From 3347727ebbf4303621bf68ba1aca5da33d09587b Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Thu, 25 May 2006 05:01:55 +0000 Subject: [PATCH 001/985] Migrating to new directory structure adopted from the RealVNC's source tree. More changes will follow. --- README_TightVNC.txt | 5 + ansi2knr.1 | 36 - ansi2knr.c | 693 --------- cderror.h | 132 -- cdjpeg.c | 181 --- cdjpeg.h | 184 --- change.log | 217 --- cjpeg.1 | 292 ---- cjpeg.c | 606 -------- ckconfig.c | 402 ------ coderules.doc | 118 -- djpeg.1 | 253 ---- djpeg.c | 616 -------- example.c | 433 ------ filelist.doc | 210 --- install.doc | 1063 -------------- jconfig.bcc | 48 - jconfig.dj | 38 - jconfig.vc => jconfig.h | 0 jconfig.mac | 43 - jconfig.manx | 43 - jconfig.mc6 | 52 - jconfig.sas | 43 - jconfig.st | 42 - jconfig.vms | 37 - jconfig.wat | 38 - jmemansi.c | 167 --- jmemdos.c | 638 --------- jmemdosa.asm | 379 ----- jmemmac.c | 289 ---- jmemname.c | 276 ---- jpeg.dsp | 320 +++++ jpegtran.1 | 238 ---- jpegtran.c | 504 ------- libjpeg.doc | 3006 --------------------------------------- ltconfig | 1512 -------------------- ltmain.sh | 2453 -------------------------------- makcjpeg.st | 38 - makdjpeg.st | 38 - makeapps.ds | 828 ----------- makefile.ansi | 214 --- makefile.bcc | 285 ---- makefile.cfg | 2 +- makefile.dj | 220 --- makefile.manx | 214 --- makefile.mc6 | 249 ---- makefile.mms | 218 --- makefile.sas | 252 ---- makefile.unix | 228 --- makefile.vc | 211 --- makefile.vms | 142 -- makefile.wat | 233 --- makelib.ds | 1046 -------------- makeproj.mac | 213 --- makljpeg.st | 70 - maktjpeg.st | 32 - makvms.opt | 4 - rdbmp.c | 439 ------ rdcolmap.c | 253 ---- rdgif.c | 38 - rdjpgcom.1 | 54 - rdjpgcom.c | 496 ------- rdppm.c | 458 ------ rdrle.c | 387 ----- rdswitch.c | 332 ----- rdtarga.c | 500 ------- structure.doc | 948 ------------ testimg.bmp | Bin 35050 -> 0 bytes testimg.jpg | Bin 5756 -> 0 bytes testimg.ppm | 4 - testimgp.jpg | Bin 5645 -> 0 bytes testorig.jpg | Bin 5770 -> 0 bytes testprog.jpg | Bin 5655 -> 0 bytes transupp.c | 928 ------------ transupp.h | 135 -- usage.doc | 562 -------- wizard.doc | 211 --- wrbmp.c | 442 ------ wrgif.c | 399 ------ wrjpgcom.1 | 103 -- wrjpgcom.c | 583 -------- wrppm.c | 268 ---- wrrle.c | 305 ---- wrtarga.c | 253 ---- 84 files changed, 326 insertions(+), 28116 deletions(-) create mode 100644 README_TightVNC.txt delete mode 100644 ansi2knr.1 delete mode 100644 ansi2knr.c delete mode 100644 cderror.h delete mode 100644 cdjpeg.c delete mode 100644 cdjpeg.h delete mode 100644 change.log delete mode 100644 cjpeg.1 delete mode 100644 cjpeg.c delete mode 100644 ckconfig.c delete mode 100644 coderules.doc delete mode 100644 djpeg.1 delete mode 100644 djpeg.c delete mode 100644 example.c delete mode 100644 filelist.doc delete mode 100644 install.doc delete mode 100644 jconfig.bcc delete mode 100644 jconfig.dj rename jconfig.vc => jconfig.h (100%) delete mode 100644 jconfig.mac delete mode 100644 jconfig.manx delete mode 100644 jconfig.mc6 delete mode 100644 jconfig.sas delete mode 100644 jconfig.st delete mode 100644 jconfig.vms delete mode 100644 jconfig.wat delete mode 100644 jmemansi.c delete mode 100644 jmemdos.c delete mode 100644 jmemdosa.asm delete mode 100644 jmemmac.c delete mode 100644 jmemname.c create mode 100644 jpeg.dsp delete mode 100644 jpegtran.1 delete mode 100644 jpegtran.c delete mode 100644 libjpeg.doc delete mode 100755 ltconfig delete mode 100644 ltmain.sh delete mode 100644 makcjpeg.st delete mode 100644 makdjpeg.st delete mode 100644 makeapps.ds delete mode 100644 makefile.ansi delete mode 100644 makefile.bcc delete mode 100644 makefile.dj delete mode 100644 makefile.manx delete mode 100644 makefile.mc6 delete mode 100644 makefile.mms delete mode 100644 makefile.sas delete mode 100644 makefile.unix delete mode 100644 makefile.vc delete mode 100644 makefile.vms delete mode 100644 makefile.wat delete mode 100644 makelib.ds delete mode 100644 makeproj.mac delete mode 100644 makljpeg.st delete mode 100644 maktjpeg.st delete mode 100644 makvms.opt delete mode 100644 rdbmp.c delete mode 100644 rdcolmap.c delete mode 100644 rdgif.c delete mode 100644 rdjpgcom.1 delete mode 100644 rdjpgcom.c delete mode 100644 rdppm.c delete mode 100644 rdrle.c delete mode 100644 rdswitch.c delete mode 100644 rdtarga.c delete mode 100644 structure.doc delete mode 100644 testimg.bmp delete mode 100644 testimg.jpg delete mode 100644 testimg.ppm delete mode 100644 testimgp.jpg delete mode 100644 testorig.jpg delete mode 100644 testprog.jpg delete mode 100644 transupp.c delete mode 100644 transupp.h delete mode 100644 usage.doc delete mode 100644 wizard.doc delete mode 100644 wrbmp.c delete mode 100644 wrgif.c delete mode 100644 wrjpgcom.1 delete mode 100644 wrjpgcom.c delete mode 100644 wrppm.c delete mode 100644 wrrle.c delete mode 100644 wrtarga.c diff --git a/README_TightVNC.txt b/README_TightVNC.txt new file mode 100644 index 00000000..72d502dc --- /dev/null +++ b/README_TightVNC.txt @@ -0,0 +1,5 @@ +This directory includes a copy of the Independent JPEG Group's JPEG +library (see the README file for more information). Not all the files +from the original distribution have been included into the TightVNC +codebase. To obtain the original library, please see the README file, +section "ARCHIVE LOCATIONS". diff --git a/ansi2knr.1 b/ansi2knr.1 deleted file mode 100644 index f9ee5a63..00000000 --- a/ansi2knr.1 +++ /dev/null @@ -1,36 +0,0 @@ -.TH ANSI2KNR 1 "19 Jan 1996" -.SH NAME -ansi2knr \- convert ANSI C to Kernighan & Ritchie C -.SH SYNOPSIS -.I ansi2knr -[--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 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). -.br - - 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 deleted file mode 100644 index 4e05fc2d..00000000 --- a/ansi2knr.c +++ /dev/null @@ -1,693 +0,0 @@ -/* ansi2knr.c */ -/* 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 -WARRANTY. No author or distributor accepts responsibility to anyone for the -consequences of using it or for whether it serves any particular purpose or -works at all, unless he says so in writing. Refer to the GNU General Public -License (the "GPL") for full details. - -Everyone is granted permission to copy, modify and redistribute ansi2knr, -but only under the conditions described in the GPL. A copy of this license -is supposed to have been given to you along with ansi2knr so you can know -your rights and responsibilities. It should be in a file named COPYLEFT. -[In the IJG distribution, the GPL appears below, not in a separate file.] -Among other things, the copyright notice and this notice must be preserved -on all copies. - -We explicitly state here what we believe is already implied by the GPL: if -the ansi2knr program is distributed as a separate set of sources and a -separate executable file which are aggregated on a storage medium together -with another program, this in itself does not bring the other program under -the GPL, nor does the mere fact that such a program or the procedures for -constructing it invoke the ansi2knr executable bring any other part of the -program under the GPL. -*/ - -/* ----------- 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 - (Clarified 11 Feb 1988) - - Copyright (C) 1988 Richard M. Stallman - Everyone is permitted to copy and distribute verbatim copies of this - license, but changing it is not allowed. You can also use this wording - to make the terms for other programs. - - The license agreements of most software companies keep you at the -mercy of those companies. By contrast, our general public license is -intended to give everyone the right to share Ghostscript. To make sure -that you get the rights we want you to have, we need to make -restrictions that forbid anyone to deny you these rights or to ask you -to surrender the rights. Hence this license agreement. - - Specifically, we want to make sure that you have the right to give -away copies of Ghostscript, that you receive source code or else can get -it if you want it, that you can change Ghostscript or use pieces of it -in new free programs, and that you know you can do these things. - - To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights. For example, if you distribute -copies of Ghostscript, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - Also, for our own protection, we must make certain that everyone finds -out that there is no warranty for Ghostscript. If Ghostscript is -modified by someone else and passed on, we want its recipients to know -that what they have is not what we distributed, so that any problems -introduced by others will not reflect on our reputation. - - Therefore we (Richard M. Stallman and the Free Software Foundation, -Inc.) make the following terms which say what you must do to be allowed -to distribute or change Ghostscript. - - - COPYING POLICIES - - 1. You may copy and distribute verbatim copies of Ghostscript source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy a valid copyright and license -notice "Copyright (C) 1989 Aladdin Enterprises. All rights reserved. -Distributed by Free Software Foundation, Inc." (or with whatever year is -appropriate); keep intact the notices on all files that refer to this -License Agreement and to the absence of any warranty; and give any other -recipients of the Ghostscript program a copy of this License Agreement -along with the program. You may charge a distribution fee for the -physical act of transferring a copy. - - 2. You may modify your copy or copies of Ghostscript or any portion of -it, and copy and distribute such modifications under the terms of -Paragraph 1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating - that you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, - that in whole or in part contains or is a derivative of Ghostscript - or any part thereof, to be licensed at no charge to all third - parties on terms identical to those contained in this License - Agreement (except that you may choose to grant more extensive - warranty protection to some or all third parties, at your option). - - c) You may charge a distribution fee for the physical act of - transferring a copy, and you may at your option offer warranty - protection in exchange for a fee. - -Mere aggregation of another unrelated program with this program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other program under the scope of these terms. - - 3. You may copy and distribute Ghostscript (or a portion or derivative -of it, under Paragraph 2) in object code or executable form under the -terms of Paragraphs 1 and 2 above provided that you also do one of the -following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal - shipping charge) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -For an executable file, complete source code means all the source code for -all modules it contains; but, as a special exception, it need not include -source code for modules which are standard libraries that accompany the -operating system on which the executable file runs. - - 4. You may not copy, sublicense, distribute or transfer Ghostscript -except as expressly provided under this License Agreement. Any attempt -otherwise to copy, sublicense, distribute or transfer Ghostscript is -void and your rights to use the program under this License agreement -shall be automatically terminated. However, parties who have received -computer software programs from you with this License Agreement will not -have their licenses terminated so long as such parties remain in full -compliance. - - 5. If you wish to incorporate parts of Ghostscript into other free -programs whose distribution conditions are different, write to the Free -Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not -yet worked out a simple rule that can be stated here, but we will often -permit this. We will be guided by the two goals of preserving the free -status of all derivatives of our free software and of promoting the -sharing and reuse of software. - -Your comments and suggestions about our licensing policies and our -software are welcome! Please contact the Free Software Foundation, -Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296. - - NO WARRANTY - - BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT -WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD -M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES -PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH -YOU. SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. -STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN -ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE -GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE -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 COPYLEFT ------------------------------ -*/ - -/* - * Usage: - ansi2knr input_file [output_file] - * If no output_file is supplied, output goes to stdout. - * There are no error messages. - * - * 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). - * - 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) (is_alnum(ch) || (ch) == '_') -#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') - -/* Forward references */ -char *skipspace(); -int writeblanks(); -int test1(); -int convert1(); - -/* The main program */ -int -main(argc, argv) - int argc; - char *argv[]; -{ FILE *in, *out; -#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; - case 3: - out = fopen(argv[2], "w"); - if ( out == NULL ) - { fprintf(stderr, "Cannot open output file %s\n", argv[2]); - exit(1); - } - } - in = fopen(argv[1], "r"); - if ( in == NULL ) - { 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 ) - { -test: line += strlen(line); - switch ( test1(buf) ) - { - case 2: /* a function header */ - convert1(buf, out, 1, convert_varargs); - break; - case 1: /* a function */ - /* 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 */ - if ( line != buf + (bufsize - 1) ) /* overflow check */ - continue; - /* falls through */ - default: /* not a function */ -wl: fputs(buf, out); - break; - } - line = buf; - } - if ( line != buf ) - fputs(buf, out); - free(buf); - fclose(out); - fclose(in); - return 0; -} - -/* Skip over space and comments, in either direction. */ -char * -skipspace(p, dir) - register char *p; - register int dir; /* 1 for forward, -1 for backward */ -{ for ( ; ; ) - { 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?? */ - p += dir; - } - p += dir; p += dir; - } - return p; -} - -/* - * 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++ ) - if ( *p != '\r' && *p != '\n' ) - *p = ' '; - return 0; -} - -/* - * Test whether the string in buf is a function definition. - * The string may contain and/or end with a newline. - * 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) - char *buf; -{ register char *p = buf; - char *bend; - char *endfn; - int contin; - - if ( !isidfirstchar(*p) ) - return 0; /* no name at left margin */ - bend = skipspace(buf + strlen(buf) - 1, -1); - switch ( *bend ) - { - 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++; - endfn = p; - p = skipspace(p, 1); - if ( *p++ != '(' ) - return 0; /* not a function */ - p = skipspace(p, 1); - if ( *p == ')' ) - 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). */ - { static char *words[] = - { "asm", "auto", "case", "char", "const", "double", - "extern", "float", "for", "if", "int", "long", - "register", "return", "short", "signed", "sizeof", - "static", "switch", "typedef", "unsigned", - "void", "volatile", "while", 0 - }; - 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 */ - key++; - } - } - return contin; -} - -/* Convert a recognized function definition or header to K&R syntax. */ -int -convert1(buf, out, header, convert_varargs) - char *buf; - FILE *out; - int header; /* Boolean */ - int convert_varargs; /* Boolean */ -{ char *endfn; - register char *p; - char **breaks; - unsigned num_breaks = 2; /* for testing */ - 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++) != '('; ) - ; -top: p = endfn; - breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); - if ( breaks == 0 ) - { /* Couldn't allocate break table, give up */ - fprintf(stderr, "Unable to allocate break table!\n"); - fputs(buf, out); - return -1; - } - btop = breaks + num_breaks * 2 - 2; - bp = breaks; - /* 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. */ - free((char *)breaks); - num_breaks <<= 1; - goto top; - } - *bp++ = p; - /* Find the end of the argument */ - for ( ; end == NULL; p++ ) - { switch(*p) - { - 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 */ - /* array modifiers. */ - for ( ; ; ) - { p = skipspace(p - 1, -1); - switch ( *p ) - { - 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: ; - } - } - if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) - { /* We found the name being declared */ - while ( !isidfirstchar(*p) ) - p = skipspace(p, 1) + 1; - goto found; - } - break; - default: - goto found; - } - } -found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) - { if ( convert_varargs ) - { *bp++ = "va_alist"; - vararg = p-2; - } - else - { p++; - if ( bp == breaks + 1 ) /* sole argument */ - writeblanks(breaks[0], p); - else - writeblanks(bp[-1] - 1, p); - bp--; - } - } - else - { while ( isidchar(*p) ) p--; - *bp++ = p+1; - } - p = end; - } - while ( *p++ == ',' ); - *bp = p; - /* Make a special check for 'void' arglist */ - if ( bp == breaks+2 ) - { p = skipspace(breaks[0], 1); - if ( !strncmp(p, "void", 4) ) - { p = skipspace(p+4, 1); - if ( p == breaks[2] - 1 ) - { bp = breaks; /* yup, pretend arglist is empty */ - writeblanks(breaks[0], p + 1); - } - } - } - /* Put out the function name and left parenthesis. */ - p = buf; - while ( p != endfn ) putc(*p, out), p++; - /* 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/cderror.h b/cderror.h deleted file mode 100644 index 70435e16..00000000 --- a/cderror.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * cderror.h - * - * Copyright (C) 1994-1997, 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. - * - * This file defines the error and message codes for the cjpeg/djpeg - * applications. These strings are not needed as part of the JPEG library - * proper. - * Edit this file to add new codes, or to translate the message strings to - * some other language. - */ - -/* - * To define the enum list of message codes, include this file without - * defining macro JMESSAGE. To create a message string table, include it - * again with a suitable JMESSAGE definition (see jerror.c for an example). - */ -#ifndef JMESSAGE -#ifndef CDERROR_H -#define CDERROR_H -/* First time through, define the enum list */ -#define JMAKE_ENUM_LIST -#else -/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ -#define JMESSAGE(code,string) -#endif /* CDERROR_H */ -#endif /* JMESSAGE */ - -#ifdef JMAKE_ENUM_LIST - -typedef enum { - -#define JMESSAGE(code,string) code , - -#endif /* JMAKE_ENUM_LIST */ - -JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ - -#ifdef BMP_SUPPORTED -JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") -JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") -JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") -JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") -JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") -JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") -JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") -JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") -JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") -JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") -JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") -#endif /* BMP_SUPPORTED */ - -#ifdef GIF_SUPPORTED -JMESSAGE(JERR_GIF_BUG, "GIF output got confused") -JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") -JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") -JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") -JMESSAGE(JERR_GIF_NOT, "Not a GIF file") -JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") -JMESSAGE(JTRC_GIF_BADVERSION, - "Warning: unexpected GIF version number '%c%c%c'") -JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") -JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") -JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") -JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") -JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") -JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") -#endif /* GIF_SUPPORTED */ - -#ifdef PPM_SUPPORTED -JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") -JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") -JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") -JMESSAGE(JTRC_PGM, "%ux%u PGM image") -JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") -JMESSAGE(JTRC_PPM, "%ux%u PPM image") -JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") -#endif /* PPM_SUPPORTED */ - -#ifdef RLE_SUPPORTED -JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") -JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") -JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") -JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") -JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") -JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") -JMESSAGE(JERR_RLE_NOT, "Not an RLE file") -JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") -JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") -JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") -JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") -JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") -JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") -JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") -#endif /* RLE_SUPPORTED */ - -#ifdef TARGA_SUPPORTED -JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") -JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") -JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") -JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") -JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") -JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") -#else -JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") -#endif /* TARGA_SUPPORTED */ - -JMESSAGE(JERR_BAD_CMAP_FILE, - "Color map file is invalid or of unsupported format") -JMESSAGE(JERR_TOO_MANY_COLORS, - "Output file format cannot handle %d colormap entries") -JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") -#ifdef TARGA_SUPPORTED -JMESSAGE(JERR_UNKNOWN_FORMAT, - "Unrecognized input file format --- perhaps you need -targa") -#else -JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") -#endif -JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") - -#ifdef JMAKE_ENUM_LIST - - JMSG_LASTADDONCODE -} ADDON_MESSAGE_CODE; - -#undef JMAKE_ENUM_LIST -#endif /* JMAKE_ENUM_LIST */ - -/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ -#undef JMESSAGE diff --git a/cdjpeg.c b/cdjpeg.c deleted file mode 100644 index b6250ff9..00000000 --- a/cdjpeg.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * cdjpeg.c - * - * Copyright (C) 1991-1997, 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. - * - * This file contains common support routines used by the IJG application - * programs (cjpeg, djpeg, jpegtran). - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include /* to declare isupper(), tolower() */ -#ifdef NEED_SIGNAL_CATCHER -#include /* to declare signal() */ -#endif -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - - -/* - * Signal catcher to ensure that temporary files are removed before aborting. - * NB: for Amiga Manx C this is actually a global routine named _abort(); - * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... - */ - -#ifdef NEED_SIGNAL_CATCHER - -static j_common_ptr sig_cinfo; - -void /* must be global for Manx C */ -signal_catcher (int signum) -{ - if (sig_cinfo != NULL) { - if (sig_cinfo->err != NULL) /* turn off trace output */ - sig_cinfo->err->trace_level = 0; - jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ - } - exit(EXIT_FAILURE); -} - - -GLOBAL(void) -enable_signal_catcher (j_common_ptr cinfo) -{ - sig_cinfo = cinfo; -#ifdef SIGINT /* not all systems have SIGINT */ - signal(SIGINT, signal_catcher); -#endif -#ifdef SIGTERM /* not all systems have SIGTERM */ - signal(SIGTERM, signal_catcher); -#endif -} - -#endif - - -/* - * Optional progress monitor: display a percent-done figure on stderr. - */ - -#ifdef PROGRESS_REPORT - -METHODDEF(void) -progress_monitor (j_common_ptr cinfo) -{ - cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; - int total_passes = prog->pub.total_passes + prog->total_extra_passes; - int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); - - if (percent_done != prog->percent_done) { - prog->percent_done = percent_done; - if (total_passes > 1) { - fprintf(stderr, "\rPass %d/%d: %3d%% ", - prog->pub.completed_passes + prog->completed_extra_passes + 1, - total_passes, percent_done); - } else { - fprintf(stderr, "\r %3d%% ", percent_done); - } - fflush(stderr); - } -} - - -GLOBAL(void) -start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) -{ - /* Enable progress display, unless trace output is on */ - if (cinfo->err->trace_level == 0) { - progress->pub.progress_monitor = progress_monitor; - progress->completed_extra_passes = 0; - progress->total_extra_passes = 0; - progress->percent_done = -1; - cinfo->progress = &progress->pub; - } -} - - -GLOBAL(void) -end_progress_monitor (j_common_ptr cinfo) -{ - /* Clear away progress display */ - if (cinfo->err->trace_level == 0) { - fprintf(stderr, "\r \r"); - fflush(stderr); - } -} - -#endif - - -/* - * Case-insensitive matching of possibly-abbreviated keyword switches. - * keyword is the constant keyword (must be lower case already), - * minchars is length of minimum legal abbreviation. - */ - -GLOBAL(boolean) -keymatch (char * arg, const char * keyword, int minchars) -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return FALSE; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return FALSE; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return FALSE; - return TRUE; /* A-OK */ -} - - -/* - * Routines to establish binary I/O mode for stdin and stdout. - * Non-Unix systems often require some hacking to get out of text mode. - */ - -GLOBAL(FILE *) -read_stdin (void) -{ - FILE * input_file = stdin; - -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { - fprintf(stderr, "Cannot reopen stdin\n"); - exit(EXIT_FAILURE); - } -#endif - return input_file; -} - - -GLOBAL(FILE *) -write_stdout (void) -{ - FILE * output_file = stdout; - -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdout), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { - fprintf(stderr, "Cannot reopen stdout\n"); - exit(EXIT_FAILURE); - } -#endif - return output_file; -} diff --git a/cdjpeg.h b/cdjpeg.h deleted file mode 100644 index 2b387b6e..00000000 --- a/cdjpeg.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * cdjpeg.h - * - * Copyright (C) 1994-1997, 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. - * - * This file contains common declarations for the sample applications - * cjpeg and djpeg. It is NOT used by the core JPEG library. - */ - -#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ -#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ -#include "jinclude.h" -#include "jpeglib.h" -#include "jerror.h" /* get library error codes too */ -#include "cderror.h" /* get application-specific error codes */ - - -/* - * Object interface for cjpeg's source file decoding modules - */ - -typedef struct cjpeg_source_struct * cjpeg_source_ptr; - -struct cjpeg_source_struct { - JMETHOD(void, start_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); - JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); - JMETHOD(void, finish_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); - - FILE *input_file; - - JSAMPARRAY buffer; - JDIMENSION buffer_height; -}; - - -/* - * Object interface for djpeg's output file encoding modules - */ - -typedef struct djpeg_dest_struct * djpeg_dest_ptr; - -struct djpeg_dest_struct { - /* start_output is called after jpeg_start_decompress finishes. - * The color map will be ready at this time, if one is needed. - */ - JMETHOD(void, start_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); - /* Emit the specified number of pixel rows from the buffer. */ - JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); - /* Finish up at the end of the image. */ - JMETHOD(void, finish_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); - - /* Target file spec; filled in by djpeg.c after object is created. */ - FILE * output_file; - - /* Output pixel-row buffer. Created by module init or start_output. - * Width is cinfo->output_width * cinfo->output_components; - * height is buffer_height. - */ - JSAMPARRAY buffer; - JDIMENSION buffer_height; -}; - - -/* - * cjpeg/djpeg may need to perform extra passes to convert to or from - * the source/destination file format. The JPEG library does not know - * about these passes, but we'd like them to be counted by the progress - * monitor. We use an expanded progress monitor object to hold the - * additional pass count. - */ - -struct cdjpeg_progress_mgr { - struct jpeg_progress_mgr pub; /* fields known to JPEG library */ - int completed_extra_passes; /* extra passes completed */ - int total_extra_passes; /* total extra */ - /* last printed percentage stored here to avoid multiple printouts */ - int percent_done; -}; - -typedef struct cdjpeg_progress_mgr * cd_progress_ptr; - - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_read_bmp jIRdBMP -#define jinit_write_bmp jIWrBMP -#define jinit_read_gif jIRdGIF -#define jinit_write_gif jIWrGIF -#define jinit_read_ppm jIRdPPM -#define jinit_write_ppm jIWrPPM -#define jinit_read_rle jIRdRLE -#define jinit_write_rle jIWrRLE -#define jinit_read_targa jIRdTarga -#define jinit_write_targa jIWrTarga -#define read_quant_tables RdQTables -#define read_scan_script RdScnScript -#define set_quant_slots SetQSlots -#define set_sample_factors SetSFacts -#define read_color_map RdCMap -#define enable_signal_catcher EnSigCatcher -#define start_progress_monitor StProgMon -#define end_progress_monitor EnProgMon -#define read_stdin RdStdin -#define write_stdout WrStdout -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - -/* 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)); - -/* 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)); - -/* djpeg support routines (in rdcolmap.c) */ - -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)); - -/* miscellaneous useful macros */ - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif -#ifndef EXIT_WARNING -#ifdef VMS -#define EXIT_WARNING 1 /* VMS is very nonstandard */ -#else -#define EXIT_WARNING 2 -#endif -#endif diff --git a/change.log b/change.log deleted file mode 100644 index 74102c0d..00000000 --- a/change.log +++ /dev/null @@ -1,217 +0,0 @@ -CHANGE LOG for Independent JPEG Group's JPEG software - - -Version 6b 27-Mar-1998 ------------------------ - -jpegtran has new features for lossless image transformations (rotation -and flipping) as well as "lossless" reduction to grayscale. - -jpegtran now copies comments by default; it has a -copy switch to enable -copying all APPn blocks as well, or to suppress comments. (Formerly it -always suppressed comments and APPn blocks.) jpegtran now also preserves -JFIF version and resolution information. - -New decompressor library feature: COM and APPn markers found in the input -file can be saved in memory for later use by the application. (Before, -you had to code this up yourself with a custom marker processor.) - -There is an unused field "void * client_data" now in compress and decompress -parameter structs; this may be useful in some applications. - -JFIF version number information is now saved by the decoder and accepted by -the encoder. jpegtran uses this to copy the source file's version number, -to ensure "jpegtran -copy all" won't create bogus files that contain JFXX -extensions but claim to be version 1.01. Applications that generate their -own JFXX extension markers also (finally) have a supported way to cause the -encoder to emit JFIF version number 1.02. - -djpeg's trace mode reports JFIF 1.02 thumbnail images as such, rather -than as unknown APP0 markers. - -In -verbose mode, djpeg and rdjpgcom will try to print the contents of -APP12 markers as text. Some digital cameras store useful text information -in APP12 markers. - -Handling of truncated data streams is more robust: blocks beyond the one in -which the error occurs will be output as uniform gray, or left unchanged -if decoding a progressive JPEG. The appearance no longer depends on the -Huffman tables being used. - -Huffman tables are checked for validity much more carefully than before. - -To avoid the Unisys LZW patent, djpeg's GIF output capability has been -changed to produce "uncompressed GIFs", and cjpeg's GIF input capability -has been removed altogether. We're not happy about it either, but there -seems to be no good alternative. - -The configure script now supports building libjpeg as a shared library -on many flavors of Unix (all the ones that GNU libtool knows how to -build shared libraries for). Use "./configure --enable-shared" to -try this out. - -New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio. -Also, a jconfig file and a build script for Metrowerks CodeWarrior -on Apple Macintosh. makefile.dj has been updated for DJGPP v2, and there -are miscellaneous other minor improvements in the makefiles. - -jmemmac.c now knows how to create temporary files following Mac System 7 -conventions. - -djpeg's -map switch is now able to read raw-format PPM files reliably. - -cjpeg -progressive -restart no longer generates any unnecessary DRI markers. - -Multiple calls to jpeg_simple_progression for a single JPEG object -no longer leak memory. - - -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 -------------------- - -Progressive JPEG support: library can read and write full progressive JPEG -files. A "buffered image" mode supports incremental decoding for on-the-fly -display of progressive images. Simply recompiling an existing IJG-v5-based -decoder with v6 should allow it to read progressive files, though of course -without any special progressive display. - -New "jpegtran" application performs lossless transcoding between different -JPEG formats; primarily, it can be used to convert baseline to progressive -JPEG and vice versa. In support of jpegtran, the library now allows lossless -reading and writing of JPEG files as DCT coefficient arrays. This ability -may be of use in other applications. - -Notes for programmers: -* We changed jpeg_start_decompress() to be able to suspend; this makes all -decoding modes available to suspending-input applications. However, -existing applications that use suspending input will need to be changed -to check the return value from jpeg_start_decompress(). You don't need to -do anything if you don't use a suspending data source. -* We changed the interface to the virtual array routines: access_virt_array -routines now take a count of the number of rows to access this time. The -last parameter to request_virt_array routines is now interpreted as the -maximum number of rows that may be accessed at once, but not necessarily -the height of every access. - - -Version 5b 15-Mar-95 ---------------------- - -Correct bugs with grayscale images having v_samp_factor > 1. - -jpeg_write_raw_data() now supports output suspension. - -Correct bugs in "configure" script for case of compiling in -a directory other than the one containing the source files. - -Repair bug in jquant1.c: sometimes didn't use as many colors as it could. - -Borland C makefile and jconfig file work under either MS-DOS or OS/2. - -Miscellaneous improvements to documentation. - - -Version 5a 7-Dec-94 --------------------- - -Changed color conversion roundoff behavior so that grayscale values are -represented exactly. (This causes test image files to change.) - -Make ordered dither use 16x16 instead of 4x4 pattern for a small quality -improvement. - -New configure script based on latest GNU Autoconf. -Fix configure script to handle CFLAGS correctly. -Rename *.auto files to *.cfg, so that configure script still works if -file names have been truncated for DOS. - -Fix bug in rdbmp.c: didn't allow for extra data between header and image. - -Modify rdppm.c/wrppm.c to handle 2-byte raw PPM/PGM formats for 12-bit data. - -Fix several bugs in rdrle.c. - -NEED_SHORT_EXTERNAL_NAMES option was broken. - -Revise jerror.h/jerror.c for more flexibility in message table. - -Repair oversight in jmemname.c NO_MKTEMP case: file could be there -but unreadable. - - -Version 5 24-Sep-94 --------------------- - -Version 5 represents a nearly complete redesign and rewrite of the IJG -software. Major user-visible changes include: - * Automatic configuration simplifies installation for most Unix systems. - * A range of speed vs. image quality tradeoffs are supported. - This includes resizing of an image during decompression: scaling down - by a factor of 1/2, 1/4, or 1/8 is handled very efficiently. - * New programs rdjpgcom and wrjpgcom allow insertion and extraction - of text comments in a JPEG file. - -The application programmer's interface to the library has changed completely. -Notable improvements include: - * We have eliminated the use of callback routines for handling the - uncompressed image data. The application now sees the library as a - set of routines that it calls to read or write image data on a - scanline-by-scanline basis. - * The application image data is represented in a conventional interleaved- - pixel format, rather than as a separate array for each color channel. - This can save a copying step in many programs. - * The handling of compressed data has been cleaned up: the application can - supply routines to source or sink the compressed data. It is possible to - suspend processing on source/sink buffer overrun, although this is not - supported in all operating modes. - * All static state has been eliminated from the library, so that multiple - instances of compression or decompression can be active concurrently. - * JPEG abbreviated datastream formats are supported, ie, quantization and - Huffman tables can be stored separately from the image data. - * And not only that, but the documentation of the library has improved - considerably! - - -The last widely used release before the version 5 rewrite was version 4A of -18-Feb-93. Change logs before that point have been discarded, since they -are not of much interest after the rewrite. diff --git a/cjpeg.1 b/cjpeg.1 deleted file mode 100644 index d175a961..00000000 --- a/cjpeg.1 +++ /dev/null @@ -1,292 +0,0 @@ -.TH CJPEG 1 "20 March 1998" -.SH NAME -cjpeg \- compress an image file to a JPEG file -.SH SYNOPSIS -.B cjpeg -[ -.I options -] -[ -.I filename -] -.LP -.SH DESCRIPTION -.LP -.B cjpeg -compresses the named image file, or the standard input if no file is -named, and produces a JPEG/JFIF file on the standard output. -The currently supported input file formats are: PPM (PBMPLUS color -format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster -Toolkit format). (RLE is supported only if the URT library is available.) -.SH OPTIONS -All switch names may be abbreviated; for example, -.B \-grayscale -may be written -.B \-gray -or -.BR \-gr . -Most of the "basic" switches can be abbreviated to as little as one letter. -Upper and lower case are equivalent (thus -.B \-BMP -is the same as -.BR \-bmp ). -British spellings are also accepted (e.g., -.BR \-greyscale ), -though for brevity these are not mentioned below. -.PP -The basic switches are: -.TP -.BI \-quality " N" -Scale quantization tables to adjust image quality. Quality is 0 (worst) to -100 (best); default is 75. (See below for more info.) -.TP -.B \-grayscale -Create monochrome JPEG file from color input. Be sure to use this switch when -compressing a grayscale BMP file, because -.B cjpeg -isn't bright enough to notice whether a BMP file uses only shades of gray. -By saying -.BR \-grayscale , -you'll get a smaller JPEG file that takes less time to process. -.TP -.B \-optimize -Perform optimization of entropy encoding parameters. Without this, default -encoding parameters are used. -.B \-optimize -usually makes the JPEG file a little smaller, but -.B cjpeg -runs somewhat slower and needs much more memory. Image quality and speed of -decompression are unaffected by -.BR \-optimize . -.TP -.B \-progressive -Create progressive JPEG file (see below). -.TP -.B \-targa -Input file is Targa format. Targa files that contain an "identification" -field will not be automatically recognized by -.BR cjpeg ; -for such files you must specify -.B \-targa -to make -.B cjpeg -treat the input as Targa format. -For most Targa files, you won't need this switch. -.PP -The -.B \-quality -switch lets you trade off compressed file size against quality of the -reconstructed image: the higher the quality setting, the larger the JPEG file, -and the closer the output image will be to the original input. Normally you -want to use the lowest quality setting (smallest file) that decompresses into -something visually indistinguishable from the original image. For this -purpose the quality setting should be between 50 and 95; the default of 75 is -often about right. If you see defects at -.B \-quality -75, then go up 5 or 10 counts at a time until you are happy with the output -image. (The optimal setting will vary from one image to another.) -.PP -.B \-quality -100 will generate a quantization table of all 1's, minimizing loss in the -quantization step (but there is still information loss in subsampling, as well -as roundoff error). This setting is mainly of interest for experimental -purposes. Quality values above about 95 are -.B not -recommended for normal use; the compressed file size goes up dramatically for -hardly any gain in output image quality. -.PP -In the other direction, quality values below 50 will produce very small files -of low image quality. Settings around 5 to 10 might be useful in preparing an -index of a large image library, for example. Try -.B \-quality -2 (or so) for some amusing Cubist effects. (Note: quality -values below about 25 generate 2-byte quantization tables, which are -considered optional in the JPEG standard. -.B cjpeg -emits a warning message when you give such a quality value, because some -other JPEG programs may be unable to decode the resulting file. Use -.B \-baseline -if you need to ensure compatibility at low quality values.) -.PP -The -.B \-progressive -switch creates a "progressive JPEG" file. In this type of JPEG file, the data -is stored in multiple scans of increasing quality. If the file is being -transmitted over a slow communications link, the decoder can use the first -scan to display a low-quality image very quickly, and can then improve the -display with each subsequent scan. The final image is exactly equivalent to a -standard JPEG file of the same quality setting, and the total file size is -about the same --- often a little smaller. -.B Caution: -progressive JPEG is not yet widely implemented, so many decoders will be -unable to view a progressive JPEG file at all. -.PP -Switches for advanced users: -.TP -.B \-dct int -Use integer DCT method (default). -.TP -.B \-dct fast -Use fast integer DCT (less accurate). -.TP -.B \-dct float -Use floating-point DCT method. -The float method is very slightly more accurate than the int method, but is -much slower unless your machine has very fast floating-point hardware. Also -note that results of the floating-point method may vary slightly across -machines, while the integer methods should give the same results everywhere. -The fast integer method is much less accurate than the other two. -.TP -.BI \-restart " N" -Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is -attached to the number. -.B \-restart 0 -(the default) means no restart markers. -.TP -.BI \-smooth " N" -Smooth the input image to eliminate dithering noise. N, ranging from 1 to -100, indicates the strength of smoothing. 0 (the default) means no smoothing. -.TP -.BI \-maxmemory " N" -Set limit for amount of memory to use in processing large images. Value is -in thousands of bytes, or millions of bytes if "M" is attached to the -number. For example, -.B \-max 4m -selects 4000000 bytes. If more space is needed, temporary files will be used. -.TP -.BI \-outfile " name" -Send output image to the named file, not to standard output. -.TP -.B \-verbose -Enable debug printout. More -.BR \-v 's -give more output. Also, version information is printed at startup. -.TP -.B \-debug -Same as -.BR \-verbose . -.PP -The -.B \-restart -option inserts extra markers that allow a JPEG decoder to resynchronize after -a transmission error. Without restart markers, any damage to a compressed -file will usually ruin the image from the point of the error to the end of the -image; with restart markers, the damage is usually confined to the portion of -the image up to the next restart marker. Of course, the restart markers -occupy extra space. We recommend -.B \-restart 1 -for images that will be transmitted across unreliable networks such as Usenet. -.PP -The -.B \-smooth -option filters the input to eliminate fine-scale noise. This is often useful -when converting dithered images to JPEG: a moderate smoothing factor of 10 to -50 gets rid of dithering patterns in the input file, resulting in a smaller -JPEG file and a better-looking image. Too large a smoothing factor will -visibly blur the image, however. -.PP -Switches for wizards: -.TP -.B \-baseline -Force baseline-compatible quantization tables to be generated. This clamps -quantization values to 8 bits even at low quality settings. (This switch is -poorly named, since it does not ensure that the output is actually baseline -JPEG. For example, you can use -.B \-baseline -and -.B \-progressive -together.) -.TP -.BI \-qtables " file" -Use the quantization tables given in the specified text file. -.TP -.BI \-qslots " N[,...]" -Select which quantization table to use for each color component. -.TP -.BI \-sample " HxV[,...]" -Set JPEG sampling factors for each color component. -.TP -.BI \-scans " file" -Use the scan script given in the specified text file. -.PP -The "wizard" switches are intended for experimentation with JPEG. If you -don't know what you are doing, \fBdon't use them\fR. These switches are -documented further in the file wizard.doc. -.SH EXAMPLES -.LP -This example compresses the PPM file foo.ppm with a quality factor of -60 and saves the output as foo.jpg: -.IP -.B cjpeg \-quality -.I 60 foo.ppm -.B > -.I foo.jpg -.SH HINTS -Color GIF files are not the ideal input for JPEG; JPEG is really intended for -compressing full-color (24-bit) images. In particular, don't try to convert -cartoons, line drawings, and other images that have only a few distinct -colors. GIF works great on these, JPEG does not. If you want to convert a -GIF to JPEG, you should experiment with -.BR cjpeg 's -.B \-quality -and -.B \-smooth -options to get a satisfactory conversion. -.B \-smooth 10 -or so is often helpful. -.PP -Avoid running an image through a series of JPEG compression/decompression -cycles. Image quality loss will accumulate; after ten or so cycles the image -may be noticeably worse than it was after one cycle. It's best to use a -lossless format while manipulating an image, then convert to JPEG format when -you are ready to file the image away. -.PP -The -.B \-optimize -option to -.B cjpeg -is worth using when you are making a "final" version for posting or archiving. -It's also a win when you are using low quality settings to make very small -JPEG files; the percentage improvement is often a lot more than it is on -larger files. (At present, -.B \-optimize -mode is always selected when generating progressive JPEG files.) -.SH ENVIRONMENT -.TP -.B JPEGMEM -If this environment variable is set, its value is the default memory limit. -The value is specified as described for the -.B \-maxmemory -switch. -.B JPEGMEM -overrides the default value specified when the program was compiled, and -itself is overridden by an explicit -.BR \-maxmemory . -.SH SEE ALSO -.BR djpeg (1), -.BR jpegtran (1), -.BR rdjpgcom (1), -.BR wrjpgcom (1) -.br -.BR ppm (5), -.BR pgm (5) -.br -Wallace, Gregory K. "The JPEG Still Picture Compression Standard", -Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. -.SH AUTHOR -Independent JPEG Group -.SH BUGS -Arithmetic coding is not supported for legal reasons. -.PP -GIF input files are no longer supported, to avoid the Unisys LZW patent. -Use a Unisys-licensed program if you need to read a GIF file. (Conversion -of GIF files to JPEG is usually a bad idea anyway.) -.PP -Not all variants of BMP and Targa file formats are supported. -.PP -The -.B \-targa -switch is not a bug, it's a feature. (It would be a bug if the Targa format -designers had not been clueless.) -.PP -Still not as fast as we'd like. diff --git a/cjpeg.c b/cjpeg.c deleted file mode 100644 index f2a929f0..00000000 --- a/cjpeg.c +++ /dev/null @@ -1,606 +0,0 @@ -/* - * cjpeg.c - * - * Copyright (C) 1991-1998, 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. - * - * This file contains a command-line user interface for the JPEG compressor. - * It should work on any system with Unix- or MS-DOS-style command lines. - * - * Two different command line styles are permitted, depending on the - * compile-time switch TWO_FILE_COMMANDLINE: - * cjpeg [options] inputfile outputfile - * cjpeg [options] [inputfile] - * In the second style, output is always to standard output, which you'd - * normally redirect to a file or pipe to some other program. Input is - * either from a named file or from standard input (typically redirected). - * The second style is convenient on Unix but is unhelpful on systems that - * don't support pipes. Also, you MUST use the first style if your system - * doesn't do binary I/O to stdin/stdout. - * To simplify script writing, the "-outfile" switch is provided. The syntax - * cjpeg [options] -outfile outputfile inputfile - * works regardless of which command line style is used. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "jversion.h" /* for version message */ - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - - -/* Create the add-on message string table. */ - -#define JMESSAGE(code,string) string , - -static const char * const cdjpeg_message_table[] = { -#include "cderror.h" - NULL -}; - - -/* - * This routine determines what format the input file is, - * and selects the appropriate input-reading module. - * - * To determine which family of input formats the file belongs to, - * we may look only at the first byte of the file, since C does not - * guarantee that more than one character can be pushed back with ungetc. - * Looking at additional bytes would require one of these approaches: - * 1) assume we can fseek() the input file (fails for piped input); - * 2) assume we can push back more than one character (works in - * some C implementations, but unportable); - * 3) provide our own buffering (breaks input readers that want to use - * stdio directly, such as the RLE library); - * or 4) don't put back the data, and modify the input_init methods to assume - * they start reading after the start of file (also breaks RLE library). - * #1 is attractive for MS-DOS but is untenable on Unix. - * - * The most portable solution for file types that can't be identified by their - * first byte is to make the user tell us what they are. This is also the - * only approach for "raw" file types that contain only arbitrary values. - * We presently apply this method for Targa files. Most of the time Targa - * files start with 0x00, so we recognize that case. Potentially, however, - * a Targa file could start with any byte value (byte 0 is the length of the - * seldom-used ID field), so we provide a switch to force Targa input mode. - */ - -static boolean is_targa; /* records user -targa switch */ - - -LOCAL(cjpeg_source_ptr) -select_file_type (j_compress_ptr cinfo, FILE * infile) -{ - int c; - - if (is_targa) { -#ifdef TARGA_SUPPORTED - return jinit_read_targa(cinfo); -#else - ERREXIT(cinfo, JERR_TGA_NOTCOMP); -#endif - } - - if ((c = getc(infile)) == EOF) - ERREXIT(cinfo, JERR_INPUT_EMPTY); - if (ungetc(c, infile) == EOF) - ERREXIT(cinfo, JERR_UNGETC_FAILED); - - switch (c) { -#ifdef BMP_SUPPORTED - case 'B': - return jinit_read_bmp(cinfo); -#endif -#ifdef GIF_SUPPORTED - case 'G': - return jinit_read_gif(cinfo); -#endif -#ifdef PPM_SUPPORTED - case 'P': - return jinit_read_ppm(cinfo); -#endif -#ifdef RLE_SUPPORTED - case 'R': - return jinit_read_rle(cinfo); -#endif -#ifdef TARGA_SUPPORTED - case 0x00: - return jinit_read_targa(cinfo); -#endif - default: - ERREXIT(cinfo, JERR_UNKNOWN_FORMAT); - break; - } - - return NULL; /* suppress compiler warnings */ -} - - -/* - * Argument-parsing code. - * The switch parser is designed to be useful with DOS-style command line - * syntax, ie, intermixed switches and file names, where only the switches - * to the left of a given file name affect processing of that file. - * The main program in this file doesn't actually use this capability... - */ - - -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ - - -LOCAL(void) -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "usage: %s [switches] ", progname); -#ifdef TWO_FILE_COMMANDLINE - fprintf(stderr, "inputfile outputfile\n"); -#else - fprintf(stderr, "[inputfile]\n"); -#endif - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -quality N Compression quality (0..100; 5-95 is useful range)\n"); - fprintf(stderr, " -grayscale Create monochrome JPEG file\n"); -#ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); -#endif -#ifdef C_PROGRESSIVE_SUPPORTED - fprintf(stderr, " -progressive Create progressive JPEG file\n"); -#endif -#ifdef TARGA_SUPPORTED - fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n"); -#endif - fprintf(stderr, "Switches for advanced users:\n"); -#ifdef DCT_ISLOW_SUPPORTED - fprintf(stderr, " -dct int Use integer DCT method%s\n", - (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); -#endif -#ifdef DCT_IFAST_SUPPORTED - fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", - (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); -#endif -#ifdef DCT_FLOAT_SUPPORTED - fprintf(stderr, " -dct float Use floating-point DCT method%s\n", - (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); -#endif - fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); -#ifdef INPUT_SMOOTHING_SUPPORTED - fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n"); -#endif - fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); - fprintf(stderr, " -outfile name Specify name for output file\n"); - fprintf(stderr, " -verbose or -debug Emit debug output\n"); - fprintf(stderr, "Switches for wizards:\n"); -#ifdef C_ARITH_CODING_SUPPORTED - fprintf(stderr, " -arithmetic Use arithmetic coding\n"); -#endif - fprintf(stderr, " -baseline Force baseline quantization tables\n"); - fprintf(stderr, " -qtables file Use quantization tables given in file\n"); - fprintf(stderr, " -qslots N[,...] Set component quantization tables\n"); - fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n"); -#ifdef C_MULTISCAN_FILES_SUPPORTED - fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); -#endif - exit(EXIT_FAILURE); -} - - -LOCAL(int) -parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) -/* Parse optional switches. - * Returns argv[] index of first file-name argument (== argc if none). - * Any file names with indexes <= last_file_arg_seen are ignored; - * they have presumably been processed in a previous iteration. - * (Pass 0 for last_file_arg_seen on the first or only iteration.) - * for_real is FALSE on the first (dummy) pass; we may skip any expensive - * processing. - */ -{ - int argn; - char * arg; - int quality; /* -quality parameter */ - int q_scale_factor; /* scaling percentage for -qtables */ - boolean force_baseline; - boolean simple_progressive; - char * qtablefile = NULL; /* saves -qtables filename if any */ - char * qslotsarg = NULL; /* saves -qslots parm if any */ - char * samplearg = NULL; /* saves -sample parm if any */ - char * scansarg = NULL; /* saves -scans parm if any */ - - /* Set up default JPEG parameters. */ - /* Note that default -quality level need not, and does not, - * match the default scaling for an explicit -qtables argument. - */ - quality = 75; /* default -quality value */ - q_scale_factor = 100; /* default to no scaling for -qtables */ - force_baseline = FALSE; /* by default, allow 16-bit quantizers */ - simple_progressive = FALSE; - is_targa = FALSE; - outfilename = NULL; - cinfo->err->trace_level = 0; - - /* Scan command line options, adjust parameters */ - - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (*arg != '-') { - /* Not a switch, must be a file name argument */ - if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ - } - break; /* else done parsing switches */ - } - arg++; /* advance past switch marker character */ - - if (keymatch(arg, "arithmetic", 1)) { - /* Use arithmetic coding. */ -#ifdef C_ARITH_CODING_SUPPORTED - cinfo->arith_code = TRUE; -#else - fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "baseline", 1)) { - /* Force baseline-compatible output (8-bit quantizer values). */ - force_baseline = TRUE; - - } else if (keymatch(arg, "dct", 2)) { - /* Select DCT algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "int", 1)) { - cinfo->dct_method = JDCT_ISLOW; - } else if (keymatch(argv[argn], "fast", 2)) { - cinfo->dct_method = JDCT_IFAST; - } else if (keymatch(argv[argn], "float", 2)) { - cinfo->dct_method = JDCT_FLOAT; - } else - usage(); - - } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { - /* Enable debug printouts. */ - /* On first -d, print version identification */ - static boolean printed_version = FALSE; - - if (! printed_version) { - fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n", - JVERSION, JCOPYRIGHT); - printed_version = TRUE; - } - cinfo->err->trace_level++; - - } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { - /* Force a monochrome JPEG file to be generated. */ - jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); - - } else if (keymatch(arg, "maxmemory", 3)) { - /* Maximum memory in Kb (or Mb with 'm'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (ch == 'm' || ch == 'M') - lval *= 1000L; - cinfo->mem->max_memory_to_use = lval * 1000L; - - } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { - /* Enable entropy parm optimization. */ -#ifdef ENTROPY_OPT_SUPPORTED - cinfo->optimize_coding = TRUE; -#else - fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "outfile", 4)) { - /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ - - } else if (keymatch(arg, "progressive", 1)) { - /* Select simple progressive mode. */ -#ifdef C_PROGRESSIVE_SUPPORTED - simple_progressive = TRUE; - /* We must postpone execution until num_components is known. */ -#else - fprintf(stderr, "%s: sorry, progressive output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "quality", 1)) { - /* Quality factor (quantization table scaling factor). */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%d", &quality) != 1) - usage(); - /* Change scale factor in case -qtables is present. */ - q_scale_factor = jpeg_quality_scaling(quality); - - } else if (keymatch(arg, "qslots", 2)) { - /* Quantization table slot numbers. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - qslotsarg = argv[argn]; - /* Must delay setting qslots until after we have processed any - * colorspace-determining switches, since jpeg_set_colorspace sets - * default quant table numbers. - */ - - } else if (keymatch(arg, "qtables", 2)) { - /* Quantization tables fetched from file. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - qtablefile = argv[argn]; - /* We postpone actually reading the file in case -quality comes later. */ - - } else if (keymatch(arg, "restart", 1)) { - /* Restart interval in MCU rows (or in MCUs with 'b'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (lval < 0 || lval > 65535L) - usage(); - if (ch == 'b' || ch == 'B') { - cinfo->restart_interval = (unsigned int) lval; - cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ - } else { - cinfo->restart_in_rows = (int) lval; - /* restart_interval will be computed during startup */ - } - - } else if (keymatch(arg, "sample", 2)) { - /* Set sampling factors. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - samplearg = argv[argn]; - /* Must delay setting sample factors until after we have processed any - * colorspace-determining switches, since jpeg_set_colorspace sets - * default sampling factors. - */ - - } else if (keymatch(arg, "scans", 2)) { - /* Set scan script. */ -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); - scansarg = argv[argn]; - /* We must postpone reading the file in case -progressive appears. */ -#else - fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "smooth", 2)) { - /* Set input smoothing factor. */ - int val; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%d", &val) != 1) - usage(); - if (val < 0 || val > 100) - usage(); - cinfo->smoothing_factor = val; - - } else if (keymatch(arg, "targa", 1)) { - /* Input file is Targa format. */ - is_targa = TRUE; - - } else { - usage(); /* bogus switch */ - } - } - - /* Post-switch-scanning cleanup */ - - if (for_real) { - - /* Set quantization tables for selected quality. */ - /* Some or all may be overridden if -qtables is present. */ - jpeg_set_quality(cinfo, quality, force_baseline); - - if (qtablefile != NULL) /* process -qtables if it was present */ - if (! read_quant_tables(cinfo, qtablefile, - q_scale_factor, force_baseline)) - usage(); - - if (qslotsarg != NULL) /* process -qslots if it was present */ - if (! set_quant_slots(cinfo, qslotsarg)) - usage(); - - if (samplearg != NULL) /* process -sample if it was present */ - if (! set_sample_factors(cinfo, samplearg)) - usage(); - -#ifdef C_PROGRESSIVE_SUPPORTED - if (simple_progressive) /* process -progressive; -scans can override */ - jpeg_simple_progression(cinfo); -#endif - -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (scansarg != NULL) /* process -scans if it was present */ - if (! read_scan_script(cinfo, scansarg)) - usage(); -#endif - } - - return argn; /* return index of next arg (file name) */ -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; -#ifdef PROGRESS_REPORT - struct cdjpeg_progress_mgr progress; -#endif - int file_index; - cjpeg_source_ptr src_mgr; - FILE * input_file; - FILE * output_file; - JDIMENSION num_scanlines; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "cjpeg"; /* in case C library doesn't provide it */ - - /* Initialize the JPEG compression object with default error handling. */ - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - /* Add some application-specific error messages (from cderror.h) */ - jerr.addon_message_table = cdjpeg_message_table; - jerr.first_addon_message = JMSG_FIRSTADDONCODE; - jerr.last_addon_message = JMSG_LASTADDONCODE; - - /* Now safe to enable signal catcher. */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &cinfo); -#endif - - /* Initialize JPEG parameters. - * Much of this may be overridden later. - * In particular, we don't yet know the input file's color space, - * but we need to provide some value for jpeg_set_defaults() to work. - */ - - cinfo.in_color_space = JCS_RGB; /* arbitrary guess */ - jpeg_set_defaults(&cinfo); - - /* Scan command line to find file names. - * It is convenient to use just one switch-parsing routine, but the switch - * values read here are ignored; we will rescan the switches after opening - * the input file. - */ - - file_index = parse_switches(&cinfo, argc, argv, 0, FALSE); - -#ifdef TWO_FILE_COMMANDLINE - /* Must have either -outfile switch or explicit output file name */ - if (outfilename == NULL) { - if (file_index != argc-2) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - outfilename = argv[file_index+1]; - } else { - if (file_index != argc-1) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - } -#else - /* Unix style: expect zero or one file name */ - if (file_index < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } -#endif /* TWO_FILE_COMMANDLINE */ - - /* Open the input file. */ - if (file_index < argc) { - if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ - input_file = read_stdin(); - } - - /* Open the output file. */ - if (outfilename != NULL) { - if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, outfilename); - exit(EXIT_FAILURE); - } - } else { - /* default output file is stdout */ - output_file = write_stdout(); - } - -#ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr) &cinfo, &progress); -#endif - - /* Figure out the input file format, and set up to read it. */ - src_mgr = select_file_type(&cinfo, input_file); - src_mgr->input_file = input_file; - - /* Read the input file header to obtain file size & colorspace. */ - (*src_mgr->start_input) (&cinfo, src_mgr); - - /* Now that we know input colorspace, fix colorspace-dependent defaults */ - jpeg_default_colorspace(&cinfo); - - /* Adjust default compression parameters by re-parsing the options */ - file_index = parse_switches(&cinfo, argc, argv, 0, TRUE); - - /* Specify data destination for compression */ - jpeg_stdio_dest(&cinfo, output_file); - - /* Start compressor */ - jpeg_start_compress(&cinfo, TRUE); - - /* Process data */ - while (cinfo.next_scanline < cinfo.image_height) { - num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr); - (void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines); - } - - /* Finish compression and release memory */ - (*src_mgr->finish_input) (&cinfo, src_mgr); - jpeg_finish_compress(&cinfo); - jpeg_destroy_compress(&cinfo); - - /* Close files, if we opened them */ - if (input_file != stdin) - fclose(input_file); - if (output_file != stdout) - fclose(output_file); - -#ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr) &cinfo); -#endif - - /* All done. */ - exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/ckconfig.c b/ckconfig.c deleted file mode 100644 index 34baf795..00000000 --- a/ckconfig.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * ckconfig.c - * - * Copyright (C) 1991-1994, 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. - */ - -/* - * This program is intended to help you determine how to configure the JPEG - * software for installation on a particular system. The idea is to try to - * compile and execute this program. If your compiler fails to compile the - * program, make changes as indicated in the comments below. Once you can - * compile the program, run it, and it will produce a "jconfig.h" file for - * your system. - * - * As a general rule, each time you try to compile this program, - * pay attention only to the *first* error message you get from the compiler. - * Many C compilers will issue lots of spurious error messages once they - * have gotten confused. Go to the line indicated in the first error message, - * and read the comments preceding that line to see what to change. - * - * Almost all of the edits you may need to make to this program consist of - * changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL", - * or vice versa. This is called defining or undefining that symbol. - */ - - -/* First we must see if your system has the include files we need. - * We start out with the assumption that your system has all the ANSI-standard - * include files. If you get any error trying to include one of these files, - * undefine the corresponding HAVE_xxx symbol. - */ - -#define HAVE_STDDEF_H /* replace 'define' by 'undef' if error here */ -#ifdef HAVE_STDDEF_H /* next line will be skipped if you undef... */ -#include -#endif - -#define HAVE_STDLIB_H /* same thing for stdlib.h */ -#ifdef HAVE_STDLIB_H -#include -#endif - -#include /* If you ain't got this, you ain't got C. */ - -/* We have to see if your string functions are defined by - * strings.h (old BSD convention) or string.h (everybody else). - * We try the non-BSD convention first; define NEED_BSD_STRINGS - * if the compiler says it can't find string.h. - */ - -#undef NEED_BSD_STRINGS - -#ifdef NEED_BSD_STRINGS -#include -#else -#include -#endif - -/* On some systems (especially older Unix machines), type size_t is - * defined only in the include file . If you get a failure - * on the size_t test below, try defining NEED_SYS_TYPES_H. - */ - -#undef NEED_SYS_TYPES_H /* start by assuming we don't need it */ -#ifdef NEED_SYS_TYPES_H -#include -#endif - - -/* Usually type size_t is defined in one of the include files we've included - * above. If not, you'll get an error on the "typedef size_t my_size_t;" line. - * In that case, first try defining NEED_SYS_TYPES_H just above. - * If that doesn't work, you'll have to search through your system library - * to figure out which include file defines "size_t". Look for a line that - * says "typedef something-or-other size_t;". Then, change the line below - * that says "#include " to instead include the file - * you found size_t in, and define NEED_SPECIAL_INCLUDE. If you can't find - * type size_t anywhere, try replacing "#include " with - * "typedef unsigned int size_t;". - */ - -#undef NEED_SPECIAL_INCLUDE /* assume we DON'T need it, for starters */ - -#ifdef NEED_SPECIAL_INCLUDE -#include -#endif - -typedef size_t my_size_t; /* The payoff: do we have size_t now? */ - - -/* The next question is whether your compiler supports ANSI-style function - * prototypes. You need to know this in order to choose between using - * makefile.ansi and using makefile.unix. - * The #define line below is set to assume you have ANSI function prototypes. - * If you get an error in this group of lines, undefine HAVE_PROTOTYPES. - */ - -#define HAVE_PROTOTYPES - -#ifdef HAVE_PROTOTYPES -int testfunction (int arg1, int * arg2); /* check prototypes */ - -struct methods_struct { /* check method-pointer declarations */ - int (*error_exit) (char *msgtext); - int (*trace_message) (char *msgtext); - int (*another_method) (void); -}; - -int testfunction (int arg1, int * arg2) /* check definitions */ -{ - return arg2[arg1]; -} - -int test2function (void) /* check void arg list */ -{ - return 0; -} -#endif - - -/* Now we want to find out if your compiler knows what "unsigned char" means. - * If you get an error on the "unsigned char un_char;" line, - * then undefine HAVE_UNSIGNED_CHAR. - */ - -#define HAVE_UNSIGNED_CHAR - -#ifdef HAVE_UNSIGNED_CHAR -unsigned char un_char; -#endif - - -/* Now we want to find out if your compiler knows what "unsigned short" means. - * If you get an error on the "unsigned short un_short;" line, - * then undefine HAVE_UNSIGNED_SHORT. - */ - -#define HAVE_UNSIGNED_SHORT - -#ifdef HAVE_UNSIGNED_SHORT -unsigned short un_short; -#endif - - -/* Now we want to find out if your compiler understands type "void". - * If you get an error anywhere in here, undefine HAVE_VOID. - */ - -#define HAVE_VOID - -#ifdef HAVE_VOID -/* Caution: a C++ compiler will insist on complete prototypes */ -typedef void * void_ptr; /* check void * */ -#ifdef HAVE_PROTOTYPES /* check ptr to function returning void */ -typedef void (*void_func) (int a, int b); -#else -typedef void (*void_func) (); -#endif - -#ifdef HAVE_PROTOTYPES /* check void function result */ -void test3function (void_ptr arg1, void_func arg2) -#else -void test3function (arg1, arg2) - void_ptr arg1; - void_func arg2; -#endif -{ - char * locptr = (char *) arg1; /* check casting to and from void * */ - arg1 = (void *) locptr; - (*arg2) (1, 2); /* check call of fcn returning void */ -} -#endif - - -/* Now we want to find out if your compiler knows what "const" means. - * If you get an error here, undefine HAVE_CONST. - */ - -#define HAVE_CONST - -#ifdef HAVE_CONST -static const int carray[3] = {1, 2, 3}; - -#ifdef HAVE_PROTOTYPES -int test4function (const int arg1) -#else -int test4function (arg1) - const int arg1; -#endif -{ - return carray[arg1]; -} -#endif - - -/* If you get an error or warning about this structure definition, - * define INCOMPLETE_TYPES_BROKEN. - */ - -#undef INCOMPLETE_TYPES_BROKEN - -#ifndef INCOMPLETE_TYPES_BROKEN -typedef struct undefined_structure * undef_struct_ptr; -#endif - - -/* If you get an error about duplicate names, - * define NEED_SHORT_EXTERNAL_NAMES. - */ - -#undef NEED_SHORT_EXTERNAL_NAMES - -#ifndef NEED_SHORT_EXTERNAL_NAMES - -int possibly_duplicate_function () -{ - return 0; -} - -int possibly_dupli_function () -{ - return 1; -} - -#endif - - - -/************************************************************************ - * OK, that's it. You should not have to change anything beyond this - * point in order to compile and execute this program. (You might get - * some warnings, but you can ignore them.) - * When you run the program, it will make a couple more tests that it - * can do automatically, and then it will create jconfig.h and print out - * any additional suggestions it has. - ************************************************************************ - */ - - -#ifdef HAVE_PROTOTYPES -int is_char_signed (int arg) -#else -int is_char_signed (arg) - int arg; -#endif -{ - if (arg == 189) { /* expected result for unsigned char */ - return 0; /* type char is unsigned */ - } - else if (arg != -67) { /* expected result for signed char */ - printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n"); - printf("I fear the JPEG software will not work at all.\n\n"); - } - return 1; /* assume char is signed otherwise */ -} - - -#ifdef HAVE_PROTOTYPES -int is_shifting_signed (long arg) -#else -int is_shifting_signed (arg) - long arg; -#endif -/* See whether right-shift on a long is signed or not. */ -{ - long res = arg >> 4; - - if (res == -0x7F7E80CL) { /* expected result for signed shift */ - return 1; /* right shift is signed */ - } - /* see if unsigned-shift hack will fix it. */ - /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); - if (res == -0x7F7E80CL) { /* expected result now? */ - return 0; /* right shift is unsigned */ - } - printf("Right shift isn't acting as I expect it to.\n"); - printf("I fear the JPEG software will not work at all.\n\n"); - return 0; /* try it with unsigned anyway */ -} - - -#ifdef HAVE_PROTOTYPES -int main (int argc, char ** argv) -#else -int main (argc, argv) - int argc; - char ** argv; -#endif -{ - char signed_char_check = (char) (-67); - FILE *outfile; - - /* Attempt to write jconfig.h */ - if ((outfile = fopen("jconfig.h", "w")) == NULL) { - printf("Failed to write jconfig.h\n"); - return 1; - } - - /* Write out all the info */ - fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n"); - fprintf(outfile, "/* see jconfig.doc for explanations */\n\n"); -#ifdef HAVE_PROTOTYPES - fprintf(outfile, "#define HAVE_PROTOTYPES\n"); -#else - fprintf(outfile, "#undef HAVE_PROTOTYPES\n"); -#endif -#ifdef HAVE_UNSIGNED_CHAR - fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n"); -#else - fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n"); -#endif -#ifdef HAVE_UNSIGNED_SHORT - fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n"); -#else - fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n"); -#endif -#ifdef HAVE_VOID - fprintf(outfile, "/* #define void char */\n"); -#else - fprintf(outfile, "#define void char\n"); -#endif -#ifdef HAVE_CONST - fprintf(outfile, "/* #define const */\n"); -#else - fprintf(outfile, "#define const\n"); -#endif - if (is_char_signed((int) signed_char_check)) - fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n"); - else - fprintf(outfile, "#define CHAR_IS_UNSIGNED\n"); -#ifdef HAVE_STDDEF_H - fprintf(outfile, "#define HAVE_STDDEF_H\n"); -#else - fprintf(outfile, "#undef HAVE_STDDEF_H\n"); -#endif -#ifdef HAVE_STDLIB_H - fprintf(outfile, "#define HAVE_STDLIB_H\n"); -#else - fprintf(outfile, "#undef HAVE_STDLIB_H\n"); -#endif -#ifdef NEED_BSD_STRINGS - fprintf(outfile, "#define NEED_BSD_STRINGS\n"); -#else - fprintf(outfile, "#undef NEED_BSD_STRINGS\n"); -#endif -#ifdef NEED_SYS_TYPES_H - fprintf(outfile, "#define NEED_SYS_TYPES_H\n"); -#else - fprintf(outfile, "#undef NEED_SYS_TYPES_H\n"); -#endif - fprintf(outfile, "#undef NEED_FAR_POINTERS\n"); -#ifdef NEED_SHORT_EXTERNAL_NAMES - fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n"); -#else - fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n"); -#endif -#ifdef INCOMPLETE_TYPES_BROKEN - fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n"); -#else - fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n"); -#endif - fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n"); - if (is_shifting_signed(-0x7F7E80B1L)) - fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n"); - else - fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n"); - fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n"); - fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n"); - fprintf(outfile, "#define BMP_SUPPORTED /* BMP image file format */\n"); - fprintf(outfile, "#define GIF_SUPPORTED /* GIF image file format */\n"); - fprintf(outfile, "#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */\n"); - fprintf(outfile, "#undef RLE_SUPPORTED /* Utah RLE image file format */\n"); - fprintf(outfile, "#define TARGA_SUPPORTED /* Targa image file format */\n\n"); - fprintf(outfile, "#undef TWO_FILE_COMMANDLINE /* You may need this on non-Unix systems */\n"); - fprintf(outfile, "#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */\n"); - fprintf(outfile, "#undef DONT_USE_B_MODE\n"); - fprintf(outfile, "/* #define PROGRESS_REPORT */ /* optional */\n"); - fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n"); - - /* Close the jconfig.h file */ - fclose(outfile); - - /* User report */ - printf("Configuration check for Independent JPEG Group's software done.\n"); - printf("\nI have written the jconfig.h file for you.\n\n"); -#ifdef HAVE_PROTOTYPES - printf("You should use makefile.ansi as the starting point for your Makefile.\n"); -#else - printf("You should use makefile.unix as the starting point for your Makefile.\n"); -#endif - -#ifdef NEED_SPECIAL_INCLUDE - printf("\nYou'll need to change jconfig.h to include the system include file\n"); - printf("that you found type size_t in, or add a direct definition of type\n"); - printf("size_t if that's what you used. Just add it to the end.\n"); -#endif - - return 0; -} diff --git a/coderules.doc b/coderules.doc deleted file mode 100644 index 0ab5d9bd..00000000 --- a/coderules.doc +++ /dev/null @@ -1,118 +0,0 @@ -IJG JPEG LIBRARY: CODING RULES - -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. - - -Since numerous people will be contributing code and bug fixes, it's important -to establish a common coding style. The goal of using similar coding styles -is much more important than the details of just what that style is. - -In general we follow the recommendations of "Recommended C Style and Coding -Standards" revision 6.1 (Cannon et al. as modified by Spencer, Keppel and -Brader). This document is available in the IJG FTP archive (see -jpeg/doc/cstyle.ms.tbl.Z, or cstyle.txt.Z for those without nroff/tbl). - -Block comments should be laid out thusly: - -/* - * Block comments in this style. - */ - -We indent statements in K&R style, e.g., - if (test) { - then-part; - } else { - else-part; - } -with two spaces per indentation level. (This indentation convention is -handled automatically by GNU Emacs and many other text editors.) - -Multi-word names should be written in lower case with underscores, e.g., -multi_word_name (not multiWordName). Preprocessor symbols and enum constants -are similar but upper case (MULTI_WORD_NAME). Names should be unique within -the first fifteen characters. (On some older systems, global names must be -unique within six characters. We accommodate this without cluttering the -source code by using macros to substitute shorter names.) - -We use function prototypes everywhere; we rely on automatic source code -transformation to feed prototype-less C compilers. Transformation is done -by the simple and portable tool 'ansi2knr.c' (courtesy of Ghostscript). -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 *) -function_name (int a, char *b) -{ - code... -} - -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 - #ifdef HAVE_PROTOTYPES - #define JMETHOD(type,methodname,arglist) type (*methodname) arglist - #else - #define JMETHOD(type,methodname,arglist) type (*methodname) () - #endif -which is used like this: - struct function_pointers { - JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp)); - JMETHOD(void, term_entropy_encoder, (void)); - }; -Note the set of parentheses surrounding the parameter list. - -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 -explicit casts on actual parameters whenever the actual parameter type is not -identical to the formal parameter. Beware of implicit conversions to "int". - -It seems there are some non-ANSI compilers in which the sizeof() operator -is defined to return int, yet size_t is defined as long. Needless to say, -this is brain-damaged. Always use the SIZEOF() macro in place of sizeof(), -so that the result is guaranteed to be of type size_t. - - -The JPEG library is intended to be used within larger programs. Furthermore, -we want it to be reentrant so that it can be used by applications that process -multiple images concurrently. The following rules support these requirements: - -1. Avoid direct use of file I/O, "malloc", error report printouts, etc; -pass these through the common routines provided. - -2. Minimize global namespace pollution. Functions should be declared static -wherever possible. (Note that our method-based calling conventions help this -a lot: in many modules only the initialization function will ever need to be -called directly, so only that function need be externally visible.) All -global function names should begin with "jpeg_", and should have an -abbreviated name (unique in the first six characters) substituted by macro -when NEED_SHORT_EXTERNAL_NAMES is set. - -3. Don't use global variables; anything that must be used in another module -should be in the common data structures. - -4. Don't use static variables except for read-only constant tables. Variables -that should be private to a module can be placed into private structures (see -the system architecture document, structure.doc). - -5. Source file names should begin with "j" for files that are part of the -library proper; source files that are not part of the library, such as cjpeg.c -and djpeg.c, do not begin with "j". Keep source file names to eight -characters (plus ".c" or ".h", etc) to make life easy for MS-DOSers. Keep -compression and decompression code in separate source files --- some -applications may want only one half of the library. - -Note: these rules (particularly #4) are not followed religiously in the -modules that are used in cjpeg/djpeg but are not part of the JPEG library -proper. Those modules are not really intended to be used in other -applications. diff --git a/djpeg.1 b/djpeg.1 deleted file mode 100644 index 11beb6a5..00000000 --- a/djpeg.1 +++ /dev/null @@ -1,253 +0,0 @@ -.TH DJPEG 1 "22 August 1997" -.SH NAME -djpeg \- decompress a JPEG file to an image file -.SH SYNOPSIS -.B djpeg -[ -.I options -] -[ -.I filename -] -.LP -.SH DESCRIPTION -.LP -.B djpeg -decompresses the named JPEG file, or the standard input if no file is named, -and produces an image file on the standard output. PBMPLUS (PPM/PGM), BMP, -GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected. -(RLE is supported only if the URT library is available.) -.SH OPTIONS -All switch names may be abbreviated; for example, -.B \-grayscale -may be written -.B \-gray -or -.BR \-gr . -Most of the "basic" switches can be abbreviated to as little as one letter. -Upper and lower case are equivalent (thus -.B \-BMP -is the same as -.BR \-bmp ). -British spellings are also accepted (e.g., -.BR \-greyscale ), -though for brevity these are not mentioned below. -.PP -The basic switches are: -.TP -.BI \-colors " N" -Reduce image to at most N colors. This reduces the number of colors used in -the output image, so that it can be displayed on a colormapped display or -stored in a colormapped file format. For example, if you have an 8-bit -display, you'd need to reduce to 256 or fewer colors. -.TP -.BI \-quantize " N" -Same as -.BR \-colors . -.B \-colors -is the recommended name, -.B \-quantize -is provided only for backwards compatibility. -.TP -.B \-fast -Select recommended processing options for fast, low quality output. (The -default options are chosen for highest quality output.) Currently, this is -equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR. -.TP -.B \-grayscale -Force gray-scale output even if JPEG file is color. Useful for viewing on -monochrome displays; also, -.B djpeg -runs noticeably faster in this mode. -.TP -.BI \-scale " M/N" -Scale the output image by a factor M/N. Currently the scale factor must be -1/1, 1/2, 1/4, or 1/8. Scaling is handy if the image is larger than your -screen; also, -.B djpeg -runs much faster when scaling down the output. -.TP -.B \-bmp -Select BMP output format (Windows flavor). 8-bit colormapped format is -emitted if -.B \-colors -or -.B \-grayscale -is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color -format is emitted. -.TP -.B \-gif -Select GIF output format. Since GIF does not support more than 256 colors, -.B \-colors 256 -is assumed (unless you specify a smaller number of colors). -.TP -.B \-os2 -Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is -emitted if -.B \-colors -or -.B \-grayscale -is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color -format is emitted. -.TP -.B \-pnm -Select PBMPLUS (PPM/PGM) output format (this is the default format). -PGM is emitted if the JPEG file is gray-scale or if -.B \-grayscale -is specified; otherwise PPM is emitted. -.TP -.B \-rle -Select RLE output format. (Requires URT library.) -.TP -.B \-targa -Select Targa output format. Gray-scale format is emitted if the JPEG file is -gray-scale or if -.B \-grayscale -is specified; otherwise, colormapped format is emitted if -.B \-colors -is specified; otherwise, 24-bit full-color format is emitted. -.PP -Switches for advanced users: -.TP -.B \-dct int -Use integer DCT method (default). -.TP -.B \-dct fast -Use fast integer DCT (less accurate). -.TP -.B \-dct float -Use floating-point DCT method. -The float method is very slightly more accurate than the int method, but is -much slower unless your machine has very fast floating-point hardware. Also -note that results of the floating-point method may vary slightly across -machines, while the integer methods should give the same results everywhere. -The fast integer method is much less accurate than the other two. -.TP -.B \-dither fs -Use Floyd-Steinberg dithering in color quantization. -.TP -.B \-dither ordered -Use ordered dithering in color quantization. -.TP -.B \-dither none -Do not use dithering in color quantization. -By default, Floyd-Steinberg dithering is applied when quantizing colors; this -is slow but usually produces the best results. Ordered dither is a compromise -between speed and quality; no dithering is fast but usually looks awful. Note -that these switches have no effect unless color quantization is being done. -Ordered dither is only available in -.B \-onepass -mode. -.TP -.BI \-map " file" -Quantize to the colors used in the specified image file. This is useful for -producing multiple files with identical color maps, or for forcing a -predefined set of colors to be used. The -.I file -must be a GIF or PPM file. This option overrides -.B \-colors -and -.BR \-onepass . -.TP -.B \-nosmooth -Use a faster, lower-quality upsampling routine. -.TP -.B \-onepass -Use one-pass instead of two-pass color quantization. The one-pass method is -faster and needs less memory, but it produces a lower-quality image. -.B \-onepass -is ignored unless you also say -.B \-colors -.IR N . -Also, the one-pass method is always used for gray-scale output (the two-pass -method is no improvement then). -.TP -.BI \-maxmemory " N" -Set limit for amount of memory to use in processing large images. Value is -in thousands of bytes, or millions of bytes if "M" is attached to the -number. For example, -.B \-max 4m -selects 4000000 bytes. If more space is needed, temporary files will be used. -.TP -.BI \-outfile " name" -Send output image to the named file, not to standard output. -.TP -.B \-verbose -Enable debug printout. More -.BR \-v 's -give more output. Also, version information is printed at startup. -.TP -.B \-debug -Same as -.BR \-verbose . -.SH EXAMPLES -.LP -This example decompresses the JPEG file foo.jpg, quantizes it to -256 colors, and saves the output in 8-bit BMP format in foo.bmp: -.IP -.B djpeg \-colors 256 \-bmp -.I foo.jpg -.B > -.I foo.bmp -.SH HINTS -To get a quick preview of an image, use the -.B \-grayscale -and/or -.B \-scale -switches. -.B \-grayscale \-scale 1/8 -is the fastest case. -.PP -Several options are available that trade off image quality to gain speed. -.B \-fast -turns on the recommended settings. -.PP -.B \-dct fast -and/or -.B \-nosmooth -gain speed at a small sacrifice in quality. -When producing a color-quantized image, -.B \-onepass \-dither ordered -is fast but much lower quality than the default behavior. -.B \-dither none -may give acceptable results in two-pass mode, but is seldom tolerable in -one-pass mode. -.PP -If you are fortunate enough to have very fast floating point hardware, -\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most -machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is -not worth using, because its theoretical accuracy advantage is too small to be -significant in practice. -.SH ENVIRONMENT -.TP -.B JPEGMEM -If this environment variable is set, its value is the default memory limit. -The value is specified as described for the -.B \-maxmemory -switch. -.B JPEGMEM -overrides the default value specified when the program was compiled, and -itself is overridden by an explicit -.BR \-maxmemory . -.SH SEE ALSO -.BR cjpeg (1), -.BR jpegtran (1), -.BR rdjpgcom (1), -.BR wrjpgcom (1) -.br -.BR ppm (5), -.BR pgm (5) -.br -Wallace, Gregory K. "The JPEG Still Picture Compression Standard", -Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. -.SH AUTHOR -Independent JPEG Group -.SH BUGS -Arithmetic coding is not supported for legal reasons. -.PP -To avoid the Unisys LZW patent, -.B djpeg -produces uncompressed GIF files. These are larger than they should be, but -are readable by standard GIF decoders. -.PP -Still not as fast as we'd like. diff --git a/djpeg.c b/djpeg.c deleted file mode 100644 index e099e90a..00000000 --- a/djpeg.c +++ /dev/null @@ -1,616 +0,0 @@ -/* - * djpeg.c - * - * Copyright (C) 1991-1997, 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. - * - * This file contains a command-line user interface for the JPEG decompressor. - * It should work on any system with Unix- or MS-DOS-style command lines. - * - * Two different command line styles are permitted, depending on the - * compile-time switch TWO_FILE_COMMANDLINE: - * djpeg [options] inputfile outputfile - * djpeg [options] [inputfile] - * In the second style, output is always to standard output, which you'd - * normally redirect to a file or pipe to some other program. Input is - * either from a named file or from standard input (typically redirected). - * The second style is convenient on Unix but is unhelpful on systems that - * don't support pipes. Also, you MUST use the first style if your system - * doesn't do binary I/O to stdin/stdout. - * To simplify script writing, the "-outfile" switch is provided. The syntax - * djpeg [options] -outfile outputfile inputfile - * works regardless of which command line style is used. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "jversion.h" /* for version message */ - -#include /* to declare isprint() */ - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - - -/* Create the add-on message string table. */ - -#define JMESSAGE(code,string) string , - -static const char * const cdjpeg_message_table[] = { -#include "cderror.h" - NULL -}; - - -/* - * This list defines the known output image formats - * (not all of which need be supported by a given version). - * You can change the default output format by defining DEFAULT_FMT; - * indeed, you had better do so if you undefine PPM_SUPPORTED. - */ - -typedef enum { - FMT_BMP, /* BMP format (Windows flavor) */ - FMT_GIF, /* GIF format */ - FMT_OS2, /* BMP format (OS/2 flavor) */ - FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ - FMT_RLE, /* RLE format */ - FMT_TARGA, /* Targa format */ - FMT_TIFF /* TIFF format */ -} IMAGE_FORMATS; - -#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ -#define DEFAULT_FMT FMT_PPM -#endif - -static IMAGE_FORMATS requested_fmt; - - -/* - * Argument-parsing code. - * The switch parser is designed to be useful with DOS-style command line - * syntax, ie, intermixed switches and file names, where only the switches - * to the left of a given file name affect processing of that file. - * The main program in this file doesn't actually use this capability... - */ - - -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ - - -LOCAL(void) -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "usage: %s [switches] ", progname); -#ifdef TWO_FILE_COMMANDLINE - fprintf(stderr, "inputfile outputfile\n"); -#else - fprintf(stderr, "[inputfile]\n"); -#endif - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); - fprintf(stderr, " -fast Fast, low-quality processing\n"); - fprintf(stderr, " -grayscale Force grayscale output\n"); -#ifdef IDCT_SCALING_SUPPORTED - fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); -#endif -#ifdef BMP_SUPPORTED - fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n", - (DEFAULT_FMT == FMT_BMP ? " (default)" : "")); -#endif -#ifdef GIF_SUPPORTED - fprintf(stderr, " -gif Select GIF output format%s\n", - (DEFAULT_FMT == FMT_GIF ? " (default)" : "")); -#endif -#ifdef BMP_SUPPORTED - fprintf(stderr, " -os2 Select BMP output format (OS/2 style)%s\n", - (DEFAULT_FMT == FMT_OS2 ? " (default)" : "")); -#endif -#ifdef PPM_SUPPORTED - fprintf(stderr, " -pnm Select PBMPLUS (PPM/PGM) output format%s\n", - (DEFAULT_FMT == FMT_PPM ? " (default)" : "")); -#endif -#ifdef RLE_SUPPORTED - fprintf(stderr, " -rle Select Utah RLE output format%s\n", - (DEFAULT_FMT == FMT_RLE ? " (default)" : "")); -#endif -#ifdef TARGA_SUPPORTED - fprintf(stderr, " -targa Select Targa output format%s\n", - (DEFAULT_FMT == FMT_TARGA ? " (default)" : "")); -#endif - fprintf(stderr, "Switches for advanced users:\n"); -#ifdef DCT_ISLOW_SUPPORTED - fprintf(stderr, " -dct int Use integer DCT method%s\n", - (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); -#endif -#ifdef DCT_IFAST_SUPPORTED - fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", - (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); -#endif -#ifdef DCT_FLOAT_SUPPORTED - fprintf(stderr, " -dct float Use floating-point DCT method%s\n", - (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); -#endif - fprintf(stderr, " -dither fs Use F-S dithering (default)\n"); - fprintf(stderr, " -dither none Don't use dithering in quantization\n"); - fprintf(stderr, " -dither ordered Use ordered dither (medium speed, quality)\n"); -#ifdef QUANT_2PASS_SUPPORTED - fprintf(stderr, " -map FILE Map to colors used in named image file\n"); -#endif - fprintf(stderr, " -nosmooth Don't use high-quality upsampling\n"); -#ifdef QUANT_1PASS_SUPPORTED - fprintf(stderr, " -onepass Use 1-pass quantization (fast, low quality)\n"); -#endif - fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); - fprintf(stderr, " -outfile name Specify name for output file\n"); - fprintf(stderr, " -verbose or -debug Emit debug output\n"); - exit(EXIT_FAILURE); -} - - -LOCAL(int) -parse_switches (j_decompress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) -/* Parse optional switches. - * Returns argv[] index of first file-name argument (== argc if none). - * Any file names with indexes <= last_file_arg_seen are ignored; - * they have presumably been processed in a previous iteration. - * (Pass 0 for last_file_arg_seen on the first or only iteration.) - * for_real is FALSE on the first (dummy) pass; we may skip any expensive - * processing. - */ -{ - int argn; - char * arg; - - /* Set up default JPEG parameters. */ - requested_fmt = DEFAULT_FMT; /* set default output file format */ - outfilename = NULL; - cinfo->err->trace_level = 0; - - /* Scan command line options, adjust parameters */ - - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (*arg != '-') { - /* Not a switch, must be a file name argument */ - if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ - } - break; /* else done parsing switches */ - } - arg++; /* advance past switch marker character */ - - if (keymatch(arg, "bmp", 1)) { - /* BMP output format. */ - requested_fmt = FMT_BMP; - - } else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) || - keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) { - /* Do color quantization. */ - int val; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%d", &val) != 1) - usage(); - cinfo->desired_number_of_colors = val; - cinfo->quantize_colors = TRUE; - - } else if (keymatch(arg, "dct", 2)) { - /* Select IDCT algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "int", 1)) { - cinfo->dct_method = JDCT_ISLOW; - } else if (keymatch(argv[argn], "fast", 2)) { - cinfo->dct_method = JDCT_IFAST; - } else if (keymatch(argv[argn], "float", 2)) { - cinfo->dct_method = JDCT_FLOAT; - } else - usage(); - - } else if (keymatch(arg, "dither", 2)) { - /* Select dithering algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "fs", 2)) { - cinfo->dither_mode = JDITHER_FS; - } else if (keymatch(argv[argn], "none", 2)) { - cinfo->dither_mode = JDITHER_NONE; - } else if (keymatch(argv[argn], "ordered", 2)) { - cinfo->dither_mode = JDITHER_ORDERED; - } else - usage(); - - } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { - /* Enable debug printouts. */ - /* On first -d, print version identification */ - static boolean printed_version = FALSE; - - if (! printed_version) { - fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n", - JVERSION, JCOPYRIGHT); - printed_version = TRUE; - } - cinfo->err->trace_level++; - - } else if (keymatch(arg, "fast", 1)) { - /* Select recommended processing options for quick-and-dirty output. */ - cinfo->two_pass_quantize = FALSE; - cinfo->dither_mode = JDITHER_ORDERED; - if (! cinfo->quantize_colors) /* don't override an earlier -colors */ - cinfo->desired_number_of_colors = 216; - cinfo->dct_method = JDCT_FASTEST; - cinfo->do_fancy_upsampling = FALSE; - - } else if (keymatch(arg, "gif", 1)) { - /* GIF output format. */ - requested_fmt = FMT_GIF; - - } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { - /* Force monochrome output. */ - cinfo->out_color_space = JCS_GRAYSCALE; - - } else if (keymatch(arg, "map", 3)) { - /* Quantize to a color map taken from an input file. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (for_real) { /* too expensive to do twice! */ -#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ - FILE * mapfile; - - if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - read_color_map(cinfo, mapfile); - fclose(mapfile); - cinfo->quantize_colors = TRUE; -#else - ERREXIT(cinfo, JERR_NOT_COMPILED); -#endif - } - - } else if (keymatch(arg, "maxmemory", 3)) { - /* Maximum memory in Kb (or Mb with 'm'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (ch == 'm' || ch == 'M') - lval *= 1000L; - cinfo->mem->max_memory_to_use = lval * 1000L; - - } else if (keymatch(arg, "nosmooth", 3)) { - /* Suppress fancy upsampling */ - cinfo->do_fancy_upsampling = FALSE; - - } else if (keymatch(arg, "onepass", 3)) { - /* Use fast one-pass quantization. */ - cinfo->two_pass_quantize = FALSE; - - } else if (keymatch(arg, "os2", 3)) { - /* BMP output format (OS/2 flavor). */ - requested_fmt = FMT_OS2; - - } else if (keymatch(arg, "outfile", 4)) { - /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ - - } else if (keymatch(arg, "pnm", 1) || keymatch(arg, "ppm", 1)) { - /* PPM/PGM output format. */ - requested_fmt = FMT_PPM; - - } else if (keymatch(arg, "rle", 1)) { - /* RLE output format. */ - requested_fmt = FMT_RLE; - - } else if (keymatch(arg, "scale", 1)) { - /* Scale the output image by a fraction M/N. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%d/%d", - &cinfo->scale_num, &cinfo->scale_denom) != 2) - usage(); - - } else if (keymatch(arg, "targa", 1)) { - /* Targa output format. */ - requested_fmt = FMT_TARGA; - - } else { - usage(); /* bogus switch */ - } - } - - return argn; /* return index of next arg (file name) */ -} - - -/* - * Marker processor for COM and interesting APPn markers. - * This replaces the library's built-in processor, which just skips the marker. - * We want to print out the marker as text, to the extent possible. - * Note this code relies on a non-suspending data source. - */ - -LOCAL(unsigned int) -jpeg_getc (j_decompress_ptr cinfo) -/* Read next byte */ -{ - struct jpeg_source_mgr * datasrc = cinfo->src; - - if (datasrc->bytes_in_buffer == 0) { - if (! (*datasrc->fill_input_buffer) (cinfo)) - ERREXIT(cinfo, JERR_CANT_SUSPEND); - } - datasrc->bytes_in_buffer--; - return GETJOCTET(*datasrc->next_input_byte++); -} - - -METHODDEF(boolean) -print_text_marker (j_decompress_ptr cinfo) -{ - boolean traceit = (cinfo->err->trace_level >= 1); - INT32 length; - unsigned int ch; - unsigned int lastch = 0; - - length = jpeg_getc(cinfo) << 8; - length += jpeg_getc(cinfo); - length -= 2; /* discount the length word itself */ - - if (traceit) { - if (cinfo->unread_marker == JPEG_COM) - fprintf(stderr, "Comment, length %ld:\n", (long) length); - else /* assume it is an APPn otherwise */ - fprintf(stderr, "APP%d, length %ld:\n", - cinfo->unread_marker - JPEG_APP0, (long) length); - } - - while (--length >= 0) { - ch = jpeg_getc(cinfo); - if (traceit) { - /* Emit the character in a readable form. - * Nonprintables are converted to \nnn form, - * while \ is converted to \\. - * Newlines in CR, CR/LF, or LF form will be printed as one newline. - */ - if (ch == '\r') { - fprintf(stderr, "\n"); - } else if (ch == '\n') { - if (lastch != '\r') - fprintf(stderr, "\n"); - } else if (ch == '\\') { - fprintf(stderr, "\\\\"); - } else if (isprint(ch)) { - putc(ch, stderr); - } else { - fprintf(stderr, "\\%03o", ch); - } - lastch = ch; - } - } - - if (traceit) - fprintf(stderr, "\n"); - - return TRUE; -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; -#ifdef PROGRESS_REPORT - struct cdjpeg_progress_mgr progress; -#endif - int file_index; - djpeg_dest_ptr dest_mgr = NULL; - FILE * input_file; - FILE * output_file; - JDIMENSION num_scanlines; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "djpeg"; /* in case C library doesn't provide it */ - - /* Initialize the JPEG decompression object with default error handling. */ - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_decompress(&cinfo); - /* Add some application-specific error messages (from cderror.h) */ - jerr.addon_message_table = cdjpeg_message_table; - jerr.first_addon_message = JMSG_FIRSTADDONCODE; - jerr.last_addon_message = JMSG_LASTADDONCODE; - - /* Insert custom marker processor for COM and APP12. - * APP12 is used by some digital camera makers for textual info, - * so we provide the ability to display it as text. - * If you like, additional APPn marker types can be selected for display, - * but don't try to override APP0 or APP14 this way (see libjpeg.doc). - */ - jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker); - jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker); - - /* Now safe to enable signal catcher. */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &cinfo); -#endif - - /* Scan command line to find file names. */ - /* It is convenient to use just one switch-parsing routine, but the switch - * values read here are ignored; we will rescan the switches after opening - * the input file. - * (Exception: tracing level set here controls verbosity for COM markers - * found during jpeg_read_header...) - */ - - file_index = parse_switches(&cinfo, argc, argv, 0, FALSE); - -#ifdef TWO_FILE_COMMANDLINE - /* Must have either -outfile switch or explicit output file name */ - if (outfilename == NULL) { - if (file_index != argc-2) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - outfilename = argv[file_index+1]; - } else { - if (file_index != argc-1) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - } -#else - /* Unix style: expect zero or one file name */ - if (file_index < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } -#endif /* TWO_FILE_COMMANDLINE */ - - /* Open the input file. */ - if (file_index < argc) { - if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ - input_file = read_stdin(); - } - - /* Open the output file. */ - if (outfilename != NULL) { - if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, outfilename); - exit(EXIT_FAILURE); - } - } else { - /* default output file is stdout */ - output_file = write_stdout(); - } - -#ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr) &cinfo, &progress); -#endif - - /* Specify data source for decompression */ - jpeg_stdio_src(&cinfo, input_file); - - /* Read file header, set default decompression parameters */ - (void) jpeg_read_header(&cinfo, TRUE); - - /* Adjust default decompression parameters by re-parsing the options */ - file_index = parse_switches(&cinfo, argc, argv, 0, TRUE); - - /* Initialize the output module now to let it override any crucial - * option settings (for instance, GIF wants to force color quantization). - */ - switch (requested_fmt) { -#ifdef BMP_SUPPORTED - case FMT_BMP: - dest_mgr = jinit_write_bmp(&cinfo, FALSE); - break; - case FMT_OS2: - dest_mgr = jinit_write_bmp(&cinfo, TRUE); - break; -#endif -#ifdef GIF_SUPPORTED - case FMT_GIF: - dest_mgr = jinit_write_gif(&cinfo); - break; -#endif -#ifdef PPM_SUPPORTED - case FMT_PPM: - dest_mgr = jinit_write_ppm(&cinfo); - break; -#endif -#ifdef RLE_SUPPORTED - case FMT_RLE: - dest_mgr = jinit_write_rle(&cinfo); - break; -#endif -#ifdef TARGA_SUPPORTED - case FMT_TARGA: - dest_mgr = jinit_write_targa(&cinfo); - break; -#endif - default: - ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT); - break; - } - dest_mgr->output_file = output_file; - - /* Start decompressor */ - (void) jpeg_start_decompress(&cinfo); - - /* Write output file header */ - (*dest_mgr->start_output) (&cinfo, dest_mgr); - - /* Process data */ - while (cinfo.output_scanline < cinfo.output_height) { - num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, - dest_mgr->buffer_height); - (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); - } - -#ifdef PROGRESS_REPORT - /* Hack: count final pass as done in case finish_output does an extra pass. - * The library won't have updated completed_passes. - */ - progress.pub.completed_passes = progress.pub.total_passes; -#endif - - /* Finish decompression and release memory. - * I must do it in this order because output module has allocated memory - * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory. - */ - (*dest_mgr->finish_output) (&cinfo, dest_mgr); - (void) jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - - /* Close files, if we opened them */ - if (input_file != stdin) - fclose(input_file); - if (output_file != stdout) - fclose(output_file); - -#ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr) &cinfo); -#endif - - /* All done. */ - exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/example.c b/example.c deleted file mode 100644 index 7fc354f0..00000000 --- a/example.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * example.c - * - * This file illustrates how to use the IJG code as a subroutine library - * to read or write JPEG image files. You should look at this code in - * conjunction with the documentation file libjpeg.doc. - * - * This code will not do anything useful as-is, but it may be helpful as a - * skeleton for constructing routines that call the JPEG library. - * - * We present these routines in the same coding style used in the JPEG code - * (ANSI function definitions, etc); but you are of course free to code your - * routines in a different style if you prefer. - */ - -#include - -/* - * Include file for users of JPEG library. - * You will need to have included system headers that define at least - * the typedefs FILE and size_t before you can include jpeglib.h. - * (stdio.h is sufficient on ANSI-conforming systems.) - * You may also wish to include "jerror.h". - */ - -#include "jpeglib.h" - -/* - * is used for the optional error recovery mechanism shown in - * the second part of the example. - */ - -#include - - - -/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/ - -/* This half of the example shows how to feed data into the JPEG compressor. - * We present a minimal version that does not worry about refinements such - * as error recovery (the JPEG code will just exit() if it gets an error). - */ - - -/* - * IMAGE DATA FORMATS: - * - * The standard input image format is a rectangular array of pixels, with - * each pixel having the same number of "component" values (color channels). - * Each pixel row is an array of JSAMPLEs (which typically are unsigned chars). - * If you are working with color data, then the color values for each pixel - * must be adjacent in the row; for example, R,G,B,R,G,B,R,G,B,... for 24-bit - * RGB color. - * - * For this example, we'll assume that this data structure matches the way - * our application has stored the image in memory, so we can just pass a - * pointer to our image buffer. In particular, let's say that the image is - * RGB color and is described by: - */ - -extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */ -extern int image_height; /* Number of rows in image */ -extern int image_width; /* Number of columns in image */ - - -/* - * Sample routine for JPEG compression. We assume that the target file name - * and a compression quality factor are passed in. - */ - -GLOBAL(void) -write_JPEG_file (char * filename, int quality) -{ - /* This struct contains the JPEG compression parameters and pointers to - * working space (which is allocated as needed by the JPEG library). - * It is possible to have several such structures, representing multiple - * compression/decompression processes, in existence at once. We refer - * to any one struct (and its associated working data) as a "JPEG object". - */ - struct jpeg_compress_struct cinfo; - /* This struct represents a JPEG error handler. It is declared separately - * because applications often want to supply a specialized error handler - * (see the second half of this file for an example). But here we just - * take the easy way out and use the standard error handler, which will - * print a message on stderr and call exit() if compression fails. - * Note that this struct must live as long as the main JPEG parameter - * struct, to avoid dangling-pointer problems. - */ - struct jpeg_error_mgr jerr; - /* More stuff */ - FILE * outfile; /* target file */ - JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ - int row_stride; /* physical row width in image buffer */ - - /* Step 1: allocate and initialize JPEG compression object */ - - /* We have to set up the error handler first, in case the initialization - * step fails. (Unlikely, but it could happen if you are out of memory.) - * This routine fills in the contents of struct jerr, and returns jerr's - * address which we place into the link field in cinfo. - */ - cinfo.err = jpeg_std_error(&jerr); - /* Now we can initialize the JPEG compression object. */ - jpeg_create_compress(&cinfo); - - /* Step 2: specify data destination (eg, a file) */ - /* Note: steps 2 and 3 can be done in either order. */ - - /* Here we use the library-supplied code to send compressed data to a - * stdio stream. You can also write your own code to do something else. - * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that - * requires it in order to write binary files. - */ - if ((outfile = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - exit(1); - } - jpeg_stdio_dest(&cinfo, outfile); - - /* Step 3: set parameters for compression */ - - /* First we supply a description of the input image. - * Four fields of the cinfo struct must be filled in: - */ - cinfo.image_width = image_width; /* image width and height, in pixels */ - cinfo.image_height = image_height; - cinfo.input_components = 3; /* # of color components per pixel */ - cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ - /* Now use the library's routine to set default compression parameters. - * (You must set at least cinfo.in_color_space before calling this, - * since the defaults depend on the source color space.) - */ - jpeg_set_defaults(&cinfo); - /* Now you can set any non-default parameters you wish to. - * Here we just illustrate the use of quality (quantization table) scaling: - */ - jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */); - - /* Step 4: Start compressor */ - - /* TRUE ensures that we will write a complete interchange-JPEG file. - * Pass TRUE unless you are very sure of what you're doing. - */ - jpeg_start_compress(&cinfo, TRUE); - - /* Step 5: while (scan lines remain to be written) */ - /* jpeg_write_scanlines(...); */ - - /* Here we use the library's state variable cinfo.next_scanline as the - * loop counter, so that we don't have to keep track ourselves. - * To keep things simple, we pass one scanline per call; you can pass - * more if you wish, though. - */ - row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ - - while (cinfo.next_scanline < cinfo.image_height) { - /* jpeg_write_scanlines expects an array of pointers to scanlines. - * Here the array is only one element long, but you could pass - * more than one scanline at a time if that's more convenient. - */ - row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; - (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); - } - - /* Step 6: Finish compression */ - - jpeg_finish_compress(&cinfo); - /* After finish_compress, we can close the output file. */ - fclose(outfile); - - /* Step 7: release JPEG compression object */ - - /* This is an important step since it will release a good deal of memory. */ - jpeg_destroy_compress(&cinfo); - - /* And we're done! */ -} - - -/* - * SOME FINE POINTS: - * - * In the above loop, we ignored the return value of jpeg_write_scanlines, - * which is the number of scanlines actually written. We could get away - * with this because we were only relying on the value of cinfo.next_scanline, - * which will be incremented correctly. If you maintain additional loop - * variables then you should be careful to increment them properly. - * Actually, for output to a stdio stream you needn't worry, because - * then jpeg_write_scanlines will write all the lines passed (or else exit - * with a fatal error). Partial writes can only occur if you use a data - * destination module that can demand suspension of the compressor. - * (If you don't know what that's for, you don't need it.) - * - * If the compressor requires full-image buffers (for entropy-coding - * optimization or a multi-scan JPEG file), it will create temporary - * files for anything that doesn't fit within the maximum-memory setting. - * (Note that temp files are NOT needed if you use the default parameters.) - * On some systems you may need to set up a signal handler to ensure that - * temporary files are deleted if the program is interrupted. See libjpeg.doc. - * - * Scanlines MUST be supplied in top-to-bottom order if you want your JPEG - * files to be compatible with everyone else's. If you cannot readily read - * your data in that order, you'll need an intermediate array to hold the - * image. See rdtarga.c or rdbmp.c for examples of handling bottom-to-top - * source data using the JPEG code's internal virtual-array mechanisms. - */ - - - -/******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/ - -/* This half of the example shows how to read data from the JPEG decompressor. - * It's a bit more refined than the above, in that we show: - * (a) how to modify the JPEG library's standard error-reporting behavior; - * (b) how to allocate workspace using the library's memory manager. - * - * Just to make this example a little different from the first one, we'll - * assume that we do not intend to put the whole image into an in-memory - * buffer, but to send it line-by-line someplace else. We need a one- - * scanline-high JSAMPLE array as a work buffer, and we will let the JPEG - * memory manager allocate it for us. This approach is actually quite useful - * because we don't need to remember to deallocate the buffer separately: it - * will go away automatically when the JPEG object is cleaned up. - */ - - -/* - * ERROR HANDLING: - * - * The JPEG library's standard error handler (jerror.c) is divided into - * several "methods" which you can override individually. This lets you - * adjust the behavior without duplicating a lot of code, which you might - * have to update with each future release. - * - * Our example here shows how to override the "error_exit" method so that - * control is returned to the library's caller when a fatal error occurs, - * rather than calling exit() as the standard error_exit method does. - * - * We use C's setjmp/longjmp facility to return control. This means that the - * routine which calls the JPEG library must first execute a setjmp() call to - * establish the return point. We want the replacement error_exit to do a - * longjmp(). But we need to make the setjmp buffer accessible to the - * error_exit routine. To do this, we make a private extension of the - * standard JPEG error handler object. (If we were using C++, we'd say we - * were making a subclass of the regular error handler.) - * - * Here's the extended error handler struct: - */ - -struct my_error_mgr { - struct jpeg_error_mgr pub; /* "public" fields */ - - jmp_buf setjmp_buffer; /* for return to caller */ -}; - -typedef struct my_error_mgr * my_error_ptr; - -/* - * Here's the routine that will replace the standard error_exit method: - */ - -METHODDEF(void) -my_error_exit (j_common_ptr cinfo) -{ - /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ - my_error_ptr myerr = (my_error_ptr) cinfo->err; - - /* Always display the message. */ - /* We could postpone this until after returning, if we chose. */ - (*cinfo->err->output_message) (cinfo); - - /* Return control to the setjmp point */ - longjmp(myerr->setjmp_buffer, 1); -} - - -/* - * Sample routine for JPEG decompression. We assume that the source file name - * is passed in. We want to return 1 on success, 0 on error. - */ - - -GLOBAL(int) -read_JPEG_file (char * filename) -{ - /* This struct contains the JPEG decompression parameters and pointers to - * working space (which is allocated as needed by the JPEG library). - */ - struct jpeg_decompress_struct cinfo; - /* We use our private extension JPEG error handler. - * Note that this struct must live as long as the main JPEG parameter - * struct, to avoid dangling-pointer problems. - */ - struct my_error_mgr jerr; - /* More stuff */ - FILE * infile; /* source file */ - JSAMPARRAY buffer; /* Output row buffer */ - int row_stride; /* physical row width in output buffer */ - - /* In this example we want to open the input file before doing anything else, - * so that the setjmp() error recovery below can assume the file is open. - * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that - * requires it in order to read binary files. - */ - - if ((infile = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - return 0; - } - - /* Step 1: allocate and initialize JPEG decompression object */ - - /* We set up the normal JPEG error routines, then override error_exit. */ - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - /* Establish the setjmp return context for my_error_exit to use. */ - if (setjmp(jerr.setjmp_buffer)) { - /* If we get here, the JPEG code has signaled an error. - * We need to clean up the JPEG object, close the input file, and return. - */ - jpeg_destroy_decompress(&cinfo); - fclose(infile); - return 0; - } - /* Now we can initialize the JPEG decompression object. */ - jpeg_create_decompress(&cinfo); - - /* Step 2: specify data source (eg, a file) */ - - jpeg_stdio_src(&cinfo, infile); - - /* Step 3: read file parameters with jpeg_read_header() */ - - (void) jpeg_read_header(&cinfo, TRUE); - /* We can ignore the return value from jpeg_read_header since - * (a) suspension is not possible with the stdio data source, and - * (b) we passed TRUE to reject a tables-only JPEG file as an error. - * See libjpeg.doc for more info. - */ - - /* Step 4: set parameters for decompression */ - - /* In this example, we don't need to change any of the defaults set by - * jpeg_read_header(), so we do nothing here. - */ - - /* Step 5: Start decompressor */ - - (void) jpeg_start_decompress(&cinfo); - /* We can ignore the return value since suspension is not possible - * with the stdio data source. - */ - - /* We may need to do some setup of our own at this point before reading - * the data. After jpeg_start_decompress() we have the correct scaled - * output image dimensions available, as well as the output colormap - * if we asked for color quantization. - * In this example, we need to make an output work buffer of the right size. - */ - /* JSAMPLEs per row in output buffer */ - row_stride = cinfo.output_width * cinfo.output_components; - /* Make a one-row-high sample array that will go away when done with image */ - buffer = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); - - /* Step 6: while (scan lines remain to be read) */ - /* jpeg_read_scanlines(...); */ - - /* Here we use the library's state variable cinfo.output_scanline as the - * loop counter, so that we don't have to keep track ourselves. - */ - while (cinfo.output_scanline < cinfo.output_height) { - /* jpeg_read_scanlines expects an array of pointers to scanlines. - * Here the array is only one element long, but you could ask for - * more than one scanline at a time if that's more convenient. - */ - (void) jpeg_read_scanlines(&cinfo, buffer, 1); - /* Assume put_scanline_someplace wants a pointer and sample count. */ - put_scanline_someplace(buffer[0], row_stride); - } - - /* Step 7: Finish decompression */ - - (void) jpeg_finish_decompress(&cinfo); - /* We can ignore the return value since suspension is not possible - * with the stdio data source. - */ - - /* Step 8: Release JPEG decompression object */ - - /* This is an important step since it will release a good deal of memory. */ - jpeg_destroy_decompress(&cinfo); - - /* After finish_decompress, we can close the input file. - * Here we postpone it until after no more JPEG errors are possible, - * so as to simplify the setjmp error logic above. (Actually, I don't - * think that jpeg_destroy can do an error exit, but why assume anything...) - */ - fclose(infile); - - /* At this point you may want to check to see whether any corrupt-data - * warnings occurred (test whether jerr.pub.num_warnings is nonzero). - */ - - /* And we're done! */ - return 1; -} - - -/* - * SOME FINE POINTS: - * - * In the above code, we ignored the return value of jpeg_read_scanlines, - * which is the number of scanlines actually read. We could get away with - * this because we asked for only one line at a time and we weren't using - * a suspending data source. See libjpeg.doc for more info. - * - * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress(); - * we should have done it beforehand to ensure that the space would be - * counted against the JPEG max_memory setting. In some systems the above - * code would risk an out-of-memory error. However, in general we don't - * know the output image dimensions before jpeg_start_decompress(), unless we - * call jpeg_calc_output_dimensions(). See libjpeg.doc for more about this. - * - * Scanlines are returned in the same order as they appear in the JPEG file, - * which is standardly top-to-bottom. If you must emit data bottom-to-top, - * you can use one of the virtual arrays provided by the JPEG memory manager - * to invert the data. See wrbmp.c for an example. - * - * As with compression, some operating modes may require temporary files. - * On some systems you may need to set up a signal handler to ensure that - * temporary files are deleted if the program is interrupted. See libjpeg.doc. - */ diff --git a/filelist.doc b/filelist.doc deleted file mode 100644 index e14982ca..00000000 --- a/filelist.doc +++ /dev/null @@ -1,210 +0,0 @@ -IJG JPEG LIBRARY: FILE LIST - -Copyright (C) 1994-1998, 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. - - -Here is a road map to the files in the IJG JPEG distribution. The -distribution includes the JPEG library proper, plus two application -programs ("cjpeg" and "djpeg") which use the library to convert JPEG -files to and from some other popular image formats. A third application -"jpegtran" uses the library to do lossless conversion between different -variants of JPEG. There are also two stand-alone applications, -"rdjpgcom" and "wrjpgcom". - - -THE JPEG LIBRARY -================ - -Include files: - -jpeglib.h JPEG library's exported data and function declarations. -jconfig.h Configuration declarations. Note: this file is not present - in the distribution; it is generated during installation. -jmorecfg.h Additional configuration declarations; need not be changed - for a standard installation. -jerror.h Declares JPEG library's error and trace message codes. -jinclude.h Central include file used by all IJG .c files to reference - system include files. -jpegint.h JPEG library's internal data structures. -jchuff.h Private declarations for Huffman encoder modules. -jdhuff.h Private declarations for Huffman decoder modules. -jdct.h Private declarations for forward & reverse DCT subsystems. -jmemsys.h Private declarations for memory management subsystem. -jversion.h Version information. - -Applications using the library should include jpeglib.h (which in turn -includes jconfig.h and jmorecfg.h). Optionally, jerror.h may be included -if the application needs to reference individual JPEG error codes. The -other include files are intended for internal use and would not normally -be included by an application program. (cjpeg/djpeg/etc do use jinclude.h, -since its function is to improve portability of the whole IJG distribution. -Most other applications will directly include the system include files they -want, and hence won't need jinclude.h.) - - -C source code files: - -These files contain most of the functions intended to be called directly by -an application program: - -jcapimin.c Application program interface: core routines for compression. -jcapistd.c Application program interface: standard compression. -jdapimin.c Application program interface: core routines for decompression. -jdapistd.c Application program interface: standard decompression. -jcomapi.c Application program interface routines common to compression - and decompression. -jcparam.c Compression parameter setting helper routines. -jctrans.c API and library routines for transcoding compression. -jdtrans.c API and library routines for transcoding decompression. - -Compression side of the library: - -jcinit.c Initialization: determines which other modules to use. -jcmaster.c Master control: setup and inter-pass sequencing logic. -jcmainct.c Main buffer controller (preprocessor => JPEG compressor). -jcprepct.c Preprocessor buffer controller. -jccoefct.c Buffer controller for DCT coefficient buffer. -jccolor.c Color space conversion. -jcsample.c Downsampling. -jcdctmgr.c DCT manager (DCT implementation selection & control). -jfdctint.c Forward DCT using slow-but-accurate integer method. -jfdctfst.c Forward DCT using faster, less accurate integer method. -jfdctflt.c Forward DCT using floating-point arithmetic. -jchuff.c Huffman entropy coding for sequential JPEG. -jcphuff.c Huffman entropy coding for progressive JPEG. -jcmarker.c JPEG marker writing. -jdatadst.c Data destination manager for stdio output. - -Decompression side of the library: - -jdmaster.c Master control: determines which other modules to use. -jdinput.c Input controller: controls input processing modules. -jdmainct.c Main buffer controller (JPEG decompressor => postprocessor). -jdcoefct.c Buffer controller for DCT coefficient buffer. -jdpostct.c Postprocessor buffer controller. -jdmarker.c JPEG marker reading. -jdhuff.c Huffman entropy decoding for sequential JPEG. -jdphuff.c Huffman entropy decoding for progressive JPEG. -jddctmgr.c IDCT manager (IDCT implementation selection & control). -jidctint.c Inverse DCT using slow-but-accurate integer method. -jidctfst.c Inverse DCT using faster, less accurate integer method. -jidctflt.c Inverse DCT using floating-point arithmetic. -jidctred.c Inverse DCTs with reduced-size outputs. -jdsample.c Upsampling. -jdcolor.c Color space conversion. -jdmerge.c Merged upsampling/color conversion (faster, lower quality). -jquant1.c One-pass color quantization using a fixed-spacing colormap. -jquant2.c Two-pass color quantization using a custom-generated colormap. - Also handles one-pass quantization to an externally given map. -jdatasrc.c Data source manager for stdio input. - -Support files for both compression and decompression: - -jerror.c Standard error handling routines (application replaceable). -jmemmgr.c System-independent (more or less) memory management code. -jutils.c Miscellaneous utility routines. - -jmemmgr.c relies on a system-dependent memory management module. The IJG -distribution includes the following implementations of the system-dependent -module: - -jmemnobs.c "No backing store": assumes adequate virtual memory exists. -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 (16-bit environment only): - can use extended and expanded memory as well as temp 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). -On unusual systems you may find it worthwhile to make a special -system-dependent memory manager. - - -Non-C source code files: - -jmemdosa.asm 80x86 assembly code support for jmemdos.c; used only in - MS-DOS-specific configurations of the JPEG library. - - -CJPEG/DJPEG/JPEGTRAN -==================== - -Include files: - -cdjpeg.h Declarations shared by cjpeg/djpeg/jpegtran modules. -cderror.h Additional error and trace message codes for cjpeg et al. -transupp.h Declarations for jpegtran support routines in transupp.c. - -C source code files: - -cjpeg.c Main program for cjpeg. -djpeg.c Main program for djpeg. -jpegtran.c Main program for jpegtran. -cdjpeg.c Utility routines used by all three programs. -rdcolmap.c Code to read a colormap file for djpeg's "-map" switch. -rdswitch.c Code to process some of cjpeg's more complex switches. - Also used by jpegtran. -transupp.c Support code for jpegtran: lossless image manipulations. - -Image file reader modules for cjpeg: - -rdbmp.c BMP file input. -rdgif.c GIF file input (now just a stub). -rdppm.c PPM/PGM file input. -rdrle.c Utah RLE file input. -rdtarga.c Targa file input. - -Image file writer modules for djpeg: - -wrbmp.c BMP file output. -wrgif.c GIF file output (a mere shadow of its former self). -wrppm.c PPM/PGM file output. -wrrle.c Utah RLE file output. -wrtarga.c Targa file output. - - -RDJPGCOM/WRJPGCOM -================= - -C source code files: - -rdjpgcom.c Stand-alone rdjpgcom application. -wrjpgcom.c Stand-alone wrjpgcom application. - -These programs do not depend on the IJG library. They do use -jconfig.h and jinclude.h, only to improve portability. - - -ADDITIONAL FILES -================ - -Documentation (see README for a guide to the documentation files): - -README Master documentation file. -*.doc Other documentation files. -*.1 Documentation in Unix man page format. -change.log Version-to-version change highlights. -example.c Sample code for calling JPEG library. - -Configuration/installation files and programs (see install.doc for more info): - -configure Unix shell script to perform automatic configuration. -ltconfig Support scripts for configure (from GNU libtool). -ltmain.sh -config.guess -config.sub -install-sh Install shell script for those Unix systems lacking one. -ckconfig.c Program to generate jconfig.h on non-Unix systems. -jconfig.doc Template for making jconfig.h by hand. -makefile.* Sample makefiles for particular systems. -jconfig.* Sample jconfig.h for particular systems. -ansi2knr.c De-ANSIfier for pre-ANSI C compilers (courtesy of - L. Peter Deutsch and Aladdin Enterprises). - -Test files (see install.doc for test procedure): - -test*.* Source and comparison files for confidence test. - These are binary image files, NOT text files. diff --git a/install.doc b/install.doc deleted file mode 100644 index 3702b986..00000000 --- a/install.doc +++ /dev/null @@ -1,1063 +0,0 @@ -INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software - -Copyright (C) 1991-1998, 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. - - -This file explains how to configure and install the IJG software. We have -tried to make this software extremely portable and flexible, so that it can be -adapted to almost any environment. The downside of this decision is that the -installation process is complicated. We have provided shortcuts to simplify -the task on common systems. But in any case, you will need at least a little -familiarity with C programming and program build procedures for your system. - -If you are only using this software as part of a larger program, the larger -program's installation procedure may take care of configuring the IJG code. -For example, Ghostscript's installation script will configure the IJG code. -You don't need to read this file if you just want to compile Ghostscript. - -If you are on a Unix machine, you may not need to read this file at all. -Try doing - ./configure - make - make test -If that doesn't complain, do - make install -(better do "make -n install" first to see if the makefile will put the files -where you want them). Read further if you run into snags or want to customize -the code for your system. - - -TABLE OF CONTENTS ------------------ - -Before you start -Configuring the software: - using the automatic "configure" script - using one of the supplied jconfig and makefile files - by hand -Building the software -Testing the software -Installing the software -Optional stuff -Optimization -Hints for specific systems - - -BEFORE YOU START -================ - -Before installing the software you must unpack the distributed source code. -Since you are reading this file, you have probably already succeeded in this -task. However, there is a potential for error if you needed to convert the -files to the local standard text file format (for example, if you are on -MS-DOS you may have converted LF end-of-line to CR/LF). You must apply -such conversion to all the files EXCEPT those whose names begin with "test". -The test files contain binary data; if you change them in any way then the -self-test will give bad results. - -Please check the last section of this file to see if there are hints for the -specific machine or compiler you are using. - - -CONFIGURING THE SOFTWARE -======================== - -To configure the IJG code for your system, you need to create two files: - * jconfig.h: contains values for system-dependent #define symbols. - * Makefile: controls the compilation process. -(On a non-Unix machine, you may create "project files" or some other -substitute for a Makefile. jconfig.h is needed in any environment.) - -We provide three different ways to generate these files: - * On a Unix system, you can just run the "configure" script. - * We provide sample jconfig files and makefiles for popular machines; - if your machine matches one of the samples, just copy the right sample - files to jconfig.h and Makefile. - * If all else fails, read the instructions below and make your own files. - - -Configuring the software using the automatic "configure" script ---------------------------------------------------------------- - -If you are on a Unix machine, you can just type - ./configure -and let the configure script construct appropriate configuration files. -If you're using "csh" on an old version of System V, you might need to type - sh configure -instead to prevent csh from trying to execute configure itself. -Expect configure to run for a few minutes, particularly on slower machines; -it works by compiling a series of test programs. - -Configure was created with GNU Autoconf and it follows the usual conventions -for GNU configure scripts. It makes a few assumptions that you may want to -override. You can do this by providing optional switches to configure: - -* If you want to build libjpeg as a shared library, say - ./configure --enable-shared -To get both shared and static libraries, say - ./configure --enable-shared --enable-static -Note that these switches invoke GNU libtool to take care of system-dependent -shared library building methods. If things don't work this way, please try -running configure without either switch; that should build a static library -without using libtool. If that works, your problem is probably with libtool -not with the IJG code. libtool is fairly new and doesn't support all flavors -of Unix yet. (You might be able to find a newer version of libtool than the -one included with libjpeg; see ftp.gnu.org. Report libtool problems to -bug-libtool@gnu.org.) - -* Configure will use gcc (GNU C compiler) if it's available, otherwise cc. -To force a particular compiler to be selected, use the CC option, for example - ./configure CC='cc' -The same method can be used to include any unusual compiler switches. -For example, on HP-UX you probably want to say - ./configure CC='cc -Aa' -to get HP's compiler to run in ANSI mode. - -* The default CFLAGS setting is "-O" for non-gcc compilers, "-O2" for gcc. -You can override this by saying, for example, - ./configure CFLAGS='-g' -if you want to compile with debugging support. - -* Configure will set up the makefile so that "make install" will install files -into /usr/local/bin, /usr/local/man, etc. You can specify an installation -prefix other than "/usr/local" by giving configure the option "--prefix=PATH". - -* If you don't have a lot of swap space, you may need to enable the IJG -software's internal virtual memory mechanism. To do this, give the option -"--enable-maxmem=N" where N is the default maxmemory limit in megabytes. -This is discussed in more detail under "Selecting a memory manager", below. -You probably don't need to worry about this on reasonably-sized Unix machines, -unless you plan to process very large images. - -Configure has some other features that are useful if you are cross-compiling -or working in a network of multiple machine types; but if you need those -features, you probably already know how to use them. - - -Configuring the software using one of the supplied jconfig and makefile files ------------------------------------------------------------------------------ - -If you have one of these systems, you can just use the provided configuration -files: - -Makefile jconfig file System and/or compiler - -makefile.manx jconfig.manx Amiga, Manx Aztec C -makefile.sas jconfig.sas Amiga, SAS C -makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior -mak*jpeg.st jconfig.st Atari ST/STE/TT, Pure C or Turbo C -makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C -makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C) -makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only) -makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C -makefile.vc jconfig.vc Windows NT/95, MS Visual C++ -make*.ds jconfig.vc Windows NT/95, MS Developer Studio -makefile.mms jconfig.vms Digital VMS, with MMS software -makefile.vms jconfig.vms Digital VMS, without MMS software - -Copy the proper jconfig file to jconfig.h and the makefile to Makefile (or -whatever your system uses as the standard makefile name). For more info see -the appropriate system-specific hints section near the end of this file. - - -Configuring the software by hand --------------------------------- - -First, generate a jconfig.h file. If you are moderately familiar with C, -the comments in jconfig.doc should be enough information to do this; just -copy jconfig.doc to jconfig.h and edit it appropriately. Otherwise, you may -prefer to use the ckconfig.c program. You will need to compile and execute -ckconfig.c by hand --- we hope you know at least enough to do that. -ckconfig.c may not compile the first try (in fact, the whole idea is for it -to fail if anything is going to). If you get compile errors, fix them by -editing ckconfig.c according to the directions given in ckconfig.c. Once -you get it to run, it will write a suitable jconfig.h file, and will also -print out some advice about which makefile to use. - -You may also want to look at the canned jconfig files, if there is one for a -system similar to yours. - -Second, select a makefile and copy it to Makefile (or whatever your system -uses as the standard makefile name). The most generic makefiles we provide -are - makefile.ansi: if your C compiler supports function prototypes - makefile.unix: if not. -(You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES" -in jconfig.h.) You may want to start from one of the other makefiles if -there is one for a system similar to yours. - -Look over the selected Makefile and adjust options as needed. In particular -you may want to change the CC and CFLAGS definitions. For instance, if you -are using GCC, set CC=gcc. If you had to use any compiler switches to get -ckconfig.c to work, make sure the same switches are in CFLAGS. - -If you are on a system that doesn't use makefiles, you'll need to set up -project files (or whatever you do use) to compile all the source files and -link them into executable files cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom. -See the file lists in any of the makefiles to find out which files go into -each program. Note that the provided makefiles all make a "library" file -libjpeg first, but you don't have to do that if you don't want to; the file -lists identify which source files are actually needed for compression, -decompression, or both. As a last resort, you can make a batch script that -just compiles everything and links it all together; makefile.vms is an example -of this (it's for VMS systems that have no make-like utility). - -Here are comments about some specific configuration decisions you'll -need to make: - -Command line style ------------------- - -These programs can use a Unix-like command line style which supports -redirection and piping, like this: - cjpeg inputfile >outputfile - cjpeg outputfile - source program | cjpeg >outputfile -The simpler "two file" command line style is just - cjpeg inputfile outputfile -You may prefer the two-file style, particularly if you don't have pipes. - -You MUST use two-file style on any system that doesn't cope well with binary -data fed through stdin/stdout; this is true for some MS-DOS compilers, for -example. If you're not on a Unix system, it's safest to assume you need -two-file style. (But if your compiler provides either the Posix-standard -fdopen() library routine or a Microsoft-compatible setmode() routine, you -can safely use the Unix command line style, by defining USE_FDOPEN or -USE_SETMODE respectively.) - -To use the two-file style, make jconfig.h say "#define TWO_FILE_COMMANDLINE". - -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 five different -memory managers: - -* jmemansi.c This version uses the ANSI-standard library routine tmpfile(), - which not all non-ANSI systems have. On some systems - tmpfile() may put the temporary file in a non-optimal - location; if you don't like what it does, use jmemname.c. - -* jmemname.c This version creates named temporary files. For anything - except a Unix machine, you'll need to configure the - select_file_name() routine appropriately; see the comments - near the head of jmemname.c. If you use this version, define - NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files - are removed if the program is aborted. - -* jmemnobs.c (That stands for No Backing Store :-).) This will compile on - almost any system, but it assumes you have enough main memory - or virtual memory to hold the biggest images you work with. - -* jmemdos.c This should be used with most 16-bit MS-DOS compilers. - See the system-specific notes about MS-DOS for more info. - 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 - 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 -or jmemansi.obj for jmemansi.c). - -If you have plenty of (real or virtual) main memory, just use jmemnobs.c. -"Plenty" means about ten bytes for every pixel in the largest images -you plan to process, so a lot of systems don't meet this criterion. -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 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 -needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory -setting. Larger max-memory settings reduce the amount of I/O needed to -process a large image, but too large a value can result in "insufficient -memory" failures. On most Unix machines (and other systems with virtual -memory), just set DEFAULT_MAX_MEM to several million and forget it. At the -other end of the spectrum, for MS-DOS machines you probably can't go much -above 300K to 400K. (On MS-DOS the value refers to conventional memory only. -Extended/expanded memory is handled separately by jmemdos.c.) - - -BUILDING THE SOFTWARE -===================== - -Now you should be able to compile the software. Just say "make" (or -whatever's necessary to start the compilation). Have a cup of coffee. - -Here are some things that could go wrong: - -If your compiler complains about undefined structures, you should be able to -shut it up by putting "#define INCOMPLETE_TYPES_BROKEN" in jconfig.h. - -If you have trouble with missing system include files or inclusion of the -wrong ones, read jinclude.h. This shouldn't happen if you used configure -or ckconfig.c to set up jconfig.h. - -There are a fair number of routines that do not use all of their parameters; -some compilers will issue warnings about this, which you can ignore. There -are also a few configuration checks that may give "unreachable code" warnings. -Any other warning deserves investigation. - -If you don't have a getenv() library routine, define NO_GETENV. - -Also see the system-specific hints, below. - - -TESTING THE SOFTWARE -==================== - -As a quick test of functionality we've included a small sample image in -several forms: - testorig.jpg Starting point for the djpeg tests. - testimg.ppm The output of djpeg testorig.jpg - testimg.bmp The output of djpeg -bmp -colors 256 testorig.jpg - testimg.jpg The output of cjpeg testimg.ppm - testprog.jpg Progressive-mode equivalent of testorig.jpg. - testimgp.jpg The output of cjpeg -progressive -optimize testimg.ppm -(The first- and second-generation .jpg files aren't identical since JPEG is -lossy.) If you can generate duplicates of the testimg* files then you -probably have working programs. - -With most of the makefiles, "make test" will perform the necessary -comparisons. - -If you're using a makefile that doesn't provide the test option, run djpeg -and cjpeg by hand and compare the output files to testimg* with whatever -binary file comparison tool you have. The files should be bit-for-bit -identical. - -If the programs complain "MAX_ALLOC_CHUNK is wrong, please fix", then you -need to reduce MAX_ALLOC_CHUNK to a value that fits in type size_t. -Try adding "#define MAX_ALLOC_CHUNK 65520L" to jconfig.h. A less likely -configuration error is "ALIGN_TYPE is wrong, please fix": defining ALIGN_TYPE -as long should take care of that one. - -If the cjpeg test run fails with "Missing Huffman code table entry", it's a -good bet that you needed to define RIGHT_SHIFT_IS_UNSIGNED. Go back to the -configuration step and run ckconfig.c. (This is a good plan for any other -test failure, too.) - -If you are using Unix (one-file) command line style on a non-Unix system, -it's a good idea to check that binary I/O through stdin/stdout actually -works. You should get the same results from "djpeg out.ppm" -as from "djpeg -outfile out.ppm testorig.jpg". Note that the makefiles all -use the latter style and therefore do not exercise stdin/stdout! If this -check fails, try recompiling with USE_SETMODE or USE_FDOPEN defined. -If it still doesn't work, better use two-file style. - -If you chose a memory manager other than jmemnobs.c, you should test that -temporary-file usage works. Try "djpeg -bmp -colors 256 -max 0 testorig.jpg" -and make sure its output matches testimg.bmp. If you have any really large -images handy, try compressing them with -optimize and/or decompressing with --colors 256 to make sure your DEFAULT_MAX_MEM setting is not too large. - -NOTE: this is far from an exhaustive test of the JPEG software; some modules, -such as 1-pass color quantization, are not exercised at all. It's just a -quick test to give you some confidence that you haven't missed something -major. - - -INSTALLING THE SOFTWARE -======================= - -Once you're done with the above steps, you can install the software by -copying the executable files (cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom) -to wherever you normally install programs. On Unix systems, you'll also want -to put the man pages (cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1) -in the man-page directory. The pre-fab makefiles don't support this step -since there's such a wide variety of installation procedures on different -systems. - -If you generated a Makefile with the "configure" script, you can just say - make install -to install the programs and their man pages into the standard places. -(You'll probably need to be root to do this.) We recommend first saying - make -n install -to see where configure thought the files should go. You may need to edit -the Makefile, particularly if your system's conventions for man page -filenames don't match what configure expects. - -If you want to install the IJG library itself, for use in compiling other -programs besides ours, then you need to put the four include files - jpeglib.h jerror.h jconfig.h jmorecfg.h -into your include-file directory, and put the library file libjpeg.a -(extension may vary depending on system) wherever library files go. -If you generated a Makefile with "configure", it will do what it thinks -is the right thing if you say - make install-lib - - -OPTIONAL STUFF -============== - -Progress monitor: - -If you like, you can #define PROGRESS_REPORT (in jconfig.h) to enable display -of percent-done progress reports. The routine provided in cdjpeg.c merely -prints percentages to stderr, but you can customize it to do something -fancier. - -Utah RLE file format support: - -We distribute the software with support for RLE image files (Utah Raster -Toolkit format) disabled, because the RLE support won't compile without the -Utah library. If you have URT version 3.1 or later, you can enable RLE -support as follows: - 1. #define RLE_SUPPORTED in jconfig.h. - 2. Add a -I option to CFLAGS in the Makefile for the directory - containing the URT .h files (typically the "include" - subdirectory of the URT distribution). - 3. Add -L... -lrle to LDLIBS in the Makefile, where ... specifies - the directory containing the URT "librle.a" file (typically the - "lib" subdirectory of the URT distribution). - -Support for 12-bit-deep pixel data: - -The JPEG standard allows either 8-bit or 12-bit data precision. (For color, -this means 8 or 12 bits per channel, of course.) If you need to work with -deeper than 8-bit data, you can compile the IJG code for 12-bit operation. -To do so: - 1. In jmorecfg.h, define BITS_IN_JSAMPLE as 12 rather than 8. - 2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED, - because the code for those formats doesn't handle 12-bit data and won't - even compile. (The PPM code does work, as explained below. The GIF - code works too; it scales 8-bit GIF data to and from 12-bit depth - automatically.) - 3. Compile. Don't expect "make test" to pass, since the supplied test - files are for 8-bit data. - -Currently, 12-bit support does not work on 16-bit-int machines. - -Note that a 12-bit version will not read 8-bit JPEG files, nor vice versa; -so you'll want to keep around a regular 8-bit compilation as well. -(Run-time selection of data depth, to allow a single copy that does both, -is possible but would probably slow things down considerably; it's very low -on our to-do list.) - -The PPM reader (rdppm.c) can read 12-bit data from either text-format or -binary-format PPM and PGM files. Binary-format PPM/PGM files which have a -maxval greater than 255 are assumed to use 2 bytes per sample, LSB first -(little-endian order). As of early 1995, 2-byte binary format is not -officially supported by the PBMPLUS library, but it is expected that a -future release of PBMPLUS will support it. Note that the PPM reader will -read files of any maxval regardless of the BITS_IN_JSAMPLE setting; incoming -data is automatically rescaled to either maxval=255 or maxval=4095 as -appropriate for the cjpeg bit depth. - -The PPM writer (wrppm.c) will normally write 2-byte binary PPM or PGM -format, maxval 4095, when compiled with BITS_IN_JSAMPLE=12. Since this -format is not yet widely supported, you can disable it by compiling wrppm.c -with PPM_NORAWWORD defined; then the data is scaled down to 8 bits to make a -standard 1-byte/sample PPM or PGM file. (Yes, this means still another copy -of djpeg to keep around. But hopefully you won't need it for very long. -Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.) - -Of course, if you are working with 12-bit data, you probably have it stored -in some other, nonstandard format. In that case you'll probably want to -write your own I/O modules to read and write your format. - -Note that a 12-bit version of cjpeg always runs in "-optimize" mode, in -order to generate valid Huffman tables. This is necessary because our -default Huffman tables only cover 8-bit data. - -Removing code: - -If you need to make a smaller version of the JPEG software, some optional -functions can be removed at compile time. See the xxx_SUPPORTED #defines in -jconfig.h and jmorecfg.h. If at all possible, we recommend that you leave in -decoder support for all valid JPEG files, to ensure that you can read anyone's -output. Taking out support for image file formats that you don't use is the -most painless way to make the programs smaller. Another possibility is to -remove some of the DCT methods: in particular, the "IFAST" method may not be -enough faster than the others to be worth keeping on your machine. (If you -do remove ISLOW or IFAST, be sure to redefine JDCT_DEFAULT or JDCT_FASTEST -to a supported method, by adding a #define in jconfig.h.) - - -OPTIMIZATION -============ - -Unless you own a Cray, you'll probably be interested in making the JPEG -software go as fast as possible. This section covers some machine-dependent -optimizations you may want to try. We suggest that before trying any of -this, you first get the basic installation to pass the self-test step. -Repeat the self-test after any optimization to make sure that you haven't -broken anything. - -The integer DCT routines perform a lot of multiplications. These -multiplications must yield 32-bit results, but none of their input values -are more than 16 bits wide. On many machines, notably the 680x0 and 80x86 -CPUs, a 16x16=>32 bit multiply instruction is faster than a full 32x32=>32 -bit multiply. Unfortunately there is no portable way to specify such a -multiplication in C, but some compilers can generate one when you use the -right combination of casts. See the MULTIPLYxxx macro definitions in -jdct.h. If your compiler makes "int" be 32 bits and "short" be 16 bits, -defining SHORTxSHORT_32 is fairly likely to work. When experimenting with -alternate definitions, be sure to test not only whether the code still works -(use the self-test), but also whether it is actually faster --- on some -compilers, alternate definitions may compute the right answer, yet be slower -than the default. Timing cjpeg on a large PGM (grayscale) input file is the -best way to check this, as the DCT will be the largest fraction of the runtime -in that mode. (Note: some of the distributed compiler-specific jconfig files -already contain #define switches to select appropriate MULTIPLYxxx -definitions.) - -If your machine has sufficiently fast floating point hardware, you may find -that the float DCT method is faster than the integer DCT methods, even -after tweaking the integer multiply macros. In that case you may want to -make the float DCT be the default method. (The only objection to this is -that float DCT results may vary slightly across machines.) To do that, add -"#define JDCT_DEFAULT JDCT_FLOAT" to jconfig.h. Even if you don't change -the default, you should redefine JDCT_FASTEST, which is the method selected -by djpeg's -fast switch. Don't forget to update the documentation files -(usage.doc and/or cjpeg.1, djpeg.1) to agree with what you've done. - -If access to "short" arrays is slow on your machine, it may be a win to -define type JCOEF as int rather than short. This will cost a good deal of -memory though, particularly in some multi-pass modes, so don't do it unless -you have memory to burn and short is REALLY slow. - -If your compiler can compile function calls in-line, make sure the INLINE -macro in jmorecfg.h is defined as the keyword that marks a function -inline-able. Some compilers have a switch that tells the compiler to inline -any function it thinks is profitable (e.g., -finline-functions for gcc). -Enabling such a switch is likely to make the compiled code bigger but faster. - -In general, it's worth trying the maximum optimization level of your compiler, -and experimenting with any optional optimizations such as loop unrolling. -(Unfortunately, far too many compilers have optimizer bugs ... be prepared to -back off if the code fails self-test.) If you do any experimentation along -these lines, please report the optimal settings to jpeg-info@uunet.uu.net so -we can mention them in future releases. Be sure to specify your machine and -compiler version. - - -HINTS FOR SPECIFIC SYSTEMS -========================== - -We welcome reports on changes needed for systems not mentioned here. Submit -'em to jpeg-info@uunet.uu.net. Also, if configure or ckconfig.c is wrong -about how to configure the JPEG software for your system, please let us know. - - -Acorn RISC OS: - -(Thanks to Simon Middleton for these hints on compiling with Desktop C.) -After renaming the files according to Acorn conventions, take a copy of -makefile.ansi, change all occurrences of 'libjpeg.a' to 'libjpeg.o' and -change these definitions as indicated: - -CFLAGS= -throwback -IC: -Wn -LDLIBS=C:o.Stubs -SYSDEPMEM=jmemansi.o -LN=Link -AR=LibFile -c -o - -Also add a new line '.c.o:; $(cc) $< $(cflags) -c -o $@'. Remove the -lines '$(RM) libjpeg.o' and '$(AR2) libjpeg.o' and the 'jconfig.h' -dependency section. - -Copy jconfig.doc to jconfig.h. Edit jconfig.h to define TWO_FILE_COMMANDLINE -and CHAR_IS_UNSIGNED. - -Run the makefile using !AMU not !Make. If you want to use the 'clean' and -'test' makefile entries then you will have to fiddle with the syntax a bit -and rename the test files. - - -Amiga: - -SAS C 6.50 reportedly is too buggy to compile the IJG code properly. -A patch to update to 6.51 is available from SAS or AmiNet FTP sites. - -The supplied config files are set up to use jmemname.c as the memory -manager, with temporary files being created on the device named by -"JPEGTMP:". - - -Atari ST/STE/TT: - -Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st -to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively. The -project files should work as-is with Pure C. For Turbo C, change library -filenames "pc..." to "tc..." in each project file. Note that libjpeg.prj -selects jmemansi.c as the recommended memory manager. You'll probably want to -adjust the DEFAULT_MAX_MEM setting --- you want it to be a couple hundred K -less than your normal free memory. Put "#define DEFAULT_MAX_MEM nnnn" into -jconfig.h to do this. - -To use the 68881/68882 coprocessor for the floating point DCT, add the -compiler option "-8" to the project files and replace pcfltlib.lib with -pc881lib.lib in cjpeg.prj and djpeg.prj. Or if you don't have a -coprocessor, you may prefer to remove the float DCT code by undefining -DCT_FLOAT_SUPPORTED in jmorecfg.h (since without a coprocessor, the float -code will be too slow to be useful). In that case, you can delete -pcfltlib.lib from the project files. - -Note that you must make libjpeg.lib before making cjpeg.ttp, djpeg.ttp, -or jpegtran.ttp. You'll have to perform the self-test by hand. - -We haven't bothered to include project files for rdjpgcom and wrjpgcom. -Those source files should just be compiled by themselves; they don't -depend on the JPEG library. - -There is a bug in some older versions of the Turbo C library which causes the -space used by temporary files created with "tmpfile()" not to be freed after -an abnormal program exit. If you check your disk afterwards, you will find -cluster chains that are allocated but not used by a file. This should not -happen in cjpeg/djpeg/jpegtran, since we enable a signal catcher to explicitly -close temp files before exiting. But if you use the JPEG library with your -own code, be sure to supply a signal catcher, or else use a different -system-dependent memory manager. - - -Cray: - -Should you be so fortunate as to be running JPEG on a Cray YMP, there is a -compiler bug in old versions of Cray's Standard C (prior to 3.1). If you -still have an old compiler, you'll need to insert a line reading -"#pragma novector" just before the loop - for (i = 1; i <= (int) htbl->bits[l]; i++) - huffsize[p++] = (char) l; -in fix_huff_tbl (in V5beta1, line 204 of jchuff.c and line 176 of jdhuff.c). -[This bug may or may not still occur with the current IJG code, but it's -probably a dead issue anyway...] - - -HP-UX: - -If you have HP-UX 7.05 or later with the "software development" C compiler, -you should run the compiler in ANSI mode. If using the configure script, -say - ./configure CC='cc -Aa' -(or -Ae if you prefer). If configuring by hand, use makefile.ansi and add -"-Aa" to the CFLAGS line in the makefile. - -If you have a pre-7.05 system, or if you are using the non-ANSI C compiler -delivered with a minimum HP-UX system, then you must use makefile.unix -(and do NOT add -Aa); or just run configure without the CC option. - -On HP 9000 series 800 machines, the HP C compiler is buggy in revisions prior -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. There isn't a complete example -available at the moment, but there are some helpful starting points: -1. Sam Bushell's free "To JPEG" applet provides drag-and-drop conversion to -JPEG under System 7 and later. This only illustrates how to use the -compression half of the library, but it does a very nice job of that part. -The CodeWarrior source code is available from http://www.pobox.com/~jsam. -2. Jim Brunner prepared a Mac-style user interface for both compression and -decompression. Unfortunately, it hasn't been updated since IJG v4, and -the library's API has changed considerably since then. Still it may be of -some help, particularly as a guide to compiling the IJG code under Think C. -Jim's code is available from the Info-Mac archives, at sumex-aim.stanford.edu -or mirrors thereof; see file /info-mac/dev/src/jpeg-convert-c.hqx. - -jmemmac.c is the recommended memory manager back end for Macintosh. It uses -NewPtr/DisposePtr instead of malloc/free, and has a Mac-specific -implementation of jpeg_mem_available(). It also creates temporary files that -follow Mac conventions. (That part of the code relies on System-7-or-later OS -functions. See the comments in jmemmac.c if you need to run it on System 6.) -NOTE that USE_MAC_MEMMGR must be defined in jconfig.h to use jmemmac.c. - -You can also use jmemnobs.c, if you don't care about handling images larger -than available memory. If you use any memory manager back end other than -jmemmac.c, we recommend replacing "malloc" and "free" by "NewPtr" and -"DisposePtr", because Mac C libraries often have peculiar implementations of -malloc/free. (For instance, free() may not return the freed space to the -Mac Memory Manager. This is undesirable for the IJG code because jmemmgr.c -already clumps space requests.) - - -Macintosh, Metrowerks CodeWarrior: - -The Unix-command-line-style interface can be used by defining USE_CCOMMAND. -You'll also need to define TWO_FILE_COMMANDLINE to avoid stdin/stdout. -This means that when using the cjpeg/djpeg programs, you'll have to type the -input and output file names in the "Arguments" text-edit box, rather than -using the file radio buttons. (Perhaps USE_FDOPEN or USE_SETMODE would -eliminate the problem, but I haven't heard from anyone who's tried it.) - -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 -of 2. Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint. - -The supplied configuration file jconfig.mac can be used for your jconfig.h; -it includes all the recommended symbol definitions. If you have AppleScript -installed, you can run the supplied script makeproj.mac to create CodeWarrior -project files for the library and the testbed applications, then build the -library and applications. (Thanks to Dan Sears and Don Agro for this nifty -hack, which saves us from trying to maintain CodeWarrior project files as part -of the IJG distribution...) - - -Macintosh, Think C: - -The documentation in Jim Brunner's "JPEG Convert" source code (see above) -includes detailed build instructions for Think C; it's probably somewhat -out of date for the current release, but may be helpful. - -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 -in the distribution since they are not text files. Use the file lists in -any of the supplied makefiles as a guide. Also add the ANSI and Unix C -libraries in a separate segment. You may need to divide the JPEG files into -more than one segment; we recommend dividing compression and decompression -modules. Define USE_CCOMMAND in jconfig.h so that the ccommand() routine is -called. You must also define TWO_FILE_COMMANDLINE because stdin/stdout -don't handle binary data correctly. - -On 680x0 Macs, Think C defines type "double" as a 12-byte IEEE extended float. -jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power of 2. -Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint. - -jconfig.mac should work as a jconfig.h configuration file for Think C, -but the makeproj.mac AppleScript script is specific to CodeWarrior. Sorry. - - -MIPS R3000: - -MIPS's cc version 1.31 has a rather nasty optimization bug. Don't use -O -if you have that compiler version. (Use "cc -V" to check the version.) -Note that the R3000 chip is found in workstations from DEC and others. - - -MS-DOS, generic comments for 16-bit compilers: - -The IJG code is designed to work well in 80x86 "small" or "medium" memory -models (i.e., data pointers are 16 bits unless explicitly declared "far"; -code pointers can be either size). You may be able to use small model to -compile cjpeg or djpeg by itself, but you will probably have to use medium -model for any larger application. This won't make much difference in -performance. You *will* take a noticeable performance hit if you use a -large-data memory model, and you should avoid "huge" model if at all -possible. Be sure that NEED_FAR_POINTERS is defined in jconfig.h if you use -a small-data memory model; be sure it is NOT defined if you use a large-data -model. (The supplied makefiles and jconfig files for Borland and Microsoft C -compile in medium model and define NEED_FAR_POINTERS.) - -The DOS-specific memory manager, jmemdos.c, should be used if possible. -It needs some assembly-code routines which are in jmemdosa.asm; make sure -your makefile assembles that file and includes it in the library. If you -don't have a suitable assembler, you can get pre-assembled object files for -jmemdosa by FTP from ftp.uu.net:/graphics/jpeg/jdosaobj.zip. (DOS-oriented -distributions of the IJG source code often include these object files.) - -When using jmemdos.c, jconfig.h must define USE_MSDOS_MEMMGR and must set -MAX_ALLOC_CHUNK to less than 64K (65520L is a typical value). If your -C library's far-heap malloc() can't allocate blocks that large, reduce -MAX_ALLOC_CHUNK to whatever it can handle. - -If you can't use jmemdos.c for some reason --- for example, because you -don't have an assembler to assemble jmemdosa.asm --- you'll have to fall -back to jmemansi.c or jmemname.c. You'll probably still need to set -MAX_ALLOC_CHUNK in jconfig.h, because most DOS C libraries won't malloc() -more than 64K at a time. IMPORTANT: if you use jmemansi.c or jmemname.c, -you will have to compile in a large-data memory model in order to get the -right stdio library. Too bad. - -wrjpgcom needs to be compiled in large model, because it malloc()s a 64KB -work area to hold the comment text. If your C library's malloc can't -handle that, reduce MAX_COM_LENGTH as necessary in wrjpgcom.c. - -Most MS-DOS compilers treat stdin/stdout as text files, so you must use -two-file command line style. But if your compiler has either fdopen() or -setmode(), you can use one-file style if you like. To do this, define -USE_SETMODE or USE_FDOPEN so that stdin/stdout will be set to binary mode. -(USE_SETMODE seems to work with more DOS compilers than USE_FDOPEN.) You -should test that I/O through stdin/stdout produces the same results as I/O -to explicitly named files... the "make test" procedures in the supplied -makefiles do NOT use stdin/stdout. - - -MS-DOS, generic comments for 32-bit compilers: - -None of the above comments about memory models apply if you are using a -32-bit flat-memory-space environment, such as DJGPP or Watcom C. (And you -should use one if you have it, as performance will be much better than -8086-compatible code!) For flat-memory-space compilers, do NOT define -NEED_FAR_POINTERS, and do NOT use jmemdos.c. Use jmemnobs.c if the -environment supplies adequate virtual memory, otherwise use jmemansi.c or -jmemname.c. - -You'll still need to be careful about binary I/O through stdin/stdout. -See the last paragraph of the previous section. - - -MS-DOS, Borland C: - -Be sure to convert all the source files to DOS text format (CR/LF newlines). -Although Borland C will often work OK with unmodified Unix (LF newlines) -source files, sometimes it will give bogus compile errors. -"Illegal character '#'" is the most common such error. (This is true with -Borland C 3.1, but perhaps is fixed in newer releases.) - -If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE. -jconfig.bcc already includes #define USE_SETMODE to make this work. -(fdopen does not work correctly.) - - -MS-DOS, Microsoft C: - -makefile.mc6 works with Microsoft C, DOS Visual C++, etc. It should only -be used if you want to build a 16-bit (small or medium memory model) program. - -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.) - -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. - -Old versions of MS C fail with an "out of macro expansion space" error -because they can't cope with the macro TRACEMS8 (defined in jerror.h). -If this happens to you, the easiest solution is to change TRACEMS8 to -expand to nothing. You'll lose the ability to dump out JPEG coefficient -tables with djpeg -debug -debug, but at least you can compile. - -Original MS C 6.0 is very buggy; it compiles incorrect code unless you turn -off optimization entirely (remove -O from CFLAGS). 6.00A is better, but it -still generates bad code if you enable loop optimizations (-Ol or -Ox). - -MS C 8.0 crashes when compiling jquant1.c with optimization switch /Oo ... -which is on by default. To work around this bug, compile that one file -with /Oo-. - - -Microsoft Windows (all versions), generic comments: - -Some Windows system include files define typedef boolean as "unsigned char". -The IJG code also defines typedef boolean, but we make it "int" by default. -This doesn't affect the IJG programs because we don't import those Windows -include files. But if you use the JPEG library in your own program, and some -of your program's files import one definition of boolean while some import the -other, you can get all sorts of mysterious problems. A good preventive step -is to make the IJG library use "unsigned char" for boolean. To do that, -add something like this to your jconfig.h file: - /* Define "boolean" as unsigned char, not int, per Windows custom */ - #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ - typedef unsigned char boolean; - #endif - #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ -(This is already in jconfig.vc, by the way.) - -windef.h contains the declarations - #define far - #define FAR far -Since jmorecfg.h tries to define FAR as empty, you may get a compiler -warning if you include both jpeglib.h and windef.h (which windows.h -includes). To suppress the warning, you can put "#ifndef FAR"/"#endif" -around the line "#define FAR" in jmorecfg.h. - -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 - MessageBox(GetActiveWindow(),buffer,"JPEG Error",MB_OK|MB_ICONERROR); -It's highly recommended that you at least do that much, since otherwise -error messages will disappear into nowhere. (Beginning with IJG v6b, this -code is already present in jerror.c; just define USE_WINDOWS_MESSAGEBOX in -jconfig.h to enable it.) - -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. (NOTE: -some older Windows C compilers provide versions of setjmp/longjmp that -don't actually work under Windows. You may need to use the Windows system -functions Catch and Throw instead.) - -The recommended memory manager under Windows is jmemnobs.c; in other words, -let Windows do any virtual memory management needed. You should NOT use -jmemdos.c nor jmemdosa.asm under Windows. - -For Windows 3.1, we recommend compiling in medium or large memory model; -for newer Windows versions, use a 32-bit flat memory model. (See the MS-DOS -sections above for more info about memory models.) In the 16-bit memory -models only, you'll need to put - #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ -into jconfig.h to limit allocation chunks to 64Kb. (Without that, you'd -have to use huge memory model, which slows things down unnecessarily.) -jmemnobs.c works without modification in large or flat memory models, but to -use medium model, you need to modify its jpeg_get_large and jpeg_free_large -routines to allocate far memory. In any case, you might like to replace -its calls to malloc and free with direct calls on Windows memory allocation -functions. - -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. - -You might want to tweak the RGB_xxx macros in jmorecfg.h so that the library -will accept or deliver color pixels in BGR sample order, not RGB; BGR order -is usually more convenient under Windows. Note that this change will break -the sample applications cjpeg/djpeg, but the library itself works fine. - - -Many people want to convert the IJG library into a DLL. This is reasonably -straightforward, but watch out for the following: - - 1. Don't try to compile as a DLL in small or medium memory model; use -large model, or even better, 32-bit flat model. Many places in the IJG code -assume the address of a local variable is an ordinary (not FAR) pointer; -that isn't true in a medium-model DLL. - - 2. Microsoft C cannot pass file pointers between applications and DLLs. -(See Microsoft Knowledge Base, PSS ID Number Q50336.) So jdatasrc.c and -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 _loadds - #define METHODDEF(type) static type _far _pascal - #define JMETHOD(type,methodname,arglist) \ - type (_far _pascal *methodname) arglist -For a 32-bit DLL you may want something like - #define GLOBAL(type) __declspec(dllexport) type - #define EXTERN(type) extern __declspec(dllexport) type -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 -been some talk of writing wrapper code that would present a simpler interface -usable from other languages, such as Visual Basic. This is on our to-do list -but hasn't been very high priority --- any volunteers out there? - - -Microsoft Windows, Borland C: - -The provided jconfig.bcc should work OK in a 32-bit Windows environment, -but you'll need to tweak it in a 16-bit environment (you'd need to define -NEED_FAR_POINTERS and MAX_ALLOC_CHUNK). Beware that makefile.bcc will need -alteration if you want to use it for Windows --- in particular, you should -use jmemnobs.c not jmemdos.c under Windows. - -Borland C++ 4.5 fails with an internal compiler error when trying to compile -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). - -Another report from a user of Borland C 4.5 was that incorrect code (leading -to a color shift in processed images) was produced if any of the following -optimization switch combinations were used: - -Ot -Og - -Ot -Op - -Ot -Om -So try backing off on optimization if you see such a problem. (Are there -several different releases all numbered "4.5"??) - - -Microsoft Windows, Microsoft Visual C++: - -jconfig.vc should work OK with any Microsoft compiler for a 32-bit memory -model. makefile.vc is intended for command-line use. (If you are using -the Developer Studio environment, you may prefer the DevStudio project -files; see below.) - -Some users feel that it's easier to call the library from C++ code if you -force VC++ to treat the library as C++ code, which you can do by renaming -all the *.c files to *.cpp (and adjusting the makefile to match). This -avoids the need to put extern "C" { ... } around #include "jpeglib.h" in -your C++ application. - - -Microsoft Windows, Microsoft Developer Studio: - -We include makefiles that should work as project files in DevStudio 4.2 or -later. There is a library makefile that builds the IJG library as a static -Win32 library, and an application makefile that builds the sample applications -as Win32 console applications. (Even if you only want the library, we -recommend building the applications so that you can run the self-test.) - -To use: -1. Copy jconfig.vc to jconfig.h, makelib.ds to jpeg.mak, and - makeapps.ds to apps.mak. (Note that the renaming is critical!) -2. Click on the .mak files to construct project workspaces. - (If you are using DevStudio more recent than 4.2, you'll probably - get a message saying that the makefiles are being updated.) -3. Build the library project, then the applications project. -4. Move the application .exe files from `app`\Release to an - appropriate location on your path. -5. To perform the self-test, execute the command line - NMAKE /f makefile.vc test - - -OS/2, Borland C++: - -Watch out for optimization bugs in older Borland compilers; you may need -to back off the optimization switch settings. See the comments in -makefile.bcc. - - -SGI: - -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 -faster than the default int method (but still slower than the fast int -method). If you use -mips2, you may want to alter the default DCT method to -be float. To do this, put "#define JDCT_DEFAULT JDCT_FLOAT" in jconfig.h. - - -VMS: - -On an Alpha/VMS system with MMS, be sure to use the "/Marco=Alpha=1" -qualifier with MMS when building the JPEG package. - -VAX/VMS v5.5-1 may have problems with the test step of the build procedure -reporting differences when it compares the original and test images. If the -error points to the last block of the files, it is most likely bogus and may -be safely ignored. It seems to be because the files are Stream_LF and -Backup/Compare has difficulty with the (presumably) null padded files. -This problem was not observed on VAX/VMS v6.1 or AXP/VMS v6.1. diff --git a/jconfig.bcc b/jconfig.bcc deleted file mode 100644 index c6c53ff6..00000000 --- a/jconfig.bcc +++ /dev/null @@ -1,48 +0,0 @@ -/* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#ifdef __MSDOS__ -#define NEED_FAR_POINTERS /* for small or medium memory model */ -#endif -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN /* this assumes you have -w-stu in CFLAGS */ - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#ifdef __MSDOS__ -#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ -#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ -#define USE_FMEM /* Borland has _fmemcpy() and _fmemset() */ -#endif - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE -#define USE_SETMODE /* Borland has setmode() */ -#ifdef __MSDOS__ -#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ -#endif -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.dj b/jconfig.dj deleted file mode 100644 index f759a9db..00000000 --- a/jconfig.dj +++ /dev/null @@ -1,38 +0,0 @@ -/* jconfig.dj --- jconfig.h for DJGPP (Delorie's GNU C port) on MS-DOS. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS /* DJGPP uses flat 32-bit addressing */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#undef TWO_FILE_COMMANDLINE /* optional */ -#define USE_SETMODE /* Needed to make one-file style work in DJGPP */ -#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.vc b/jconfig.h similarity index 100% rename from jconfig.vc rename to jconfig.h diff --git a/jconfig.mac b/jconfig.mac deleted file mode 100644 index 0de3efe2..00000000 --- a/jconfig.mac +++ /dev/null @@ -1,43 +0,0 @@ -/* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#define USE_MAC_MEMMGR /* Define this if you use jmemmac.c */ - -#define ALIGN_TYPE long /* Needed for 680x0 Macs */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define USE_CCOMMAND /* Command line reader for Macintosh */ -#define TWO_FILE_COMMANDLINE /* Binary I/O thru stdin/stdout doesn't work */ - -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.manx b/jconfig.manx deleted file mode 100644 index 6dd0d008..00000000 --- a/jconfig.manx +++ /dev/null @@ -1,43 +0,0 @@ -/* jconfig.manx --- jconfig.h for Amiga systems using Manx Aztec C ver 5.x. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ - -#define SHORTxSHORT_32 /* produces better DCT code with Aztec C */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE -#define NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#define signal_catcher _abort /* hack for Aztec C naming requirements */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.mc6 b/jconfig.mc6 deleted file mode 100644 index c55082df..00000000 --- a/jconfig.mc6 +++ /dev/null @@ -1,52 +0,0 @@ -/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#define NEED_FAR_POINTERS /* for small or medium memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ - -#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ - -#define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */ - -#define NEED_FHEAPMIN /* far heap management routines are broken */ - -#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */ -/* Note: the above define is known to improve the code with Microsoft C 6.00A. - * I do not know whether it is good for later compiler versions. - * Please report any info on this point to jpeg-info@uunet.uu.net. - */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE -#define USE_SETMODE /* Microsoft has setmode() */ -#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.sas b/jconfig.sas deleted file mode 100644 index efdac222..00000000 --- a/jconfig.sas +++ /dev/null @@ -1,43 +0,0 @@ -/* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ - -#define NO_MKTEMP /* SAS C doesn't have mktemp() */ - -#define SHORTxSHORT_32 /* produces better DCT code with SAS C */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE -#define NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.st b/jconfig.st deleted file mode 100644 index 4421b7a1..00000000 --- a/jconfig.st +++ /dev/null @@ -1,42 +0,0 @@ -/* jconfig.st --- jconfig.h for Atari ST/STE/TT using Pure C or Turbo C. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -#define INCOMPLETE_TYPES_BROKEN /* suppress undefined-structure warnings */ - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#define ALIGN_TYPE long /* apparently double is a weird size? */ - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE /* optional -- undef if you like Unix style */ -/* Note: if you undef TWO_FILE_COMMANDLINE, you may need to define - * USE_SETMODE. Some Atari compilers require it, some do not. - */ -#define NEED_SIGNAL_CATCHER /* needed if you use jmemname.c */ -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.vms b/jconfig.vms deleted file mode 100644 index 55a6ffba..00000000 --- a/jconfig.vms +++ /dev/null @@ -1,37 +0,0 @@ -/* jconfig.vms --- jconfig.h for use on Digital VMS. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE /* Needed on VMS */ -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.wat b/jconfig.wat deleted file mode 100644 index 6cc545ba..00000000 --- a/jconfig.wat +++ /dev/null @@ -1,38 +0,0 @@ -/* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#define CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS /* Watcom uses flat 32-bit addressing */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#undef TWO_FILE_COMMANDLINE /* optional */ -#define USE_SETMODE /* Needed to make one-file style work in Watcom */ -#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jmemansi.c b/jmemansi.c deleted file mode 100644 index 2d93e496..00000000 --- a/jmemansi.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * jmemansi.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. - * - * This file provides a simple generic implementation of the system- - * dependent portion of the JPEG memory manager. This implementation - * assumes that you have the ANSI-standard library routine tmpfile(). - * Also, the problem of determining the amount of memory available - * is shoved onto the user. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -#endif - -#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 regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * 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) -{ - return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ -} - -GLOBAL(void) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/jmemdos.c b/jmemdos.c deleted file mode 100644 index 60b45c69..00000000 --- a/jmemdos.c +++ /dev/null @@ -1,638 +0,0 @@ -/* - * jmemdos.c - * - * Copyright (C) 1992-1997, 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. - * - * This file provides an MS-DOS-compatible implementation of the system- - * dependent portion of the JPEG memory manager. Temporary data can be - * stored in extended or expanded memory as well as in regular DOS files. - * - * If you use this file, you must be sure that NEED_FAR_POINTERS is defined - * if you compile in a small-data memory model; it should NOT be defined if - * you use a large-data memory model. This file is not recommended if you - * are using a flat-memory-space 386 environment such as DJGCC or Watcom C. - * Also, this code will NOT work if struct fields are aligned on greater than - * 2-byte boundaries. - * - * Based on code contributed by Ge' Weijers. - */ - -/* - * If you have both extended and expanded memory, you may want to change the - * order in which they are tried in jopen_backing_store. On a 286 machine - * expanded memory is usually faster, since extended memory access involves - * an expensive protected-mode-and-back switch. On 386 and better, extended - * memory is usually faster. As distributed, the code tries extended memory - * first (what? not everyone has a 386? :-). - * - * You can disable use of extended/expanded memory entirely by altering these - * definitions or overriding them from the Makefile (eg, -DEMS_SUPPORTED=0). - */ - -#ifndef XMS_SUPPORTED -#define XMS_SUPPORTED 1 -#endif -#ifndef EMS_SUPPORTED -#define EMS_SUPPORTED 1 -#endif - - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare these */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -extern char * getenv JPP((const char * name)); -#endif - -#ifdef NEED_FAR_POINTERS - -#ifdef __TURBOC__ -/* These definitions work for Borland C (Turbo C) */ -#include /* need farmalloc(), farfree() */ -#define far_malloc(x) farmalloc(x) -#define far_free(x) farfree(x) -#else -/* These definitions work for Microsoft C and compatible compilers */ -#include /* need _fmalloc(), _ffree() */ -#define far_malloc(x) _fmalloc(x) -#define far_free(x) _ffree(x) -#endif - -#else /* not NEED_FAR_POINTERS */ - -#define far_malloc(x) malloc(x) -#define far_free(x) free(x) - -#endif /* NEED_FAR_POINTERS */ - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#define READ_BINARY "rb" -#endif - -#ifndef USE_MSDOS_MEMMGR /* make sure user got configuration right */ - You forgot to define USE_MSDOS_MEMMGR in jconfig.h. /* deliberate syntax error */ -#endif - -#if MAX_ALLOC_CHUNK >= 65535L /* make sure jconfig.h got this right */ - MAX_ALLOC_CHUNK should be less than 64K. /* deliberate syntax error */ -#endif - - -/* - * Declarations for assembly-language support routines (see jmemdosa.asm). - * - * 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. - */ - -typedef void far * XMSDRIVER; /* actually a pointer to code */ -typedef struct { /* registers for calling XMS driver */ - unsigned short ax, dx, bx; - void far * ds_si; - } XMScontext; -typedef struct { /* registers for calling EMS driver */ - unsigned short ax, dx, bx; - 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, - unsigned short count)); -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 *)); - - -/* - * Selection of a file name for a temporary file. - * This is highly system-dependent, and you may want to customize it. - */ - -static int next_file_num; /* to distinguish among several temp files */ - -LOCAL(void) -select_file_name (char * fname) -{ - const char * env; - char * ptr; - FILE * tfile; - - /* Keep generating file names till we find one that's not in use */ - for (;;) { - /* Get temp directory name from environment TMP or TEMP variable; - * if none, use "." - */ - if ((env = (const char *) getenv("TMP")) == NULL) - if ((env = (const char *) getenv("TEMP")) == NULL) - env = "."; - if (*env == '\0') /* null string means "." */ - env = "."; - ptr = fname; /* copy name to fname */ - while (*env != '\0') - *ptr++ = *env++; - if (ptr[-1] != '\\' && ptr[-1] != '/') - *ptr++ = '\\'; /* append backslash if not in env variable */ - /* Append a suitable file name */ - next_file_num++; /* advance counter */ - sprintf(ptr, "JPG%03d.TMP", next_file_num); - /* Probe to see if file name is already in use */ - if ((tfile = fopen(fname, READ_BINARY)) == NULL) - break; - fclose(tfile); /* oops, it's there; close tfile & try again */ - } -} - - -/* - * Near-memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are allocated in far memory, if possible - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) far_malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - far_free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 300000L /* for total usage about 450K */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * 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. - */ - -/* - * For MS-DOS we support three types of backing storage: - * 1. Conventional DOS files. We access these by direct DOS calls rather - * than via the stdio package. This provides a bit better performance, - * but the real reason is that the buffers to be read or written are FAR. - * The stdio library for small-data memory models can't cope with that. - * 2. Extended memory, accessed per the XMS V2.0 specification. - * 3. Expanded memory, accessed per the LIM/EMS 4.0 specification. - * You'll need copies of those specs to make sense of the related code. - * The specs are available by Internet FTP from the SIMTEL archives - * (oak.oakland.edu and its various mirror sites). See files - * pub/msdos/microsoft/xms20.arc and pub/msdos/info/limems41.zip. - */ - - -/* - * Access methods for a DOS file. - */ - - -METHODDEF(void) -read_file_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (jdos_seek(info->handle.file_handle, file_offset)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ - if (byte_count > 65535L) /* safety check */ - ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); - if (jdos_read(info->handle.file_handle, buffer_address, - (unsigned short) byte_count)) - ERREXIT(cinfo, JERR_TFILE_READ); -} - - -METHODDEF(void) -write_file_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - if (jdos_seek(info->handle.file_handle, file_offset)) - ERREXIT(cinfo, JERR_TFILE_SEEK); - /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ - if (byte_count > 65535L) /* safety check */ - ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); - if (jdos_write(info->handle.file_handle, buffer_address, - (unsigned short) byte_count)) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_file_store (j_common_ptr cinfo, backing_store_ptr info) -{ - jdos_close(info->handle.file_handle); /* close the file */ - remove(info->temp_name); /* delete the file */ -/* If your system doesn't have remove(), try unlink() instead. - * remove() is the ANSI-standard name for this function, but - * unlink() was more common in pre-ANSI systems. - */ - TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name); -} - - -LOCAL(boolean) -open_file_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - short handle; - - select_file_name(info->temp_name); - if (jdos_open((short far *) & handle, (char far *) info->temp_name)) { - /* might as well exit since jpeg_open_backing_store will fail anyway */ - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - return FALSE; - } - info->handle.file_handle = handle; - info->read_backing_store = read_file_store; - info->write_backing_store = write_file_store; - info->close_backing_store = close_file_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); - return TRUE; /* succeeded */ -} - - -/* - * Access methods for extended memory. - */ - -#if XMS_SUPPORTED - -static XMSDRIVER xms_driver; /* saved address of XMS driver */ - -typedef union { /* either long offset or real-mode pointer */ - long offset; - void far * ptr; - } XMSPTR; - -typedef struct { /* XMS move specification structure */ - long length; - XMSH src_handle; - XMSPTR src; - XMSH dst_handle; - XMSPTR dst; - } XMSspec; - -#define ODD(X) (((X) & 1L) != 0) - - -METHODDEF(void) -read_xms_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - XMScontext ctx; - XMSspec spec; - char endbuffer[2]; - - /* The XMS driver can't cope with an odd length, so handle the last byte - * specially if byte_count is odd. We don't expect this to be common. - */ - - spec.length = byte_count & (~ 1L); - spec.src_handle = info->handle.xms_handle; - spec.src.offset = file_offset; - spec.dst_handle = 0; - spec.dst.ptr = buffer_address; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x0b00; /* EMB move */ - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - ERREXIT(cinfo, JERR_XMS_READ); - - if (ODD(byte_count)) { - read_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0]; - } -} - - -METHODDEF(void) -write_xms_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - XMScontext ctx; - XMSspec spec; - char endbuffer[2]; - - /* The XMS driver can't cope with an odd length, so handle the last byte - * specially if byte_count is odd. We don't expect this to be common. - */ - - spec.length = byte_count & (~ 1L); - spec.src_handle = 0; - spec.src.ptr = buffer_address; - spec.dst_handle = info->handle.xms_handle; - spec.dst.offset = file_offset; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x0b00; /* EMB move */ - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - ERREXIT(cinfo, JERR_XMS_WRITE); - - if (ODD(byte_count)) { - read_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L]; - write_xms_store(cinfo, info, (void FAR *) endbuffer, - file_offset + byte_count - 1L, 2L); - } -} - - -METHODDEF(void) -close_xms_store (j_common_ptr cinfo, backing_store_ptr info) -{ - XMScontext ctx; - - ctx.dx = info->handle.xms_handle; - ctx.ax = 0x0a00; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE, info->handle.xms_handle); - /* we ignore any error return from the driver */ -} - - -LOCAL(boolean) -open_xms_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - XMScontext ctx; - - /* Get address of XMS driver */ - jxms_getdriver((XMSDRIVER far *) & xms_driver); - if (xms_driver == NULL) - return FALSE; /* no driver to be had */ - - /* Get version number, must be >= 2.00 */ - ctx.ax = 0x0000; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax < (unsigned short) 0x0200) - return FALSE; - - /* Try to get space (expressed in kilobytes) */ - ctx.dx = (unsigned short) ((total_bytes_needed + 1023L) >> 10); - ctx.ax = 0x0900; - jxms_calldriver(xms_driver, (XMScontext far *) & ctx); - if (ctx.ax != 1) - return FALSE; - - /* Succeeded, save the handle and away we go */ - info->handle.xms_handle = ctx.dx; - info->read_backing_store = read_xms_store; - info->write_backing_store = write_xms_store; - info->close_backing_store = close_xms_store; - TRACEMS1(cinfo, 1, JTRC_XMS_OPEN, ctx.dx); - return TRUE; /* succeeded */ -} - -#endif /* XMS_SUPPORTED */ - - -/* - * Access methods for expanded memory. - */ - -#if EMS_SUPPORTED - -/* The EMS move specification structure requires word and long fields aligned - * at odd byte boundaries. Some compilers will align struct fields at even - * byte boundaries. While it's usually possible to force byte alignment, - * that causes an overall performance penalty and may pose problems in merging - * JPEG into a larger application. Instead we accept some rather dirty code - * here. Note this code would fail if the hardware did not allow odd-byte - * word & long accesses, but all 80x86 CPUs do. - */ - -typedef void far * EMSPTR; - -typedef union { /* EMS move specification structure */ - long length; /* It's easy to access first 4 bytes */ - char bytes[18]; /* Misaligned fields in here! */ - } EMSspec; - -/* Macros for accessing misaligned fields */ -#define FIELD_AT(spec,offset,type) (*((type *) &(spec.bytes[offset]))) -#define SRC_TYPE(spec) FIELD_AT(spec,4,char) -#define SRC_HANDLE(spec) FIELD_AT(spec,5,EMSH) -#define SRC_OFFSET(spec) FIELD_AT(spec,7,unsigned short) -#define SRC_PAGE(spec) FIELD_AT(spec,9,unsigned short) -#define SRC_PTR(spec) FIELD_AT(spec,7,EMSPTR) -#define DST_TYPE(spec) FIELD_AT(spec,11,char) -#define DST_HANDLE(spec) FIELD_AT(spec,12,EMSH) -#define DST_OFFSET(spec) FIELD_AT(spec,14,unsigned short) -#define DST_PAGE(spec) FIELD_AT(spec,16,unsigned short) -#define DST_PTR(spec) FIELD_AT(spec,14,EMSPTR) - -#define EMSPAGESIZE 16384L /* gospel, see the EMS specs */ - -#define HIBYTE(W) (((W) >> 8) & 0xFF) -#define LOBYTE(W) ((W) & 0xFF) - - -METHODDEF(void) -read_ems_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - EMScontext ctx; - EMSspec spec; - - spec.length = byte_count; - SRC_TYPE(spec) = 1; - SRC_HANDLE(spec) = info->handle.ems_handle; - SRC_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE); - SRC_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE); - DST_TYPE(spec) = 0; - DST_HANDLE(spec) = 0; - DST_PTR(spec) = buffer_address; - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x5700; /* move memory region */ - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - ERREXIT(cinfo, JERR_EMS_READ); -} - - -METHODDEF(void) -write_ems_store (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count) -{ - EMScontext ctx; - EMSspec spec; - - spec.length = byte_count; - SRC_TYPE(spec) = 0; - SRC_HANDLE(spec) = 0; - SRC_PTR(spec) = buffer_address; - DST_TYPE(spec) = 1; - DST_HANDLE(spec) = info->handle.ems_handle; - DST_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE); - DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE); - - ctx.ds_si = (void far *) & spec; - ctx.ax = 0x5700; /* move memory region */ - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - ERREXIT(cinfo, JERR_EMS_WRITE); -} - - -METHODDEF(void) -close_ems_store (j_common_ptr cinfo, backing_store_ptr info) -{ - EMScontext ctx; - - ctx.ax = 0x4500; - ctx.dx = info->handle.ems_handle; - jems_calldriver((EMScontext far *) & ctx); - TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE, info->handle.ems_handle); - /* we ignore any error return from the driver */ -} - - -LOCAL(boolean) -open_ems_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - EMScontext ctx; - - /* Is EMS driver there? */ - if (! jems_available()) - return FALSE; - - /* Get status, make sure EMS is OK */ - ctx.ax = 0x4000; - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - return FALSE; - - /* Get version, must be >= 4.0 */ - ctx.ax = 0x4600; - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0 || LOBYTE(ctx.ax) < 0x40) - return FALSE; - - /* Try to allocate requested space */ - ctx.ax = 0x4300; - ctx.bx = (unsigned short) ((total_bytes_needed + EMSPAGESIZE-1L) / EMSPAGESIZE); - jems_calldriver((EMScontext far *) & ctx); - if (HIBYTE(ctx.ax) != 0) - return FALSE; - - /* Succeeded, save the handle and away we go */ - info->handle.ems_handle = ctx.dx; - info->read_backing_store = read_ems_store; - info->write_backing_store = write_ems_store; - info->close_backing_store = close_ems_store; - TRACEMS1(cinfo, 1, JTRC_EMS_OPEN, ctx.dx); - return TRUE; /* succeeded */ -} - -#endif /* EMS_SUPPORTED */ - - -/* - * Initial opening of a backing-store object. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - /* Try extended memory, then expanded memory, then regular file. */ -#if XMS_SUPPORTED - if (open_xms_store(cinfo, info, total_bytes_needed)) - return; -#endif -#if EMS_SUPPORTED - if (open_ems_store(cinfo, info, total_bytes_needed)) - return; -#endif - if (open_file_store(cinfo, info, total_bytes_needed)) - return; - ERREXITS(cinfo, JERR_TFILE_CREATE, ""); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -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) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* Microsoft C, at least in v6.00A, will not successfully reclaim freed - * blocks of size > 32Kbytes unless we give it a kick in the rear, like so: - */ -#ifdef NEED_FHEAPMIN - _fheapmin(); -#endif -} diff --git a/jmemdosa.asm b/jmemdosa.asm deleted file mode 100644 index ecd43729..00000000 --- a/jmemdosa.asm +++ /dev/null @@ -1,379 +0,0 @@ -; -; jmemdosa.asm -; -; Copyright (C) 1992, 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. -; -; This file contains low-level interface routines to support the MS-DOS -; backing store manager (jmemdos.c). Routines are provided to access disk -; files through direct DOS calls, and to access XMS and EMS drivers. -; -; This file should assemble with Microsoft's MASM or any compatible -; assembler (including Borland's Turbo Assembler). If you haven't got -; a compatible assembler, better fall back to jmemansi.c or jmemname.c. -; -; To minimize dependence on the C compiler's register usage conventions, -; we save and restore all 8086 registers, even though most compilers only -; require SI,DI,DS to be preserved. Also, we use only 16-bit-wide return -; values, which everybody returns in AX. -; -; Based on code contributed by Ge' Weijers. -; - -JMEMDOSA_TXT segment byte public 'CODE' - - assume cs:JMEMDOSA_TXT - - public _jdos_open - public _jdos_close - public _jdos_seek - public _jdos_read - public _jdos_write - public _jxms_getdriver - public _jxms_calldriver - public _jems_available - public _jems_calldriver - -; -; short far jdos_open (short far * handle, char far * filename) -; -; Create and open a temporary file -; -_jdos_open proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov cx,0 ; normal file attributes - lds dx,dword ptr [bp+10] ; get filename pointer - mov ah,3ch ; create file - int 21h - jc open_err ; if failed, return error code - lds bx,dword ptr [bp+6] ; get handle pointer - mov word ptr [bx],ax ; save the handle - xor ax,ax ; return zero for OK -open_err: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jdos_open endp - - -; -; short far jdos_close (short handle) -; -; Close the file handle -; -_jdos_close proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov bx,word ptr [bp+6] ; file handle - mov ah,3eh ; close file - int 21h - jc close_err ; if failed, return error code - xor ax,ax ; return zero for OK -close_err: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jdos_close endp - - -; -; short far jdos_seek (short handle, long offset) -; -; Set file position -; -_jdos_seek proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov bx,word ptr [bp+6] ; file handle - mov dx,word ptr [bp+8] ; LS offset - mov cx,word ptr [bp+10] ; MS offset - mov ax,4200h ; absolute seek - int 21h - jc seek_err ; if failed, return error code - xor ax,ax ; return zero for OK -seek_err: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jdos_seek endp - - -; -; short far jdos_read (short handle, void far * buffer, unsigned short count) -; -; Read from file -; -_jdos_read proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov bx,word ptr [bp+6] ; file handle - lds dx,dword ptr [bp+8] ; buffer address - mov cx,word ptr [bp+12] ; number of bytes - mov ah,3fh ; read file - int 21h - jc read_err ; if failed, return error code - cmp ax,word ptr [bp+12] ; make sure all bytes were read - je read_ok - mov ax,1 ; else return 1 for not OK - jmp short read_err -read_ok: xor ax,ax ; return zero for OK -read_err: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jdos_read endp - - -; -; short far jdos_write (short handle, void far * buffer, unsigned short count) -; -; Write to file -; -_jdos_write proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov bx,word ptr [bp+6] ; file handle - lds dx,dword ptr [bp+8] ; buffer address - mov cx,word ptr [bp+12] ; number of bytes - mov ah,40h ; write file - int 21h - jc write_err ; if failed, return error code - cmp ax,word ptr [bp+12] ; make sure all bytes written - je write_ok - mov ax,1 ; else return 1 for not OK - jmp short write_err -write_ok: xor ax,ax ; return zero for OK -write_err: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jdos_write endp - - -; -; void far jxms_getdriver (XMSDRIVER far *) -; -; Get the address of the XMS driver, or NULL if not available -; -_jxms_getdriver proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov ax,4300h ; call multiplex interrupt with - int 2fh ; a magic cookie, hex 4300 - cmp al,80h ; AL should contain hex 80 - je xmsavail - xor dx,dx ; no XMS driver available - xor ax,ax ; return a nil pointer - jmp short xmsavail_done -xmsavail: mov ax,4310h ; fetch driver address with - int 2fh ; another magic cookie - mov dx,es ; copy address to dx:ax - mov ax,bx -xmsavail_done: les bx,dword ptr [bp+6] ; get pointer to return value - mov word ptr es:[bx],ax - mov word ptr es:[bx+2],dx - pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jxms_getdriver endp - - -; -; void far jxms_calldriver (XMSDRIVER, XMScontext far *) -; -; The XMScontext structure contains values for the AX,DX,BX,SI,DS registers. -; These are loaded, the XMS call is performed, and the new values of the -; AX,DX,BX registers are written back to the context structure. -; -_jxms_calldriver proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - les bx,dword ptr [bp+10] ; get XMScontext pointer - mov ax,word ptr es:[bx] ; load registers - mov dx,word ptr es:[bx+2] - mov si,word ptr es:[bx+6] - mov ds,word ptr es:[bx+8] - mov bx,word ptr es:[bx+4] - call dword ptr [bp+6] ; call the driver - mov cx,bx ; save returned BX for a sec - les bx,dword ptr [bp+10] ; get XMScontext pointer - mov word ptr es:[bx],ax ; put back ax,dx,bx - mov word ptr es:[bx+2],dx - mov word ptr es:[bx+4],cx - pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jxms_calldriver endp - - -; -; short far jems_available (void) -; -; Have we got an EMS driver? (this comes straight from the EMS 4.0 specs) -; -_jems_available proc far - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - mov ax,3567h ; get interrupt vector 67h - int 21h - push cs - pop ds - mov di,000ah ; check offs 10 in returned seg - lea si,ASCII_device_name ; against literal string - mov cx,8 - cld - repe cmpsb - jne no_ems - mov ax,1 ; match, it's there - jmp short avail_done -no_ems: xor ax,ax ; it's not there -avail_done: pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - ret - -ASCII_device_name db "EMMXXXX0" - -_jems_available endp - - -; -; void far jems_calldriver (EMScontext far *) -; -; The EMScontext structure contains values for the AX,DX,BX,SI,DS registers. -; These are loaded, the EMS trap is performed, and the new values of the -; AX,DX,BX registers are written back to the context structure. -; -_jems_calldriver proc far - push bp ; linkage - mov bp,sp - push si ; save all registers for safety - push di - push bx - push cx - push dx - push es - push ds - les bx,dword ptr [bp+6] ; get EMScontext pointer - mov ax,word ptr es:[bx] ; load registers - mov dx,word ptr es:[bx+2] - mov si,word ptr es:[bx+6] - mov ds,word ptr es:[bx+8] - mov bx,word ptr es:[bx+4] - int 67h ; call the EMS driver - mov cx,bx ; save returned BX for a sec - les bx,dword ptr [bp+6] ; get EMScontext pointer - mov word ptr es:[bx],ax ; put back ax,dx,bx - mov word ptr es:[bx+2],dx - mov word ptr es:[bx+4],cx - pop ds ; restore registers and exit - pop es - pop dx - pop cx - pop bx - pop di - pop si - pop bp - ret -_jems_calldriver endp - -JMEMDOSA_TXT ends - - end diff --git a/jmemmac.c b/jmemmac.c deleted file mode 100644 index 106f9bea..00000000 --- a/jmemmac.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * jmemmac.c - * - * Copyright (C) 1992-1997, 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. - * - * If you use jmemmac.c, then you must define USE_MAC_MEMMGR in the - * JPEG_INTERNALS part of jconfig.h. - * - * 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 and System 7.0+'s - * temporary folder functionality. - * - * Note that jmemmac.c depends on two features of MacOS that were first - * introduced in System 7: FindFolder and the FSSpec-based calls. - * If your application uses jmemmac.c and is run under System 6 or earlier, - * and the jpeg library decides it needs a temporary file, it will abort, - * printing error messages about requiring System 7. (If no temporary files - * are created, it will run fine.) - * - * If you want to use jmemmac.c in an application that might be used with - * System 6 or earlier, then you should remove dependencies on FindFolder - * and the FSSpec calls. You will need to replace FindFolder with some - * other mechanism for finding a place to put temporary files, and you - * should replace the FSSpec calls with their HFS equivalents: - * - * FSpDelete -> HDelete - * FSpGetFInfo -> HGetFInfo - * FSpCreate -> HCreate - * FSpOpenDF -> HOpen *** Note: not HOpenDF *** - * FSMakeFSSpec -> (fill in spec by hand.) - * - * (Use HOpen instead of HOpenDF. HOpen is just a glue-interface to PBHOpen, - * which is on all HFS macs. HOpenDF is a System 7 addition which avoids the - * ages-old problem of names starting with a period.) - * - * Contributed by Sam Bushell (jsam@iagu.on.net) and - * Dan Gildor (gyld@in-touch.com). - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef USE_MAC_MEMMGR /* make sure user got configuration right */ - You forgot to define USE_MAC_MEMMGR in jconfig.h. /* deliberate syntax error */ -#endif - -#include /* we use the MacOS memory manager */ -#include /* we use the MacOS File stuff */ -#include /* we use the MacOS HFS stuff */ -#include /* for smSystemScript */ -#include /* we use Gestalt to test for specific functionality */ - -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "JPG%03d.TMP" -#endif - -static int next_file_num; /* to distinguish among several temp files */ - - -/* - * 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) -{ - long bytes = byte_count; - long retVal; - - if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) - ERREXIT(cinfo, JERR_TFILE_SEEK); - - retVal = FSRead ( info->temp_file, &bytes, - (unsigned char *) buffer_address ); - if ( retVal != noErr || bytes != 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) -{ - long bytes = byte_count; - long retVal; - - if ( SetFPos ( info->temp_file, fsFromStart, file_offset ) != noErr ) - ERREXIT(cinfo, JERR_TFILE_SEEK); - - retVal = FSWrite ( info->temp_file, &bytes, - (unsigned char *) buffer_address ); - if ( retVal != noErr || bytes != byte_count ) - ERREXIT(cinfo, JERR_TFILE_WRITE); -} - - -METHODDEF(void) -close_backing_store (j_common_ptr cinfo, backing_store_ptr info) -{ - FSClose ( info->temp_file ); - FSpDelete ( &(info->tempSpec) ); -} - - -/* - * Initial opening of a backing-store object. - * - * This version uses FindFolder to find the Temporary Items folder, - * and puts the temporary file in there. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - short tmpRef, vRefNum; - long dirID; - FInfo finderInfo; - FSSpec theSpec; - Str255 fName; - OSErr osErr; - long gestaltResponse = 0; - - /* Check that FSSpec calls are available. */ - osErr = Gestalt( gestaltFSAttr, &gestaltResponse ); - if ( ( osErr != noErr ) - || !( gestaltResponse & (1<temp_name, TEMP_FILE_NAME, next_file_num); - strcpy ( (Ptr)fName+1, info->temp_name ); - *fName = strlen (info->temp_name); - osErr = FSMakeFSSpec ( vRefNum, dirID, fName, &theSpec ); - - if ( (osErr = FSpGetFInfo ( &theSpec, &finderInfo ) ) != noErr ) - break; - } - - osErr = FSpCreate ( &theSpec, '????', '????', smSystemScript ); - if ( osErr != noErr ) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - - osErr = FSpOpenDF ( &theSpec, fsRdWrPerm, &(info->temp_file) ); - if ( osErr != noErr ) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - - info->tempSpec = theSpec; - - info->read_backing_store = read_backing_store; - info->write_backing_store = write_backing_store; - info->close_backing_store = close_backing_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -GLOBAL(long) -jpeg_mem_init (j_common_ptr cinfo) -{ - next_file_num = 0; - - /* 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/jmemname.c b/jmemname.c deleted file mode 100644 index ed96dee1..00000000 --- a/jmemname.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * jmemname.c - * - * Copyright (C) 1992-1997, 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. - * - * This file provides a generic implementation of the system-dependent - * portion of the JPEG memory manager. This implementation assumes that - * you must explicitly construct a name for each temp file. - * Also, the problem of determining the amount of memory available - * is shoved onto the user. - */ - -#define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ - -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); -#endif - -#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ -#define SEEK_SET 0 /* if not, assume 0 is correct */ -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define RW_BINARY "w+" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define RW_BINARY "w+b", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define RW_BINARY "w+b" -#endif -#endif - - -/* - * Selection of a file name for a temporary file. - * This is system-dependent! - * - * The code as given is suitable for most Unix systems, and it is easily - * modified for most non-Unix systems. Some notes: - * 1. The temp file is created in the directory named by TEMP_DIRECTORY. - * The default value is /usr/tmp, which is the conventional place for - * creating large temp files on Unix. On other systems you'll probably - * want to change the file location. You can do this by editing the - * #define, or (preferred) by defining TEMP_DIRECTORY in jconfig.h. - * - * 2. If you need to change the file name as well as its location, - * you can override the TEMP_FILE_NAME macro. (Note that this is - * actually a printf format string; it must contain %s and %d.) - * Few people should need to do this. - * - * 3. mktemp() is used to ensure that multiple processes running - * simultaneously won't select the same file names. If your system - * doesn't have mktemp(), define NO_MKTEMP to do it the hard way. - * (If you don't have , also define NO_ERRNO_H.) - * - * 4. You probably want to define NEED_SIGNAL_CATCHER so that cjpeg.c/djpeg.c - * will cause the temp files to be removed if you stop the program early. - */ - -#ifndef TEMP_DIRECTORY /* can override from jconfig.h or Makefile */ -#define TEMP_DIRECTORY "/usr/tmp/" /* recommended setting for Unix */ -#endif - -static int next_file_num; /* to distinguish among several temp files */ - -#ifdef NO_MKTEMP - -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "%sJPG%03d.TMP" -#endif - -#ifndef NO_ERRNO_H -#include /* to define ENOENT */ -#endif - -/* ANSI C specifies that errno is a macro, but on older systems it's more - * likely to be a plain int variable. And not all versions of errno.h - * bother to declare it, so we have to in order to be most portable. Thus: - */ -#ifndef errno -extern int errno; -#endif - - -LOCAL(void) -select_file_name (char * fname) -{ - FILE * tfile; - - /* Keep generating file names till we find one that's not in use */ - for (;;) { - next_file_num++; /* advance counter */ - sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); - if ((tfile = fopen(fname, READ_BINARY)) == NULL) { - /* fopen could have failed for a reason other than the file not - * being there; for example, file there but unreadable. - * If isn't available, then we cannot test the cause. - */ -#ifdef ENOENT - if (errno != ENOENT) - continue; -#endif - break; - } - fclose(tfile); /* oops, it's there; close tfile & try again */ - } -} - -#else /* ! NO_MKTEMP */ - -/* Note that mktemp() requires the initial filename to end in six X's */ -#ifndef TEMP_FILE_NAME /* can override from jconfig.h or Makefile */ -#define TEMP_FILE_NAME "%sJPG%dXXXXXX" -#endif - -LOCAL(void) -select_file_name (char * fname) -{ - next_file_num++; /* advance counter */ - sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); - mktemp(fname); /* make sure file name is unique */ - /* mktemp replaces the trailing XXXXXX with a unique string of characters */ -} - -#endif /* NO_MKTEMP */ - - -/* - * Memory allocation and freeing are controlled by the regular library - * routines malloc() and free(). - */ - -GLOBAL(void *) -jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. - */ - -GLOBAL(void FAR *) -jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) -{ - return (void FAR *) malloc(sizeofobject); -} - -GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) -{ - free(object); -} - - -/* - * This routine computes the total memory space available for allocation. - * It's impossible to do this in a portable way; our current solution is - * to make the user tell us (with a default value set at compile time). - * If you can actually get the available space, it's a good idea to subtract - * a slop factor of 5% or so. - */ - -#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ -#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ -#endif - -GLOBAL(long) -jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, - long max_bytes_needed, long already_allocated) -{ - return cinfo->mem->max_memory_to_use - already_allocated; -} - - -/* - * 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); /* close the file */ - unlink(info->temp_name); /* delete the file */ -/* If your system doesn't have unlink(), use remove() instead. - * remove() is the ANSI-standard name for this function, but if - * your system was ANSI you'd be using jmemansi.c, right? - */ - TRACEMSS(cinfo, 1, JTRC_TFILE_CLOSE, info->temp_name); -} - - -/* - * Initial opening of a backing-store object. - */ - -GLOBAL(void) -jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) -{ - select_file_name(info->temp_name); - if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL) - ERREXITS(cinfo, JERR_TFILE_CREATE, info->temp_name); - info->read_backing_store = read_backing_store; - info->write_backing_store = write_backing_store; - info->close_backing_store = close_backing_store; - TRACEMSS(cinfo, 1, JTRC_TFILE_OPEN, info->temp_name); -} - - -/* - * These routines take care of any system-dependent initialization and - * cleanup required. - */ - -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) -jpeg_mem_term (j_common_ptr cinfo) -{ - /* no work */ -} diff --git a/jpeg.dsp b/jpeg.dsp new file mode 100644 index 00000000..c5685926 --- /dev/null +++ b/jpeg.dsp @@ -0,0 +1,320 @@ +# Microsoft Developer Studio Project File - Name="jpeg" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=jpeg - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "jpeg.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "jpeg.mak" CFG="jpeg - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "jpeg - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "jpeg - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "jpeg - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\jpeg" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x419 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "jpeg - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "..\Debug" +# PROP BASE Intermediate_Dir "..\Debug\jpeg" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x419 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "jpeg - Win32 Release" +# Name "jpeg - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\jcapimin.c +# End Source File +# Begin Source File + +SOURCE=.\jcapistd.c +# End Source File +# Begin Source File + +SOURCE=.\jccoefct.c +# End Source File +# Begin Source File + +SOURCE=.\jccolor.c +# End Source File +# Begin Source File + +SOURCE=.\jcdctmgr.c +# End Source File +# Begin Source File + +SOURCE=.\jchuff.c +# End Source File +# Begin Source File + +SOURCE=.\jcinit.c +# End Source File +# Begin Source File + +SOURCE=.\jcmainct.c +# End Source File +# Begin Source File + +SOURCE=.\jcmarker.c +# End Source File +# Begin Source File + +SOURCE=.\jcmaster.c +# End Source File +# Begin Source File + +SOURCE=.\jcomapi.c +# End Source File +# Begin Source File + +SOURCE=.\jcparam.c +# End Source File +# Begin Source File + +SOURCE=.\jcphuff.c +# End Source File +# Begin Source File + +SOURCE=.\jcprepct.c +# End Source File +# Begin Source File + +SOURCE=.\jcsample.c +# End Source File +# Begin Source File + +SOURCE=.\jctrans.c +# End Source File +# Begin Source File + +SOURCE=.\jdapimin.c +# End Source File +# Begin Source File + +SOURCE=.\jdapistd.c +# End Source File +# Begin Source File + +SOURCE=.\jdatadst.c +# End Source File +# Begin Source File + +SOURCE=.\jdatasrc.c +# End Source File +# Begin Source File + +SOURCE=.\jdcoefct.c +# End Source File +# Begin Source File + +SOURCE=.\jdcolor.c +# End Source File +# Begin Source File + +SOURCE=.\jddctmgr.c +# End Source File +# Begin Source File + +SOURCE=.\jdhuff.c +# End Source File +# Begin Source File + +SOURCE=.\jdinput.c +# End Source File +# Begin Source File + +SOURCE=.\jdmainct.c +# End Source File +# Begin Source File + +SOURCE=.\jdmarker.c +# End Source File +# Begin Source File + +SOURCE=.\jdmaster.c +# End Source File +# Begin Source File + +SOURCE=.\jdmerge.c +# End Source File +# Begin Source File + +SOURCE=.\jdphuff.c +# End Source File +# Begin Source File + +SOURCE=.\jdpostct.c +# End Source File +# Begin Source File + +SOURCE=.\jdsample.c +# End Source File +# Begin Source File + +SOURCE=.\jdtrans.c +# End Source File +# Begin Source File + +SOURCE=.\jerror.c +# End Source File +# Begin Source File + +SOURCE=.\jfdctflt.c +# End Source File +# Begin Source File + +SOURCE=.\jfdctfst.c +# End Source File +# Begin Source File + +SOURCE=.\jfdctint.c +# End Source File +# Begin Source File + +SOURCE=.\jidctflt.c +# End Source File +# Begin Source File + +SOURCE=.\jidctfst.c +# End Source File +# Begin Source File + +SOURCE=.\jidctint.c +# End Source File +# Begin Source File + +SOURCE=.\jidctred.c +# End Source File +# Begin Source File + +SOURCE=.\jmemmgr.c +# End Source File +# Begin Source File + +SOURCE=.\jmemnobs.c +# End Source File +# Begin Source File + +SOURCE=.\jquant1.c +# End Source File +# Begin Source File + +SOURCE=.\jquant2.c +# End Source File +# Begin Source File + +SOURCE=.\jutils.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\jchuff.h +# End Source File +# Begin Source File + +SOURCE=.\jconfig.h +# End Source File +# Begin Source File + +SOURCE=.\jdct.h +# End Source File +# Begin Source File + +SOURCE=.\jdhuff.h +# End Source File +# Begin Source File + +SOURCE=.\jerror.h +# End Source File +# Begin Source File + +SOURCE=.\jinclude.h +# End Source File +# Begin Source File + +SOURCE=.\jmemsys.h +# End Source File +# Begin Source File + +SOURCE=.\jmorecfg.h +# End Source File +# Begin Source File + +SOURCE=.\jpegint.h +# End Source File +# Begin Source File + +SOURCE=.\jpeglib.h +# End Source File +# Begin Source File + +SOURCE=.\jversion.h +# End Source File +# End Group +# End Target +# End Project diff --git a/jpegtran.1 b/jpegtran.1 deleted file mode 100644 index 6de18e2a..00000000 --- a/jpegtran.1 +++ /dev/null @@ -1,238 +0,0 @@ -.TH JPEGTRAN 1 "3 August 1997" -.SH NAME -jpegtran \- lossless transformation of JPEG files -.SH SYNOPSIS -.B jpegtran -[ -.I options -] -[ -.I filename -] -.LP -.SH DESCRIPTION -.LP -.B jpegtran -performs various useful transformations of JPEG files. -It can translate the coded representation from one variant of JPEG to another, -for example from baseline JPEG to progressive JPEG or vice versa. It can also -perform some rearrangements of the image data, for example turning an image -from landscape to portrait format by rotation. -.PP -.B jpegtran -works by rearranging the compressed data (DCT coefficients), without -ever fully decoding the image. Therefore, its transformations are lossless: -there is no image degradation at all, which would not be true if you used -.B djpeg -followed by -.B cjpeg -to accomplish the same conversion. But by the same token, -.B jpegtran -cannot perform lossy operations such as changing the image quality. -.PP -.B jpegtran -reads the named JPEG/JFIF file, or the standard input if no file is -named, and produces a JPEG/JFIF file on the standard output. -.SH OPTIONS -All switch names may be abbreviated; for example, -.B \-optimize -may be written -.B \-opt -or -.BR \-o . -Upper and lower case are equivalent. -British spellings are also accepted (e.g., -.BR \-optimise ), -though for brevity these are not mentioned below. -.PP -To specify the coded JPEG representation used in the output file, -.B jpegtran -accepts a subset of the switches recognized by -.BR cjpeg : -.TP -.B \-optimize -Perform optimization of entropy encoding parameters. -.TP -.B \-progressive -Create progressive JPEG file. -.TP -.BI \-restart " N" -Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is -attached to the number. -.TP -.BI \-scans " file" -Use the scan script given in the specified text file. -.PP -See -.BR cjpeg (1) -for more details about these switches. -If you specify none of these switches, you get a plain baseline-JPEG output -file. The quality setting and so forth are determined by the input file. -.PP -The image can be losslessly transformed by giving one of these switches: -.TP -.B \-flip horizontal -Mirror image horizontally (left-right). -.TP -.B \-flip vertical -Mirror image vertically (top-bottom). -.TP -.B \-rotate 90 -Rotate image 90 degrees clockwise. -.TP -.B \-rotate 180 -Rotate image 180 degrees. -.TP -.B \-rotate 270 -Rotate image 270 degrees clockwise (or 90 ccw). -.TP -.B \-transpose -Transpose image (across UL-to-LR axis). -.TP -.B \-transverse -Transverse transpose (across UR-to-LL axis). -.PP -The transpose transformation has no restrictions regarding image dimensions. -The other transformations operate rather oddly if the image dimensions are not -a multiple of the iMCU size (usually 8 or 16 pixels), because they can only -transform complete blocks of DCT coefficient data in the desired way. -.PP -.BR jpegtran 's -default behavior when transforming an odd-size image is designed -to preserve exact reversibility and mathematical consistency of the -transformation set. As stated, transpose is able to flip the entire image -area. Horizontal mirroring leaves any partial iMCU column at the right edge -untouched, but is able to flip all rows of the image. Similarly, vertical -mirroring leaves any partial iMCU row at the bottom edge untouched, but is -able to flip all columns. The other transforms can be built up as sequences -of transpose and flip operations; for consistency, their actions on edge -pixels are defined to be the same as the end result of the corresponding -transpose-and-flip sequence. -.PP -For practical use, you may prefer to discard any untransformable edge pixels -rather than having a strange-looking strip along the right and/or bottom edges -of a transformed image. To do this, add the -.B \-trim -switch: -.TP -.B \-trim -Drop non-transformable edge blocks. -.PP -Obviously, a transformation with -.B \-trim -is not reversible, so strictly speaking -.B jpegtran -with this switch is not lossless. Also, the expected mathematical -equivalences between the transformations no longer hold. For example, -.B \-rot 270 -trim -trims only the bottom edge, but -.B \-rot 90 -trim -followed by -.B \-rot 180 -trim -trims both edges. -.PP -Another not-strictly-lossless transformation switch is: -.TP -.B \-grayscale -Force grayscale output. -.PP -This option discards the chrominance channels if the input image is YCbCr -(ie, a standard color JPEG), resulting in a grayscale JPEG file. The -luminance channel is preserved exactly, so this is a better method of reducing -to grayscale than decompression, conversion, and recompression. This switch -is particularly handy for fixing a monochrome picture that was mistakenly -encoded as a color JPEG. (In such a case, the space savings from getting rid -of the near-empty chroma channels won't be large; but the decoding time for -a grayscale JPEG is substantially less than that for a color JPEG.) -.PP -.B jpegtran -also recognizes these switches that control what to do with "extra" markers, -such as comment blocks: -.TP -.B \-copy none -Copy no extra markers from source file. This setting suppresses all -comments and other excess baggage present in the source file. -.TP -.B \-copy comments -Copy only comment markers. This setting copies comments from the source file, -but discards any other inessential data. -.TP -.B \-copy all -Copy all extra markers. This setting preserves miscellaneous markers -found in the source file, such as JFIF thumbnails and Photoshop settings. -In some files these extra markers can be sizable. -.PP -The default behavior is -.BR "\-copy comments" . -(Note: in IJG releases v6 and v6a, -.B jpegtran -always did the equivalent of -.BR "\-copy none" .) -.PP -Additional switches recognized by jpegtran are: -.TP -.BI \-maxmemory " N" -Set limit for amount of memory to use in processing large images. Value is -in thousands of bytes, or millions of bytes if "M" is attached to the -number. For example, -.B \-max 4m -selects 4000000 bytes. If more space is needed, temporary files will be used. -.TP -.BI \-outfile " name" -Send output image to the named file, not to standard output. -.TP -.B \-verbose -Enable debug printout. More -.BR \-v 's -give more output. Also, version information is printed at startup. -.TP -.B \-debug -Same as -.BR \-verbose . -.SH EXAMPLES -.LP -This example converts a baseline JPEG file to progressive form: -.IP -.B jpegtran \-progressive -.I foo.jpg -.B > -.I fooprog.jpg -.PP -This example rotates an image 90 degrees clockwise, discarding any -unrotatable edge pixels: -.IP -.B jpegtran \-rot 90 -trim -.I foo.jpg -.B > -.I foo90.jpg -.SH ENVIRONMENT -.TP -.B JPEGMEM -If this environment variable is set, its value is the default memory limit. -The value is specified as described for the -.B \-maxmemory -switch. -.B JPEGMEM -overrides the default value specified when the program was compiled, and -itself is overridden by an explicit -.BR \-maxmemory . -.SH SEE ALSO -.BR cjpeg (1), -.BR djpeg (1), -.BR rdjpgcom (1), -.BR wrjpgcom (1) -.br -Wallace, Gregory K. "The JPEG Still Picture Compression Standard", -Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. -.SH AUTHOR -Independent JPEG Group -.SH BUGS -Arithmetic coding is not supported for legal reasons. -.PP -The transform options can't transform odd-size images perfectly. Use -.B \-trim -if you don't like the results without it. -.PP -The entire image is read into memory and then written out again, even in -cases where this isn't really necessary. Expect swapping on large images, -especially when using the more complex transform options. diff --git a/jpegtran.c b/jpegtran.c deleted file mode 100644 index 20ef111b..00000000 --- a/jpegtran.c +++ /dev/null @@ -1,504 +0,0 @@ -/* - * jpegtran.c - * - * Copyright (C) 1995-1997, 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. - * - * This file contains a command-line user interface for JPEG transcoding. - * It is very similar to cjpeg.c, but provides lossless transcoding between - * different JPEG file formats. It also provides some lossless and sort-of- - * lossless transformations of JPEG data. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "transupp.h" /* Support routines for jpegtran */ -#include "jversion.h" /* for version message */ - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - - -/* - * Argument-parsing code. - * The switch parser is designed to be useful with DOS-style command line - * syntax, ie, intermixed switches and file names, where only the switches - * to the left of a given file name affect processing of that file. - * The main program in this file doesn't actually use this capability... - */ - - -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ -static JCOPY_OPTION copyoption; /* -copy switch */ -static jpeg_transform_info transformoption; /* image transformation options */ - - -LOCAL(void) -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "usage: %s [switches] ", progname); -#ifdef TWO_FILE_COMMANDLINE - fprintf(stderr, "inputfile outputfile\n"); -#else - fprintf(stderr, "[inputfile]\n"); -#endif - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -copy none Copy no extra markers from source file\n"); - fprintf(stderr, " -copy comments Copy only comment markers (default)\n"); - fprintf(stderr, " -copy all Copy all extra markers\n"); -#ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); -#endif -#ifdef C_PROGRESSIVE_SUPPORTED - fprintf(stderr, " -progressive Create progressive JPEG file\n"); -#endif -#if TRANSFORMS_SUPPORTED - fprintf(stderr, "Switches for modifying the image:\n"); - fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n"); - fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); - fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n"); - fprintf(stderr, " -transpose Transpose image\n"); - fprintf(stderr, " -transverse Transverse transpose image\n"); - fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); -#endif /* TRANSFORMS_SUPPORTED */ - fprintf(stderr, "Switches for advanced users:\n"); - fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); - fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); - fprintf(stderr, " -outfile name Specify name for output file\n"); - fprintf(stderr, " -verbose or -debug Emit debug output\n"); - fprintf(stderr, "Switches for wizards:\n"); -#ifdef C_ARITH_CODING_SUPPORTED - fprintf(stderr, " -arithmetic Use arithmetic coding\n"); -#endif -#ifdef C_MULTISCAN_FILES_SUPPORTED - fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); -#endif - exit(EXIT_FAILURE); -} - - -LOCAL(void) -select_transform (JXFORM_CODE transform) -/* Silly little routine to detect multiple transform options, - * which we can't handle. - */ -{ -#if TRANSFORMS_SUPPORTED - if (transformoption.transform == JXFORM_NONE || - transformoption.transform == transform) { - transformoption.transform = transform; - } else { - fprintf(stderr, "%s: can only do one image transformation at a time\n", - progname); - usage(); - } -#else - fprintf(stderr, "%s: sorry, image transformation was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif -} - - -LOCAL(int) -parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) -/* Parse optional switches. - * Returns argv[] index of first file-name argument (== argc if none). - * Any file names with indexes <= last_file_arg_seen are ignored; - * they have presumably been processed in a previous iteration. - * (Pass 0 for last_file_arg_seen on the first or only iteration.) - * for_real is FALSE on the first (dummy) pass; we may skip any expensive - * processing. - */ -{ - int argn; - char * arg; - boolean simple_progressive; - char * scansarg = NULL; /* saves -scans parm if any */ - - /* Set up default JPEG parameters. */ - simple_progressive = FALSE; - outfilename = NULL; - copyoption = JCOPYOPT_DEFAULT; - transformoption.transform = JXFORM_NONE; - transformoption.trim = FALSE; - transformoption.force_grayscale = FALSE; - cinfo->err->trace_level = 0; - - /* Scan command line options, adjust parameters */ - - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (*arg != '-') { - /* Not a switch, must be a file name argument */ - if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ - } - break; /* else done parsing switches */ - } - arg++; /* advance past switch marker character */ - - if (keymatch(arg, "arithmetic", 1)) { - /* Use arithmetic coding. */ -#ifdef C_ARITH_CODING_SUPPORTED - cinfo->arith_code = TRUE; -#else - fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "copy", 1)) { - /* Select which extra markers to copy. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "none", 1)) { - copyoption = JCOPYOPT_NONE; - } else if (keymatch(argv[argn], "comments", 1)) { - copyoption = JCOPYOPT_COMMENTS; - } else if (keymatch(argv[argn], "all", 1)) { - copyoption = JCOPYOPT_ALL; - } else - usage(); - - } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { - /* Enable debug printouts. */ - /* On first -d, print version identification */ - static boolean printed_version = FALSE; - - if (! printed_version) { - fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n", - JVERSION, JCOPYRIGHT); - printed_version = TRUE; - } - cinfo->err->trace_level++; - - } else if (keymatch(arg, "flip", 1)) { - /* Mirror left-right or top-bottom. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "horizontal", 1)) - select_transform(JXFORM_FLIP_H); - else if (keymatch(argv[argn], "vertical", 1)) - select_transform(JXFORM_FLIP_V); - else - usage(); - - } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { - /* Force to grayscale. */ -#if TRANSFORMS_SUPPORTED - transformoption.force_grayscale = TRUE; -#else - select_transform(JXFORM_NONE); /* force an error */ -#endif - - } else if (keymatch(arg, "maxmemory", 3)) { - /* Maximum memory in Kb (or Mb with 'm'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (ch == 'm' || ch == 'M') - lval *= 1000L; - cinfo->mem->max_memory_to_use = lval * 1000L; - - } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { - /* Enable entropy parm optimization. */ -#ifdef ENTROPY_OPT_SUPPORTED - cinfo->optimize_coding = TRUE; -#else - fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "outfile", 4)) { - /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ - - } else if (keymatch(arg, "progressive", 1)) { - /* Select simple progressive mode. */ -#ifdef C_PROGRESSIVE_SUPPORTED - simple_progressive = TRUE; - /* We must postpone execution until num_components is known. */ -#else - fprintf(stderr, "%s: sorry, progressive output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "restart", 1)) { - /* Restart interval in MCU rows (or in MCUs with 'b'). */ - long lval; - char ch = 'x'; - - if (++argn >= argc) /* advance to next argument */ - usage(); - if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); - if (lval < 0 || lval > 65535L) - usage(); - if (ch == 'b' || ch == 'B') { - cinfo->restart_interval = (unsigned int) lval; - cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ - } else { - cinfo->restart_in_rows = (int) lval; - /* restart_interval will be computed during startup */ - } - - } else if (keymatch(arg, "rotate", 2)) { - /* Rotate 90, 180, or 270 degrees (measured clockwise). */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (keymatch(argv[argn], "90", 2)) - select_transform(JXFORM_ROT_90); - else if (keymatch(argv[argn], "180", 3)) - select_transform(JXFORM_ROT_180); - else if (keymatch(argv[argn], "270", 3)) - select_transform(JXFORM_ROT_270); - else - usage(); - - } else if (keymatch(arg, "scans", 1)) { - /* Set scan script. */ -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); - scansarg = argv[argn]; - /* We must postpone reading the file in case -progressive appears. */ -#else - fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", - progname); - exit(EXIT_FAILURE); -#endif - - } else if (keymatch(arg, "transpose", 1)) { - /* Transpose (across UL-to-LR axis). */ - select_transform(JXFORM_TRANSPOSE); - - } else if (keymatch(arg, "transverse", 6)) { - /* Transverse transpose (across UR-to-LL axis). */ - select_transform(JXFORM_TRANSVERSE); - - } else if (keymatch(arg, "trim", 3)) { - /* Trim off any partial edge MCUs that the transform can't handle. */ - transformoption.trim = TRUE; - - } else { - usage(); /* bogus switch */ - } - } - - /* Post-switch-scanning cleanup */ - - if (for_real) { - -#ifdef C_PROGRESSIVE_SUPPORTED - if (simple_progressive) /* process -progressive; -scans can override */ - jpeg_simple_progression(cinfo); -#endif - -#ifdef C_MULTISCAN_FILES_SUPPORTED - if (scansarg != NULL) /* process -scans if it was present */ - if (! read_scan_script(cinfo, scansarg)) - usage(); -#endif - } - - return argn; /* return index of next arg (file name) */ -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - struct jpeg_decompress_struct srcinfo; - struct jpeg_compress_struct dstinfo; - struct jpeg_error_mgr jsrcerr, jdsterr; -#ifdef PROGRESS_REPORT - struct cdjpeg_progress_mgr progress; -#endif - jvirt_barray_ptr * src_coef_arrays; - jvirt_barray_ptr * dst_coef_arrays; - int file_index; - FILE * input_file; - FILE * output_file; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "jpegtran"; /* in case C library doesn't provide it */ - - /* Initialize the JPEG decompression object with default error handling. */ - srcinfo.err = jpeg_std_error(&jsrcerr); - jpeg_create_decompress(&srcinfo); - /* Initialize the JPEG compression object with default error handling. */ - dstinfo.err = jpeg_std_error(&jdsterr); - jpeg_create_compress(&dstinfo); - - /* Now safe to enable signal catcher. - * Note: we assume only the decompression object will have virtual arrays. - */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &srcinfo); -#endif - - /* Scan command line to find file names. - * It is convenient to use just one switch-parsing routine, but the switch - * values read here are mostly ignored; we will rescan the switches after - * opening the input file. Also note that most of the switches affect the - * destination JPEG object, so we parse into that and then copy over what - * needs to affects the source too. - */ - - 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 */ - if (outfilename == NULL) { - if (file_index != argc-2) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - outfilename = argv[file_index+1]; - } else { - if (file_index != argc-1) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - } -#else - /* Unix style: expect zero or one file name */ - if (file_index < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } -#endif /* TWO_FILE_COMMANDLINE */ - - /* Open the input file. */ - if (file_index < argc) { - if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ - input_file = read_stdin(); - } - - /* Open the output file. */ - if (outfilename != NULL) { - if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, outfilename); - exit(EXIT_FAILURE); - } - } else { - /* default output file is stdout */ - output_file = write_stdout(); - } - -#ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr) &dstinfo, &progress); -#endif - - /* Specify data source for decompression */ - jpeg_stdio_src(&srcinfo, input_file); - - /* Enable saving of extra markers that we want to copy */ - jcopy_markers_setup(&srcinfo, copyoption); - - /* Read file header */ - (void) jpeg_read_header(&srcinfo, TRUE); - - /* Any space needed by a transform option must be requested before - * jpeg_read_coefficients so that memory allocation will be done right. - */ -#if TRANSFORMS_SUPPORTED - jtransform_request_workspace(&srcinfo, &transformoption); -#endif - - /* Read source file as DCT coefficients */ - src_coef_arrays = jpeg_read_coefficients(&srcinfo); - - /* Initialize destination compression parameters from source values */ - jpeg_copy_critical_parameters(&srcinfo, &dstinfo); - - /* Adjust destination parameters if required by transform options; - * also find out which set of coefficient arrays will hold the output. - */ -#if TRANSFORMS_SUPPORTED - dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); -#else - dst_coef_arrays = src_coef_arrays; -#endif - - /* Adjust default compression parameters by re-parsing the options */ - file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE); - - /* Specify data destination for compression */ - jpeg_stdio_dest(&dstinfo, output_file); - - /* Start compressor (note no image data is actually written here) */ - jpeg_write_coefficients(&dstinfo, dst_coef_arrays); - - /* Copy to the output file any extra markers that we want to preserve */ - jcopy_markers_execute(&srcinfo, &dstinfo, copyoption); - - /* Execute image transformation, if any */ -#if TRANSFORMS_SUPPORTED - jtransform_execute_transformation(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); -#endif - - /* Finish compression and release memory */ - jpeg_finish_compress(&dstinfo); - jpeg_destroy_compress(&dstinfo); - (void) jpeg_finish_decompress(&srcinfo); - jpeg_destroy_decompress(&srcinfo); - - /* Close files, if we opened them */ - if (input_file != stdin) - fclose(input_file); - if (output_file != stdout) - fclose(output_file); - -#ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr) &dstinfo); -#endif - - /* All done. */ - exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/libjpeg.doc b/libjpeg.doc deleted file mode 100644 index 689b206c..00000000 --- a/libjpeg.doc +++ /dev/null @@ -1,3006 +0,0 @@ -USING THE IJG JPEG LIBRARY - -Copyright (C) 1994-1998, 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. - - -This file describes how to use the IJG JPEG library within an application -program. Read it if you want to write a program that uses the library. - -The file example.c provides heavily commented skeleton code for calling the -JPEG library. Also see jpeglib.h (the include file to be used by application -programs) for full details about data structures and function parameter lists. -The library source code, of course, is the ultimate reference. - -Note that there have been *major* changes from the application interface -presented by IJG version 4 and earlier versions. The old design had several -inherent limitations, and it had accumulated a lot of cruft as we added -features while trying to minimize application-interface changes. We have -sacrificed backward compatibility in the version 5 rewrite, but we think the -improvements justify this. - - -TABLE OF CONTENTS ------------------ - -Overview: - Functions provided by the library - Outline of typical usage -Basic library usage: - Data formats - Compression details - Decompression details - Mechanics of usage: include files, linking, etc -Advanced features: - Compression parameter selection - Decompression parameter selection - Special color spaces - Error handling - Compressed data handling (source and destination managers) - I/O suspension - Progressive JPEG support - Buffered-image mode - Abbreviated datastreams and multiple images - Special markers - Raw (downsampled) image data - Really raw data: DCT coefficients - Progress monitoring - Memory management - Memory usage - Library compile-time options - Portability considerations - Notes for MS-DOS implementors - -You should read at least the overview and basic usage sections before trying -to program with the library. The sections on advanced features can be read -if and when you need them. - - -OVERVIEW -======== - -Functions provided by the library ---------------------------------- - -The IJG JPEG library provides C code to read and write JPEG-compressed image -files. The surrounding application program receives or supplies image data a -scanline at a time, using a straightforward uncompressed image format. All -details of color conversion and other preprocessing/postprocessing can be -handled by the library. - -The library includes a substantial amount of code that is not covered by the -JPEG standard but is necessary for typical applications of JPEG. These -functions preprocess the image before JPEG compression or postprocess it after -decompression. They include colorspace conversion, downsampling/upsampling, -and color quantization. The application indirectly selects use of this code -by specifying the format in which it wishes to supply or receive image data. -For example, if colormapped output is requested, then the decompression -library automatically invokes color quantization. - -A wide range of quality vs. speed tradeoffs are possible in JPEG processing, -and even more so in decompression postprocessing. The decompression library -provides multiple implementations that cover most of the useful tradeoffs, -ranging from very-high-quality down to fast-preview operation. On the -compression side we have generally not provided low-quality choices, since -compression is normally less time-critical. It should be understood that the -low-quality modes may not meet the JPEG standard's accuracy requirements; -nonetheless, they are useful for viewers. - -A word about functions *not* provided by the library. We handle a subset of -the ISO JPEG standard; most baseline, extended-sequential, and progressive -JPEG processes are supported. (Our subset includes all features now in common -use.) Unsupported ISO options include: - * Hierarchical storage - * Lossless JPEG - * Arithmetic entropy coding (unsupported for legal reasons) - * DNL marker - * Nonintegral subsampling ratios -We support both 8- and 12-bit data precision, but this is a compile-time -choice rather than a run-time choice; hence it is difficult to use both -precisions in a single application. - -By itself, the library handles only interchange JPEG datastreams --- in -particular the widely used JFIF file format. The library can be used by -surrounding code to process interchange or abbreviated JPEG datastreams that -are embedded in more complex file formats. (For example, this library is -used by the free LIBTIFF library to support JPEG compression in TIFF.) - - -Outline of typical usage ------------------------- - -The rough outline of a JPEG compression operation is: - - Allocate and initialize a JPEG compression object - Specify the destination for the compressed data (eg, a file) - Set parameters for compression, including image size & colorspace - jpeg_start_compress(...); - while (scan lines remain to be written) - jpeg_write_scanlines(...); - jpeg_finish_compress(...); - Release the JPEG compression object - -A JPEG compression object holds parameters and working state for the JPEG -library. We make creation/destruction of the object separate from starting -or finishing compression of an image; the same object can be re-used for a -series of image compression operations. This makes it easy to re-use the -same parameter settings for a sequence of images. Re-use of a JPEG object -also has important implications for processing abbreviated JPEG datastreams, -as discussed later. - -The image data to be compressed is supplied to jpeg_write_scanlines() from -in-memory buffers. If the application is doing file-to-file compression, -reading image data from the source file is the application's responsibility. -The library emits compressed data by calling a "data destination manager", -which typically will write the data into a file; but the application can -provide its own destination manager to do something else. - -Similarly, the rough outline of a JPEG decompression operation is: - - Allocate and initialize a JPEG decompression object - Specify the source of the compressed data (eg, a file) - Call jpeg_read_header() to obtain image info - Set parameters for decompression - jpeg_start_decompress(...); - while (scan lines remain to be read) - jpeg_read_scanlines(...); - jpeg_finish_decompress(...); - Release the JPEG decompression object - -This is comparable to the compression outline except that reading the -datastream header is a separate step. This is helpful because information -about the image's size, colorspace, etc is available when the application -selects decompression parameters. For example, the application can choose an -output scaling ratio that will fit the image into the available screen size. - -The decompression library obtains compressed data by calling a data source -manager, which typically will read the data from a file; but other behaviors -can be obtained with a custom source manager. Decompressed data is delivered -into in-memory buffers passed to jpeg_read_scanlines(). - -It is possible to abort an incomplete compression or decompression operation -by calling jpeg_abort(); or, if you do not need to retain the JPEG object, -simply release it by calling jpeg_destroy(). - -JPEG compression and decompression objects are two separate struct types. -However, they share some common fields, and certain routines such as -jpeg_destroy() can work on either type of object. - -The JPEG library has no static variables: all state is in the compression -or decompression object. Therefore it is possible to process multiple -compression and decompression operations concurrently, using multiple JPEG -objects. - -Both compression and decompression can be done in an incremental memory-to- -memory fashion, if suitable source/destination managers are used. See the -section on "I/O suspension" for more details. - - -BASIC LIBRARY USAGE -=================== - -Data formats ------------- - -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" 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. - -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 -example, R,G,B,R,G,B,R,G,B,... for 24-bit RGB color. Each scanline is an -array of data type JSAMPLE --- which is typically "unsigned char", unless -you've changed jmorecfg.h. (You can also change the RGB pixel layout, say -to B,G,R order, by modifying jmorecfg.h. But see the restrictions listed in -that file before doing so.) - -A 2-D array of pixels is formed by making a list of pointers to the starts of -scanlines; so the scanlines need not be physically adjacent in memory. Even -if you process just one scanline at a time, you must make a one-element -pointer array to conform to this structure. Pointers to JSAMPLE rows are of -type JSAMPROW, and the pointer to the pointer array is of type JSAMPARRAY. - -The library accepts or supplies one or more complete scanlines per call. -It is not possible to process part of a row at a time. Scanlines are always -processed top-to-bottom. You can process an entire image in one call if you -have it all in memory, but usually it's simplest to process one scanline at -a time. - -For best results, source data values should have the precision specified by -BITS_IN_JSAMPLE (normally 8 bits). For instance, if you choose to compress -data that's only 6 bits/channel, you should left-justify each value in a -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 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, -that is, colormap[i][j] is the value of the i'th color component for pixel -value (map index) j. Note that since the colormap indexes are stored in -JSAMPLEs, the maximum number of colors is limited by the size of JSAMPLE -(ie, at most 256 colors for an 8-bit JPEG library). - - -Compression details -------------------- - -Here we revisit the JPEG compression outline given in the overview. - -1. Allocate and initialize a JPEG compression object. - -A JPEG compression object is a "struct jpeg_compress_struct". (It also has -a bunch of subsidiary structures which are allocated via malloc(), but the -application doesn't control those directly.) This struct can be just a local -variable in the calling routine, if a single routine is going to execute the -whole JPEG compression sequence. Otherwise it can be static or allocated -from malloc(). - -You will also need a structure representing a JPEG error handler. The part -of this that the library cares about is a "struct jpeg_error_mgr". If you -are providing your own error handler, you'll typically want to embed the -jpeg_error_mgr struct in a larger structure; this is discussed later under -"Error handling". For now we'll assume you are just using the default error -handler. The default error handler will print JPEG error/warning messages -on stderr, and it will call exit() if a fatal error occurs. - -You must initialize the error handler structure, store a pointer to it into -the JPEG object's "err" field, and then call jpeg_create_compress() to -initialize the rest of the JPEG object. - -Typical code for this step, if you are using the default error handler, is - - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - ... - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - -jpeg_create_compress allocates a small amount of memory, so it could fail -if you are out of memory. In that case it will exit via the error handler; -that's why the error handler must be initialized first. - - -2. Specify the destination for the compressed data (eg, a file). - -As previously mentioned, the JPEG library delivers compressed data to a -"data destination" module. The library includes one data destination -module which knows how to write to a stdio stream. You can use your own -destination module if you want to do something else, as discussed later. - -If you use the standard destination module, you must open the target stdio -stream beforehand. Typical code for this step looks like: - - FILE * outfile; - ... - if ((outfile = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - exit(1); - } - jpeg_stdio_dest(&cinfo, outfile); - -where the last line invokes the standard destination module. - -WARNING: it is critical that the binary compressed data be delivered to the -output file unchanged. On non-Unix systems the stdio library may perform -newline translation or otherwise corrupt binary data. To suppress this -behavior, you may need to use a "b" option to fopen (as shown above), or use -setmode() or another routine to put the stdio stream in binary mode. See -cjpeg.c and djpeg.c for code that has been found to work on many systems. - -You can select the data destination after setting other parameters (step 3), -if that's more convenient. You may not change the destination between -calling jpeg_start_compress() and jpeg_finish_compress(). - - -3. Set parameters for compression, including image size & colorspace. - -You must supply information about the source image by setting the following -fields in the JPEG object (cinfo structure): - - image_width Width of image, in pixels - image_height Height of image, in pixels - input_components Number of color channels (samples per pixel) - in_color_space Color space of source image - -The image dimensions are, hopefully, obvious. JPEG supports image dimensions -of 1 to 64K pixels in either direction. The input color space is typically -RGB or grayscale, and input_components is 3 or 1 accordingly. (See "Special -color spaces", later, for more info.) The in_color_space field must be -assigned one of the J_COLOR_SPACE enum constants, typically JCS_RGB or -JCS_GRAYSCALE. - -JPEG has a large number of compression parameters that determine how the -image is encoded. Most applications don't need or want to know about all -these parameters. You can set all the parameters to reasonable defaults by -calling jpeg_set_defaults(); then, if there are particular values you want -to change, you can do so after that. The "Compression parameter selection" -section tells about all the parameters. - -You must set in_color_space correctly before calling jpeg_set_defaults(), -because the defaults depend on the source image colorspace. However the -other three source image parameters need not be valid until you call -jpeg_start_compress(). There's no harm in calling jpeg_set_defaults() more -than once, if that happens to be convenient. - -Typical code for a 24-bit RGB source image is - - cinfo.image_width = Width; /* image width and height, in pixels */ - cinfo.image_height = Height; - cinfo.input_components = 3; /* # of color components per pixel */ - cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ - - jpeg_set_defaults(&cinfo); - /* Make optional parameter settings here */ - - -4. jpeg_start_compress(...); - -After you have established the data destination and set all the necessary -source image info and other parameters, call jpeg_start_compress() to begin -a compression cycle. This will initialize internal state, allocate working -storage, and emit the first few bytes of the JPEG datastream header. - -Typical code: - - jpeg_start_compress(&cinfo, TRUE); - -The "TRUE" parameter ensures that a complete JPEG interchange datastream -will be written. This is appropriate in most cases. If you think you might -want to use an abbreviated datastream, read the section on abbreviated -datastreams, below. - -Once you have called jpeg_start_compress(), you may not alter any JPEG -parameters or other fields of the JPEG object until you have completed -the compression cycle. - - -5. while (scan lines remain to be written) - jpeg_write_scanlines(...); - -Now write all the required image data by calling jpeg_write_scanlines() -one or more times. You can pass one or more scanlines in each call, up -to the total image height. In most applications it is convenient to pass -just one or a few scanlines at a time. The expected format for the passed -data is discussed under "Data formats", above. - -Image data should be written in top-to-bottom scanline order. The JPEG spec -contains some weasel wording about how top and bottom are application-defined -terms (a curious interpretation of the English language...) but if you want -your files to be compatible with everyone else's, you WILL use top-to-bottom -order. If the source data must be read in bottom-to-top order, you can use -the JPEG library's virtual array mechanism to invert the data efficiently. -Examples of this can be found in the sample application cjpeg. - -The library maintains a count of the number of scanlines written so far -in the next_scanline field of the JPEG object. Usually you can just use -this variable as the loop counter, so that the loop test looks like -"while (cinfo.next_scanline < cinfo.image_height)". - -Code for this step depends heavily on the way that you store the source data. -example.c shows the following code for the case of a full-size 2-D source -array containing 3-byte RGB pixels: - - JSAMPROW row_pointer[1]; /* pointer to a single row */ - int row_stride; /* physical row width in buffer */ - - row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ - - while (cinfo.next_scanline < cinfo.image_height) { - row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; - jpeg_write_scanlines(&cinfo, row_pointer, 1); - } - -jpeg_write_scanlines() returns the number of scanlines actually written. -This will normally be equal to the number passed in, so you can usually -ignore the return value. It is different in just two cases: - * If you try to write more scanlines than the declared image height, - the additional scanlines are ignored. - * If you use a suspending data destination manager, output buffer overrun - will cause the compressor to return before accepting all the passed lines. - This feature is discussed under "I/O suspension", below. The normal - stdio destination manager will NOT cause this to happen. -In any case, the return value is the same as the change in the value of -next_scanline. - - -6. jpeg_finish_compress(...); - -After all the image data has been written, call jpeg_finish_compress() to -complete the compression cycle. This step is ESSENTIAL to ensure that the -last bufferload of data is written to the data destination. -jpeg_finish_compress() also releases working memory associated with the JPEG -object. - -Typical code: - - jpeg_finish_compress(&cinfo); - -If using the stdio destination manager, don't forget to close the output -stdio stream (if necessary) afterwards. - -If you have requested a multi-pass operating mode, such as Huffman code -optimization, jpeg_finish_compress() will perform the additional passes using -data buffered by the first pass. In this case jpeg_finish_compress() may take -quite a while to complete. With the default compression parameters, this will -not happen. - -It is an error to call jpeg_finish_compress() before writing the necessary -total number of scanlines. If you wish to abort compression, call -jpeg_abort() as discussed below. - -After completing a compression cycle, you may dispose of the JPEG object -as discussed next, or you may use it to compress another image. In that case -return to step 2, 3, or 4 as appropriate. If you do not change the -destination manager, the new datastream will be written to the same target. -If you do not change any JPEG parameters, the new datastream will be written -with the same parameters as before. Note that you can change the input image -dimensions freely between cycles, but if you change the input colorspace, you -should call jpeg_set_defaults() to adjust for the new colorspace; and then -you'll need to repeat all of step 3. - - -7. Release the JPEG compression object. - -When you are done with a JPEG compression object, destroy it by calling -jpeg_destroy_compress(). This will free all subsidiary memory (regardless of -the previous state of the object). Or you can call jpeg_destroy(), which -works for either compression or decompression objects --- this may be more -convenient if you are sharing code between compression and decompression -cases. (Actually, these routines are equivalent except for the declared type -of the passed pointer. To avoid gripes from ANSI C compilers, jpeg_destroy() -should be passed a j_common_ptr.) - -If you allocated the jpeg_compress_struct structure from malloc(), freeing -it is your responsibility --- jpeg_destroy() won't. Ditto for the error -handler structure. - -Typical code: - - jpeg_destroy_compress(&cinfo); - - -8. Aborting. - -If you decide to abort a compression cycle before finishing, you can clean up -in either of two ways: - -* If you don't need the JPEG object any more, just call - jpeg_destroy_compress() or jpeg_destroy() to release memory. This is - legitimate at any point after calling jpeg_create_compress() --- in fact, - it's safe even if jpeg_create_compress() fails. - -* If you want to re-use the JPEG object, call jpeg_abort_compress(), or call - jpeg_abort() which works on both compression and decompression objects. - This will return the object to an idle state, releasing any working memory. - jpeg_abort() is allowed at any time after successful object creation. - -Note that cleaning up the data destination, if required, is your -responsibility; neither of these routines will call term_destination(). -(See "Compressed data handling", below, for more about that.) - -jpeg_destroy() and jpeg_abort() are the only safe calls to make on a JPEG -object that has reported an error by calling error_exit (see "Error handling" -for more info). The internal state of such an object is likely to be out of -whack. Either of these two routines will return the object to a known state. - - -Decompression details ---------------------- - -Here we revisit the JPEG decompression outline given in the overview. - -1. Allocate and initialize a JPEG decompression object. - -This is just like initialization for compression, as discussed above, -except that the object is a "struct jpeg_decompress_struct" and you -call jpeg_create_decompress(). Error handling is exactly the same. - -Typical code: - - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - ... - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_decompress(&cinfo); - -(Both here and in the IJG code, we usually use variable name "cinfo" for -both compression and decompression objects.) - - -2. Specify the source of the compressed data (eg, a file). - -As previously mentioned, the JPEG library reads compressed data from a "data -source" module. The library includes one data source module which knows how -to read from a stdio stream. You can use your own source module if you want -to do something else, as discussed later. - -If you use the standard source module, you must open the source stdio stream -beforehand. Typical code for this step looks like: - - FILE * infile; - ... - if ((infile = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - exit(1); - } - jpeg_stdio_src(&cinfo, infile); - -where the last line invokes the standard source module. - -WARNING: it is critical that the binary compressed data be read unchanged. -On non-Unix systems the stdio library may perform newline translation or -otherwise corrupt binary data. To suppress this behavior, you may need to use -a "b" option to fopen (as shown above), or use setmode() or another routine to -put the stdio stream in binary mode. See cjpeg.c and djpeg.c for code that -has been found to work on many systems. - -You may not change the data source between calling jpeg_read_header() and -jpeg_finish_decompress(). If you wish to read a series of JPEG images from -a single source file, you should repeat the jpeg_read_header() to -jpeg_finish_decompress() sequence without reinitializing either the JPEG -object or the data source module; this prevents buffered input data from -being discarded. - - -3. Call jpeg_read_header() to obtain image info. - -Typical code for this step is just - - jpeg_read_header(&cinfo, TRUE); - -This will read the source datastream header markers, up to the beginning -of the compressed data proper. On return, the image dimensions and other -info have been stored in the JPEG object. The application may wish to -consult this information before selecting decompression parameters. - -More complex code is necessary if - * A suspending data source is used --- in that case jpeg_read_header() - may return before it has read all the header data. See "I/O suspension", - below. The normal stdio source manager will NOT cause this to happen. - * Abbreviated JPEG files are to be processed --- see the section on - abbreviated datastreams. Standard applications that deal only in - interchange JPEG files need not be concerned with this case either. - -It is permissible to stop at this point if you just wanted to find out the -image dimensions and other header info for a JPEG file. In that case, -call jpeg_destroy() when you are done with the JPEG object, or call -jpeg_abort() to return it to an idle state before selecting a new data -source and reading another header. - - -4. Set parameters for decompression. - -jpeg_read_header() sets appropriate default decompression parameters based on -the properties of the image (in particular, its colorspace). However, you -may well want to alter these defaults before beginning the decompression. -For example, the default is to produce full color output from a color file. -If you want colormapped output you must ask for it. Other options allow the -returned image to be scaled and allow various speed/quality tradeoffs to be -selected. "Decompression parameter selection", below, gives details. - -If the defaults are appropriate, nothing need be done at this step. - -Note that all default values are set by each call to jpeg_read_header(). -If you reuse a decompression object, you cannot expect your parameter -settings to be preserved across cycles, as you can for compression. -You must set desired parameter values each time. - - -5. jpeg_start_decompress(...); - -Once the parameter values are satisfactory, call jpeg_start_decompress() to -begin decompression. This will initialize internal state, allocate working -memory, and prepare for returning data. - -Typical code is just - - jpeg_start_decompress(&cinfo); - -If you have requested a multi-pass operating mode, such as 2-pass color -quantization, jpeg_start_decompress() will do everything needed before data -output can begin. In this case jpeg_start_decompress() may take quite a while -to complete. With a single-scan (non progressive) JPEG file and default -decompression parameters, this will not happen; jpeg_start_decompress() will -return quickly. - -After this call, the final output image dimensions, including any requested -scaling, are available in the JPEG object; so is the selected colormap, if -colormapped output has been requested. Useful fields include - - output_width image width and height, as scaled - output_height - out_color_components # of color components in out_color_space - output_components # of color components returned per pixel - colormap the selected colormap, if any - actual_number_of_colors number of entries in colormap - -output_components is 1 (a colormap index) when quantizing colors; otherwise it -equals out_color_components. It is the number of JSAMPLE values that will be -emitted per pixel in the output arrays. - -Typically you will need to allocate data buffers to hold the incoming image. -You will need output_width * output_components JSAMPLEs per scanline in your -output buffer, and a total of output_height scanlines will be returned. - -Note: if you are using the JPEG library's internal memory manager to allocate -data buffers (as djpeg does), then the manager's protocol requires that you -request large buffers *before* calling jpeg_start_decompress(). This is a -little tricky since the output_XXX fields are not normally valid then. You -can make them valid by calling jpeg_calc_output_dimensions() after setting the -relevant parameters (scaling, output color space, and quantization flag). - - -6. while (scan lines remain to be read) - jpeg_read_scanlines(...); - -Now you can read the decompressed image data by calling jpeg_read_scanlines() -one or more times. At each call, you pass in the maximum number of scanlines -to be read (ie, the height of your working buffer); jpeg_read_scanlines() -will return up to that many lines. The return value is the number of lines -actually read. The format of the returned data is discussed under "Data -formats", above. Don't forget that grayscale and color JPEGs will return -different data formats! - -Image data is returned in top-to-bottom scanline order. If you must write -out the image in bottom-to-top order, you can use the JPEG library's virtual -array mechanism to invert the data efficiently. Examples of this can be -found in the sample application djpeg. - -The library maintains a count of the number of scanlines returned so far -in the output_scanline field of the JPEG object. Usually you can just use -this variable as the loop counter, so that the loop test looks like -"while (cinfo.output_scanline < cinfo.output_height)". (Note that the test -should NOT be against image_height, unless you never use scaling. The -image_height field is the height of the original unscaled image.) -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 returns only a -few 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(...); - -After all the image data has been read, call jpeg_finish_decompress() to -complete the decompression cycle. This causes working memory associated -with the JPEG object to be released. - -Typical code: - - jpeg_finish_decompress(&cinfo); - -If using the stdio source manager, don't forget to close the source stdio -stream if necessary. - -It is an error to call jpeg_finish_decompress() before reading the correct -total number of scanlines. If you wish to abort decompression, call -jpeg_abort() as discussed below. - -After completing a decompression cycle, you may dispose of the JPEG object as -discussed next, or you may use it to decompress another image. In that case -return to step 2 or 3 as appropriate. If you do not change the source -manager, the next image will be read from the same source. - - -8. Release the JPEG decompression object. - -When you are done with a JPEG decompression object, destroy it by calling -jpeg_destroy_decompress() or jpeg_destroy(). The previous discussion of -destroying compression objects applies here too. - -Typical code: - - jpeg_destroy_decompress(&cinfo); - - -9. Aborting. - -You can abort a decompression cycle by calling jpeg_destroy_decompress() or -jpeg_destroy() if you don't need the JPEG object any more, or -jpeg_abort_decompress() or jpeg_abort() if you want to reuse the object. -The previous discussion of aborting compression cycles applies here too. - - -Mechanics of usage: include files, linking, etc ------------------------------------------------ - -Applications using the JPEG library should include the header file jpeglib.h -to obtain declarations of data types and routines. Before including -jpeglib.h, include system headers that define at least the typedefs FILE and -size_t. On ANSI-conforming systems, including is sufficient; on -older Unix systems, you may need to define size_t. - -If the application needs to refer to individual JPEG library error codes, also -include jerror.h to define those symbols. - -jpeglib.h indirectly includes the files jconfig.h and jmorecfg.h. If you are -installing the JPEG header files in a system directory, you will want to -install all four files: jpeglib.h, jerror.h, jconfig.h, jmorecfg.h. - -The most convenient way to include the JPEG code into your executable program -is to prepare a library file ("libjpeg.a", or a corresponding name on non-Unix -machines) and reference it at your link step. If you use only half of the -library (only compression or only decompression), only that much code will be -included from the library, unless your linker is hopelessly brain-damaged. -The supplied makefiles build libjpeg.a automatically (see install.doc). - -While you can build the JPEG library as a shared library if the whim strikes -you, we don't really recommend it. The trouble with shared libraries is that -at some point you'll probably try to substitute a new version of the library -without recompiling the calling applications. That generally doesn't work -because the parameter struct declarations usually change with each new -version. In other words, the library's API is *not* guaranteed binary -compatible across versions; we only try to ensure source-code compatibility. -(In hindsight, it might have been smarter to hide the parameter structs from -applications and introduce a ton of access functions instead. Too late now, -however.) - -On some systems your application may need to set up a signal handler to ensure -that temporary files are deleted if the program is interrupted. This is most -critical if you are on MS-DOS and use the jmemdos.c memory manager back end; -it will try to grab extended memory for temp files, and that space will NOT be -freed automatically. See cjpeg.c or djpeg.c for an example signal handler. - -It may be worth pointing out that the core JPEG library does not actually -require the stdio library: only the default source/destination managers and -error handler need it. You can use the library in a stdio-less environment -if you replace those modules and use jmemnobs.c (or another memory manager of -your own devising). More info about the minimum system library requirements -may be found in jinclude.h. - - -ADVANCED FEATURES -================= - -Compression parameter selection -------------------------------- - -This section describes all the optional parameters you can set for JPEG -compression, as well as the "helper" routines provided to assist in this -task. Proper setting of some parameters requires detailed understanding -of the JPEG standard; if you don't know what a parameter is for, it's best -not to mess with it! See REFERENCES in the README file for pointers to -more info about JPEG. - -It's a good idea to call jpeg_set_defaults() first, even if you plan to set -all the parameters; that way your code is more likely to work with future JPEG -libraries that have additional parameters. For the same reason, we recommend -you use a helper routine where one is provided, in preference to twiddling -cinfo fields directly. - -The helper routines are: - -jpeg_set_defaults (j_compress_ptr cinfo) - This routine sets all JPEG parameters to reasonable defaults, using - only the input image's color space (field in_color_space, which must - already be set in cinfo). Many applications will only need to use - this routine and perhaps jpeg_set_quality(). - -jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) - Sets the JPEG file's colorspace (field jpeg_color_space) as specified, - and sets other color-space-dependent parameters appropriately. See - "Special color spaces", below, before using this. A large number of - parameters, including all per-component parameters, are set by this - routine; if you want to twiddle individual parameters you should call - jpeg_set_colorspace() before rather than after. - -jpeg_default_colorspace (j_compress_ptr cinfo) - Selects an appropriate JPEG colorspace based on cinfo->in_color_space, - and calls jpeg_set_colorspace(). This is actually a subroutine of - jpeg_set_defaults(). It's broken out in case you want to change - just the colorspace-dependent JPEG parameters. - -jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) - Constructs JPEG quantization tables appropriate for the indicated - quality setting. The quality value is expressed on the 0..100 scale - recommended by IJG (cjpeg's "-quality" switch uses this routine). - Note that the exact mapping from quality values to tables may change - in future IJG releases as more is learned about DCT quantization. - If the force_baseline parameter is TRUE, then the quantization table - entries are constrained to the range 1..255 for full JPEG baseline - compatibility. In the current implementation, this only makes a - difference for quality settings below 25, and it effectively prevents - very small/low quality files from being generated. The IJG decoder - is capable of reading the non-baseline files generated at low quality - settings when force_baseline is FALSE, but other decoders may not be. - -jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - boolean force_baseline) - Same as jpeg_set_quality() except that the generated tables are the - sample tables given in the JPEC spec section K.1, multiplied by the - specified scale factor (which is expressed as a percentage; thus - scale_factor = 100 reproduces the spec's tables). Note that larger - scale factors give lower quality. This entry point is useful for - conforming to the Adobe PostScript DCT conventions, but we do not - recommend linear scaling as a user-visible quality scale otherwise. - force_baseline again constrains the computed table entries to 1..255. - -int jpeg_quality_scaling (int quality) - Converts a value on the IJG-recommended quality scale to a linear - scaling percentage. Note that this routine may change or go away - in future releases --- IJG may choose to adopt a scaling method that - can't be expressed as a simple scalar multiplier, in which case the - premise of this routine collapses. Caveat user. - -jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - 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 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. - This is the recommended method of creating a progressive file, - unless you want to make a custom scan sequence. You must ensure that - the JPEG color space is set correctly before calling this routine. - - -Compression parameters (cinfo fields) include: - -J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are: - JDCT_ISLOW: slow but accurate integer algorithm - JDCT_IFAST: faster, less accurate integer method - JDCT_FLOAT: floating-point method - JDCT_DEFAULT: default method (normally JDCT_ISLOW) - JDCT_FASTEST: fastest method (normally JDCT_IFAST) - The FLOAT method is very slightly more accurate than the ISLOW method, - but may give different results on different machines due to varying - roundoff behavior. The integer methods should give the same results - on all machines. On machines with sufficiently fast FP hardware, the - floating-point method may also be the fastest. The IFAST method is - considerably less accurate than the other two; its use is not - recommended if high quality is a concern. JDCT_DEFAULT and - JDCT_FASTEST are macros configurable by each installation. - -J_COLOR_SPACE jpeg_color_space -int num_components - The JPEG color space and corresponding number of components; see - "Special color spaces", below, for more info. We recommend using - jpeg_set_color_space() if you want to change these. - -boolean optimize_coding - TRUE causes the compressor to compute optimal Huffman coding tables - for the image. This requires an extra pass over the data and - therefore costs a good deal of space and time. The default is - FALSE, which tells the compressor to use the supplied or default - Huffman tables. In most cases optimal tables save only a few percent - of file size compared to the default tables. Note that when this is - TRUE, you need not supply Huffman tables at all, and any you do - supply will be overwritten. - -unsigned int restart_interval -int restart_in_rows - To emit restart markers in the JPEG file, set one of these nonzero. - Set restart_interval to specify the exact interval in MCU blocks. - Set restart_in_rows to specify the interval in MCU rows. (If - restart_in_rows is not 0, then restart_interval is set after the - image width in MCUs is computed.) Defaults are zero (no restarts). - One restart marker per MCU row is often a good choice. - NOTE: the overhead of restart markers is higher in grayscale JPEG - files than in color files, and MUCH higher in progressive JPEGs. - If you use restarts, you may want to use larger intervals in those - cases. - -const jpeg_scan_info * scan_info -int num_scans - By default, scan_info is NULL; this causes the compressor to write a - single-scan sequential JPEG file. If not NULL, scan_info points to - an array of scan definition records of length num_scans. The - compressor will then write a JPEG file having one scan for each scan - definition record. This is used to generate noninterleaved or - progressive JPEG files. The library checks that the scan array - defines a valid JPEG scan sequence. (jpeg_simple_progression creates - a suitable scan definition array for progressive JPEG.) This is - discussed further under "Progressive JPEG support". - -int smoothing_factor - If non-zero, the input image is smoothed; the value should be 1 for - minimal smoothing to 100 for maximum smoothing. Consult jcsample.c - for details of the smoothing algorithm. The default is zero. - -boolean write_JFIF_header - If TRUE, a JFIF APP0 marker is emitted. jpeg_set_defaults() and - jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space - (ie, YCbCr or grayscale) is selected, otherwise FALSE. - -UINT8 JFIF_major_version -UINT8 JFIF_minor_version - The version number to be written into the JFIF marker. - jpeg_set_defaults() initializes the version to 1.01 (major=minor=1). - You should set it to 1.02 (major=1, minor=2) if you plan to write - any JFIF 1.02 extension markers. - -UINT8 density_unit -UINT16 X_density -UINT16 Y_density - The resolution information to be written into the JFIF marker; - not used otherwise. density_unit may be 0 for unknown, - 1 for dots/inch, or 2 for dots/cm. The default values are 0,1,1 - indicating square pixels of unknown size. - -boolean write_Adobe_marker - If TRUE, an Adobe APP14 marker is emitted. jpeg_set_defaults() and - jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK, - or YCCK is selected, otherwise FALSE. It is generally a bad idea - to set both write_JFIF_header and write_Adobe_marker. In fact, - you probably shouldn't change the default settings at all --- the - default behavior ensures that the JPEG file's color space can be - recognized by the decoder. - -JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS] - Pointers to coefficient quantization tables, one per table slot, - or NULL if no table is defined for a slot. Usually these should - be set via one of the above helper routines; jpeg_add_quant_table() - is general enough to define any quantization table. The other - routines will set up table slot 0 for luminance quality and table - slot 1 for chrominance. - -JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS] -JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS] - Pointers to Huffman coding tables, one per table slot, or NULL if - no table is defined for a slot. Slots 0 and 1 are filled with the - JPEG sample tables by jpeg_set_defaults(). If you need to allocate - more table structures, jpeg_alloc_huff_table() may be used. - Note that optimal Huffman tables can be computed for an image - by setting optimize_coding, as discussed above; there's seldom - any need to mess with providing your own Huffman tables. - -There are some additional cinfo fields which are not documented here -because you currently can't change them; for example, you can't set -arith_code TRUE because arithmetic coding is unsupported. - - -Per-component parameters are stored in the struct cinfo.comp_info[i] for -component number i. Note that components here refer to components of the -JPEG color space, *not* the source image color space. A suitably large -comp_info[] array is allocated by jpeg_set_defaults(); if you choose not -to use that routine, it's up to you to allocate the array. - -int component_id - The one-byte identifier code to be recorded in the JPEG file for - this component. For the standard color spaces, we recommend you - leave the default values alone. - -int h_samp_factor -int v_samp_factor - Horizontal and vertical sampling factors for the component; must - be 1..4 according to the JPEG standard. Note that larger sampling - factors indicate a higher-resolution component; many people find - this behavior quite unintuitive. The default values are 2,2 for - luminance components and 1,1 for chrominance components, except - for grayscale where 1,1 is used. - -int quant_tbl_no - Quantization table number for component. The default value is - 0 for luminance components and 1 for chrominance components. - -int dc_tbl_no -int ac_tbl_no - DC and AC entropy coding table numbers. The default values are - 0 for luminance components and 1 for chrominance components. - -int component_index - Must equal the component's index in comp_info[]. (Beginning in - release v6, the compressor library will fill this in automatically; - you don't have to.) - - -Decompression parameter selection ---------------------------------- - -Decompression parameter selection is somewhat simpler than compression -parameter selection, since all of the JPEG internal parameters are -recorded in the source file and need not be supplied by the application. -(Unless you are working with abbreviated files, in which case see -"Abbreviated datastreams", below.) Decompression parameters control -the postprocessing done on the image to deliver it in a format suitable -for the application's use. Many of the parameters control speed/quality -tradeoffs, in which faster decompression may be obtained at the price of -a poorer-quality image. The defaults select the highest quality (slowest) -processing. - -The following fields in the JPEG object are set by jpeg_read_header() and -may be useful to the application in choosing decompression parameters: - -JDIMENSION image_width Width and height of image -JDIMENSION image_height -int num_components Number of color components -J_COLOR_SPACE jpeg_color_space Colorspace of image -boolean saw_JFIF_marker TRUE if a JFIF APP0 marker was seen - UINT8 JFIF_major_version Version information from JFIF marker - UINT8 JFIF_minor_version - UINT8 density_unit Resolution data from JFIF marker - UINT16 X_density - UINT16 Y_density -boolean saw_Adobe_marker TRUE if an Adobe APP14 marker was seen - UINT8 Adobe_transform Color transform code from Adobe marker - -The JPEG color space, unfortunately, is something of a guess since the JPEG -standard proper does not provide a way to record it. In practice most files -adhere to the JFIF or Adobe conventions, and the decoder will recognize these -correctly. See "Special color spaces", below, for more info. - - -The decompression parameters that determine the basic properties of the -returned image are: - -J_COLOR_SPACE out_color_space - Output color space. jpeg_read_header() sets an appropriate default - based on jpeg_color_space; typically it will be RGB or grayscale. - The application can change this field to request output in a different - colorspace. For example, set it to JCS_GRAYSCALE to get grayscale - output from a color file. (This is useful for previewing: grayscale - output is faster than full color since the color components need not - be processed.) Note that not all possible color space transforms are - currently implemented; you may need to extend jdcolor.c if you want an - unusual conversion. - -unsigned int scale_num, scale_denom - Scale the image by the fraction scale_num/scale_denom. Default is - 1/1, or no scaling. Currently, the only supported scaling ratios - are 1/1, 1/2, 1/4, and 1/8. (The library design allows for arbitrary - scaling ratios but this is not likely to be implemented any time soon.) - Smaller scaling ratios permit significantly faster decoding since - fewer pixels need be processed and a simpler IDCT method can be used. - -boolean quantize_colors - If set TRUE, colormapped output will be delivered. Default is FALSE, - meaning that full-color output will be delivered. - -The next three parameters are relevant only if quantize_colors is TRUE. - -int desired_number_of_colors - Maximum number of colors to use in generating a library-supplied color - map (the actual number of colors is returned in a different field). - Default 256. Ignored when the application supplies its own color map. - -boolean two_pass_quantize - If TRUE, an extra pass over the image is made to select a custom color - map for the image. This usually looks a lot better than the one-size- - fits-all colormap that is used otherwise. Default is TRUE. Ignored - when the application supplies its own color map. - -J_DITHER_MODE dither_mode - Selects color dithering method. Supported values are: - JDITHER_NONE no dithering: fast, very low quality - JDITHER_ORDERED ordered dither: moderate speed and quality - JDITHER_FS Floyd-Steinberg dither: slow, high quality - Default is JDITHER_FS. (At present, ordered dither is implemented - only in the single-pass, standard-colormap case. If you ask for - ordered dither when two_pass_quantize is TRUE or when you supply - an external color map, you'll get F-S dithering.) - -When quantize_colors is TRUE, the target color map is described by the next -two fields. colormap is set to NULL by jpeg_read_header(). The application -can supply a color map by setting colormap non-NULL and setting -actual_number_of_colors to the map size. Otherwise, jpeg_start_decompress() -selects a suitable color map and sets these two fields itself. -[Implementation restriction: at present, an externally supplied colormap is -only accepted for 3-component output color spaces.] - -JSAMPARRAY colormap - The color map, represented as a 2-D pixel array of out_color_components - rows and actual_number_of_colors columns. Ignored if not quantizing. - CAUTION: if the JPEG library creates its own colormap, the storage - pointed to by this field is released by jpeg_finish_decompress(). - Copy the colormap somewhere else first, if you want to save it. - -int actual_number_of_colors - The number of colors in the color map. - -Additional decompression parameters that the application may set include: - -J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are the same - as described above for compression. - -boolean do_fancy_upsampling - If TRUE, do careful upsampling of chroma components. If FALSE, - a faster but sloppier method is used. Default is TRUE. The visual - impact of the sloppier method is often very small. - -boolean do_block_smoothing - If TRUE, interblock smoothing is applied in early stages of decoding - progressive JPEG files; if FALSE, not. Default is TRUE. Early - progression stages look "fuzzy" with smoothing, "blocky" without. - In any case, block smoothing ceases to be applied after the first few - AC coefficients are known to full accuracy, so it is relevant only - when using buffered-image mode for progressive images. - -boolean enable_1pass_quant -boolean enable_external_quant -boolean enable_2pass_quant - These are significant only in buffered-image mode, which is - described in its own section below. - - -The output image dimensions are given by the following fields. These are -computed from the source image dimensions and the decompression parameters -by jpeg_start_decompress(). You can also call jpeg_calc_output_dimensions() -to obtain the values that will result from the current parameter settings. -This can be useful if you are trying to pick a scaling ratio that will get -close to a desired target size. It's also important if you are using the -JPEG library's memory manager to allocate output buffer space, because you -are supposed to request such buffers *before* jpeg_start_decompress(). - -JDIMENSION output_width Actual dimensions of output image. -JDIMENSION output_height -int out_color_components Number of color components in out_color_space. -int output_components Number of color components returned. -int rec_outbuf_height Recommended height of scanline buffer. - -When quantizing colors, output_components is 1, indicating a single color map -index per pixel. Otherwise it equals out_color_components. The output arrays -are required to be output_width * output_components JSAMPLEs wide. - -rec_outbuf_height is the recommended minimum height (in scanlines) of the -buffer passed to jpeg_read_scanlines(). If the buffer is smaller, the -library will still work, but time will be wasted due to unnecessary data -copying. In high-quality modes, rec_outbuf_height is always 1, but some -faster, lower-quality modes set it to larger values (typically 2 to 4). -If you are going to ask for a high-speed processing mode, you may as well -go to the trouble of honoring rec_outbuf_height so as to avoid data copying. -(An output buffer larger than rec_outbuf_height lines is OK, but won't -provide any material speed improvement over that height.) - - -Special color spaces --------------------- - -The JPEG standard itself is "color blind" and doesn't specify any particular -color space. It is customary to convert color data to a luminance/chrominance -color space before compressing, since this permits greater compression. The -existing de-facto JPEG file format standards specify YCbCr or grayscale data -(JFIF), or grayscale, RGB, YCbCr, CMYK, or YCCK (Adobe). For special -applications such as multispectral images, other color spaces can be used, -but it must be understood that such files will be unportable. - -The JPEG library can handle the most common colorspace conversions (namely -RGB <=> YCbCr and CMYK <=> YCCK). It can also deal with data of an unknown -color space, passing it through without conversion. If you deal extensively -with an unusual color space, you can easily extend the library to understand -additional color spaces and perform appropriate conversions. - -For compression, the source data's color space is specified by field -in_color_space. This is transformed to the JPEG file's color space given -by jpeg_color_space. jpeg_set_defaults() chooses a reasonable JPEG color -space depending on in_color_space, but you can override this by calling -jpeg_set_colorspace(). Of course you must select a supported transformation. -jccolor.c currently supports the following transformations: - RGB => YCbCr - RGB => GRAYSCALE - YCbCr => GRAYSCALE - CMYK => YCCK -plus the null transforms: GRAYSCALE => GRAYSCALE, RGB => RGB, -YCbCr => YCbCr, CMYK => CMYK, YCCK => YCCK, and UNKNOWN => UNKNOWN. - -The de-facto file format standards (JFIF and Adobe) specify APPn markers that -indicate the color space of the JPEG file. It is important to ensure that -these are written correctly, or omitted if the JPEG file's color space is not -one of the ones supported by the de-facto standards. jpeg_set_colorspace() -will set the compression parameters to include or omit the APPn markers -properly, so long as it is told the truth about the JPEG color space. -For example, if you are writing some random 3-component color space without -conversion, don't try to fake out the library by setting in_color_space and -jpeg_color_space to JCS_YCbCr; use JCS_UNKNOWN. You may want to write an -APPn marker of your own devising to identify the colorspace --- see "Special -markers", below. - -When told that the color space is UNKNOWN, the library will default to using -luminance-quality compression parameters for all color components. You may -well want to change these parameters. See the source code for -jpeg_set_colorspace(), in jcparam.c, for details. - -For decompression, the JPEG file's color space is given in jpeg_color_space, -and this is transformed to the output color space out_color_space. -jpeg_read_header's setting of jpeg_color_space can be relied on if the file -conforms to JFIF or Adobe conventions, but otherwise it is no better than a -guess. If you know the JPEG file's color space for certain, you can override -jpeg_read_header's guess by setting jpeg_color_space. jpeg_read_header also -selects a default output color space based on (its guess of) jpeg_color_space; -set out_color_space to override this. Again, you must select a supported -transformation. jdcolor.c currently supports - YCbCr => GRAYSCALE - YCbCr => RGB - GRAYSCALE => RGB - YCCK => CMYK -as well as the null transforms. (Since GRAYSCALE=>RGB is provided, an -application can force grayscale JPEGs to look like color JPEGs if it only -wants to handle one case.) - -The two-pass color quantizer, jquant2.c, is specialized to handle RGB data -(it weights distances appropriately for RGB colors). You'll need to modify -the code if you want to use it for non-RGB output color spaces. Note that -jquant2.c is used to map to an application-supplied colormap as well as for -the normal two-pass colormap selection process. - -CAUTION: it appears that Adobe Photoshop writes inverted data in CMYK JPEG -files: 0 represents 100% ink coverage, rather than 0% ink as you'd expect. -This is arguably a bug in Photoshop, but if you need to work with Photoshop -CMYK files, you will have to deal with it in your application. We cannot -"fix" this in the library by inverting the data during the CMYK<=>YCCK -transform, because that would break other applications, notably Ghostscript. -Photoshop versions prior to 3.0 write EPS files containing JPEG-encoded CMYK -data in the same inverted-YCCK representation used in bare JPEG files, but -the surrounding PostScript code performs an inversion using the PS image -operator. I am told that Photoshop 3.0 will write uninverted YCCK in -EPS/JPEG files, and will omit the PS-level inversion. (But the data -polarity used in bare JPEG files will not change in 3.0.) In either case, -the JPEG library must not invert the data itself, or else Ghostscript would -read these EPS files incorrectly. - - -Error handling --------------- - -When the default error handler is used, any error detected inside the JPEG -routines will cause a message to be printed on stderr, followed by exit(). -You can supply your own error handling routines to override this behavior -and to control the treatment of nonfatal warnings and trace/debug messages. -The file example.c illustrates the most common case, which is to have the -application regain control after an error rather than exiting. - -The JPEG library never writes any message directly; it always goes through -the error handling routines. Three classes of messages are recognized: - * Fatal errors: the library cannot continue. - * Warnings: the library can continue, but the data is corrupt, and a - damaged output image is likely to result. - * Trace/informational messages. These come with a trace level indicating - the importance of the message; you can control the verbosity of the - program by adjusting the maximum trace level that will be displayed. - -You may, if you wish, simply replace the entire JPEG error handling module -(jerror.c) with your own code. However, you can avoid code duplication by -only replacing some of the routines depending on the behavior you need. -This is accomplished by calling jpeg_std_error() as usual, but then overriding -some of the method pointers in the jpeg_error_mgr struct, as illustrated by -example.c. - -All of the error handling routines will receive a pointer to the JPEG object -(a j_common_ptr which points to either a jpeg_compress_struct or a -jpeg_decompress_struct; if you need to tell which, test the is_decompressor -field). This struct includes a pointer to the error manager struct in its -"err" field. Frequently, custom error handler routines will need to access -additional data which is not known to the JPEG library or the standard error -handler. The most convenient way to do this is to embed either the JPEG -object or the jpeg_error_mgr struct in a larger structure that contains -additional fields; then casting the passed pointer provides access to the -additional fields. Again, see example.c for one way to do it. (Beginning -with IJG version 6b, there is also a void pointer "client_data" in each -JPEG object, which the application can also use to find related data. -The library does not touch client_data at all.) - -The individual methods that you might wish to override are: - -error_exit (j_common_ptr cinfo) - Receives control for a fatal error. Information sufficient to - generate the error message has been stored in cinfo->err; call - output_message to display it. Control must NOT return to the caller; - generally this routine will exit() or longjmp() somewhere. - Typically you would override this routine to get rid of the exit() - default behavior. Note that if you continue processing, you should - clean up the JPEG object with jpeg_abort() or jpeg_destroy(). - -output_message (j_common_ptr cinfo) - Actual output of any JPEG message. Override this to send messages - somewhere other than stderr. Note that this method does not know - how to generate a message, only where to send it. - -format_message (j_common_ptr cinfo, char * buffer) - Constructs a readable error message string based on the error info - stored in cinfo->err. This method is called by output_message. Few - applications should need to override this method. One possible - reason for doing so is to implement dynamic switching of error message - language. - -emit_message (j_common_ptr cinfo, int msg_level) - Decide whether or not to emit a warning or trace message; if so, - calls output_message. The main reason for overriding this method - would be to abort on warnings. msg_level is -1 for warnings, - 0 and up for trace messages. - -Only error_exit() and emit_message() are called from the rest of the JPEG -library; the other two are internal to the error handler. - -The actual message texts are stored in an array of strings which is pointed to -by the field err->jpeg_message_table. The messages are numbered from 0 to -err->last_jpeg_message, and it is these code numbers that are used in the -JPEG library code. You could replace the message texts (for instance, with -messages in French or German) by changing the message table pointer. See -jerror.h for the default texts. CAUTION: this table will almost certainly -change or grow from one library version to the next. - -It may be useful for an application to add its own message texts that are -handled by the same mechanism. The error handler supports a second "add-on" -message table for this purpose. To define an addon table, set the pointer -err->addon_message_table and the message numbers err->first_addon_message and -err->last_addon_message. If you number the addon messages beginning at 1000 -or so, you won't have to worry about conflicts with the library's built-in -messages. See the sample applications cjpeg/djpeg for an example of using -addon messages (the addon messages are defined in cderror.h). - -Actual invocation of the error handler is done via macros defined in jerror.h: - ERREXITn(...) for fatal errors - WARNMSn(...) for corrupt-data warnings - TRACEMSn(...) for trace and informational messages. -These macros store the message code and any additional parameters into the -error handler struct, then invoke the error_exit() or emit_message() method. -The variants of each macro are for varying numbers of additional parameters. -The additional parameters are inserted into the generated message using -standard printf() format codes. - -See jerror.h and jerror.c for further details. - - -Compressed data handling (source and destination managers) ----------------------------------------------------------- - -The JPEG compression library sends its compressed data to a "destination -manager" module. The default destination manager just writes the data to a -stdio stream, but you can provide your own manager to do something else. -Similarly, the decompression library calls a "source manager" to obtain the -compressed data; you can provide your own source manager if you want the data -to come from somewhere other than a stdio stream. - -In both cases, compressed data is processed a bufferload at a time: the -destination or source manager provides a work buffer, and the library invokes -the manager only when the buffer is filled or emptied. (You could define a -one-character buffer to force the manager to be invoked for each byte, but -that would be rather inefficient.) The buffer's size and location are -controlled by the manager, not by the library. For example, if you desired to -decompress a JPEG datastream that was all in memory, you could just make the -buffer pointer and length point to the original data in memory. Then the -buffer-reload procedure would be invoked only if the decompressor ran off the -end of the datastream, which would indicate an erroneous datastream. - -The work buffer is defined as an array of datatype JOCTET, which is generally -"char" or "unsigned char". On a machine where char is not exactly 8 bits -wide, you must define JOCTET as a wider data type and then modify the data -source and destination modules to transcribe the work arrays into 8-bit units -on external storage. - -A data destination manager struct contains a pointer and count defining the -next byte to write in the work buffer and the remaining free space: - - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - -The library increments the pointer and decrements the count until the buffer -is filled. The manager's empty_output_buffer method must reset the pointer -and count. The manager is expected to remember the buffer's starting address -and total size in private fields not visible to the library. - -A data destination manager provides three methods: - -init_destination (j_compress_ptr cinfo) - Initialize destination. This is called by jpeg_start_compress() - before any data is actually written. It must initialize - next_output_byte and free_in_buffer. free_in_buffer must be - initialized to a positive value. - -empty_output_buffer (j_compress_ptr cinfo) - This is called whenever the buffer has filled (free_in_buffer - reaches zero). In typical applications, it should write out the - *entire* buffer (use the saved start address and buffer length; - ignore the current state of next_output_byte and free_in_buffer). - Then reset the pointer & count to the start of the buffer, and - return TRUE indicating that the buffer has been dumped. - free_in_buffer must be set to a positive value when TRUE is - returned. A FALSE return should only be used when I/O suspension is - desired (this operating mode is discussed in the next section). - -term_destination (j_compress_ptr cinfo) - Terminate destination --- called by jpeg_finish_compress() after all - data has been written. In most applications, this must flush any - data remaining in the buffer. Use either next_output_byte or - free_in_buffer to determine how much data is in the buffer. - -term_destination() is NOT called by jpeg_abort() or jpeg_destroy(). If you -want the destination manager to be cleaned up during an abort, you must do it -yourself. - -You will also need code to create a jpeg_destination_mgr struct, fill in its -method pointers, and insert a pointer to the struct into the "dest" field of -the JPEG compression object. This can be done in-line in your setup code if -you like, but it's probably cleaner to provide a separate routine similar to -the jpeg_stdio_dest() routine of the supplied destination manager. - -Decompression source managers follow a parallel design, but with some -additional frammishes. The source manager struct contains a pointer and count -defining the next byte to read from the work buffer and the number of bytes -remaining: - - const JOCTET * next_input_byte; /* => next byte to read from buffer */ - size_t bytes_in_buffer; /* # of bytes remaining in buffer */ - -The library increments the pointer and decrements the count until the buffer -is emptied. The manager's fill_input_buffer method must reset the pointer and -count. In most applications, the manager must remember the buffer's starting -address and total size in private fields not visible to the library. - -A data source manager provides five methods: - -init_source (j_decompress_ptr cinfo) - Initialize source. This is called by jpeg_read_header() before any - data is actually read. Unlike init_destination(), it may leave - bytes_in_buffer set to 0 (in which case a fill_input_buffer() call - will occur immediately). - -fill_input_buffer (j_decompress_ptr cinfo) - This is called whenever bytes_in_buffer has reached zero and more - data is wanted. In typical applications, it should read fresh data - into the buffer (ignoring the current state of next_input_byte and - bytes_in_buffer), reset the pointer & count to the start of the - buffer, and return TRUE indicating that the buffer has been reloaded. - It is not necessary to fill the buffer entirely, only to obtain at - least one more byte. bytes_in_buffer MUST be set to a positive value - if TRUE is returned. A FALSE return should only be used when I/O - suspension is desired (this mode is discussed in the next section). - -skip_input_data (j_decompress_ptr cinfo, long num_bytes) - Skip num_bytes worth of data. The buffer pointer and count should - be advanced over num_bytes input bytes, refilling the buffer as - needed. This is used to skip over a potentially large amount of - uninteresting data (such as an APPn marker). In some applications - it may be possible to optimize away the reading of the skipped data, - but it's not clear that being smart is worth much trouble; large - skips are uncommon. bytes_in_buffer may be zero on return. - A zero or negative skip count should be treated as a no-op. - -resync_to_restart (j_decompress_ptr cinfo, int desired) - This routine is called only when the decompressor has failed to find - a restart (RSTn) marker where one is expected. Its mission is to - find a suitable point for resuming decompression. For most - applications, we recommend that you just use the default resync - procedure, jpeg_resync_to_restart(). However, if you are able to back - up in the input data stream, or if you have a-priori knowledge about - the likely location of restart markers, you may be able to do better. - Read the read_restart_marker() and jpeg_resync_to_restart() routines - in jdmarker.c if you think you'd like to implement your own resync - procedure. - -term_source (j_decompress_ptr cinfo) - Terminate source --- called by jpeg_finish_decompress() after all - data has been read. Often a no-op. - -For both fill_input_buffer() and skip_input_data(), there is no such thing -as an EOF return. If the end of the file has been reached, the routine has -a choice of exiting via ERREXIT() or inserting fake data into the buffer. -In most cases, generating a warning message and inserting a fake EOI marker -is the best course of action --- this will allow the decompressor to output -however much of the image is there. In pathological cases, the decompressor -may swallow the EOI and again demand data ... just keep feeding it fake EOIs. -jdatasrc.c illustrates the recommended error recovery behavior. - -term_source() is NOT called by jpeg_abort() or jpeg_destroy(). If you want -the source manager to be cleaned up during an abort, you must do it yourself. - -You will also need code to create a jpeg_source_mgr struct, fill in its method -pointers, and insert a pointer to the struct into the "src" field of the JPEG -decompression object. This can be done in-line in your setup code if you -like, but it's probably cleaner to provide a separate routine similar to the -jpeg_stdio_src() routine of the supplied source manager. - -For more information, consult the stdio source and destination managers -in jdatasrc.c and jdatadst.c. - - -I/O suspension --------------- - -Some applications need to use the JPEG library as an incremental memory-to- -memory filter: when the compressed data buffer is filled or emptied, they want -control to return to the outer loop, rather than expecting that the buffer can -be emptied or reloaded within the data source/destination manager subroutine. -The library supports this need by providing an "I/O suspension" mode, which we -describe in this section. - -The I/O suspension mode is not a panacea: nothing is guaranteed about the -maximum amount of time spent in any one call to the library, so it will not -eliminate response-time problems in single-threaded applications. If you -need guaranteed response time, we suggest you "bite the bullet" and implement -a real multi-tasking capability. - -To use I/O suspension, cooperation is needed between the calling application -and the data source or destination manager; you will always need a custom -source/destination manager. (Please read the previous section if you haven't -already.) The basic idea is that the empty_output_buffer() or -fill_input_buffer() routine is a no-op, merely returning FALSE to indicate -that it has done nothing. Upon seeing this, the JPEG library suspends -operation and returns to its caller. The surrounding application is -responsible for emptying or refilling the work buffer before calling the -JPEG library again. - -Compression suspension: - -For compression suspension, use an empty_output_buffer() routine that returns -FALSE; typically it will not do anything else. This will cause the -compressor to return to the caller of jpeg_write_scanlines(), with the return -value indicating that not all the supplied scanlines have been accepted. -The application must make more room in the output buffer, adjust the output -buffer pointer/count appropriately, and then call jpeg_write_scanlines() -again, pointing to the first unconsumed scanline. - -When forced to suspend, the compressor will backtrack to a convenient stopping -point (usually the start of the current MCU); it will regenerate some output -data when restarted. Therefore, although empty_output_buffer() is only -called when the buffer is filled, you should NOT write out the entire buffer -after a suspension. Write only the data up to the current position of -next_output_byte/free_in_buffer. The data beyond that point will be -regenerated after resumption. - -Because of the backtracking behavior, a good-size output buffer is essential -for efficiency; you don't want the compressor to suspend often. (In fact, an -overly small buffer could lead to infinite looping, if a single MCU required -more data than would fit in the buffer.) We recommend a buffer of at least -several Kbytes. You may want to insert explicit code to ensure that you don't -call jpeg_write_scanlines() unless there is a reasonable amount of space in -the output buffer; in other words, flush the buffer before trying to compress -more data. - -The compressor does not allow suspension while it is trying to write JPEG -markers at the beginning and end of the file. This means that: - * At the beginning of a compression operation, there must be enough free - space in the output buffer to hold the header markers (typically 600 or - so bytes). The recommended buffer size is bigger than this anyway, so - this is not a problem as long as you start with an empty buffer. However, - this restriction might catch you if you insert large special markers, such - as a JFIF thumbnail image, without flushing the buffer afterwards. - * When you call jpeg_finish_compress(), there must be enough space in the - output buffer to emit any buffered data and the final EOI marker. In the - current implementation, half a dozen bytes should suffice for this, but - for safety's sake we recommend ensuring that at least 100 bytes are free - before calling jpeg_finish_compress(). - -A more significant restriction is that jpeg_finish_compress() cannot suspend. -This means you cannot use suspension with multi-pass operating modes, namely -Huffman code optimization and multiple-scan output. Those modes write the -whole file during jpeg_finish_compress(), which will certainly result in -buffer overrun. (Note that this restriction applies only to compression, -not decompression. The decompressor supports input suspension in all of its -operating modes.) - -Decompression suspension: - -For decompression suspension, use a fill_input_buffer() routine that simply -returns FALSE (except perhaps during error recovery, as discussed below). -This will cause the decompressor to return to its caller with an indication -that suspension has occurred. This can happen at four places: - * jpeg_read_header(): will return JPEG_SUSPENDED. - * jpeg_start_decompress(): will return FALSE, rather than its usual TRUE. - * jpeg_read_scanlines(): will return the number of scanlines already - completed (possibly 0). - * jpeg_finish_decompress(): will return FALSE, rather than its usual TRUE. -The surrounding application must recognize these cases, load more data into -the input buffer, and repeat the call. In the case of jpeg_read_scanlines(), -increment the passed pointers past any scanlines successfully read. - -Just as with compression, the decompressor will typically backtrack to a -convenient restart point before suspending. When fill_input_buffer() is -called, next_input_byte/bytes_in_buffer point to the current restart point, -which is where the decompressor will backtrack to if FALSE is returned. -The data beyond that position must NOT be discarded if you suspend; it needs -to be re-read upon resumption. In most implementations, you'll need to shift -this data down to the start of your work buffer and then load more data after -it. Again, this behavior means that a several-Kbyte work buffer is essential -for decent performance; furthermore, you should load a reasonable amount of -new data before resuming decompression. (If you loaded, say, only one new -byte each time around, you could waste a LOT of cycles.) - -The skip_input_data() source manager routine requires special care in a -suspension scenario. This routine is NOT granted the ability to suspend the -decompressor; it can decrement bytes_in_buffer to zero, but no more. If the -requested skip distance exceeds the amount of data currently in the input -buffer, then skip_input_data() must set bytes_in_buffer to zero and record the -additional skip distance somewhere else. The decompressor will immediately -call fill_input_buffer(), which should return FALSE, which will cause a -suspension return. The surrounding application must then arrange to discard -the recorded number of bytes before it resumes loading the input buffer. -(Yes, this design is rather baroque, but it avoids complexity in the far more -common case where a non-suspending source manager is used.) - -If the input data has been exhausted, we recommend that you emit a warning -and insert dummy EOI markers just as a non-suspending data source manager -would do. This can be handled either in the surrounding application logic or -within fill_input_buffer(); the latter is probably more efficient. If -fill_input_buffer() knows that no more data is available, it can set the -pointer/count to point to a dummy EOI marker and then return TRUE just as -though it had read more data in a non-suspending situation. - -The decompressor does not attempt to suspend within standard JPEG markers; -instead it will backtrack to the start of the marker and reprocess the whole -marker next time. Hence the input buffer must be large enough to hold the -longest standard marker in the file. Standard JPEG markers should normally -not exceed a few hundred bytes each (DHT tables are typically the longest). -We recommend at least a 2K buffer for performance reasons, which is much -larger than any correct marker is likely to be. For robustness against -damaged marker length counts, you may wish to insert a test in your -application for the case that the input buffer is completely full and yet -the decoder has suspended without consuming any data --- otherwise, if this -situation did occur, it would lead to an endless loop. (The library can't -provide this test since it has no idea whether "the buffer is full", or -even whether there is a fixed-size input buffer.) - -The input buffer would need to be 64K to allow for arbitrary COM or APPn -markers, but these are handled specially: they are either saved into allocated -memory, or skipped over by calling skip_input_data(). In the former case, -suspension is handled correctly, and in the latter case, the problem of -buffer overrun is placed on skip_input_data's shoulders, as explained above. -Note that if you provide your own marker handling routine for large markers, -you should consider how to deal with buffer overflow. - -Multiple-buffer management: - -In some applications it is desirable to store the compressed data in a linked -list of buffer areas, so as to avoid data copying. This can be handled by -having empty_output_buffer() or fill_input_buffer() set the pointer and count -to reference the next available buffer; FALSE is returned only if no more -buffers are available. Although seemingly straightforward, there is a -pitfall in this approach: the backtrack that occurs when FALSE is returned -could back up into an earlier buffer. For example, when fill_input_buffer() -is called, the current pointer & count indicate the backtrack restart point. -Since fill_input_buffer() will set the pointer and count to refer to a new -buffer, the restart position must be saved somewhere else. Suppose a second -call to fill_input_buffer() occurs in the same library call, and no -additional input data is available, so fill_input_buffer must return FALSE. -If the JPEG library has not moved the pointer/count forward in the current -buffer, then *the correct restart point is the saved position in the prior -buffer*. Prior buffers may be discarded only after the library establishes -a restart point within a later buffer. Similar remarks apply for output into -a chain of buffers. - -The library will never attempt to backtrack over a skip_input_data() call, -so any skipped data can be permanently discarded. You still have to deal -with the case of skipping not-yet-received data, however. - -It's much simpler to use only a single buffer; when fill_input_buffer() is -called, move any unconsumed data (beyond the current pointer/count) down to -the beginning of this buffer and then load new data into the remaining buffer -space. This approach requires a little more data copying but is far easier -to get right. - - -Progressive JPEG support ------------------------- - -Progressive JPEG rearranges the stored data into a series of scans of -increasing quality. In situations where a JPEG file is transmitted across a -slow communications link, a decoder can generate a low-quality image very -quickly from the first scan, then gradually improve the displayed quality as -more scans are received. The final image after all scans are complete is -identical to that of a regular (sequential) JPEG file of the same quality -setting. Progressive JPEG files are often slightly smaller than equivalent -sequential JPEG files, but the possibility of incremental display is the main -reason for using progressive JPEG. - -The IJG encoder library generates progressive JPEG files when given a -suitable "scan script" defining how to divide the data into scans. -Creation of progressive JPEG files is otherwise transparent to the encoder. -Progressive JPEG files can also be read transparently by the decoder library. -If the decoding application simply uses the library as defined above, it -will receive a final decoded image without any indication that the file was -progressive. Of course, this approach does not allow incremental display. -To perform incremental display, an application needs to use the decoder -library's "buffered-image" mode, in which it receives a decoded image -multiple times. - -Each displayed scan requires about as much work to decode as a full JPEG -image of the same size, so the decoder must be fairly fast in relation to the -data transmission rate in order to make incremental display useful. However, -it is possible to skip displaying the image and simply add the incoming bits -to the decoder's coefficient buffer. This is fast because only Huffman -decoding need be done, not IDCT, upsampling, colorspace conversion, etc. -The IJG decoder library allows the application to switch dynamically between -displaying the image and simply absorbing the incoming bits. A properly -coded application can automatically adapt the number of display passes to -suit the time available as the image is received. Also, a final -higher-quality display cycle can be performed from the buffered data after -the end of the file is reached. - -Progressive compression: - -To create a progressive JPEG file (or a multiple-scan sequential JPEG file), -set the scan_info cinfo field to point to an array of scan descriptors, and -perform compression as usual. Instead of constructing your own scan list, -you can call the jpeg_simple_progression() helper routine to create a -recommended progression sequence; this method should be used by all -applications that don't want to get involved in the nitty-gritty of -progressive scan sequence design. (If you want to provide user control of -scan sequences, you may wish to borrow the scan script reading code found -in rdswitch.c, so that you can read scan script files just like cjpeg's.) -When scan_info is not NULL, the compression library will store DCT'd data -into a buffer array as jpeg_write_scanlines() is called, and will emit all -the requested scans during jpeg_finish_compress(). This implies that -multiple-scan output cannot be created with a suspending data destination -manager, since jpeg_finish_compress() does not support suspension. We -should also note that the compressor currently forces Huffman optimization -mode when creating a progressive JPEG file, because the default Huffman -tables are unsuitable for progressive files. - -Progressive decompression: - -When buffered-image mode is not used, the decoder library will read all of -a multi-scan file during jpeg_start_decompress(), so that it can provide a -final decoded image. (Here "multi-scan" means either progressive or -multi-scan sequential.) This makes multi-scan files transparent to the -decoding application. However, existing applications that used suspending -input with version 5 of the IJG library will need to be modified to check -for a suspension return from jpeg_start_decompress(). - -To perform incremental display, an application must use the library's -buffered-image mode. This is described in the next section. - - -Buffered-image mode -------------------- - -In buffered-image mode, the library stores the partially decoded image in a -coefficient buffer, from which it can be read out as many times as desired. -This mode is typically used for incremental display of progressive JPEG files, -but it can be used with any JPEG file. Each scan of a progressive JPEG file -adds more data (more detail) to the buffered image. The application can -display in lockstep with the source file (one display pass per input scan), -or it can allow input processing to outrun display processing. By making -input and display processing run independently, it is possible for the -application to adapt progressive display to a wide range of data transmission -rates. - -The basic control flow for buffered-image decoding is - - jpeg_create_decompress() - set data source - jpeg_read_header() - set overall decompression parameters - cinfo.buffered_image = TRUE; /* select buffered-image mode */ - jpeg_start_decompress() - for (each output pass) { - adjust output decompression parameters if required - jpeg_start_output() /* start a new output pass */ - for (all scanlines in image) { - jpeg_read_scanlines() - display scanlines - } - jpeg_finish_output() /* terminate output pass */ - } - jpeg_finish_decompress() - jpeg_destroy_decompress() - -This differs from ordinary unbuffered decoding in that there is an additional -level of looping. The application can choose how many output passes to make -and how to display each pass. - -The simplest approach to displaying progressive images is to do one display -pass for each scan appearing in the input file. In this case the outer loop -condition is typically - while (! jpeg_input_complete(&cinfo)) -and the start-output call should read - jpeg_start_output(&cinfo, cinfo.input_scan_number); -The second parameter to jpeg_start_output() indicates which scan of the input -file is to be displayed; the scans are numbered starting at 1 for this -purpose. (You can use a loop counter starting at 1 if you like, but using -the library's input scan counter is easier.) The library automatically reads -data as necessary to complete each requested scan, and jpeg_finish_output() -advances to the next scan or end-of-image marker (hence input_scan_number -will be incremented by the time control arrives back at jpeg_start_output()). -With this technique, data is read from the input file only as needed, and -input and output processing run in lockstep. - -After reading the final scan and reaching the end of the input file, the -buffered image remains available; it can be read additional times by -repeating the jpeg_start_output()/jpeg_read_scanlines()/jpeg_finish_output() -sequence. For example, a useful technique is to use fast one-pass color -quantization for display passes made while the image is arriving, followed by -a final display pass using two-pass quantization for highest quality. This -is done by changing the library parameters before the final output pass. -Changing parameters between passes is discussed in detail below. - -In general the last scan of a progressive file cannot be recognized as such -until after it is read, so a post-input display pass is the best approach if -you want special processing in the final pass. - -When done with the image, be sure to call jpeg_finish_decompress() to release -the buffered image (or just use jpeg_destroy_decompress()). - -If input data arrives faster than it can be displayed, the application can -cause the library to decode input data in advance of what's needed to produce -output. This is done by calling the routine jpeg_consume_input(). -The return value is one of the following: - JPEG_REACHED_SOS: reached an SOS marker (the start of a new scan) - JPEG_REACHED_EOI: reached the EOI marker (end of image) - JPEG_ROW_COMPLETED: completed reading one MCU row of compressed data - JPEG_SCAN_COMPLETED: completed reading last MCU row of current scan - JPEG_SUSPENDED: suspended before completing any of the above -(JPEG_SUSPENDED can occur only if a suspending data source is used.) This -routine can be called at any time after initializing the JPEG object. It -reads some additional data and returns when one of the indicated significant -events occurs. (If called after the EOI marker is reached, it will -immediately return JPEG_REACHED_EOI without attempting to read more data.) - -The library's output processing will automatically call jpeg_consume_input() -whenever the output processing overtakes the input; thus, simple lockstep -display requires no direct calls to jpeg_consume_input(). But by adding -calls to jpeg_consume_input(), you can absorb data in advance of what is -being displayed. This has two benefits: - * You can limit buildup of unprocessed data in your input buffer. - * You can eliminate extra display passes by paying attention to the - state of the library's input processing. - -The first of these benefits only requires interspersing calls to -jpeg_consume_input() with your display operations and any other processing -you may be doing. To avoid wasting cycles due to backtracking, it's best to -call jpeg_consume_input() only after a hundred or so new bytes have arrived. -This is discussed further under "I/O suspension", above. (Note: the JPEG -library currently is not thread-safe. You must not call jpeg_consume_input() -from one thread of control if a different library routine is working on the -same JPEG object in another thread.) - -When input arrives fast enough that more than one new scan is available -before you start a new output pass, you may as well skip the output pass -corresponding to the completed scan. This occurs for free if you pass -cinfo.input_scan_number as the target scan number to jpeg_start_output(). -The input_scan_number field is simply the index of the scan currently being -consumed by the input processor. You can ensure that this is up-to-date by -emptying the input buffer just before calling jpeg_start_output(): call -jpeg_consume_input() repeatedly until it returns JPEG_SUSPENDED or -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 -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 -number greater than the current input scan number, the output processor will -wait until that scan starts to arrive before producing any output. (To avoid -an infinite loop, the target scan number is automatically reset to the last -scan number when the end of image is reached. Thus, if you specify a large -target scan number, the library will just absorb the entire input file and -then perform an output pass. This is effectively the same as what -jpeg_start_decompress() does when you don't select buffered-image mode.) -When you pass a target scan number equal to the current input scan number, -the image is displayed no faster than the current input scan arrives. The -final possibility is to pass a target scan number less than the current input -scan number; this disables the input/output interlock and causes the output -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 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); - adjust output decompression parameters if required - jpeg_start_output(&cinfo, cinfo.input_scan_number); - ... - jpeg_finish_output() - } while (! final_pass); -rather than quitting as soon as jpeg_input_complete() returns TRUE. This -arrangement makes it simple to use higher-quality decoding parameters -for the final pass. But if you don't want to use special parameters for -the final pass, the right loop logic is like this: - for (;;) { - absorb any waiting input by calling jpeg_consume_input() - jpeg_start_output(&cinfo, cinfo.input_scan_number); - ... - jpeg_finish_output() - if (jpeg_input_complete(&cinfo) && - 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 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 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 -new one using the newly arrived information. To do so, just call -jpeg_finish_output() and then start a new pass with jpeg_start_output(). - -A variant strategy is to abort and restart display if more than one complete -scan arrives during an output pass; this can be detected by noting -JPEG_REACHED_SOS returns and/or examining cinfo.input_scan_number. This -idea should be employed with caution, however, since the display process -might never get to the bottom of the image before being aborted, resulting -in the lower part of the screen being several passes worse than the upper. -In most cases it's probably best to abort an output pass only if the whole -file has arrived and you want to begin the final output pass immediately. - -When receiving data across a communication link, we recommend always using -the current input scan number for the output target scan number; if a -higher-quality final pass is to be done, it should be started (aborting any -incomplete output pass) as soon as the end of file is received. However, -many other strategies are possible. For example, the application can examine -the parameters of the current input scan and decide whether to display it or -not. If the scan contains only chroma data, one might choose not to use it -as the target scan, expecting that the scan will be small and will arrive -quickly. To skip to the next scan, call jpeg_consume_input() until it -returns JPEG_REACHED_SOS or JPEG_REACHED_EOI. Or just use the next higher -number as the target scan for jpeg_start_output(); but that method doesn't -let you inspect the next scan's parameters before deciding to display it. - - -In buffered-image mode, jpeg_start_decompress() never performs input and -thus never suspends. An application that uses input suspension with -buffered-image mode must be prepared for suspension returns from these -routines: -* jpeg_start_output() performs input only if you request 2-pass quantization - and the target scan isn't fully read yet. (This is discussed below.) -* 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 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 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() -all return TRUE if they completed their tasks, FALSE if they had to suspend. -In the event of a FALSE return, the application must load more input data -and repeat the call. Applications that use non-suspending data sources need -not check the return values of these three routines. - - -It is possible to change decoding parameters between output passes in the -buffered-image mode. The decoder library currently supports only very -limited changes of parameters. ONLY THE FOLLOWING parameter changes are -allowed after jpeg_start_decompress() is called: -* dct_method can be changed before each call to jpeg_start_output(). - For example, one could use a fast DCT method for early scans, changing - to a higher quality method for the final scan. -* dither_mode can be changed before each call to jpeg_start_output(); - of course this has no impact if not using color quantization. Typically - one would use ordered dither for initial passes, then switch to - Floyd-Steinberg dither for the final pass. Caution: changing dither mode - can cause more memory to be allocated by the library. Although the amount - of memory involved is not large (a scanline or so), it may cause the - initial max_memory_to_use specification to be exceeded, which in the worst - case would result in an out-of-memory failure. -* do_block_smoothing can be changed before each call to jpeg_start_output(). - This setting is relevant only when decoding a progressive JPEG image. - During the first DC-only scan, block smoothing provides a very "fuzzy" look - instead of the very "blocky" look seen without it; which is better seems a - matter of personal taste. But block smoothing is nearly always a win - during later stages, especially when decoding a successive-approximation - image: smoothing helps to hide the slight blockiness that otherwise shows - up on smooth gradients until the lowest coefficient bits are sent. -* Color quantization mode can be changed under the rules described below. - You *cannot* change between full-color and quantized output (because that - would alter the required I/O buffer sizes), but you can change which - quantization method is used. - -When generating color-quantized output, changing quantization method is a -very useful way of switching between high-speed and high-quality display. -The library allows you to change among its three quantization methods: -1. Single-pass quantization to a fixed color cube. - Selected by cinfo.two_pass_quantize = FALSE and cinfo.colormap = NULL. -2. Single-pass quantization to an application-supplied colormap. - Selected by setting cinfo.colormap to point to the colormap (the value of - two_pass_quantize is ignored); also set cinfo.actual_number_of_colors. -3. Two-pass quantization to a colormap chosen specifically for the image. - Selected by cinfo.two_pass_quantize = TRUE and cinfo.colormap = NULL. - (This is the default setting selected by jpeg_read_header, but it is - probably NOT what you want for the first pass of progressive display!) -These methods offer successively better quality and lesser speed. However, -only the first method is available for quantizing in non-RGB color spaces. - -IMPORTANT: because the different quantizer methods have very different -working-storage requirements, the library requires you to indicate which -one(s) you intend to use before you call jpeg_start_decompress(). (If we did -not require this, the max_memory_to_use setting would be a complete fiction.) -You do this by setting one or more of these three cinfo fields to TRUE: - enable_1pass_quant Fixed color cube colormap - enable_external_quant Externally-supplied colormap - enable_2pass_quant Two-pass custom colormap -All three are initialized FALSE by jpeg_read_header(). But -jpeg_start_decompress() automatically sets TRUE the one selected by the -current two_pass_quantize and colormap settings, so you only need to set the -enable flags for any other quantization methods you plan to change to later. - -After setting the enable flags correctly at jpeg_start_decompress() time, you -can change to any enabled quantization method by setting two_pass_quantize -and colormap properly just before calling jpeg_start_output(). The following -special rules apply: -1. You must explicitly set cinfo.colormap to NULL when switching to 1-pass - or 2-pass mode from a different mode, or when you want the 2-pass - quantizer to be re-run to generate a new colormap. -2. To switch to an external colormap, or to change to a different external - colormap than was used on the prior pass, you must call - jpeg_new_colormap() after setting cinfo.colormap. -NOTE: if you want to use the same colormap as was used in the prior pass, -you should not do either of these things. This will save some nontrivial -switchover costs. -(These requirements exist because cinfo.colormap will always be non-NULL -after completing a prior output pass, since both the 1-pass and 2-pass -quantizers set it to point to their output colormaps. Thus you have to -do one of these two things to notify the library that something has changed. -Yup, it's a bit klugy, but it's necessary to do it this way for backwards -compatibility.) - -Note that in buffered-image mode, the library generates any requested colormap -during jpeg_start_output(), not during jpeg_start_decompress(). - -When using two-pass quantization, jpeg_start_output() makes a pass over the -buffered image to determine the optimum color map; it therefore may take a -significant amount of time, whereas ordinarily it does little work. The -progress monitor hook is called during this pass, if defined. It is also -important to realize that if the specified target scan number is greater than -or equal to the current input scan number, jpeg_start_output() will attempt -to consume input as it makes this pass. If you use a suspending data source, -you need to check for a FALSE return from jpeg_start_output() under these -conditions. The combination of 2-pass quantization and a not-yet-fully-read -target scan is the only case in which jpeg_start_output() will consume input. - - -Application authors who support buffered-image mode may be tempted to use it -for all JPEG images, even single-scan ones. This will work, but it is -inefficient: there is no need to create an image-sized coefficient buffer for -single-scan images. Requesting buffered-image mode for such an image wastes -memory. Worse, it can cost time on large images, since the buffered data has -to be swapped out or written to a temporary file. If you are concerned about -maximum performance on baseline JPEG files, you should use buffered-image -mode only when the incoming file actually has multiple scans. This can be -tested by calling jpeg_has_multiple_scans(), which will return a correct -result at any time after jpeg_read_header() completes. - -It is also worth noting that when you use jpeg_consume_input() to let input -processing get ahead of output processing, the resulting pattern of access to -the coefficient buffer is quite nonsequential. It's best to use the memory -manager jmemnobs.c if you can (ie, if you have enough real or virtual main -memory). If not, at least make sure that max_memory_to_use is set as high as -possible. If the JPEG memory manager has to use a temporary file, you will -probably see a lot of disk traffic and poor performance. (This could be -improved with additional work on the memory manager, but we haven't gotten -around to it yet.) - -In some applications it may be convenient to use jpeg_consume_input() for all -input processing, including reading the initial markers; that is, you may -wish to call jpeg_consume_input() instead of jpeg_read_header() during -startup. This works, but note that you must check for JPEG_REACHED_SOS and -JPEG_REACHED_EOI return codes as the equivalent of jpeg_read_header's codes. -Once the first SOS marker has been reached, you must call -jpeg_start_decompress() before jpeg_consume_input() will consume more input; -it'll just keep returning JPEG_REACHED_SOS until you do. If you read a -tables-only file this way, jpeg_consume_input() will return JPEG_REACHED_EOI -without ever returning JPEG_REACHED_SOS; be sure to check for this case. -If this happens, the decompressor will not read any more input until you call -jpeg_abort() to reset it. It is OK to call jpeg_consume_input() even when not -using buffered-image mode, but in that case it's basically a no-op after the -initial markers have been read: it will just return JPEG_SUSPENDED. - - -Abbreviated datastreams and multiple images -------------------------------------------- - -A JPEG compression or decompression object can be reused to process multiple -images. This saves a small amount of time per image by eliminating the -"create" and "destroy" operations, but that isn't the real purpose of the -feature. Rather, reuse of an object provides support for abbreviated JPEG -datastreams. Object reuse can also simplify processing a series of images in -a single input or output file. This section explains these features. - -A JPEG file normally contains several hundred bytes worth of quantization -and Huffman tables. In a situation where many images will be stored or -transmitted with identical tables, this may represent an annoying overhead. -The JPEG standard therefore permits tables to be omitted. The standard -defines three classes of JPEG datastreams: - * "Interchange" datastreams contain an image and all tables needed to decode - the image. These are the usual kind of JPEG file. - * "Abbreviated image" datastreams contain an image, but are missing some or - all of the tables needed to decode that image. - * "Abbreviated table specification" (henceforth "tables-only") datastreams - contain only table specifications. -To decode an abbreviated image, it is necessary to load the missing table(s) -into the decoder beforehand. This can be accomplished by reading a separate -tables-only file. A variant scheme uses a series of images in which the first -image is an interchange (complete) datastream, while subsequent ones are -abbreviated and rely on the tables loaded by the first image. It is assumed -that once the decoder has read a table, it will remember that table until a -new definition for the same table number is encountered. - -It is the application designer's responsibility to figure out how to associate -the correct tables with an abbreviated image. While abbreviated datastreams -can be useful in a closed environment, their use is strongly discouraged in -any situation where data exchange with other applications might be needed. -Caveat designer. - -The JPEG library provides support for reading and writing any combination of -tables-only datastreams and abbreviated images. In both compression and -decompression objects, a quantization or Huffman table will be retained for -the lifetime of the object, unless it is overwritten by a new table definition. - - -To create abbreviated image datastreams, it is only necessary to tell the -compressor not to emit some or all of the tables it is using. Each -quantization and Huffman table struct contains a boolean field "sent_table", -which normally is initialized to FALSE. For each table used by the image, the -header-writing process emits the table and sets sent_table = TRUE unless it is -already TRUE. (In normal usage, this prevents outputting the same table -definition multiple times, as would otherwise occur because the chroma -components typically share tables.) Thus, setting this field to TRUE before -calling jpeg_start_compress() will prevent the table from being written at -all. - -If you want to create a "pure" abbreviated image file containing no tables, -just call "jpeg_suppress_tables(&cinfo, TRUE)" after constructing all the -tables. If you want to emit some but not all tables, you'll need to set the -individual sent_table fields directly. - -To create an abbreviated image, you must also call jpeg_start_compress() -with a second parameter of FALSE, not TRUE. Otherwise jpeg_start_compress() -will force all the sent_table fields to FALSE. (This is a safety feature to -prevent abbreviated images from being created accidentally.) - -To create a tables-only file, perform the same parameter setup that you -normally would, but instead of calling jpeg_start_compress() and so on, call -jpeg_write_tables(&cinfo). This will write an abbreviated datastream -containing only SOI, DQT and/or DHT markers, and EOI. All the quantization -and Huffman tables that are currently defined in the compression object will -be emitted unless their sent_tables flag is already TRUE, and then all the -sent_tables flags will be set TRUE. - -A sure-fire way to create matching tables-only and abbreviated image files -is to proceed as follows: - - create JPEG compression object - set JPEG parameters - set destination to tables-only file - jpeg_write_tables(&cinfo); - set destination to image file - jpeg_start_compress(&cinfo, FALSE); - write data... - jpeg_finish_compress(&cinfo); - -Since the JPEG parameters are not altered between writing the table file and -the abbreviated image file, the same tables are sure to be used. Of course, -you can repeat the jpeg_start_compress() ... jpeg_finish_compress() sequence -many times to produce many abbreviated image files matching the table file. - -You cannot suppress output of the computed Huffman tables when Huffman -optimization is selected. (If you could, there'd be no way to decode the -image...) Generally, you don't want to set optimize_coding = TRUE when -you are trying to produce abbreviated files. - -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. 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 -into the decompression object before trying to read the abbreviated image. -If the proper tables are stored in the application program, you can just -allocate the table structs and fill in their contents directly. For example, -to load a fixed quantization table into table slot "n": - - if (cinfo.quant_tbl_ptrs[n] == NULL) - cinfo.quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) &cinfo); - quant_ptr = cinfo.quant_tbl_ptrs[n]; /* quant_ptr is JQUANT_TBL* */ - for (i = 0; i < 64; i++) { - /* Qtable[] is desired quantization table, in natural array order */ - quant_ptr->quantval[i] = Qtable[i]; - } - -Code to load a fixed Huffman table is typically (for AC table "n"): - - if (cinfo.ac_huff_tbl_ptrs[n] == NULL) - cinfo.ac_huff_tbl_ptrs[n] = jpeg_alloc_huff_table((j_common_ptr) &cinfo); - huff_ptr = cinfo.ac_huff_tbl_ptrs[n]; /* huff_ptr is JHUFF_TBL* */ - for (i = 1; i <= 16; i++) { - /* counts[i] is number of Huffman codes of length i bits, i=1..16 */ - huff_ptr->bits[i] = counts[i]; - } - for (i = 0; i < 256; i++) { - /* symbols[] is the list of Huffman symbols, in code-length order */ - huff_ptr->huffval[i] = symbols[i]; - } - -(Note that trying to set cinfo.quant_tbl_ptrs[n] to point directly at a -constant JQUANT_TBL object is not safe. If the incoming file happened to -contain a quantization table definition, your master table would get -overwritten! Instead allocate a working table copy and copy the master table -into it, as illustrated above. Ditto for Huffman tables, of course.) - -You might want to read the tables from a tables-only file, rather than -hard-wiring them into your application. The jpeg_read_header() call is -sufficient to read a tables-only file. You must pass a second parameter of -FALSE to indicate that you do not require an image to be present. Thus, the -typical scenario is - - create JPEG decompression object - set source to tables-only file - jpeg_read_header(&cinfo, FALSE); - set source to abbreviated image file - jpeg_read_header(&cinfo, TRUE); - set decompression parameters - jpeg_start_decompress(&cinfo); - read data... - jpeg_finish_decompress(&cinfo); - -In some cases, you may want to read a file without knowing whether it contains -an image or just tables. In that case, pass FALSE and check the return value -from jpeg_read_header(): it will be JPEG_HEADER_OK if an image was found, -JPEG_HEADER_TABLES_ONLY if only tables were found. (A third return value, -JPEG_SUSPENDED, is possible when using a suspending data source manager.) -Note that jpeg_read_header() will not complain if you read an abbreviated -image for which you haven't loaded the missing tables; the missing-table check -occurs later, in jpeg_start_decompress(). - - -It is possible to read a series of images from a single source file by -repeating the jpeg_read_header() ... jpeg_finish_decompress() sequence, -without releasing/recreating the JPEG object or the data source module. -(If you did reinitialize, any partial bufferload left in the data source -buffer at the end of one image would be discarded, causing you to lose the -start of the next image.) When you use this method, stored tables are -automatically carried forward, so some of the images can be abbreviated images -that depend on tables from earlier images. - -If you intend to write a series of images into a single destination file, -you might want to make a specialized data destination module that doesn't -flush the output buffer at term_destination() time. This would speed things -up by some trifling amount. Of course, you'd need to remember to flush the -buffer after the last image. You can make the later images be abbreviated -ones by passing FALSE to jpeg_start_compress(). - - -Special markers ---------------- - -Some applications may need to insert or extract special data in the JPEG -datastream. The JPEG standard provides marker types "COM" (comment) and -"APP0" through "APP15" (application) to hold application-specific data. -Unfortunately, the use of these markers is not specified by the standard. -COM markers are fairly widely used to hold user-supplied text. The JFIF file -format spec uses APP0 markers with specified initial strings to hold certain -data. Adobe applications use APP14 markers beginning with the string "Adobe" -for miscellaneous data. Other APPn markers are rarely seen, but might -contain almost anything. - -If you wish to store user-supplied text, we recommend you use COM markers -and place readable 7-bit ASCII text in them. Newline conventions are not -standardized --- expect to find LF (Unix style), CR/LF (DOS style), or CR -(Mac style). A robust COM reader should be able to cope with random binary -garbage, including nulls, since some applications generate COM markers -containing non-ASCII junk. (But yours should not be one of them.) - -For program-supplied data, use an APPn marker, and be sure to begin it with an -identifying string so that you can tell whether the marker is actually yours. -It's probably best to avoid using APP0 or APP14 for any private markers. -(NOTE: the upcoming SPIFF standard will use APP8 markers; we recommend you -not use APP8 markers for any private purposes, either.) - -Keep in mind that at most 65533 bytes can be put into one marker, but you -can have as many markers as you like. - -By default, the IJG compression library will write a JFIF APP0 marker if the -selected JPEG colorspace is grayscale or YCbCr, or an Adobe APP14 marker if -the selected colorspace is RGB, CMYK, or YCCK. You can disable this, but -we don't recommend it. The decompression library will recognize JFIF and -Adobe markers and will set the JPEG colorspace properly when one is found. - - -You can write special markers immediately following the datastream header by -calling jpeg_write_marker() after jpeg_start_compress() and before the first -call to jpeg_write_scanlines(). When you do this, the markers appear after -the SOI and the JFIF APP0 and Adobe APP14 markers (if written), but before -all else. Specify the marker type parameter as "JPEG_COM" for COM or -"JPEG_APP0 + n" for APPn. (Actually, jpeg_write_marker will let you write -any marker type, but we don't recommend writing any other kinds of marker.) -For example, to write a user comment string pointed to by comment_text: - jpeg_write_marker(cinfo, JPEG_COM, comment_text, strlen(comment_text)); - -If it's not convenient to store all the marker data in memory at once, -you can instead call jpeg_write_m_header() followed by multiple calls to -jpeg_write_m_byte(). If you do it this way, it's your responsibility to -call jpeg_write_m_byte() exactly the number of times given in the length -parameter to jpeg_write_m_header(). (This method lets you empty the -output buffer partway through a marker, which might be important when -using a suspending data destination module. In any case, if you are using -a suspending destination, you should flush its buffer after inserting -any special markers. See "I/O suspension".) - -Or, if you prefer to synthesize the marker byte sequence yourself, -you can just cram it straight into the data destination module. - -If you are writing JFIF 1.02 extension markers (thumbnail images), don't -forget to set cinfo.JFIF_minor_version = 2 so that the encoder will write the -correct JFIF version number in the JFIF header marker. The library's default -is to write version 1.01, but that's wrong if you insert any 1.02 extension -markers. (We could probably get away with just defaulting to 1.02, but there -used to be broken decoders that would complain about unknown minor version -numbers. To reduce compatibility risks it's safest not to write 1.02 unless -you are actually using 1.02 extensions.) - - -When reading, two methods of handling special markers are available: -1. You can ask the library to save the contents of COM and/or APPn markers -into memory, and then examine them at your leisure afterwards. -2. You can supply your own routine to process COM and/or APPn markers -on-the-fly as they are read. -The first method is simpler to use, especially if you are using a suspending -data source; writing a marker processor that copes with input suspension is -not easy (consider what happens if the marker is longer than your available -input buffer). However, the second method conserves memory since the marker -data need not be kept around after it's been processed. - -For either method, you'd normally set up marker handling after creating a -decompression object and before calling jpeg_read_header(), because the -markers of interest will typically be near the head of the file and so will -be scanned by jpeg_read_header. Once you've established a marker handling -method, it will be used for the life of that decompression object -(potentially many datastreams), unless you change it. Marker handling is -determined separately for COM markers and for each APPn marker code. - - -To save the contents of special markers in memory, call - jpeg_save_markers(cinfo, marker_code, length_limit) -where marker_code is the marker type to save, JPEG_COM or JPEG_APP0+n. -(To arrange to save all the special marker types, you need to call this -routine 17 times, for COM and APP0-APP15.) If the incoming marker is longer -than length_limit data bytes, only length_limit bytes will be saved; this -parameter allows you to avoid chewing up memory when you only need to see the -first few bytes of a potentially large marker. If you want to save all the -data, set length_limit to 0xFFFF; that is enough since marker lengths are only -16 bits. As a special case, setting length_limit to 0 prevents that marker -type from being saved at all. (That is the default behavior, in fact.) - -After jpeg_read_header() completes, you can examine the special markers by -following the cinfo->marker_list pointer chain. All the special markers in -the file appear in this list, in order of their occurrence in the file (but -omitting any markers of types you didn't ask for). Both the original data -length and the saved data length are recorded for each list entry; the latter -will not exceed length_limit for the particular marker type. Note that these -lengths exclude the marker length word, whereas the stored representation -within the JPEG file includes it. (Hence the maximum data length is really -only 65533.) - -It is possible that additional special markers appear in the file beyond the -SOS marker at which jpeg_read_header stops; if so, the marker list will be -extended during reading of the rest of the file. This is not expected to be -common, however. If you are short on memory you may want to reset the length -limit to zero for all marker types after finishing jpeg_read_header, to -ensure that the max_memory_to_use setting cannot be exceeded due to addition -of later markers. - -The marker list remains stored until you call jpeg_finish_decompress or -jpeg_abort, at which point the memory is freed and the list is set to empty. -(jpeg_destroy also releases the storage, of course.) - -Note that the library is internally interested in APP0 and APP14 markers; -if you try to set a small nonzero length limit on these types, the library -will silently force the length up to the minimum it wants. (But you can set -a zero length limit to prevent them from being saved at all.) Also, in a -16-bit environment, the maximum length limit may be constrained to less than -65533 by malloc() limitations. It is therefore best not to assume that the -effective length limit is exactly what you set it to be. - - -If you want to supply your own marker-reading routine, you do it by calling -jpeg_set_marker_processor(). A marker processor routine must have the -signature - boolean jpeg_marker_parser_method (j_decompress_ptr cinfo) -Although the marker code is not explicitly passed, the routine can find it -in cinfo->unread_marker. At the time of call, the marker proper has been -read from the data source module. The processor routine is responsible for -reading the marker length word and the remaining parameter bytes, if any. -Return TRUE to indicate success. (FALSE should be returned only if you are -using a suspending data source and it tells you to suspend. See the standard -marker processors in jdmarker.c for appropriate coding methods if you need to -use a suspending data source.) - -If you override the default APP0 or APP14 processors, it is up to you to -recognize JFIF and Adobe markers if you want colorspace recognition to occur -properly. We recommend copying and extending the default processors if you -want to do that. (A better idea is to save these marker types for later -examination by calling jpeg_save_markers(); that method doesn't interfere -with the library's own processing of these markers.) - -jpeg_set_marker_processor() and jpeg_save_markers() are mutually exclusive ---- if you call one it overrides any previous call to the other, for the -particular marker type specified. - -A simple example of an external COM processor can be found in djpeg.c. -Also, see jpegtran.c for an example of using jpeg_save_markers. - - -Raw (downsampled) image data ----------------------------- - -Some applications need to supply already-downsampled image data to the JPEG -compressor, or to receive raw downsampled data from the decompressor. The -library supports this requirement by allowing the application to write or -read raw data, bypassing the normal preprocessing or postprocessing steps. -The interface is different from the standard one and is somewhat harder to -use. If your interest is merely in bypassing color conversion, we recommend -that you use the standard interface and simply set jpeg_color_space = -in_color_space (or jpeg_color_space = out_color_space for decompression). -The mechanism described in this section is necessary only to supply or -receive downsampled image data, in which not all components have the same -dimensions. - - -To compress raw data, you must supply the data in the colorspace to be used -in the JPEG file (please read the earlier section on Special color spaces) -and downsampled to the sampling factors specified in the JPEG parameters. -You must supply the data in the format used internally by the JPEG library, -namely a JSAMPIMAGE array. This is an array of pointers to two-dimensional -arrays, each of type JSAMPARRAY. Each 2-D array holds the values for one -color component. This structure is necessary since the components are of -different sizes. If the image dimensions are not a multiple of the MCU size, -you must also pad the data correctly (usually, this is done by replicating -the last column and/or row). The data must be padded to a multiple of a DCT -block in each component: that is, each downsampled row must contain a -multiple of 8 valid samples, and there must be a multiple of 8 sample rows -for each component. (For applications such as conversion of digital TV -images, the standard image size is usually a multiple of the DCT block size, -so that no padding need actually be done.) - -The procedure for compression of raw data is basically the same as normal -compression, except that you call jpeg_write_raw_data() in place of -jpeg_write_scanlines(). Before calling jpeg_start_compress(), you must do -the following: - * Set cinfo->raw_data_in to TRUE. (It is set FALSE by jpeg_set_defaults().) - This notifies the library that you will be supplying raw data. - * Ensure jpeg_color_space is correct --- an explicit jpeg_set_colorspace() - call is a good idea. Note that since color conversion is bypassed, - in_color_space is ignored, except that jpeg_set_defaults() uses it to - choose the default jpeg_color_space setting. - * Ensure the sampling factors, cinfo->comp_info[i].h_samp_factor and - cinfo->comp_info[i].v_samp_factor, are correct. Since these indicate the - dimensions of the data you are supplying, it's wise to set them - explicitly, rather than assuming the library's defaults are what you want. - -To pass raw data to the library, call jpeg_write_raw_data() in place of -jpeg_write_scanlines(). The two routines work similarly except that -jpeg_write_raw_data takes a JSAMPIMAGE data array rather than JSAMPARRAY. -The scanlines count passed to and returned from jpeg_write_raw_data is -measured in terms of the component with the largest v_samp_factor. - -jpeg_write_raw_data() processes one MCU row per call, which is to say -v_samp_factor*DCTSIZE sample rows of each component. The passed num_lines -value must be at least max_v_samp_factor*DCTSIZE, and the return value will -be exactly that amount (or possibly some multiple of that amount, in future -library versions). This is true even on the last call at the bottom of the -image; don't forget to pad your data as necessary. - -The required dimensions of the supplied data can be computed for each -component as - cinfo->comp_info[i].width_in_blocks*DCTSIZE samples per row - cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image -after jpeg_start_compress() has initialized those fields. If the valid data -is smaller than this, it must be padded appropriately. For some sampling -factors and image sizes, additional dummy DCT blocks are inserted to make -the image a multiple of the MCU dimensions. The library creates such dummy -blocks itself; it does not read them from your supplied data. Therefore you -need never pad by more than DCTSIZE samples. An example may help here. -Assume 2h2v downsampling of YCbCr data, that is - cinfo->comp_info[0].h_samp_factor = 2 for Y - cinfo->comp_info[0].v_samp_factor = 2 - cinfo->comp_info[1].h_samp_factor = 1 for Cb - cinfo->comp_info[1].v_samp_factor = 1 - cinfo->comp_info[2].h_samp_factor = 1 for Cr - cinfo->comp_info[2].v_samp_factor = 1 -and suppose that the nominal image dimensions (cinfo->image_width and -cinfo->image_height) are 101x101 pixels. Then jpeg_start_compress() will -compute downsampled_width = 101 and width_in_blocks = 13 for Y, -downsampled_width = 51 and width_in_blocks = 7 for Cb and Cr (and the same -for the height fields). You must pad the Y data to at least 13*8 = 104 -columns and rows, the Cb/Cr data to at least 7*8 = 56 columns and rows. The -MCU height is max_v_samp_factor = 2 DCT rows so you must pass at least 16 -scanlines on each call to jpeg_write_raw_data(), which is to say 16 actual -sample rows of Y and 8 each of Cb and Cr. A total of 7 MCU rows are needed, -so you must pass a total of 7*16 = 112 "scanlines". The last DCT block row -of Y data is dummy, so it doesn't matter what you pass for it in the data -arrays, but the scanlines count must total up to 112 so that all of the Cb -and Cr data gets passed. - -Output suspension is supported with raw-data compression: if the data -destination module suspends, jpeg_write_raw_data() will return 0. -In this case the same data rows must be passed again on the next call. - - -Decompression with raw data output implies bypassing all postprocessing: -you cannot ask for rescaling or color quantization, for instance. More -seriously, you must deal with the color space and sampling factors present in -the incoming file. If your application only handles, say, 2h1v YCbCr data, -you must check for and fail on other color spaces or other sampling factors. -The library will not convert to a different color space for you. - -To obtain raw data output, set cinfo->raw_data_out = TRUE before -jpeg_start_decompress() (it is set FALSE by jpeg_read_header()). Be sure to -verify that the color space and sampling factors are ones you can handle. -Then call jpeg_read_raw_data() in place of jpeg_read_scanlines(). The -decompression process is otherwise the same as usual. - -jpeg_read_raw_data() returns one MCU row per call, and thus you must pass a -buffer of at least max_v_samp_factor*DCTSIZE scanlines (scanline counting is -the same as for raw-data compression). The buffer you pass must be large -enough to hold the actual data plus padding to DCT-block boundaries. As with -compression, any entirely dummy DCT blocks are not processed so you need not -allocate space for them, but the total scanline count includes them. The -above example of computing buffer dimensions for raw-data compression is -equally valid for decompression. - -Input suspension is supported with raw-data decompression: if the data source -module suspends, jpeg_read_raw_data() will return 0. You can also use -buffered-image mode to read raw data in multiple passes. - - -Really raw data: DCT coefficients ---------------------------------- - -It is possible to read or write the contents of a JPEG file as raw DCT -coefficients. This facility is mainly intended for use in lossless -transcoding between different JPEG file formats. Other possible applications -include lossless cropping of a JPEG image, lossless reassembly of a -multi-strip or multi-tile TIFF/JPEG file into a single JPEG datastream, etc. - -To read the contents of a JPEG file as DCT coefficients, open the file and do -jpeg_read_header() as usual. But instead of calling jpeg_start_decompress() -and jpeg_read_scanlines(), call jpeg_read_coefficients(). This will read the -entire image into a set of virtual coefficient-block arrays, one array per -component. The return value is a pointer to an array of virtual-array -descriptors. Each virtual array can be accessed directly using the JPEG -memory manager's access_virt_barray method (see Memory management, below, -and also read structure.doc's discussion of virtual array handling). Or, -for simple transcoding to a different JPEG file format, the array list can -just be handed directly to jpeg_write_coefficients(). - -Each block in the block arrays contains quantized coefficient values in -normal array order (not JPEG zigzag order). The block arrays contain only -DCT blocks containing real data; any entirely-dummy blocks added to fill out -interleaved MCUs at the right or bottom edges of the image are discarded -during reading and are not stored in the block arrays. (The size of each -block array can be determined from the width_in_blocks and height_in_blocks -fields of the component's comp_info entry.) This is also the data format -expected by jpeg_write_coefficients(). - -When you are done using the virtual arrays, call jpeg_finish_decompress() -to release the array storage and return the decompression object to an idle -state; or just call jpeg_destroy() if you don't need to reuse the object. - -If you use a suspending data source, jpeg_read_coefficients() will return -NULL if it is forced to suspend; a non-NULL return value indicates successful -completion. You need not test for a NULL return value when using a -non-suspending data source. - -It is also possible to call jpeg_read_coefficients() to obtain access to the -decoder's coefficient arrays during a normal decode cycle in buffered-image -mode. This frammish might be useful for progressively displaying an incoming -image and then re-encoding it without loss. To do this, decode in buffered- -image mode as discussed previously, then call jpeg_read_coefficients() after -the last jpeg_finish_output() call. The arrays will be available for your use -until you call jpeg_finish_decompress(). - - -To write the contents of a JPEG file as DCT coefficients, you must provide -the DCT coefficients stored in virtual block arrays. You can either pass -block arrays read from an input JPEG file by jpeg_read_coefficients(), or -allocate virtual arrays from the JPEG compression object and fill them -yourself. In either case, jpeg_write_coefficients() is substituted for -jpeg_start_compress() and jpeg_write_scanlines(). Thus the sequence is - * Create compression object - * Set all compression parameters as necessary - * Request virtual arrays if needed - * jpeg_write_coefficients() - * jpeg_finish_compress() - * Destroy or re-use compression object -jpeg_write_coefficients() is passed a pointer to an array of virtual block -array descriptors; the number of arrays is equal to cinfo.num_components. - -The virtual arrays need only have been requested, not realized, before -jpeg_write_coefficients() is called. A side-effect of -jpeg_write_coefficients() is to realize any virtual arrays that have been -requested from the compression object's memory manager. Thus, when obtaining -the virtual arrays from the compression object, you should fill the arrays -after calling jpeg_write_coefficients(). The data is actually written out -when you call jpeg_finish_compress(); jpeg_write_coefficients() only writes -the file header. - -When writing raw DCT coefficients, it is crucial that the JPEG quantization -tables and sampling factors match the way the data was encoded, or the -resulting file will be invalid. For transcoding from an existing JPEG file, -we recommend using jpeg_copy_critical_parameters(). This routine initializes -all the compression parameters to default values (like jpeg_set_defaults()), -then copies the critical information from a source decompression object. -The decompression object should have just been used to read the entire -JPEG input file --- that is, it should be awaiting jpeg_finish_decompress(). - -jpeg_write_coefficients() marks all tables stored in the compression object -as needing to be written to the output file (thus, it acts like -jpeg_start_compress(cinfo, TRUE)). This is for safety's sake, to avoid -emitting abbreviated JPEG files by accident. If you really want to emit an -abbreviated JPEG file, call jpeg_suppress_tables(), or set the tables' -individual sent_table flags, between calling jpeg_write_coefficients() and -jpeg_finish_compress(). - - -Progress monitoring -------------------- - -Some applications may need to regain control from the JPEG library every so -often. The typical use of this feature is to produce a percent-done bar or -other progress display. (For a simple example, see cjpeg.c or djpeg.c.) -Although you do get control back frequently during the data-transferring pass -(the jpeg_read_scanlines or jpeg_write_scanlines loop), any additional passes -will occur inside jpeg_finish_compress or jpeg_start_decompress; those -routines may take a long time to execute, and you don't get control back -until they are done. - -You can define a progress-monitor routine which will be called periodically -by the library. No guarantees are made about how often this call will occur, -so we don't recommend you use it for mouse tracking or anything like that. -At present, a call will occur once per MCU row, scanline, or sample row -group, whichever unit is convenient for the current processing mode; so the -wider the image, the longer the time between calls. During the data -transferring pass, only one call occurs per call of jpeg_read_scanlines or -jpeg_write_scanlines, so don't pass a large number of scanlines at once if -you want fine resolution in the progress count. (If you really need to use -the callback mechanism for time-critical tasks like mouse tracking, you could -insert additional calls inside some of the library's inner loops.) - -To establish a progress-monitor callback, create a struct jpeg_progress_mgr, -fill in its progress_monitor field with a pointer to your callback routine, -and set cinfo->progress to point to the struct. The callback will be called -whenever cinfo->progress is non-NULL. (This pointer is set to NULL by -jpeg_create_compress or jpeg_create_decompress; the library will not change -it thereafter. So if you allocate dynamic storage for the progress struct, -make sure it will live as long as the JPEG object does. Allocating from the -JPEG memory manager with lifetime JPOOL_PERMANENT will work nicely.) You -can use the same callback routine for both compression and decompression. - -The jpeg_progress_mgr struct contains four fields which are set by the library: - long pass_counter; /* work units completed in this pass */ - long pass_limit; /* total number of work units in this pass */ - int completed_passes; /* passes completed so far */ - int total_passes; /* total number of passes expected */ -During any one pass, pass_counter increases from 0 up to (not including) -pass_limit; the step size is usually but not necessarily 1. The pass_limit -value may change from one pass to another. The expected total number of -passes is in total_passes, and the number of passes already completed is in -completed_passes. Thus the fraction of work completed may be estimated as - completed_passes + (pass_counter/pass_limit) - -------------------------------------------- - total_passes -ignoring the fact that the passes may not be equal amounts of work. - -When decompressing, pass_limit can even change within a pass, because it -depends on the number of scans in the JPEG file, which isn't always known in -advance. The computed fraction-of-work-done may jump suddenly (if the library -discovers it has overestimated the number of scans) or even decrease (in the -opposite case). It is not wise to put great faith in the work estimate. - -When using the decompressor's buffered-image mode, the progress monitor work -estimate is likely to be completely unhelpful, because the library has no way -to know how many output passes will be demanded of it. Currently, the library -sets total_passes based on the assumption that there will be one more output -pass if the input file end hasn't yet been read (jpeg_input_complete() isn't -TRUE), but no more output passes if the file end has been reached when the -output pass is started. This means that total_passes will rise as additional -output passes are requested. If you have a way of determining the input file -size, estimating progress based on the fraction of the file that's been read -will probably be more useful than using the library's value. - - -Memory management ------------------ - -This section covers some key facts about the JPEG library's built-in memory -manager. For more info, please read structure.doc's section about the memory -manager, and consult the source code if necessary. - -All memory and temporary file allocation within the library is done via the -memory manager. If necessary, you can replace the "back end" of the memory -manager to control allocation yourself (for example, if you don't want the -library to use malloc() and free() for some reason). - -Some data is allocated "permanently" and will not be freed until the JPEG -object is destroyed. Most data is allocated "per image" and is freed by -jpeg_finish_compress, jpeg_finish_decompress, or jpeg_abort. You can call the -memory manager yourself to allocate structures that will automatically be -freed at these times. Typical code for this is - ptr = (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, size); -Use JPOOL_PERMANENT to get storage that lasts as long as the JPEG object. -Use alloc_large instead of alloc_small for anything bigger than a few Kbytes. -There are also alloc_sarray and alloc_barray routines that automatically -build 2-D sample or block arrays. - -The library's minimum space requirements to process an image depend on the -image's width, but not on its height, because the library ordinarily works -with "strip" buffers that are as wide as the image but just a few rows high. -Some operating modes (eg, two-pass color quantization) require full-image -buffers. Such buffers are treated as "virtual arrays": only the current strip -need be in memory, and the rest can be swapped out to a temporary file. - -If you use the simplest memory manager back end (jmemnobs.c), then no -temporary files are used; virtual arrays are simply malloc()'d. Images bigger -than memory can be processed only if your system supports virtual memory. -The other memory manager back ends support temporary files of various flavors -and thus work in machines without virtual memory. They may also be useful on -Unix machines if you need to process images that exceed available swap space. - -When using temporary files, the library will make the in-memory buffers for -its virtual arrays just big enough to stay within a "maximum memory" setting. -Your application can set this limit by setting cinfo->mem->max_memory_to_use -after creating the JPEG object. (Of course, there is still a minimum size for -the buffers, so the max-memory setting is effective only if it is bigger than -the minimum space needed.) If you allocate any large structures yourself, you -must allocate them before jpeg_start_compress() or jpeg_start_decompress() in -order to have them counted against the max memory limit. Also keep in mind -that space allocated with alloc_small() is ignored, on the assumption that -it's too small to be worth worrying about; so a reasonable safety margin -should be left when setting max_memory_to_use. - -If you use the jmemname.c or jmemdos.c memory manager back end, it is -important to clean up the JPEG object properly to ensure that the temporary -files get deleted. (This is especially crucial with jmemdos.c, where the -"temporary files" may be extended-memory segments; if they are not freed, -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 or jmemmac.c either, -since the C library is supposed to take care of deleting files made with -tmpfile(). - - -Memory usage ------------- - -Working memory requirements while performing compression or decompression -depend on image dimensions, image characteristics (such as colorspace and -JPEG process), and operating mode (application-selected options). - -As of v6b, the decompressor requires: - 1. About 24K in more-or-less-fixed-size data. This varies a bit depending - on operating mode and image characteristics (particularly color vs. - grayscale), but it doesn't depend on image dimensions. - 2. Strip buffers (of size proportional to the image width) for IDCT and - upsampling results. The worst case for commonly used sampling factors - is about 34 bytes * width in pixels for a color image. A grayscale image - only needs about 8 bytes per pixel column. - 3. A full-image DCT coefficient buffer is needed to decode a multi-scan JPEG - file (including progressive JPEGs), or whenever you select buffered-image - mode. This takes 2 bytes/coefficient. At typical 2x2 sampling, that's - 3 bytes per pixel for a color image. Worst case (1x1 sampling) requires - 6 bytes/pixel. For grayscale, figure 2 bytes/pixel. - 4. To perform 2-pass color quantization, the decompressor also needs a - 128K color lookup table and a full-image pixel buffer (3 bytes/pixel). -This does not count any memory allocated by the application, such as a -buffer to hold the final output image. - -The above figures are valid for 8-bit JPEG data precision and a machine with -32-bit ints. For 12-bit JPEG data, double the size of the strip buffers and -quantization pixel buffer. The "fixed-size" data will be somewhat smaller -with 16-bit ints, larger with 64-bit ints. Also, CMYK or other unusual -color spaces will require different amounts of space. - -The full-image coefficient and pixel buffers, if needed at all, do not -have to be fully RAM resident; you can have the library use temporary -files instead when the total memory usage would exceed a limit you set. -(But if your OS supports virtual memory, it's probably better to just use -jmemnobs and let the OS do the swapping.) - -The compressor's memory requirements are similar, except that it has no need -for color quantization. Also, it needs a full-image DCT coefficient buffer -if Huffman-table optimization is asked for, even if progressive mode is not -requested. - -If you need more detailed information about memory usage in a particular -situation, you can enable the MEM_STATS code in jmemmgr.c. - - -Library compile-time options ----------------------------- - -A number of compile-time options are available by modifying jmorecfg.h. - -The JPEG standard provides for both the baseline 8-bit DCT process and -a 12-bit DCT process. The IJG code supports 12-bit lossy JPEG if you define -BITS_IN_JSAMPLE as 12 rather than 8. Note that this causes JSAMPLE to be -larger than a char, so it affects the surrounding application's image data. -The sample applications cjpeg and djpeg can support 12-bit mode only for PPM -and GIF file formats; you must disable the other file formats to compile a -12-bit cjpeg or djpeg. (install.doc has more information about that.) -At present, a 12-bit library can handle *only* 12-bit images, not both -precisions. (If you need to include both 8- and 12-bit libraries in a single -application, you could probably do it by defining NEED_SHORT_EXTERNAL_NAMES -for just one of the copies. You'd have to access the 8-bit and 12-bit copies -from separate application source files. This is untested ... if you try it, -we'd like to hear whether it works!) - -Note that a 12-bit library always compresses in Huffman optimization mode, -in order to generate valid Huffman tables. This is necessary because our -default Huffman tables only cover 8-bit data. If you need to output 12-bit -files in one pass, you'll have to supply suitable default Huffman tables. -You may also want to supply your own DCT quantization tables; the existing -quality-scaling code has been developed for 8-bit use, and probably doesn't -generate especially good tables for 12-bit. - -The maximum number of components (color channels) in the image is determined -by MAX_COMPONENTS. The JPEG standard allows up to 255 components, but we -expect that few applications will need more than four or so. - -On machines with unusual data type sizes, you may be able to improve -performance or reduce memory space by tweaking the various typedefs in -jmorecfg.h. In particular, on some RISC CPUs, access to arrays of "short"s -is quite slow; consider trading memory for speed by making JCOEF, INT16, and -UINT16 be "int" or "unsigned int". UINT8 is also a candidate to become int. -You probably don't want to make JSAMPLE be int unless you have lots of memory -to burn. - -You can reduce the size of the library by compiling out various optional -functions. To do this, undefine xxx_SUPPORTED symbols as necessary. - -You can also save a few K by not having text error messages in the library; -the standard error message table occupies about 5Kb. This is particularly -reasonable for embedded applications where there's no good way to display -a message anyway. To do this, remove the creation of the message table -(jpeg_std_message_table[]) from jerror.c, and alter format_message to do -something reasonable without it. You could output the numeric value of the -message code number, for example. If you do this, you can also save a couple -more K by modifying the TRACEMSn() macros in jerror.h to expand to nothing; -you don't need trace capability anyway, right? - - -Portability considerations --------------------------- - -The JPEG library has been written to be extremely portable; the sample -applications cjpeg and djpeg are slightly less so. This section summarizes -the design goals in this area. (If you encounter any bugs that cause the -library to be less portable than is claimed here, we'd appreciate hearing -about them.) - -The code works fine on ANSI C, C++, and pre-ANSI C compilers, using any of -the popular system include file setups, and some not-so-popular ones too. -See install.doc for configuration procedures. - -The code is not dependent on the exact sizes of the C data types. As -distributed, we make the assumptions that - char is at least 8 bits wide - short is at least 16 bits wide - int is at least 16 bits wide - long is at least 32 bits wide -(These are the minimum requirements of the ANSI C standard.) Wider types will -work fine, although memory may be used inefficiently if char is much larger -than 8 bits or short is much bigger than 16 bits. The code should work -equally well with 16- or 32-bit ints. - -In a system where these assumptions are not met, you may be able to make the -code work by modifying the typedefs in jmorecfg.h. However, you will probably -have difficulty if int is less than 16 bits wide, since references to plain -int abound in the code. - -char can be either signed or unsigned, although the code runs faster if an -unsigned char type is available. If char is wider than 8 bits, you will need -to redefine JOCTET and/or provide custom data source/destination managers so -that JOCTET represents exactly 8 bits of data on external storage. - -The JPEG library proper does not assume ASCII representation of characters. -But some of the image file I/O modules in cjpeg/djpeg do have ASCII -dependencies in file-header manipulation; so does cjpeg's select_file_type() -routine. - -The JPEG library does not rely heavily on the C library. In particular, C -stdio is used only by the data source/destination modules and the error -handler, all of which are application-replaceable. (cjpeg/djpeg are more -heavily dependent on stdio.) malloc and free are called only from the memory -manager "back end" module, so you can use a different memory allocator by -replacing that one file. - -The code generally assumes that C names must be unique in the first 15 -characters. However, global function names can be made unique in the -first 6 characters by defining NEED_SHORT_EXTERNAL_NAMES. - -More info about porting the code may be gleaned by reading jconfig.doc, -jmorecfg.h, and jinclude.h. - - -Notes for MS-DOS implementors ------------------------------ - -The IJG code is designed to work efficiently in 80x86 "small" or "medium" -memory models (i.e., data pointers are 16 bits unless explicitly declared -"far"; code pointers can be either size). You may be able to use small -model to compile cjpeg or djpeg by itself, but you will probably have to use -medium model for any larger application. This won't make much difference in -performance. You *will* take a noticeable performance hit if you use a -large-data memory model (perhaps 10%-25%), and you should avoid "huge" model -if at all possible. - -The JPEG library typically needs 2Kb-3Kb of stack space. It will also -malloc about 20K-30K of near heap space while executing (and lots of far -heap, but that doesn't count in this calculation). This figure will vary -depending on selected operating mode, and to a lesser extent on image size. -There is also about 5Kb-6Kb of constant data which will be allocated in the -near data segment (about 4Kb of this is the error message table). -Thus you have perhaps 20K available for other modules' static data and near -heap space before you need to go to a larger memory model. The C library's -static data will account for several K of this, but that still leaves a good -deal for your needs. (If you are tight on space, you could reduce the sizes -of the I/O buffers allocated by jdatasrc.c and jdatadst.c, say from 4K to -1K. Another possibility is to move the error message table to far memory; -this should be doable with only localized hacking on jerror.c.) - -About 2K of the near heap space is "permanent" memory that will not be -released until you destroy the JPEG object. This is only an issue if you -save a JPEG object between compression or decompression operations. - -Far data space may also be a tight resource when you are dealing with large -images. The most memory-intensive case is decompression with two-pass color -quantization, or single-pass quantization to an externally supplied color -map. This requires a 128Kb color lookup table plus strip buffers amounting -to about 40 bytes per column for typical sampling ratios (eg, about 25600 -bytes for a 640-pixel-wide image). You may not be able to process wide -images if you have large data structures of your own. - -Of course, all of these concerns vanish if you use a 32-bit flat-memory-model -compiler, such as DJGPP or Watcom C. We highly recommend flat model if you -can use it; the JPEG library is significantly faster in flat model. diff --git a/ltconfig b/ltconfig deleted file mode 100755 index 2347e694..00000000 --- a/ltconfig +++ /dev/null @@ -1,1512 +0,0 @@ -#! /bin/sh - -# ltconfig - Create a system-specific libtool. -# Copyright (C) 1996-1998 Free Software Foundation, Inc. -# Gordon Matzigkeit , 1996 -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A lot of this script is taken from autoconf-2.10. - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi - -echo=echo -if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : -else - # The Solaris and AIX default echo program unquotes backslashes. - # This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # So, we emulate echo with printf '%s\n' - echo="printf %s\\n" - if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : - else - # Oops. We have no working printf. Try to find a not-so-buggy echo. - echo=echo - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH /usr/ucb; do - if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - fi -fi - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# The name of this program. -progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` - -# Constants: -PROGRAM=ltconfig -PACKAGE=libtool -VERSION=1.2 -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' -rm="rm -f" - -help="Try \`$progname --help' for more information." - -# Global variables: -can_build_shared=yes -enable_shared=yes -# All known linkers require a `.a' archive for static linking. -enable_static=yes -ltmain= -silent= -srcdir= -ac_config_guess= -ac_config_sub= -host= -nonopt= -verify_host=yes -with_gcc=no -with_gnu_ld=no - -old_AR="$AR" -old_CC="$CC" -old_CFLAGS="$CFLAGS" -old_CPPFLAGS="$CPPFLAGS" -old_LD="$LD" -old_LN_S="$LN_S" -old_NM="$NM" -old_RANLIB="$RANLIB" - -# Parse the command line options. -args= -prev= -for option -do - case "$option" in - -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - eval "$prev=\$option" - prev= - continue - fi - - case "$option" in - --help) cat <&2 - echo "$help" 1>&2 - exit 1 - ;; - - *) - if test -z "$ltmain"; then - ltmain="$option" - elif test -z "$host"; then -# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 -# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then -# echo "$progname: warning \`$option' is not a valid host type" 1>&2 -# fi - host="$option" - else - echo "$progname: too many arguments" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac -done - -if test -z "$ltmain"; then - echo "$progname: you must specify a LTMAIN file" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -if test -f "$ltmain"; then : -else - echo "$progname: \`$ltmain' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -# Quote any args containing shell metacharacters. -ltconfig_args= -for arg -do - case "$arg" in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ltconfig_args="$ltconfig_args '$arg'" ;; - *) ltconfig_args="$ltconfig_args $arg" ;; - esac -done - -# A relevant subset of AC_INIT. - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 5 compiler messages saved in config.log -# 6 checking for... messages and results -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>>./config.log - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; fi - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - -if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to ltmain.sh. - srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'` - test "$srcdir" = "$ltmain" && srcdir=. -fi - -trap "$rm conftest*; exit 1" 1 2 15 -if test "$verify_host" = yes; then - # Check for config.guess and config.sub. - ac_aux_dir= - for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/config.guess; then - ac_aux_dir=$ac_dir - break - fi - done - if test -z "$ac_aux_dir"; then - echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 - echo "$help" 1>&2 - exit 1 - fi - ac_config_guess=$ac_aux_dir/config.guess - ac_config_sub=$ac_aux_dir/config.sub - - # Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then : - else - echo "$progname: cannot run $ac_config_sub" 1>&2 - echo "$help" 1>&2 - exit 1 - fi - - echo $ac_n "checking host system type""... $ac_c" 1>&6 - - host_alias=$host - case "$host_alias" in - "") - if host_alias=`$ac_config_guess`; then : - else - echo "$progname: cannot guess host type; you must specify one" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac - host=`$ac_config_sub $host_alias` - echo "$ac_t$host" 1>&6 - - # Make sure the host verified. - test -z "$host" && exit 1 - -elif test -z "$host"; then - echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 - echo "$help" 1>&2 - exit 1 -else - host_alias=$host -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case "$host_os" in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -case "$host_os" in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "${COLLECT_NAMES+set}" != set; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR cru $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -# Set a sane default for `AR'. -test -z "$AR" && AR=ar - -# If RANLIB is not set, then run the test. -if test "${RANLIB+set}" != "set"; then - result=no - - echo $ac_n "checking for ranlib... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/ranlib; then - RANLIB="ranlib" - result="ranlib" - break - fi - done - IFS="$save_ifs" - - echo "$ac_t$result" 1>&6 -fi - -if test -n "$RANLIB"; then - old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds" -fi - -# Check to see if we are using GCC. -if test "$with_gcc" != yes || test -z "$CC"; then - # If CC is not set, then try to find GCC or a usable CC. - if test -z "$CC"; then - echo $ac_n "checking for gcc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - IFS="$save_ifs" - test -z "$dir" && dir=. - if test -f $dir/gcc; then - CC="gcc" - break - fi - done - IFS="$save_ifs" - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - fi - - # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". - if test -z "$CC"; then - echo $ac_n "checking for cc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - cc_rejected=no - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/cc; then - if test "$dir/cc" = "/usr/ucb/cc"; then - cc_rejected=yes - continue - fi - CC="cc" - break - fi - done - IFS="$save_ifs" - if test $cc_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same name, so the bogon will be chosen - # first if we set CC to just the name; use the full file name. - shift - set dummy "$dir/cc" "$@" - shift - CC="$@" - fi - fi - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$CC"; then - echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 - exit 1 - fi - fi - - # Now see if the compiler is really GCC. - with_gcc=no - echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 - echo "$progname:424: checking whether we are using GNU C" >&5 - - $rm conftest.c - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - with_gcc=yes - fi - $rm conftest.c - echo "$ac_t$with_gcc" 1>&6 -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 -pic_flag= -special_shlib_compile_flags= -wl= -link_static_flag= -no_builtin_flag= - -if test "$with_gcc" = yes; then - wl='-Wl,' - link_static_flag='-static' - no_builtin_flag=' -fno-builtin' - - case "$host_os" in - aix3* | aix4* | irix5* | irix6* | osf3* | osf4*) - # PIC is the default for these OSes. - ;; - os2*) - # We can build DLLs from non-PIC. - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; - *) - pic_flag='-fPIC' - ;; - esac -else - # PORTME Check for PIC flags for the system compiler. - case "$host_os" in - aix3* | aix4*) - # All AIX code is PIC. - link_static_flag='-bnso -bI:/lib/syscalls.exp' - ;; - - hpux9* | hpux10*) - # Is there a better link_static_flag that works with the bundled CC? - wl='-Wl,' - link_static_flag="${wl}-a ${wl}archive" - pic_flag='+Z' - ;; - - irix5* | irix6*) - wl='-Wl,' - link_static_flag='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - os2*) - # We can build DLLs from non-PIC. - ;; - - osf3* | osf4*) - # All OSF/1 code is PIC. - wl='-Wl,' - link_static_flag='-non_shared' - ;; - - sco3.2v5*) - pic_flag='-Kpic' - link_static_flag='-dn' - special_shlib_compile_flags='-belf' - ;; - - solaris2*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - sunos4*) - pic_flag='-PIC' - link_static_flag='-Bstatic' - wl='-Qoption ld ' - ;; - - sysv4.2uw2*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - uts4*) - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; - - *) - can_build_shared=no - ;; - esac -fi - -if test -n "$pic_flag"; then - echo "$ac_t$pic_flag" 1>&6 - - # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 - $rm conftest* - echo > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" - echo "$progname:547: checking if $compiler PIC flag $pic_flag works" >&5 - if { (eval echo $progname:548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - # On HP-UX, both CC and GCC only warn that PIC is supported... then they - # create non-PIC objects. So, if there were any warnings, we assume that - # PIC is not supported. - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - can_build_shared=no - pic_flag= - else - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - can_build_shared=no - pic_flag= - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - echo "$ac_t"none 1>&6 -fi - -# Check for any special shared library compilation flags. -if test -n "$special_shlib_compile_flags"; then - echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : - else - echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 - can_build_shared=no - fi -fi - -echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 -$rm conftest* -echo 'main(){return(0);}' > conftest.c -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $link_static_flag" -echo "$progname:591: checking if $compiler static flag $link_static_flag works" >&5 -if { (eval echo $progname:592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 -else - echo "$ac_t"none 1>&6 - link_static_flag= -fi -LDFLAGS="$save_LDFLAGS" -$rm conftest* - -if test -z "$LN_S"; then - # Check to see if we can use ln -s, or we need hard links. - echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 - $rm conftestdata - if ln -s X conftestdata 2>/dev/null; then - $rm conftestdata - LN_S="ln -s" - else - LN_S=ln - fi - if test "$LN_S" = "ln -s"; then - echo "$ac_t"yes 1>&6 - else - echo "$ac_t"no 1>&6 - fi -fi - -# Make sure LD is an absolute path. -if test -z "$LD"; then - ac_prog=ld - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 - echo "$progname:624: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - /* | [A-Za-z]:\\*) - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we are not using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac - elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld... $ac_c" 1>&6 - echo "$progname:642: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 - echo "$progname:645: checking for non-GNU ld" >&5 - fi - - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" - fi - - if test -n "$LD"; then - echo "$ac_t$LD" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$LD"; then - echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 - exit 1 - fi -fi - -# Check to see if it really is or is not GNU ld. -echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 -# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - with_gnu_ld=yes -else - with_gnu_ld=no -fi -echo "$ac_t$with_gnu_ld" 1>&6 - -# See if the linker supports building shared libraries. -echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 - -allow_undefined_flag= -no_undefined_flag= -archive_cmds= -old_archive_from_new_cmds= -export_dynamic_flag_spec= -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= - -case "$host_os" in -amigaos* | sunos4*) - # On these operating systems, we should treat GNU ld like the system ld. - gnu_ld_acts_native=yes - ;; -*) - gnu_ld_acts_native=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes && test "$gnu_ld_acts_native" != yes; then - - # See if GNU ld supports shared libraries. - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs' - runpath_var=LD_RUN_PATH - ld_shlibs=yes - else - ld_shlibs=no - fi - - if test "$ld_shlibs" = yes; then - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case "$host_os" in - aix3*) - allow_undefined_flag=unsupported - archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$with_gcc" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4*) - allow_undefined_flag=unsupported - archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname' - hardcode_direct=yes - hardcode_minus_L=yes - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data;$echo "#define NAME $libname" > $objdir/a2ixlibrary.data;$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data;$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data;$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data;$AR cru $lib$libobjs;$RANLIB $lib;(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib$libobjs /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib$libobjs' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3, at last, uses gcc -shared to do shared libraries. - freebsd3*) - archive_cmds='$CC -shared -o $lib$libobjs' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;mv $objdir/$soname $lib' - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs' - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - ;; - - netbsd*) - # Tested with NetBSD 1.2 ld - archive_cmds='$LD -Bshareable -o $lib$libobjs' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - openbsd*) - archive_cmds='$LD -Bshareable -o $lib$libobjs' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - - osf3* | osf4*) - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -o $lib$libobjs' - hardcode_direct=yes - ;; - - solaris2*) - no_undefined_flag=' -z text' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - - # Solaris 2 before 2.5 hardcodes -L paths. - case "$host_os" in - solaris2.[0-4]*) - hardcode_minus_L=yes - ;; - esac - ;; - - sunos4*) - if test "$with_gcc" = yes; then - archive_cmds='$CC -shared -o $lib$libobjs' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' - fi - - if test "$with_gnu_ld" = yes; then - export_dynamic_flag_spec='${wl}-export-dynamic' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib$libobjs' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - can_build_shared=no - ;; - esac -fi -echo "$ac_t$ld_shlibs" 1>&6 - -if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in - /* | [A-Za-z]:\\*) ;; # Let the user override the test with a path. - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -p" - else - NM="$ac_dir/nm" - fi - break - fi - done - IFS="$ac_save_ifs" - test -z "$NM" && NM=nm - ;; - esac - echo "$ac_t$NM" 1>&6 -fi - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRSTU]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \1' - -# Define system-specific variables. -case "$host_os" in -aix*) - symcode='[BCDTU]' - ;; -irix*) - # Cannot use undefined symbols on IRIX because inlined functions mess us up. - symcode='[BCDEGRST]' - ;; -solaris2*) - symcode='[BDTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTUW]' -fi - -# Write the raw and C identifiers. -global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'" - -# Check to see that the pipe works correctly. -pipe_works=no -$rm conftest* -cat > conftest.c <&5 -if { (eval echo $progname:972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then - # Now try to grab the symbols. - nlist=conftest.nm - if { echo "$progname:975: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - wcout=`wc "$nlist" 2>/dev/null` - count=`$echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` - (test "$count" -ge 0) 2>/dev/null || count=-1 - else - rm -f "$nlist"T - count=-1 - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define __ptr_t void * -#else -# define __ptr_t char * -#endif - -/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ -int dld_preloaded_symbol_count = $count; - -/* The mapping between symbol names and symbols. */ -struct { - char *name; - __ptr_t address; -} -dld_preloaded_symbols[] = -{ -EOF - sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (__ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.o conftestm.o - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS='conftestm.o' - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo $progname:1033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - pipe_works=yes - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$save_LIBS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $global_symbol_pipe" >&5 - fi -else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 -fi -$rm conftest* - -# Do not use the global_symbol_pipe unless it works. -echo "$ac_t$pipe_works" 1>&6 -test "$pipe_works" = yes || global_symbol_pipe= - -# Check hardcoding attributes. -echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && \ - test "$hardcode_minus_L" != no && \ - test "$hardcode_shlibpath_var" != no; then - - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -elif test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" != yes; then - # We cannot hardcode anything. - hardcode_action=unsupported -else - # We can only hardcode existing directories. - hardcode_action=relink -fi -echo "$ac_t$hardcode_action" 1>&6 -test "$hardcode_action" = unsupported && can_build_shared=no - - -reload_flag= -reload_cmds='$LD$reload_flag -o $output$reload_objs' -echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 -# PORTME Some linker may need a different reload flag. -reload_flag='-r' -echo "$ac_t$reload_flag" -test -n "$reload_flag" && reload_flag=" $reload_flag" - -# PORTME Fill in your ld.so characteristics -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -version_type=none -dynamic_linker="$host_os ld.so" - -echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 -case "$host_os" in -aix3* | aix4*) - version_type=linux - library_names_spec='${libname}${release}.so.$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so.$major' - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -freebsd2* | freebsd3*) - version_type=sunos - library_names_spec='${libname}${release}.so.$versuffix $libname.so' - finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -gnu*) - version_type=sunos - library_names_spec='${libname}${release}.so.$versuffix' - shlibpath_var=LD_LIBRARY_PATH - ;; - -hpux9* | hpux10*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - shlibpath_var=SHLIB_PATH - library_names_spec='${libname}${release}.sl.$versuffix ${libname}${release}.sl.$major $libname.sl' - soname_spec='${libname}${release}.sl.$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6*) - version_type=osf - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so.$versuffix $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' - soname_spec='${libname}${release}.so.$major' - finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - - if test -f /lib/ld.so.1; then - dynamic_linker='GNU ld.so' - else - # Only the GNU ld.so supports shared libraries on MkLinux. - case "$host_cpu" in - powerpc*) dynamic_linker=no ;; - *) dynamic_linker='Linux ld.so' ;; - esac - fi - ;; - -netbsd* | openbsd*) - version_type=sunos - library_names_spec='${libname}${release}.so.$versuffix' - finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4*) - version_type=osf - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so.$versuffix $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so.$major' - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris2*) - version_type=linux - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' - soname_spec='${libname}${release}.so.$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so.$versuffix' - finish_cmds='PATH="$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4.2uw2*) - version_type=linux - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' - soname_spec='${libname}${release}.so.$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' - soname_spec='${libname}${release}.so.$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$ac_t$dynamic_linker" -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 - -echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds;\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -esac - -echo "$ac_t$enable_shared" 1>&6 - -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes - -echo "checking whether to build static libraries... $enable_static" 1>&6 - -echo $ac_n "checking for objdir... $ac_c" 1>&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$ac_t$objdir" 1>&6 - -# Copy echo and quote the copy, instead of the original, because it is -# used later. -ltecho="$echo" - -# Now quote all the things that may contain metacharacters. -for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ - old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \ - link_static_flag no_builtin_flag export_dynamic_flag_spec \ - libname_spec library_names_spec soname_spec RANLIB \ - old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \ - allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe \ - hardcode_libdir_flag_spec hardcode_libdir_separator; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | archive_cmds | \ - postinstall_cmds | postuninstall_cmds | finish_cmds) - # Double-quote double-evaled strings. - eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`" - ;; - *) - eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`" - ;; - esac -done - -ofile=libtool -trap "$rm $ofile; exit 1" 1 2 15 -echo creating $ofile -$rm $ofile -cat < $ofile -#! /bin/sh - -# libtool - Provide generalized library-building support services. -# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION -# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. -# -# Copyright (C) 1996-1998 Free Software Foundation, Inc. -# Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This program was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\ -# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\ -# $0$ltconfig_args -# -# Compiler and other test output produced by $progname, useful for -# debugging $progname, is in ./config.log if it exists. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi - -# An echo program that does not interpret backslashes. -echo="$ltecho" - -# The version of $progname that generated this script. -LTCONFIG_VERSION="$VERSION" - -# Shell to use when invoking shell scripts. -SHELL=${CONFIG_SHELL-/bin/sh} - -# Whether or not to build libtool libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build old-style libraries. -build_old_libs=$enable_static - -# The host system. -host_alias="$host_alias" -host="$host" - -# The archiver. -AR="$AR" - -# The default C compiler. -CC="$CC" - -# The linker used to build libraries. -LD="$LD" - -# Whether we need hard or soft links. -LN_S="$LN_S" - -# A BSD-compatible nm program. -NM="$NM" - -# The name of the directory that contains temporary libtool files. -objdir="$objdir" - -# How to create reloadable object files. -reload_flag="$reload_flag" -reload_cmds="$reload_cmds" - -# How to pass a linker flag through the compiler. -wl="$wl" - -# Additional compiler flags for building library objects. -pic_flag="$pic_flag" - -# Compiler flag to prevent dynamic linking. -link_static_flag="$link_static_flag" - -# Compiler flag to turn off builtin functions. -no_builtin_flag="$no_builtin_flag" - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="$export_dynamic_flag_spec" - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec="$libname_spec" - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec="$library_names_spec" - -# The coded name of the library, if different from the real name. -soname_spec="$soname_spec" - -# Commands used to build and install an old-style archive. -RANLIB="$RANLIB" -old_archive_cmds="$old_archive_cmds" -old_postinstall_cmds="$old_postinstall_cmds" -old_postuninstall_cmds="$old_postuninstall_cmds" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="$old_archive_from_new_cmds" - -# Commands used to build and install a shared archive. -archive_cmds="$archive_cmds" -postinstall_cmds="$postinstall_cmds" -postuninstall_cmds="$postuninstall_cmds" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="$allow_undefined_flag" - -# Flag that forces no undefined symbols. -no_undefined_flag="$no_undefined_flag" - -# Commands used to finish a libtool library installation in a directory. -finish_cmds="$finish_cmds" - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval="$finish_eval" - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="$global_symbol_pipe" - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec" - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator="$hardcode_libdir_separator" - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -EOF - -case "$host_os" in -aix3*) - cat <<\EOF >> $ofile -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "${COLLECT_NAMES+set}" != set; then - COLLECT_NAMES= - export COLLECT_NAMES -fi - -EOF - ;; -esac - -# Append the ltmain.sh script. -cat "$ltmain" >> $ofile || (rm -f $ofile; exit 1) - -chmod +x $ofile -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/ltmain.sh b/ltmain.sh deleted file mode 100644 index e9350b3f..00000000 --- a/ltmain.sh +++ /dev/null @@ -1,2453 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. -# -# Copyright (C) 1996-1998 Free Software Foundation, Inc. -# Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# The name of this program. -progname=`$echo "$0" | sed 's%^.*/%%'` -modename="$progname" - -# Constants. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.2 - -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; fi - -if test "$LTCONFIG_VERSION" != "$VERSION"; then - echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= - -# Parse our command line options once, thoroughly. -while test $# -gt 0 -do - arg="$1" - shift - - case "$arg" in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - execute_dlfiles) - eval "$prev=\"\$$prev \$arg\"" - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case "$arg" in - --help) - show_help=yes - ;; - - --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION" - exit 0 - ;; - - --dry-run | -n) - run=: - ;; - - --features) - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - case "$nonopt" in - *cc | *++ | gcc* | *-gcc*) - mode=link - for arg - do - case "$arg" in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case "$mode" in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - lastarg= - srcfile="$nonopt" - suppress_output= - - for arg - do - # Accept any command-line options. - case "$arg" in - -o) - $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done - - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - - # Recognize several different file suffixes. - xform='[cCFSfms]' - case "$libobj" in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case "$libobj" in - *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;; - *) - $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2 - exit 1 - ;; - esac - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - $run $rm $obj $libobj - trap "$run $rm $obj $libobj; exit 1" 1 2 15 - else - $run $rm $libobj - trap "$run $rm $libobj; exit 1" 1 2 15 - fi - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - # All platforms use -DPIC, to notify preprocessed assembler code. - $show "$base_compile$pic_flag -DPIC $srcfile" - if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then : - else - test -n "$obj" && $run $rm $obj - exit 1 - fi - - # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag"; then - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj - exit $? - fi - - # Just move the object, then go on to compile the next one - $show "$mv $obj $libobj" - $run $mv $obj $libobj || exit 1 - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - # Suppress compiler output if we already did a PIC compilation. - $show "$base_compile $srcfile$suppress_output" - if $run eval "$base_compile \$srcfile$suppress_output"; then : - else - $run $rm $obj $libobj - exit 1 - fi - fi - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - fi - - exit 0 - ;; - - # libtool link mode - link) - modename="$modename: link" - CC="$nonopt" - allow_undefined=yes - compile_command="$CC" - finalize_command="$CC" - - compile_shlibpath= - finalize_shlibpath= - deplibs= - dlfiles= - dlprefiles= - export_dynamic=no - hardcode_libdirs= - libobjs= - link_against_libtool_libs= - ltlibs= - objs= - prev= - prevarg= - release= - rpath= - perm_rpath= - temp_rpath= - vinfo= - - # We need to know -static, to get the right output filenames. - for arg - do - case "$arg" in - -all-static | -static) - if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - for arg - do - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case "$prev" in - dlfiles|dlprefiles) - case "$arg" in - *.la | *.lo) ;; # We handle these cases below. - *) - dlprefiles="$dlprefiles $arg" - test "$prev" = dlfiles && dlfiles="$dlfiles $arg" - prev= - ;; - esac - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath) - rpath="$rpath $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi - - prevarg="$arg" - - case "$arg" in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - if test "$export_dynamic" != yes; then - export_dynamic=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - fi - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` - case "$dir" in - /* | [A-Za-z]:\\*) - # Add the corresponding hardcode_libdir_flag, if it is not identical. - ;; - *) - $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 - exit 1 - ;; - esac - deplibs="$deplibs $arg" - ;; - - -l*) deplibs="$deplibs $arg" ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - - *.o | *.a) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A library object. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes; then - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'` - prev= - fi - libobjs="$libobjs $arg" - ;; - - *.la) - # A libtool-controlled library. - - dlname= - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 - exit 1 - fi - - # If there is no directory component, then add one. - case "$arg" in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$libdir"; then - $echo "$modename: \`$arg' contains no -rpath information" 1>&2 - exit 1 - fi - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 - exit 1 - fi - - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname"; then - # If there is no dlname, we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue - fi - fi - - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" - else - dlprefiles="$dlprefiles $dir/$linklib" - fi - prev= - fi - - if test "$build_libtool_libs" = yes && test -n "$library_names"; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # This is the magic to use -rpath. - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$libdir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" - - compile_command="$compile_command $flag" - finalize_command="$finalize_command $flag" - fi - elif test -n "$runpath_var"; then - # Do the same for the permanent run path. - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - - - case "$hardcode_action" in - immediate) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - elif test "$hardcode_minus_L" = no; then - compile_command="$compile_command -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - compile_shlibpath="$compile_shlibpath$dir:" - compile_command="$compile_command -l$name" - fi - ;; - - relink) - # We need an absolute path. - case "$dir" in - /* | [A-Za-z]:\\*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - compile_command="$compile_command -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - compile_shlibpath="$compile_shlibpath$dir:" - compile_command="$compile_command -l$name" - fi - ;; - - *) - $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2 - exit 1 - ;; - esac - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - finalize_command="$finalize_command -L$libdir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - finalize_shlibpath="$finalize_shlibpath$libdir:" - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - finalize_command="$finalize_command -L$libdir -l$name" - fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 - fi - - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - compile_command="$compile_command -L$dir -l$name" - finalize_command="$finalize_command -L$dir -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - esac - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$vinfo" && test -n "$release"; then - $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - oldlib= - oldobjs= - case "$output" in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - */* | *\\*) - $echo "$modename: output file \`$output' must have no directory components" 1>&2 - exit 1 - ;; - - *.a) - # Now set the variables for building old libraries. - build_libtool_libs=no - build_old_libs=yes - oldlib="$output" - $show "$rm $oldlib" - $run $rm $oldlib - ;; - - *.la) - # Make sure we only generate libraries of the form `libNAME.la'. - case "$output" in - lib*) ;; - *) - $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - current=0 - revision=0 - age=0 - - if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - fi - - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 - exit 1 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2 - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$rpath"; then - $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo - IFS="$save_ifs" - - if test -n "$5"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - test -n "$2" && current="$2" - test -n "$3" && revision="$3" - test -n "$4" && age="$4" - - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test $age -gt $current; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - version_vars="version_type current age revision" - case "$version_type" in - none) ;; - - linux) - version_vars="$version_vars major versuffix" - major=`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - version_vars="$version_vars versuffix verstring" - major=`expr $current - $age` - versuffix="$current.$age.$revision" - verstring="$versuffix" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test $loop != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - version_vars="$version_vars major versuffix" - major="$current" - versuffix="$current.$revision" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Create the output directory, or remove our outputs if we need to. - if test -d $objdir; then - $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*" - $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.* - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - # Add libc to deplibs on all systems. - dependency_libs="$deplibs" - deplibs="$deplibs -lc" - - if test "$build_libtool_libs" = yes; then - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - lib="$objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are PIC. - test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'` - - # Do each of the archive commands. - eval cmds=\"$archive_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Create links to the real library. - for linkname in $linknames; do - $show "(cd $objdir && $LN_S $realname $linkname)" - $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $? - done - - # If -export-dynamic was specified, set the dlname. - if test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - - # Now set the variables for building old libraries. - oldlib="$objdir/$libname.a" - ;; - - *.lo | *.o) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2 - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 - fi - - case "$output" in - *.lo) - if test -n "$objs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Create the old-style object. - reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - test -z "$libobj" && exit 0 - - if test "$build_libtool_libs" != yes; then - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag"; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj || exit 1 - fi - - exit 0 - ;; - - *) - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 - fi - - if test -n "$rpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$libdir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" - - compile_command="$compile_command $flag" - finalize_command="$finalize_command $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - fi - - # Substitute the hardcoded libdirs into the compile commands. - if test -n "$hardcode_libdir_separator"; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - fi - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - fi - - if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${output}S.c" - else - dlsyms= - fi - - if test -n "$dlsyms"; then - # Add our own program objects to the preloaded list. - dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - - # Discover the nlist of each of the dlfiles. - nlist="$objdir/${output}.nm" - - if test -d $objdir; then - $show "$rm $nlist ${nlist}T" - $run $rm "$nlist" "${nlist}T" - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - # Parse the name list into a source file. - $show "creating $objdir/$dlsyms" - if test -z "$run"; then - # Make sure we at least have an empty file. - test -f "$nlist" || : > "$nlist" - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - wcout=`wc "$nlist" 2>/dev/null` - count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` - (test "$count" -ge 0) 2>/dev/null || count=-1 - else - $rm "$nlist"T - count=-1 - fi - - case "$dlsyms" in - "") ;; - *.c) - $echo > "$objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define dld_preloaded_symbol_count some_other_symbol -#define dld_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test -f "$nlist"; then - sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms" - else - echo '/* NONE */' >> "$objdir/$dlsyms" - fi - - $echo >> "$objdir/$dlsyms" "\ - -#undef dld_preloaded_symbol_count -#undef dld_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define __ptr_t void * -#else -# define __ptr_t char * -#endif - -/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ -int dld_preloaded_symbol_count = $count; - -/* The mapping between symbol names and symbols. */ -struct { - char *name; - __ptr_t address; -} -dld_preloaded_symbols[] = -{\ -" - - if test -f "$nlist"; then - sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms" - fi - - $echo >> "$objdir/$dlsyms" "\ - {0, (__ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif\ -" - ;; - - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - fi - - # Now compile the dynamic symbol file. - $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")" - $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $? - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` - elif test "$export_dynamic" != yes; then - test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 - else - # We keep going just in case the user didn't refer to - # dld_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - - # We have no uninstalled library dependencies, so finalize right now. - $show "$compile_command" - $run eval "$compile_command" - exit $? - fi - - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'` - finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'` - - # Create the binary in the object directory, then wrap it. - if test -d $objdir; then : - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case "$dir" in - /* | [A-Za-z]:\\*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - # Delete the old output file. - $run $rm $output - - if test -n "$compile_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" - finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" - fi - - case "$hardcode_action" in - relink) - # AGH! Flame the AIX and HP-UX people for me, will ya? - $echo "$modename: warning: using a buggy system linker" 1>&2 - $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2 - ;; - esac - - $show "$compile_command" - $run eval "$compile_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the finalize command for shipping. - finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"` - - # Quote $echo for shipping. - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! /bin/sh - -# $output - temporary wrapper script for $objdir/$output -# Generated by ltmain.sh - GNU $PACKAGE $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of \``pwd`'. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - link_against_libtool_libs='$link_against_libtool_libs' - finalize_command=\"$finalize_command\" -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" = \"$magic\"; then : - else - echo=\"$qecho\" - file=\"\$0\" - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" - - progdir=\"\$thisdir/$objdir\" - program='$output' - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\` - - export $shlibpath_var -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} - - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - if test "$build_old_libs" = "yes"; then - # Transform .lo files to .o files. - oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Now create the libtool archive. - case "$output" in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.a" - - $show "creating $output" - - # Only create the output if not a dry run. - if test -z "$run"; then - $echo > $output "\ -# $output - a libtool library file -# Generated by ltmain.sh - GNU $PACKAGE $VERSION - -# The name that we can dlopen(3). -dlname='$dlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $objdir && $LN_S ../$output $output)" - $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1 - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional /bin/sh argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL"; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir= - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case "$arg" in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test -n "$isdir"; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test $# -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case "$destdir" in - /* | [A-Za-z]:\\*) ;; - *) - for file in $files; do - case "$file" in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case "$file" in - *.a) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? - test "X$dlname" = "X$realname" && dlname= - - if test $# -gt 0; then - # Delete the old symlinks. - rmcmd="$rm" - for linkname - do - rmcmd="$rmcmd $destdir/$linkname" - done - $show "$rmcmd" - $run $rmcmd - - # ... and create new ones. - for linkname - do - test "X$dlname" = "X$linkname" && dlname= - $show "(cd $destdir && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $LN_S $realname $linkname)" - done - fi - - if test -n "$dlname"; then - # Install the dynamically-loadable library. - $show "$install_prog $dir/$dlname $destdir/$dlname" - $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - $show "$install_prog $file $destdir/$name" - $run eval "$install_prog $file $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case "$destfile" in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'` - ;; - *.o) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - link_against_libtool_libs= - finalize_command= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Check the variables that should have been set. - if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $link_against_libtool_libs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" - if test -z "$libdir"; then - $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2 - elif test -f "$libfile"; then : - else - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - if test "$hardcode_action" = relink; then - if test "$finalize" = yes; then - $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 - $show "$finalize_command" - if $run eval "$finalize_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue - fi - file="$objdir/$file"T - else - $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - $show "$install_prog$stripme $file $dest" - $run eval "$install_prog\$stripme \$file \$dest" || exit $? - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 - fi - - exit 0 - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" - fi - done - fi - - echo "------------------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" - done - echo - echo "To link against installed libraries in a given directory, LIBDIR," - echo "you must use the \`-LLIBDIR' flag during linking." - echo - echo " You will also need to do one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - echo " - use the \`$flag' linker flag" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "------------------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test -f "$file"; then : - else - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case "$file" in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case "$file" in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool uninstall mode - uninstall) - modename="$modename: uninstall" - rm="$nonopt" - files= - - for arg - do - case "$arg" in - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - rmfiles="$file" - - case "$name" in - *.la) - # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $dir/$n" - test "X$n" = "X$dlname" && dlname= - done - test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" - test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - # FIXME: should reinstall the best remaining shared library. - fi - ;; - - *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'` - rmfiles="$rmfiles $dir/$oldobj" - fi - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - - *) - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - esac - done - exit 0 - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 -fi # test -z "$show_help" - -# We need to display help for each of the modes. -case "$mode" in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - --n, --dry-run display commands without modifying any files - --features display configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --version print version information - -MODE must be one of the following: - - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only -library objects (\`.lo' files) may be specified, and \`-rpath' is required. - -If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' -and \`ranlib'. - -If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is -created, otherwise an executable program is created." - ;; - -uninstall) - $echo -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/makcjpeg.st b/makcjpeg.st deleted file mode 100644 index fc72c898..00000000 --- a/makcjpeg.st +++ /dev/null @@ -1,38 +0,0 @@ -; Project file for Independent JPEG Group's software -; -; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. -; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), -; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), -; and Guido Vollbeding (guivol@esc.de). -; -; To use this file, rename it to cjpeg.prj. -; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." -; Read installation instructions before trying to make the program! -; -; -; * * * Output file * * * -cjpeg.ttp -; -; * * * COMPILER OPTIONS * * * -.C[-P] ; absolute calls -.C[-M] ; and no string merging, folks -.C[-w-cln] ; no "constant is long" warnings -.C[-w-par] ; no "parameter xxxx unused" -.C[-w-rch] ; no "unreachable code" -.C[-wsig] ; warn if significant digits may be lost -= -; * * * * List of modules * * * * -pcstart.o -cjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h) -cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdswitch.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdppm.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdgif.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdtarga.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdbmp.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdrle.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -libjpeg.lib ; built by libjpeg.prj -pcfltlib.lib ; floating point library -; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED -pcstdlib.lib ; standard library -pcextlib.lib ; extended library diff --git a/makdjpeg.st b/makdjpeg.st deleted file mode 100644 index 32267263..00000000 --- a/makdjpeg.st +++ /dev/null @@ -1,38 +0,0 @@ -; Project file for Independent JPEG Group's software -; -; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. -; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), -; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), -; and Guido Vollbeding (guivol@esc.de). -; -; To use this file, rename it to djpeg.prj. -; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." -; Read installation instructions before trying to make the program! -; -; -; * * * Output file * * * -djpeg.ttp -; -; * * * COMPILER OPTIONS * * * -.C[-P] ; absolute calls -.C[-M] ; and no string merging, folks -.C[-w-cln] ; no "constant is long" warnings -.C[-w-par] ; no "parameter xxxx unused" -.C[-w-rch] ; no "unreachable code" -.C[-wsig] ; warn if significant digits may be lost -= -; * * * * List of modules * * * * -pcstart.o -djpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h) -cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdcolmap.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -wrppm.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -wrgif.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -wrtarga.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -wrbmp.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -wrrle.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -libjpeg.lib ; built by libjpeg.prj -pcfltlib.lib ; floating point library -; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED -pcstdlib.lib ; standard library -pcextlib.lib ; extended library diff --git a/makeapps.ds b/makeapps.ds deleted file mode 100644 index bedd038a..00000000 --- a/makeapps.ds +++ /dev/null @@ -1,828 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -!IF "$(CFG)" == "" -CFG=cjpeg - Win32 -!MESSAGE No configuration specified. Defaulting to cjpeg - Win32. -!ENDIF - -!IF "$(CFG)" != "cjpeg - Win32" && "$(CFG)" != "djpeg - Win32" &&\ - "$(CFG)" != "jpegtran - Win32" && "$(CFG)" != "rdjpgcom - Win32" &&\ - "$(CFG)" != "wrjpgcom - Win32" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "apps.mak" CFG="cjpeg - Win32" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cjpeg - Win32" (based on "Win32 (x86) Console Application") -!MESSAGE "djpeg - Win32" (based on "Win32 (x86) Console Application") -!MESSAGE "jpegtran - Win32" (based on "Win32 (x86) Console Application") -!MESSAGE "rdjpgcom - Win32" (based on "Win32 (x86) Console Application") -!MESSAGE "wrjpgcom - Win32" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "cjpeg - Win32" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cjpeg - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cjpeg\Release" -# PROP BASE Intermediate_Dir "cjpeg\Release" -# PROP BASE Target_Dir "cjpeg" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "cjpeg\Release" -# PROP Intermediate_Dir "cjpeg\Release" -# PROP Target_Dir "cjpeg" -OUTDIR=.\cjpeg\Release -INTDIR=.\cjpeg\Release - -ALL : "$(OUTDIR)\cjpeg.exe" - -CLEAN : - -@erase "$(INTDIR)\cjpeg.obj" - -@erase "$(INTDIR)\rdppm.obj" - -@erase "$(INTDIR)\rdgif.obj" - -@erase "$(INTDIR)\rdtarga.obj" - -@erase "$(INTDIR)\rdrle.obj" - -@erase "$(INTDIR)\rdbmp.obj" - -@erase "$(INTDIR)\rdswitch.obj" - -@erase "$(INTDIR)\cdjpeg.obj" - -@erase "$(OUTDIR)\cjpeg.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ - /Fp"$(INTDIR)/cjpeg.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\cjpeg\Release/ -CPP_SBRS=.\. -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/cjpeg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -LINK32_FLAGS=Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)/cjpeg.pdb" /machine:I386 /out:"$(OUTDIR)/cjpeg.exe" -LINK32_OBJS= \ - "$(INTDIR)\cjpeg.obj" \ - "$(INTDIR)\rdppm.obj" \ - "$(INTDIR)\rdgif.obj" \ - "$(INTDIR)\rdtarga.obj" \ - "$(INTDIR)\rdrle.obj" \ - "$(INTDIR)\rdbmp.obj" \ - "$(INTDIR)\rdswitch.obj" \ - "$(INTDIR)\cdjpeg.obj" \ - - -"$(OUTDIR)\cjpeg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "djpeg - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "djpeg\Release" -# PROP BASE Intermediate_Dir "djpeg\Release" -# PROP BASE Target_Dir "djpeg" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "djpeg\Release" -# PROP Intermediate_Dir "djpeg\Release" -# PROP Target_Dir "djpeg" -OUTDIR=.\djpeg\Release -INTDIR=.\djpeg\Release - -ALL : "$(OUTDIR)\djpeg.exe" - -CLEAN : - -@erase "$(INTDIR)\djpeg.obj" - -@erase "$(INTDIR)\wrppm.obj" - -@erase "$(INTDIR)\wrgif.obj" - -@erase "$(INTDIR)\wrtarga.obj" - -@erase "$(INTDIR)\wrrle.obj" - -@erase "$(INTDIR)\wrbmp.obj" - -@erase "$(INTDIR)\rdcolmap.obj" - -@erase "$(INTDIR)\cdjpeg.obj" - -@erase "$(OUTDIR)\djpeg.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ - /Fp"$(INTDIR)/djpeg.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\djpeg\Release/ -CPP_SBRS=.\. -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/djpeg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -LINK32_FLAGS=Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)/djpeg.pdb" /machine:I386 /out:"$(OUTDIR)/djpeg.exe" -LINK32_OBJS= \ - "$(INTDIR)\djpeg.obj" \ - "$(INTDIR)\wrppm.obj" \ - "$(INTDIR)\wrgif.obj" \ - "$(INTDIR)\wrtarga.obj" \ - "$(INTDIR)\wrrle.obj" \ - "$(INTDIR)\wrbmp.obj" \ - "$(INTDIR)\rdcolmap.obj" \ - "$(INTDIR)\cdjpeg.obj" \ - - -"$(OUTDIR)\djpeg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "jpegtran - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "jpegtran\Release" -# PROP BASE Intermediate_Dir "jpegtran\Release" -# PROP BASE Target_Dir "jpegtran" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "jpegtran\Release" -# PROP Intermediate_Dir "jpegtran\Release" -# PROP Target_Dir "jpegtran" -OUTDIR=.\jpegtran\Release -INTDIR=.\jpegtran\Release - -ALL : "$(OUTDIR)\jpegtran.exe" - -CLEAN : - -@erase "$(INTDIR)\jpegtran.obj" - -@erase "$(INTDIR)\rdswitch.obj" - -@erase "$(INTDIR)\cdjpeg.obj" - -@erase "$(INTDIR)\transupp.obj" - -@erase "$(OUTDIR)\jpegtran.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ - /Fp"$(INTDIR)/jpegtran.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\jpegtran\Release/ -CPP_SBRS=.\. -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/jpegtran.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -LINK32_FLAGS=Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)/jpegtran.pdb" /machine:I386 /out:"$(OUTDIR)/jpegtran.exe" -LINK32_OBJS= \ - "$(INTDIR)\jpegtran.obj" \ - "$(INTDIR)\rdswitch.obj" \ - "$(INTDIR)\cdjpeg.obj" \ - "$(INTDIR)\transupp.obj" \ - - -"$(OUTDIR)\jpegtran.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "rdjpgcom - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "rdjpgcom\Release" -# PROP BASE Intermediate_Dir "rdjpgcom\Release" -# PROP BASE Target_Dir "rdjpgcom" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "rdjpgcom\Release" -# PROP Intermediate_Dir "rdjpgcom\Release" -# PROP Target_Dir "rdjpgcom" -OUTDIR=.\rdjpgcom\Release -INTDIR=.\rdjpgcom\Release - -ALL : "$(OUTDIR)\rdjpgcom.exe" - -CLEAN : - -@erase "$(INTDIR)\rdjpgcom.obj" - -@erase "$(OUTDIR)\rdjpgcom.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ - /Fp"$(INTDIR)/rdjpgcom.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\rdjpgcom\Release/ -CPP_SBRS=.\. -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/rdjpgcom.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -LINK32_FLAGS=Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)/rdjpgcom.pdb" /machine:I386 /out:"$(OUTDIR)/rdjpgcom.exe" -LINK32_OBJS= \ - "$(INTDIR)\rdjpgcom.obj" - -"$(OUTDIR)\rdjpgcom.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "wrjpgcom - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "wrjpgcom\Release" -# PROP BASE Intermediate_Dir "wrjpgcom\Release" -# PROP BASE Target_Dir "wrjpgcom" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "wrjpgcom\Release" -# PROP Intermediate_Dir "wrjpgcom\Release" -# PROP Target_Dir "wrjpgcom" -OUTDIR=.\wrjpgcom\Release -INTDIR=.\wrjpgcom\Release - -ALL : "$(OUTDIR)\wrjpgcom.exe" - -CLEAN : - -@erase "$(INTDIR)\wrjpgcom.obj" - -@erase "$(OUTDIR)\wrjpgcom.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ - /Fp"$(INTDIR)/wrjpgcom.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\wrjpgcom\Release/ -CPP_SBRS=.\. -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/wrjpgcom.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -LINK32_FLAGS=Release\jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\ - odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no\ - /pdb:"$(OUTDIR)/wrjpgcom.pdb" /machine:I386 /out:"$(OUTDIR)/wrjpgcom.exe" -LINK32_OBJS= \ - "$(INTDIR)\wrjpgcom.obj" - -"$(OUTDIR)\wrjpgcom.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -################################################################################ -# Begin Target - -# Name "cjpeg - Win32" - -!IF "$(CFG)" == "cjpeg - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="cjpeg.c" -DEP_CPP_CJPEG=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - "jversion.h"\ - - -"$(INTDIR)\cjpeg.obj" : $(SOURCE) $(DEP_CPP_CJPEG) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="cdjpeg.c" -DEP_CPP_CDJPE=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdswitch.c" -DEP_CPP_RDSWI=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdswitch.obj" : $(SOURCE) $(DEP_CPP_RDSWI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdppm.c" -DEP_CPP_RDPPM=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdppm.obj" : $(SOURCE) $(DEP_CPP_RDPPM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdgif.c" -DEP_CPP_RDGIF=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdgif.obj" : $(SOURCE) $(DEP_CPP_RDGIF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdtarga.c" -DEP_CPP_RDTAR=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdtarga.obj" : $(SOURCE) $(DEP_CPP_RDTAR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdbmp.c" -DEP_CPP_RDBMP=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdbmp.obj" : $(SOURCE) $(DEP_CPP_RDBMP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdrle.c" -DEP_CPP_RDRLE=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdrle.obj" : $(SOURCE) $(DEP_CPP_RDRLE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -################################################################################ -# Begin Target - -# Name "djpeg - Win32" - -!IF "$(CFG)" == "djpeg - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="djpeg.c" -DEP_CPP_DJPEG=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - "jversion.h"\ - - -"$(INTDIR)\djpeg.obj" : $(SOURCE) $(DEP_CPP_DJPEG) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="cdjpeg.c" -DEP_CPP_CDJPE=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdcolmap.c" -DEP_CPP_RDCOL=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdcolmap.obj" : $(SOURCE) $(DEP_CPP_RDCOL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="wrppm.c" -DEP_CPP_WRPPM=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\wrppm.obj" : $(SOURCE) $(DEP_CPP_WRPPM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="wrgif.c" -DEP_CPP_WRGIF=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\wrgif.obj" : $(SOURCE) $(DEP_CPP_WRGIF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="wrtarga.c" -DEP_CPP_WRTAR=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\wrtarga.obj" : $(SOURCE) $(DEP_CPP_WRTAR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="wrbmp.c" -DEP_CPP_WRBMP=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\wrbmp.obj" : $(SOURCE) $(DEP_CPP_WRBMP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="wrrle.c" -DEP_CPP_WRRLE=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\wrrle.obj" : $(SOURCE) $(DEP_CPP_WRRLE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -################################################################################ -# Begin Target - -# Name "jpegtran - Win32" - -!IF "$(CFG)" == "jpegtran - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="jpegtran.c" -DEP_CPP_JPEGT=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - "transupp.h"\ - "jversion.h"\ - - -"$(INTDIR)\jpegtran.obj" : $(SOURCE) $(DEP_CPP_JPEGT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="cdjpeg.c" -DEP_CPP_CDJPE=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\cdjpeg.obj" : $(SOURCE) $(DEP_CPP_CDJPE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="rdswitch.c" -DEP_CPP_RDSWI=\ - "cdjpeg.h"\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - "cderror.h"\ - - -"$(INTDIR)\rdswitch.obj" : $(SOURCE) $(DEP_CPP_RDSWI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="transupp.c" -DEP_CPP_TRANS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "transupp.h"\ - - -"$(INTDIR)\transupp.obj" : $(SOURCE) $(DEP_CPP_TRANS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -################################################################################ -# Begin Target - -# Name "rdjpgcom - Win32" - -!IF "$(CFG)" == "rdjpgcom - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="rdjpgcom.c" -DEP_CPP_RDJPG=\ - "jinclude.h"\ - "jconfig.h"\ - - -"$(INTDIR)\rdjpgcom.obj" : $(SOURCE) $(DEP_CPP_RDJPG) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -################################################################################ -# Begin Target - -# Name "wrjpgcom - Win32" - -!IF "$(CFG)" == "wrjpgcom - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="wrjpgcom.c" -DEP_CPP_WRJPG=\ - "jinclude.h"\ - "jconfig.h"\ - - -"$(INTDIR)\wrjpgcom.obj" : $(SOURCE) $(DEP_CPP_WRJPG) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -# End Project -################################################################################ - diff --git a/makefile.ansi b/makefile.ansi deleted file mode 100644 index 82919135..00000000 --- a/makefile.ansi +++ /dev/null @@ -1,214 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is suitable for Unix-like systems with ANSI-capable compilers. -# If you have a non-ANSI compiler, makefile.unix is a better starting point. - -# Read installation instructions before saying "make" !! - -# The name of your C compiler: -CC= cc - -# You may need to adjust these cc options: -CFLAGS= -O -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time cc options: -LDFLAGS= - -# To link any special libraries, add the necessary -l commands here. -LDLIBS= - -# Put here the object file name for the correct system-dependent memory -# manager file. For Unix this is usually jmemnobs.o, but you may want -# to use jmemansi.o or jmemname.o if you have limited swap space. -SYSDEPMEM= jmemnobs.o - -# miscellaneous OS-dependent stuff -# linker -LN= $(CC) -# file deletion command -RM= rm -f -# library (.a) file creation command -AR= ar rc -# second step in .a creation (use "touch" if not needed) -AR2= ranlib - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \ - jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \ - jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \ - jfdctint.o -# decompression library object files -DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \ - jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \ - jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \ - jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o -# These objectfiles are included in libjpeg.a -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \ - cdjpeg.o -DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \ - cdjpeg.o -TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o - - -all: libjpeg.a cjpeg djpeg jpegtran rdjpgcom wrjpgcom - -libjpeg.a: $(LIBOBJECTS) - $(RM) libjpeg.a - $(AR) libjpeg.a $(LIBOBJECTS) - $(AR2) libjpeg.a - -cjpeg: $(COBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.a $(LDLIBS) - -djpeg: $(DOBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.a $(LDLIBS) - -jpegtran: $(TROBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.a $(LDLIBS) - -rdjpgcom: rdjpgcom.o - $(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS) - -wrjpgcom: wrjpgcom.o - $(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS) - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: - $(RM) *.o cjpeg djpeg jpegtran libjpeg.a rdjpgcom wrjpgcom - $(RM) core testout* - -test: cjpeg djpeg jpegtran - $(RM) testout* - ./djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - ./cjpeg -dct int -outfile testout.jpg testimg.ppm - ./djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - ./cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - ./jpegtran -outfile testoutt.jpg testprog.jpg - cmp testimg.ppm testout.ppm - cmp testimg.bmp testout.bmp - cmp testimg.jpg testout.jpg - cmp testimg.ppm testoutp.ppm - cmp testimgp.jpg testoutp.jpg - cmp testorig.jpg testoutt.jpg - - -jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h -jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -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 transupp.h jversion.h -rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h -cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h -rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h diff --git a/makefile.bcc b/makefile.bcc deleted file mode 100644 index a1cfcde6..00000000 --- a/makefile.bcc +++ /dev/null @@ -1,285 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is suitable for Borland C on MS-DOS or OS/2. -# It works with Borland C++ for DOS, revision 3.0 or later, -# and has been tested with Borland C++ for OS/2. -# Watch out for optimization bugs in the OS/2 compilers --- see notes below! -# Thanks to Tom Wright and Ge' Weijers (original DOS) and -# Ken Porter (OS/2) for this file. - -# Read installation instructions before saying "make" !! - -# Are we under DOS or OS/2? -!if !$d(DOS) && !$d(OS2) -!if $d(__OS2__) -OS2=1 -!else -DOS=1 -!endif -!endif - -# The name of your C compiler: -CC= bcc - -# You may need to adjust these cc options: -!if $d(DOS) -CFLAGS= -O2 -mm -w-par -w-stu -w-ccc -w-rch -!else -CFLAGS= -O1 -w-par -w-stu -w-ccc -w-rch -!endif -# -O2 enables full code optimization (for pre-3.0 Borland C++, use -O -G -Z). -# -O2 is buggy in Borland OS/2 C++ revision 2.0, so use -O1 there for now. -# If you have Borland OS/2 C++ revision 1.0, use -O or no optimization at all. -# -mm selects medium memory model (near data, far code pointers; DOS only!) -# -w-par suppresses warnings about unused function parameters -# -w-stu suppresses warnings about incomplete structures -# -w-ccc suppresses warnings about compile-time-constant conditions -# -w-rch suppresses warnings about unreachable code -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time cc options: -!if $d(DOS) -LDFLAGS= -mm -# memory model option here must match CFLAGS! -!else -LDFLAGS= -# -lai full-screen app -# -lc case-significant link -!endif - -# Put here the object file name for the correct system-dependent memory -# manager file. -# For DOS, we recommend jmemdos.c and jmemdosa.asm. -# For OS/2, we recommend jmemnobs.c (flat memory!) -# SYSDEPMEMLIB must list the same files with "+" signs for the librarian. -!if $d(DOS) -SYSDEPMEM= jmemdos.obj jmemdosa.obj -SYSDEPMEMLIB= +jmemdos.obj +jmemdosa.obj -!else -SYSDEPMEM= jmemnobs.obj -SYSDEPMEMLIB= +jmemnobs.obj -!endif - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \ - jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \ - jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \ - jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj -# decompression library object files -DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \ - jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \ - jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \ - jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \ - jquant1.obj jquant2.obj jdmerge.obj -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \ - rdswitch.obj cdjpeg.obj -DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \ - rdcolmap.obj cdjpeg.obj -TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj - - -all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.lib: $(LIBOBJECTS) - - del libjpeg.lib - tlib libjpeg.lib /E /C @&&| -+jcapimin.obj +jcapistd.obj +jctrans.obj +jcparam.obj +jdatadst.obj & -+jcinit.obj +jcmaster.obj +jcmarker.obj +jcmainct.obj +jcprepct.obj & -+jccoefct.obj +jccolor.obj +jcsample.obj +jchuff.obj +jcphuff.obj & -+jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj +jfdctint.obj +jdapimin.obj & -+jdapistd.obj +jdtrans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj & -+jdmarker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj +jdcoefct.obj & -+jdpostct.obj +jddctmgr.obj +jidctfst.obj +jidctflt.obj +jidctint.obj & -+jidctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj +jquant2.obj & -+jdmerge.obj +jcomapi.obj +jutils.obj +jerror.obj +jmemmgr.obj & -$(SYSDEPMEMLIB) -| - -cjpeg.exe: $(COBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) -ecjpeg.exe $(COBJECTS) libjpeg.lib - -djpeg.exe: $(DOBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) -edjpeg.exe $(DOBJECTS) libjpeg.lib - -jpegtran.exe: $(TROBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) -ejpegtran.exe $(TROBJECTS) libjpeg.lib - -rdjpgcom.exe: rdjpgcom.c -!if $d(DOS) - $(CC) -ms -O rdjpgcom.c -!else - $(CC) $(CFLAGS) rdjpgcom.c -!endif - -# On DOS, wrjpgcom needs large model so it can malloc a 64K chunk -wrjpgcom.exe: wrjpgcom.c -!if $d(DOS) - $(CC) -ml -O wrjpgcom.c -!else - $(CC) $(CFLAGS) wrjpgcom.c -!endif - -# This "{}" syntax allows Borland Make to "batch" source files. -# In this way, each run of the compiler can build many modules. -.c.obj: - $(CC) $(CFLAGS) -c{ $<} - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: - - del *.obj - - del libjpeg.lib - - del cjpeg.exe - - del djpeg.exe - - del jpegtran.exe - - del rdjpgcom.exe - - del wrjpgcom.exe - - del testout*.* - -test: cjpeg.exe djpeg.exe jpegtran.exe - - del testout*.* - djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - cjpeg -dct int -outfile testout.jpg testimg.ppm - djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - jpegtran -outfile testoutt.jpg testprog.jpg -!if $d(DOS) - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b testorig.jpg testoutt.jpg -!else - echo n > n.tmp - comp testimg.ppm testout.ppm < n.tmp - comp testimg.bmp testout.bmp < n.tmp - comp testimg.jpg testout.jpg < n.tmp - comp testimg.ppm testoutp.ppm < n.tmp - comp testimgp.jpg testoutp.jpg < n.tmp - comp testorig.jpg testoutt.jpg < n.tmp - del n.tmp -!endif - - -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 transupp.h jversion.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.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 -transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.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 -jmemdosa.obj: jmemdosa.asm - tasm /mx jmemdosa.asm diff --git a/makefile.cfg b/makefile.cfg index f25e42e3..7bb3b9df 100644 --- a/makefile.cfg +++ b/makefile.cfg @@ -133,7 +133,7 @@ DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(O) wrtarga.$(O) wrrle.$(O) \ TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O) -all: @A2K_DEPS@ libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom +all: @A2K_DEPS@ libjpeg.$(A) # Special compilation rules to support ansi2knr and libtool. .SUFFIXES: .lo .la diff --git a/makefile.dj b/makefile.dj deleted file mode 100644 index f766d25e..00000000 --- a/makefile.dj +++ /dev/null @@ -1,220 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is for DJGPP (Delorie's GNU C port on MS-DOS), v2.0 or later. -# Thanks to Frank J. Donahoe for this version. - -# Read installation instructions before saying "make" !! - -# The name of your C compiler: -CC= gcc - -# You may need to adjust these cc options: -CFLAGS= -O2 -Wall -I. -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time cc options: -LDFLAGS= -s - -# To link any special libraries, add the necessary -l commands here. -LDLIBS= - -# Put here the object file name for the correct system-dependent memory -# manager file. For DJGPP this is usually jmemnobs.o, but you could -# use jmemname.o if you want to use named temp files instead of swap space. -SYSDEPMEM= jmemnobs.o - -# miscellaneous OS-dependent stuff -# linker -LN= $(CC) -# file deletion command -RM= del -# library (.a) file creation command -AR= ar rc -# second step in .a creation (use "touch" if not needed) -AR2= ranlib - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \ - jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \ - jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \ - jfdctint.o -# decompression library object files -DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \ - jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \ - jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \ - jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o -# These objectfiles are included in libjpeg.a -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \ - cdjpeg.o -DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \ - cdjpeg.o -TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o - - -all: libjpeg.a cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.a: $(LIBOBJECTS) - $(RM) libjpeg.a - $(AR) libjpeg.a $(LIBOBJECTS) - $(AR2) libjpeg.a - -cjpeg.exe: $(COBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o cjpeg.exe $(COBJECTS) libjpeg.a $(LDLIBS) - -djpeg.exe: $(DOBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o djpeg.exe $(DOBJECTS) libjpeg.a $(LDLIBS) - -jpegtran.exe: $(TROBJECTS) libjpeg.a - $(LN) $(LDFLAGS) -o jpegtran.exe $(TROBJECTS) libjpeg.a $(LDLIBS) - -rdjpgcom.exe: rdjpgcom.o - $(LN) $(LDFLAGS) -o rdjpgcom.exe rdjpgcom.o $(LDLIBS) - -wrjpgcom.exe: wrjpgcom.o - $(LN) $(LDFLAGS) -o wrjpgcom.exe wrjpgcom.o $(LDLIBS) - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: - $(RM) *.o - $(RM) cjpeg.exe - $(RM) djpeg.exe - $(RM) jpegtran.exe - $(RM) rdjpgcom.exe - $(RM) wrjpgcom.exe - $(RM) libjpeg.a - $(RM) testout*.* - -test: cjpeg.exe djpeg.exe jpegtran.exe - $(RM) testout*.* - ./djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - ./cjpeg -dct int -outfile testout.jpg testimg.ppm - ./djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - ./cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - ./jpegtran -outfile testoutt.jpg testprog.jpg - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b testorig.jpg testoutt.jpg - - -jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h -jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -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 transupp.h jversion.h -rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h -cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h -rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h diff --git a/makefile.manx b/makefile.manx deleted file mode 100644 index 4cb42d17..00000000 --- a/makefile.manx +++ /dev/null @@ -1,214 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is for Amiga systems using Manx Aztec C ver 5.x. -# Thanks to D.J. James (djjames@cup.portal.com) for this version. - -# Read installation instructions before saying "make" !! - -# The name of your C compiler: -CC= cc - -# You may need to adjust these cc options: -# Uncomment for generic 68000 code (will work on any Amiga) -ARCHFLAGS= -sn - -# Uncomment for 68020/68030 code (faster, but won't run on 68000 CPU) -#ARCHFLAGS= -c2 - -CFLAGS= -MC -MD $(ARCHFLAGS) -spfam -r4 - -# Link-time cc options: -LDFLAGS= -g - -# To link any special libraries, add the necessary -l commands here. -LDLIBS= -lml -lcl - -# Put here the object file name for the correct system-dependent memory -# manager file. For Amiga we recommend jmemname.o. -SYSDEPMEM= jmemname.o - -# miscellaneous OS-dependent stuff -# linker -LN= ln -# file deletion command -RM= delete quiet -# library (.lib) file creation command -AR= lb - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \ - jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \ - jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \ - jfdctint.o -# decompression library object files -DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \ - jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \ - jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \ - jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \ - cdjpeg.o -DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \ - cdjpeg.o -TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o - - -all: libjpeg.lib cjpeg djpeg jpegtran rdjpgcom wrjpgcom - -libjpeg.lib: $(LIBOBJECTS) - -$(RM) libjpeg.lib - $(AR) libjpeg.lib $(LIBOBJECTS) - -cjpeg: $(COBJECTS) libjpeg.lib - $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.lib $(LDLIBS) - -djpeg: $(DOBJECTS) libjpeg.lib - $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.lib $(LDLIBS) - -jpegtran: $(TROBJECTS) libjpeg.lib - $(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.lib $(LDLIBS) - -rdjpgcom: rdjpgcom.o - $(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.o $(LDLIBS) - -wrjpgcom: wrjpgcom.o - $(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS) - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: - -$(RM) *.o cjpeg djpeg jpegtran libjpeg.lib rdjpgcom wrjpgcom - -$(RM) core testout*.* - -test: cjpeg djpeg jpegtran - -$(RM) testout*.* - djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - cjpeg -dct int -outfile testout.jpg testimg.ppm - djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - jpegtran -outfile testoutt.jpg testprog.jpg - cmp testimg.ppm testout.ppm - cmp testimg.bmp testout.bmp - cmp testimg.jpg testout.jpg - cmp testimg.ppm testoutp.ppm - cmp testimgp.jpg testoutp.jpg - cmp testorig.jpg testoutt.jpg - - -jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmarker.o: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmaster.o: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jctrans.o: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdcoefct.o: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmarker.o: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdtrans.o: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jerror.o: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h -jfdctflt.o: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctfst.o: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctint.o: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctflt.o: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jutils.o: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jmemmgr.o: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemansi.o: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -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 transupp.h jversion.h -rdjpgcom.o: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.o: wrjpgcom.c jinclude.h jconfig.h -cdjpeg.o: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdcolmap.o: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdswitch.o: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -transupp.o: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h -rdppm.o: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrppm.o: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdgif.o: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrgif.o: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdtarga.o: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrtarga.o: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdbmp.o: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrbmp.o: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdrle.o: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrrle.o: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h diff --git a/makefile.mc6 b/makefile.mc6 deleted file mode 100644 index 6aff0546..00000000 --- a/makefile.mc6 +++ /dev/null @@ -1,249 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is for Microsoft C for MS-DOS, version 6.00A and up. -# Use NMAKE, not Microsoft's brain-damaged MAKE. -# Thanks to Alan Wright and Chris Turner of Olivetti Research Ltd. - -# Read installation instructions before saying "nmake" !! - -# You may need to adjust these compiler options: -CFLAGS = -AM -Oecigt -Gs -W3 -# -AM medium memory model (or use -AS for small model, if you remove features) -# -Oecigt -Gs maximum safe optimisation (-Ol has bugs in MSC 6.00A) -# -W3 warning level 3 -# You might also want to add -G2 if you have an 80286, etc. -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Jan-Herman Buining suggests the following switches for MS C 8.0 and a 486: -# CFLAGS = /AM /f- /FPi87 /G3 /Gs /Gy /Ob1 /Oc /Oe /Og /Oi /Ol /On /Oo /Ot \ -# /OV4 /W3 -# except for jquant1.c, which must be compiled with /Oo- to avoid a compiler -# crash. - -# Ingar Steinsland suggests the following switches when building -# a 16-bit Windows DLL: -# CFLAGS = -ALw -Gsw -Zpe -W3 -O2 -Zi -Zd - -# Put here the object file name for the correct system-dependent memory -# manager file. For DOS, we recommend jmemdos.c and jmemdosa.asm. -# (But not for Windows; see install.doc if you use this makefile for Windows.) -SYSDEPMEM= jmemdos.obj jmemdosa.obj -# SYSDEPMEMLIB must list the same files with "+" signs for the librarian. -SYSDEPMEMLIB= +jmemdos.obj +jmemdosa.obj - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \ - jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \ - jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \ - jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj -# decompression library object files -DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \ - jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \ - jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \ - jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \ - jquant1.obj jquant2.obj jdmerge.obj -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \ - rdswitch.obj cdjpeg.obj -DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \ - rdcolmap.obj cdjpeg.obj -TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj - -# need linker response file because file list > 128 chars -RFILE = libjpeg.ans - - -all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.lib: $(LIBOBJECTS) $(RFILE) - del libjpeg.lib - lib @$(RFILE) - -# linker response file for building libjpeg.lib -$(RFILE) : makefile - del $(RFILE) - echo libjpeg.lib >$(RFILE) -# silly want-to-create-it prompt: - echo y >>$(RFILE) - echo +jcapimin.obj +jcapistd.obj +jctrans.obj +jcparam.obj & >>$(RFILE) - echo +jdatadst.obj +jcinit.obj +jcmaster.obj +jcmarker.obj & >>$(RFILE) - echo +jcmainct.obj +jcprepct.obj +jccoefct.obj & >>$(RFILE) - echo +jccolor.obj +jcsample.obj +jchuff.obj +jcphuff.obj & >>$(RFILE) - echo +jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj & >>$(RFILE) - echo +jfdctint.obj +jdapimin.obj +jdapistd.obj & >>$(RFILE) - echo +jdtrans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj & >>$(RFILE) - echo +jdmarker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj & >>$(RFILE) - echo +jdcoefct.obj +jdpostct.obj +jddctmgr.obj & >>$(RFILE) - 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 & >>$(RFILE) - echo $(SYSDEPMEMLIB) ; >>$(RFILE) - -cjpeg.exe: $(COBJECTS) libjpeg.lib - echo $(COBJECTS) >cjpeg.lst - link /STACK:4096 /EXEPACK @cjpeg.lst, cjpeg.exe, , libjpeg.lib, ; - del cjpeg.lst - -djpeg.exe: $(DOBJECTS) libjpeg.lib - echo $(DOBJECTS) >djpeg.lst - link /STACK:4096 /EXEPACK @djpeg.lst, djpeg.exe, , libjpeg.lib, ; - del djpeg.lst - -jpegtran.exe: $(TROBJECTS) libjpeg.lib - link /STACK:4096 /EXEPACK $(TROBJECTS), jpegtran.exe, , libjpeg.lib, ; - -rdjpgcom.exe: rdjpgcom.c - $(CC) -AS -O -W3 rdjpgcom.c - -# wrjpgcom needs large model so it can malloc a 64K chunk -wrjpgcom.exe: wrjpgcom.c - $(CC) -AL -O -W3 wrjpgcom.c - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: - del *.obj - del libjpeg.lib - del cjpeg.exe - del djpeg.exe - del jpegtran.exe - del rdjpgcom.exe - del wrjpgcom.exe - del testout*.* - -test: cjpeg.exe djpeg.exe jpegtran.exe - del testout*.* - djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - cjpeg -dct int -outfile testout.jpg testimg.ppm - djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - jpegtran -outfile testoutt.jpg testprog.jpg - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b 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 -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 transupp.h jversion.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.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 -transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.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 -jmemdosa.obj : jmemdosa.asm - masm /mx $*; diff --git a/makefile.mms b/makefile.mms deleted file mode 100644 index cf130e5b..00000000 --- a/makefile.mms +++ /dev/null @@ -1,218 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is for use with MMS on Digital VMS systems. -# Thanks to Rick Dyson (dyson@iowasp.physics.uiowa.edu) -# and Tim Bell (tbell@netcom.com) for their help. - -# Read installation instructions before saying "MMS" !! - -# You may need to adjust these cc options: -CFLAGS= $(CFLAGS) /NoDebug /Optimize -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via /Define switches here. -.ifdef ALPHA -OPT= -.else -OPT= ,Sys$Disk:[]MAKVMS.OPT/Option -.endif - -# Put here the object file name for the correct system-dependent memory -# manager file. For Unix this is usually jmemnobs.o, but you may want -# to use jmemansi.o or jmemname.o if you have limited swap space. -SYSDEPMEM= jmemnobs.obj - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \ - jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \ - jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \ - jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj -# decompression library object files -DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \ - jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \ - jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \ - jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \ - jquant1.obj jquant2.obj jdmerge.obj -# These objectfiles are included in libjpeg.olb -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \ - rdswitch.obj cdjpeg.obj -DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \ - rdcolmap.obj cdjpeg.obj -TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj -# objectfile lists with commas --- what a crock -COBJLIST= cjpeg.obj,rdppm.obj,rdgif.obj,rdtarga.obj,rdrle.obj,rdbmp.obj,\ - rdswitch.obj,cdjpeg.obj -DOBJLIST= djpeg.obj,wrppm.obj,wrgif.obj,wrtarga.obj,wrrle.obj,wrbmp.obj,\ - rdcolmap.obj,cdjpeg.obj -TROBJLIST= jpegtran.obj,rdswitch.obj,cdjpeg.obj,transupp.obj -LIBOBJLIST= jcapimin.obj,jcapistd.obj,jctrans.obj,jcparam.obj,jdatadst.obj,\ - jcinit.obj,jcmaster.obj,jcmarker.obj,jcmainct.obj,jcprepct.obj,\ - jccoefct.obj,jccolor.obj,jcsample.obj,jchuff.obj,jcphuff.obj,\ - jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj,jfdctint.obj,jdapimin.obj,\ - jdapistd.obj,jdtrans.obj,jdatasrc.obj,jdmaster.obj,jdinput.obj,\ - jdmarker.obj,jdhuff.obj,jdphuff.obj,jdmainct.obj,jdcoefct.obj,\ - jdpostct.obj,jddctmgr.obj,jidctfst.obj,jidctflt.obj,jidctint.obj,\ - jidctred.obj,jdsample.obj,jdcolor.obj,jquant1.obj,jquant2.obj,\ - jdmerge.obj,jcomapi.obj,jutils.obj,jerror.obj,jmemmgr.obj,$(SYSDEPMEM) - - -.first - @- Define /NoLog Sys Sys$Library - -ALL : libjpeg.olb cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - @ Continue - -libjpeg.olb : $(LIBOBJECTS) - Library /Create libjpeg.olb $(LIBOBJLIST) - -cjpeg.exe : $(COBJECTS) libjpeg.olb - $(LINK) $(LFLAGS) /Executable = cjpeg.exe $(COBJLIST),libjpeg.olb/Library$(OPT) - -djpeg.exe : $(DOBJECTS) libjpeg.olb - $(LINK) $(LFLAGS) /Executable = djpeg.exe $(DOBJLIST),libjpeg.olb/Library$(OPT) - -jpegtran.exe : $(TROBJECTS) libjpeg.olb - $(LINK) $(LFLAGS) /Executable = jpegtran.exe $(TROBJLIST),libjpeg.olb/Library$(OPT) - -rdjpgcom.exe : rdjpgcom.obj - $(LINK) $(LFLAGS) /Executable = rdjpgcom.exe rdjpgcom.obj$(OPT) - -wrjpgcom.exe : wrjpgcom.obj - $(LINK) $(LFLAGS) /Executable = wrjpgcom.exe wrjpgcom.obj$(OPT) - -jconfig.h : jconfig.vms - @- Copy jconfig.vms jconfig.h - -clean : - @- Set Protection = Owner:RWED *.*;-1 - @- Set Protection = Owner:RWED *.OBJ - - Purge /NoLog /NoConfirm *.* - - Delete /NoLog /NoConfirm *.OBJ; - -test : cjpeg.exe djpeg.exe jpegtran.exe - mcr sys$disk:[]djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - mcr sys$disk:[]djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - mcr sys$disk:[]cjpeg -dct int -outfile testout.jpg testimg.ppm - mcr sys$disk:[]djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - mcr sys$disk:[]cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - mcr sys$disk:[]jpegtran -outfile testoutt.jpg testprog.jpg - - Backup /Compare/Log testimg.ppm testout.ppm - - Backup /Compare/Log testimg.bmp testout.bmp - - Backup /Compare/Log testimg.jpg testout.jpg - - Backup /Compare/Log testimg.ppm testoutp.ppm - - Backup /Compare/Log testimgp.jpg testoutp.jpg - - 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 -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 transupp.h jversion.h -rdjpgcom.obj : rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj : wrjpgcom.c jinclude.h jconfig.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 -transupp.obj : transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.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 deleted file mode 100644 index f296faf0..00000000 --- a/makefile.sas +++ /dev/null @@ -1,252 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is for Amiga systems using SAS C 6.0 and up. -# Thanks to Ed Hanway, Mark Rinfret, and Jim Zepeda. - -# Read installation instructions before saying "make" !! - -# The name of your C compiler: -CC= sc - -# You may need to adjust these cc options: -# Uncomment the following lines for generic 680x0 version -ARCHFLAGS= cpu=any -SUFFIX= - -# Uncomment the following lines for 68030-only version -#ARCHFLAGS= cpu=68030 -#SUFFIX=.030 - -CFLAGS= nostackcheck data=near parms=register optimize $(ARCHFLAGS) \ - ignore=104 ignore=304 ignore=306 -# ignore=104 disables warnings for mismatched const qualifiers -# ignore=304 disables warnings for variables being optimized out -# ignore=306 disables warnings for the inlining of functions -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via define switches here. - -# Link-time cc options: -LDFLAGS= SC SD ND BATCH - -# To link any special libraries, add the necessary commands here. -LDLIBS= LIB:scm.lib LIB:sc.lib - -# Put here the object file name for the correct system-dependent memory -# manager file. For Amiga we recommend jmemname.o. -SYSDEPMEM= jmemname.o - -# miscellaneous OS-dependent stuff -# linker -LN= slink -# file deletion command -RM= delete quiet -# library (.lib) file creation command -AR= oml - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o \ - jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \ - jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \ - jfdctint.o -# decompression library object files -DLIBOBJECTS= jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o \ - jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \ - jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \ - jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o \ - cdjpeg.o -DOBJECTS= djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o wrbmp.o rdcolmap.o \ - cdjpeg.o -TROBJECTS= jpegtran.o rdswitch.o cdjpeg.o transupp.o - - -all: libjpeg.lib cjpeg$(SUFFIX) djpeg$(SUFFIX) jpegtran$(SUFFIX) rdjpgcom$(SUFFIX) wrjpgcom$(SUFFIX) - -# note: do several AR steps to avoid command line length limitations - -libjpeg.lib: $(LIBOBJECTS) - -$(RM) libjpeg.lib - $(AR) libjpeg.lib r $(CLIBOBJECTS) - $(AR) libjpeg.lib r $(DLIBOBJECTS) - $(AR) libjpeg.lib r $(COMOBJECTS) - -cjpeg$(SUFFIX): $(COBJECTS) libjpeg.lib - $(LN) - -# You may want to adjust these compiler options: -CFLAGS= $(cflags) $(cdebug) $(cvars) -I. -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time options: -LDFLAGS= $(ldebug) $(conlflags) - -# To link any special libraries, add the necessary commands here. -LDLIBS= $(conlibs) - -# Put here the object file name for the correct system-dependent memory -# manager file. For NT we suggest jmemnobs.obj, which expects the OS to -# provide adequate virtual memory. -SYSDEPMEM= jmemnobs.obj - -# miscellaneous OS-dependent stuff -# file deletion command -RM= del - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c \ - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \ - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \ - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj \ - jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \ - jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \ - jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj -# decompression library object files -DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj \ - jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj \ - jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \ - jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \ - jquant1.obj jquant2.obj jdmerge.obj -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj \ - rdswitch.obj cdjpeg.obj -DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj \ - rdcolmap.obj cdjpeg.obj -TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj - -# Template command for compiling .c to .obj -.c.obj: - $(cc) $(CFLAGS) $*.c - - -all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.lib: $(LIBOBJECTS) - $(RM) libjpeg.lib - lib -out:libjpeg.lib $(LIBOBJECTS) - -cjpeg.exe: $(COBJECTS) libjpeg.lib - $(link) $(LDFLAGS) -out:cjpeg.exe $(COBJECTS) libjpeg.lib $(LDLIBS) - -djpeg.exe: $(DOBJECTS) libjpeg.lib - $(link) $(LDFLAGS) -out:djpeg.exe $(DOBJECTS) libjpeg.lib $(LDLIBS) - -jpegtran.exe: $(TROBJECTS) libjpeg.lib - $(link) $(LDFLAGS) -out:jpegtran.exe $(TROBJECTS) libjpeg.lib $(LDLIBS) - -rdjpgcom.exe: rdjpgcom.obj - $(link) $(LDFLAGS) -out:rdjpgcom.exe rdjpgcom.obj $(LDLIBS) - -wrjpgcom.exe: wrjpgcom.obj - $(link) $(LDFLAGS) -out:wrjpgcom.exe wrjpgcom.obj $(LDLIBS) - - -clean: - $(RM) *.obj *.exe libjpeg.lib - $(RM) testout* - -test: cjpeg.exe djpeg.exe jpegtran.exe - $(RM) testout* - .\djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - .\djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - .\cjpeg -dct int -outfile testout.jpg testimg.ppm - .\djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - .\cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - .\jpegtran -outfile testoutt.jpg testprog.jpg - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b 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 -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 transupp.h jversion.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.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 -transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.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.vms b/makefile.vms deleted file mode 100644 index a42358d0..00000000 --- a/makefile.vms +++ /dev/null @@ -1,142 +0,0 @@ -$! Makefile for Independent JPEG Group's software -$! -$! This is a command procedure for Digital VMS systems that do not have MMS. -$! It builds the JPEG software by brute force, recompiling everything whether -$! or not it is necessary. It then runs the basic self-test. -$! Thanks to Rick Dyson (dyson@iowasp.physics.uiowa.edu) -$! 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 = "" -$ Else -$ OPT = ",Sys$Disk:[]makvms.opt/Option" -$ EndIf -$ -$ DoCompile := CC /NoDebug /Optimize /NoList -$! -$ DoCompile jcapimin.c -$ DoCompile jcapistd.c -$ DoCompile jctrans.c -$ DoCompile jcparam.c -$ DoCompile jdatadst.c -$ DoCompile jcinit.c -$ DoCompile jcmaster.c -$ DoCompile jcmarker.c -$ DoCompile jcmainct.c -$ DoCompile jcprepct.c -$ DoCompile jccoefct.c -$ DoCompile jccolor.c -$ DoCompile jcsample.c -$ DoCompile jchuff.c -$ DoCompile jcphuff.c -$ DoCompile jcdctmgr.c -$ DoCompile jfdctfst.c -$ DoCompile jfdctflt.c -$ DoCompile jfdctint.c -$ DoCompile jdapimin.c -$ DoCompile jdapistd.c -$ DoCompile jdtrans.c -$ DoCompile jdatasrc.c -$ DoCompile jdmaster.c -$ DoCompile jdinput.c -$ DoCompile jdmarker.c -$ DoCompile jdhuff.c -$ DoCompile jdphuff.c -$ DoCompile jdmainct.c -$ DoCompile jdcoefct.c -$ DoCompile jdpostct.c -$ DoCompile jddctmgr.c -$ DoCompile jidctfst.c -$ DoCompile jidctflt.c -$ DoCompile jidctint.c -$ DoCompile jidctred.c -$ DoCompile jdsample.c -$ DoCompile jdcolor.c -$ DoCompile jquant1.c -$ DoCompile jquant2.c -$ DoCompile jdmerge.c -$ DoCompile jcomapi.c -$ DoCompile jutils.c -$ DoCompile jerror.c -$ DoCompile jmemmgr.c -$ DoCompile jmemnobs.c -$! -$ Library /Create libjpeg.olb jcapimin.obj,jcapistd.obj,jctrans.obj, - - jcparam.obj,jdatadst.obj,jcinit.obj,jcmaster.obj,jcmarker.obj, - - jcmainct.obj,jcprepct.obj,jccoefct.obj,jccolor.obj,jcsample.obj, - - jchuff.obj,jcphuff.obj,jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj, - - jfdctint.obj,jdapimin.obj,jdapistd.obj,jdtrans.obj,jdatasrc.obj, - - jdmaster.obj,jdinput.obj,jdmarker.obj,jdhuff.obj,jdphuff.obj, - - jdmainct.obj,jdcoefct.obj,jdpostct.obj,jddctmgr.obj,jidctfst.obj, - - jidctflt.obj,jidctint.obj,jidctred.obj,jdsample.obj,jdcolor.obj, - - jquant1.obj,jquant2.obj,jdmerge.obj,jcomapi.obj,jutils.obj, - - jerror.obj,jmemmgr.obj,jmemnobs.obj -$! -$ DoCompile cjpeg.c -$ DoCompile rdppm.c -$ DoCompile rdgif.c -$ DoCompile rdtarga.c -$ DoCompile rdrle.c -$ DoCompile rdbmp.c -$ DoCompile rdswitch.c -$ DoCompile cdjpeg.c -$! -$ 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 -$ DoCompile wrgif.c -$ DoCompile wrtarga.c -$ DoCompile wrrle.c -$ DoCompile wrbmp.c -$ DoCompile rdcolmap.c -$ DoCompile cdjpeg.c -$! -$ 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 -$ DoCompile transupp.c -$! -$ Link /NoMap /Executable = jpegtran.exe jpegtran.obj,rdswitch.obj, - - cdjpeg.obj,transupp.obj,libjpeg.olb/Library'OPT' -$! -$ DoCompile rdjpgcom.c -$ Link /NoMap /Executable = rdjpgcom.exe rdjpgcom.obj'OPT' -$! -$ DoCompile wrjpgcom.c -$ Link /NoMap /Executable = wrjpgcom.exe wrjpgcom.obj'OPT' -$! -$! Run the self-test -$! -$ mcr sys$disk:[]djpeg -dct int -ppm -outfile testout.ppm testorig.jpg -$ mcr sys$disk:[]djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg -$ mcr sys$disk:[]cjpeg -dct int -outfile testout.jpg testimg.ppm -$ mcr sys$disk:[]djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg -$ mcr sys$disk:[]cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm -$ mcr sys$disk:[]jpegtran -outfile testoutt.jpg testprog.jpg -$ Backup /Compare/Log testimg.ppm testout.ppm -$ Backup /Compare/Log testimg.bmp testout.bmp -$ Backup /Compare/Log testimg.jpg testout.jpg -$ 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 deleted file mode 100644 index d953e466..00000000 --- a/makefile.wat +++ /dev/null @@ -1,233 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is suitable for Watcom C/C++ 10.0 on MS-DOS (using -# dos4g extender), OS/2, and Windows NT console mode. -# Thanks to Janos Haide, jhaide@btrvtech.com. - -# Read installation instructions before saying "wmake" !! - -# Uncomment line for desired system -SYSTEM=DOS -#SYSTEM=OS2 -#SYSTEM=NT - -# The name of your C compiler: -CC= wcl386 - -# You may need to adjust these cc options: -CFLAGS= -4r -ort -wx -zq -bt=$(SYSTEM) -# Caution: avoid -ol or -ox; these generate bad code with 10.0 or 10.0a. -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time cc options: -!ifeq SYSTEM DOS -LDFLAGS= -zq -l=dos4g -!else ifeq SYSTEM OS2 -LDFLAGS= -zq -l=os2v2 -!else ifeq SYSTEM NT -LDFLAGS= -zq -l=nt -!endif - -# Put here the object file name for the correct system-dependent memory -# manager file. jmemnobs should work fine for dos4g or OS/2 environment. -SYSDEPMEM= jmemnobs.obj - -# End of configurable options. - - -# source files: JPEG library proper -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c & - jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c & - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c & - jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 -# 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 rdjpgcom.c wrjpgcom.c cdjpeg.c & - rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c & - rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c -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 transupp.h -# documentation, test, and support files -DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 & - wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc & - coderules.doc filelist.doc change.log -MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc & - makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds & - makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st & - maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms & - makvms.opt -CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat & - jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas & - jconfig.vms -CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh -OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm -TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg & - testimgp.jpg -DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) & - $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) -# library object files common to compression and decompression -COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) -# compression library object files -CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj & - jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj & - jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj & - jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj -# decompression library object files -DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj & - jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj & - jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj & - jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj & - jquant1.obj jquant2.obj jdmerge.obj -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -# object files for sample applications (excluding library files) -COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj & - rdswitch.obj cdjpeg.obj -DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj & - rdcolmap.obj cdjpeg.obj -TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj - - -all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.lib: $(LIBOBJECTS) - - del libjpeg.lib - * wlib -n libjpeg.lib $(LIBOBJECTS) - -cjpeg.exe: $(COBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(COBJECTS) libjpeg.lib - -djpeg.exe: $(DOBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(DOBJECTS) libjpeg.lib - -jpegtran.exe: $(TROBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(TROBJECTS) libjpeg.lib - -rdjpgcom.exe: rdjpgcom.c - $(CC) $(CFLAGS) $(LDFLAGS) rdjpgcom.c - -wrjpgcom.exe: wrjpgcom.c - $(CC) $(CFLAGS) $(LDFLAGS) wrjpgcom.c - -.c.obj: - $(CC) $(CFLAGS) -c $< - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: .SYMBOLIC - - del *.obj - - del libjpeg.lib - - del cjpeg.exe - - del djpeg.exe - - del jpegtran.exe - - del rdjpgcom.exe - - del wrjpgcom.exe - - del testout*.* - -test: cjpeg.exe djpeg.exe jpegtran.exe .SYMBOLIC - - del testout*.* - djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - cjpeg -dct int -outfile testout.jpg testimg.ppm - djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - jpegtran -outfile testoutt.jpg testprog.jpg -!ifeq SYSTEM DOS - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b testorig.jpg testoutt.jpg -!else - echo n > n.tmp - comp testimg.ppm testout.ppm < n.tmp - comp testimg.bmp testout.bmp < n.tmp - comp testimg.jpg testout.jpg < n.tmp - comp testimg.ppm testoutp.ppm < n.tmp - comp testimgp.jpg testoutp.jpg < n.tmp - comp testorig.jpg testoutt.jpg < n.tmp - del n.tmp -!endif - - -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 transupp.h jversion.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.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 -transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.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/makelib.ds b/makelib.ds deleted file mode 100644 index c7ad36d0..00000000 --- a/makelib.ds +++ /dev/null @@ -1,1046 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -!IF "$(CFG)" == "" -CFG=jpeg - Win32 -!MESSAGE No configuration specified. Defaulting to jpeg - Win32. -!ENDIF - -!IF "$(CFG)" != "jpeg - Win32" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "jpeg.mak" CFG="jpeg - Win32" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "jpeg - Win32" (based on "Win32 (x86) Static Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "jpeg - Win32" -CPP=cl.exe - -!IF "$(CFG)" == "jpeg - Win32" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -OUTDIR=.\Release -INTDIR=.\Release - -ALL : "$(OUTDIR)\jpeg.lib" - -CLEAN : - -@erase "$(INTDIR)\jcapimin.obj" - -@erase "$(INTDIR)\jcapistd.obj" - -@erase "$(INTDIR)\jctrans.obj" - -@erase "$(INTDIR)\jcparam.obj" - -@erase "$(INTDIR)\jdatadst.obj" - -@erase "$(INTDIR)\jcinit.obj" - -@erase "$(INTDIR)\jcmaster.obj" - -@erase "$(INTDIR)\jcmarker.obj" - -@erase "$(INTDIR)\jcmainct.obj" - -@erase "$(INTDIR)\jcprepct.obj" - -@erase "$(INTDIR)\jccoefct.obj" - -@erase "$(INTDIR)\jccolor.obj" - -@erase "$(INTDIR)\jcsample.obj" - -@erase "$(INTDIR)\jchuff.obj" - -@erase "$(INTDIR)\jcphuff.obj" - -@erase "$(INTDIR)\jcdctmgr.obj" - -@erase "$(INTDIR)\jfdctfst.obj" - -@erase "$(INTDIR)\jfdctflt.obj" - -@erase "$(INTDIR)\jfdctint.obj" - -@erase "$(INTDIR)\jdapimin.obj" - -@erase "$(INTDIR)\jdapistd.obj" - -@erase "$(INTDIR)\jdtrans.obj" - -@erase "$(INTDIR)\jdatasrc.obj" - -@erase "$(INTDIR)\jdmaster.obj" - -@erase "$(INTDIR)\jdinput.obj" - -@erase "$(INTDIR)\jdmarker.obj" - -@erase "$(INTDIR)\jdhuff.obj" - -@erase "$(INTDIR)\jdphuff.obj" - -@erase "$(INTDIR)\jdmainct.obj" - -@erase "$(INTDIR)\jdcoefct.obj" - -@erase "$(INTDIR)\jdpostct.obj" - -@erase "$(INTDIR)\jddctmgr.obj" - -@erase "$(INTDIR)\jidctfst.obj" - -@erase "$(INTDIR)\jidctflt.obj" - -@erase "$(INTDIR)\jidctint.obj" - -@erase "$(INTDIR)\jidctred.obj" - -@erase "$(INTDIR)\jdsample.obj" - -@erase "$(INTDIR)\jdcolor.obj" - -@erase "$(INTDIR)\jquant1.obj" - -@erase "$(INTDIR)\jquant2.obj" - -@erase "$(INTDIR)\jdmerge.obj" - -@erase "$(INTDIR)\jcomapi.obj" - -@erase "$(INTDIR)\jutils.obj" - -@erase "$(INTDIR)\jerror.obj" - -@erase "$(INTDIR)\jmemmgr.obj" - -@erase "$(INTDIR)\jmemnobs.obj" - -@erase "$(OUTDIR)\jpeg.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ - /Fp"$(INTDIR)/jpeg.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\Release/ -CPP_SBRS=.\. -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/jpeg.bsc" -BSC32_SBRS= \ - -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -LIB32_FLAGS=/nologo /out:"$(OUTDIR)/jpeg.lib" -LIB32_OBJS= \ - "$(INTDIR)\jcapimin.obj" \ - "$(INTDIR)\jcapistd.obj" \ - "$(INTDIR)\jctrans.obj" \ - "$(INTDIR)\jcparam.obj" \ - "$(INTDIR)\jdatadst.obj" \ - "$(INTDIR)\jcinit.obj" \ - "$(INTDIR)\jcmaster.obj" \ - "$(INTDIR)\jcmarker.obj" \ - "$(INTDIR)\jcmainct.obj" \ - "$(INTDIR)\jcprepct.obj" \ - "$(INTDIR)\jccoefct.obj" \ - "$(INTDIR)\jccolor.obj" \ - "$(INTDIR)\jcsample.obj" \ - "$(INTDIR)\jchuff.obj" \ - "$(INTDIR)\jcphuff.obj" \ - "$(INTDIR)\jcdctmgr.obj" \ - "$(INTDIR)\jfdctfst.obj" \ - "$(INTDIR)\jfdctflt.obj" \ - "$(INTDIR)\jfdctint.obj" \ - "$(INTDIR)\jdapimin.obj" \ - "$(INTDIR)\jdapistd.obj" \ - "$(INTDIR)\jdtrans.obj" \ - "$(INTDIR)\jdatasrc.obj" \ - "$(INTDIR)\jdmaster.obj" \ - "$(INTDIR)\jdinput.obj" \ - "$(INTDIR)\jdmarker.obj" \ - "$(INTDIR)\jdhuff.obj" \ - "$(INTDIR)\jdphuff.obj" \ - "$(INTDIR)\jdmainct.obj" \ - "$(INTDIR)\jdcoefct.obj" \ - "$(INTDIR)\jdpostct.obj" \ - "$(INTDIR)\jddctmgr.obj" \ - "$(INTDIR)\jidctfst.obj" \ - "$(INTDIR)\jidctflt.obj" \ - "$(INTDIR)\jidctint.obj" \ - "$(INTDIR)\jidctred.obj" \ - "$(INTDIR)\jdsample.obj" \ - "$(INTDIR)\jdcolor.obj" \ - "$(INTDIR)\jquant1.obj" \ - "$(INTDIR)\jquant2.obj" \ - "$(INTDIR)\jdmerge.obj" \ - "$(INTDIR)\jcomapi.obj" \ - "$(INTDIR)\jutils.obj" \ - "$(INTDIR)\jerror.obj" \ - "$(INTDIR)\jmemmgr.obj" \ - "$(INTDIR)\jmemnobs.obj" - -"$(OUTDIR)\jpeg.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) - $(LIB32) @<< - $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) -<< - -!ENDIF - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -################################################################################ -# Begin Target - -# Name "jpeg - Win32" - -!IF "$(CFG)" == "jpeg - Win32" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE="jcapimin.c" -DEP_CPP_JCAPI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcapimin.obj" : $(SOURCE) $(DEP_CPP_JCAPI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcapistd.c" -DEP_CPP_JCAPIS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcapistd.obj" : $(SOURCE) $(DEP_CPP_JCAPIS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jccoefct.c" -DEP_CPP_JCCOE=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jccoefct.obj" : $(SOURCE) $(DEP_CPP_JCCOE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jccolor.c" -DEP_CPP_JCCOL=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jccolor.obj" : $(SOURCE) $(DEP_CPP_JCCOL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcdctmgr.c" -DEP_CPP_JCDCT=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jcdctmgr.obj" : $(SOURCE) $(DEP_CPP_JCDCT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jchuff.c" -DEP_CPP_JCHUF=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jchuff.h"\ - - -"$(INTDIR)\jchuff.obj" : $(SOURCE) $(DEP_CPP_JCHUF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcinit.c" -DEP_CPP_JCINI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcinit.obj" : $(SOURCE) $(DEP_CPP_JCINI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcmainct.c" -DEP_CPP_JCMAI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcmainct.obj" : $(SOURCE) $(DEP_CPP_JCMAI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcmarker.c" -DEP_CPP_JCMAR=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcmarker.obj" : $(SOURCE) $(DEP_CPP_JCMAR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcmaster.c" -DEP_CPP_JCMAS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcmaster.obj" : $(SOURCE) $(DEP_CPP_JCMAS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcomapi.c" -DEP_CPP_JCOMA=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcomapi.obj" : $(SOURCE) $(DEP_CPP_JCOMA) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcparam.c" -DEP_CPP_JCPAR=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcparam.obj" : $(SOURCE) $(DEP_CPP_JCPAR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcphuff.c" -DEP_CPP_JCPHU=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jchuff.h"\ - - -"$(INTDIR)\jcphuff.obj" : $(SOURCE) $(DEP_CPP_JCPHU) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcprepct.c" -DEP_CPP_JCPRE=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcprepct.obj" : $(SOURCE) $(DEP_CPP_JCPRE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jcsample.c" -DEP_CPP_JCSAM=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jcsample.obj" : $(SOURCE) $(DEP_CPP_JCSAM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jctrans.c" -DEP_CPP_JCTRA=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jctrans.obj" : $(SOURCE) $(DEP_CPP_JCTRA) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdapimin.c" -DEP_CPP_JDAPI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdapimin.obj" : $(SOURCE) $(DEP_CPP_JDAPI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdapistd.c" -DEP_CPP_JDAPIS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdapistd.obj" : $(SOURCE) $(DEP_CPP_JDAPIS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdatadst.c" -DEP_CPP_JDATA=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdatadst.obj" : $(SOURCE) $(DEP_CPP_JDATA) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdatasrc.c" -DEP_CPP_JDATAS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdatasrc.obj" : $(SOURCE) $(DEP_CPP_JDATAS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdcoefct.c" -DEP_CPP_JDCOE=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdcoefct.obj" : $(SOURCE) $(DEP_CPP_JDCOE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdcolor.c" -DEP_CPP_JDCOL=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdcolor.obj" : $(SOURCE) $(DEP_CPP_JDCOL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jddctmgr.c" -DEP_CPP_JDDCT=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jddctmgr.obj" : $(SOURCE) $(DEP_CPP_JDDCT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdhuff.c" -DEP_CPP_JDHUF=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdhuff.h"\ - - -"$(INTDIR)\jdhuff.obj" : $(SOURCE) $(DEP_CPP_JDHUF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdinput.c" -DEP_CPP_JDINP=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdinput.obj" : $(SOURCE) $(DEP_CPP_JDINP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdmainct.c" -DEP_CPP_JDMAI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdmainct.obj" : $(SOURCE) $(DEP_CPP_JDMAI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdmarker.c" -DEP_CPP_JDMAR=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdmarker.obj" : $(SOURCE) $(DEP_CPP_JDMAR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdmaster.c" -DEP_CPP_JDMAS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdmaster.obj" : $(SOURCE) $(DEP_CPP_JDMAS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdmerge.c" -DEP_CPP_JDMER=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdmerge.obj" : $(SOURCE) $(DEP_CPP_JDMER) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdphuff.c" -DEP_CPP_JDPHU=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdhuff.h"\ - - -"$(INTDIR)\jdphuff.obj" : $(SOURCE) $(DEP_CPP_JDPHU) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdpostct.c" -DEP_CPP_JDPOS=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdpostct.obj" : $(SOURCE) $(DEP_CPP_JDPOS) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdsample.c" -DEP_CPP_JDSAM=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdsample.obj" : $(SOURCE) $(DEP_CPP_JDSAM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jdtrans.c" -DEP_CPP_JDTRA=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jdtrans.obj" : $(SOURCE) $(DEP_CPP_JDTRA) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jerror.c" -DEP_CPP_JERRO=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jversion.h"\ - "jerror.h"\ - - -"$(INTDIR)\jerror.obj" : $(SOURCE) $(DEP_CPP_JERRO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jfdctflt.c" -DEP_CPP_JFDCT=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jfdctflt.obj" : $(SOURCE) $(DEP_CPP_JFDCT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jfdctfst.c" -DEP_CPP_JFDCTF=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jfdctfst.obj" : $(SOURCE) $(DEP_CPP_JFDCTF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jfdctint.c" -DEP_CPP_JFDCTI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jfdctint.obj" : $(SOURCE) $(DEP_CPP_JFDCTI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jidctflt.c" -DEP_CPP_JIDCT=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jidctflt.obj" : $(SOURCE) $(DEP_CPP_JIDCT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jidctfst.c" -DEP_CPP_JIDCTF=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jidctfst.obj" : $(SOURCE) $(DEP_CPP_JIDCTF) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jidctint.c" -DEP_CPP_JIDCTI=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jidctint.obj" : $(SOURCE) $(DEP_CPP_JIDCTI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jidctred.c" -DEP_CPP_JIDCTR=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jdct.h"\ - - -"$(INTDIR)\jidctred.obj" : $(SOURCE) $(DEP_CPP_JIDCTR) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jquant1.c" -DEP_CPP_JQUAN=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jquant1.obj" : $(SOURCE) $(DEP_CPP_JQUAN) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jquant2.c" -DEP_CPP_JQUANT=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jquant2.obj" : $(SOURCE) $(DEP_CPP_JQUANT) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jutils.c" -DEP_CPP_JUTIL=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - - -"$(INTDIR)\jutils.obj" : $(SOURCE) $(DEP_CPP_JUTIL) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jmemmgr.c" -DEP_CPP_JMEMM=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jmemsys.h"\ - - -"$(INTDIR)\jmemmgr.obj" : $(SOURCE) $(DEP_CPP_JMEMM) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE="jmemnobs.c" -DEP_CPP_JMEMN=\ - "jinclude.h"\ - "jconfig.h"\ - "jpeglib.h"\ - "jmorecfg.h"\ - "jpegint.h"\ - "jerror.h"\ - "jmemsys.h"\ - - -"$(INTDIR)\jmemnobs.obj" : $(SOURCE) $(DEP_CPP_JMEMN) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -# End Target -# End Project -################################################################################ - diff --git a/makeproj.mac b/makeproj.mac deleted file mode 100644 index ed277c83..00000000 --- a/makeproj.mac +++ /dev/null @@ -1,213 +0,0 @@ --- --- makeproj.mac --- --- This AppleScript builds Code Warrior PRO Release 2 project files for the --- libjpeg library as well as the test programs 'cjpeg', 'djpeg', 'jpegtran'. --- (We'd distribute real project files, except they're not text --- and would create maintenance headaches.) --- --- The script then compiles and links the library and the test programs. --- NOTE: if you haven't already created a 'jconfig.h' file, the script --- automatically copies 'jconfig.mac' to 'jconfig.h'. --- --- To use this script, you must have AppleScript 1.1 or later installed --- and a suitable AppleScript editor like Script Editor or Script Debugger --- (http://www.latenightsw.com). Open this file with your AppleScript --- editor and execute the "run" command to build the projects. --- --- Thanks to Dan Sears and Don Agro for this script. --- Questions about this script can be addressed to dogpark@interlog.com --- - -on run - - choose folder with prompt ">>> Select IJG source folder <<<" - set ijg_folder to result - - choose folder with prompt ">>> Select MetroWerks folder <<<" - set cw_folder to result - - -- if jconfig.h doesn't already exist, copy jconfig.mac - - tell application "Finder" - if not (exists file "jconfig.h" of ijg_folder) then - duplicate {file "jconfig.mac" of folder ijg_folder} - select file "jconfig.mac copy" of folder ijg_folder - set name of selection to "jconfig.h" - end if - end tell - - tell application "CodeWarrior IDE 2.1" - with timeout of 10000 seconds - - -- create libjpeg project - - activate - Create Project (ijg_folder as string) & "libjpeg.proj" - Set Preferences of panel "Target Settings" to {Target Name:"libjpeg"} - Set Preferences of panel "PPC Project" to {File Name:"libjpeg"} - Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"} - Set Preferences of panel "PPC Project" to {Project Type:library} - Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true} - Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true} - Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC} - Set Preferences of panel "PPC Linker" to {Generate SYM File:false} - - Add Files (ijg_folder as string) & "jcapimin.c" To Segment 1 - Add Files (ijg_folder as string) & "jcapistd.c" To Segment 1 - Add Files (ijg_folder as string) & "jctrans.c" To Segment 1 - Add Files (ijg_folder as string) & "jcparam.c" To Segment 1 - Add Files (ijg_folder as string) & "jdatadst.c" To Segment 1 - Add Files (ijg_folder as string) & "jcinit.c" To Segment 1 - Add Files (ijg_folder as string) & "jcmaster.c" To Segment 1 - Add Files (ijg_folder as string) & "jcmarker.c" To Segment 1 - Add Files (ijg_folder as string) & "jcmainct.c" To Segment 1 - Add Files (ijg_folder as string) & "jcprepct.c" To Segment 1 - Add Files (ijg_folder as string) & "jccoefct.c" To Segment 1 - Add Files (ijg_folder as string) & "jccolor.c" To Segment 1 - Add Files (ijg_folder as string) & "jcsample.c" To Segment 1 - Add Files (ijg_folder as string) & "jchuff.c" To Segment 1 - Add Files (ijg_folder as string) & "jcphuff.c" To Segment 1 - Add Files (ijg_folder as string) & "jcdctmgr.c" To Segment 1 - Add Files (ijg_folder as string) & "jfdctfst.c" To Segment 1 - Add Files (ijg_folder as string) & "jfdctflt.c" To Segment 1 - Add Files (ijg_folder as string) & "jfdctint.c" To Segment 1 - Add Files (ijg_folder as string) & "jdapimin.c" To Segment 1 - Add Files (ijg_folder as string) & "jdapistd.c" To Segment 1 - Add Files (ijg_folder as string) & "jdtrans.c" To Segment 1 - Add Files (ijg_folder as string) & "jdatasrc.c" To Segment 1 - Add Files (ijg_folder as string) & "jdmaster.c" To Segment 1 - Add Files (ijg_folder as string) & "jdinput.c" To Segment 1 - Add Files (ijg_folder as string) & "jdmarker.c" To Segment 1 - Add Files (ijg_folder as string) & "jdhuff.c" To Segment 1 - Add Files (ijg_folder as string) & "jdphuff.c" To Segment 1 - Add Files (ijg_folder as string) & "jdmainct.c" To Segment 1 - Add Files (ijg_folder as string) & "jdcoefct.c" To Segment 1 - Add Files (ijg_folder as string) & "jdpostct.c" To Segment 1 - Add Files (ijg_folder as string) & "jddctmgr.c" To Segment 1 - Add Files (ijg_folder as string) & "jidctfst.c" To Segment 1 - Add Files (ijg_folder as string) & "jidctflt.c" To Segment 1 - Add Files (ijg_folder as string) & "jidctint.c" To Segment 1 - Add Files (ijg_folder as string) & "jidctred.c" To Segment 1 - Add Files (ijg_folder as string) & "jdsample.c" To Segment 1 - Add Files (ijg_folder as string) & "jdcolor.c" To Segment 1 - Add Files (ijg_folder as string) & "jquant1.c" To Segment 1 - Add Files (ijg_folder as string) & "jquant2.c" To Segment 1 - Add Files (ijg_folder as string) & "jdmerge.c" To Segment 1 - Add Files (ijg_folder as string) & "jcomapi.c" To Segment 1 - Add Files (ijg_folder as string) & "jutils.c" To Segment 1 - Add Files (ijg_folder as string) & "jerror.c" To Segment 1 - Add Files (ijg_folder as string) & "jmemmgr.c" To Segment 1 - Add Files (ijg_folder as string) & "jmemmac.c" To Segment 1 - - -- compile and link the library - - Make Project - Close Project - - -- create cjpeg project - - activate - Create Project (ijg_folder as string) & "cjpeg.proj" - Set Preferences of panel "Target Settings" to {Target Name:"cjpeg"} - Set Preferences of panel "PPC Project" to {File Name:"cjpeg"} - Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"} - Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true} - Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true} - Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC} - Set Preferences of panel "PPC Linker" to {Generate SYM File:false} - - Add Files (ijg_folder as string) & "cjpeg.c" To Segment 1 - Add Files (ijg_folder as string) & "rdppm.c" To Segment 1 - Add Files (ijg_folder as string) & "rdgif.c" To Segment 1 - Add Files (ijg_folder as string) & "rdtarga.c" To Segment 1 - Add Files (ijg_folder as string) & "rdrle.c" To Segment 1 - Add Files (ijg_folder as string) & "rdbmp.c" To Segment 1 - Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1 - Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1 - - Add Files (ijg_folder as string) & "libjpeg" To Segment 2 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4 - - -- compile and link cjpeg - - Make Project - Close Project - - -- create djpeg project - - activate - Create Project (ijg_folder as string) & "djpeg.proj" - Set Preferences of panel "Target Settings" to {Target Name:"djpeg"} - Set Preferences of panel "PPC Project" to {File Name:"djpeg"} - Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"} - Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true} - Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true} - Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC} - Set Preferences of panel "PPC Linker" to {Generate SYM File:false} - - Add Files (ijg_folder as string) & "djpeg.c" To Segment 1 - Add Files (ijg_folder as string) & "wrppm.c" To Segment 1 - Add Files (ijg_folder as string) & "wrgif.c" To Segment 1 - Add Files (ijg_folder as string) & "wrtarga.c" To Segment 1 - Add Files (ijg_folder as string) & "wrrle.c" To Segment 1 - Add Files (ijg_folder as string) & "wrbmp.c" To Segment 1 - Add Files (ijg_folder as string) & "rdcolmap.c" To Segment 1 - Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1 - - Add Files (ijg_folder as string) & "libjpeg" To Segment 2 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4 - - -- compile and link djpeg - - Make Project - Close Project - - -- create jpegtran project - - activate - Create Project (ijg_folder as string) & "jpegtran.proj" - Set Preferences of panel "Target Settings" to {Target Name:"jpegtran"} - Set Preferences of panel "PPC Project" to {File Name:"jpegtran"} - Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"} - Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true} - Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true} - Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC} - Set Preferences of panel "PPC Linker" to {Generate SYM File:false} - - Add Files (ijg_folder as string) & "jpegtran.c" To Segment 1 - Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1 - Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1 - Add Files (ijg_folder as string) & "transupp.c" To Segment 1 - - Add Files (ijg_folder as string) & "libjpeg" To Segment 2 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3 - - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4 - Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4 - - -- compile and link jpegtran - - Make Project - Close Project - - quit - - end timeout - end tell -end run diff --git a/makljpeg.st b/makljpeg.st deleted file mode 100644 index 813493ea..00000000 --- a/makljpeg.st +++ /dev/null @@ -1,70 +0,0 @@ -; Project file for Independent JPEG Group's software -; -; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. -; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), -; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), -; and Guido Vollbeding (guivol@esc.de). -; -; To use this file, rename it to libjpeg.prj. -; Read installation instructions before trying to make the program! -; -; -; * * * Output file * * * -libjpeg.lib -; -; * * * COMPILER OPTIONS * * * -.C[-P] ; absolute calls -.C[-M] ; and no string merging, folks -.C[-w-cln] ; no "constant is long" warnings -.C[-w-par] ; no "parameter xxxx unused" -.C[-w-rch] ; no "unreachable code" -.C[-wsig] ; warn if significant digits may be lost -.L[-J] ; link new Obj-format (so we get a library) -= -; * * * * List of modules * * * * -jcapimin.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcapistd.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jccoefct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jccolor.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcdctmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jchuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h) -jcinit.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcmainct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcmarker.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcmaster.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcomapi.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcparam.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcphuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h) -jcprepct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jcsample.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jctrans.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdapimin.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdapistd.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdatadst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h) -jdatasrc.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h) -jdcoefct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdcolor.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jddctmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jdhuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h) -jdinput.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdmainct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdmarker.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdmaster.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdmerge.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdphuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h) -jdpostct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdsample.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jdtrans.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jerror.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jversion.h,jerror.h) -jfdctflt.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jfdctfst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jfdctint.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jidctflt.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jidctfst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jidctint.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jidctred.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) -jquant1.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jquant2.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jutils.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) -jmemmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h) -jmemansi.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h) diff --git a/maktjpeg.st b/maktjpeg.st deleted file mode 100644 index 31f4d169..00000000 --- a/maktjpeg.st +++ /dev/null @@ -1,32 +0,0 @@ -; Project file for Independent JPEG Group's software -; -; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. -; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), -; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), -; and Guido Vollbeding (guivol@esc.de). -; -; To use this file, rename it to jpegtran.prj. -; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." -; Read installation instructions before trying to make the program! -; -; -; * * * Output file * * * -jpegtran.ttp -; -; * * * COMPILER OPTIONS * * * -.C[-P] ; absolute calls -.C[-M] ; and no string merging, folks -.C[-w-cln] ; no "constant is long" warnings -.C[-w-par] ; no "parameter xxxx unused" -.C[-w-rch] ; no "unreachable code" -.C[-wsig] ; warn if significant digits may be lost -= -; * * * * List of modules * * * * -pcstart.o -jpegtran.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,transupp.h,jversion.h) -cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -rdswitch.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) -transupp.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,transupp.h) -libjpeg.lib ; built by libjpeg.prj -pcstdlib.lib ; standard library -pcextlib.lib ; extended library diff --git a/makvms.opt b/makvms.opt deleted file mode 100644 index 675e8fe9..00000000 --- a/makvms.opt +++ /dev/null @@ -1,4 +0,0 @@ -! A pointer to the VAX/VMS C Run-Time Shareable Library. -! This file is needed by makefile.mms and makefile.vms, -! but only for the older VAX C compiler. DEC C does not need it. -Sys$Library:VAXCRTL.EXE /Share diff --git a/rdbmp.c b/rdbmp.c deleted file mode 100644 index b05fe2ac..00000000 --- a/rdbmp.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * rdbmp.c - * - * 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. - * - * This file contains routines to read input images in Microsoft "BMP" - * format (MS Windows 3.x, OS/2 1.x, and OS/2 2.x flavors). - * Currently, only 8-bit and 24-bit images are supported, not 1-bit or - * 4-bit (feeding such low-depth images into JPEG would be silly anyway). - * Also, we don't support RLE-compressed files. - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume input from - * an ordinary stdio stream. They further assume that reading begins - * at the start of the file; start_input may need work if the - * user interface has already read some data (e.g., to determine that - * the file is indeed BMP format). - * - * This code contributed by James Arthur Boucher. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef BMP_SUPPORTED - - -/* Macros to deal with unsigned chars as efficiently as compiler allows */ - -#ifdef HAVE_UNSIGNED_CHAR -typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) -#else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED -typedef char U_CHAR; -#define UCH(x) ((int) (x)) -#else -typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) -#endif -#endif /* HAVE_UNSIGNED_CHAR */ - - -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) - - -/* Private version of data source object */ - -typedef struct _bmp_source_struct * bmp_source_ptr; - -typedef struct _bmp_source_struct { - struct cjpeg_source_struct pub; /* public fields */ - - j_compress_ptr cinfo; /* back link saves passing separate parm */ - - JSAMPARRAY colormap; /* BMP colormap (converted to my format) */ - - jvirt_sarray_ptr whole_image; /* Needed to reverse row order */ - JDIMENSION source_row; /* Current source row number */ - JDIMENSION row_width; /* Physical width of scanlines in file */ - - int bits_per_pixel; /* remembers 8- or 24-bit format */ -} bmp_source_struct; - - -LOCAL(int) -read_byte (bmp_source_ptr sinfo) -/* Read next byte from BMP file */ -{ - register FILE *infile = sinfo->pub.input_file; - register int c; - - if ((c = getc(infile)) == EOF) - ERREXIT(sinfo->cinfo, JERR_INPUT_EOF); - return c; -} - - -LOCAL(void) -read_colormap (bmp_source_ptr sinfo, int cmaplen, int mapentrysize) -/* Read the colormap from a BMP file */ -{ - int i; - - switch (mapentrysize) { - case 3: - /* BGR format (occurs in OS/2 files) */ - for (i = 0; i < cmaplen; i++) { - sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo); - } - break; - case 4: - /* BGR0 format (occurs in MS Windows files) */ - for (i = 0; i < cmaplen; i++) { - sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo); - (void) read_byte(sinfo); - } - break; - default: - ERREXIT(sinfo->cinfo, JERR_BMP_BADCMAP); - break; - } -} - - -/* - * Read one row of pixels. - * The image has been read into the whole_image array, but is otherwise - * unprocessed. We must read it out in top-to-bottom row order, and if - * it is an 8-bit image, we must expand colormapped pixels to 24bit format. - */ - -METHODDEF(JDIMENSION) -get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 8-bit colormap indexes */ -{ - bmp_source_ptr source = (bmp_source_ptr) sinfo; - register JSAMPARRAY colormap = source->colormap; - JSAMPARRAY image_ptr; - register int t; - register JSAMPROW inptr, outptr; - register JDIMENSION col; - - /* Fetch next row from virtual array */ - source->source_row--; - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->whole_image, - source->source_row, (JDIMENSION) 1, FALSE); - - /* Expand the colormap indexes to real data */ - inptr = image_ptr[0]; - outptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - t = GETJSAMPLE(*inptr++); - *outptr++ = colormap[0][t]; /* can omit GETJSAMPLE() safely */ - *outptr++ = colormap[1][t]; - *outptr++ = colormap[2][t]; - } - - return 1; -} - - -METHODDEF(JDIMENSION) -get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 24-bit pixels */ -{ - bmp_source_ptr source = (bmp_source_ptr) sinfo; - JSAMPARRAY image_ptr; - register JSAMPROW inptr, outptr; - register JDIMENSION col; - - /* Fetch next row from virtual array */ - source->source_row--; - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->whole_image, - source->source_row, (JDIMENSION) 1, FALSE); - - /* Transfer data. Note source values are in BGR order - * (even though Microsoft's own documents say the opposite). - */ - inptr = image_ptr[0]; - outptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ - outptr[1] = *inptr++; - outptr[0] = *inptr++; - outptr += 3; - } - - return 1; -} - - -/* - * This method loads the image into whole_image during the first call on - * get_pixel_rows. The get_pixel_rows pointer is then adjusted to call - * get_8bit_row or get_24bit_row on subsequent calls. - */ - -METHODDEF(JDIMENSION) -preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - bmp_source_ptr source = (bmp_source_ptr) sinfo; - register FILE *infile = source->pub.input_file; - register int c; - register JSAMPROW out_ptr; - JSAMPARRAY image_ptr; - JDIMENSION row, col; - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - - /* Read the data into a virtual array in input-file row order. */ - for (row = 0; row < cinfo->image_height; row++) { - if (progress != NULL) { - progress->pub.pass_counter = (long) row; - progress->pub.pass_limit = (long) cinfo->image_height; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->whole_image, - row, (JDIMENSION) 1, TRUE); - out_ptr = image_ptr[0]; - for (col = source->row_width; col > 0; col--) { - /* inline copy of read_byte() for speed */ - if ((c = getc(infile)) == EOF) - ERREXIT(cinfo, JERR_INPUT_EOF); - *out_ptr++ = (JSAMPLE) c; - } - } - if (progress != NULL) - progress->completed_extra_passes++; - - /* Set up to read from the virtual array in top-to-bottom order */ - switch (source->bits_per_pixel) { - case 8: - source->pub.get_pixel_rows = get_8bit_row; - break; - case 24: - source->pub.get_pixel_rows = get_24bit_row; - break; - default: - ERREXIT(cinfo, JERR_BMP_BADDEPTH); - } - source->source_row = cinfo->image_height; - - /* And read the first row */ - return (*source->pub.get_pixel_rows) (cinfo, sinfo); -} - - -/* - * Read the file header; return image size and component count. - */ - -METHODDEF(void) -start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - bmp_source_ptr source = (bmp_source_ptr) sinfo; - U_CHAR bmpfileheader[14]; - U_CHAR bmpinfoheader[64]; -#define GET_2B(array,offset) ((unsigned int) UCH(array[offset]) + \ - (((unsigned int) UCH(array[offset+1])) << 8)) -#define GET_4B(array,offset) ((INT32) UCH(array[offset]) + \ - (((INT32) UCH(array[offset+1])) << 8) + \ - (((INT32) UCH(array[offset+2])) << 16) + \ - (((INT32) UCH(array[offset+3])) << 24)) - INT32 bfOffBits; - INT32 headerSize; - INT32 biWidth = 0; /* initialize to avoid compiler warning */ - INT32 biHeight = 0; - unsigned int biPlanes; - INT32 biCompression; - INT32 biXPelsPerMeter,biYPelsPerMeter; - INT32 biClrUsed = 0; - int mapentrysize = 0; /* 0 indicates no colormap */ - INT32 bPad; - JDIMENSION row_width; - - /* Read and verify the bitmap file header */ - if (! ReadOK(source->pub.input_file, bmpfileheader, 14)) - ERREXIT(cinfo, JERR_INPUT_EOF); - if (GET_2B(bmpfileheader,0) != 0x4D42) /* 'BM' */ - ERREXIT(cinfo, JERR_BMP_NOT); - bfOffBits = (INT32) GET_4B(bmpfileheader,10); - /* We ignore the remaining fileheader fields */ - - /* The infoheader might be 12 bytes (OS/2 1.x), 40 bytes (Windows), - * or 64 bytes (OS/2 2.x). Check the first 4 bytes to find out which. - */ - if (! ReadOK(source->pub.input_file, bmpinfoheader, 4)) - ERREXIT(cinfo, JERR_INPUT_EOF); - headerSize = (INT32) GET_4B(bmpinfoheader,0); - if (headerSize < 12 || headerSize > 64) - ERREXIT(cinfo, JERR_BMP_BADHEADER); - if (! ReadOK(source->pub.input_file, bmpinfoheader+4, headerSize-4)) - ERREXIT(cinfo, JERR_INPUT_EOF); - - switch ((int) headerSize) { - case 12: - /* Decode OS/2 1.x header (Microsoft calls this a BITMAPCOREHEADER) */ - biWidth = (INT32) GET_2B(bmpinfoheader,4); - biHeight = (INT32) GET_2B(bmpinfoheader,6); - biPlanes = GET_2B(bmpinfoheader,8); - source->bits_per_pixel = (int) GET_2B(bmpinfoheader,10); - - switch (source->bits_per_pixel) { - case 8: /* colormapped image */ - mapentrysize = 3; /* OS/2 uses RGBTRIPLE colormap */ - TRACEMS2(cinfo, 1, JTRC_BMP_OS2_MAPPED, (int) biWidth, (int) biHeight); - break; - case 24: /* RGB image */ - TRACEMS2(cinfo, 1, JTRC_BMP_OS2, (int) biWidth, (int) biHeight); - break; - default: - ERREXIT(cinfo, JERR_BMP_BADDEPTH); - break; - } - if (biPlanes != 1) - ERREXIT(cinfo, JERR_BMP_BADPLANES); - break; - case 40: - case 64: - /* Decode Windows 3.x header (Microsoft calls this a BITMAPINFOHEADER) */ - /* or OS/2 2.x header, which has additional fields that we ignore */ - biWidth = GET_4B(bmpinfoheader,4); - biHeight = GET_4B(bmpinfoheader,8); - biPlanes = GET_2B(bmpinfoheader,12); - source->bits_per_pixel = (int) GET_2B(bmpinfoheader,14); - biCompression = GET_4B(bmpinfoheader,16); - biXPelsPerMeter = GET_4B(bmpinfoheader,24); - biYPelsPerMeter = GET_4B(bmpinfoheader,28); - biClrUsed = GET_4B(bmpinfoheader,32); - /* biSizeImage, biClrImportant fields are ignored */ - - switch (source->bits_per_pixel) { - case 8: /* colormapped image */ - mapentrysize = 4; /* Windows uses RGBQUAD colormap */ - TRACEMS2(cinfo, 1, JTRC_BMP_MAPPED, (int) biWidth, (int) biHeight); - break; - case 24: /* RGB image */ - TRACEMS2(cinfo, 1, JTRC_BMP, (int) biWidth, (int) biHeight); - break; - default: - ERREXIT(cinfo, JERR_BMP_BADDEPTH); - break; - } - if (biPlanes != 1) - ERREXIT(cinfo, JERR_BMP_BADPLANES); - if (biCompression != 0) - ERREXIT(cinfo, JERR_BMP_COMPRESSED); - - if (biXPelsPerMeter > 0 && biYPelsPerMeter > 0) { - /* Set JFIF density parameters from the BMP data */ - cinfo->X_density = (UINT16) (biXPelsPerMeter/100); /* 100 cm per meter */ - cinfo->Y_density = (UINT16) (biYPelsPerMeter/100); - cinfo->density_unit = 2; /* dots/cm */ - } - break; - default: - ERREXIT(cinfo, JERR_BMP_BADHEADER); - break; - } - - /* Compute distance to bitmap data --- will adjust for colormap below */ - bPad = bfOffBits - (headerSize + 14); - - /* Read the colormap, if any */ - if (mapentrysize > 0) { - if (biClrUsed <= 0) - biClrUsed = 256; /* assume it's 256 */ - else if (biClrUsed > 256) - ERREXIT(cinfo, JERR_BMP_BADCMAP); - /* Allocate space to store the colormap */ - source->colormap = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) biClrUsed, (JDIMENSION) 3); - /* and read it from the file */ - read_colormap(source, (int) biClrUsed, mapentrysize); - /* account for size of colormap */ - bPad -= biClrUsed * mapentrysize; - } - - /* Skip any remaining pad bytes */ - if (bPad < 0) /* incorrect bfOffBits value? */ - ERREXIT(cinfo, JERR_BMP_BADHEADER); - while (--bPad >= 0) { - (void) read_byte(source); - } - - /* Compute row width in file, including padding to 4-byte boundary */ - if (source->bits_per_pixel == 24) - row_width = (JDIMENSION) (biWidth * 3); - else - row_width = (JDIMENSION) biWidth; - while ((row_width & 3) != 0) row_width++; - source->row_width = row_width; - - /* Allocate space for inversion array, prepare for preload pass */ - source->whole_image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - row_width, (JDIMENSION) biHeight, (JDIMENSION) 1); - source->pub.get_pixel_rows = preload_image; - if (cinfo->progress != NULL) { - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - progress->total_extra_passes++; /* count file input as separate pass */ - } - - /* Allocate one-row buffer for returned data */ - source->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (biWidth * 3), (JDIMENSION) 1); - source->pub.buffer_height = 1; - - cinfo->in_color_space = JCS_RGB; - cinfo->input_components = 3; - cinfo->data_precision = 8; - cinfo->image_width = (JDIMENSION) biWidth; - cinfo->image_height = (JDIMENSION) biHeight; -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - /* no work */ -} - - -/* - * The module selection routine for BMP format input. - */ - -GLOBAL(cjpeg_source_ptr) -jinit_read_bmp (j_compress_ptr cinfo) -{ - bmp_source_ptr source; - - /* Create module interface object */ - source = (bmp_source_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_source_struct)); - source->cinfo = cinfo; /* make back link for subroutines */ - /* Fill in method ptrs, except get_pixel_rows which start_input sets */ - source->pub.start_input = start_input_bmp; - source->pub.finish_input = finish_input_bmp; - - return (cjpeg_source_ptr) source; -} - -#endif /* BMP_SUPPORTED */ diff --git a/rdcolmap.c b/rdcolmap.c deleted file mode 100644 index 42b34376..00000000 --- a/rdcolmap.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * rdcolmap.c - * - * 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. - * - * This file implements djpeg's "-map file" switch. It reads a source image - * and constructs a colormap to be supplied to the JPEG decompressor. - * - * Currently, these file formats are supported for the map file: - * GIF: the contents of the GIF's global colormap are used. - * PPM (either text or raw flavor): the entire file is read and - * each unique pixel value is entered in the map. - * Note that reading a large PPM file will be horrendously slow. - * Typically, a PPM-format map file should contain just one pixel - * of each desired color. Such a file can be extracted from an - * ordinary image PPM file with ppmtomap(1). - * - * Rescaling a PPM that has a maxval unequal to MAXJSAMPLE is not - * currently implemented. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ - -/* Portions of this code are based on the PBMPLUS library, which is: -** -** Copyright (C) 1988 by Jef Poskanzer. -** -** Permission to use, copy, modify, and distribute this software and its -** documentation for any purpose and without fee is hereby granted, provided -** that the above copyright notice appear in all copies and that both that -** copyright notice and this permission notice appear in supporting -** documentation. This software is provided "as is" without express or -** implied warranty. -*/ - - -/* - * Add a (potentially) new color to the color map. - */ - -LOCAL(void) -add_map_entry (j_decompress_ptr cinfo, int R, int G, int B) -{ - JSAMPROW colormap0 = cinfo->colormap[0]; - JSAMPROW colormap1 = cinfo->colormap[1]; - JSAMPROW colormap2 = cinfo->colormap[2]; - int ncolors = cinfo->actual_number_of_colors; - int index; - - /* Check for duplicate color. */ - for (index = 0; index < ncolors; index++) { - if (GETJSAMPLE(colormap0[index]) == R && - GETJSAMPLE(colormap1[index]) == G && - GETJSAMPLE(colormap2[index]) == B) - return; /* color is already in map */ - } - - /* Check for map overflow. */ - if (ncolors >= (MAXJSAMPLE+1)) - ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, (MAXJSAMPLE+1)); - - /* OK, add color to map. */ - colormap0[ncolors] = (JSAMPLE) R; - colormap1[ncolors] = (JSAMPLE) G; - colormap2[ncolors] = (JSAMPLE) B; - cinfo->actual_number_of_colors++; -} - - -/* - * Extract color map from a GIF file. - */ - -LOCAL(void) -read_gif_map (j_decompress_ptr cinfo, FILE * infile) -{ - int header[13]; - int i, colormaplen; - int R, G, B; - - /* Initial 'G' has already been read by read_color_map */ - /* Read the rest of the GIF header and logical screen descriptor */ - for (i = 1; i < 13; i++) { - if ((header[i] = getc(infile)) == EOF) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - } - - /* Verify GIF Header */ - if (header[1] != 'I' || header[2] != 'F') - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - - /* There must be a global color map. */ - if ((header[10] & 0x80) == 0) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - - /* OK, fetch it. */ - colormaplen = 2 << (header[10] & 0x07); - - for (i = 0; i < colormaplen; i++) { - R = getc(infile); - G = getc(infile); - B = getc(infile); - if (R == EOF || G == EOF || B == EOF) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - add_map_entry(cinfo, - R << (BITS_IN_JSAMPLE-8), - G << (BITS_IN_JSAMPLE-8), - B << (BITS_IN_JSAMPLE-8)); - } -} - - -/* Support routines for reading PPM */ - - -LOCAL(int) -pbm_getc (FILE * infile) -/* Read next char, skipping over any comments */ -/* A comment/newline sequence is returned as a newline */ -{ - register int ch; - - ch = getc(infile); - if (ch == '#') { - do { - ch = getc(infile); - } while (ch != '\n' && ch != EOF); - } - return ch; -} - - -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 */ -/* Note that on a 16-bit-int machine, only values up to 64k can be read. */ -/* This should not be a problem in practice. */ -{ - register int ch; - register unsigned int val; - - /* Skip any leading whitespace */ - do { - ch = pbm_getc(infile); - if (ch == EOF) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'); - - if (ch < '0' || ch > '9') - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - - val = ch - '0'; - while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') { - val *= 10; - val += ch - '0'; - } - return val; -} - - -/* - * Extract color map from a PPM file. - */ - -LOCAL(void) -read_ppm_map (j_decompress_ptr cinfo, FILE * infile) -{ - int c; - unsigned int w, h, maxval, row, col; - int R, G, B; - - /* Initial 'P' has already been read by read_color_map */ - c = getc(infile); /* save format discriminator for a sec */ - - /* while we fetch the remaining header info */ - w = read_pbm_integer(cinfo, infile); - h = read_pbm_integer(cinfo, infile); - maxval = read_pbm_integer(cinfo, infile); - - if (w <= 0 || h <= 0 || maxval <= 0) /* error check */ - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - - /* For now, we don't support rescaling from an unusual maxval. */ - if (maxval != (unsigned int) MAXJSAMPLE) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - - switch (c) { - case '3': /* it's a text-format PPM file */ - for (row = 0; row < h; row++) { - for (col = 0; col < w; col++) { - R = read_pbm_integer(cinfo, infile); - G = read_pbm_integer(cinfo, infile); - B = read_pbm_integer(cinfo, infile); - add_map_entry(cinfo, R, G, B); - } - } - break; - - case '6': /* it's a raw-format PPM file */ - for (row = 0; row < h; row++) { - for (col = 0; col < w; col++) { - R = getc(infile); - G = getc(infile); - B = getc(infile); - if (R == EOF || G == EOF || B == EOF) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - add_map_entry(cinfo, R, G, B); - } - } - break; - - default: - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - break; - } -} - - -/* - * Main entry point from djpeg.c. - * Input: opened input file (from file name argument on command line). - * Output: colormap and actual_number_of_colors fields are set in cinfo. - */ - -GLOBAL(void) -read_color_map (j_decompress_ptr cinfo, FILE * infile) -{ - /* Allocate space for a color map of maximum supported size. */ - cinfo->colormap = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (MAXJSAMPLE+1), (JDIMENSION) 3); - cinfo->actual_number_of_colors = 0; /* initialize map to empty */ - - /* Read first byte to determine file format */ - switch (getc(infile)) { - case 'G': - read_gif_map(cinfo, infile); - break; - case 'P': - read_ppm_map(cinfo, infile); - break; - default: - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - break; - } -} - -#endif /* QUANT_2PASS_SUPPORTED */ diff --git a/rdgif.c b/rdgif.c deleted file mode 100644 index b27c1675..00000000 --- a/rdgif.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * rdgif.c - * - * Copyright (C) 1991-1997, 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. - * - * This file contains routines to read input images in GIF format. - * - ***************************************************************************** - * NOTE: to avoid entanglements with Unisys' patent on LZW compression, * - * the ability to read GIF files has been removed from the IJG distribution. * - * Sorry about that. * - ***************************************************************************** - * - * We are required to state that - * "The Graphics Interchange Format(c) is the Copyright property of - * CompuServe Incorporated. GIF(sm) is a Service Mark property of - * CompuServe Incorporated." - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef GIF_SUPPORTED - -/* - * The module selection routine for GIF format input. - */ - -GLOBAL(cjpeg_source_ptr) -jinit_read_gif (j_compress_ptr cinfo) -{ - fprintf(stderr, "GIF input is unsupported for legal reasons. Sorry.\n"); - exit(EXIT_FAILURE); - return NULL; /* keep compiler happy */ -} - -#endif /* GIF_SUPPORTED */ diff --git a/rdjpgcom.1 b/rdjpgcom.1 deleted file mode 100644 index 2bba04e1..00000000 --- a/rdjpgcom.1 +++ /dev/null @@ -1,54 +0,0 @@ -.TH RDJPGCOM 1 "11 October 1997" -.SH NAME -rdjpgcom \- display text comments from a JPEG file -.SH SYNOPSIS -.B rdjpgcom -[ -.B \-verbose -] -[ -.I filename -] -.LP -.SH DESCRIPTION -.LP -.B rdjpgcom -reads the named JPEG/JFIF file, or the standard input if no file is named, -and prints any text comments found in the file on the standard output. -.PP -The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. -Although the standard doesn't actually define what COM blocks are for, they -are widely used to hold user-supplied text strings. This lets you add -annotations, titles, index terms, etc to your JPEG files, and later retrieve -them as text. COM blocks do not interfere with the image stored in the JPEG -file. The maximum size of a COM block is 64K, but you can have as many of -them as you like in one JPEG file. -.SH OPTIONS -.TP -.B \-verbose -Causes -.B rdjpgcom -to also display the JPEG image dimensions. -.PP -Switch names may be abbreviated, and are not case sensitive. -.SH HINTS -.B rdjpgcom -does not depend on the IJG JPEG library. Its source code is intended as an -illustration of the minimum amount of code required to parse a JPEG file -header correctly. -.PP -In -.B \-verbose -mode, -.B rdjpgcom -will also attempt to print the contents of any "APP12" markers as text. -Some digital cameras produce APP12 markers containing useful textual -information. If you like, you can modify the source code to print -other APPn marker types as well. -.SH SEE ALSO -.BR cjpeg (1), -.BR djpeg (1), -.BR jpegtran (1), -.BR wrjpgcom (1) -.SH AUTHOR -Independent JPEG Group diff --git a/rdjpgcom.c b/rdjpgcom.c deleted file mode 100644 index ffe6fc62..00000000 --- a/rdjpgcom.c +++ /dev/null @@ -1,496 +0,0 @@ -/* - * rdjpgcom.c - * - * Copyright (C) 1994-1997, 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. - * - * This file contains a very simple stand-alone application that displays - * the text in COM (comment) markers in a JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - */ - -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jinclude.h" /* get auto-config symbols, */ - -#include /* to declare isupper(), tolower() */ -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif - - -/* - * These macros are used to read the input file. - * To reuse this code in another application, you might need to change these. - */ - -static FILE * infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - - -/* Error exit handler */ -#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) - - -/* Read one byte, testing for EOF */ -static int -read_1_byte (void) -{ - int c; - - c = NEXTBYTE(); - if (c == EOF) - ERREXIT("Premature EOF in JPEG file"); - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int -read_2_bytes (void) -{ - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - ERREXIT("Premature EOF in JPEG file"); - c2 = NEXTBYTE(); - if (c2 == EOF) - ERREXIT("Premature EOF in JPEG file"); - return (((unsigned int) c1) << 8) + ((unsigned int) c2); -} - - -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_APP0 0xE0 /* Application-specific marker, type N */ -#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ -#define M_COM 0xFE /* COMment */ - - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ - -static int -next_marker (void) -{ - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - fprintf(stderr, "Warning: garbage data found in JPEG file\n"); - } - - return c; -} - - -/* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - -static int -first_marker (void) -{ - int c1, c2; - - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - ERREXIT("Not a JPEG file"); - return c2; -} - - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ - -static void -skip_variable (void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void) read_1_byte(); - length--; - } -} - - -/* - * Process a COM marker. - * We want to print out the marker contents as legible text; - * we must guard against non-text junk and varying newline representations. - */ - -static void -process_COM (void) -{ - unsigned int length; - int ch; - int lastch = 0; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - - while (length > 0) { - ch = read_1_byte(); - /* Emit the character in a readable form. - * Nonprintables are converted to \nnn form, - * while \ is converted to \\. - * Newlines in CR, CR/LF, or LF form will be printed as one newline. - */ - if (ch == '\r') { - printf("\n"); - } else if (ch == '\n') { - if (lastch != '\r') - printf("\n"); - } else if (ch == '\\') { - printf("\\\\"); - } else if (isprint(ch)) { - putc(ch, stdout); - } else { - printf("\\%03o", ch); - } - lastch = ch; - length--; - } - printf("\n"); -} - - -/* - * Process a SOFn marker. - * This code is only needed if you want to know the image dimensions... - */ - -static void -process_SOFn (int marker) -{ - unsigned int length; - unsigned int image_height, image_width; - int data_precision, num_components; - const char * process; - int ci; - - length = read_2_bytes(); /* usual parameter length count */ - - data_precision = read_1_byte(); - image_height = read_2_bytes(); - image_width = read_2_bytes(); - num_components = read_1_byte(); - - switch (marker) { - case M_SOF0: process = "Baseline"; break; - case M_SOF1: process = "Extended sequential"; break; - case M_SOF2: process = "Progressive"; break; - case M_SOF3: process = "Lossless"; break; - case M_SOF5: process = "Differential sequential"; break; - case M_SOF6: process = "Differential progressive"; break; - case M_SOF7: process = "Differential lossless"; break; - case M_SOF9: process = "Extended sequential, arithmetic coding"; break; - case M_SOF10: process = "Progressive, arithmetic coding"; break; - case M_SOF11: process = "Lossless, arithmetic coding"; break; - case M_SOF13: process = "Differential sequential, arithmetic coding"; break; - case M_SOF14: process = "Differential progressive, arithmetic coding"; break; - case M_SOF15: process = "Differential lossless, arithmetic coding"; break; - default: process = "Unknown"; break; - } - - printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - image_width, image_height, num_components, data_precision); - printf("JPEG process: %s\n", process); - - if (length != (unsigned int) (8 + num_components * 3)) - ERREXIT("Bogus SOF marker length"); - - for (ci = 0; ci < num_components; ci++) { - (void) read_1_byte(); /* Component ID code */ - (void) read_1_byte(); /* H, V sampling factors */ - (void) read_1_byte(); /* Quantization table number */ - } -} - - -/* - * Parse the marker stream until SOS or EOI is seen; - * display any COM markers. - * While the companion program wrjpgcom will always insert COM markers before - * SOFn, other implementations might not, so we scan to SOS before stopping. - * If we were only interested in the image dimensions, we would stop at SOFn. - * (Conversely, if we only cared about COM markers, there would be no need - * for special code to handle SOFn; we could treat it like other markers.) - */ - -static int -scan_JPEG_header (int verbose) -{ - int marker; - - /* Expect SOI at start of file */ - if (first_marker() != M_SOI) - ERREXIT("Expected SOI marker first"); - - /* Scan miscellaneous markers until we reach SOS. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - if (verbose) - process_SOFn(marker); - else - skip_variable(); - break; - - case M_SOS: /* stop before hitting compressed data */ - return marker; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: - process_COM(); - break; - - case M_APP12: - /* Some digital camera makers put useful textual information into - * APP12 markers, so we print those out too when in -verbose mode. - */ - if (verbose) { - printf("APP12 contains:\n"); - process_COM(); - } else - skip_variable(); - break; - - default: /* Anything else just gets skipped */ - skip_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - - -/* Command line parsing code */ - -static const char * progname; /* program name for error messages */ - - -static void -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n"); - - fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname); - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -verbose Also display dimensions of JPEG image\n"); - - exit(EXIT_FAILURE); -} - - -static int -keymatch (char * arg, const char * keyword, int minchars) -/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ -/* keyword is the constant keyword (must be lower case already), */ -/* minchars is length of minimum legal abbreviation. */ -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return 0; - return 1; /* A-OK */ -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - int argn; - char * arg; - int verbose = 0; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "rdjpgcom"; /* in case C library doesn't provide it */ - - /* Parse switches, if any */ - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ - if (keymatch(arg, "verbose", 1)) { - verbose++; - } else - usage(); - } - - /* Open the input file. */ - /* Unix style: expect zero or one file name */ - if (argn < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } - if (argn < argc) { - if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open stdin\n", progname); - exit(EXIT_FAILURE); - } -#else - infile = stdin; -#endif - } - - /* Scan the JPEG headers. */ - (void) scan_JPEG_header(verbose); - - /* All done. */ - exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/rdppm.c b/rdppm.c deleted file mode 100644 index 1df35c1b..00000000 --- a/rdppm.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * rdppm.c - * - * Copyright (C) 1991-1997, 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. - * - * This file contains routines to read input images in PPM/PGM format. - * The extended 2-byte-per-sample raw PPM/PGM formats are supported. - * The PBMPLUS library is NOT required to compile this software - * (but it is highly useful as a set of PPM image manipulation programs). - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume input from - * an ordinary stdio stream. They further assume that reading begins - * at the start of the file; start_input may need work if the - * user interface has already read some data (e.g., to determine that - * the file is indeed PPM format). - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef PPM_SUPPORTED - - -/* Portions of this code are based on the PBMPLUS library, which is: -** -** Copyright (C) 1988 by Jef Poskanzer. -** -** Permission to use, copy, modify, and distribute this software and its -** documentation for any purpose and without fee is hereby granted, provided -** that the above copyright notice appear in all copies and that both that -** copyright notice and this permission notice appear in supporting -** documentation. This software is provided "as is" without express or -** implied warranty. -*/ - - -/* Macros to deal with unsigned chars as efficiently as compiler allows */ - -#ifdef HAVE_UNSIGNED_CHAR -typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) -#else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED -typedef char U_CHAR; -#define UCH(x) ((int) (x)) -#else -typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) -#endif -#endif /* HAVE_UNSIGNED_CHAR */ - - -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) - - -/* - * On most systems, reading individual bytes with getc() is drastically less - * efficient than buffering a row at a time with fread(). On PCs, we must - * allocate the buffer in near data space, because we are assuming small-data - * memory model, wherein fread() can't reach far memory. If you need to - * process very wide images on a PC, you might have to compile in large-memory - * model, or else replace fread() with a getc() loop --- which will be much - * slower. - */ - - -/* Private version of data source object */ - -typedef struct { - struct cjpeg_source_struct pub; /* public fields */ - - U_CHAR *iobuffer; /* non-FAR pointer to I/O buffer */ - JSAMPROW pixrow; /* FAR pointer to same */ - size_t buffer_width; /* width of I/O buffer */ - JSAMPLE *rescale; /* => maxval-remapping array, or NULL */ -} ppm_source_struct; - -typedef ppm_source_struct * ppm_source_ptr; - - -LOCAL(int) -pbm_getc (FILE * infile) -/* Read next char, skipping over any comments */ -/* A comment/newline sequence is returned as a newline */ -{ - register int ch; - - ch = getc(infile); - if (ch == '#') { - do { - ch = getc(infile); - } while (ch != '\n' && ch != EOF); - } - return ch; -} - - -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 */ -/* Note that on a 16-bit-int machine, only values up to 64k can be read. */ -/* This should not be a problem in practice. */ -{ - register int ch; - register unsigned int val; - - /* Skip any leading whitespace */ - do { - ch = pbm_getc(infile); - if (ch == EOF) - ERREXIT(cinfo, JERR_INPUT_EOF); - } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'); - - if (ch < '0' || ch > '9') - ERREXIT(cinfo, JERR_PPM_NONNUMERIC); - - val = ch - '0'; - while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') { - val *= 10; - val += ch - '0'; - } - return val; -} - - -/* - * Read one row of pixels. - * - * We provide several different versions depending on input file format. - * In all cases, input is scaled to the size of JSAMPLE. - * - * A really fast path is provided for reading byte/sample raw files with - * maxval = MAXJSAMPLE, which is the normal case for 8-bit data. - */ - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - FILE * infile = source->pub.input_file; - register JSAMPROW ptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - *ptr++ = rescale[read_pbm_integer(cinfo, infile)]; - } - return 1; -} - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - FILE * infile = source->pub.input_file; - register JSAMPROW ptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - *ptr++ = rescale[read_pbm_integer(cinfo, infile)]; - *ptr++ = rescale[read_pbm_integer(cinfo, infile)]; - *ptr++ = rescale[read_pbm_integer(cinfo, infile)]; - } - return 1; -} - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - register JSAMPROW ptr; - register U_CHAR * bufferptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) - ERREXIT(cinfo, JERR_INPUT_EOF); - ptr = source->pub.buffer[0]; - bufferptr = source->iobuffer; - for (col = cinfo->image_width; col > 0; col--) { - *ptr++ = rescale[UCH(*bufferptr++)]; - } - return 1; -} - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - register JSAMPROW ptr; - register U_CHAR * bufferptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) - ERREXIT(cinfo, JERR_INPUT_EOF); - ptr = source->pub.buffer[0]; - bufferptr = source->iobuffer; - for (col = cinfo->image_width; col > 0; col--) { - *ptr++ = rescale[UCH(*bufferptr++)]; - *ptr++ = rescale[UCH(*bufferptr++)]; - *ptr++ = rescale[UCH(*bufferptr++)]; - } - return 1; -} - - -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! - * Note that same code works for PPM and PGM files. - */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - - if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) - ERREXIT(cinfo, JERR_INPUT_EOF); - return 1; -} - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - register JSAMPROW ptr; - register U_CHAR * bufferptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) - ERREXIT(cinfo, JERR_INPUT_EOF); - ptr = source->pub.buffer[0]; - bufferptr = source->iobuffer; - for (col = cinfo->image_width; col > 0; col--) { - register int temp; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; - *ptr++ = rescale[temp]; - } - return 1; -} - - -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 */ -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - register JSAMPROW ptr; - register U_CHAR * bufferptr; - register JSAMPLE *rescale = source->rescale; - JDIMENSION col; - - if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) - ERREXIT(cinfo, JERR_INPUT_EOF); - ptr = source->pub.buffer[0]; - bufferptr = source->iobuffer; - for (col = cinfo->image_width; col > 0; col--) { - register int temp; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; - *ptr++ = rescale[temp]; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; - *ptr++ = rescale[temp]; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; - *ptr++ = rescale[temp]; - } - return 1; -} - - -/* - * Read the file header; return image size and component count. - */ - -METHODDEF(void) -start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - ppm_source_ptr source = (ppm_source_ptr) sinfo; - int c; - unsigned int w, h, maxval; - boolean need_iobuffer, use_raw_buffer, need_rescale; - - if (getc(source->pub.input_file) != 'P') - ERREXIT(cinfo, JERR_PPM_NOT); - - c = getc(source->pub.input_file); /* subformat discriminator character */ - - /* detect unsupported variants (ie, PBM) before trying to read header */ - switch (c) { - case '2': /* it's a text-format PGM file */ - case '3': /* it's a text-format PPM file */ - case '5': /* it's a raw-format PGM file */ - case '6': /* it's a raw-format PPM file */ - break; - default: - ERREXIT(cinfo, JERR_PPM_NOT); - break; - } - - /* fetch the remaining header info */ - w = read_pbm_integer(cinfo, source->pub.input_file); - h = read_pbm_integer(cinfo, source->pub.input_file); - maxval = read_pbm_integer(cinfo, source->pub.input_file); - - if (w <= 0 || h <= 0 || maxval <= 0) /* error check */ - ERREXIT(cinfo, JERR_PPM_NOT); - - cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */ - cinfo->image_width = (JDIMENSION) w; - cinfo->image_height = (JDIMENSION) h; - - /* initialize flags to most common settings */ - need_iobuffer = TRUE; /* do we need an I/O buffer? */ - use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */ - need_rescale = TRUE; /* do we need a rescale array? */ - - switch (c) { - case '2': /* it's a text-format PGM file */ - cinfo->input_components = 1; - cinfo->in_color_space = JCS_GRAYSCALE; - TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h); - source->pub.get_pixel_rows = get_text_gray_row; - need_iobuffer = FALSE; - break; - - case '3': /* it's a text-format PPM file */ - cinfo->input_components = 3; - cinfo->in_color_space = JCS_RGB; - TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h); - source->pub.get_pixel_rows = get_text_rgb_row; - need_iobuffer = FALSE; - break; - - case '5': /* it's a raw-format PGM file */ - cinfo->input_components = 1; - cinfo->in_color_space = JCS_GRAYSCALE; - TRACEMS2(cinfo, 1, JTRC_PGM, w, h); - if (maxval > 255) { - source->pub.get_pixel_rows = get_word_gray_row; - } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) { - source->pub.get_pixel_rows = get_raw_row; - use_raw_buffer = TRUE; - need_rescale = FALSE; - } else { - source->pub.get_pixel_rows = get_scaled_gray_row; - } - break; - - case '6': /* it's a raw-format PPM file */ - cinfo->input_components = 3; - cinfo->in_color_space = JCS_RGB; - TRACEMS2(cinfo, 1, JTRC_PPM, w, h); - if (maxval > 255) { - source->pub.get_pixel_rows = get_word_rgb_row; - } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) { - source->pub.get_pixel_rows = get_raw_row; - use_raw_buffer = TRUE; - need_rescale = FALSE; - } else { - source->pub.get_pixel_rows = get_scaled_rgb_row; - } - break; - } - - /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */ - if (need_iobuffer) { - source->buffer_width = (size_t) w * cinfo->input_components * - ((maxval<=255) ? SIZEOF(U_CHAR) : (2*SIZEOF(U_CHAR))); - source->iobuffer = (U_CHAR *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - source->buffer_width); - } - - /* Create compressor input buffer. */ - if (use_raw_buffer) { - /* For unscaled raw-input case, we can just map it onto the I/O buffer. */ - /* Synthesize a JSAMPARRAY pointer structure */ - /* Cast here implies near->far pointer conversion on PCs */ - source->pixrow = (JSAMPROW) source->iobuffer; - source->pub.buffer = & source->pixrow; - source->pub.buffer_height = 1; - } else { - /* Need to translate anyway, so make a separate sample buffer. */ - source->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) w * cinfo->input_components, (JDIMENSION) 1); - source->pub.buffer_height = 1; - } - - /* Compute the rescaling array if required. */ - if (need_rescale) { - INT32 val, half_maxval; - - /* On 16-bit-int machines we have to be careful of maxval = 65535 */ - source->rescale = (JSAMPLE *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE))); - half_maxval = maxval / 2; - for (val = 0; val <= (INT32) maxval; val++) { - /* The multiplication here must be done in 32 bits to avoid overflow */ - source->rescale[val] = (JSAMPLE) ((val*MAXJSAMPLE + half_maxval)/maxval); - } - } -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - /* no work */ -} - - -/* - * The module selection routine for PPM format input. - */ - -GLOBAL(cjpeg_source_ptr) -jinit_read_ppm (j_compress_ptr cinfo) -{ - ppm_source_ptr source; - - /* Create module interface object */ - source = (ppm_source_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_source_struct)); - /* Fill in method ptrs, except get_pixel_rows which start_input sets */ - source->pub.start_input = start_input_ppm; - source->pub.finish_input = finish_input_ppm; - - return (cjpeg_source_ptr) source; -} - -#endif /* PPM_SUPPORTED */ diff --git a/rdrle.c b/rdrle.c deleted file mode 100644 index 542bc374..00000000 --- a/rdrle.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * rdrle.c - * - * 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. - * - * This file contains routines to read input images in Utah RLE format. - * The Utah Raster Toolkit library is required (version 3.1 or later). - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume input from - * an ordinary stdio stream. They further assume that reading begins - * at the start of the file; start_input may need work if the - * user interface has already read some data (e.g., to determine that - * the file is indeed RLE format). - * - * Based on code contributed by Mike Lijewski, - * with updates from Robert Hutchinson. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef RLE_SUPPORTED - -/* rle.h is provided by the Utah Raster Toolkit. */ - -#include - -/* - * We assume that JSAMPLE has the same representation as rle_pixel, - * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples. - */ - -#if BITS_IN_JSAMPLE != 8 - Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ -#endif - -/* - * We support the following types of RLE files: - * - * GRAYSCALE - 8 bits, no colormap - * MAPPEDGRAY - 8 bits, 1 channel colomap - * PSEUDOCOLOR - 8 bits, 3 channel colormap - * TRUECOLOR - 24 bits, 3 channel colormap - * DIRECTCOLOR - 24 bits, no colormap - * - * For now, we ignore any alpha channel in the image. - */ - -typedef enum - { GRAYSCALE, MAPPEDGRAY, PSEUDOCOLOR, TRUECOLOR, DIRECTCOLOR } rle_kind; - - -/* - * Since RLE stores scanlines bottom-to-top, we have to invert the image - * to conform to JPEG's top-to-bottom order. To do this, we read the - * incoming image into a virtual array on the first get_pixel_rows call, - * then fetch the required row from the virtual array on subsequent calls. - */ - -typedef struct _rle_source_struct * rle_source_ptr; - -typedef struct _rle_source_struct { - struct cjpeg_source_struct pub; /* public fields */ - - rle_kind visual; /* actual type of input file */ - jvirt_sarray_ptr image; /* virtual array to hold the image */ - JDIMENSION row; /* current row # in the virtual array */ - rle_hdr header; /* Input file information */ - rle_pixel** rle_row; /* holds a row returned by rle_getrow() */ - -} rle_source_struct; - - -/* - * Read the file header; return image size and component count. - */ - -METHODDEF(void) -start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - rle_source_ptr source = (rle_source_ptr) sinfo; - JDIMENSION width, height; -#ifdef PROGRESS_REPORT - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; -#endif - - /* Use RLE library routine to get the header info */ - source->header = *rle_hdr_init(NULL); - source->header.rle_file = source->pub.input_file; - switch (rle_get_setup(&(source->header))) { - case RLE_SUCCESS: - /* A-OK */ - break; - case RLE_NOT_RLE: - ERREXIT(cinfo, JERR_RLE_NOT); - break; - case RLE_NO_SPACE: - ERREXIT(cinfo, JERR_RLE_MEM); - break; - case RLE_EMPTY: - ERREXIT(cinfo, JERR_RLE_EMPTY); - break; - case RLE_EOF: - ERREXIT(cinfo, JERR_RLE_EOF); - break; - default: - ERREXIT(cinfo, JERR_RLE_BADERROR); - break; - } - - /* Figure out what we have, set private vars and return values accordingly */ - - width = source->header.xmax - source->header.xmin + 1; - height = source->header.ymax - source->header.ymin + 1; - source->header.xmin = 0; /* realign horizontally */ - source->header.xmax = width-1; - - cinfo->image_width = width; - cinfo->image_height = height; - cinfo->data_precision = 8; /* we can only handle 8 bit data */ - - if (source->header.ncolors == 1 && source->header.ncmap == 0) { - source->visual = GRAYSCALE; - TRACEMS2(cinfo, 1, JTRC_RLE_GRAY, width, height); - } else if (source->header.ncolors == 1 && source->header.ncmap == 1) { - source->visual = MAPPEDGRAY; - TRACEMS3(cinfo, 1, JTRC_RLE_MAPGRAY, width, height, - 1 << source->header.cmaplen); - } else if (source->header.ncolors == 1 && source->header.ncmap == 3) { - source->visual = PSEUDOCOLOR; - TRACEMS3(cinfo, 1, JTRC_RLE_MAPPED, width, height, - 1 << source->header.cmaplen); - } else if (source->header.ncolors == 3 && source->header.ncmap == 3) { - source->visual = TRUECOLOR; - TRACEMS3(cinfo, 1, JTRC_RLE_FULLMAP, width, height, - 1 << source->header.cmaplen); - } else if (source->header.ncolors == 3 && source->header.ncmap == 0) { - source->visual = DIRECTCOLOR; - TRACEMS2(cinfo, 1, JTRC_RLE, width, height); - } else - ERREXIT(cinfo, JERR_RLE_UNSUPPORTED); - - if (source->visual == GRAYSCALE || source->visual == MAPPEDGRAY) { - cinfo->in_color_space = JCS_GRAYSCALE; - cinfo->input_components = 1; - } else { - cinfo->in_color_space = JCS_RGB; - cinfo->input_components = 3; - } - - /* - * A place to hold each scanline while it's converted. - * (GRAYSCALE scanlines don't need converting) - */ - if (source->visual != GRAYSCALE) { - source->rle_row = (rle_pixel**) (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) width, (JDIMENSION) cinfo->input_components); - } - - /* request a virtual array to hold the image */ - source->image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) (width * source->header.ncolors), - (JDIMENSION) height, (JDIMENSION) 1); - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - /* count file input as separate pass */ - progress->total_extra_passes++; - } -#endif - - source->pub.buffer_height = 1; -} - - -/* - * Read one row of pixels. - * Called only after load_image has read the image into the virtual array. - * Used for GRAYSCALE, MAPPEDGRAY, TRUECOLOR, and DIRECTCOLOR images. - */ - -METHODDEF(JDIMENSION) -get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - rle_source_ptr source = (rle_source_ptr) sinfo; - - source->row--; - source->pub.buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE); - - return 1; -} - -/* - * Read one row of pixels. - * Called only after load_image has read the image into the virtual array. - * Used for PSEUDOCOLOR images. - */ - -METHODDEF(JDIMENSION) -get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - rle_source_ptr source = (rle_source_ptr) sinfo; - JSAMPROW src_row, dest_row; - JDIMENSION col; - rle_map *colormap; - int val; - - colormap = source->header.cmap; - dest_row = source->pub.buffer[0]; - source->row--; - src_row = * (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE); - - for (col = cinfo->image_width; col > 0; col--) { - val = GETJSAMPLE(*src_row++); - *dest_row++ = (JSAMPLE) (colormap[val ] >> 8); - *dest_row++ = (JSAMPLE) (colormap[val + 256] >> 8); - *dest_row++ = (JSAMPLE) (colormap[val + 512] >> 8); - } - - return 1; -} - - -/* - * Load the image into a virtual array. We have to do this because RLE - * files start at the lower left while the JPEG standard has them starting - * in the upper left. This is called the first time we want to get a row - * of input. What we do is load the RLE data into the array and then call - * the appropriate routine to read one row from the array. Before returning, - * we set source->pub.get_pixel_rows so that subsequent calls go straight to - * the appropriate row-reading routine. - */ - -METHODDEF(JDIMENSION) -load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - rle_source_ptr source = (rle_source_ptr) sinfo; - JDIMENSION row, col; - JSAMPROW scanline, red_ptr, green_ptr, blue_ptr; - rle_pixel **rle_row; - rle_map *colormap; - char channel; -#ifdef PROGRESS_REPORT - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; -#endif - - colormap = source->header.cmap; - rle_row = source->rle_row; - - /* Read the RLE data into our virtual array. - * We assume here that (a) rle_pixel is represented the same as JSAMPLE, - * and (b) we are not on a machine where FAR pointers differ from regular. - */ - RLE_CLR_BIT(source->header, RLE_ALPHA); /* don't read the alpha channel */ - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_limit = cinfo->image_height; - progress->pub.pass_counter = 0; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - - switch (source->visual) { - - case GRAYSCALE: - case PSEUDOCOLOR: - for (row = 0; row < cinfo->image_height; row++) { - rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE); - rle_getrow(&source->header, rle_row); -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_counter++; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - } - break; - - case MAPPEDGRAY: - case TRUECOLOR: - for (row = 0; row < cinfo->image_height; row++) { - scanline = * (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE); - rle_row = source->rle_row; - rle_getrow(&source->header, rle_row); - - for (col = 0; col < cinfo->image_width; col++) { - for (channel = 0; channel < source->header.ncolors; channel++) { - *scanline++ = (JSAMPLE) - (colormap[GETJSAMPLE(rle_row[channel][col]) + 256 * channel] >> 8); - } - } - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_counter++; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - } - break; - - case DIRECTCOLOR: - for (row = 0; row < cinfo->image_height; row++) { - scanline = * (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE); - rle_getrow(&source->header, rle_row); - - red_ptr = rle_row[0]; - green_ptr = rle_row[1]; - blue_ptr = rle_row[2]; - - for (col = cinfo->image_width; col > 0; col--) { - *scanline++ = *red_ptr++; - *scanline++ = *green_ptr++; - *scanline++ = *blue_ptr++; - } - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_counter++; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - } - } - -#ifdef PROGRESS_REPORT - if (progress != NULL) - progress->completed_extra_passes++; -#endif - - /* Set up to call proper row-extraction routine in future */ - if (source->visual == PSEUDOCOLOR) { - source->pub.buffer = source->rle_row; - source->pub.get_pixel_rows = get_pseudocolor_row; - } else { - source->pub.get_pixel_rows = get_rle_row; - } - source->row = cinfo->image_height; - - /* And fetch the topmost (bottommost) row */ - return (*source->pub.get_pixel_rows) (cinfo, sinfo); -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - /* no work */ -} - - -/* - * The module selection routine for RLE format input. - */ - -GLOBAL(cjpeg_source_ptr) -jinit_read_rle (j_compress_ptr cinfo) -{ - rle_source_ptr source; - - /* Create module interface object */ - source = (rle_source_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(rle_source_struct)); - /* Fill in method ptrs */ - source->pub.start_input = start_input_rle; - source->pub.finish_input = finish_input_rle; - source->pub.get_pixel_rows = load_image; - - return (cjpeg_source_ptr) source; -} - -#endif /* RLE_SUPPORTED */ diff --git a/rdswitch.c b/rdswitch.c deleted file mode 100644 index 4f4bb4f5..00000000 --- a/rdswitch.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * rdswitch.c - * - * 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. - * - * This file contains routines to process some of cjpeg's more complicated - * command-line switches. Switches processed here are: - * -qtables file Read quantization tables from text file - * -scans file Read scan script from text file - * -qslots N[,N,...] Set component quantization table selectors - * -sample HxV[,HxV,...] Set component sampling factors - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include /* to declare isdigit(), isspace() */ - - -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 */ -{ - register int ch; - - ch = getc(file); - if (ch == '#') { - do { - ch = getc(file); - } while (ch != '\n' && ch != EOF); - } - return ch; -} - - -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 */ -{ - register int ch; - register long val; - - /* Skip any leading whitespace, detect EOF */ - do { - ch = text_getc(file); - if (ch == EOF) { - *termchar = ch; - return FALSE; - } - } while (isspace(ch)); - - if (! isdigit(ch)) { - *termchar = ch; - return FALSE; - } - - val = ch - '0'; - while ((ch = text_getc(file)) != EOF) { - if (! isdigit(ch)) - break; - val *= 10; - val += ch - '0'; - } - *result = val; - *termchar = ch; - return TRUE; -} - - -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. - * The file is plain ASCII text: decimal numbers with whitespace between. - * Comments preceded by '#' may be included in the file. - * There may be one to NUM_QUANT_TBLS tables in the file, each of 64 values. - * The tables are implicitly numbered 0,1,etc. - * NOTE: does not affect the qslots mapping, which will default to selecting - * table 0 for luminance (or primary) components, 1 for chrominance components. - * You must use -qslots if you want a different component->table mapping. - */ -{ - FILE * fp; - int tblno, i, termchar; - long val; - unsigned int table[DCTSIZE2]; - - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Can't open table file %s\n", filename); - return FALSE; - } - tblno = 0; - - while (read_text_integer(fp, &val, &termchar)) { /* read 1st element of table */ - if (tblno >= NUM_QUANT_TBLS) { - fprintf(stderr, "Too many tables in file %s\n", filename); - fclose(fp); - return FALSE; - } - table[0] = (unsigned int) val; - for (i = 1; i < DCTSIZE2; i++) { - if (! read_text_integer(fp, &val, &termchar)) { - fprintf(stderr, "Invalid table data in file %s\n", filename); - fclose(fp); - return FALSE; - } - table[i] = (unsigned int) val; - } - jpeg_add_quant_table(cinfo, tblno, table, scale_factor, force_baseline); - tblno++; - } - - if (termchar != EOF) { - fprintf(stderr, "Non-numeric data in file %s\n", filename); - fclose(fp); - return FALSE; - } - - fclose(fp); - return TRUE; -} - - -#ifdef C_MULTISCAN_FILES_SUPPORTED - -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. - */ -{ - register int ch; - - if (! read_text_integer(file, result, termchar)) - return FALSE; - ch = *termchar; - while (ch != EOF && isspace(ch)) - ch = text_getc(file); - if (isdigit(ch)) { /* oops, put it back */ - if (ungetc(ch, file) == EOF) - return FALSE; - ch = ' '; - } else { - /* Any separators other than ';' and ':' are ignored; - * this allows user to insert commas, etc, if desired. - */ - if (ch != EOF && ch != ';' && ch != ':') - ch = ' '; - } - *termchar = ch; - return TRUE; -} - - -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. - * Entries are separated by semicolons ';'. - * An entry contains one to four component indexes, - * optionally followed by a colon ':' and four progressive-JPEG parameters. - * The component indexes denote which component(s) are to be transmitted - * in the current scan. The first component has index 0. - * Sequential JPEG is used if the progressive-JPEG parameters are omitted. - * The file is free format text: any whitespace may appear between numbers - * and the ':' and ';' punctuation marks. Also, other punctuation (such - * as commas or dashes) can be placed between numbers if desired. - * Comments preceded by '#' may be included in the file. - * Note: we do very little validity checking here; - * jcmaster.c will validate the script parameters. - */ -{ - FILE * fp; - int scanno, ncomps, termchar; - long val; - jpeg_scan_info * scanptr; -#define MAX_SCANS 100 /* quite arbitrary limit */ - jpeg_scan_info scans[MAX_SCANS]; - - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Can't open scan definition file %s\n", filename); - return FALSE; - } - scanptr = scans; - scanno = 0; - - while (read_scan_integer(fp, &val, &termchar)) { - if (scanno >= MAX_SCANS) { - fprintf(stderr, "Too many scans defined in file %s\n", filename); - fclose(fp); - return FALSE; - } - scanptr->component_index[0] = (int) val; - ncomps = 1; - while (termchar == ' ') { - if (ncomps >= MAX_COMPS_IN_SCAN) { - fprintf(stderr, "Too many components in one scan in file %s\n", - filename); - fclose(fp); - return FALSE; - } - if (! read_scan_integer(fp, &val, &termchar)) - goto bogus; - scanptr->component_index[ncomps] = (int) val; - ncomps++; - } - scanptr->comps_in_scan = ncomps; - if (termchar == ':') { - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; - scanptr->Ss = (int) val; - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; - scanptr->Se = (int) val; - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; - scanptr->Ah = (int) val; - if (! read_scan_integer(fp, &val, &termchar)) - goto bogus; - scanptr->Al = (int) val; - } else { - /* set non-progressive parameters */ - scanptr->Ss = 0; - scanptr->Se = DCTSIZE2-1; - scanptr->Ah = 0; - scanptr->Al = 0; - } - if (termchar != ';' && termchar != EOF) { -bogus: - fprintf(stderr, "Invalid scan entry format in file %s\n", filename); - fclose(fp); - return FALSE; - } - scanptr++, scanno++; - } - - if (termchar != EOF) { - fprintf(stderr, "Non-numeric data in file %s\n", filename); - fclose(fp); - return FALSE; - } - - if (scanno > 0) { - /* Stash completed scan list in cinfo structure. - * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data, - * but if you want to compress multiple images you'd want JPOOL_PERMANENT. - */ - scanptr = (jpeg_scan_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - scanno * SIZEOF(jpeg_scan_info)); - MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info)); - cinfo->scan_info = scanptr; - cinfo->num_scans = scanno; - } - - fclose(fp); - return TRUE; -} - -#endif /* C_MULTISCAN_FILES_SUPPORTED */ - - -GLOBAL(boolean) -set_quant_slots (j_compress_ptr cinfo, char *arg) -/* Process a quantization-table-selectors parameter string, of the form - * N[,N,...] - * If there are more components than parameters, the last value is replicated. - */ -{ - int val = 0; /* default table # */ - int ci; - char ch; - - for (ci = 0; ci < MAX_COMPONENTS; ci++) { - if (*arg) { - ch = ','; /* if not set by sscanf, will be ',' */ - if (sscanf(arg, "%d%c", &val, &ch) < 1) - return FALSE; - if (ch != ',') /* syntax check */ - return FALSE; - if (val < 0 || val >= NUM_QUANT_TBLS) { - fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n", - NUM_QUANT_TBLS-1); - return FALSE; - } - cinfo->comp_info[ci].quant_tbl_no = val; - while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; - } else { - /* reached end of parameter, set remaining components to last table */ - cinfo->comp_info[ci].quant_tbl_no = val; - } - } - return TRUE; -} - - -GLOBAL(boolean) -set_sample_factors (j_compress_ptr cinfo, char *arg) -/* Process a sample-factors parameter string, of the form - * HxV[,HxV,...] - * If there are more components than parameters, "1x1" is assumed for the rest. - */ -{ - int ci, val1, val2; - char ch1, ch2; - - for (ci = 0; ci < MAX_COMPONENTS; ci++) { - if (*arg) { - ch2 = ','; /* if not set by sscanf, will be ',' */ - if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3) - return FALSE; - if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */ - return FALSE; - if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) { - fprintf(stderr, "JPEG sampling factors must be 1..4\n"); - return FALSE; - } - cinfo->comp_info[ci].h_samp_factor = val1; - cinfo->comp_info[ci].v_samp_factor = val2; - while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; - } else { - /* reached end of parameter, set remaining components to 1x1 sampling */ - cinfo->comp_info[ci].h_samp_factor = 1; - cinfo->comp_info[ci].v_samp_factor = 1; - } - } - return TRUE; -} diff --git a/rdtarga.c b/rdtarga.c deleted file mode 100644 index 4c2cd267..00000000 --- a/rdtarga.c +++ /dev/null @@ -1,500 +0,0 @@ -/* - * rdtarga.c - * - * 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. - * - * This file contains routines to read input images in Targa format. - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume input from - * an ordinary stdio stream. They further assume that reading begins - * at the start of the file; start_input may need work if the - * user interface has already read some data (e.g., to determine that - * the file is indeed Targa format). - * - * Based on code contributed by Lee Daniel Crocker. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef TARGA_SUPPORTED - - -/* Macros to deal with unsigned chars as efficiently as compiler allows */ - -#ifdef HAVE_UNSIGNED_CHAR -typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) -#else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED -typedef char U_CHAR; -#define UCH(x) ((int) (x)) -#else -typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) -#endif -#endif /* HAVE_UNSIGNED_CHAR */ - - -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) - - -/* Private version of data source object */ - -typedef struct _tga_source_struct * tga_source_ptr; - -typedef struct _tga_source_struct { - struct cjpeg_source_struct pub; /* public fields */ - - j_compress_ptr cinfo; /* back link saves passing separate parm */ - - JSAMPARRAY colormap; /* Targa colormap (converted to my format) */ - - jvirt_sarray_ptr whole_image; /* Needed if funny input row order */ - JDIMENSION current_row; /* Current logical row number to read */ - - /* Pointer to routine to extract next Targa pixel from input file */ - JMETHOD(void, read_pixel, (tga_source_ptr sinfo)); - - /* Result of read_pixel is delivered here: */ - U_CHAR tga_pixel[4]; - - int pixel_size; /* Bytes per Targa pixel (1 to 4) */ - - /* State info for reading RLE-coded pixels; both counts must be init to 0 */ - int block_count; /* # of pixels remaining in RLE block */ - int dup_pixel_count; /* # of times to duplicate previous pixel */ - - /* This saves the correct pixel-row-expansion method for preload_image */ - JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); -} tga_source_struct; - - -/* For expanding 5-bit pixel values to 8-bit with best rounding */ - -static const UINT8 c5to8bits[32] = { - 0, 8, 16, 25, 33, 41, 49, 58, - 66, 74, 82, 90, 99, 107, 115, 123, - 132, 140, 148, 156, 165, 173, 181, 189, - 197, 206, 214, 222, 230, 239, 247, 255 -}; - - - -LOCAL(int) -read_byte (tga_source_ptr sinfo) -/* Read next byte from Targa file */ -{ - register FILE *infile = sinfo->pub.input_file; - register int c; - - if ((c = getc(infile)) == EOF) - ERREXIT(sinfo->cinfo, JERR_INPUT_EOF); - return c; -} - - -LOCAL(void) -read_colormap (tga_source_ptr sinfo, int cmaplen, int mapentrysize) -/* Read the colormap from a Targa file */ -{ - int i; - - /* Presently only handles 24-bit BGR format */ - if (mapentrysize != 24) - ERREXIT(sinfo->cinfo, JERR_TGA_BADCMAP); - - for (i = 0; i < cmaplen; i++) { - sinfo->colormap[2][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[1][i] = (JSAMPLE) read_byte(sinfo); - sinfo->colormap[0][i] = (JSAMPLE) read_byte(sinfo); - } -} - - -/* - * read_pixel methods: get a single pixel from Targa file into tga_pixel[] - */ - -METHODDEF(void) -read_non_rle_pixel (tga_source_ptr sinfo) -/* Read one Targa pixel from the input file; no RLE expansion */ -{ - register FILE *infile = sinfo->pub.input_file; - register int i; - - for (i = 0; i < sinfo->pixel_size; i++) { - sinfo->tga_pixel[i] = (U_CHAR) getc(infile); - } -} - - -METHODDEF(void) -read_rle_pixel (tga_source_ptr sinfo) -/* Read one Targa pixel from the input file, expanding RLE data as needed */ -{ - register FILE *infile = sinfo->pub.input_file; - register int i; - - /* Duplicate previously read pixel? */ - if (sinfo->dup_pixel_count > 0) { - sinfo->dup_pixel_count--; - return; - } - - /* Time to read RLE block header? */ - if (--sinfo->block_count < 0) { /* decrement pixels remaining in block */ - i = read_byte(sinfo); - if (i & 0x80) { /* Start of duplicate-pixel block? */ - sinfo->dup_pixel_count = i & 0x7F; /* number of dups after this one */ - sinfo->block_count = 0; /* then read new block header */ - } else { - sinfo->block_count = i & 0x7F; /* number of pixels after this one */ - } - } - - /* Read next pixel */ - for (i = 0; i < sinfo->pixel_size; i++) { - sinfo->tga_pixel[i] = (U_CHAR) getc(infile); - } -} - - -/* - * Read one row of pixels. - * - * We provide several different versions depending on input file format. - */ - - -METHODDEF(JDIMENSION) -get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 8-bit grayscale pixels */ -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - register JSAMPROW ptr; - register JDIMENSION col; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ - *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]); - } - return 1; -} - -METHODDEF(JDIMENSION) -get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 8-bit colormap indexes */ -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - register int t; - register JSAMPROW ptr; - register JDIMENSION col; - register JSAMPARRAY colormap = source->colormap; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ - t = UCH(source->tga_pixel[0]); - *ptr++ = colormap[0][t]; - *ptr++ = colormap[1][t]; - *ptr++ = colormap[2][t]; - } - return 1; -} - -METHODDEF(JDIMENSION) -get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 16-bit pixels */ -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - register int t; - register JSAMPROW ptr; - register JDIMENSION col; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ - t = UCH(source->tga_pixel[0]); - t += UCH(source->tga_pixel[1]) << 8; - /* We expand 5 bit data to 8 bit sample width. - * The format of the 16-bit (LSB first) input word is - * xRRRRRGGGGGBBBBB - */ - ptr[2] = (JSAMPLE) c5to8bits[t & 0x1F]; - t >>= 5; - ptr[1] = (JSAMPLE) c5to8bits[t & 0x1F]; - t >>= 5; - ptr[0] = (JSAMPLE) c5to8bits[t & 0x1F]; - ptr += 3; - } - return 1; -} - -METHODDEF(JDIMENSION) -get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -/* This version is for reading 24-bit pixels */ -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - register JSAMPROW ptr; - register JDIMENSION col; - - ptr = source->pub.buffer[0]; - for (col = cinfo->image_width; col > 0; col--) { - (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ - *ptr++ = (JSAMPLE) UCH(source->tga_pixel[2]); /* change BGR to RGB order */ - *ptr++ = (JSAMPLE) UCH(source->tga_pixel[1]); - *ptr++ = (JSAMPLE) UCH(source->tga_pixel[0]); - } - return 1; -} - -/* - * Targa also defines a 32-bit pixel format with order B,G,R,A. - * We presently ignore the attribute byte, so the code for reading - * these pixels is identical to the 24-bit routine above. - * This works because the actual pixel length is only known to read_pixel. - */ - -#define get_32bit_row get_24bit_row - - -/* - * This method is for re-reading the input data in standard top-down - * row order. The entire image has already been read into whole_image - * with proper conversion of pixel format, but it's in a funny row order. - */ - -METHODDEF(JDIMENSION) -get_memory_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - JDIMENSION source_row; - - /* Compute row of source that maps to current_row of normal order */ - /* For now, assume image is bottom-up and not interlaced. */ - /* NEEDS WORK to support interlaced images! */ - source_row = cinfo->image_height - source->current_row - 1; - - /* Fetch that row from virtual array */ - source->pub.buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->whole_image, - source_row, (JDIMENSION) 1, FALSE); - - source->current_row++; - return 1; -} - - -/* - * This method loads the image into whole_image during the first call on - * get_pixel_rows. The get_pixel_rows pointer is then adjusted to call - * get_memory_row on subsequent calls. - */ - -METHODDEF(JDIMENSION) -preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - JDIMENSION row; - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - - /* Read the data into a virtual array in input-file row order. */ - for (row = 0; row < cinfo->image_height; row++) { - if (progress != NULL) { - progress->pub.pass_counter = (long) row; - progress->pub.pass_limit = (long) cinfo->image_height; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } - source->pub.buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, source->whole_image, row, (JDIMENSION) 1, TRUE); - (*source->get_pixel_rows) (cinfo, sinfo); - } - if (progress != NULL) - progress->completed_extra_passes++; - - /* Set up to read from the virtual array in unscrambled order */ - source->pub.get_pixel_rows = get_memory_row; - source->current_row = 0; - /* And read the first row */ - return get_memory_row(cinfo, sinfo); -} - - -/* - * Read the file header; return image size and component count. - */ - -METHODDEF(void) -start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - tga_source_ptr source = (tga_source_ptr) sinfo; - U_CHAR targaheader[18]; - int idlen, cmaptype, subtype, flags, interlace_type, components; - unsigned int width, height, maplen; - boolean is_bottom_up; - -#define GET_2B(offset) ((unsigned int) UCH(targaheader[offset]) + \ - (((unsigned int) UCH(targaheader[offset+1])) << 8)) - - if (! ReadOK(source->pub.input_file, targaheader, 18)) - ERREXIT(cinfo, JERR_INPUT_EOF); - - /* Pretend "15-bit" pixels are 16-bit --- we ignore attribute bit anyway */ - if (targaheader[16] == 15) - targaheader[16] = 16; - - idlen = UCH(targaheader[0]); - cmaptype = UCH(targaheader[1]); - subtype = UCH(targaheader[2]); - maplen = GET_2B(5); - width = GET_2B(12); - height = GET_2B(14); - source->pixel_size = UCH(targaheader[16]) >> 3; - flags = UCH(targaheader[17]); /* Image Descriptor byte */ - - is_bottom_up = ((flags & 0x20) == 0); /* bit 5 set => top-down */ - interlace_type = flags >> 6; /* bits 6/7 are interlace code */ - - if (cmaptype > 1 || /* cmaptype must be 0 or 1 */ - source->pixel_size < 1 || source->pixel_size > 4 || - (UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */ - interlace_type != 0) /* currently don't allow interlaced image */ - ERREXIT(cinfo, JERR_TGA_BADPARMS); - - if (subtype > 8) { - /* It's an RLE-coded file */ - source->read_pixel = read_rle_pixel; - source->block_count = source->dup_pixel_count = 0; - subtype -= 8; - } else { - /* Non-RLE file */ - source->read_pixel = read_non_rle_pixel; - } - - /* Now should have subtype 1, 2, or 3 */ - components = 3; /* until proven different */ - cinfo->in_color_space = JCS_RGB; - - switch (subtype) { - case 1: /* Colormapped image */ - if (source->pixel_size == 1 && cmaptype == 1) - source->get_pixel_rows = get_8bit_row; - else - ERREXIT(cinfo, JERR_TGA_BADPARMS); - TRACEMS2(cinfo, 1, JTRC_TGA_MAPPED, width, height); - break; - case 2: /* RGB image */ - switch (source->pixel_size) { - case 2: - source->get_pixel_rows = get_16bit_row; - break; - case 3: - source->get_pixel_rows = get_24bit_row; - break; - case 4: - source->get_pixel_rows = get_32bit_row; - break; - default: - ERREXIT(cinfo, JERR_TGA_BADPARMS); - break; - } - TRACEMS2(cinfo, 1, JTRC_TGA, width, height); - break; - case 3: /* Grayscale image */ - components = 1; - cinfo->in_color_space = JCS_GRAYSCALE; - if (source->pixel_size == 1) - source->get_pixel_rows = get_8bit_gray_row; - else - ERREXIT(cinfo, JERR_TGA_BADPARMS); - TRACEMS2(cinfo, 1, JTRC_TGA_GRAY, width, height); - break; - default: - ERREXIT(cinfo, JERR_TGA_BADPARMS); - break; - } - - if (is_bottom_up) { - /* Create a virtual array to buffer the upside-down image. */ - source->whole_image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) width * components, (JDIMENSION) height, (JDIMENSION) 1); - if (cinfo->progress != NULL) { - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - progress->total_extra_passes++; /* count file input as separate pass */ - } - /* source->pub.buffer will point to the virtual array. */ - source->pub.buffer_height = 1; /* in case anyone looks at it */ - source->pub.get_pixel_rows = preload_image; - } else { - /* Don't need a virtual array, but do need a one-row input buffer. */ - source->whole_image = NULL; - source->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) width * components, (JDIMENSION) 1); - source->pub.buffer_height = 1; - source->pub.get_pixel_rows = source->get_pixel_rows; - } - - while (idlen--) /* Throw away ID field */ - (void) read_byte(source); - - if (maplen > 0) { - if (maplen > 256 || GET_2B(3) != 0) - ERREXIT(cinfo, JERR_TGA_BADCMAP); - /* Allocate space to store the colormap */ - source->colormap = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) maplen, (JDIMENSION) 3); - /* and read it from the file */ - read_colormap(source, (int) maplen, UCH(targaheader[7])); - } else { - if (cmaptype) /* but you promised a cmap! */ - ERREXIT(cinfo, JERR_TGA_BADPARMS); - source->colormap = NULL; - } - - cinfo->input_components = components; - cinfo->data_precision = 8; - cinfo->image_width = width; - cinfo->image_height = height; -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) -{ - /* no work */ -} - - -/* - * The module selection routine for Targa format input. - */ - -GLOBAL(cjpeg_source_ptr) -jinit_read_targa (j_compress_ptr cinfo) -{ - tga_source_ptr source; - - /* Create module interface object */ - source = (tga_source_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_source_struct)); - source->cinfo = cinfo; /* make back link for subroutines */ - /* Fill in method ptrs, except get_pixel_rows which start_input sets */ - source->pub.start_input = start_input_tga; - source->pub.finish_input = finish_input_tga; - - return (cjpeg_source_ptr) source; -} - -#endif /* TARGA_SUPPORTED */ diff --git a/structure.doc b/structure.doc deleted file mode 100644 index 51c9def7..00000000 --- a/structure.doc +++ /dev/null @@ -1,948 +0,0 @@ -IJG JPEG LIBRARY: SYSTEM ARCHITECTURE - -Copyright (C) 1991-1995, 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. - - -This file provides an overview of the architecture of the IJG JPEG software; -that is, the functions of the various modules in the system and the interfaces -between modules. For more precise details about any data structure or calling -convention, see the include files and comments in the source code. - -We assume that the reader is already somewhat familiar with the JPEG standard. -The README file includes references for learning about JPEG. The file -libjpeg.doc describes the library from the viewpoint of an application -programmer using the library; it's best to read that file before this one. -Also, the file coderules.doc describes the coding style conventions we use. - -In this document, JPEG-specific terminology follows the JPEG standard: - A "component" means a color channel, e.g., Red or Luminance. - A "sample" is a single component value (i.e., one number in the image data). - A "coefficient" is a frequency coefficient (a DCT transform output number). - A "block" is an 8x8 group of samples or coefficients. - An "MCU" (minimum coded unit) is an interleaved set of blocks of size - determined by the sampling factors, or a single block in a - noninterleaved scan. -We do not use the terms "pixel" and "sample" interchangeably. When we say -pixel, we mean an element of the full-size image, while a sample is an element -of the downsampled image. Thus the number of samples may vary across -components while the number of pixels does not. (This terminology is not used -rigorously throughout the code, but it is used in places where confusion would -otherwise result.) - - -*** System features *** - -The IJG distribution contains two parts: - * A subroutine library for JPEG compression and decompression. - * cjpeg/djpeg, two sample applications that use the library to transform - JFIF JPEG files to and from several other image formats. -cjpeg/djpeg are of no great intellectual complexity: they merely add a simple -command-line user interface and I/O routines for several uncompressed image -formats. This document concentrates on the library itself. - -We desire the library to be capable of supporting all JPEG baseline, extended -sequential, and progressive DCT processes. Hierarchical processes are not -supported. - -The library does not support the lossless (spatial) JPEG process. Lossless -JPEG shares little or no code with lossy JPEG, and would normally be used -without the extensive pre- and post-processing provided by this library. -We feel that lossless JPEG is better handled by a separate library. - -Within these limits, any set of compression parameters allowed by the JPEG -spec should be readable for decompression. (We can be more restrictive about -what formats we can generate.) Although the system design allows for all -parameter values, some uncommon settings are not yet implemented and may -never be; nonintegral sampling ratios are the prime example. Furthermore, -we treat 8-bit vs. 12-bit data precision as a compile-time switch, not a -run-time option, because most machines can store 8-bit pixels much more -compactly than 12-bit. - -For legal reasons, JPEG arithmetic coding is not currently supported, but -extending the library to include it would be straightforward. - -By itself, the library handles only interchange JPEG datastreams --- in -particular the widely used JFIF file format. The library can be used by -surrounding code to process interchange or abbreviated JPEG datastreams that -are embedded in more complex file formats. (For example, libtiff uses this -library to implement JPEG compression within the TIFF file format.) - -The library includes a substantial amount of code that is not covered by the -JPEG standard but is necessary for typical applications of JPEG. These -functions preprocess the image before JPEG compression or postprocess it after -decompression. They include colorspace conversion, downsampling/upsampling, -and color quantization. This code can be omitted if not needed. - -A wide range of quality vs. speed tradeoffs are possible in JPEG processing, -and even more so in decompression postprocessing. The decompression library -provides multiple implementations that cover most of the useful tradeoffs, -ranging from very-high-quality down to fast-preview operation. On the -compression side we have generally not provided low-quality choices, since -compression is normally less time-critical. It should be understood that the -low-quality modes may not meet the JPEG standard's accuracy requirements; -nonetheless, they are useful for viewers. - - -*** Portability issues *** - -Portability is an essential requirement for the library. The key portability -issues that show up at the level of system architecture are: - -1. Memory usage. We want the code to be able to run on PC-class machines -with limited memory. Images should therefore be processed sequentially (in -strips), to avoid holding the whole image in memory at once. Where a -full-image buffer is necessary, we should be able to use either virtual memory -or temporary files. - -2. Near/far pointer distinction. To run efficiently on 80x86 machines, the -code should distinguish "small" objects (kept in near data space) from -"large" ones (kept in far data space). This is an annoying restriction, but -fortunately it does not impact code quality for less brain-damaged machines, -and the source code clutter turns out to be minimal with sufficient use of -pointer typedefs. - -3. Data precision. We assume that "char" is at least 8 bits, "short" and -"int" at least 16, "long" at least 32. The code will work fine with larger -data sizes, although memory may be used inefficiently in some cases. However, -the JPEG compressed datastream must ultimately appear on external storage as a -sequence of 8-bit bytes if it is to conform to the standard. This may pose a -problem on machines where char is wider than 8 bits. The library represents -compressed data as an array of values of typedef JOCTET. If no data type -exactly 8 bits wide is available, custom data source and data destination -modules must be written to unpack and pack the chosen JOCTET datatype into -8-bit external representation. - - -*** System overview *** - -The compressor and decompressor are each divided into two main sections: -the JPEG compressor or decompressor proper, and the preprocessing or -postprocessing functions. The interface between these two sections is the -image data that the official JPEG spec regards as its input or output: this -data is in the colorspace to be used for compression, and it is downsampled -to the sampling factors to be used. The preprocessing and postprocessing -steps are responsible for converting a normal image representation to or from -this form. (Those few applications that want to deal with YCbCr downsampled -data can skip the preprocessing or postprocessing step.) - -Looking more closely, the compressor library contains the following main -elements: - - Preprocessing: - * Color space conversion (e.g., RGB to YCbCr). - * Edge expansion and downsampling. Optionally, this step can do simple - smoothing --- this is often helpful for low-quality source data. - JPEG proper: - * MCU assembly, DCT, quantization. - * Entropy coding (sequential or progressive, Huffman or arithmetic). - -In addition to these modules we need overall control, marker generation, -and support code (memory management & error handling). There is also a -module responsible for physically writing the output data --- typically -this is just an interface to fwrite(), but some applications may need to -do something else with the data. - -The decompressor library contains the following main elements: - - JPEG proper: - * Entropy decoding (sequential or progressive, Huffman or arithmetic). - * Dequantization, inverse DCT, MCU disassembly. - Postprocessing: - * Upsampling. Optionally, this step may be able to do more general - rescaling of the image. - * Color space conversion (e.g., YCbCr to RGB). This step may also - provide gamma adjustment [ currently it does not ]. - * Optional color quantization (e.g., reduction to 256 colors). - * Optional color precision reduction (e.g., 24-bit to 15-bit color). - [This feature is not currently implemented.] - -We also need overall control, marker parsing, and a data source module. -The support code (memory management & error handling) can be shared with -the compression half of the library. - -There may be several implementations of each of these elements, particularly -in the decompressor, where a wide range of speed/quality tradeoffs is very -useful. It must be understood that some of the best speedups involve -merging adjacent steps in the pipeline. For example, upsampling, color space -conversion, and color quantization might all be done at once when using a -low-quality ordered-dither technique. The system architecture is designed to -allow such merging where appropriate. - - -Note: it is convenient to regard edge expansion (padding to block boundaries) -as a preprocessing/postprocessing function, even though the JPEG spec includes -it in compression/decompression. We do this because downsampling/upsampling -can be simplified a little if they work on padded data: it's not necessary to -have special cases at the right and bottom edges. Therefore the interface -buffer is always an integral number of blocks wide and high, and we expect -compression preprocessing to pad the source data properly. Padding will occur -only to the next block (8-sample) boundary. In an interleaved-scan situation, -additional dummy blocks may be used to fill out MCUs, but the MCU assembly and -disassembly logic will create or discard these blocks internally. (This is -advantageous for speed reasons, since we avoid DCTing the dummy blocks. -It also permits a small reduction in file size, because the compressor can -choose dummy block contents so as to minimize their size in compressed form. -Finally, it makes the interface buffer specification independent of whether -the file is actually interleaved or not.) Applications that wish to deal -directly with the downsampled data must provide similar buffering and padding -for odd-sized images. - - -*** Poor man's object-oriented programming *** - -It should be clear by now that we have a lot of quasi-independent processing -steps, many of which have several possible behaviors. To avoid cluttering the -code with lots of switch statements, we use a simple form of object-style -programming to separate out the different possibilities. - -For example, two different color quantization algorithms could be implemented -as two separate modules that present the same external interface; at runtime, -the calling code will access the proper module indirectly through an "object". - -We can get the limited features we need while staying within portable C. -The basic tool is a function pointer. An "object" is just a struct -containing one or more function pointer fields, each of which corresponds to -a method name in real object-oriented languages. During initialization we -fill in the function pointers with references to whichever module we have -determined we need to use in this run. Then invocation of the module is done -by indirecting through a function pointer; on most machines this is no more -expensive than a switch statement, which would be the only other way of -making the required run-time choice. The really significant benefit, of -course, is keeping the source code clean and well structured. - -We can also arrange to have private storage that varies between different -implementations of the same kind of object. We do this by making all the -module-specific object structs be separately allocated entities, which will -be accessed via pointers in the master compression or decompression struct. -The "public" fields or methods for a given kind of object are specified by -a commonly known struct. But a module's initialization code can allocate -a larger struct that contains the common struct as its first member, plus -additional private fields. With appropriate pointer casting, the module's -internal functions can access these private fields. (For a simple example, -see jdatadst.c, which implements the external interface specified by struct -jpeg_destination_mgr, but adds extra fields.) - -(Of course this would all be a lot easier if we were using C++, but we are -not yet prepared to assume that everyone has a C++ compiler.) - -An important benefit of this scheme is that it is easy to provide multiple -versions of any method, each tuned to a particular case. While a lot of -precalculation might be done to select an optimal implementation of a method, -the cost per invocation is constant. For example, the upsampling step might -have a "generic" method, plus one or more "hardwired" methods for the most -popular sampling factors; the hardwired methods would be faster because they'd -use straight-line code instead of for-loops. The cost to determine which -method to use is paid only once, at startup, and the selection criteria are -hidden from the callers of the method. - -This plan differs a little bit from usual object-oriented structures, in that -only one instance of each object class will exist during execution. The -reason for having the class structure is that on different runs we may create -different instances (choose to execute different modules). You can think of -the term "method" as denoting the common interface presented by a particular -set of interchangeable functions, and "object" as denoting a group of related -methods, or the total shared interface behavior of a group of modules. - - -*** Overall control structure *** - -We previously mentioned the need for overall control logic in the compression -and decompression libraries. In IJG implementations prior to v5, overall -control was mostly provided by "pipeline control" modules, which proved to be -large, unwieldy, and hard to understand. To improve the situation, the -control logic has been subdivided into multiple modules. The control modules -consist of: - -1. Master control for module selection and initialization. This has two -responsibilities: - - 1A. Startup initialization at the beginning of image processing. - The individual processing modules to be used in this run are selected - and given initialization calls. - - 1B. Per-pass control. This determines how many passes will be performed - and calls each active processing module to configure itself - appropriately at the beginning of each pass. End-of-pass processing, - where necessary, is also invoked from the master control module. - - Method selection is partially distributed, in that a particular processing - module may contain several possible implementations of a particular method, - which it will select among when given its initialization call. The master - control code need only be concerned with decisions that affect more than - one module. - -2. Data buffering control. A separate control module exists for each - inter-processing-step data buffer. This module is responsible for - invoking the processing steps that write or read that data buffer. - -Each buffer controller sees the world as follows: - -input data => processing step A => buffer => processing step B => output data - | | | - ------------------ controller ------------------ - -The controller knows the dataflow requirements of steps A and B: how much data -they want to accept in one chunk and how much they output in one chunk. Its -function is to manage its buffer and call A and B at the proper times. - -A data buffer control module may itself be viewed as a processing step by a -higher-level control module; thus the control modules form a binary tree with -elementary processing steps at the leaves of the tree. - -The control modules are objects. A considerable amount of flexibility can -be had by replacing implementations of a control module. For example: -* Merging of adjacent steps in the pipeline is done by replacing a control - module and its pair of processing-step modules with a single processing- - step module. (Hence the possible merges are determined by the tree of - control modules.) -* In some processing modes, a given interstep buffer need only be a "strip" - buffer large enough to accommodate the desired data chunk sizes. In other - modes, a full-image buffer is needed and several passes are required. - The control module determines which kind of buffer is used and manipulates - virtual array buffers as needed. One or both processing steps may be - unaware of the multi-pass behavior. - -In theory, we might be able to make all of the data buffer controllers -interchangeable and provide just one set of implementations for all. In -practice, each one contains considerable special-case processing for its -particular job. The buffer controller concept should be regarded as an -overall system structuring principle, not as a complete description of the -task performed by any one controller. - - -*** Compression object structure *** - -Here is a sketch of the logical structure of the JPEG compression library: - - |-- Colorspace conversion - |-- Preprocessing controller --| - | |-- Downsampling -Main controller --| - | |-- Forward DCT, quantize - |-- Coefficient controller --| - |-- Entropy encoding - -This sketch also describes the flow of control (subroutine calls) during -typical image data processing. Each of the components shown in the diagram is -an "object" which may have several different implementations available. One -or more source code files contain the actual implementation(s) of each object. - -The objects shown above are: - -* Main controller: buffer controller for the subsampled-data buffer, which - holds the preprocessed input data. This controller invokes preprocessing to - fill the subsampled-data buffer, and JPEG compression to empty it. There is - usually no need for a full-image buffer here; a strip buffer is adequate. - -* Preprocessing controller: buffer controller for the downsampling input data - buffer, which lies between colorspace conversion and downsampling. Note - that a unified conversion/downsampling module would probably replace this - controller entirely. - -* Colorspace conversion: converts application image data into the desired - JPEG color space; also changes the data from pixel-interleaved layout to - separate component planes. Processes one pixel row at a time. - -* Downsampling: performs reduction of chroma components as required. - Optionally may perform pixel-level smoothing as well. Processes a "row - group" at a time, where a row group is defined as Vmax pixel rows of each - component before downsampling, and Vk sample rows afterwards (remember Vk - differs across components). Some downsampling or smoothing algorithms may - require context rows above and below the current row group; the - preprocessing controller is responsible for supplying these rows via proper - buffering. The downsampler is responsible for edge expansion at the right - edge (i.e., extending each sample row to a multiple of 8 samples); but the - preprocessing controller is responsible for vertical edge expansion (i.e., - duplicating the bottom sample row as needed to make a multiple of 8 rows). - -* Coefficient controller: buffer controller for the DCT-coefficient data. - This controller handles MCU assembly, including insertion of dummy DCT - blocks when needed at the right or bottom edge. When performing - Huffman-code optimization or emitting a multiscan JPEG file, this - controller is responsible for buffering the full image. The equivalent of - one fully interleaved MCU row of subsampled data is processed per call, - even when the JPEG file is noninterleaved. - -* Forward DCT and quantization: Perform DCT, quantize, and emit coefficients. - Works on one or more DCT blocks at a time. (Note: the coefficients are now - emitted in normal array order, which the entropy encoder is expected to - convert to zigzag order as necessary. Prior versions of the IJG code did - the conversion to zigzag order within the quantization step.) - -* Entropy encoding: Perform Huffman or arithmetic entropy coding and emit the - coded data to the data destination module. Works on one MCU per call. - For progressive JPEG, the same DCT blocks are fed to the entropy coder - during each pass, and the coder must emit the appropriate subset of - coefficients. - -In addition to the above objects, the compression library includes these -objects: - -* Master control: determines the number of passes required, controls overall - and per-pass initialization of the other modules. - -* Marker writing: generates JPEG markers (except for RSTn, which is emitted - by the entropy encoder when needed). - -* Data destination manager: writes the output JPEG datastream to its final - destination (e.g., a file). The destination manager supplied with the - library knows how to write to a stdio stream; for other behaviors, the - surrounding application may provide its own destination manager. - -* Memory manager: allocates and releases memory, controls virtual arrays - (with backing store management, where required). - -* Error handler: performs formatting and output of error and trace messages; - determines handling of nonfatal errors. The surrounding application may - override some or all of this object's methods to change error handling. - -* Progress monitor: supports output of "percent-done" progress reports. - This object represents an optional callback to the surrounding application: - if wanted, it must be supplied by the application. - -The error handler, destination manager, and progress monitor objects are -defined as separate objects in order to simplify application-specific -customization of the JPEG library. A surrounding application may override -individual methods or supply its own all-new implementation of one of these -objects. The object interfaces for these objects are therefore treated as -part of the application interface of the library, whereas the other objects -are internal to the library. - -The error handler and memory manager are shared by JPEG compression and -decompression; the progress monitor, if used, may be shared as well. - - -*** Decompression object structure *** - -Here is a sketch of the logical structure of the JPEG decompression library: - - |-- Entropy decoding - |-- Coefficient controller --| - | |-- Dequantize, Inverse DCT -Main controller --| - | |-- Upsampling - |-- Postprocessing controller --| |-- Colorspace conversion - |-- Color quantization - |-- Color precision reduction - -As before, this diagram also represents typical control flow. The objects -shown are: - -* Main controller: buffer controller for the subsampled-data buffer, which - holds the output of JPEG decompression proper. This controller's primary - task is to feed the postprocessing procedure. Some upsampling algorithms - may require context rows above and below the current row group; when this - is true, the main controller is responsible for managing its buffer so as - to make context rows available. In the current design, the main buffer is - always a strip buffer; a full-image buffer is never required. - -* Coefficient controller: buffer controller for the DCT-coefficient data. - This controller handles MCU disassembly, including deletion of any dummy - DCT blocks at the right or bottom edge. When reading a multiscan JPEG - file, this controller is responsible for buffering the full image. - (Buffering DCT coefficients, rather than samples, is necessary to support - progressive JPEG.) The equivalent of one fully interleaved MCU row of - subsampled data is processed per call, even when the source JPEG file is - noninterleaved. - -* Entropy decoding: Read coded data from the data source module and perform - Huffman or arithmetic entropy decoding. Works on one MCU per call. - For progressive JPEG decoding, the coefficient controller supplies the prior - coefficients of each MCU (initially all zeroes), which the entropy decoder - modifies in each scan. - -* Dequantization and inverse DCT: like it says. Note that the coefficients - buffered by the coefficient controller have NOT been dequantized; we - merge dequantization and inverse DCT into a single step for speed reasons. - When scaled-down output is asked for, simplified DCT algorithms may be used - that emit only 1x1, 2x2, or 4x4 samples per DCT block, not the full 8x8. - Works on one DCT block at a time. - -* Postprocessing controller: buffer controller for the color quantization - input buffer, when quantization is in use. (Without quantization, this - controller just calls the upsampler.) For two-pass quantization, this - controller is responsible for buffering the full-image data. - -* Upsampling: restores chroma components to full size. (May support more - general output rescaling, too. Note that if undersized DCT outputs have - been emitted by the DCT module, this module must adjust so that properly - sized outputs are created.) Works on one row group at a time. This module - also calls the color conversion module, so its top level is effectively a - buffer controller for the upsampling->color conversion buffer. However, in - all but the highest-quality operating modes, upsampling and color - conversion are likely to be merged into a single step. - -* Colorspace conversion: convert from JPEG color space to output color space, - and change data layout from separate component planes to pixel-interleaved. - Works on one pixel row at a time. - -* Color quantization: reduce the data to colormapped form, using either an - externally specified colormap or an internally generated one. This module - is not used for full-color output. Works on one pixel row at a time; may - require two passes to generate a color map. Note that the output will - always be a single component representing colormap indexes. In the current - design, the output values are JSAMPLEs, so an 8-bit compilation cannot - quantize to more than 256 colors. This is unlikely to be a problem in - practice. - -* Color reduction: this module handles color precision reduction, e.g., - generating 15-bit color (5 bits/primary) from JPEG's 24-bit output. - Not quite clear yet how this should be handled... should we merge it with - colorspace conversion??? - -Note that some high-speed operating modes might condense the entire -postprocessing sequence to a single module (upsample, color convert, and -quantize in one step). - -In addition to the above objects, the decompression library includes these -objects: - -* Master control: determines the number of passes required, controls overall - and per-pass initialization of the other modules. This is subdivided into - input and output control: jdinput.c controls only input-side processing, - while jdmaster.c handles overall initialization and output-side control. - -* Marker reading: decodes JPEG markers (except for RSTn). - -* Data source manager: supplies the input JPEG datastream. The source - manager supplied with the library knows how to read from a stdio stream; - for other behaviors, the surrounding application may provide its own source - manager. - -* Memory manager: same as for compression library. - -* Error handler: same as for compression library. - -* Progress monitor: same as for compression library. - -As with compression, the data source manager, error handler, and progress -monitor are candidates for replacement by a surrounding application. - - -*** Decompression input and output separation *** - -To support efficient incremental display of progressive JPEG files, the -decompressor is divided into two sections that can run independently: - -1. Data input includes marker parsing, entropy decoding, and input into the - coefficient controller's DCT coefficient buffer. Note that this - processing is relatively cheap and fast. - -2. Data output reads from the DCT coefficient buffer and performs the IDCT - and all postprocessing steps. - -For a progressive JPEG file, the data input processing is allowed to get -arbitrarily far ahead of the data output processing. (This occurs only -if the application calls jpeg_consume_input(); otherwise input and output -run in lockstep, since the input section is called only when the output -section needs more data.) In this way the application can avoid making -extra display passes when data is arriving faster than the display pass -can run. Furthermore, it is possible to abort an output pass without -losing anything, since the coefficient buffer is read-only as far as the -output section is concerned. See libjpeg.doc for more detail. - -A full-image coefficient array is only created if the JPEG file has multiple -scans (or if the application specifies buffered-image mode anyway). When -reading a single-scan file, the coefficient controller normally creates only -a one-MCU buffer, so input and output processing must run in lockstep in this -case. jpeg_consume_input() is effectively a no-op in this situation. - -The main impact of dividing the decompressor in this fashion is that we must -be very careful with shared variables in the cinfo data structure. Each -variable that can change during the course of decompression must be -classified as belonging to data input or data output, and each section must -look only at its own variables. For example, the data output section may not -depend on any of the variables that describe the current scan in the JPEG -file, because these may change as the data input section advances into a new -scan. - -The progress monitor is (somewhat arbitrarily) defined to treat input of the -file as one pass when buffered-image mode is not used, and to ignore data -input work completely when buffered-image mode is used. Note that the -library has no reliable way to predict the number of passes when dealing -with a progressive JPEG file, nor can it predict the number of output passes -in buffered-image mode. So the work estimate is inherently bogus anyway. - -No comparable division is currently made in the compression library, because -there isn't any real need for it. - - -*** Data formats *** - -Arrays of pixel sample values use the following data structure: - - typedef something JSAMPLE; a pixel component value, 0..MAXJSAMPLE - typedef JSAMPLE *JSAMPROW; ptr to a row of samples - typedef JSAMPROW *JSAMPARRAY; ptr to a list of rows - typedef JSAMPARRAY *JSAMPIMAGE; ptr to a list of color-component arrays - -The basic element type JSAMPLE will typically be one of unsigned char, -(signed) char, or short. Short will be used if samples wider than 8 bits are -to be supported (this is a compile-time option). Otherwise, unsigned char is -used if possible. If the compiler only supports signed chars, then it is -necessary to mask off the value when reading. Thus, all reads of JSAMPLE -values must be coded as "GETJSAMPLE(value)", where the macro will be defined -as "((value) & 0xFF)" on signed-char machines and "((int) (value))" elsewhere. - -With these conventions, JSAMPLE values can be assumed to be >= 0. This helps -simplify correct rounding during downsampling, etc. The JPEG standard's -specification that sample values run from -128..127 is accommodated by -subtracting 128 just as the sample value is copied into the source array for -the DCT step (this will be an array of signed ints). Similarly, during -decompression the output of the IDCT step will be immediately shifted back to -0..255. (NB: different values are required when 12-bit samples are in use. -The code is written in terms of MAXJSAMPLE and CENTERJSAMPLE, which will be -defined as 255 and 128 respectively in an 8-bit implementation, and as 4095 -and 2048 in a 12-bit implementation.) - -We use a pointer per row, rather than a two-dimensional JSAMPLE array. This -choice costs only a small amount of memory and has several benefits: -* Code using the data structure doesn't need to know the allocated width of - the rows. This simplifies edge expansion/compression, since we can work - in an array that's wider than the logical picture width. -* Indexing doesn't require multiplication; this is a performance win on many - machines. -* Arrays with more than 64K total elements can be supported even on machines - where malloc() cannot allocate chunks larger than 64K. -* The rows forming a component array may be allocated at different times - without extra copying. This trick allows some speedups in smoothing steps - that need access to the previous and next rows. - -Note that each color component is stored in a separate array; we don't use the -traditional layout in which the components of a pixel are stored together. -This simplifies coding of modules that work on each component independently, -because they don't need to know how many components there are. Furthermore, -we can read or write each component to a temporary file independently, which -is helpful when dealing with noninterleaved JPEG files. - -In general, a specific sample value is accessed by code such as - GETJSAMPLE(image[colorcomponent][row][col]) -where col is measured from the image left edge, but row is measured from the -first sample row currently in memory. Either of the first two indexings can -be precomputed by copying the relevant pointer. - - -Since most image-processing applications prefer to work on images in which -the components of a pixel are stored together, the data passed to or from the -surrounding application uses the traditional convention: a single pixel is -represented by N consecutive JSAMPLE values, and an image row is an array of -(# of color components)*(image width) JSAMPLEs. One or more rows of data can -be represented by a pointer of type JSAMPARRAY in this scheme. This scheme is -converted to component-wise storage inside the JPEG library. (Applications -that want to skip JPEG preprocessing or postprocessing will have to contend -with component-wise storage.) - - -Arrays of DCT-coefficient values use the following data structure: - - typedef short JCOEF; a 16-bit signed integer - typedef JCOEF JBLOCK[DCTSIZE2]; an 8x8 block of coefficients - typedef JBLOCK *JBLOCKROW; ptr to one horizontal row of 8x8 blocks - typedef JBLOCKROW *JBLOCKARRAY; ptr to a list of such rows - typedef JBLOCKARRAY *JBLOCKIMAGE; ptr to a list of color component arrays - -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 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 -samples, and for the same reasons. - -On machines where malloc() can't handle a request bigger than 64Kb, this data -structure limits us to rows of less than 512 JBLOCKs, or a picture width of -4000+ pixels. This seems an acceptable restriction. - - -On 80x86 machines, the bottom-level pointer types (JSAMPROW and JBLOCKROW) -must be declared as "far" pointers, but the upper levels can be "near" -(implying that the pointer lists are allocated in the DS segment). -We use a #define symbol FAR, which expands to the "far" keyword when -compiling on 80x86 machines and to nothing elsewhere. - - -*** Suspendable processing *** - -In some applications it is desirable to use the JPEG library as an -incremental, memory-to-memory filter. In this situation the data source or -destination may be a limited-size buffer, and we can't rely on being able to -empty or refill the buffer at arbitrary times. Instead the application would -like to have control return from the library at buffer overflow/underrun, and -then resume compression or decompression at a later time. - -This scenario is supported for simple cases. (For anything more complex, we -recommend that the application "bite the bullet" and develop real multitasking -capability.) The libjpeg.doc file goes into more detail about the usage and -limitations of this capability; here we address the implications for library -structure. - -The essence of the problem is that the entropy codec (coder or decoder) must -be prepared to stop at arbitrary times. In turn, the controllers that call -the entropy codec must be able to stop before having produced or consumed all -the data that they normally would handle in one call. That part is reasonably -straightforward: we make the controller call interfaces include "progress -counters" which indicate the number of data chunks successfully processed, and -we require callers to test the counter rather than just assume all of the data -was processed. - -Rather than trying to restart at an arbitrary point, the current Huffman -codecs are designed to restart at the beginning of the current MCU after a -suspension due to buffer overflow/underrun. At the start of each call, the -codec's internal state is loaded from permanent storage (in the JPEG object -structures) into local variables. On successful completion of the MCU, the -permanent state is updated. (This copying is not very expensive, and may even -lead to *improved* performance if the local variables can be registerized.) -If a suspension occurs, the codec simply returns without updating the state, -thus effectively reverting to the start of the MCU. Note that this implies -leaving some data unprocessed in the source/destination buffer (ie, the -compressed partial MCU). The data source/destination module interfaces are -specified so as to make this possible. This also implies that the data buffer -must be large enough to hold a worst-case compressed MCU; a couple thousand -bytes should be enough. - -In a successive-approximation AC refinement scan, the progressive Huffman -decoder has to be able to undo assignments of newly nonzero coefficients if it -suspends before the MCU is complete, since decoding requires distinguishing -previously-zero and previously-nonzero coefficients. This is a bit tedious -but probably won't have much effect on performance. Other variants of Huffman -decoding need not worry about this, since they will just store the same values -again if forced to repeat the MCU. - -This approach would probably not work for an arithmetic codec, since its -modifiable state is quite large and couldn't be copied cheaply. Instead it -would have to suspend and resume exactly at the point of the buffer end. - -The JPEG marker reader is designed to cope with suspension at an arbitrary -point. It does so by backing up to the start of the marker parameter segment, -so the data buffer must be big enough to hold the largest marker of interest. -Again, a couple KB should be adequate. (A special "skip" convention is used -to bypass COM and APPn markers, so these can be larger than the buffer size -without causing problems; otherwise a 64K buffer would be needed in the worst -case.) - -The JPEG marker writer currently does *not* cope with suspension. I feel that -this is not necessary; it is much easier simply to require the application to -ensure there is enough buffer space before starting. (An empty 2K buffer is -more than sufficient for the header markers; and ensuring there are a dozen or -two bytes available before calling jpeg_finish_compress() will suffice for the -trailer.) This would not work for writing multi-scan JPEG files, but -we simply do not intend to support that capability with suspension. - - -*** Memory manager services *** - -The JPEG library's memory manager controls allocation and deallocation of -memory, and it manages large "virtual" data arrays on machines where the -operating system does not provide virtual memory. Note that the same -memory manager serves both compression and decompression operations. - -In all cases, allocated objects are tied to a particular compression or -decompression master record, and they will be released when that master -record is destroyed. - -The memory manager does not provide explicit deallocation of objects. -Instead, objects are created in "pools" of free storage, and a whole pool -can be freed at once. This approach helps prevent storage-leak bugs, and -it speeds up operations whenever malloc/free are slow (as they often are). -The pools can be regarded as lifetime identifiers for objects. Two -pools/lifetimes are defined: - * JPOOL_PERMANENT lasts until master record is destroyed - * JPOOL_IMAGE lasts until done with image (JPEG datastream) -Permanent lifetime is used for parameters and tables that should be carried -across from one datastream to another; this includes all application-visible -parameters. Image lifetime is used for everything else. (A third lifetime, -JPOOL_PASS = one processing pass, was originally planned. However it was -dropped as not being worthwhile. The actual usage patterns are such that the -peak memory usage would be about the same anyway; and having per-pass storage -substantially complicates the virtual memory allocation rules --- see below.) - -The memory manager deals with three kinds of object: -1. "Small" objects. Typically these require no more than 10K-20K total. -2. "Large" objects. These may require tens to hundreds of K depending on - image size. Semantically they behave the same as small objects, but we - distinguish them for two reasons: - * On MS-DOS machines, large objects are referenced by FAR pointers, - small objects by NEAR pointers. - * Pool allocation heuristics may differ for large and small objects. - Note that individual "large" objects cannot exceed the size allowed by - type size_t, which may be 64K or less on some machines. -3. "Virtual" objects. These are large 2-D arrays of JSAMPLEs or JBLOCKs - (typically large enough for the entire image being processed). The - memory manager provides stripwise access to these arrays. On machines - without virtual memory, the rest of the array may be swapped out to a - temporary file. - -(Note: JSAMPARRAY and JBLOCKARRAY data structures are a combination of large -objects for the data proper and small objects for the row pointers. For -convenience and speed, the memory manager provides single routines to create -these structures. Similarly, virtual arrays include a small control block -and a JSAMPARRAY or JBLOCKARRAY working buffer, all created with one call.) - -In the present implementation, virtual arrays are only permitted to have image -lifespan. (Permanent lifespan would not be reasonable, and pass lifespan is -not very useful since a virtual array's raison d'etre is to store data for -multiple passes through the image.) We also expect that only "small" objects -will be given permanent lifespan, though this restriction is not required by -the memory manager. - -In a non-virtual-memory machine, some performance benefit can be gained by -making the in-memory buffers for virtual arrays be as large as possible. -(For small images, the buffers might fit entirely in memory, so blind -swapping would be very wasteful.) The memory manager will adjust the height -of the buffers to fit within a prespecified maximum memory usage. In order -to do this in a reasonably optimal fashion, the manager needs to allocate all -of the virtual arrays at once. Therefore, there isn't a one-step allocation -routine for virtual arrays; instead, there is a "request" routine that simply -allocates the control block, and a "realize" routine (called just once) that -determines space allocation and creates all of the actual buffers. The -realize routine must allow for space occupied by non-virtual large objects. -(We don't bother to factor in the space needed for small objects, on the -grounds that it isn't worth the trouble.) - -To support all this, we establish the following protocol for doing business -with the memory manager: - 1. Modules must request virtual arrays (which may have only image lifespan) - during the initial setup phase, i.e., in their jinit_xxx routines. - 2. All "large" objects (including JSAMPARRAYs and JBLOCKARRAYs) must also be - allocated during initial setup. - 3. realize_virt_arrays will be called at the completion of initial setup. - The above conventions ensure that sufficient information is available - for it to choose a good size for virtual array buffers. -Small objects of any lifespan may be allocated at any time. We expect that -the total space used for small objects will be small enough to be negligible -in the realize_virt_arrays computation. - -In a virtual-memory machine, we simply pretend that the available space is -infinite, thus causing realize_virt_arrays to decide that it can allocate all -the virtual arrays as full-size in-memory buffers. The overhead of the -virtual-array access protocol is very small when no swapping occurs. - -A virtual array can be specified to be "pre-zeroed"; when this flag is set, -never-yet-written sections of the array are set to zero before being made -available to the caller. If this flag is not set, never-written sections -of the array contain garbage. (This feature exists primarily because the -equivalent logic would otherwise be needed in jdcoefct.c for progressive -JPEG mode; we may as well make it available for possible other uses.) - -The first write pass on a virtual array is required to occur in top-to-bottom -order; read passes, as well as any write passes after the first one, may -access the array in any order. This restriction exists partly to simplify -the virtual array control logic, and partly because some file systems may not -support seeking beyond the current end-of-file in a temporary file. The main -implication of this restriction is that rearrangement of rows (such as -converting top-to-bottom data order to bottom-to-top) must be handled while -reading data out of the virtual array, not while putting it in. - - -*** Memory manager internal structure *** - -To isolate system dependencies as much as possible, we have broken the -memory manager into two parts. There is a reasonably system-independent -"front end" (jmemmgr.c) and a "back end" that contains only the code -likely to change across systems. All of the memory management methods -outlined above are implemented by the front end. The back end provides -the following routines for use by the front end (none of these routines -are known to the rest of the JPEG code): - -jpeg_mem_init, jpeg_mem_term system-dependent initialization/shutdown - -jpeg_get_small, jpeg_free_small interface to malloc and free library routines - (or their equivalents) - -jpeg_get_large, jpeg_free_large interface to FAR malloc/free in MSDOS machines; - else usually the same as - jpeg_get_small/jpeg_free_small - -jpeg_mem_available estimate available memory - -jpeg_open_backing_store create a backing-store object - -read_backing_store, manipulate a backing-store object -write_backing_store, -close_backing_store - -On some systems there will be more than one type of backing-store object -(specifically, in MS-DOS a backing store file might be an area of extended -memory as well as a disk file). jpeg_open_backing_store is responsible for -choosing how to implement a given object. The read/write/close routines -are method pointers in the structure that describes a given object; this -lets them be different for different object types. - -It may be necessary to ensure that backing store objects are explicitly -released upon abnormal program termination. For example, MS-DOS won't free -extended memory by itself. To support this, we will expect the main program -or surrounding application to arrange to call self_destruct (typically via -jpeg_destroy) upon abnormal termination. This may require a SIGINT signal -handler or equivalent. We don't want to have the back end module install its -own signal handler, because that would pre-empt the surrounding application's -ability to control signal handling. - -The IJG distribution includes several memory manager back end implementations. -Usually the same back end should be suitable for all applications on a given -system, but it is possible for an application to supply its own back end at -need. - - -*** Implications of DNL marker *** - -Some JPEG files may use a DNL marker to postpone definition of the image -height (this would be useful for a fax-like scanner's output, for instance). -In these files the SOF marker claims the image height is 0, and you only -find out the true image height at the end of the first scan. - -We could read these files as follows: -1. Upon seeing zero image height, replace it by 65535 (the maximum allowed). -2. When the DNL is found, update the image height in the global image - descriptor. -This implies that control modules must avoid making copies of the image -height, and must re-test for termination after each MCU row. This would -be easy enough to do. - -In cases where image-size data structures are allocated, this approach will -result in very inefficient use of virtual memory or much-larger-than-necessary -temporary files. This seems acceptable for something that probably won't be a -mainstream usage. People might have to forgo use of memory-hogging options -(such as two-pass color quantization or noninterleaved JPEG files) if they -want efficient conversion of such files. (One could improve efficiency by -demanding a user-supplied upper bound for the height, less than 65536; in most -cases it could be much less.) - -The standard also permits the SOF marker to overestimate the image height, -with a DNL to give the true, smaller height at the end of the first scan. -This would solve the space problems if the overestimate wasn't too great. -However, it implies that you don't even know whether DNL will be used. - -This leads to a couple of very serious objections: -1. Testing for a DNL marker must occur in the inner loop of the decompressor's - Huffman decoder; this implies a speed penalty whether the feature is used - or not. -2. There is no way to hide the last-minute change in image height from an - application using the decoder. Thus *every* application using the IJG - library would suffer a complexity penalty whether it cared about DNL or - not. -We currently do not support DNL because of these problems. - -A different approach is to insist that DNL-using files be preprocessed by a -separate program that reads ahead to the DNL, then goes back and fixes the SOF -marker. This is a much simpler solution and is probably far more efficient. -Even if one wants piped input, buffering the first scan of the JPEG file needs -a lot smaller temp file than is implied by the maximum-height method. For -this approach we'd simply treat DNL as a no-op in the decompressor (at most, -check that it matches the SOF image height). - -We will not worry about making the compressor capable of outputting DNL. -Something similar to the first scheme above could be applied if anyone ever -wants to make that work. diff --git a/testimg.bmp b/testimg.bmp deleted file mode 100644 index 8603d15484d47f0b90eb4246a2309c566f8adaa7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35050 zcma)_3tX1<-TyC>J>f74nTlu{hZGOkAIYFla+;t5CY2?gP!NJV4nbH*Qq9cO(pDM; z!M&9_Ivv~Qt&darbb%w{>;N(93 zxHBv7XHI7B(@w~}KJe$ADSu}5{^WsOJ zI*aaj&q=#&u9K8K$JtiC&KVZ*ptI}npPaa{e{tsJr8}`x=Q!~HsR(Vsi< z6VE!Oi}IYG&-{b)>)&p5?#y26JhZRG$({Pp-* zCw1O_CwWqxb9CK0XX?y{oy_bsXH@hjPSN_U&Mi~dI4|D+3nw(>O(%BzBqu+k&AETU zpPdmABb=wQ?{OwQFwa@{>=RD&H|L!P?{9O~{_2Et>+PR7lZUrCQMc@K?!9N3^Ug2U zIFoPR=1iHL>OA~zgh97 zQ}*1a&dy)`!O57K?Cjou%vo0awDVT&Kb+b>z3seK^OCdexy{b8O`DvjH`h6TI(F8{ zfBl!v@!ve@{BGyF&KqxTaT@mTck=Fk!`c17Q%?8|Y0g7g`tAhI9RdZO+J1QG8yYZ8p|f+xHfQhdKRENIzv;|R|J2ENuE=>{#eV08am$>Wr!IAVwQrmA zhpKO!@bFKa`!cpU^X{MTjJ)Z7Cw|gC=jFd_cLqni;N&d-)LF3nMdzOBpE(o9e(J1P z@R{?=+)tcU3miq2f7o6*&mpTt`_=9u%{Kd|&TcVv=GydTmdh$0;>X>hx2O zPFmI*PP|&Ef4qNaUZ|(VpHB--3yn`pjJamg)oWjUX56@?7b5!{e`U&)n+FZL@4f?b z<}6)0?muafk&!?A#mI5vc5aDE>byi*>mC)=J*s1(tTC@{_a%^7cLZIT6|)f zf11A$0-81!U0lyT^FGWRF2@wVl9#1`lg;o8l3{!6i z3&y^ys;XN3QmR%BT(zouYpb7Mr;Z&W>M?CXJdpm0yLVmv#H-i2id~4@+2{Cyt59-~ zC_njM4*rMIE}b*@F?9Q3yJbsMpb&NN*5Cm%C53yV+~V&c4CiCeZv_Pz6Cxs{V034c zu8F{gRaYJ3)6#&#K#kDuc$JvA8&kdDp@|$9*{9EOlpHkZ z(0%_A@kV!}wm7<%gC>D!)7%sOW(FU2NO2{f1E7uMk^@xtr zm*yuSSM^1`s;U$i_pj=nlH##d%o42l^XJcpVx(#~WN2c%f8M^UfBEWl_@lMR$ekDZ z95?{v$^Ve?hYGr{<&OY%5fTpgQd*^EcsRELD8s`Gpu`n}bo|!3*s4*wD*A!F&~Kri zA5I9RT@122to&f1QxJbX91KJcVN?hV5vxDv{p$PBuF15jS4a={61BeSAMjvd^{H-kUS{#=%>zk!C{&PDmh)m zcmgdBx$A0+tDT2>!BWV77IHfO$o-HaAG_u8`~UHi^FBU-8-oIa0%=KHO-Yk7bS1GS zD5bU4OxK_Ekrm~}Q$hJ*lHYF<(66-%p*@w1LNvxIe(p!^kdP4C&8*giBx5Ef#_am_ z6R&pB@fnQul>-M3Y?|{giLaB$^Q7ai+`zi?;m7a)iBApf$dSM!HAiY{#OSu7z@jKc z+Vdk|6k=;DI{Nbp5nVEHp!B>jU=y(Lhk!UG>Y<;So|wpvOcnL8R+{UQ6ULla{X zCtdyOtK>(w5m_(vx#jpP$BzT44B5fa@eBXvF*5Sue?m8;CZp!aMs7!HHg4Q_BruTc z#tzV+q@eK70_;>mwqmOO{{986eu|@FvU~R_f=aS_budx|Jj#xW)?g-B^ z&K)_jk&BB8X;M&NcvNXnP-{vMGRB7%0GT32S3$#)c(jGa_dUXeik}M?dJxGXtsnwv z?@C8kNpng?SDp}b{6o_y0(xA%R&`Eii@dON=gvNT1|J_h7<2s(bc~GrpAY7b_44w{ zh#it4xFJXCTvqp9oPp;|&7>nirKNtP4=k0ufszF&3(-+{U7Ga!zJ#VGG{7Sxm5rQn z|NgZ7MIJ_JXby>-1RVM01hj-P(ceEth0Z0$$Y(BG7Kzj6F8Oq@<#44qmng>tfm_ULvHhW3- z#83-~rGBkZ-S-#7#}70{$K#KRr;=0212a|fK*+S1CHHp8j~61Z>w}PeBKyoae&E1h zx#a(?WaQ5O`2fKD{NQctyRh?4Xpg%AZu@)U7E+`}b3Xuc}(;;EoPdQcq$^LrF@GR3m$gU-Iis9c7MsAAL4m z=tJRpVJAA0B(M8-(e)Xsc-q4sWaJ0u*4I~5Y}+N1M*h)WrjRO1s~ zlLTZaLi*v4lF=pPLDKz8bITmy&|R*W(w#ysJ`o*BEex-SOJ$CS5KaMGo#P*~`;jNQ zgq)=puIsa@k8G8?l~Q2sflb%_A4*34N+Raw*5^(=yA8-8IAlkY#VY6oo;!D1*Ns5p znhLc?lrm{BZrRO2nuenETz*JszA1L$$rT|KVtisE-3}p=A3G#WLqk2sAFa^A9k+bX z9hEvTRD$bHw>Cey_SM1H{X28rdH+~EG1nTV3L|DJ9Xr~&K&fZ83ZtY%NhOmb6bDI3 zHRnUOY}x;>gf43*spxpC)el3(5$SJ0xQcq5DlL9L-A5QLabU1AQf{u@nyq53;~zP> z_PWlXIu1w$9Ug9(^5Px6dM$bJS%@D~MaK`sd>??;9qm|^Ct1Q%2 z6j;-dV#K^XmxgPB8u?b#?#y&mAEQ}0+W1vVBC_`DWvo>b9Em(Xfai41NAG5=n!M4 ztLRd#;vxP-VqdBNL3Wy|M@Wh3G1kz~yxltv(o612Da3J+$6p!LE3qJc_x7t#{x8-V z`Da9|_pV1pZow55u_Q+$1QJXSpjhRKfF>AIE{Z-PKoC-XyW!k-m zm>*)Lt*!WA_p0tyAku-P8;OpIeY>Zat$OssFXftPQb;_13`lci&w0*;I3A>1fE zjWVz%@ci@%3oA`cG(;a4n5xdIQ@@mW4c{OjEqv9g_`c|fkfx&*<=jCh zyXBdhThir)rsc(CUcL7Bm+AmRjC|~>LA^#442+N2eeh-y<+v{4HS*yny@)mS_2T1_ zN?7gJZ(F}hI(A42qNEfg7HaOOJJ(!Ma-+{!pQOS{qon-4WU8VQtWd49tREF6CcbA1 z3Q{_r=zHSCs_t|<+qZrkuPe_Z|g}GjE6P^t98A|iWTkd;&fj=V=@oC!+ z9hmb;mpr-iH{X%-kuj{EOKw6KT83=f)~~J($Rl+_&bhW)r^q8h52Tr@BCAp2k_4fR z>YxNwf*}D-LGc1+8O5H-P^oMx7y5NiT=^c5o@Rva_3hieQ2y8T2DiQ$u}+Q3zi`sxcwGZF6^Fo%{A{am}4V4 z+@0vV_yn(UXyr#FG`l5k7x=_$&Z%|10*r9qO)6|&Ofpt4l!2vh7~$(5}sC#KDw-A&`G zp0>E}dt68#mLJ_(M^Q(n%GLUj(viw1X33#0bvcYX``q%!J9@>3rvx!5m=#py6Z6%e z1Dhh3M!xV}ZhcOpH&D%C%?V*mJiyruV=g)>tRkdqr!rS5O0w*%bOfiMO7qAF=8+7a z`94WOL71yXJJdJs=!d92RWBG7k&(E%^5W>Di(Nn-7-;3%ch&yZOFDw)amG#^C1+aR zmPbx@Ngj+kU3K#vTX4o8T4_*a|Dw3OuO5H+;s5#h+=<>T5T&++B_uSbCp3vQtU28` zw;o%Sjz*@t$*#p>yrOiujLm%tEB=UzJ$oL>$k?3Wlf>ASjFR9|C?WAk$~XE_E@GuV zf$lIK9^FllA_P!3qEHnzxgx3n?atM*Q%7~RVzwVTiA#x0%m*h7!svBi8bg+6Ui zVOC{n&C`GTf6rYxH`u$mCAp;~A)%?I8A=ht$bCqMj&e#5p-YL364DZ-@tr1Pnx(?o z6Uw>_uM8ib%>{S`6}K?4OEFTL+PICW$os7+@ry5xzG#ddM30auPJDszXkB!?^oCV+ zQgZF9%yDSo`{9QMEr?-kDJ!Kl3n42D3rkBkW_)+o+_~P~IW5Ue&CM+dEeXxE4o2TF z3f9Rc2{)6aC|&f=;E(nWOdJ-O1XRTgVjdz#`$AqS_#V25PHdd;6d z-^b^CcoBnk($Czlu#hPYlr>(-n-bpF7$u|`s*A|0?v6*sG|!`Y$ZCdY4=P{twrq!T z?R_Ut4*F_KC?d9|5VQ;VWV0%R0*Bevm85zMj(e2{s!=n{iT?xC{1CiA^U%57TaC#n)o^k|Zg@=)AqQI(37}rc5v=goG{g!E~48Yq`4wOm~2uaX;?zYHc9|@7+}a` zt6Mwu(-RZ4!-Qefm1bg|JC^~X2?^v_pQ7;YE9o#{vE5a!`n6_RWv6ifLe53yj?q_K zG1~Nl@sf@n0fpiTIFgW;ddC2D=To4GQO4?n0_UHpXh@wpH6(Xvb&j{8g@vg!H3w{R zO|_}HxH-KT(6CcyLn`_Wq0H$w`Fq~zi86|{lR=zJ>NI19dNP;Orsa_%LY$AmqNEQ= ziw2H}jIVYwOa}1K$ilLg2Jn7q4F^48gbpg4z9*8-ihZ)9#f&ylj zP%))7@JN3B*;7-erdCHsSLbw63fAL?InB*E#mU9V&FSfQYRK8MjOTbl>ZL5{0Rpa$ zN{{BMD_ny_&(mlOVhz5COL~o+?xTt3_!B4mQIhbQrI`XumZ#lUE$(*FY*k^$Ak80@ zF0EcQOrav%1bfuDx!ZV@%@&x9#B1hUNQm{9h2(mJ*cOqKV{l4`Il8oPrxrer*m zuv)>0l?JU;%DHHlP$#>9m^077G+7POZ1zY7krg40ajZ{40YSApohG^jN+N!K^ezE~ z97dB7W5p#+Nj$O}{bV=hxMB*bj6C7OUDEJ;C@LlusUy{@%oucT?4Gli!B`z2AhXjj z0ot`K2W`1|G)<+-K}L66j*f@hhDg3TQPJyau!~W8eq1-%&6cOnO@@$Wj9&AnPah!( zG0c^$XK1BR_e7jlWk=~~p;eHwRyB;(>YPhDx|D#bNkaW7lo^NutRyRi^#_!xDI06X z?uqrTZfgrjZua#J;X-p!B`QO4VHB@9$;MePTaArnT+Y&mN*&Wny7lXK_H0AQSzQ_$ z`dub1O=u9Uk|p+JXiU$;ICkvxHNASRj893~eC$9Xv z%xu@(1!8hKo!}p~kX$P8%YbZvvKgUU!a_ozJd06Uxx+)O0O4~1=|x*Pgx*k+X8P3; zg{>sOFYEew#VW9xLwe00tJOOsjw&WJ!lPP);G@XF9~UonQ%4t{G;^i2GaVuEP<6sl zuv*QEv5HZaiZ^DZ6ylaCNr4&PRTEu=Snfimcd!BkBLpF5OMHEs=}%f@ZP>=!Knkv3 zzlzujjFgWd#5cXUnX6%jG++VSzMo+xpB~~BJD#*+`c;*M7s05R z4#gbTAKl2RB#Dx)M|%8Ggmx98OVugi`2rtH{#j5~RYg@r6|t=5h!_3gbhtv!cCd9k zdKl04!~A%!xwyEgB|#P(aw;UG!9Xi2q~Y0+a(Ve$`Ep46-N~0R~dvu%2pZa@DO&y9r}{00%WVEl+^OrrezJ2 zQDKMo>A7hci3;JWqN1cEpZQ+-jV(%Xsdq6Q=ccBT zQwa&Yg}fF05K*xP6QE8=@7)BZqOfmR!c_H9tXW{9JUEAtQE!0H{(8%i4trvS-tY7xDgf+U|k-v#G{HGy_E z_iTs=)9qrg1P|Hj*<6AN5b3>p7pE6DHSvjXODIQ4Fby#zEWIhcsknD>@7~S5ky7^R zo50_lZ7{d=P@b#H$d@zD#~EoOR;~de= zRq8NIm(^+kjJ2;52Vz`75_d^FN>c>&DJvknmYKrJ{!vMos0a(_JHxoA9@oL21#&4^Ula=NQqMhsaj>k#dO3UAq3C8ssm!R0Ci4y61E7VA%N;4p7$wJmMkks ziqjB7QBo00^uR~q(DU>61XnQa7IIcW14JCN)(}N0#s&~_6>+J4^fNRPN-d_@45a;> z5R>j2GAind${=#1tJVRDkdzEeE(BNPix7YGpEmNHcSc=|rw6GnWMv@*c~BubE~d=! zTnyEME5tA|^RD%W?ixgZeYnChA@rlrya^M^$_n-u6mgL~hf8C^kh=a%D#{u`GaX$q zC8gY{LEfl{VkI3321}G$I9@v0GNb|hbA9pXbTd@s6dn)49W$bnTR^m)oF{otWw3Sc(WK zZzz|Mhc#iLy7UIHxK?g!FPj*A4#{n>_=;N&nS5FB`yWmWuFv<%7b9K8Zlm70bKT*^ zRs~SBB4tW^UqYw|yV3pV=z$pI=x$C{5H%WOiLeq_WU=98WqAX}kH0=MbNp?K@)j*x zl$Vzm3LTK56sY<-6(GXKk?HV6hhW&M#S;{6ZX@MU>{!iil=?L2Ql>Wt1o)QU4J6ho zKWsu{U0h<`@l|O=qmr=h$YtKkavCS5zMVgI`gHPRQ22?%cdi3+#I%(K*ejlyLY3}8 zgm9YFw1!7sG1{>?3!<>4zapj-37vVjjn7=MVg-!W#t(2QJxYRl9-qu7u8{vMW(v_N z^K|lKgJPzyZ*p66E>>x=M|MlLPsU>9dC3tG5n(C;q_0`25{yCCg4opLi_U^PD@clh z;144LT3S-ioS8m7rAnjoeY>suX5__by+*ENY6(PoB5qY1-FYX8gw-7Jo&7}vq%Uc~ zM{#E~>&ckDTL@-hR#s8b>eU0w-nwo43K-|jTQO|KFxl*m9UJh?@p++0i6s+W8PN5q znV&zmEjhWw4pMPdt=715feL9Ob#SCKWswpt{AMy7z0;T1rZ=@kL`Tqb(Z{1EB}Gc< zm)@IBsXiST4YYxeEh1oMds9o}#4|O4%m=oX`jtk7_8K*6-8w?-N_x#5I;uc*DLrBW zX^f)8T&q?W4IFrR*`h^~QMS5b*vl`k=pj8TxZN}q~5=LxU*-Z=pQ3L0tv z$~ApUM5WZBUWwwX2?=Gogv95_AY!R)%9%kQ8#XoSJP<{wpYpHqSDr?>c(%MeAYx|w z@Z^~-6YF3stgI{@6XY}Pn>+8klRR?x1fw|}I*PHwTHVMaMqyThh^Y=N8(4PvTQI&X z$Q3VhaodI!8^&kilvD*~s|5KHIt>ZIt!>iRj{Ex#0-Q4a>lkJOnR0w)#8`Z_u`%J{PCSpqYkfx(Hu|)Dq0UG&pH^1Iv{2h4NQA$ z;9Hkpe)$)&QOW4JnyqeFk-24j-UK|6)vxhBHDiP4dN<}oL`O%5HJ6uTmlWW#NE9T}FOIvAULRpFQ++u=!(i@Pyq-f6R@BZQjTFDjy@dF%4BmtF!= zl=C_))qND?ZFxQ!ap&X1<0;I8a~i87-d`3S%@~~IGRa({_Baow*J{Ds) z=8*}gl2k$pRdbTqDt`bWA(_m$DDAD6XfoHAO-lw9-eEp|GK3!vC6u*-Y*ZX#F#M$oMt z?lPMH$_dm|EBPj4t;5@w4GkkcWgtK&*o(X(4Ohl$xj z5IM)9D6WipX3<+Fq?9zWc`J4ZQB4^{jH=Up813*zM%uDv%c7xD(*e1MWl!z+Ov`d= zI#*HRPVZUEX}aSkO!`(3Dpi^Rn~rjEUEF_>$L5HL8N(HKW=`BTX3W=Gy5iRw7`~Ej z$Vka3^_2ESg^nwEM>k3y$787KcNCPRP~Unaz5(bCJMOg9Cn^2}=Wwq4OeLZU}4jI(ClG;2B6<;!p4ioMD@(UA-( zN@YzKvBQXYRgxTyM*`X2I1wSW=pl&H2!Oof@X8Y&@9Q9xJ3_cpT6S}&l&J~<5(S4V(cN}Q3#+bZ!KGt?}WHlt&~1iDnW4OsMrbd*P;;-j}d`mwIx-umsg zJFd;7+9@bQ#tbh8JgyYt^Gxitm6wnoJjN>Xvg6aE#AW3iuv5dlng4+}Jze%GJ9QZq zf6Q1dMb1J=k(rR7p(~9iCBALhGiJ^tgS5{~ts8?wijdLXcqS#gKw8X^tnit&E>^!I z3PhP|LDGcKnA@ns2Ym6C7>B{Q{?SK2yZ6!09{r4V>$lftX6EIUkv^yZ@`LAMs?Tfg zs=1B9MTUmzty_L#SR z{k`|zdxP4&pZ)H$M>bp^b3U!iXM)ezjQqJ*Mq{RJZFHiVa~MF)4I_?{9uz`Ve%G3g zIaUyy3TbJ{$!ToN38QQ!ee|v^Ca@~5k{_uE#K^3(x{_wE2q{zG7uD?NC1E8I$7Tcw za`?=tv16=r9~4EuDxB4SvP}@J@q(9R%oB_K7qc`FM%Nc>G^RtfP2X|+fPDjoeL+LW z_3J;o_l75)cw+6^Cr%zZ^t;ctlRiT8KAJvu>~|niR<|WHfYDryWW-LAqVl4vLUOt! zY$y-&4kkdBBCud!PmD*6&xP{MGc5z0J@fc zpLq4a;K7`3ru&`>i_XR+VI;I>97$rL zi8-ed{kP_z2Q%AX+(OkQ9ukvX5nF6Ls2$w=|wP zlEf@b6zg(KM$-?-qaE2pj9OLBN>=s>@iYy{>1iAzRs+WG+c#{O#hrQcKEL6K1AT7c ze7T*sTs3778x*Yh$=E$tJ|ErIlFV!djA0B6Hw0H#d&>b!0_YVI`9Z|sd>K#;VKTWT z0O{JYquZKD9J78rtGKN=IT`9?V2YVmcgu3gh)?QOiR@j!YckG4X!22c1dN28_Tf#9 zZzH7U?(xQz-86usHrgHI(9^|zPk5GHuhQ5fW2-d;)o|025!JXngWQL?s@l2r-a~7T zyNrTdu;w2hc+Gu3nobqRR!g59jEdaq>gq7&H`HNj<^d10G2`a)l9o2S7Ncf>Bf1S2 zRIxgICWMUY1PGEqBllC*XCQ>0q->Xui6@;hGLp`CUiC5<6ghDDnxujnIVE*#-hcu7ULJZt(jA*CegqmG_OR`-GvE2mw&c$88c5id<8Q@VCre1Zve zF6da}@`$aXNPW{f;X!D>d8GAw-N(6bv1jXZ+5(!3n?SKbCbxdBi%7(g*=dGG zmTDp-x3xvLv^33#ZaNknkWi99fGHkc+s?oofP&6x;m;VnV)1|~IN7owRl`|WwJsQl zjMbhcAs@^B5FvqVJkv8O3vXOJ?Hbk}k3LGYp&xZv(;T`SzT)uV!xyK$cOpLiUl>)? zC56Woqzynw)ja$5z1)Ms_10@Y`yJ=LkB!x7Vgbq6X%n+)N*QMx>OlL(b+lG_c?bL@T#BN>t=%b$FO0zKFCUEGcPg zYC3iI-ONQQtCZy6o?KJ)?-8Za>1pGVwO0GgDh}w-(UnpD$Sg|q^Dd;-0TU}W2C^(i zraJquOL=%S;vLrDIEb{7dv{&4QjE3_L8rZXUKPc~O<>kz^CCr`eJajx-SGE!e|y)J z(b0;A)*E7i2}YK~c@Om#qD2ip@nntsbBxFsK$JnXWa3X#t#5WyNy*&_%tC5f**7%@ ze~g$~Uu^@*6oBfo$ih|qz(|b74|%Q&1GnWN_4EL6NYw%D!)LbKej3J=w$|bBY^i97 zSgG5-`R4G*i`OKk4g6npB=96L-N-~vnNQgSNC%j)UVH7EfBHF@p9q;e(}vR$$o;uY zHRgKPQ<8IlGB4n$a|j{HjK3A5c<&!`h^YGG+S=mewgAnW^Luh+P901QX(;z@LCH1- zM{M%P#vjv@1C%|4s0)8j>S#FY4dXIJ9oHcn>&_*u(prbn=qNro4wp}!ckea31mAZnDoq2X>@q~+03QsR!LV{|8@#;=<084}3)z>B!u;crYr-R%`5 zGJdme)R*tPbMop*yXkirRA3U1rlJ;$Z-1=jJJEfpn6hlE9=g?-0|~k?NI(SArP#*7)(Szy9XW-#C^%vweASdvQ|&okT6h zC9b;0$~qK2_HmtW|R8=v{pbOXWhvWW`QEJwpH|rcLWL4amcXzuEf@dVaH2Ix6Cf zx|yARo;diigKX-07@;KfAc{~8Q-zVr?)5+X?XQ3Ru(5r4dvY=nFszw8o!rcF8rFoN zq%Ss1xM_>dks1V9LJ%Ln@`r{|Z8Vi4Zg@NCgab@&YA1!*{7-ofYhaljk*UfZWft!A zGld;dM~GCjj5Fj^OGE;zJTic&6ATpcts_SbVso)4 z4nBg8*r*l*n9&-p!MS&YRuZKcH@x{bAR7~Awg+h07kv&fx{(8`lXK zX9YwA6c_W787wNEbOufXuuMQuUt^WXZ#?B==T)WeJAIA+>&i%t+yED#}>N;Rq=|l~1_=7D!dxjOJ*JRS}bcob>2q zW`e+^<6)C>^2}3DUeN2}#c3CNjb!n|Q5ptIP+hl=8i)t3D<(_|z z9C;DMJ6Y6_CrDI6L=^)!Q=RjZPSA2Lx+{X#(1 zxRwn&-`$(xaQ(0xf22gD0cRdB89k8M*+_|w!&~0Jf63m%(?-7d&Xk|t@(L4?Uw*lD z-BuWX^v)mu^2+hY<~%IO$1l~Z2p6a=!nheOJ&&{r4AEs~vL;|fj~**t9x!at7jJF$ zI+NNoe0h5@HCsz^aXUelRq+%lIyRQe>$ud=5)ZZ5Z}~&EO={KTDtXkJMpWG#Yr;1t zqdUfGZb?m3D$QI7Cn%cm&6%=<0xbh(v(&{_Rk-$Re!5FdT1jSOca?Ke+ zEsQ{TT}zs4q2!aY$iu(n;!zT?G_S&&L9yy;SHcK6WE(>P%f6a+bY-_*H{as!i}K9x zH~sW4fBDg0{_>Yse&1(jWaOMV$LBou*l|a-43tt3k7OAq4aelE23mXU5aD`;%h#`; zx1&domszRv?mZJ*hBq~_P#nZ!qE0G7k50S`=~}9U6eGGQu=d6S`GJaU%XaFCDTUHV z{k+m|6MAfbjtmq)=8#2Hgs>`4tPDOdpBpX8W7*Xa*~^Yax6N#Cd}9HpU-@qt)W>tS z^fS-={`Wtn_36`RC%aKR_Sj={*qYE|tEdN}=IEH>k&Z;zvb6D;Jw6uTywBHv{`uAG z*MEE~t35Vsc;KFishq9K`C|khDol2YAF} zo~PvldX23|DC@UT_A{!J2{~7g|hY7%gW&7s!xo5U1f-%|mWnw6DjG_497M^>f;%+}3~o=&iS| zU;phd{_yO?saihGjkRrBIULf)7#3wqf^TX_xm-y}MD<)TmS>P|axcHTS&`FvQN&kk zns%d==b&VA8yb4-SA-QNqGV)3m*Ls!=$y9f4qPe=f3{$_ zw7E?uqbnx&*lJWDv#dJTzpyl@RO@umk++J9^7egfjGwwqVjAN5kH7uu&3A8{nA##O z35`k_tg7ZTIfg+kxGGtyVzotoJSy#>Af0EW6pex~WPRd_Kzw652HO``)qO&Aw~vrvXSqN zW$&Y9_J_~E@XrOI?0@;@L!WdpRu81>i+bTeDCvagS6W!gY9x@k1QrdHjw19lx#gn- z)|ZD37?AhY=FJ&r-e!XiSuDG(Fo!Bbg_eet>MLjshue6fQuJ=s*Fse3BQRo;B~N_- z0nsg-#L|W{;)}9&*{JR~2andsn6ns#NmOOR_QPX8`}qey@sEld@zp~Qf8rtQd|=ZJ zSIDIo91?~Hu~b5q_Qxp$v*>)RM#mju{BJHdn35t~G3>Ut-nxAC>eqDI{F&P)HqufV zxFBC*s0ucyC`ju@V4@yM^FvS=R!p{zFS$@1E0uF}fi;AnWrXyW-Eae)ePCfA=A?SJ zkQB4C17^&0DR~a$``_*P$>yknHTOUCulxG4C#9=of8$9>kwYPx_|%vrJ@}B?o$su`_w(Rr%nYjpT zdIAhXSuP@8SX+xV*MhAsM{_!k*sMjALR3c^6ZLj&g7qLRscmf=v-_|sEw*H5I}@nmdCiQiGF!G@hOE<&QD6fe<`h^Is+timls zn&NJ{Z$O*+Q#4gRVPOo_<<>WQH&gX6%-kjg4N@k{gcnmK+0{eGX8h!zf9`6kM$6Xd zgAcemE`?Eq+OS27A1g~i2C*m*9VZN!XNaQ2R3Ckms$3$Ly@ZU4OmP*o{#R+)_or!&K2q0|#iYduL5LaI8Jw)i#}BX_uA z4m;E_US|_5Ohb1zbISmYM$ed$Gk5Hh4?aBSlMWe0sBO|7d+dOR@tI9xEOZH79SN&a zkrKe;j(8*O-bX*)k;yu<)rk0-LQ^4UCKnd=uNs*4MdARK(QWp+(JNo$r7EDgXnmFR zp)BBzs*Wp51#Hw+Nl`-pL>+#|Z3JMt#SDSDkQ5d$hS2wJPG+n!06*+7R3a<5*+|La zi5cI$``rI@$&MbzPv#6hFxcJm=YklKkoDvyBc91l6)*-Cy;hc&`SI1lQ#if#%oV+?&xc~G%sEH$(%Wx z9y3T73k}Z*<&MgZ6y#vW|Rl|HS85Vd|- z>0ARdRO%&nt4!Abh$|-918njK_tdE*SE~YrNmS({N^Qb-y6)9ioXUk?bK$@_e$JUxnWL^%U{qY%fJ}OiJ2Hu-WpS^) zrq%dr!t8)F#-LLDZ6W(1ontFmAxcJLRCsiC;jrm-VZF5qL{Mr_u9k30j>Mv=8C2Tm zXuOtYPN^K596-UqM3+J0kmi$Sv#i^C;Wsa2oPPJYhpooxl00l{#-)*)4y>KB_La3$ ze(kW>)!ea=qc04q0#T4rMOj5Hqc)J~#9L zo$%oc&uy&v$FFclSGh}dx$V3)cr9PVaq#5L2OWvXc1Z$cC97mKMlc!c$Xk?$gjxNA z`j^^f1InY^_}xmCe?o+jQl7Wj&ada`x>%jz$(gJ|v=cq0s9J7AZoO7^(iCS+NOTmi zI+Rk;>{2JqS(?pd%0pxE?M!z9h_Q-}CxjZJ&deDtsn0$cIO4w^SB-;dav^J|>E+T- zt~+q@;3JPLIk@Bz$5j#g>y)voLrMnbRNH}o}DR7M}`g6Dwu9oXWk}bMG2(!H}sU(8kY8^0KpROO zz_#3eSJIk09zW3Mlj}ZlTL)yMLeAQQk8IzyYkRL=_#?;6g=8mZ3rh(TGEK>7s*epgS}Vb%>Wxh12coSeMPo(od_4z1Tvg0#sR zMOEf&=vq`)Q|4(%lL6bQXT8ac8p#9DL)T%iGiNl;oROW~KI6mNf4+Img8TXE8#SXe zNtb>?<`}&8&?DP-?~a+q_i8QF#$HBgmI|4S)$Enwoh+T*q=s}RBPTi$fjxA5dqdDh z@k2};l4owLn>$g%z6}i(aACRq&Jt^L*6@lfj7 z31#IWEgGq8PcELR2d4C_nZYvC0U}+i_y4qKzR#Mk2AyQ(sT%u-euAWtAbv7HtRI6(by|{gMVq#y;w{esg z$&7Bmk+Hg%>Qs6VIdJe`;8MxCBM8}K)G%2ayDaJU_ATXckDctk$)vh+DM-_^XWolE|0NXnuS*PiNa1} z#9!};J%cZc zE@B6v4&4Y!{ai>k9T2RrJVLt0T1Y9NQG}q4lg~6ZHYME6o)rCZa}#`(N!a@;*iD)t zAydf>2~CXjr+U-D=KL%M^H^{#sY(FYbk|OBZEU>f z?IAsTQjrBkY5VIXONcJqwlBG3(9I{OoMejpphw32`wJY`6$?3qiECC+f5Q|nv?dXd zlE_phQwCXhb83Vmlas5>yc+0rk>)G`u5wL z72mIZBE1p@m&1bhc=?1*_n$ufgDV4=OlePs3`8J{WvbY!`0UlxXY--h@D}RYyu=S_lh(+c#{kh zm8q%|rgNQ2O-nOWqqJW&YYi+tz3t4z+lOw8^@a8F1ZwjpXoY+c>y z$&)XeNuCr*6o%xP5Q z$O@yPe6;EQG}=mTyRO-_cM0vwNlSL^VyRr;RYe6!)Z~R+E0NI;9jRA?TuB-92Bt}Of0@qwfDfg#C;O+dA30kz#d_rriH)sb>l}7{W}lLZiuyD4 z_T2$>M`|)SD_)QZxkK}ZWSr+q5NKn+8=BK1#^uW?a&j6OI=<3vf4cI@yPldmcW&?* z_8U4qrso)CEJoMDeL_!cVUqRew4>LsbnfUi*Ua9vchcUyyN<5JANMo1>WEN{B+r4W zq*3pK<1RF9h?x9aWJWVn-RTn%bVu8mB`_{x=aQ9Gnzd2;B(i@hU(LZ@OU!@tf-~mV=+xNr)2DO3K~6Jg?z9IqM!)gK8$WxJ z_FoGYELgK<&GfMue5(SRd5#$~#_EnSUymsb3}?#%W|QArc@)6eqpz7g`{?Z1vvp-&lf}m^(-yr9G$Pf=D@y&bxcrr0bd*E4`sKbqpxAb zoDlcUzJ@mKJ!T3R9CyeYE@2_cDKOg6(#_Jl#^s^2=iHe~%66rlwNky{&vesM%v?Xi zlmJCckhIafwyENwrsJu*J@RE|hrY1~yRP9Ig*X9d`UxOE`0lQ|o?P(Nk|kSr?G+!< zQNHyB%W&iaV;tVUlP9^jyR>hEJQihdcHdXD2-N`eA>nA$7JnnHbqO z#*mM&M<70n`|5k4GPJ3qKagvBebsBp-mQCSySD67$i(jAQPIx`^_?909stMT&?7o2uzsQFnNIbC;zw;4qMax>OSE&y=r z)~$PI?>&0-8ZPfi#VWaun&EZcea+?;X`DQFao0sGmF17D z-aQ`~Zmw`<_xuM7?N?1W-RUOjcpzlS^fA|->?JH3xY$^ZT_1U3d*m6UM@aT3=ev>= zcC5vEjs0lNmXUjfIEfr^lq5%GO}LTw0A>w7J?E8<#E)}XS)em=>)v&D{^-tiG6CFq z@2+VI#VJ7?xdwCu>9NF)f2I?y>l1znNWG)~1FyAK>JkD8B7s4H+BH-P9^0~0Z2CGD z+XGSND!>k>L`}W}qSGbW?r6;#B@RW^-S52zVNptyLYF>hZj|~^112bmvCG? zAFo_TjFnOGD|anfGHKG*tAF%M+K+y;_3Cw7zudZY*ENZJZLKld@xu6j1L~)q|3}uU zD?Uk}v5Sj|rIPnOh{y;_tXqsT0zg06gcKjm0xZ8_#eig#S%a9N(ss`Wy}nv9atV=2iI?6Eg54#_T`+sncZK}DT+^c@;kWmM2p{7DxwRwjHcS3sfG_ULkJqC%8u@(6h zK>lOF$nATPaeq-!RTf`hQHf|As^Wq1nO|`LiV0EiyL-UcqsOGHxlGzSY1iyYFiygq z2XdAi+UV+D%*{F=yIQUN^P%EkcD{cqvKH}o%>u8s(C6M z0*w{vP`c#}G7@TxP)p;aBj4u*C6BJTVzSz8RfJ-MQaa`a=YRLXnl)?;Oy7up0*v-m zBnpn!TxRaYSQ!)-llkqA^*uOa^NY)0VlSt(#NGQS<#+G)k7rYg4o0&8)ikc=wfB%|3WfQ*~6`n&=e*_qVcZp`D8_JtSP+glM= zjP>kXUynTQx*z^pV)dA~n_Y z$W7(B`x#hwgHKN)n(YWtBI?TG9^wtr#+HRpr6LN)TM-N*8+6);B1>Mi{>`JMJW`PE zMM5Gayc7#K@YLLj{EQm9r|Qxc+J9spZxf4*A-CzGmzFzR?aY6Wd##oY^d*ekc#!WGE|KkYuHrh z^~hFPF~GQTKh8vQD;{BbSXD7Fb)XUT{2@mIOJTInkpEupVdCk|jz@?+gD7`vHh*;6 zcvnV2GO@k7EG;dqU|{$_wyMO>#T-u*@UWqG1*5MCO;vXH~K zSJR0gZ(x=zbmPlQIN!xJR_&Ic^#an8$q;zNrmN|wr@Xh#j5WBzYe*oUT%qZxBk>3+ zSF}Tr9M}$DM4U19qw#EMu*hU&#lq^cn3$N|G5+xb(J@Z(6sE4tm^`E&J`>lT%XInu z4onJgnP*4S3Q;C{K;+;VAE&iosLc#|Bcp^gMC{e{RNU==v`1)TSy7Ca)V{J?Lz2FaP|zF{o$*F`2v zuIxngn5&r4(S)qPSh0T#s_p?v3lF6TX{DuF(&lyJ2iLRB=*t7dSo9i`!zYWgk76_)4V~y38X6_^CLi7Obwz}OhJY#3Nft3ox5-yk`wN1-K|Th zG62(bja78^l6xVB@a>-&($QLnrC~vy1F&PlR54U9uXlg@+YOm3dJK4LH7c%N%~x_g Sa`hccw(kxNXLrXq=l=ug74q5u diff --git a/testimg.jpg b/testimg.jpg deleted file mode 100644 index b34ca5d3151840576b6cdf33c3d52d0368172d4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5756 zcmbW&XHXMPn*i|8tMo_<9YqKNhS0l6fFLE5&=KhbX+c60rK9u!p@Y&}04brP^eVkd zQ96QxpdeC&^Z&j#cQg0t?w+09FZ;~S^P6qg3)iav1~^O`1|T8=0EqrJ!1WS99Y9G= zPC-saNkKtDMMX(X%W{L3hK81%iJ6{-i-U)oivtAW6%-TVpOR857?!O_Xt#TDiA)EDFD9}pNG5g8Tz@>NW7N-8cbJtH%#ps=X8q_nKOqOQJy z(Ad=6(%RkA+t)uZI5a#pJu^EuzwmK!ZGB^NYkTL*?%vUlpT{S^PJf@B|KlP8ko=qV zcle$eGj-6py```5~c{EcdbbwOv#Kl7@#s zJM<*=O+o0|t)qWv|C0UhU}66+*?+&X z!_{KtrmR!-Go3zbLI(HAIP$g8bmuxKcq#Y3c5~p2PqWz&{UTHNgz8e=95eq7E@AHhT zgr`HYx%umHH4{H8@4|IxLPei#l$})R{Bb;y#aZ0u-ZV85k2tHq=(nH=?UiFlw7$MKc&ZsYHCmZwIus7|gL2hpKMvTOla z%$yU6BZA&~FQM*OYqBa_aYw-rI?rKDMubU~guoz5shzwc?}eF@tODlm^@vxx3^mmJ zK^ceUJy7c?FvW{j~jmI8j)fVwn)LF z;ynwa|7~Pf7sb!DG^&(Z4LCoa+KKk@EHia?E!;Df5AI&pYr&?4}TE2Ern$8lbPRQ=vj@p!!auOKz`wcbHNDQOe`kd~(>KdbCKPZpTE7E1A{gbR$HX_u56 zPYc<|$A8sj9ZBL$BNc!Asr`cnkHepx{MqPY!}b$|=8EWbsOf$X!2eQqAmA0~Loj-ruOx?r{Clf#d?j$){^>5{FRNQ~GA9p+?R zZ4Pn+%2H9a=NGHNH{iuAkI92a1NQUwIb{4CxDke!<8o<+Ho&R<9}(L=qGguXrSJzW zI5r$wa)vH?A>lYDewI=b!D4H$8QP~4k?N5czM_9zmJ4d6#tmTD%Ickc5XOH#6&lBP z=26NGR#yK|2mGXT+>4XvC^IoeYoD9Esc})D`12QEXdakQZh~TpE^>C8b+XIL*~BsrZs;>bjo5EjFf2zUhRM&h zBr<}lA$m8S8sZX~=M5)p$&8zxc?In(7Bok2Nn@B^H+mX@9JrcEnNz--3cSkX3^O6u zlg~mnq?v8HO#8qfYKkF2a|wFqpyqNToSbln{KD}g$_Caf!3P!JNhr7plY&${hl#`O z^=pkaqUp?w^$y^a-%cI2==YJn)1GMqy-2sL!;eX$AV+kkU5lSE1Id(KSpTU)qQ1KBf*#E)|HGi+|*-Z0AT*$(=%1Qkt`!-!gxb2^01lH?nK0 zXBM6kYMIW!*WjuuSa*C}W9L8EPi^=(x@)XMPwPP48$aYrB4X>YiZyRj+LMY<3ybUJ z4%pYncK2&3&X1bb$WL!$Ph}t8RlF`$NXz4+Rt&%P0Fh7gZq183NP0 zVXakw`=Ajb-sus-Jsa+5lv-3YX;LJLFY?mUB*@=Fgas66*-%*sv(lEb{O+F}gY1+N zoR*;ZG{fuP?5LFf_>Vr|d-6k-YfKX;%(j*DLY_%nh7$B_fMCqKwDA2YAK1s5agbHO zw)1?dLVD(y~Z(s`<1Ua0IM9>SH!i1f(7mPSCqmCXZPAF1{Y zbYcHzgU@TmTgX?#Z{^Mn1=5qmk@hi7UZnF7g@oqL((MoK`%go4d0g3dt$pj;Cj`pL zUQsBunu<+mCZ@WpSbTXV#hZLP;>7C6lsudNX{q)iEW%qNm7Pw@DkaYOu#9P4Tc|Cb z{=*UQ(cgD>tLI5vN|)5wvJI#8&vMTC(BE@kHGLEx8owoQejBS?n=Qh~=ZvF=Y0%1q zT^ae=_==pd$PS_!=K8b)$8l|GxOm85NR>+I#({>m6-Y7>qa&62KltvvNO_uDnv zW#lGUHuvu~?kr2HfVsSM=#RF(?Z--ABK4e|ScGc83Xk@`IevO$70E4?s_`r9ySw%{ z^p#8!VDq?Cx3muvuar%$KK5z7-6D01YrL*&V=X2cJeh$>VsGy?B6N~6Ph1#4sF0)* zvb-}>YNDcWuDCZTc{x71Stc!xI8%FU6#MFHR6o+?OG&Zbvzo`fXIQaybnc%H;fXqE zi1v?sHbKk=OETWZ*v2yV_t`wxjr)GWSIql4#(SAdR4^H=otsSjpj9hR^TNf7>>t;d zcz5tX`ri7cNW%-s7t{$?sqYuaU3#pvCf~`@%mlk)Nz*g}oH^BohUBE&edTVn30ui% zKyNoaHVn&6o+)WOv=Fp&cFvUNC85aME=*Gdx=MV|RCNh1O&jtVbLm=18CAy(83#Ox zjAFZ7?E)NFDwT)EYMGrtcU1VcGi3Qo9)5v~=-|w}t5j&3IT|MOzGz(oRN|eo+6suX zQkzI3wO$G>A6-cqUkQMo1SHqilrKLU0R5^qLT0ePX&i(2y+6JpH2KJ4N0=i)$-&@+ zjwCBos<#IjwnVHX?*@1^>HhfG{--pBX_eqSeNP{U+*{vy0$(W%7h+R$|OG}owZylVUXUg*e|Jc7irXxB+s#f)0RRn?tJU4`DE))@}}l> zl^FgMow|kSUsUN_nlEZ}lO`o=c>-W<9=`@yv=ozqV)C>(G{tsA1GC~xX^Szzkm3=C zg~;YX74=;`U-ycE!l(TC$RUU0N>&m37*TXKjPmsB`J`RILG~Ao*Xgcj(fQ?<^9-qm zn2nNvGU9rWyWF|)-z#nQLmuF|f}<3se2F3M;ju83ywp4dDtZTu>1e$yOmmhcPSbXe zGMqIZ2zc~FZg?aiY3b>q5o@-C24%$&j&gWh-?On~*qSVXitRlxg zo%k`-Nvfa)J$8;@%i~mwxJ2jfAAeIBud+AeYkj9Ru(EdzI7lE=d5bwZDK*#OpjEL3SvPyhAks^jr)njc5x2h7_r^TbsVBeMSD7hBymqGJIY zD!G^|p4wZx=3X)lw%x!++ipckvsF1I9e@(Yg9smX}$zvtPR_eDS( z_3p-lj{2WmSVtR>^GUVE@OSmyx~LWL0LywwNvyUZn{+K_KZTd@I+@Cki7S(l;c?Hr zZMVjekRWc6We5Xi71Cq}5z(ApOA2#%Mz2byhaI3iV|{HjRO!-2Ru^docm;!bwR$?_Jg9T7 z0U}(|K8XIZ;ctt5QZLnph|BI?*t7G*tBLOOjeus#6!tL21KsnlQ0w0q3G_3w?1E*B zdMJn=14ZDh>JK+NM;VNpE4m$_HSFb};Ikal8a@BB!k~ItTmupF)+vGI=Pe-@0okt> zeISBJP-_RnMIysTmtXO8SP$i?jnfnvd#l;ela=*MAzVgYsgfHqC@83|j#7D?_~+1w zlH(^U!J;DgP3S6-iLS;If^x9Mru66)mS@H^*dt`AbgKPodEG&%p8A**M(+_3i1g2k zFuBFJ6#^8TiZvcEr&ohJmbylnLUf{OXdir~gboLapQIp^v9#6y@B zb@<6okqAHJGSvvOHq^B zeh9_H0yhUa4CRCfPc5ziA^QZNq#3ZWWnkrsLiy@-qz0VJF33#rBN*27DFEiJE0jej z-#ra9nYR3-Itf?cjtC52HUS-tq8ozVRYXL}@KCmChKbJq}S$RreJ5KsQa$5)CF( zVA}K)0}NH9bHqt(0!;^01Gej{Poz_XZ<@$Ex8Q%A?V;T?=yu5Y->bB7#eT1Vjy?OZ zI_qrR;`jyC!aIW<1T3zIv=}aIEZM@?*V{(v^ra`Y6^X1!^5dJtSE@&}n{})ycAah|8ThJhaVDOkd6FvP4>PC;fDMJP=I0VRU=# z=&Q!li<_nb@>zF4Q?t1tV50|N?1Vdpo^5%!46qSw$0)>J4pnxkmDwh+e4I_=rf}yn zV}hwgkh<1aE|v(Ut63~;N!i7={@VY3zol1Y**Ew?agc&iVc9Cy%CR&oYsWZf9_`1| z-D-BAJnOwB=~wle*UW$nzs7m-p$&|Jj7_?`&q>Hr*J}XFZ)2(o&AuX|KAi)xDiPNJ zrq>2Rrpdq4yJQxb8zwwk>y!jZw)Ia#u7bgfiFyqYH*`niyXiBYqiSD0 zgUP~)^7v9y>&%@Zr;Oo1WMh3kN}hC=uF!L{Eq++0(&0IIy+nVdx{!$T#6@?k-d(laezRBR+Fvesf&p104Dc4rWBo9xMy$2LAA5;nm-t4bvd;?}UTY@u~2 zJP=2Xi3|sfYO|C`k9)%PWPtI5)oBJ2UZ}BB6k!3U~vl; zK+?ftnAVf9l{XXTKgxnoiA-)%)ZYMH17e~+I49Qs{lkCOcW=jlu?Mabo;D&{?sM8O zeWRE=CBGzta;3II$*R+LGz9`OhMxHTsgrQj2F@4IA4JB5KC6KC6MD5MD5OC3NB2OC3OC3PD4RE5R?1Y?2b@4nB5}E6H8G9F7G:G9E:G;G>G?H@E@FLCLDKEICIBD>B=A;A:@:??-?/?/>.>,=+<+<+?+?+=*=*=*>+?,@/?6>5=2?1B3D3D4D4?0A2F8H;H9oA2T8*C3&=5295495473271160050-50-72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-5,-4+,4*+3)*7(+=.1E69P:0U?1^A3jC4xD6E4E5C3C4A4A4B7D:E@<@6>/@.?-?-?-?,?-@-@,@+A-A+@*A)@*A,>-?/>.>.>,=+<+<+?+>*=*=*=*>+?,@/@5>5>3>1A3D4C4D5A2C6F8I;G:l@3S9*B4)>63:6595484382271161.61.72/72/72/61.61-50,50,41,//-.0-//-//-0/-0/-2.-2.-3--5,-4*+3)*5)+<-0C47N8:d>=vEAJINLTVajl}r{{ou[[QHuOCiOFeOG_PH_RN_[Yfnot~ojkY][LVSJXSZVRaXQa/.,/.,0/-10.40-40-51.51.72.72.72.72.92,92,92,92,91.80.7/-7/-7/-7/-80.91/80.80.80.80.80.80.80.80.6.,5-+5-+5-+4,*4,*4,*4,*5-+5-+5-+5-+5-+5-+5-+3.*2-'1.'2/(30)30)41*41*52+63,63,63,74-85.96/96/:7.?8.@:.B<0D>2G?4H@5H@3H@3I@1I@1K?1K?1K?/L@0MA1NB2MA1QA1YB2dC2qC3|C2B2A0<-:+;.=2@6D:F=D>CE@FBGBFDFCEAD?D;@:?;@=@@@A=@;@5=.@-@-?,?-?->,@,?-@-@,A+A,?*@*@+>->.>.>.=+=+=+=+>,>,<+<+=,=,?+?.A6?5>3>2A4C5D5C5D8F;I=J=G;h@4Q:,B5,?74=77<66:4494183072/72/62/62/62/51.52-41,41,21,.0-,1-.0-.0-//-//-0/-2.-5//4..5,-4*+4*+9-/>24I56[97l?9|E@IDOM[`fvmw}}u~fmTVMEvLAkMAeOFcQHcMH^NK\[[eqty|xzlfiXZ[MVSLZU[ZT`[S`.-+/.,/.,0/-3/,40-40-40-61-61-61-61-81+81+81+81+7/-7/-6.,6.,6.,6.,7/-7/-80.80.80.80.80.80.80.80.5-+5-+5-+4,*4,*4,*3+)3+)6.,6.,6.,6.,6.,6.,6.,4/,30+30)30)41*41*52+52+52+52+52+63,74-85.85.96/96->7-?9-@:.B<0E=2E=2F>1F>1G=1G>/H<.I=/I=/J>.L@0JA0KD2NE4UD4^D3iD2sB1~A/?-9)9'9*<-@3E8HDCACBCDCCDBC@C?A;@:?;@>@A@B=@9@3=-@,@,@,>,?,?,?+@-?,@+@*@+@*@)?*>,>.>.=-=+=+<*<*=+=+<*<*<+>,>-?-A6?5>2@4B6C8C7B7F|F:b@4L:.A7-@85>96=77<74:5294183083062/62/62/32.52-21,21,12--2.-2./1./1.00.00.10.10.5106005//5,-4+,6,-:01D22T71c;3qA7{E;HDRU_lis}yx}ow`fQRLEyL@pL@hPEgQFfLC^GBVMLZ^^fjnquyxx}wzvwzokoa`bTWYLTTL]WY]V]]V^------.-+/.,0/-10.3/,40-3/,3/,4/+4/+4/+4/+6/)6/)4/,4/,3.+3.+3.+3.+4/,4/,50-50-50-50-50-50-50-50-3.+3.+2-*2-*2-*1,)1,)1,)4/,4/,4/,4/,4/,4/,4/,4/,41,41,41,41,41,52-52-52-52-52-63.63.74/85096196/<5-=6,?8.@9/B:/C;0C;0C;.D:.D:.F:.G;-H<.I=/J>0I@1JG6MH5RG5YF5bE3jD1uB/}>,;):):*=,B2F8J=I?GBDCDBEBBBAA=@<>:?:<<>?>B>C:A5?0?-?,?,?,>->->-?->.?-?,?+?,?+>*>*>,?.>->->-=,=,=,=,=,=,=,<,>->.?.B4A4@1@3A7C9B8A7C;H?LCJ@tE;Z>2E9-<5+@93@85?75>63=52<4194083/62/43/43/23.32.12-12-02--2.,2.-2.-2./1./1.00.10.3205105104..2,,4+,7./=/.N5.Y9.e=1n@3sB;yKKZegpzxu{ks_dTTOGLBwNAmNBhMAeJA`GBYGFXKKWMPU]cc`fbbia`f\Z`TW[MUXMXXP^YV`WX`WZ,,,,,,.-+.-+/.,0/-3/,3/,2.+2.+3.*3.*3.*3.*5.(5-*3.+3.+2-*1,)1,)2-*3.+3.+3.+3.+3.+3.+3.+3.+3.+3.+2-*2-*2-*2-*1,)1,)1,)0+(3.+3.+3.+3.+3.+3.+3.+3.+41,41,41,41,41,41,41,41,41,52-52-63.74/85085085.;4,<5+=6,>7-@7.A9.A9.A9.C9/C9-E9-F:.G;/H<.J>0HA1JG6IH6NG5VF6\E3dC2n@0v>-{<+;);*=,@1F5J:J=H@EAFAE@CA@>>?:<;<:;<=@=C=C8@2>,?,@,?+?+?->,>,?,>-?,?,>,?+>*>)?*>+>->->-=,=,=,<+=,<+<+<+<-=,>/?.B4A2@2B5C9C:B:A;A9I@NGNEoG=S?4A;/96-@93A75?74>63<4194083/74/43/43/34/23.23.02-02-.3--3/-3/.3/.3/02/02/11/11/21/32032040/2.-1-,4..8.,G4-O4)X8+`<0e?6mGFyYdku||w|nudh[[RMLB~OArL@hI=cH>`HB^ECX@BO;@FBGJDMJJQJJQIIQFKQEOUIVWO^YS`YS`XU++++++,,,---/.,/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-)2-*2,,1++1++1++1++2,,2,,1++1++1++1++1++1++1++1++2,,2,,2,,1++1++1++0**0**3--3--3--3--3--3--3--3.+41,41,41,30+30+30+30+30+41,41,52-63.74/74/85085.:3+;4,<5-=6.?6/?6-?6-?7,B8.B8.E8/E9-G;/H<0J>2H@3HE6GF4KE5QD4XC2_B2f?.n=,v=,|:*9);*=.B2F7F8FF>E>D@C?@@>>::;:<.>.=->-=.?.?-?-?,>*?*>)>+>->-=,=.=.<-<-<-=-;,<,.=0?/C2B1A1B6C:CCC793@72>71=60:5/94.83/63.43.43.34/13.13..3-.3-.3--3/-3/-3/-3/.3/.3/02/02/00.11/22021/0/-/.,2.-4/,?0+D0)K3)T8-Z<4dFFu]js~tzmpceVSLCK?qI_FB]DBW?AN;?H:BE>HGDMHGQIGQHJRGNVKUXM^ZOaYNaXO++++++,,,,,,.,-/.,0/-0/-1-*1-*1-*1-*2-)2-)2-)2-*2,,1++1++0**0**1++1++2,,0**0**0**0**0**0**0**0**2,,2,,2,,1++1++0**0**0**2,,2,,2,,2,,2,,2,,2,,2,,3/,30+30+30+30+30+30+30+41,41,52-63.63.74/85085092,:3+;4,<5->5.>5.>5.>5,B8/B8.E8/E8/G:1I=1J>2I?3FC4FC4JB5OA4TA2\@2b>0j<-q<.w9*}8)8(:,=/B4B5F:E;F>G?G@FACAB@;;;;>;B;D:D4@->(A-A-@,@.@.?-?->/>.@.?.?->+?*>)>+>->->-=,=.<-<-=-=-<.<.<./>1?1D2C1B4C6C;D>D>EAPL[Te\f]u_T[UIGMACI?<92?82>71;6094.74-63.43.43.34.24/13./4..3-.3-.3--3/-3/-3/-3/.3/.3/02/02///-00.22022010.0/-0/-3/,8,,;,)C0*K70S<6^IHtbnzƄzrxikWWIDE=nG^CAY@CV@DP>EKGQRKWUQ^WU`XS_UR^TT^SY_S^[LaZJaZJ,-/,-/,-/,.-------.-+.-+/.,/.,1-*0,)0,)0,)/+(/+(/+*/+*/+*/+*/+*/+*/+*0,+/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+0,+1-,1-,2.-1-,1-,1-,1-,1-,1-,1-,1-,0,)1-*2.+3/,3/,3/,3/,3/,3/,3/,3/,3/,40-51.62/74/80-92,:3-;4.=4/>5.>5.>5.?4.?5,B5-C6.D7/F90G:1F<2G?4H@5J@6P?5T>3X<1^90b6+m9.t8-|8+9,;/=0?1>0A3A4C8E:G=G>E?C@@?BADAE>D8B1A.B,A.@-?,>.=-=->.?/<,=,<->-=,=+=*>*<+<+=-<,<,<,:-;-=/3@2A5A4E5D4E9I>G@D>EAMGZRf_qfsh~rdjj^V^SIQFLLBJF=B>5<8/95,74+63,33+43.34.14-14-02-/1,,1+,1+-2.-2.-2.-2./1./1./1./1.02/02/11/11/11/11/11/40/4+0;/3A32C4/J;6]OOymyϐكtzjn_bZ[LItHBdA>]>>X?BUAIVLU\U`bbqnn}xv|rulyoguh_k_W_P]\Hb\Fc]G,-/,-/,-/,-/------.,-.-+/.,.-+0,)0,)/+(/+(/+(/+(.*).*).*).*)/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+0,+0,+1-,1-,1-,1-,1-,1-,1-,1-,1-,1-,0,+0,)1-*2.+3/,3/,2.+2.+2.+2.+2.+2.+3/,40-51.62/80.91.:2/;4.=4/>50>50=4-?4.?4.A4.B5-C6.E80G:2H;3H>5H>5L=6O>6Q=4V;2Z90_7/h70p7.w7-9-9.<1<1=1@3A3B5D8E:FF8C2B-B-C.B-@.?-?-?->.>.=,>,=-=,=+>+>*=,<+=+<,<,<,;+;-<-2@6A7B6G9E7G->->->/?0<-=-<.=.>-=,<+=+<*<*<,;+;-<-:-;-<0<0<2>3?4A8C:D9J=H;H>KDKFLGSM`Vsgqz{wsocqbXcUNRDMN@HI;DD8@@49;.46+/1&01)01)/0*/0*./*./*//-//-//-.0-//-//-//-//-//-//-00.00.00.00.00.00.00.1/26+97+98/4;63HE>_^Yzz|DŽ}{|}}wq~n}n~~o~y|{j{i\hTXX@]Y<_[@-.0-.0-.0-.0-.0-.0.......-+.-+-,*-,*.*'.*'.*'.*),*++)*+)*+)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+-+,-+,-+,-+,.,-.,-.,-.,-/-./-./-./+*0,+1-,1-,1-,1-,0,+0,+0,+0,+0,+0,+1-,2.-3/.40/91/:20;31<41=31=31=31=4/>3/>3/@2/@3-A4.C60D71E82F93H94I:5J;6L:6N94Q83T50^72e60o6/x8/90:/<1>1?4?4?2?1A2B5D7E:G>H@JAI>F:B5A0@.A-A-?->,>,>,=.>.<,=,=.=-=,=+=-<,;););+;+;,;,;-;,;/<1<1>5@7C:DJCLIQL]Vj^oyzxm{jbm]SZJQUFKO@EI:@D6;=057,13(01)/0(./).-(.-).-)/.,0/-/.,/.,/.,/.,/.,..,/.,..,0/-//-0/-//-//-//-//-2-17,:6*83-1961HJ?bfX{z}|k|iXfOSV;ZV9^Z=+/2+/2+/2+/2-.0-.0......------.-+-,*-,*,+),+),+),*+,*+,*++)*+)**()*()*(),*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*+,*++)*+)*+)*,*+-+,-+,.,-.,-/-./-./-./+*0,+0,+0,+0,+0,+/+*.*)/+*/+*/+*/+*0,+1-,3/.40/901:20;31<42=32=31<20<20=20=2.?1.?1.@2/A30B5/C60D63C84D95E:6G96H94K84N50X72_60i70r7/}:1<1>2>2@6?5?5?3@3C5C6E8E;G=H>G=D8A5?0@/@-@-?.>-=,<,=/=/<.;-0->0-?1.@2/A4.?4.@51@72@93A:4B94C84F74H5/Q51X5/a6/l8-u9.0=1?5>5?5?4B4B4C4D4B5D8E:E;B7?4>1>0?.?+=,=,<+<+<.<.;-<-<.;-;,<,;+;+:*:*9):):+9*9-9-<1<3?6A8CHCNJVR`Zper}~~yup{jdp\]iSR^JJS@BK:>E5:@29<134,22*1.)/,'/))0**1++2,,1++1++1++1++1++0,+0,+0,+1-,1-,1-,1-,/.,/.,/.,2,.8*75(13+(56&EK1\gGudyťέɭʰ˱Ȭ{wrdx]Q_ENR7QQ5SR6,03,03,03,03./1./1./1./1/////////////.,/.,.-+.-+/-..,-.,--+,,*++)*+)**()+)*+)*+)*+)*+)*+)*+)*+)*+)*+)*+)**()*()*())'()'(+)*+)*,*+-+,.,-.,-/-./-./+*/+*/+*/+*/+*.*)-)(,('0,+0,+0,+0,+1-,2.-40/40/:12;23;23<34=32<21<21;10<1/<1/>0/=/.>0->0-?1.>3/=60;60;83<94=:5>93@72C60G4.O4+Y4+d5+n8,x:-;.;.<4<5>3@3A2B1A2@0>1@4B7B9@6>5=2?2?-?->,=+;*;*<-<-;.;.;-;-;.:-:,;,9)9):)9(9*9*~8,~8,<1=4@7B9E>IAKFMFIAH@JFSO]Xhb{ny~wxnjxadr[ZhQQ]IITCCL;>D60-?1.=2.=4-=6.;819919:29:2;81?6/C2+J1,T2)^3*g7+o9-u=.z2B6C7B7?4>2>1>/=.=-<,=,=,=.>/<.<.2>5@6C:G=JBNEOGICIDPJ\Tg`uiu~zytoi}bby]\pUUgOO\HGRAAH8=A388.85.7/,3+)2()2()3)*4*+0*,/+*0*,0**0*,0*,2),2),3*-1+-1+-1+-0,-0,-0,-1+/4)/4*+4-%46!?F%T`8m|Qgtz~z{Ĉːəǝƚ~xvolfZnSJZ?GM3FJ1DF./0+.0+/0+01,01,01,12-21-32.43/43/62/51.41,3/,4/,50-50-4/,3.+2,,1-,0,+0,+.,-.,---/--/,,.++-*).))+.)/.)-/(/.)-/)-.)-.*+.*+/+*/+*-,*.-)--+-.)./*./*------.,-/-./.,0/-2.+2.+2-*4,)5-*6.+8/*:1,:1*;2+=4-=4->50>50>50=4/<3.;2-=2.<1-<1/;0.=/.>0/>0/@1.A0)@2);4*77-39-28.56.:3-?-)F*'L)'S*&Z/(`5,d<0k@0yA0@/A1B3@3=0;/8-;/=.A1B2C2A0>.;,;0:2;1=0?0?/?.>.@1?0>1<0;/:.:-;-{9+~@3w<.q7)w>-w>-v;-}?2{;/@4E9I?LAMBPCNEKISPbYpa}jq|~u{ouiib_[zXZsUZnSWeNPWEJK=C?6@93;0.6**3')3'+3'+1&*,*-)+***,*(),'+.(,1(-2'-3(.3(.3(02(00)10)1/*1/*0/)-1++0-(//#5,>5,>5.>5.>5.=4-<3.<3.=2.<1-;0.;0.=/.=/.>0/@1.C0*C0)A2+>4+:6-95,:3-<1-?-+D*)I*(N+'T/)Z5-_:1e>/pA/xA-A0@2?4=3:2;19..@0A1A1A/?1;2;2<2=0>0@/?/?.@1>/=0<.;.;,:,;,x8,x<1s9-n9+s>.s>.r8*u:,}=1A5E:I=K@NAPCNEJHSRf]wfpww}ovei``YZY{X\wXZnSSaJNUCFH;C@7<737/-3*+2)*1(+.(*,*+**,+),+),-(,/)-2(02(02(02(02(10)1/*1-*3-*3-*12-12.-0,)--%8:,SXBox]iolnpppw{xwy||{xuqnh{eYjWMZHEL<@D5;=/12,12,12,12,23-23-43.43.54/54/85085085074/72.61-80-80-7/,6.+4/,3.+2,,1-,1-./-.0.1/-0--/,,.+*/+)./(/1'//)-/)-/)-/)-.*+.*+0,+0,+/.*/.*/.)0/*0/*0/+//-///0./0./0/-/.,1-*2-*6.+70*90+:1*<1+=3*>4+?5,?6-?6-@7.@7.?6/>5.=4-=4-=2.<1-;0.;0.;0.;0.<1/?1.C2+E0+H/+K--L,/K+.I*/E+.A-,@.*A.(E.(M.)X1*b3-g5,j:,o;-w;0=4<6<5:4:4<2=2>2?3A2A3B5C5?2=/>1>.>/>,=.<,;.<,:-:*;,<)~=+{<+}=1z<1v:/u;/x@1x@1v<.v;-?5B8F=H?JAKANCNFJHTQf\vent{}yximae\a\`]`[|]UrVPhPFYEBP?:D93:2.3,*/)*,)**(0'(1&*1&*1&*0'*1(+0*.0+//*.-+.,+0+,0)-0(-1(-1)-01/23/..*'**"57*PUAmv[|ik~jjnn~mqx|zxvvuwyy}}ywtpmh|cYkUMZHDH9=?299-23-23-34.34.34.45/54/54/650761961:72:72961940940:2/91.91.80-50-4/,4..4..3/03/01/01/20.1..0--/-+.0)02).0*.0*.0*.0*,/+,/+*1-,1-,0/+0/+10+10+10+10,11/1111/010.10.2.+3.+3.*92,92,;2+<3,>4+@6-@6-A7.B8/A8/B90A8/A81@70>5.>5.=2.=2.<1/;0.;0.<1/=20=2.B3.E2.L..R+0V'/U&.P'/I).C/.<1+;2)?2)G0(R/)_.*d/)i9/k;/u<3}<6;8;9;7:6>8@8B9B9C7B7A7A5@1A/@.@.>-<,;+:+8*9*:*:)<){=(x>(x>*>1{7.z7.z<1v;-w=/|A3{@2B7E:H=J?J@MBODQHSJ\Qh[tbgm~v|~}yqoiifgfeggde_~_Zw[PhPK^JBP?8D62:/.4*,/(+*%2&&5%(4%(2&(1'(/)+/+,.,-+++*+-*+-(,-(,/',/',/*+-.*+1++0+'.+"88,PUAiqYvc{hyh|il}mykzmrtq}p}p}s~v~x}x|x}zzwuqnje|bWkRN[GDF9?=1:8,45/45/45/560560560761761872872;83<94<94<94<73<73<41<41;30;3083072/61.61.5106216213122011/00./1-.2,04+.4+.4+.2,.2,,2,,2,,3/.3/,3/,3/,21,21,32-32.32032032032051051.61.61-;4.<5/=4-?6-A7.B8/E8/C9/D:1D:1E;2D:1C90B8/@5/@5/>3/>3/=2.=2.=20=20>31>31@51E31M02T,4X)3W(2R)1K,1B30:6-77+:6*B4)M2)X/)^/)f:1j;3s<7z=:<:<;;;::;7>8A8B9C:C:@9@7C2C1B0?/=.<.:-9-7+8+9+:+~=+x>*v?*x>*9-|/'8/>4w4+s5*}A6}C7E:GJ?KBMDQGWJ|aNzjQpYu]|biu|~{}zwzpzlxlwkumrlmgkd`rX[iRR[HHL=@@4;7,70&5*$6('5''3''1'&.)&+*(++)+-*',('+*)+*)+***,+),+),-)*,#$2*'50*86*BC5UZFfpWn}^teqbuexiwkshtiwkznxlwmxnys{u{w|wyuzwwtsomhd{_WkPN[GCC7>:195,560560671671782782872872983:94=:5>;6>;6>;6>95>95?74?74>63=52;63:5294194184184395484373243151240/6-06-.6-06-.4..4..4..4/,40-40-40-51.32-32-43.43.43/431542540841850940:5/=60>7/@7.A8/C90D:0G:1H;2F<3F<3F<3F<3E;2C90B71A60@51@51?40>3/>31?42@53?53@72C52I35P16T/6S.5P05J22C52=90<:-=:+C7)I6(Q3)W2)]2+d3,l50v64}77877766~75}:4}<6}>5?9@8?9A8B3C1B1@0=/;.:.9-9,9,:,<,|=,y>,x?,|=,5*2,LEXQA8|90F;K=yH:zJ<{M>|N?}OBQEUJ_LrkOosR|uXw]ybiszz|~{y~vpoppp{pwmskj~bfv\_hSV[GOM>GA3@6*=0';,'9+(6+'3+(/,',-'+.').().(+-(-,*/+*3)*4(*7'*7'(3($<3,E>4IG8QR@]bKgqVjyZn]k\l]pbqeodoerfumrjqitnxrzvyvyvvtwvurokjfc|^UlON\ECC7@91;4,671782782782893893983:94:94;:5>;6?<7?<7?<7@;7@;7B:7B:7A96@85=84=84<73<73<73<74<74<74;639529338308/09/.8/080.80.80.61.61-61-61-52-52-63.63.74/74/540540841952:63<94=84@93@70A8/C90D:0G:1H<0I=1I=1J=4J=4J=4I<3F<3D:1B8/A7.A81@70@72?61?61@72@72A83?74@85B86D97G96H96H96H94E80E8/E9-E9+G9,I9*K9+Q7*Z/&d/'n3-z6398;9;:=;A>@:=6<3:3<4=7@7A5B3@2?2=1<0;//|>/}>/=/9/1+<8lf~yZTC(+C&+E$+C&(F5-LC4VQ>[YD`bJgmQiwVj{Wl[gWfWl\oananbrfskojoirnwtyxxwuvssuvsrnlicb{[TmMM]CGH:E<5@707827828938938939:4:94:94;:5<;6?<7@=8@=8@=8A<8A<8C;8C;8C;8B:7?:6>95>95=84>95>95>95>95=85<73:51;30:0.:0.91.91.91/91.91.72.61-61-63.63.63.74/74/74/540651952;83<94?:4B;5B;3A8/B:/C9/E;/H<0I=1J>2J>2K>5K>5J=4J=4F<3E;2C90B8/B92B92A83@72@72A83B94A:4?82@93B;5D=7F=6G<6K<5N;4M6.N6,Q6+Q6+Q7*P9+P9)V6'f6*r6,~;3@9D@HDJGLFQJLDD;;07-7-91=4>5>7=6<5<5=4}=3z>3x@3vA3x@3z>3<3:37331(&=;|zhcG@K@xH:nMhV>lX@t[E`LhPysQwUt\l^__V\Q[T\ouzx̆|~}xvrtuuussr|nyju{amoWgbN_TBUE5R/(9/&7.'6/'81):/)=.+A,+F)+H(+K'+H)'TB4YQ9B?:D?;D?;E@8E>8D=7B;5B;5B;5B;5B:7B;5A:4A:4A83A83A83@72@64>71>71>71<71<71;60:5/85.85.74/74/961961961:70<71=82A:2B;1C:1D<1F<2J>2K?3L@2N@3N@5N@7N@7L?6K>5I<3H;2E;2E;2B90A8/@91?80?80?80@93@93<5/MD=M@:K:3T@9R62O0+a<6\3-`5.`4+^/'^/%f6,m=1q=0I=G;I?KAF>>7=6D;NDPEVJYKOBA5;0>69898655284?8|@6r>1rB4oA2q=0v:07243-1',HIbaEDWUyvVOFu:9:49:49:49:4:;5;<6>=8?>9>=8>=8A>9A>9B?:C@;D?;D?;FA=E@8E>8E>8E>8E>8D=5C<6C<4D;4C:1B92B92B92B92A83A83@93@93>71<71;60;6096/85.74/74/96196/96/:70<71>:1A:0B<0C;0E;/I=1J>0L@2L@2N@3N@3N@5N@7M?6J=4I<3H;2E;2E;2C:1B90@91@91@91@91A:4B92D93I81L/+V.,j76u99{;;ECD?H@IAG>IBNHPLOGD7B4B6C8>37-7-=0C5?0@0E3G6F6H:NELMHL@D9;98>:@8x>3o>0zI;LA?8,+).9DLWKNMM>=@?`\YQ@5TDyaIe[@^]?ihIslOvgJ~dKcNdX_[UZAN,E%D&H'I.N3N6UE8[O5cZ9gaAifEnrOz]zbt^r_p_p`q`udwdwdwfsixrzxyx~}zzromhhd`y[TmMNaERSAVPBUOC8938938939:4;<6<=7?>9@?:@?:@?:C@;C@;C@;C@;D?;D?;FA;FA;FA;E@:E@:E@:G@8F?7JA:I@9H?8G>5F=6E<3F<3E;1D:1D:1D:1D:1D;4D;4D;4C<4?80?80<71;60:5/:5/94.94.96/96/:5/;7.>7/@9/B90C;0E;1F<0I=1K?1M?2M@0NA1M@0P?5M?4L>3K=2I<3H;2E;1D:0C:1C:1A:0A:0?;2@<3@<3D;4UDI?LANBRJUROSLK@4B0@0?1;.7+8+=/E6>+7$:'>-A/C2D:02:BDLLRMRKLA>71{8/v6,x2*1-37=GGWM[FI53:931NKc]J?[J}cLj_CgdEtoOpQhJhNhYbbQZDQ7I1J2N/M*H2O0K1J5L4M2K3L7P@XC[F]IaNcQeUhVkSjRiOiNiNlPoSsVuha|[tUlYldrR]r-2^&'Y0,W:4Q?5B:-:8)>B1LN9VO3aV6e_?heDquTe~iwdxiuerdrcveyhzizjv~zypmg~b^wYTmMPcGSXDXUDYVG7827828939:4;<6=>8@?:A@;BA5G=3F<2E;1D:0D:0E;1E;2D;2E<3E<5E<5@91?80=82<71;60:5/:5/:5/96/96-;7.;7,?8.@:.C;0D0K?/M@0M@0M@/M@0O?2O>4L>3K=2J<3G:1E;1D:0D;2D;2B;1@<1@<3A=4B>5F<3S81[*&:?T`TeUfUcJO30:/>0A3F=IGBH>@B7F5B3@3?3>3B4D6G5B/<);(<(:(6&3(979=7>7<^@aCf@f?e?g?hCmErIsOuQuUvSqTnaxfvWb}15j0/X1*P8,G>/>A.;D/?G/PK._T8g`CokN||`rv}qzq|s|szozm}ouzsqh|c]tXSlNPdHRZCWYDYZH671671782893:;5<=7?>9@?:BA/K?1M@0M@0NA0O?/O?0O?2N=3N=3J<1I;0G;/D:0D:0D<1D<1B;1@<1A=2A?3B?6K=4\5.w32LS]iM_@Q6E&+1)7(:&<)@3D=>?;;?5B4@2?2@5C9H;J<>/?/=+;)9):,;/<1FADA>?797KCTLSMKJ?B5>274.7.1+:484@9[PUC{N9bIkP`F[FfTrdmhEK:D9C=8@?:@?:C@;DAGB>GD=GD=HC=ID>IE2I=1G=1G=1F<0F<0E;1E;1D;2C:1A:0A:0@91@91=82<71;60;60;7.;7.;7,<8-?9-A;/D0L?/M@0NA0NA0O?/O?/O?2N=3M<2L;1I;0G;/F90C9/C;0B<0B;1@<1@>2A?3B?6N;4m84FEY_WbCQ8F3;++1'8%:!9 ;&>.:2717,:-9-7,:1B8E;E:>2?0<,6'6)>0D;G=8-@6D?BB=A9>27.075GBSLNG=910/2671(A>GBOMWWNRDM:G5F2F.D1G7N8S8T8V9W;\>aAeCk;ej?m>n>o=m:jHr;a?dKnKnNmUoZnrajILt:8\6-P9+PC2UM:^QAreU|nʿ~m~k`t[WnRVjNS`FV`EX`H560560560560671893:94;:5=<7>=8A>9C@;DAHC?HC?GD=HE>ID>ID>JF=JF=MF2@@4P91r1/JKSV>D0603//1)1!9#=!;< =#;%6%6)8-6,4,81@:C<@6B7A4->-5+*&"%%+*1.4)*.+3,4,3,2,0-2+2%6&2&7,6.>7`UqeSVBM:WIf[d_RTCIFM@D??@<@8@7FAMLJN@K9H7H5H3E6G;M8P7R6R6U6X9];ak?m@qBtBuBuBtBpFmAaEeKjKkVt_z]tj~p~ow^aCAg6/hB7sUJye\}vŽ˺tqexb\sW[oS[jM\iK]gL561561561560561671872983<;6=<7@=8B?:DAHE>HE>HE2G=1E=2D;2C:1C:3A:2A:4@93?74<73<71>7/>7/<8/=90>:1A:2C<2D=3H@5I?3L@2MA1NA0P@0O@-O@-L?/L>1M=0L;1J91I81E80C90@9/>:/;;/<<0=>0>?1A?0S8-<7\[ZY86.*1+.%2#9&B*F,D'A&A&<#9#9*;0:07.<4CD;=<<@9>48,6.94HH@E;D:H:I8G;I?NAU?Vi>l>o>p>q@r@tAqCjMmSsJh@`Tsge]w_xh{p}qxgg^X{ZQ~wļ«zxl{hbu_`rXbpVboScmT21/320431651875984984984;:5<;6==5??7AA9CC9EE;EE;HH@HH>HHLC4J@4KA5MC9LB8F=4B90E<5C:5@93?74@85?75<74<42C:5B94A96>95?:7>:7?;8@<9B?:D@7G@6J@4L@0O@-O@+L?,G@.F?/I;0K81M53K65J88F;9B?:6904,=,<,=/C4F8>12&9+8*8+8-7-5.3/1-.,.-0,1,5*7):):(9&33 8'7'6(B5SINCSK\W]ZPR>C9??GAFCDAA?9<3;/?HH>HH9H?:F=8B;5D:8A96?74?74@85@85=85;62=4/=4/=52<74=96>:9=<:>=9B?:D?9G@6J@4M@0O@-P?+L@*B?,B?.F<0H:1J65I56F35@65@<9:=6;>5@@4E<-J9)^B4L>QB;-2#6&:'7$9%>*;%<(?+@-=,9*6(7)9):*9);+>.A1B/@.?,:(<+E6H9?18+6)7+7,9.;-8;1:-<-=.E5L?NEGC?>?B?F@JCJCLDPFTBS>S>XBaFhCi?i@jBpFvJzK{JzHtKpQs\z_{XwNqEkDlEiKg_pnukLI~t̲ų~/.,0/-10.21/43/540762761:94::2<<4>>6@@6BB8CC9DD:IF=IG;JH;LI8MJ7NL7NL7OL9KI:NKBTRS_^fihxmmlkkh`YiYQ\OGRH@KH>GG=EE93>:1=9083-94.;60<92=:3>;4?<5@<3E>4G?4I?3L@0O?0P?/P?-L?,<;&:=(?<+A;-B71A62>42;30=84B;5H94N2.Y,)l/.;=FE;02$1 9'<)7$8"<&;&=)A-A/>.<-:-->-<,?-8(>.L=G:6*2&9.6,6+8,:.:/8.6/3,0-.+.+1)2'6&8"7!8$5#9'>/=.6)9,A7<5>8EAKIJJCC?ACCCAD?B==4:.8*:*;+8)D8NEIE@@>ABIHPAG@ICOGTEU@U?XA_DfCiCkFpIwK{L|JzFxHwKtNtZ|aUvCdIkTv?\I`{||aC;|nճξ/.,/.,0/-10,21-32.54/650880991;;3==5??5AA7BB8CC9HEQPL^]bmlzzz{urke_{YSmTLdMEZG@PB;2?=1@<1?;/A;-F?/H?.K?/M@/O?0O?/P>0L?/@=*?>,@=.?;/?;2>93=:5:94<94D95M51V-+j)-288C>C7.7(:(?-?,9&8#;&:&<)>,@/>/=0=1>2?3=29.8*9+:,:,9*;,;-B4E9>31'2(9/5+4*6-7-7.6,3,1*0,.+/)0(2&4$6 5204$<.=/9.=2D:5-60;5D@MIKIC?=8@9A8>4Vdtӏd92lJ>ynХ10,10,0/+0/+10,21,43.54/77/880991;;3==3??5AA7DA8IE:LF:NH:PJ:RK9RM:SL:QK=OJDVTUfdqwxÏƎ{wpmid_[~UPnNJaKGXEBM?=B;7895296/85,85,671783891;;1>5L?6K>5F<3B92=82:946;47<59<5>:1H4-Y2-w78?D>E9<;0<+@.A/@-<);'>*8$:'<+=.<-;.<0=3?6>3:/7,7,8+8+8+7+A5C88.1&3)7-5+4+3)4-6,5,5+1*/*/,/*/)0'2#4!541/2"6)9-:0?6E=F>@7<5@9KDNGE>;1=1<0CBLIUJYFXCYC]@_BdElJsNzO|LyIvJwTT}JqImStVtNiD^F]Xk󝞎HFk.)kc͖ɿȾȿ65143.32.10+10+21,32-43.66.77/880::2<<2>>4@@6B@4JD8ME8OH8RK;TK:TM;SL*F@*G?*H@+IA,IB0IA4HB6HA9G@:K=?51;/<+?-?->,>*?+?-8%9(:+9-9,:.:0<4>5;4918.8.9/8.6,7-C9@70&,#7/<42*3,2(2+3*3+2+/*-*/*.)0)1(4$5"6 57#3#3$3&5)8,<1?6YQRJHAC;E1:*;(:*:):(:+>0A3A6<3<6A=EEGHIMLPBF@CCIKTNYJZF\F_A_BaEiJpNwOzNxLvQ{RyOvOtVy]{SoD^TlQddt`dMMjgΏX<94;8185052+41*41*52+63,74-85.96/;81=:1?<3A>5C?4JB7MC7PG8SJ;WK;UL=UK?SJCSJK]WcnlŚڟꢩ뙛啘ݔ֐ʉzyrqfc~XVkPN\IGRFCLCBJ??K==G;:@;9:<94?;/C=-E@,F@*FA+EB/EC4CC7BC;AC>@ACBLCANEEOCHNAIL>HI>GDCHAA=2L:.gF7OAI/>,>*?+@,@-?-<*8'8)9*9,8-8.91;5:4:3818192:2706/<5>5912(4*;2<33*1*1'1*2)1)/)-(,(-)/)1)3(5'6%7!7 9%8%6%4%4(7+8.7/NGXPZSQIG>D9@7>/<*<&<(:'9(;*>0A4D;@7@:FCIHHGGJIKFHBDDILSQZO]L]K`D^DaFfIlNuOxOxPwVxUvTvYx]{ZwQkI`WkUgM^^mKZTaTaXaefȃ~嫧@=6=:3:7074-52+52+52+63,74-74-96/;81=:1?<3@=4B>3JB7MC7RF8VJ:WK;XL?:6@<1A>/C@/CB0BC3BD7?D=>D@CVCIaLRhU\o\br`dobbjd`afXWaJDlG>SEXFJ7@+>+A.@/A-@-A.A/=+7&7(8+8+8-6-7/81;4727272829494836/A:8/3*8/=5=5915,2)0'0(0)/)-),(,(-)/)2)4)5'7&7$8#7"8%7$6&7)9+7+4*4+NGd\`YOFA7;29->)>'<&;%9&9*2D9A9E?KHLIGDEEHGIICDEHMSSZR\O^OaH^G`GdIiNrQxRyTzUuZw^}^|UpMgOiYn[mctM^TeO`UgL_R_^_vqלB>5A=4@<3>:1<8/:6-84+73*62)62)73*84+;60>93A<6E>6I@7MC7RF8UI9WJ:XK;ZLA[NHTIMXR`gd|~ʗ㞪쩫蟡ڙҍtrhe]ZXR~XQzYQvVOnMH_C?M?:@?;:B?8>>4@B5BE:?D=:CB>FH?LUDVnQfaristvxo^l[cWYWUVMM?@.9$:$<(=*?,@.@-?-=,;,6'6(6*7-7-8/91838495:693616183:3C<=670@7[Rlc]T?63)2)2*/)*&(%(&+(-+0,2+1'0#1"4$:(;&<(<)<*:,9+8,7-@881GAc^XQB<@;4*:&<$<&<&:(:+<0>2>4C;PJXROJ?:?:HDHGGEJKPTRWNVKXL\RfOfKeJfMlQsRvRvWvXuXu[w\xZsWnVkbuVg\m[lFXDXQeVefgieʏ網C?6B>3A=4?;2=90;7.:6-95,73*73*73*84+:5/=82@;5D=5H?6LB6QE7TH8VI8WJ9YK>ZMEUJNWQ_eby{ɔ⛦뢣㘘،ɀuqiec^`W`V]TVPtMIbFCTBAIAAC<<:AB=FEACD?A?@DBEOMRWVdchqu}}}{p`uYiVaQUHF@4;)<&='8$7%8&9(8'9(7(6(3%4(7-:2<3=5<5<5>9<7<7>9B=C=B[O@66,+#)#-)/-,+((0.4/616.3)2&2%6&:';'<(:(9*7)5)4(9/5-=6PJTQLHB?1(;(=&<';'9(8(:,:/>4B8OFWPRID=C;HCLHJFMLSRTWPVNVOZVfUhSiRkRmSqStRuMmUt\z_{\vUoRiReUfRbZhZhN^ScYiS^`_^W}٩EA6EA5C?4A=2?;0=9.<8-;7,84+84+73*84+:5/=82?:4C<4G>5JB7ND8RF6TG6WG7YIBZEJpW]csrz{vpcTnG\K\HP<<5.9*<'<%;';):);*<,<-<-<.6*8.<1?5A8>7<3:4714.3-93A;E?B<=5<44,4+7-2', 6*G:K>@64--),*,,,,*,*)/+2.5.4+1(1'3'7(:):(:);*:*8+8,4+<4:5<7ONYWEE3/;,<(;*:)9)8(8*8,=3A6JAUKRGG>D:G>KDICLISPSTPSMSNWXdZh[pZrVnRlQlQpGmPvZ}[{VrTkWk\mYhZham`k]gfnfm\_]W{OFmfݺIE9HD8FB6D@4B>3@<1?;0>:/:6-95,95,95,:5/<71>93@;5E>6I@7LD7OF5RE4UE5WG8WI>XMKXNW^Zqppԕ革ꗖ⌋ׂ}yumpgf`_ZYXQQuGGcA>Q=5DH8BT=C`@EnCJOU]dfxknoi`WxIg;U2HAPEM;<71?0@,:$6"5$5$5&7(8+;-/?0@3@36*LBJE50GFZ\IKA?2F9OBPDH7/=6.=6.=60>71@93?:4C>8EA8KC8NE6QD3RE2VF6VH;ZMGVMR[Whlk~Β㚦铕⊌نу{umkde_aY[RQsNHbWFY_CQmBLEMMTU][bZhRpRuTuPlJbBW8J.?8ECKGK>>>6F:H6?+>-=-<->/?0B4D7E:E9B7>5;26-5,3+3*1*4-7.90807/6.5,/&5+7+2#1"9)>-;)<-D7JAD?64*-*-/26755301,0*/,0-0+8191:1;2<0=0?0>17+WLaZ;6;:PQFHPQ<4:/8,9,:-<.;-;,:-<.A3H9I;D6@2>0F1E6E6F7E8F8G:G3;18/4,3*4+4,6-81<4=4<3905-5,7-.$;0=.1"-7&=):&9'8):/=9@@<>37,/,.+**)+(/,448899757473717-6*5(5&5(PEmcHA42CC>BVVA<>48.6+:-/=.9+<-?0A2A2@.=.<-C6D9H?PGRLOINLON^cagitnzduVjQiUoWvVtXp^pnywksXa`m`mbos}숊́|thyjskXON:_VGqgSM=RL4D=3B;3A:2@93A:4A96@;7A@;CC;IE9MG7OG2RF0UF1UH5WK?RHFXR^jg}Ēژ礧흤蛢晞⒚ۋ҆ʃ„ymczXiQ_MYIRAI=A=;>8C9H:I8F3C0@1TIG?;76488:;9874:/<.;.:.8+7*4'2&4*3*3(3)3*5,6.8/=3=2;18/7-6,4*3)3&3%4%6&=)>*9$2:&4%1'51<<=@7=37-1-.--/.439:;=9=2603011/1*2(1%3$1$=1j_TL95@?:=RSJHC=:36.8.;0<0=/;*?-@.?-;*;(;+<,>0>2D8LBPHNFLINLaeafhro{hxZkUjZrYs]tarjt}wy_dgtm|eulw좟Ĕ|hjUHQSK>PJF>DF@D8=65B;D8C8A5>29,6)2'2(3(4*5,5.4.4.4,B7=17,6,9-9-5)1%8(2 1!9(8'4"7%C07&8*6,5.3/53:9?>LKHFBB>=<=7:26,1+1)/,./.1+4*5)7(0!.dY]S@:DC;;MMRQHE;66/8.9/;-:+<,@-A.<)8%9&<)?.7)7+>1G:K@IAIBJEa_^`djnwku]iXe]m^sbtdolr~qsryyaqXfЮ]jPDR9QT?jbUXO@WP@WN?UN>TK2G?2H>2F@4GC:GE9JG8NI6RJ5UJ4UJ4VK9XNDULMZTbkh{~Ñט磤쥨ﭩ▟֦ζgzL]ER>M;G?<=EB:4D9F:1)JEJICE>B;?<=<;B;?7D;MAK>=06)9,7+6,5-2*/*/+2/5.A59+1$3&9+;-8&2245!4"4"4%5'5)0&2)5)6*4(3&3'4)2)3.5233/2-2-4.5-3+/+,/-5.9,7(4%-3"XHYN;3NI41HHOPJJC@;6808,9+<+<*;(9&;(<)=)=+<,8,;0=1?3?3@4@5A7japic_mjqqadgmpylzhxdobidjlnqoqoy{}Zlcwbp}u]rQJY:LR8snZ˷YPAXO@XO@VM>UL=TKLAC5:,9+7*7+6-4-2.3/5384>2;-6)5&5'5'5"49$9"9%:&<+<,8,4*3.5-7+7)6&4"4!4"2$2&0+.,,-,/-2.3+.,-0.2.4*5'8'9'?.*D5>1F>VPB?BAUVRRKHC>=59.9+8(;*;(:'<)>+?-@/>.:,;0=0>1?0?1B3C5i\mdb[kfolbakltxq~o|ir]fY`bfqpzxvwx~Rd[p]njkZtON_;SZ;us\ĸ\PB[OA[OAYM?XL>WK=VJD=?==A>CB;?9<686696;6HA;15+A5K>H:=/8)6)7)7,6.507195=93*5*6*6*5*7):*>,4!44!6"8)8)3(-%@;>8=3<.9)7$7"7#7%3$/&.'.*.-//./,)0+5-5,3&4%9&>*A/1 SE;0A;C?JITUUTSQOMJCC;<28+6&7&7%7&:'<*>-=,=,:,;/<.=/=.?0C4E7\Qg]aYlgpma`fgjqR^^khqem`geiqqxwtunuJ]Rh[m񜡣a`UoHOd=W`Aww]\PB\PB[OAZN@YM?YM?XL>XL>UI;TH:SG9RF8RF8RF8RF8PF:LE;KGE=F?F:>?@EDA<61>:ZYAB@C=@:=8997<8A8E;:.2(/9(8)9)8.:/8091;7>81+2*3,5,5-7.9.=/7(:)<+<,;.;0<695C@@<@7=19*9%:&;%<(7'1%1%1(3,1,/*2*5,7+7)5'7%;(>*;(<,^PF<3/.,@@WXusrojg^YPGA75(. 8'8(8&;)<,=-=,<-;.<..B3F7MA`Wa[pltr`a]a]dHTYegrgoelkpsvvvpsenDXKbXk뒖_zYQlCSh?\gEy|_\PB\PB[OA[OAZN@YM?YM?YM?WK=VJ@@?IE>82,C??=@1;-8'7%9'<)<):(>-:*>2C:/-::245653;6C>KCQISHTHUG?0?.<,=->-?.?/>0<.<.<.=,<,=.A3D6LAbXc]nlrr`c`e`gkvozkv`h_flqx{y|ms^jAWC]Uh懍g]YtI^uIhwPfǻ伺޺޼[OA[OA[OAZN@ZN@YM?YM?YM?XL>XL>WK=VJQI>QI>SK>UL;XM9XM7YL9XM;WK?ULGYSWe^nnjut~}ȍώԏՏӐӋʃ|u|ovioljlcyYvPoBd7V4L8H@EFBJCJEGGCJ=N>LCICCA>ID;44,I@LFBA?=;;<;@=E?G2A5A5A6G8A1;(9&<)=*<*8&:+7)0'C<2/?A/2*,1/5.81908.5*2&1#E5A2=.:*9)9+:,:,;/=0>/<.<+<,>/A2SGg^c_jinochjqoxq{t~mubkdnrzx~quipWfAY@[Qf~ykm]oZy`r֭ӦЧӫԮֱں[N>[N>[N>[N>ZM=ZM=ZM=ZM=YLUL=XLNAEFDA=HB:/7,OFB<=8641051>8E;F9D59(:(:*:'8%9&:':&9&:):,9+7+5+3+3-*+*--3/4173738588;8<9>9A9D7F6H5E+5-2124/6-8*;+=,5&8*;/=2>4=4>5A6J0/..46663-7.90:1;1;0:0;/L?F:@19*6)6(7*8*;-=/>0=/<+<+<.=0KAdZc^kiosinrzvfpoyryjslvwv}hocnRbB[ZM=ZM=ZM=ZM=ZM=YLVJ>XL>YN583/,*&/*:3C9C6>/;*;)<):';(<);'8%5$7%8)7*5*3*3)2*33588<4:-2(-(-+1-3)0&1)6,?*A 9/"0(.,10/1,3+5)6*6+90=6>7:4715092H=KYM=WMCWLHXNOZPX]Ub`Yia\rjfokspvq{u~ɊLj~yrrtl\HLB9A:C@@?:;<>DE><=<>=@ABICMANAL>>@9?6>3,7%:'<);(9%9&:':(:'9(6(2$."/%7.=582400-**&(%'%'%'&*!)".'7(>!;61'8#,#++---+(-)416264666512./,,/,92:191SK"+#F>.&.(<7E@:7/*.*51<7>4<.5)3&5*;.;08.bXZOC:6,:/8-3'6*0%2&2&4%6':*<.=1:0C;\Wppsvx|yq||wt}s{r~r}mxgs`nI\>\>[AVekzm}f~cjw|vzqyo|rvuwy§̹Կ̺ZM=ZM=ZM=ZM=ZM=ZM=ZM=ZM=XK;XK;XK;YL]P@[OC[NFYNJZPQ\SX_U^_Wfd\tibngqjxpyĊď~tnqujW{=A5+5+<3@8>8?:A==;;<;@>B@IAI@KAF<9=4<1;/:,:+A5JAG@A=6351@9C89+5#8';(=*=*;(;(:(9(9(6&2%2%5*8.80911&/%.%,&+'+),+-.*-%+$.'7$;7300.93<*1(,.002+.:>7=4:26/40325872-;582E?E?/+2."51?:E@=83-2,60:1:.9*5'5(9+<0<29/cYXN@84+91:06,9/5+4*4*5)6)5(6(6);0B9YTljqtx||v|yv~usp}kwdq_nI]>\>\CYehwozbu\x]ckppmp]l]h\g^k_qeyizktv|}ƷǿϼƷ\L<\L<\L<\L<\L<\L<\L<\L:A=E@GAH@E@B;6909+9*8(9*?3F9674;7C=OEH<3#9(:';)=+=,<+:)9)7)2#/#4*=3?6914+4&5&2%/$,$+%+(+(+-(+&/(6%:733%70;5A8C;D,626;3=6=8<7=6<2;19.6*6);/@6TMgeorz~||yxwsn}gv`p[mG^\FZ`a~evZiQhOmRtX{]}^x\qX`zM_PaUeYn`ug}j~mrtxyyz~ǹ˸ȶ[K;[K;[K;[K;[K;[K;[K;[K;ZJ:ZJ:ZJ:[K;[K;\L<\L<\L<]K=]K=]L<^M=^M;^O<^O<^O<^Q@^Q@]OB[OC\NE[NF\OI]OO^P_bTmdY{i^pg|t{{zxucMlFRA@A=E;H;G;E9A:@A0D:<731;9A?D?SLUJ:+9)7$7%;)=,=,9*8)4&2&2)9/>7>65./&6)6)4*1'.)-)*(**),','1)9&;GD=:<9:5807-6*4&3#5#6$8&;,9=9?9@8?5<2:.9-9,=1NHc_no|~yyyxtn}et^nVhE\8V^N>\O?^NA]OB^PE^OJbNYbQdcTqdZ}lexrwv}‰΂wlXwD_BTDPJPIHE>EBB@C@GBHDGCDA=?7@7=/:+:*9)8*;.?6FA=;BBAA;6JBXLK>@28(3#8(<-:*7)8+0%3)8/;4:5600+,'0,1-10312537486;-5,6.=0C-F)G+N3R9L3?@M_llzWfCS>P3D3A3>6<99834*/$2*.(72YT\ZXVA?HFB@<7706-8-9+7'5#8#9$:(=-;,6)7.=5NGEA501->9@:815120215283:2:/9.:.6*8+IB_Ynl}v}w~yxsk}dv^pSeF]8V=ZL]TRz_BWhC?EBEFBDAECFDEEAB:?4?3;-8(9(9)8*:-;3IE??=>782/A:ZPh[PCA35%6'9+9+7+8,0&6-;4;440/,-+--493;3=3=1>0=1=1>0A1B4K5N0N-O1X>_3HO\an_nWfP`DX8JAQ:G2:/22-8-;+:*:/2(JBkcLGPK;9;9LJ@<707--9)3':/D;GAC=722.;7:62.2-,-,,./3171:1<1>26)4)B:XRjh|}v}xzxqi{bt]oQcI`:X?[O_QNqX:Sf8]uEa|InSvY{]~`gll}m|o}ponllqqrroprtvtwï̫̾ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8ZK8[L9[L9\M:\M:]L:^K<`J<^K<_L=^M;_N<^O<^O<^O:_P;`O;aP>aP>aP>aP@8>3>19+7':)<*<,=1?7=:9903/24294MElah[QCD>63;7UQF@918-:,9(9(=)?'<&;&=*7(3(=4LFGAE@963073510+1-,/+-./1/4/81;1>29.3(;2NHa^yzz|{xn~ew^pZlL`Ia9W=YM]JGhQ1Qd6\tDf~Nu[chjnsttr}pnmllnnoolknrttwƯν̻ʤ[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8ZK8[J8[L9\K9\M:]L:]L:^K<^K<^K<^M=^M=^O<^O<\O<`Q>aR=aR?bQ?bQ?aP>aO;bL>hOKgNRbP\cWkjfuv}|xzƄ}uzlmY[DL/I5R4=0?1;+8(<,?.@1A7C=7485..30:60'5)UGwj[PC7<0;07*6+:0708263320112364<%6#9"9"9!865629%B(G&J'M3\Ehbu`lWcQ]P]MZ@M2==F7;/./(5';(?&>%9'8+VJ;2?8412/C@WSHA916*6(5%5$:(<(:&7%9*4&1%?5RJIAHB;62.411/-+22,/+.+-++-*1*4,8,=12(7.IB\Xww}vj|_sXlTiD\D^6U:VLZHC^K-Mc5Uo?b}Jt\glnrvzwr~m|i}ggikmmlh~ijosrxũʵ¶Ş]K7\K7]K7\K7]K7\K7]K7\K7^L8]L8^L8]L8^L8]L8^L8]L:]J<]K=^L>\L<\L<[N=]P?^SA`SB_R?`P@bQAcRBdQBdNAdLBjMIhKMdPYf[lnkw{Ђy~sqjba^JW>Q:L?NCQ@KF9=4;0:,6&A0<,6(A5F==57285715.6-8*<*:'6%;0SLZOE98*>.B3:-3+GB//5:6=,7BM'3&2)2(2'"*'/'/&)+7 .&7-A#;Xr-D]l_iZcU\PWHM?@84>7A7?17&2!6#;'<)8-7/E?;7316454DCLHKED;:04)5(4)5*1=3_Ysqxh}_w[uUoLfEc:Y;[?Y]i@;VF-L^6YuBgMw]}cgjnonm~l}i|h}feflmlk~gfgimrv|z]K7]K7]K7]K7]K7]K7]K7]K7^L8^L8^L8^L8^L8^L8^L8^K:\K;^L>_M?^N>[N=[N=\Q?^RB_SC]QA]OB_OB`NDbPFcOHeNHiMJgNQeS_g_tnny~ʣxy|{vji`]aOZFRHSIVEP?J;E9?:<::=8?7>4/8(8);.;4JF016;6A.<@N'4$,%(),+,*+((((+,$'%(%,;D'4CAR&6jubjZaW]OSBC<8>68,D5H6>,/)((-%:6TPHG5445==WUGBG?A99/3)6,7/70=3915.2-4.83?9E=J@A86-0*0,210303021201/00.1-4-9-=13$aP@`P@]P?\O>[O?[RC[QE[QG\OG\OI_PMcQOfTTgUUgUUgV\h]nlisv|ˊԘנʪ}π䄆vsjegS\GQFOHREQAK=E7=7:99<7@7A4?0>->-<+:,B6H?;20):26/6.7,8,7(8&9&:*4-4.A9OCH:5%2#@2>5HD135;7@4@ES2?)0#&$'13-/''&%12)*8:+1)13=R^=K[g^fV\OTMREI:;74?96,?2B5=17-3),#' %/*EC::,,35AB^]?:C;A9=39/=4@8@;@<=;>;A?>>::?=IDB9<45,2+1-311202020201/00.1-4-9->24%8+;0[Tzw~rdy[tTqNmFg=_=\EbTgAHp;3SH2Qa<]xEfNrZu^t_xc{g{gyfyfycxbybya|bzczf{h{h{e{a{`}``jnstwuynolSeYAPM2A>^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^M9^L8`N:aP<`Q>]P?ZN>YOCXPEXOH[QO_UTbXYeX_iYcl\fk^glaildqokrty~ʅڌᎇןӭijy{ށzwsrcgU\MTGPCM>G-=0F:RGH?5.1)9181;0=1;-6'6&8+5-2+=4NBK=:,8*B67.>:/0164<8BNZLU>E38$&/1,,22**/.::37,29@EMXcMW=CADBF>A9=8988978391:2A:NHVSNNC@7295KIMLQRYZRQYV51>6B9@7?5B9C<@;?@8=9=?C:?58>=MJ93603+3,4.30210102/201/0/.0-4-8-?36'5(9.VO|yzocwXqOlFh@c9\?^KdZh35g;0WO8WgCa{KjPsYt\u^wbyezfwdvawav`x`x`{azczfzgzfzbz`z]|]~_gntsuqtiidQcUDSL8G@^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M;^M9]K5_M5`P9_P;\O>ZN@XOFXQKYPQ`W\g`hnfsshysg{sg}qh}ol}pqrwv}z҄响㝌ڠulnqvlvismllgi^`RWFM3=16*4'6*3,70=5E9F9B3A2>20&720/.1.47?PX]dZ_OS.103,-EE66,,-.>@2537bh=B*2-4&*;=@E6:379=7;/043;;GFRS`cilek^a@>E@^[hgopjjKK=;40>7D5<4:1415;-7,6.8,4,39b:_6\AaNeWap/+_?0[W>^lIe}MkSt\u_v_xcycxbu`u`u_v_w_x`{azbzd{e|d|`y^yZ{\}^agmpsr{nrjexe[k^RbU_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N<_N:^L4_N4`N8^O:[N>YOEZSMZTT_Zahbprmzu{u{qzpvpqtrxt}wz~τڋޖܙ͛~yl[Q>MBQIWRWUSRKM>C4:9<9;;9=8@8B6A0?/9,A65+.$I?g\dZUI<26)3):0;06,3)6-1*71;29/>0F5B39+1(4-31-.*.17EJV[]b\a9<9<+,JK89//57()'+XZ>B9=6:#(+<>AE49,21705(.37KNaehncl`i`lbkLLNJ\ZVTMMHF423/ACJJ1.3,3,5,4-4/4/3/02/2.1-0../-2-7-=1;-1$7,C=yv|qhx_rRlDc9^6]6\FcN`IMe5+VD0[Y@^lIe|NkRt[w_x`{dzcv`s]r\s\t]v^w_{azbybzb|b{_x[xYzY{Z~_ekmsus|rupnlfwe_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:aP6aP6aO9^O<[OA[RK\VV_Zakgvso}z~|}w{uxvsys}x{~ĄɍΔ͚ǠɭŦmfJE2A4@4B9HDNNJK?C=?;=<;=:@8@5>1=0:0?64,1'I?cVh[eWOB>24)7,905,2+600,4/7/7.>1C4>04%4*0+3/..-.1478BEMRY^FKQW37FJ80=*7.:;ECHAB1/4-4-5,4-3,4/4002/2.1-0../-2-7-:/>01%7,;5sqvi}at[pPjCb7`7a;_LfO[~86]=0NF1VX@ZeEcxMjRr[v^ya{dxas]pYpWqXqXt\u]y_x`x_y^z^y\xYxWyV{X_dhloqmxjqij~cbv]_P=_P=_P=_P=_P=_P=_P=_P=^O<^O<^O<^O<^O<^O<^O<_N:cQ9cQ9aP<]P@ZPG\TR_Zaa_mtryx~~yyyuwww|x}ĂąȸоѻЬoT\GG5>0G?WQWVNO@C=?<==;=:=5:19080<5:3=5OEXM]OeXcUL>:-8.914-2,60402-5.<3C7C4:-3%5,.&0-/,3154-.24BFX]W\ouDJHM@02:=HK9>7?=F7B-8>J]gmwjrcn]g^kao]nYe\]PIJG74/0540.95D?JDIA@86/4/7166'/0<2=+60:>E?A443.5.6-4,3*3,4/4101/2.1-0../-2-7-9.?20%6,61popcx\pXnOiBb9a`P@`P@_O?_O?_O?aQAbRB_O?]M=]M=aQAcSCbRB`Q>dS?aP>]P@^QI[QPZSZeapsqyxz|~}xzrslotwv{̀ʋƖäƳ̰ϬϧϣУ˜˜Ѩg^FzgueH?QNccKL?A89:::97561;6815.B;<3I?XKOAdVcTXIG9:/6-7/6/4/0-2,70=4<07)5(7,/$/&/)1-2040516479JNY]NS8=6+90>=HS_`igrepbmcn`o]gSSF@854111/.3194D=B:?7<4908193667<4;4;4<6;59331/3,5.7.5+3+2,2,201203/2.1//0.3.7.?58,6,/&;7XW{me|\rPhGeCe;d9`NlRd=?P, C;&CG.KM5Y_CZjEcxMqZxbx`t\rYqYlSmRnSoTrXtZu]u[tXtWvXwWvWvUuTtS{[{]z^u[mUb~MXrCSj>AW0?U/`P@`P@`P@_O?`P@aQAbRB`P@_O?`P@bRBcSCbRB`P@fVG_QF\OG^TSaZad`omkvwwy{}}x|qukplonquv|~ՉӘΨǸźαתۥޥݢۤأѠǛӼ}dŋw}mVJa[rpZ[KL?@=>>@;;6664=883?86.>3K@H;]Mo``QH:5)0&6-5-0)5195=7<38.5)4*5*7.5+2+0+0,2,4.5287>@JLW[^b\d]eaiS[NVQY_gjqflZ`NT4:,5*6-9'5!-'67CPZZdbldmencm[hQZEE<7646355302/62>9>7;4:3818295:69;7:7:797965312,3,6-7,6,2+1,1,201203/2.1//0.3.7.<3=28.1*74Z[s}fz^vWoOiFf?b^QA^QA^QA^QA_RB`SCaTD`SC_RB`SCaTDaTD`SC^PCbUM\QM[QRcYbkdtqmvuy{y{y~x|nsei`gjnru}}ׇݗ۩ػؿۧϡÜkpo`RG]Umiuu__JL@DAD>@8:66=:;6A:707,>3=/F8j\i[[MB62(4+6-2,52A>GC=62)1'2'0%4*1).)/)2,7/=4B9-(43DCVX^bZaS[Q[FQHSOY\fmvntY_>D.5-42<2>+9'46EKWISPWW_^fck`iRYBI977175<8;;955160:3;290907183:6<8999997988874402+6-7-8,6,2)0)0,10121302/1//0.3.6.90D9804./._blwbxWsPmLlCf:];_IfSgDJl;4O>,=<':?(ED/FH0Q\U'B\/E_2Ic6WJ:ZM=\O?^QA]P@^QA_RBaTD`SC`SC`SCaTDaTD`SC_RB\PDZOMZQVbXcjcsqmvuxzz|w|symrbi]daglrx{ʉߕ夡䶵۪ө¡vqrcbWi`rmut[]LNCG@D@?=;957282918080717396:7:7;9:7:8:6845.3+6,7-8,6,2)0)/+0/222312010/0.3.6.8/F<913.,,fjygtbyTqKkGj>c6Y=^QhXeBBgC7[N;GF1AC-JH3EE-LU6Sc>btLlUpXnRkPiKgIhJhKjMkPmToWpVtXsUqSoPjMgJeHdG`D]AWy=Rq8Mi6Lf6Ne7Of8Lf7Oi9Sm>UH8WJ:[N>\O?]P@]P@_RBaTD_RB`SCaTDaTD`SC_RB_RB^QIVMR_Xhnf{tpxtxwxzy{syjr`g[c_gjrv|ƀΓ䭮绽߹׶еƱy|qvksimeoi扄~sredWYMNDE@@:7;7B=E?<3=3B51#0"I;XKN@=/8*6*3*42UUkh]XD>;3;2804-2,1+0)0'/$/$0#9,4'3):5CAEGBG@HDOOZVaVa^igoYaBG:<5738283=9CHSV_6?4;6;ADJOIM;A135195<8<9;9:77370;2;1:09082736475:8;8:8:9;7956/3,7-8.9-7*3)1)0)1-323322011/0.3.6.7/C:701-13jpqzft]tPmCf=d9c8^EdZmV[wE>dJ=aYFTO;KI4PI6GE.GP3L\8ZlFf|NmSmRlMhJfHgHgIiLjOlSnVoUtVsUnRjLfKcHaF_FZBX|?St;Pn8Ok:Rl=Wn@ZqCUo?Vq>WqARE5UH8XK;ZM=[N>\O?^QA`SC`SCaTDaTDaTD`SC`SCbUEaVP^Vcje|yu}yzyxyvyswjrcj[c]ehpv~ǁшәݣ௳㻿þŹx{tyvquleleoga[`[smyu{|yrpccSTHGC?>:<6A;:1C:TJ>26)9,=.?/B1C5@17-2/LM_]WSD?:48170939292:19/9,8+8)(3"@2I>D@;:7;:@7AHRV_Yb^g`iU[AE@>?;ACGJLTQYT]V^4:/5/37:=A;?4812429586422020404.<4=4<3;2837343438898889997755/3,7-8,:+7*2(0(0(1,424332111/1.3.6.91<3710-@CnukubqRiHf;a4^6b>dNi\iGFjF:]L<]VCXQ>RJ7OG4ID.DJ.GU2Sc>^sHgMjOjKgGgFfGfHgJiNkRmUmUqUoQjNgKcH`E_F^G\E[~DWxAVr?Uo@YpB]rG^uG[sCYtAXs@NB2QE5UI9WK;XL\P@^RBaUEbVFbVFaUE_SCaUEfZJh]Yngwup|x{ywxvwpujoah^f_gempx}͉؏ؙ֪֡۴ߺɼĻqqqtpopfewhenj_Yd_ZTf`snzv{wwshfZWRNHB=6D=;4G=\R;0<07+6(>.D3B3A1A386>>CCB@=7817/7/:393:3;3>5A5E8G6-;%J8L==50+009>AJKTU`Ze]eYaLR>@4/7/;9@@CHDJBI?F5;26368<7914/2142095740.,*0,3.3,=5=4=4<3:59565655757576866542.1+7.9-:+7*4&1&1(1,425342211/1.3.6.;34+:520UXpxcnZiI`Ef8b/]5bBhLePYj5/^G7XK:UN;[P>VI8M@0JC0@F,AO.K[6Xj@bxGfJhIfFeDcBcEeHgLhOiRkSnRlPhNdJaH_F_H_H_H_H]~G]yF]wH`wKcxOczN]uC[vAZu@JC3MF6QH9TK.E6>-2"7'E7E?973.50;5=5<4=4;4925.4+5)8+<,?-S>G2<):-=2;57443KNMRPUTYY]VXMOD@5+7+7/52242618.64>3;5?9B4>+5(3/9-35759./*+0.515/<4=4=4=4;6:676664635253455411-0(8,:+:+8(4&3$3&4*5052423/2/2,4,6.=4/&>935bgoy[iNcC]Eh:e0]6aGhJ]CFR,#VI8SL:OH6[O?UI9F?-HF1>B'@J(IU1Sd:_rEe}IgJeHcCaBbCcEeHfMhPiQlPkMfJcIaG`F`H`I^G^F_}G`|Ia{Kd{Mf|Nf~N]xC]z@^{CDB6FD8JF;PG>RH>WI>]M>_O?`Q>aR?`SB_VGbYRgb_ojnso~wqzt|yywppgg`a\_`bfhopyz̄֍ߖ眙栞ݡף٤ڦإץԤӥѣ͢ɢȟÙ|rn}igld^`fZZkYUrWP}WNWORIZPXPZSkdyr|uqus_]PLEAZT712*6*7(7'7&9(;+<.?18.<2?4;05(3':/@590907.7+7):*?,A/=.@4E:G+?*?)?(?&?$<$<$8'9+<,9+5.545;984:3;4;5:595735435465454535/5,5)8,9*9(9&8&7%6%4&5-4/504.5,5+5*7,907/:6?BmwbsSjIcKj6[6_cNjIV^$"D, ?:'HE4PMC/?G/BH&EK%KS.S]8[kDavKd~NdJbF`Ba@cBeFhJlPmQlLiHgGfHfJeIcHaGdJdIbGc~GdJdHe~Ga}C[{<\=_B=?4?A6FC[K>]M=`O;`Q<^SA^VIc[Xhcinlysotpvptppmgfaa]^\\edkjtr}{φٍ易囖ٜ՝֞מ֝՜ԛўќ͜ʛǚēxtk|mdif]^f[YiZSoWM{UJVKVK\RYRXRfaqjvo~wusgdUSZU2,/%7)7&7%8&8';*;-=/9,9,:,:,9+9+8+8,;1908.8,9*9(:&9&6*80=5@8A9?7<4914->6H@OGQINFC;7*7%8$7)4,//+3)7(:+@*A)A&A#@!<=:: 9%;);-9197:;;94:5;4;5:595735235465464716/5,5)9*9*9(9&9&8%8%6%5+3+4,5*5*6(7)7*;14,54TYes[pGbIhAd;`3[;aMmLb8?S*$A5'69(;<,B@1DA0@?-=B.>G,=CKP'\b_?bB69.:<1??7DA:KB;OE/>/6(/":.8-7,8,:+:)9&7$5)6,8.:0=3@6A7B8:1@6E;FG=@67+6%6&7,4/03-5+9*<';'=%=#;!:77686$8*;2<6=8;::94:5;4;59585735236475565616/5,4(8)9)9'8%8%7$7$6%5'4)5*6(6(7(6)7+<21+88kr]nPi<[Hl7]>e5[>bVq?Qa#(L/);7+07'37&9<)@=*A<(@>)BB&?FXa4s~Tdw`hSa}LaG`C`?a@c@hEjJkMlNnMkHhHgGhKhKfLdJeKdJcFdGfHfGeFbBcDeEhH25*58-;<4A>7G@:KB;RE.>.8(/!6)5)4(6)9+<+=*;):-:/909/:1;1<3=3D9?8:8794:5;4;59585735447476665726/5,5*8*8(8(8&7&7$6$6$5%6(7'9(9(:(9):+:13.HKoyVjD_<_Ag3\8b>cMlOe0=J C1-11'.6'4=,=B.B@+B<$E>$HE$U\0p~Mr|mjW_{J]~E_Ca@bAfCkJlLmOmOoNlIiIhHiLiLhNgMfLdJdGeHgHhIfGdDgHiIlL-3'36+891<;6B=9G@:MD=QG=SI=SK>UNDZUQa^eigumklkjhb`XVPPQQXY`cfjorux|Ђֆه؊ً֋ϋ͉̊ЉшъщЌϋȍ~wmYjSZnVTc\RZaOZ_HeZDxUBLDTRSWRY^dejkluqunoh~v{~l`?28(;(='='<';':'8(7):/8.8,9+:+:*9)7(9+7+8,7+7*8*<,>-<0=0<2;/:08,7-5*@7@5=49.80;1:25,/%0)2025/8-9+;,<-?.?/@/@/A/?-?.@)9)8+70:6=8=774394:5;6:79585654448485676726/6,5*8*9(9(9&9&8&7&8&8%:&;'=(=(=*=,<.7/;8^eaqPi<[Ai4_4`1YKlYq>NZ%-C),:2/-0)08+7@/:B+<<"A<UH(`[5{Slwo[aK^F`DcBeDjGoNpPoSoSoNlIiIgGiLiLiOhNfJeIdHeIgIhHgGeDiIiKlN+1%.4*470893>:7B=:HA;KD18*4&8)<,:,:,;/;-:/9+5+5(6,;/>4?3?6>37.,#+%-*02391;0<0?0?0@1@1@0=/<-9,9*7/8IE4>1>0@/?.$?%@(@*=-;196U\^qGc?a:a7g3b8`FdNa@IS12A64@:<:46?56<7179+4="9CSZ.PqŊˎ̒Í}{egQ_E^@c@iDoJsPsSqUoSnNkJgGeEgJhKiNiNfKdIdIeHgJhIiHfEjLlNoQ&.!(0%-2+13.331764:95<;6GD=DD*;'7$4#B2OAN@B47)7)>/;+:*8(7'6'6(8*8+;.;/9-6*7,<1<271888=:A9B4A/<,;,:/;19384857563657376;9<69453376;9869796:7877767465:5:7:8995827/7+8+:*9+;*:*:(:*;(9":"=$>%?(?+<.81<89?48E26C41=:)>E&FU*bs?aˌɋËz{efPZ|@^?a>hCoJrOrRpTnRnNjIfFdDfIhKiNiNfKeJdGeFgHhGhGeDkLmOpR(0!'/"(-&).(.0-3317839:4==5?@8DE@JLKORYVXeZ\s]^}YX[Y^]eennwx؄⌌솇䂂܀ւӃ΀ȁǃ˄ΆЈӋҌϊŊ}xwozkegf]Xm[Qm[Mi\Lf^Kd_IeaHhaGo_FoP;UA]OaYYXQTS[\`heYPD<707/:1=/;+9(:&9(:)8)8*5,5,/%3)8,>/@/@-=*9'9)0"WJK?/#=12<07,8->4C5;687899:97877;=<<::8785747575979899::9;9<9<8<7;6:8:9:;9;5907,8+9)9+:):):(;*<)9#=':#49%D3?61,^eVgIb<\1X0Y6cBiYoFQo33N3,B?6>C<@78@-1L/3K2.A9&DJ(Zn=~_włʌ~nfRXvBY{?]>cAiDnImLlNkOlNiIfDcBcBfIhKfLdJgMhNgKfHeEfEjIkJqQrStU*0")/#).').(-/,130561782;<4>?7AD=HJGOPTSUaXYkZ\u\Z^]dbkjut~·ߋ鍍년 ؀~Ҁς̅Ɇȇˉ΋ό΍̎Ȋ|x{stknlb`e]Re`Me^Kf^Kh]Ki\Ij^Hk_Gn^Ew_G[CYFZLVPRSQXX_USLE>9606/909,9(8&8&8(8)7)6*4,5,0'5)9+=-A/@-<*9(8)<.REH<4(:-:,4&=,<+;*;*:)9)8)6(7*8,7,3)1'1(7.<5DG8>/9/:0=.;1<6?5:3622:8EBIFDC?>:7989796858598988788999:9;9<9<7;6:596888;8:59/7+8*:*:*;*;*<)<+<)9$?):%5:';/:2<=^gPdA[8W6[;`>dIe?L?>_:2G;/:>08>2F<:R>=N0.S8/VK5ciEx[p}Ɓ}xr^YuETp=\{B_@b@iCmHlKkLiMiMgGeCcBcDgJiLhNgMiOiMiKgGgFfElImLpQoRtU-1"-1#,/&,.)//-11/34/45-9;0<>1@B7EHAKMLQRWUUaVWi\Yt^]fdpnzx΍ߐꐎ튉燄߁|}ȀÆLjƊʌɌɌŌ|v{pujpndbi_Vc]M_aL_aKc^Jg\Jl[In\Ho]Gq]EwaIxX?S=VDXOUSOTMS><<784716/6.7+7(7&8$8&8'6)5*3,5,3(6(9)<+?-?-<+8(5'J=F:A584627272728596;8;877888:8;8<8<8<8;58475777:7:48/7,8+:+;+<+<+<)<+<)9&@*9$6$;+0'40PT[iJ`:U7V@]HfHdNa89e?6R@2DA09=,57)>6+K9/E-#R=,g]B_t{z{xm\uKHb5Nh8[xB_}?c@hDlGjIhJgLfKdDdCcDeFhKkNkOjNiOiOiMhJgHhHlKoMsVsWvY24&04&01)01+12-23.34.46+9;-;>-?A3DF9IJDMONRQWSS]XVd\Zoda~nlzwÌ֑㔑ꓐ뎋≅ق||~Ë}{vyn~rgmmaak^Vi[Pc\J]`K]aJc^Jh[JmZKqZJtZIv[FsWAxR;Q=YF[PTPFI>A2/5/51605.5+6)8)7$8$8&9'6)6*3,6-6)8'7&:(>+?-;+8)4'UI<18,B45%=+=+8(8'9(:)9)7)6(3'6*3)2)4,:3>7?9=:45596;5;2:397=<@UVbbmjidVQA<634/61717182859697:878898;9<8<8<8<7<5:686797<7<49/9,9*;*;)<)<+=);*<(:'@,8&8';-+"54`gTdG\-=@-@C.DG4IK>MNFQPNRRRVUSYX]a_lkius}njӕᔑ␍܋ӄā}||~zxsznzrfjm_^j[Ti[PjZKfZJb_Lb_Le^Li\Kn[Lr[Kw\K{ZG~UAR=RAVFRHG@88331-3/5/5.3,3)5(9(8$9$:&:'8)7*5,7-;+:)6%8';+=.;.7,90\T=55+A53$:(?+:):*:+:,;-:-8-7-3*1)1+71<7>:;77475;<8>7=7;7;797:::=:=7;2;/8*:*;*<)<*<(;););(=*8'9*8-/)@ChrM^H[DYH[O^T]TWXUdM?OL9LG4JE1FD-?B'=D#>H#KV.\g.==1==3==5;<4;=2;=/?B/@D-CG.FJ3KL:NOAQQIRRHYWJZZN_^\gerqn{yďяӍϊǃ~yzwyv{v|y|}}x|tzrvksrffm_\j\Sk[NlZLl[Kk[Ki]Mg^Mi]Mj]Mn]Ms^Mz]MZI`OVGN@J=@76.1+1+516/5.4-2)4'6&;(9$;$;&;':)9*7,9->,;(5#5#9)<.;/7-?7[TIA:0@36&3 <)9'7'7'7(7)7*7,7-<3:293<7>:=9854196<9::8:>@PPbcppheTP=61+40;7=:;7;5:294837373556669697;8<8>7=7=6:8<898:;:>:>7<28TXepK\I]J\M[QZVVZR`RPI7HM9NI5H@+;567>O%Lf6lTw\edfkt|mn}\Q`Cg{HiFlGmGjGfGbGcGhJlMoPnPlMiKjJjLsTsUsSrQrOsRwUzZvZu[sYRK;RK;RJ=RJ=RJ=RJ=RJ=RK;UNXQ?YR@[TD\UE\UEb[HaZHaYLbYRe][kaiqftuj{zn|pss|puj{mbre]jc`k`_g_\c_Z^^ZY^YUaZRbZOe[Og[Ki\Kk\Ik\Gm]Fm]Fj^HicMqfTqZJuOBWJ\PYLZLN=E4<,7(8-80411-6/7.7.7.7.7+6)7)8)8)9)9)9+9+8+;,;+>-9(1 2!9*H9=,2#PFJ@F<:7487::::776493=7F>B9:/4(1&5);/?3:0<3?7?:=;;9899:7:8:8:999797959540516576899:9:9;;>9;99=:A=B;A6?1:)<+=*<(:&:%8&8&A0<-/#/&LJmoloVZLNNOQMUOXO]RaTjSWZ/:M7FTa)~Poyxs~ahL\mCYdBT]BHP9?D0:=,@C2<@1:>0]sBgHpKoKlGjIiKgJlPmSoSlPmMkJmJmIqLqMrNrPtRvUyYz^ycmZbOWN?WN?WN?WN?WN?WN?WN?WN?XO@YPAYPA[RC\SD]TE^UF_VGd[JcZIcYMcYOf[Uj_]nbdpdhreltgpvirvirsfmm`gg[_bXY^[VZZRYVOWTKXTIXTH\VH^WGcZKcZIf[Ig\Hi]Gj^Fk_Gh`IcbMngTv\MSFVMVORJQEH9C0=,9)8,8062406.8.8.8.7-8-7,7+7+7+7+7+8+8+8+:,<.>.9(1 2 :)>.<.:-4*4);0E:OBQCOCF?@;<5;4=7=88633777879787797=9B:A7?4:,6'5&8)=-@1A4@6@7=8:777567:6:6<7:89879595:592:3:5;6;8;89999:;;;<=?=A;?6=2;-;+=*=+<);(:&8%:%9'8)5*<5QPee^aMMNLTMYP\Q^S^S_VfQ`_/Sg*^r3zOn|pbjHauBTe;JX7FP7?H59?158-:^tEgHqMpLnHkHkLhKmQnTmSmQkLkHlHmHpJpJpLsQuTxXxXx^mXbQYH]TE]TE]TE]TE]TE]TE]TE]TE[RC\SD]TE^UF_VG`WHaXIaXGe]Je]Hd[Jd[Le[Qf[Uh]Yh][i]]j^^k__k__i^\f[YbWS_VQZVMWTKUQHRNCQMBSOCWQCXRB^WG^WEaYFc[Fg\Hi^Hk`JhbLbaMngUy_PXN[UVQIEE@@7>1;/8+8+9,;/:/8.7-7-9.8-7,7,7+7+7+7+8+8+8+9+;,>0>.:(2 3:&>,>.?08+2(4*<0F9M?ND:643204297=<<<;<9<5:27265899<:@:8-:+6'4%5%8(<+=.D5C6B8=79464557969696977779595:3:3;4;6<6;8:999889:<<@>B=?9:17+7(;,<+<+;):(9&7%9&z6#y6%9,F=SOWTPOIFMHSLYP^SaWaW_VePsrFzVn{|[[oaXIaXIaXIaXIaXIaXIaXIaXI_VG`WH`WHaXIbYJcZKd[Ld[Je]Hf^Gf^Ig_Lg^Of\Pf\Rf\Sh]Wh]Wh]Wh^Ug]Te[QdZPc[N]YMZVJVRFRNBPL@PM>TN@UO?WQAYTA[VC]XDaZGd]Jf_LfaMdcQleUv\O[Qb\ZXFD<:<8;6:08-8):*?.?/9-7,8-9-8-8,8,7+7+8+8+8+8+8+9+;,?1>.9'3 38"=)@.?-:+7*5*7+:.7<380625587765615(7'6&7&7&9(:):*A1B4A7?8;5957687687878868694:4;492:2:4;7:8:89799<:@3B%:F.=F3;A3:=2:=4<=599-?@2<>39<1<@29B/?L2PbNK:NK:NK:PMTQ@VS@XWC[ZF]\H^]Kb`Qf^QmWJ[Ricc`MMBC;=8984709+=)C+B+;+7)8*:+9+9*9*8)8)8)8)9)9)9)9);,?1>0:(6"47 =&B-;*;,:,9-8.:0<0:49<4<3928384838256<494:7:9<76210(6(:(:(:(:(:(9&7&:+;/>3?7=8;896876666667484:3:3<3:2;2<5=7=:><=;>=@?1;=28;0;?18A.>K1Pb8770;.?+C*A(;*7(8)9*9*9*9*8)8)9)9)9)9)9)9);,?1=/<)9$65;"A*B.@/;,7*2(4+;0=85:3<6=8>:>;>:=9<587:9>=>=>962/0'9+>*>*>*=)<(:'8%6%7);0=3<5<7;8;787757585:4;4<4=4>5?7A:A;A>A?@=B??:@8=38-5(5'8(<*<(<)<(:&9'7%6$6%}:)t3!~9*OAYNRGOEVJYN[MZM[M\Q_T`WgW~xXy^r|ZU`B;E,/;%0;*0<.3=24<16<2?1:<17:/:>07@-=J0Oa;bxIkLuQuQtNqNrSpRrQsPrOpKnJpLsOvRyX{Zz]x]qWgO]EXB`NYISzCg^Og^Og^Og^Og^Og^Og^Og^Og^Og^Og^Oh_Ph_Ph_Ph_Pi`OjaPjbOjbOjbOi`Oi`OiaNiaNiaNh`Kh`Kh`Ih`IhaGhaGhaGf_Le^Kb[I\WDWR?PM:LI8IH6IH6GH6GJ9GK:HL;IM;A@CAEBC@A??1266:<=;;9714.4)<->+>+@,>+>(;':'7%7'8+8.7094=9>;:79595:4;4;4=4>4B7C9C9<3:/8+6(7'8):):(=)<*<):'9(7&6%}6$x3#x5%B2UEWKPCPDZLYMZN\Q\Q[T\U[VbUkbEV`=JS4=G,6?*2=,4>35?66=68?8=B;CF=EG/;9*78*=>0:<17:/:>06?,=J0N`:awHkLuQuQtNrOrSpPqOrNqMpLoKrNuTyX`~az]qUfL_G]E^IbPYISzCh_Ph_Ph_Ph_Ph_Ph_Ph_Ph_Pg^Oh_Ph_Ph_Ph_Ph_Pi`Qi`QmdUlcTjaRi`Qh_Pg^Og^Mh`MiaNiaLiaLiaLh`Ih`IhaGh`IgaKf_Le^Kb[H\WDUR?PMSQDSPAXLYSRODE::75;3>/=)8":)8'9(;*;*;*;*;*:):):):):):):);,;0:.<,>+9#37?'9#;)>0<18.7/<5?==B?DCEDC@?;7501./,51:6<6:28.8,:+=->+?,@-@-A+>*=*;*:(7(5)5+90?9C>=7;5;5<4<5=4>5@5D9D:C;A9?:;685937-8(5'6':)<*:)8&=*<+<*<)~:'|8%{6&{6&y1#8*G8SCPBL=RE_SWLYN[R]T]V\VYT^QaX;EM(6@8A&>G26BE*;:&78(=>09;069.:>06?,F7GK=IK=AE4KJ6\Q;aE/J9j]g`USFEA@A=>5=0=-4%5&6'7(7(8);,=.<-<-<-<-;,;,;,<-2(7.;/:)7"579"A-;+6)4*6/<7C?HEDEEHCC:661808.4+9/9.8.8-9,:+<+<+=+=*>+?,@-A,A-@-;*:(7(6)6+8-;3<4=6=6?8A7A9B6@6@5H=E;A8;25/3-1*2+9-;*9+:*:););+<+9'}8(|9(|9(|9({8'y6&x3$w- A4OCMAL@QEUJRG\R\RUMTLZUXSWTgZ]T5IQ*AK(BK,>H/7@+2=-4?14<1HPCZ^PW[JMO:DF.AA'==%:;)>?1;=2:=2;?14=*;H.PbF7>F7=E6@F8>E5>F1HL5MI0U?'Q:sbcX_ZUTGG@>A=?9:09+=,=.>-;-;+9+:*:,:+:,:+:,:+:,;.?5B:B7=/6#1125#6(;/A8E?IDJFKHCAEDB><39/=0?1=0?1>2>0>/=/>.@.?,=*;*<+=,?+>+>,>,@.=-:,8,8+8-:09/<2<2?5A7C9C9D9E8B6A4=3:06/5.4,7,:.=,;,;+:*;*<*<,~;*|;){9)y:)x9(w8'u6'w4$4'D7NCK?J>QDTIRGSJXOUOVP]XWRSOcT]W5Xc9_jBZfBIT66C)4@*0:<19<1<@25>+;H.PbMKD63?3A4A3A4;,:,8-7+6+6,7.:/;/<,;-;,:+;+;+<,};+z;*z;,w9*v8)u7(t6)v4&;1FEI0?C(=@#:<$89';<.8:/9<1=A36?,MK4>4>4>4?5?5?5>7?;B>D>F=FM@PDSHPGMGIEGBC?A=B=FBD??7=0>.C0G3I6F4E3C3B1A0}@.zA.|?-:,8,9+:,:,;-;+;+:+:)8)8*9,;/=/<0:/8.9/:.:.:,9+8*7)7(6)6*7+8-9/<0<.<-;,9*:*~9*}:*};+|:,z;,y;,w9*s8*q6(r7)u5)D8H=K?H:IB)=A(;='78(:;-79.9<1=A37@-NKB1=I1?G/LG1S>+g=-ZL_S>43+?9XUigdeRUJNNPIAF<@6>4@6D:G=G>JAJAJBJBKCKCKDKESRTTSRROSLSLULUNLHIFEBC@B@C@EBFDJFE@>7=2?2B1E3G4E3C3B3@0?1~?0z?/|>/:.9.9.9.;-;-;-;-9*9*9+:*:+;-<.;/;/9-9-:,9,8+8*8*8)8)8(8)9*:,:-;-:-:,9+8*}8)}7+|8+{9+z8,y9-x:-v8+q5*o5)q7+t9+H;IC-B47@-;H.L^8_uFiJtPtPtNrOsTpQnMmLpPwY|az`rXiQZA\EaIeMgMgKhJfLcPY{IRtBi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`QkbSkbSkbSkbSkbSkbSkbSkaUlbYlbYlbYlbVlbVlcRlcRldQldQldQlcRlcTlbVlbXlbXlbXocUnbRkbQlcRlcRkbQg`Pd]M^WGYSCSM?MJ;KH9GE6EB3?B/;H.?H-OC-a=-E:XRNJ,+:9=;SRpnvvehX^^_UQPFG@C:D=G>GAG?HCJBHDJCJFKDKGKGHHGIHHGGHDHDGBFBBAABBABBCBB@A>A?JGC?<6>3@3A0A0C3A2@1?1=1<0<1=1=1;1;1:3;1;1.9)9(:*:+;,;+;,:+:,9+7)~6({5){5){5)z6)x6*x8,w9,s8*p4)o5)r:-v<0M@KN)?O(J\2_rEk~QexKXj@M_7@Q-6E&7D*=F1=D4:>07;-8:,:;-68-8;0>B47@-9F,I[5[qBeFrNsOsMrOsTpQmLoOsUx\z`s[iQ`HYB^GeMgMfJeGgGhLaNXzHQsAi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`QkbSkbSkbSkbSkbSkbSkbSkbSlbXlbVlbVlcRlcRldOldOldMldMldMldOldQlcRlcTlbVlbVocUmaSkbSlcTmdUlcTi`Qf_Ob[K^WGXQARLB>@9C?C=C@D?CAD@ECDCADADDFGHIHJIIIGHACADBEBEAA@>=:=:FF=<83;2@4?1>0@1G]/AV-7H$1@!6B*=F5PK8MH5ID1DC.@F*DD([B,TG\X>A/3IN?E;>;FBFBB>>7D=D=D@EAEBECDEDF?C@DBEEEGGFFBC>?BD@C>A=>>>A?C@ECBB9850;4?6>3=/?2)=C5?>@=@=C?B?>:9370:0=2>3>2?2?3=2;393938192;0<.<.;-;/:.:.:.~:-~:-~:-~:-};/};/};/};/}90}90~80~8.7.7.7.~8,8,~8,}9,|8-{9-z8,x8,x8,x8.x8.w7-v8-v6,t6+s5*q5+m1'r6,n4)m3(o6+m4)q8-I=SHSJRGRHPHQJQKRLTMTK[NcQo_HYU:MV7O_;j~YbxQYoHUjCRg@Mb;IY5CR17D&4>#2:#6;'<>0@B5@@6<>358-39-4:.7:/9=/;?.=B,%Q?)kP=XGNBE=D?WVTTQQPONMMMLJKJTTHG=>=:B@EAB;>4D9E9F=G>FBDDAEAEBFCDCDDEDCFDFDFDEAD@B?A>A=A=A=C?E?C<>6:090:/<0<0A2~@3~>4<3:3918190;.<-;,;,;-:,:,:,9-9-9-9-~:/~:/~:/~:/}90}90}90}90}90}90|90|90|90z:0z:0y9/y9/y9/w9.w9.w8/w8/t8.s7-r6,r6,p6+p6+k1&q7,m4)l3(o6+l3(p7,~H>RISLQJPJQLPMQNSOOGSH[K{ePsiPhkLfqQgxT^tMXnGPf?La:K_:K\:GV7CP4>2;=04:03;05;16<0:A,>D*Q[9^mDkRpRpSqRsSsVx^|exakT`I]F]F\E`IaJcLeNdMbK`I^I]LRtBIk9i`Qi`Qi`QjaRjaRkbSkbSkbSjaRjaRjaRjaRjaRjaRjaRjaRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTnbTqdTo_Pm]Pm_RqeYog\ldYhbVfbWpl`{xi~{jyizubpiVe`JTT(MB.S@/U8(]7*l=3n70u91~;5@:IBPJXPZR^YSNGEB?DBFCD@@:A;CG@GCFFEFDFCDCDCDCDDEEEECECDBDBD?C>C=C=C=C>E@E?B<>5:18-9,;-@2@1~>2=1:19181:0;.;,;,;,:,:,:.:.9-9-~:/~:/~:/~:/~:/~:/}90}90}90}90|90{8/{8/{8/{;1{;1z:0y;0x:/x:/x:/x:/t8.t8.s7-s7-r6,q5+o5*o5*j1&o6+m4)k2'l6*i3'm7+}G=PIPIPJQLRMSNUPVPWO[P~^OtbNoiQorUlwYfwUQeBK_:EY6DU3EV6GV9GT8ER8?I0*7;*:<.<>0;=/9;.6<25=26<26<0:0=@-=C)MW5Zi@f|MlNnQqRuUtWz`w`nWcL\E\E\EZC_HaJbKdMcLaJ_H]H[}JPr@Gi7i`Qi`Qi`QjaRjaRkbSkbSkbSjaRjaRjaRjaRjaRjaRjaRjaRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTnbTrdWoaTm_Rk_SkaWlcZle[jf]jf]xtix~r}zg`cNOT>DG2FE1HC0F=,L<,VC4P9+R6*V4*Y5)\6+a9/e=1m=1KBSJUONKFDABDCFF@>A?B>E@ECFDEDEDDDCDCDDDDDEDEBFCFBEAD>E>DDA8;18,9+<-@0@1~?0=/:1:/9/:.:-;,;,:+:,:,9-9-9-9-~:/~:/~:/~:/~:/~:/}90|90}90{8/{8/{8/{8/x8.{;1y;0y;0y;0x:/x:/x:/v:/s7-s7-s7-r6,q5+o5*o5*m4)j1&o6+l3(h2&k5)h2&l6*|FG2:A/9=,9=.9=.8<-7;-7=36=56;46<2:<1;=/bxIjLnQsTwWxZ{ar[eN\EZC\E\EZC_H`IaJbKaJ`I^G]HY{HNp>Eg5haQhaQhaQibRibRjcSjcSjcSibRibRibRibRibRibRibRibRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTlcTrfXth\sg[mcYjaXle]snhzwp~wz{kcfSOR?GJ7EH5BE2BE2EH5KL0A9,A7+@6*F4(S5*qB8PHPKIGGIEIBE@B@BBACBEAEADADADDDFDFDFDDEDEDDCFBFAF>E=E=F=E=F>A:C;E=B9>39-;..=-;/:-:-;.:-;-:,:,:,9+9-9-~:/~:/~:/~:/}:1}:1}:1}:1|91z:1|91y90y90x8/x8/v7.y:1y:1x90v:0v:0u9/u9/t:/r7/q6.q6.p5-o4,n3+n3+m4+j1(m7-j4*h2(j4*f2'j6+}D;NGNHQJTLUOWPYR[Q{YMv\OkZJ]UBYXDY^HOYA?K3:H/7E.4B+5A+8D.=I3CL7EN9BK6?H5.5<,4:,5<45<56;56;49;0:-;@)GP1Ra:`vGiKoRuVyYy[x`nW`IZ}C[~D^G^G]F`IaJbKbKaJ`I_H^IW|ILp@Bf6haQhaQhaQibRibRjcSjcSjcSibRibRibRibRibRibRibRibRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTlcTkaUndZpf\lcZkd\rmg|ľrfcTPQ?FI8>E3;D1:F28E38E38C2:B34(P:/e?6EAPOX[QVCIFJEFFFEDEBDBD?CADDDFDFDFDCDCDCDCEAFAF@F=E/?/>.=-<-;-:-;.:,:,:,:,9+:+9-~8,~:/~:/~:/~:/}:1}:1}:1}:1z:1z:1y90y90x8/v7.v7.t8.w8/u9/u9/s9.t8.s9.r8-r8-q6.q6.p5-o4,n3+m4+l3*j4*h2(l6,i3)f2'h4)e1&i5*{B9MGMHPJTLVOXNYO|\Qs\Nk[L`WFVSBPSBJQ?@I64@,3<+2;*09(09(2;*5>-9B1G4:F2:C25@/3>-1<,3:33954954928919;.;>-;@*CL/O^7]sDiMpSwYyYwYqYfOZ}CX{A\E]F]F^G`I`I`I`I`I_H^G]JV{HJn@Ae7haQhaQhaQibRibRjcSjcSjcSibRibRibRibRibRibRibRibRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTlbVj`VjaXkdZkg^upjμzym]_YIKL:@E1;D/>J6=H7=F5;C4;>5:;3983880==3C<2N71a84HH]_`dWZQSNOMKKJHGFDDABBCDDFDFCECEBDBBCBDCD@D?F?E.>-=,<,;,;,<-:,:,:,9+9-9-~8.}9.~:/~:/}:1}:1}:1}:1}:1}:1z:1y:1x90x90w8/t8.s7-r8-t8.s9.r8-q8-r8-p7,p7,p7,o6-o6-n5,n5,m4+l3*k2)i3)g1'k7,h4)e1&h4)b0%f4)zA8MGMHPJULXNYOxZOr\Nk^N^WGRPAKN=CJ:9B12:+08)17+17-06,/5+/5)08+2:+4<-9D4;F5=H7-.800621622717829;0:<.:?)?H+KY5[qChLqVw[wYsVgP^IUx@WzB[~F[~F[~F]H_J_J_J_J^I^I]H]JUvIJk@@a6haQhaQhaQibRibRjcSjcSjcSibRibRibRibRibRibRibRibRkbSkbSkbSkbSkbSkbSkbSkbSlcTlcTlcTlcTlcTlcTlcTlbVpg^ng_lgatqj}ub^\GKM7CH2AI2AI4@G5BD7AA7B=9C97?:69<5>?7B71J.+d66QRginm\\ZWVSQNLKHHCDBCCFDFDFCECEBDBBBBDCCBC?D>E>FD69A208+/7*6<247058157247025.06,08-19,6A3:E5=J9>K9-,6..400511606718:/:<.:?+WzB[~FY|DY|D\G_J_J^I^I^I]H]H]LStIHhA?]7icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSjcSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUmdUmdUldWibZgd]vsnʵƶibbFEH-DH/CG0FE1GD5F<3C60F42H:9>=9>?:B:7I75cGFjjœ譩ҋtn]XSPONJLFKFKEGIKDF;>>@GIDG:=@@@@A@B>C>BA9@9A9B8@5:.8*=0>/>.>-=,<+=*<,:+9-9-~8,~8.|8-|8-|8-|90|90|90|90z:1z:1z:1z:1y=5w<4w;3u:2t91q8/p7.p7.o6-m7-m7-l8-m7-l8-m7-m7-i2+m6/p92o81k4-g2*g2*h3+e0(i7.d2)]-#`0&_/%b2(s>6OJPKQJRJ}YMv_QfYITN>DE5>E5:C25@04&DR1WlChRs]w_rWkR[~DXyDTu@Tu@WxCZ{F[|GZ{F^JbNbN^J\}H_K`L^~MTsJFd@2I:3L95K<9?:7BA?MHE]RPyjgβſ쳪͂|c^VVRSHMADDEEEHHJKEF<><>AC????A@A@B>B=A<@9A<@;@9B:C;A6;18-=0>/>.>-=,<+<,<,:+9-9-~8,}9.|8-|8-|8-|90|90|90|90z:1{;2{;2z;2w<4u<3u:2s:1r90n8.o6-m7-m7-l8-l8-l8-l8-j8-l8-l8-k6.n70o81n91l7/i4,g2*e3*c1(d4*_/%^.$b2(^.$`0&p>5JERLXR~XOrVKdRDQJ:>?/:A16A05@03>04<14<15;17:379477577557246116//6./7,.9+1<.4A08E49H58G44E24B1.8/.5..3--2+23+46+8:-9=,7?(DQ3WlEhUt`wbpYgPY|DWxCTu@Tu@VwBYzEYzEYzE[|G_K_K\}H[|G^J^J^{MSnKF_A9R4icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSkbSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUmdUmdUneVneVlfZed_y{xشğl`gEQX7DG,DC.JD4LD7KA8I>:C;9SJKia_wvecBEDIRVUTMKDACAFEEFDDCD=?>@@?@?B@B?B=A:@:@:B:E/>.=-~<,=-=-9-9-~:/}9.}9.|8-{8/{8/}:1}:1{;2{;2{;2{;2z;4x<4t;2q;1r90o9/n8.l8-l6,k7,l8-j8-j8-j8-j8-i9-j8-j8-n91m80m80m80m80i7.f4+c1(d2)a1']-#_0&c4*\-#_0&sD<}PJVP~YQpTI^J?OC7?<-46(2;*0;+1<.2=/4<14<15;17:379479668357257227007/08-.9+0;-2?.6C27E48G48G49F54>33:2/4-,2(/0(13(57*6:)6>'DQ5YmJkZwfwflZ_KWxCWuCTr@Tr@VtBXvDYwEYwEZxF]{I_}K]{I]{I_}K^|JZwKPgJAW@3I2icSicSicSicSicSicSicSicSicSicSicSicSicSicSicSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUmdUneVneVneVneVmg[jkfڴefmLMQ6FH0HJ5KI:HD9D@7OGDj`_収cd@?PKTMPHF@GBMJKH@?>>???>A?A?B?B=B=>9@:C=E?E>A9=5;2<1=0>/>.=/~<,=-=-9-9-~:/}9.}9.|8-{8/{8/~;2~;2|<3{;2{;2{;2z;4x<4r90o9/o9/m9.l8-k7,j6+h6+i7,i7,i7,h8,h8,h8,h8,h8,m;2l7/j5-i7.j8/j8/f4+a1'e5+a2(].$a2(b3)Y* a2(yNE\VvWRiNGWC:I<3@:.:;-8<.08)/:*3;.4@?A@C?C?C?C=?;A@9>5=3<1<2=1=0=1~<.=/=/~:/~:/~:/}9.|90{8/{8/{8/|<3|<3|<3{;2z;4y:3y:3w;3n70m80l7/l7/k6.h6-h6-h6-i7.h8.h8.g8.g8.g8.g8.h8.k92h6/f4-g5.i70h70e4-b1*c2+b3+_0(]1(]1(V*!b6-{ULtYRaNHN?8A7.=6,;9-9;.9<139-3;.5;/6<06<07:/58-47.69049238139/39/2:/19.19,.9+.9+/:,0;-3>.6C2:E5Qn>Qn>Qn>Qn>Qn>Sp@Sp@WtD[xH]zJ]zJ_|L_|LZwGRlECU?6D7(6)gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSkbSkbSlcTlcTmdUmdUmdUmdUmdUneVneVofWpgXpgXng]lnmz׹ĥregOMP;GK:FM=GOBKQG{{sžؓeSJ:TFWIF;@8KEC>C?B?C@C>C>D>B=B6<5/95,;8/8:/57,36+69.5;/7:/69.69.58-57,36+28,19,28.19,19.19,19,19,.9+.9+.9+/:,0;+3>.6A17B2ex\umtlf_RwKBh9KkVsCZwG]zJ^{K_|L_|LVsCNg@D=CUrDYvH[xJ]zL^{M\yKQn@G_;6B4+4/#)%gdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSgdSicSjcSjcSjbUlbVlbVmcWmdUmdUmdUleUmfVngWogZnh\oh^mjekormtzη|ubb_NXZL]cWmwn|}̻pQDSFSHC:J@H@G>F>E=DG>G>C;>5:2:3>6=5=4=5=4<3;0;1;1~:/~:/~:1}90|90{8/{8/{8/z:1z:1x92w81v70u6/u6/q6.m80k90j8/j8/i9/i9/i9/h8.g7-f7-g7-f7-f7-f7-f7-f7-f5.j81m;4k:3j92j:0m>4oC8l@5oD;d<2c=2zVJdZyWMbLA>:13814927<54:0/5+25,9<336+25*24)03(13(25*46+47,.6),7)/7*-8*/7*/7*/7*/7*19,08+08-/7,/7,/7,08-08+7?09B14*00!''heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjdXldYlcZmeZmeXmfVg`NjeRnkXol]he\feasqrԶ|qtY_dMbkXr}lا`XD=NEMCF3<2:1919191~:1|91{80z7/z7/w7.v6-w7.w7.w8/w8/v7.u6-q5+n3+l7/i81i81h70h70g6/g6/g6/f5.g6/i70i81h70g6/e4-e3,h3-j5/m80k90j:0i;.i=0kA3gB2jI:dH:v_O~k\xjoRJ=79.4:04:039/39/39/28.28.17-17-36-06,25,/5+14+/5+/4-.5-/4-.5-/4-/4-/4-/4-05./4-/4-.3,.3,/4-/4-/6.1;23=26@58B79D67B45@03>-4?.DQ=WeN[kQPbHEX<@T8BW6Ic>Ke>Kf=Kf=JeOj?UpGYtK\vO]wP]wRWqNHb?;O6&1+&+.$),heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVidQjhSmjWjk[gg_lll~ЯvkqUYaI_kUto~uKAM@K>L@K>E9=4?6E9F7J7L:J7F6C2C6E7C7B8A7>5<4:39193~92}:2z:1z:1y90x8/v7.v7.u6-v7.t8.t8.t8.r6,o5*m4+l7/i81j81h70i70h70g6/g6/e3,e3,g5.h6/j81j81j81k92k60l71k90k;1k;/j>1j@0iD2gH6kP=gRAufSuesrKL<69.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4.05//4..3-.3-.3-.3-/4./6/.80/:21=34@66B66B66B45B16C1CP>P]IR`IIW@AO6BP7EU:Jb@Jd?Ke@Ke>Ic6I5&1-',0$)-heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVmhUkiTmjWjk[kkcwwwۿʫyuy`kpZt{i؞L=RBL;@1G;YMUJ@4D7H:K=I;B7?3@7E;@9A9A8?6~>5}=4<4}=4z;4x<4w;3w;3u:2t91t91t91r90r90r90r90o9/n8.l6,k5+l7/j81l71j81k60i70i70h6/g5.g5.f5.g6/h70i81k:3k:3l;4j;3i:0h<1k?2jC4iD2fE2fI7lVAjYGujVm{mEF658-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+/4./4./4./4./4./4./4./4./4./4..3--2,-2,.3-/4..5.+5-+6.-9//;12>24@46B47D38E3?L:ER>CQ:;I28F->L3DT9J_@Jb@LdBKc?Ia=G`9F_8G`9RkDXpL]uS^vVZqTPgK=T8.A.&1-',0%*.heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZmfVniVljUlkWlm]pqiؼǫ}ſñpP@O?XJM?E9G4e=1f>2hC3iE5fG3cG2cJ6hV@i\IskVozpq_9=,47,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3-.3-.3--2,-2,-2,-2,.3--4-*4,)4,*6,+7-.:.1=14@25A36C2:G5N4DX@7C;F?D=>;:7:8>;=;?<@=}@=xA6s>6r=5r=5r=5p>5o=4n>4m=3l<2k;1j;1i:0i:0j:0n72p62p62m61m61l71i70i70l;4k:3h91e90e90e90e:1d<2fB6cA5cC4dD5dG5dI6bI3_I2^L6eV?jbMrmWor[`L3:(28,28.17-17-17-06,06,06,17-17-17-06,06,/5+/5+/5+.3-.3-.3-.3-.3-.3-.3-.3--2,-2,,1+,1+,1+,1+-2,,3,,6.+5-*4+*4++5,.8-0;-2=/2=-5@/6A05A-1=)1=)5A-8F/=O5@T8FY=H\@J]?I^=K^>K`?TgG[pQcvZauZYkSJ]G6G4&4%$-*$),"'*heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjcYkdZlc\md[meZlfVjgTkjUlnYorasvmθκƶøͧkX[GWEL;D:DE?A>=::9;9=5o?5o?5o@6n?5m>4k<2h<1h<1h<1l<2o83q62p62p62m61l71j81i81h70g80e90e:1d<2e?4f@5dB6^B4aG8cL:dM;cM8`K6]K3]M4]Q9bX?mhRss[nv{eFO:4=*39-28.28.28.17-17-17-06,17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0*+0*+0*,1+,3,.5.,6.*4+*4+*4++5,-7,.9+-8*0;+4?/5@/4?.3?+3>-3@,7F/9K3@O8BT:GWJ=I>I@G@D>=::7=9>:?9A:xA:tD:pF:pE5j>5n=6o83r73p62p62n72l71j81i81d8/d90c;1d>3d@4cA5cA5_C5ZE4_NnlUtv^|kcmU2>(6B.3;.39/39/39/28.28.28.17-17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1+,1++0**/)*/)+0*,1++2+-4-+5-*4,*4,+5,+5,,6+-7,,6+/:,2=/6A17B27B15@04?.2?-4C.:G3=L5AO8DT:JX?L\BTbI\kTcqZ^mXUbPDRA2>0#/%&/,&,,$**heVheVheVheVheVheVheVheVheVheVheVheVheVheVheVheVjdVjdVjcYkdZlc\md[lfZlfVolYmlWjlWgkZflbr{x׭oYWDQ@O>OAOBK@C<<5>7?6?8A7{B7uD6qE8qE8p?8q?8s>8q?8q?8q?8q?8p?8sB;qB:o@8m>6l=5j>5m>6o>7o83q73o83m82m82i81h91f:1f;2d>3d@4bB5`C5]A3\@2WB1TG4[S>f^Gi^HbX?ZS9ZS7\W:ZV;XW;kmUsw^u}fUaI&28D03;.4:04:039/39/39/28.28.17-17-17-06,06,/5+/5+/5+-2,-2,-2,-2,-2,-2,-2,-2,,1++0*+0**/)*/)+0*+0*,1++2+)3+*4,+5-+5,,6--7.-7,,6+.8-2<16A39D69D47B46A10;+2?-5B09F22=/x=/t?/sB3tD6r=5r=7t=8s>8u@:u@:t?9q?8sA:q@9q@9q@9p?8n?7o>7o>7k92m82l:3l;4l;4h<3g<3c=2c?3^>1dG9cG9T=-N9(M8'@1WQ;PN7KI0OK2]Y>ieJeaDVU7XX<]`CosZzfdlU=I1-9#2>*4-1=)2>*9E/BN8IU?O[GVbN]hWYdTLWI/u@8s>8u>9u@:t?9o=6p>7sA:q?8p?8p?8n?7o>7m>6n=6m>6k<4l=5m>6k?6j?6gA6eA5bB5dG9[A2^G7^I8N=+F7$G8%>6!LL4GK2DG,DD*MM1\[?baC`aBYY=dgJsw^sy_X`I:D,/;%7C/6>16<26<26<25;15;15;15;15;15;15;14:04:039/39/39/27127127116016016005/05/.3-.3--2,-2,,1+,1++0*+0**1**1*)0))0))0)*1*+2*,3+.5--4,.5-07/4;39A6?F>BJ?;F8:E57B14?.3?+6B.)r>)s@+tD0vE4q?4n<3q<4tB9sA8o?5qA7xH>n>4m>4m>4k?4l=3j>3l=3j>3g?5gA6gA6gC7eC7cC6`C5^D5bK;UB1ZI7`S@RG3C;&E=(FA+AE,BH.AE*<@%?B%NN2_`AijKaaEnqTvzagmSJO94<%4=(=F38>28>48>48>47=37=37=36<28>48>47=37=37=36<26<26<25:449349349338238238227105/05//4..3--2,,1++0*+0*).().().().().(*/)+0*,1+160/4.,1+,1+/4.6;4=BK:4.8/-4--4-,3,gdUgdUheVheVheVheVifWifWifWifWifWifWifWifWifWifWkeWkeWlcZmd[md]mf\mg[jiWkmXimVjoYjs`hthm|wڻּҽz{R>tJ4uH3vI4zM8}P;yL7nA.e7'{M@sD:qB8sD:oC8g;0d8-g=1i?3i?3i?3g?3f>2f>2f>2e?2b@4bB5`C5_C5_C5[D4ZE4WD3XI6OB/\T?oiSc^HMK4IG0IK3>D*?H-@F*48>47=37=37=39?58>48>48>48>48>48>48>47<67<67<66;56;56;55:45:438238216005//4.-2,,1+,1++0*+0**/)*/)+0*,1+-2,-2,05/.3-+0*+0*-2.2718=9;B:@K=@M;@M;=J68E13@,1?(0>'4.:0,6..5.-4-gdUgdUgdUheVheVifWifWifWifWifWifWifWifWifWifWifWkeWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_drejytܿչйѾϴuawVCjI6lI6rM;uP>mF7iB3gB2jE5nI9nJ:oK;oK;eA1cB1cB1cB1cB1cB1bC1`C3]F6\G6\G6ZG6ZG6WH5TG4RG3PH3NH2fdM~~frrZVX@JL4GM3A.:>-;>39?59?58>48>47=37=37=38>48>48>48>48>48>48>48>49>89>89>88=78=78=77<67<66;55:449338227105//4./4.-2.-2.,1-+0,+0,,1--2.-2.,1-,1-,1-,1-.210513764;4;G9=L9@O<@O:8F71?2-9-,6--4,,3+fcTfcTgdUheVheVifWjgXjgXifWifWifWifWifWifWifWifWldWldWlcZmd[md]mf\mg[jiWkmXinWiqZgs_bpcgxrڽѵ˴˺ҿһsrb|]K}^LtUCaD2W:(Y<*[>,X=*`E2`E2`E2_F2`G3`G3`G3]H3\K7\M:\M:YL9XM9UM8RL6QL6NL5QQ9ikS|gmqXSY?FL2>G,48>48>48>47=37=38>48>48>48>49?59?5:?9:?9:?9:?99>89>89>88=78=78=77<66;55:4493382382/40.3/-2.,1-+0,+0,+0,+0,+0,,1--10.21/32/32/32-4-3?17F3=L7@O:?N7M:MJ9BC3=@5;A7;A7;A7:@6:@6:@69?58>48>48>49?59?5:@6:@6:@6;@:;@:;@::?9:?99>89>89>8:?9:?99>89>88=78=77<67<6495273162/40-2.,1-+/.+/.,0/,0/-10.21.23.23-12+1-+9*/@-6H2;M7=O7A6>A6>A6=@7=@79?59?59?5:@6:@6:B7:B7:B7;@9;@9;@::?8:?99>79>89>7;@:;@9;@:;@9:?9:?8:?9:?98?87=94;4382160/4..3/.3/.21.21,2.,2.+2++2*,4))6%$6)=!2F+8L1;O6;M5;M5;M58J29K3;M5H&DK*FM+EL*PV4PT3KN/HK,TT8bbFccIZZ@[Y@\ZA][B][B[Y@XV=US:SQ8HF1GD1DA0A?0@>1>>2??5>@5;>59?59?59A69A48C58C58C5:B79A69@88@58?79A69@8:B7:A9:B79@8:B7;B:E=8B:8B:7A88@56>14O<>P::L6@R8EW=FY=DX=@T;5H2+<),6+,3++2*ZgM[hN\hP]iQbjSckTglXhkXghVghVifWifWkeWlfXmeZmgYmgYkhYkg[kg\jf]jf[hfZefVhiWglVfo\erajwnz˹ʿNjlRM0SN0QK+QK+UO/UO/TO1TO1SO2SO2QP4QP4QM2PO3PN5NQ6MO7JP6HM6EM5HQ6EN1BK.?I'BI(FM+JP,KQ-NR/PT1VZ7^bA_bCY\?TWWU>XV=YW>XV=XW;WV:XT9QK3OI3LG4ID1DA2B@3A?3>@5<=59?59?59A67B48C57D37D3:B79A69A68@58@59A69A6:B7:B7:B7:B7:B7;C874>63=40>-3C)9M*BY/Ga1Op;Ln;Li=Fa>BY?F;J@?I>>I9?G8>F7>D8=B;>E>9C;6@74B19I/BV3Pg=XrB^J[}JXuIMhECZ@9O:6G54E2XR6:@6:@69A67B47B46C26C2;C8:B79A69A69A69A6:B7;C8;C8:B7:B7;C8;C8=E:>F;=G<=G?>H=>I9?G8>F7>D8=B;=D=9C;6@74B19I/DX5Ri?[uEZ{FWyFTqEIdA=T:2H3/@.->+6H2@R8L_CReGSgKOcG@W=6I30:/07/-4,YgMZhN\hP^jRblTemVinZjo[mn\lm[mk\mj[nhZnhZoi]oi[liZkhYjfZieZie\ieZig[ghXghVchRajWerao|s{ѿɶıþʾŸ̌oRL2TO2TM0UN1TN.UO/VQ3VQ3UQ4SO2ON2NM1PL1NM1NL3KN3LN6KQ7KP9JR:LU:IR5JS6OY7SZ9T[9]c?fnGcszpr{\\bFLP7KM5LK6KI4LJ5PK5TN8VP:WQ;VP:SN;QL9LI:IG:GE9CE:=>6:@6:@69A67B47B46C26C2;C8;C8:B79A69A6:B7;C8;C8;C8;C8;C8;C8F;=G<=G?=G<=H8>F7=E6=C7=B;:A:7A95?64B19I/BV3Ne;Uo?Tu@RtAPmAE`=9P6-C.+<*+<)1C-!Vx7}f~W~m!srZw zBt{G3L^(l_(SrEoyyv{%THk-)exCpKTF-j!-@f*B?R%e-&X)jCUCd1k00;yCfEN$o zd=8)q08>-bP*Z_vXlQ6@!E_K71_(VpgoBBhk%fno_X-auH#gr^Nnt*IaRF{_5xHyP zQb;r!%`2>+B9Bs*lt!a|e*{QNOADcgurn~Qqu|_d)c<>&696zUAPcZU3FHS*z<`u6 z;CU~A3jm;?1pfZr{|-tZ1&E58=33s9Knh9#i0XV60HFi|D4>+ki!%47pfY%N zQuWq7$pHT;QGd6!&c}Cj*P1#+Cq;vvm(6;a*OV#u`G0u>N#*%CGfHk!eQ059`s`{^ zQ#Xphd>^il<=I2E9KN9H5&qvvI0=x5K7akdua)B25|B+kQ+t%1`C zZG9ta`rQ@C*Va5ds@>1P`?+AWNJAg}u&H_5CoY!py$ zxetTR=7Qc-tDszoB7KeQ`9p6BKKL05&*=o~T4mX7i(Zi@dg*S#5vDpcOx`LgNO%MF zN>5OJ1;P+*HMvcklNxI(VV5DT>3P5%Mz!7NpMH*2t|3lm9+STxp98L!97qqliJBVG zk<$%`fBC6!Ax0+1hJeg_Cy!aT_EJCSwJPj8d*Q-eyK!PtAa8Szt?^>L`uNXF0Y<8= zGw87g!-bX9{nfK^hvGH40!fqWVz-KVI2IZpIIH`J!{aC zQrLyq#Gn8Q3Lxdh08#!&i$Dqhj1mN8;)5fpnE6rC>MR0M8mwr|3;BUB6bq!H_(h)s ztgMmb<)KHVq+q!J_^}8YG=3)6qL%z6ms1)yk9AnZI>u_%CLtDIEQ^zvf)LM4VeI}SFXr05WAg_jWjrl8*;;4lHiC3V&zsLEM+JP(EEn?wW+?7rL0>;W>j-yCE(W z3=wBII^QB&`H&iE%IKNXLivv0utEfzly{jyr!hVF+f;lhW0IMwS~DfMMD}GNi4MEf zH9qptof+#P7aNMCXTMB|WO8I4@s0Z=?tiT^)gF)V<_o%Jx&a|hk?MQJ`2mO@=ywkV zuoZ6uTYZ|T*9JY}jjRhqUZR|gYEs$cdo;k&d$BLXcDXw#TMrqp6sY+o4JhX`&qmST z_;YFwKgIC}siOY@a_-Fo%acUNC?as@LuTEXs{bTo!k!ioz>6)shTT8sHc zf8HW_P!TL1ND2>;4$B9B`mqan>I|;*R+%Q&RQEX0;MKFN&jEG;9T5vpnUS2ZX4)9b znJ;I0xXG{1P2R|On1ezbZm z=Ze0F@{La^U*2T@R5*zZ5q3#5QiLYd%55FfKT%9x6kU*m73Us$jj zaKAgfMb&#x;qu+#OxbVg0bcu7h%2{|j(5AIg%mK>4r(iz=YVe+KWAPwB9g=(r(-@P zqjNAT+|F{w$fJz5G%y#F{9M--j}pt~@Ru)}&q5xd9SLiq7;)o1PX4(D`V5E11(F`` zW{&;jTMnEo@R~Uw-idoR1h@-qRxbHx8FM8Rqgz!mLmH!*z9Af0g-!>Kb0_Q_Ov(n% zm|1b%(UU-~H%@CF7O{3N>GQDB?B zL#^n=pswP~&|tby|IZ1KoKB8g7G6fA7*?85<6v|Ska}yZ^)b^eW&@6x*Ohgjb{AXz}_lSsevZ&pF@%7e5q0`R}6t z%L@iaLN7@1`9`D_*Z&&;YH(~Bq8lv9bmCCFR2pJTJSLA+%Lx?xaZQ+p| zAZA!lEDEafq#-l6#JET!T19(8IkEFv_hn%^`&qZAJ-kr=z}ybbjWnzJQDdD%1LugS z#|g+(A%2K@F*roDq*dqE#3{=jtM_z6+c^M|5vC(FOOS*~Bx(*ssBlnS*upQi%<@y- z6tJ{cl&6-6Q}B}y!|d9cqU?4_-uR8&IS9Ob!JFUAzQiF+3+dtg`VO+%6Ox*v^3-hP z00B5E)9Ro_*@16nF6knZDs?8_^Z2&AMq3(oV@M?vE=#F9MCVfmrK$t1xMKIPM8DWf zoU5y&A%QE>oKvpcPadr%m$sFA^c>zGjw$85lX?!Qo2uJD^9zV4N9Xexpy(lis4CfC zakEHyX=`haBU*+x;Cl^&&#V;Ijjsj@?%=qz7Sq|R9k1upCcYs}3y5?FtCE`TBu5A; zkX{i3V*r93k8vV_Nz}TV+NPwh^$h}di`1!oQa_^7s?yG=l)uMDcPHcSRy1m_ z`~8Hj_FEVZW{{bz_=PhzxQN~w1~soRPcoz%$*)_yi7sl3$S-+d#Y|Qg&Q!y62cuh> z0aQ;&CJPo3wNmfPbxJp}vB4ONi1n9ZHpX>xor9VLF_v-7KQ=cXtz9W$wZV%L5g@dw zD2$MxwdSg`nOZYi@t`nRgm7-T%YGcWo=7}9H?Jq zE{ROx&nwk&q1V8~lKNkT2sa5AgBLYSofWj&Jl>n1wN6EjSA=0SH~VTz!rl+Cri2EX z?1>NZY1?_2BzN;Kvu%xvlP~^~Z{Fh)86b zU-W7IuX?z>*${j4K#yyE=I*PdX_-epnhkpmdFjmgGsPKWWEU81ckYCGUC4~Q!4oYkYK~VpNdY#eV#|AGp}I004A;E%9CPAA-x% zK0DSSZxZMR3I&qB$}1sg>J`4}jaXJ&(yOR*8Awz-eso`j2t*r$hNt(l-IO8Ll)awR zZ_k(rVJsB3vgTYq3t`PLNbjI&&r*-Un#4o&D6gt(0-i%HRD2X`N7c2sJKmnq6%zj2 zVFh6Su?!&9|E9!0mJz|{dtn(ne|yI7D1~CnmLViTuQu@~{F9#9>$e~Y6B0{Z@tEi< zw7AK4o2i0&&55dgELP(0959BHg>@B25W-+>C%6K}Y? zCFa1{fmP~P81)~W-0DIqX6*giDev-F(YCyZ;RoC|PN^FE<>fJD4C()HbS`M?0=(bLc0ERA8?59C zkTO#X%Ljs9J^saqqpMbzmTl~Kuxsj^o8(J&CGr%*Zuz3XUQa)tZrwVL?60J8zKGLN ze3NaGMiRc$!8?Os(6TnR z2qTk-#khk7cNhe9x<>Ct9?jups5X{Sba3isf&F064Y06>ev-`a(CU+|hBDnz792Jd z`xzPczE_(KypTGY6jLt0%lTHSqib=H(9Fm36&Lgl3R8a04YCgDeI2j=P=4)$c7!Qo z>Mqw4#^()o{Nb)HIuM3ZUpYN1XN{X(t7b1*^Qw17*;|yQXW}Xsv%yVt`k=%9) zhE*8Fex{UE4OT{po~UzH(+pvqaX0Hxvg%#=Nuo7wxi>MhbJqwGYcj<{^xd{%)M^?U9(E?`-s_h!GdQ zdMlNsX+Pfwze<+4#2X&w57_?2yl4LtW4GAUZc{pcjcdh7+dSLq)ymj(VDSJyx%s50pw`*0W z{6G$k#4Tjl$txcx*9!FWwVYhmG+f+gu9Z(4ajFCczYr9c_)e=o$28WQKDRu;s$@EZht6QyL4 z-|Ykbz7OX6i6bV?^n|0lw&WUQV@^V4gN4(xBfV-!y?LV0BiY$G7QAcOOv8`+1qB0z z_R)#gaJbIfq028^oo$NwXIJLpZ+T>l@Pf^OOFfyEFGzp3WY$+#EGI|UUqxM7&a`BZ zg412Uk2t%Yltvhs`Rg|4gy3dRxp`iXMee?KaBrtANNUUmUMcoo(u=d;9Kc3%Hm_G} z%X<*5QPB<49LiaZHkNL^8JCr&8>yE?No&XSB@x`vR5w-)y$3QO)>Lr>kID{;+Rbw*PAqI_S$ z*Sy=-5iHfMIwvPly6=EVmzBI9Y=aSv^nfUXPjUUX7B6lo7zQ^$tX1}8W&<R^Ck^ zY7s$OVXSu-gi{C=Uer8gtWlK#;7gq>b3EMQR$rli350iho&)0G>36h=-M1g|^pUON z$RdYB*I!#P@LYPp{uN7nPiWUeEeRGWgZvF1J~N@}2ECI}z_a82GNMl|)p$u=hJ6KV zm^uu7bQBY_v!Qh5W*`xBX{N~`8gpCADEPX5HR}WdF%?qZIp>fFSV{q~w$y1VZCkz3 zGA}&4ImT@ARLmLNOjWlKBk;;|7et++tsMF1W?+uAALH{d#TY%Sd4+gi875vsBoM2Z zuykS?H}5=JntNZHel|LD3XwL9+3J;E$Bxx5M`y)Fmjuy53M;JR1b=`#@?7TD$d&uc zmbQl578?_}A*f7OU!KCtDw;_GG)x4sA=U>Glz0)GI-6o|S6VKjezpen8p z7iThx<&QEMOOU=!#>qVhOc;D1pTI^fHn7EQZA^+ SFy0h4Vu|?xbo`-qKJz~|j?X{< diff --git a/testorig.jpg b/testorig.jpg deleted file mode 100644 index 9816a0c6231a7c5eaafd445368a9eeb1cffc63df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5770 zcmbW(S5y;DmjLjD7OF@IQiAkel%{kP4J8sV5JE?av`~c5K@n7n^ePbPA&}6K-V}sT z6$Ap(MS2lLiZsRb|9yLQ&)KKly>n(BX70IXelrg!N z0e1kjG&CR@YFZEoL`O$U&&bZi$iTqJ#mdIa&dberm6sa=;TM(_;}?_`f|9_4@od6bEKn7r$5-13uU;$FH z0RQv=`2Oyb8u+gO{AU0uD5v}?P-#-n?}3J#cObo3loIJvk*M8(7l0; zqpPP6GeMf7%*-t;9UnS5ySTccef|6c0)v7>p1+8UijH|1o0^uM@hUSb8(V}c#+Q^5 zh-Gi;>KhuHnp;}mclVHb`}zk4$HvJMlb@%iXTB~iudJ@EZ)|S;*grTt`gweEdiIYC z2%!8o>+kq)*#B^`{B==KQBhKX{&4{*0{?bO7Ak51IU3g62#~!Go1lCIExUF~VQm+k zkb?0Z*a0(2&mpY%RpiG%w13I|cd%#wFWG;={@XPJV59{8y*x@5fEHkX6&-NqEJ3S? z<#s$i(D{LY#413eeOAVPAa+U0kWstlJphrN%u^#VXy|6n@KTl<_J$Q*uxOI8hlbqK zDP}!=!sKQ-&!OyG_4ppirXlO<(FiKvWV~|;@?o?ctY?&aGu)#B9wM@=mIcwLXC zX;3_2+-1L{U}YJV%VV+Ar(9mj9P+K3FD_oZ%sn9Zc?1GGNv^OIRS#2&?}_TF>e&s- zeEWVW!?2H0;x#eQl%iEN_sV_eY$03yrAB{J)^xZIVCD18ug0ZFoB38Vyi9z^i#SNJ zC+SgSIV@BD^;N;TjOtGZ3D){kqoHeKjVHA@lbgPpi(M(j8Vvd{F;j}SE=gr^WJ}BCLveC z3P&@zLLUF_Gv(C!3XdJ+j0t?C_|v$Va(nw;9`DC@bw8LY6`#POjhd~@tFq-7iz7YG zkTtU2MfEHTUq3JgCC5Kpq)>etsqf-}f0+U+8~IGVZ{9T=pKTVLS1P%n`nRoZ zt8pD|uMng_I{zEq4-VK}p%+1EpmlsZNsD?1{taw00G6d&dICme;5rQtLSl#_r&SYd6hX$**^2 zH*IEu^m?-&r^PP)(sh`8Q*Y<(R^}zSW;=|S$O~A5?{sZLJ%1-@m|!JaQpSUFKFvkb zRP-E4Hy+vC$C)lH*A_e%QX1Q^q_RwCap4keiOC9=YTSFgLWB6k{RPB1SXnHI)!7&( zt8@8qIRb@4xYr&jwzcWg53p2YELbv=nH;vT)@B7?Y1~JN5zkNj6ioR{`Y7JyT<1S0 zcjNuBnNcn(`=20wO1W-Drx;31XXH1v&)G4!Z~5(qsx^mYW|=Y~0rtQ10=e|&qX}S# z;fc6x5p6KDwkmcT-y9|NB)Jn8?~AN*nD4q^83u7x!6t}!wAXrd)S#4vuW4iMP4PE% zwE+(1IjLy9Px9eV6$ggnFO(Z-Q*j)v!mj&>$Fb{ZTO0p=Y+4guzb0}D)W)}ILL+`@ zvG}*DvB(EPPkBmSfuCkiVDX9Hi5jnx`tm0Ar6`dSSe zTe^G1UF=1*cY7FW6PU^g%DQt6Y5!?Ly9}3VG*(G%;>pb+0~tzw+B)4;9_^TlMg&f$ zi})%ePJ~P+Uiq-orP-jrEZ1Vv1->?;g(2wjub7I>t;642&%^b){6@UdLFqTF_>}HP zttdWbnQZtF^wP#B)!V%&y~4k@_0@BqdJbNnuJ8Hi*rm&U15*ZJvmFLL$pMR(4UIai z_2Pu=SPAkz-W!88Ji4 z=6=P}UY+>du6_5RSTz{+o+iAX=X?%1h|&pB^v0aP*fY`#`W4N5lwJ=gXsTi*&Pz}( z9}Iv51Ac6#B7N^VJW9~c4ElAur_q6PG0j{%ub9}s)POUa9?8nq-s&svCKA_G2wwiA z7r6!bc+8pU_$&UEMbv5!tta<=I_VA#si{19xo7EF_Itk7CaFBhbMEpsw+6F#nuSqb zBOwX)m+f$JpuA9%74O~NVhg(N z!);TRtT_sKZ}b+Fy~;rv7)I#__*ucjs{(_;!Is*CgSu2Jp(aJ9oMKqv$i8F(7=3C2a8fAqv3w@#8 z?@?>5Ldmi^T@gokWB}JN$Yb*P<_{>^*5Pi)E#ByN9WFzvIQD*Njpo9xO2fbbj@6G3 zg?4pjzFf3oRVaiVz0C5{^V-*wj4m1^W4Qa|^A{8zzc%9c)5KnX~U+JgGovhEM9a0rk{v4j7YErx-q^+CRPLrTSK6+U<}KWDn(Iep0~W4hy`HM$wM=!75?hj?5S zdAXw8JBB{QhC5lXL@gYxjl$~zOm3ULMpEsz&TI=Y$h83b=)Crd9m97X?QH$WMeSQ_ zZmet2gJ{rL?9NZ$n`;rPuU$zj&32M@FLHnbRaQLK3CL6cWHQInAb~Sbc?6v|NOGXC zsBNp#kkST1e zn^y$BOY;a%KnEmSHDxyOBOM=-pF}F#1S)o$W~iLsJyIXG;Lm!O%oAuF-z->%H>qE1 z*gfLJxBvYsi|zv;dFh+=Csm`Rb$0#1vvX!~#yPl_pXTb1<-Auz6fTWX-pq;(Xa+nB z;X~8hmh6lIQE_ASL?U0_sZD3~9Zz(tgEdLNDf@=G-mT8IV?Owimz_);$@r$6FE27@ zX!5QJuSt`Dr+AP-+a=V*Su$7~j0pA$Twb^KQ=*$IJuzzZF)4HL5aC>azN}cdDS+7s zTXy{Jw|rDmrc~iU!aP0p|TJ@wA3maZdy!cX&i z>)2Pwn*- zOT^H3>#@E5|B#QLEH;nTHEJaV0Yk?cVmLU;F3-Mc?-M zx!#$gDd8JJr^l;N8_+9TsWnl`roMS9|qwB^RiK`nman zsimw9eYql-%DMLYHOs|}2W{5PId=tkWIhUT3?}|PLk;)BF+43eeMk6GRLiO{+`6&l z{JPX})>XiU)cW?la*a8>im6Xy(%y}uO&RRR2%wi0fO=Qq4`8y&?KViTG*u^MsAcGC z2@c#XVUuq_#7y51@RDc#bY_xkg|6M0rzM!avCxnt4Q4IHK}trSX`Efuo9Bg=oUyp9 z&V<=-pr0!Bh_L52Z|0!^6@5I0VHv6dCa=^J!?^>UwCS}4dBbb^Ce!2p09bxe8$oP+ zQ^y3wSF?u!_*5(V^ahmAg4y>&@I7eZTzOeQEdMz!&j<~Isfgvdbw}L8IEktF%B3>O z=(ZN8|BA*IJCW`s45N?Ig)Ny=CL0R)oNExjFu6O2-?T<59i{|Y-|F?vZ~X!6CN@<1 z$T~TzH`#AmAtH09FZXn3kO_x6H)9^fqux2kU+mjHn0|V86kTF5hrS{=^PbLGE1YO> zg*)R9Ad|kmPGvp*!hiN8td|$aJY(Rn%;jX8C&WQ8s{!3>{nJiex+-J9~LKZ zmIl-t(6iO2G-C9M)JPYSP13hN#rEY1@o-!1-fNv&sDC992>AL?nIZ2miRw9}|3`!wct9?Gw??;jC^l4)Mo9asnXP;%90t*kP?|3D(S59YV_ZJfxdCU`*DVy1U zP~@MwK9yWub!i&$Rho6`)JOt*anY)Ib6M4LfrU2r`ftl?f(j@~^_E{ejvFDaOw`-M za>%(qh14>oce;+033>j=Ia8=qF&GdS`b8|Zfg#0;@7rv=gM}>VI4#XgAj2A< zteKH4Y`>7xL~ZyqK2>fY1f z6F@r?y@ifXMS6-UajC^ncAyJ_m1^Z*w<*=P*oqfBDa-S=>_TnsY@beun|WO+B9P1# zbm@ar)9P7r{3{(2Ei*LcZDXGF#dy?*>O|``@wxe&54^6eLa&|e{xC=z{9t5~*HEs} z(J^g7#peO}yq^Qv{U$YX!BtZ!9H>cKLrUF9TQW6fzmq=I4O-?{5nX_nmuAW4skXORozZcF{OUWbLROcn97_yI zm!L%NB|^;Cm_DE(mZHP>vKJi%?^>z*DM9_?2uW(3 zp;cNLPnee;G0$whk`GRy?866LDlh7&B8pVN9)MOWSmD#SAP33u6X7wLDch<764En` zOCo>O?1huAVA~_gAZ|5i?EXV02}s&ZEBt9Esx_6Xe!sEF{QO<#`j_!N0`X3Tkvr(M zi0kL`5z%3Z;saCzT=lzto4flIw}h_ar=6@TP4402N05-o;BCvy z7r{XqaHl5Au`9K!%dDodQEB>muEO-ALJ75WBmsK^XVKT#axRtFkNP|g$g@~l>Fc1e z7|)g9h?xK)by7j8gLT4cCzq1(G9n7{tn6fiS$)!fp=8WSaIn_DFUPcg1#-bO)1}Fn6j7fX51NCTRr;^`PxmHw!KtSeua$3zrJ_lWSZ( zZ#r(9f7azW1%>yP6X|s|tZt&uBT=f$qvW7YDL~Gbz(EGL@~ppxY?dq6T4Hx$C6r zd|~6eh=)dBHMp1w8s+`J;EQoP)HAL(=gsp{fd^veoliA0c91O1mvt=%D@C+S%9-Mb zx6i8$`#xmyr-OJ^Cw&v$7mh}vEm6d`R@PHKknir(w7GH{YcUR@W6&NOO-MF~dJckQu)LnE}U_{r;`I})_ z#TiaR$#`!ylhS8w4-?12_G(W-cm=K{!A9yAkxYrqFtUa5_}!M|h?dU|zm32t9{UxY zi#1;KXA>O{u0gy>9}xRbJ~H^e@^@17T~{1O(T5s)fEv8)P#;Bi(E~9^Pv8y`kebr9 zVoGXD?v2%4`dP75QJOCGYMml}U6*fkQ*K3GyRRmOZ@Ppsc6}|B>{ktPV9O|EqX#ng9Q(i%9Qn47NBI1q+ zKt&jNMeVq+VK9Cl6e5n7iA`KhB*%NV6vdi^ZHssX<@bX7Vx&)(zx{p1+rRDoonK3> zyH+rI;A7n7@n%pyBnJUycD&g#ZW|QFV59Ic5p^J!I<>uH-JJ2VYXt#?-}EOC8;|+1 zN?SCN)iCj@m~Sd^iEe``MX^QH{?-_3eMfdrKT3X~u~^Dsuv;8( e^;Dd4QS7i5y@D0wT$xcv%Tm0kNlEL^^nU=~nbB7O diff --git a/testprog.jpg b/testprog.jpg deleted file mode 100644 index 920fee2e32b5a8ab0af796e010ee8a1add3eee63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5655 zcmb7{cQjmU+s0=`?^D!47`-!$(TOfvln|nKi8@;JPDG8P6J&IW9yPk?L{IeSHIir% zk>KN;^S$&#ty6@|`>s0_)UFDt%00;yCfHxQ5dJ&)qAjHQf zz{evbARr(jA|xiIBqJpuA*F-DC@2}>Om`UJ3=GU{0-Ve&e5?!%Tw>gOLP!(}#l$Hg zBQ7j0Ac7LUeF>0=h=`Pgl$MN)Rv5v65dMGHbq@eS2uK5L-~d?wAP5i#0=(`8&;tM< z9N_Ke{QoB^V#GdhuimXn;{b) zxA>^!0F~>|#=Atb8uQ%#4<8Ve*CP{t`&F6yws-GrC25R0RtHy(444airxDB*!+$yQ zs8Lcfuwya)&$wq?aiG(Wx5u+&x&G|)iW(T*!Is$@T%v3uQ7QV zSY6Q+{W7ml-j~yTEszX*G543_ z3pU59D;JtKdx2UzU8l3Z+NFHP#m)1K?r6Vro}89gY*lj;$+0~O5Lb;X8f9)zmYny5 zxXzRTd4;$oJlNoQ1AX_z>|_On(|XG4OW6or^s3rS2UqWcPwIRNW-Rt*E_2o4>$pX6IvCi#4zi)NLHf8f5&oNjCP44XnNE;8nZlJZj8y zIIj%9zhWWgr*=h8qL{|3ipB_H>7)kgPUQG^U)b)+NHtOk?g6heDISj_W>=2I`1s&> zXU?lYhVLxmjymIiUIE+4+~u$o0we1H6tEoy7jioPz#7oI@Mv4&c$`O|YH0$u8>{hv z0iYY>;o#ujIPC8Nf&dU4TriXwfy9Hc2#d%ounJL9p>DiKcw<)}9_T7A16Womz{E%* zoRp-(kbAO%JE)s4)+|@Go(UH*TGF)M*0hOMs!9-CUKNHF^_L3iyew8v<1zera}zj9 zod&q{Y6f8s=f2s!?>AiVMtt1i%}N^RRQ7(&Q&zs?%7P0D(xrw948Dw)S?ft+!a;PG zy7HFzU9oE^V5HIXmR-UETJ(hHS=vjQ%5&;_-+*Tb z)dlPlZJ(x0qxmZNpXahKvBGFuBT<&Id*7?IIpSqSbmW%cTV2yuJ0U zo*DXlL>;@lt9wDkP_jbfUDFLRLKfICysWy{9)0%tSd=Ai{ zHQtsC*ycgNv~7?iDGXg?i&-~ZvU9Pg2TSXbzFs*aaGGPB$BIC(^g5Xaxp{&!omvXM zJzA#_!t%JmU&ZQqbHbqs+ooF*J+9_GM&Q@=KFu8u_uk#HI+=(uy#`cSXJIy{^Zg=K zf3mx7RQM&lAo}+Coa~Kg=KbI#Z4!O`Qq%Gb3Wj%#gvR-ITR2Qzo)@0)6T8%zua3iD zm~M~X==+fsy1o@7Q6d7RO6RQJ4?4vC1w2sjZAGICq03PV#dETu z(5jbLxp90$dlJ1LA~dx{o<2P>Sg8awr|C;>dAUM#6;U@hGWuSrjmTd;NyMa=@7#qZ2(gnHuh7OKvDkU|(H&NT;>V z9>jK%1rDoaO=zRwIy~myZ0PGNhn@`BD0{Vx5WX(^$XI0J$J`==`twr2!{IETja)!h zgZfFvxrDpn6=@|y?B@DU%FmTXteI^@#Y6jOb)p<0Odd(Pc3l9^{BPP;sHC=Cge&QD z+m)uUwziZ!+6tp(*0Rozd24%lV=41PeHS^BDPq2L{fFCe{6slKIb>)j<&7v#!J=lGwIQ+~ zPVsAisW~;v2ZCBUNdc3^E54err3^0*hc*CjB1mAlA7la z^3*{S8$CSOp4WEN%acv9FW6ZpsBol1y2j zkOosgsF}h~nEoN$KYRla{2R4E02l&dMnHv-Eb_WmICoivtuY>9$^Q}#Uk>yeJVnFg zN}ON9bKoQD_Q9AJHNT~rmfr0g_3I&2y8KyOO&wDdrwxA&x&Lom^x?a7ygAJ3l1&|| zWq}^y`<4g0$EcB>vpuNeJkFnIT90bfP%6wR)r^W3O#h2`&6`%i&$uR`g0qAdQ>}p}4E`b*lFL~mVa1576iglnHr77n~22f>~ zoi_q3^QRfep4YsoQD#it_YsDd0lb}uLt>}lE)^_m(79e|U)baea}N~LnxDE`_xWK2 zdKW#T5UtuAM2d}kAdHPB{B&NGl~B_IclmV8t^()aJXNIb|7|x7@1GbV@|>^83f@{3 zEmodk8wy2G>xXgmqp_^2cfI?M3LtiJc=XnB$~obR?~xgYsBfk7P?o6jE94Yh*9wc( z3kEMiYbM)8u-({SZHZ1yl#yuVm>C<5I;JzY4DiT=IG<{>->ul|DE!cxCvSj1A(>tVq$Uy>U7nhtnY7Ej6Nus<^>{BMlP##&q`)vY zy!Q(lT%e((bR5L$m#};9W5e#mvAs`l`YhS6_<`Ts()tJjz3>V$HO?U<7Z0`-^!|X` z^-b3-t)o7h?iq)oOd)UAsXW8=)f+!7LfA(%ds1&!);fz1li+l!dR8z}ddTNKe)YZf4*yfsHGm2297AF(7tHtJz7@gFO4K!gnV>5$RPF{BtdQGT z*uD2V2!I?rCP ztBYn{#&Ff^hJ*-dt&a~i6`x8pCr0a%>cIk7vioXws#3k<+^2%V>yDmxW^&>%kGp$U z87Dwqyngo9HcO@TjM>)w8TE^ULj{#DdL9;CB`bs0N>1i*tuV zO`Hj{S5r^&=C2$3A{FbkbklV5EMvt54za2LK0!AQp<*oi{JZ>Wutif03@RipZ z-mWRtFY&?q!_?OYp3ht?4>2_7Y3dLwUZF}2>C1cj}>>(sPdmRFjM=GrOR}xOxAsp zlx)v6dN&Yu07EbFZ|Gy&&)`3vs4bNREa?K*mVZSAIBy}AK=~0oThjK zk#&nr1Xmjc8K!rR_wf$}xoo@=)`PI|zxbuvFkgK!H+$s--#P;X#J%k!{+TWSH(7EM zCE(jAnXK(*UOPPcZ=irrrH1=5Lm}#eapI%OI^|0!o85Fet$40dO*T7aqbyugB_Nk@ zkMSD^_w%-*in4g;450{55XV}$-g{aKr1=qmN8*B1IM%Xn6pQzRIZ7-TAwzRiFCrMM+5CtuF(A$UM1HR@ywx&-|gs9wG zP3tNtfttk|7?yUkPCX?)0qi?S63#lj^2CF5QR{2Y>yWcL6-E;qgpM`|^!wpbY&+{; zBxbbn5OiX`SW&rvoPJQIYMc8bih=Pp>bi^3rlsHHOD>d3K&bV+d-ptq_<}Cd56to8 z)d_-G7ro1rghrcQ@|RAdO#{)jN;7-UQ*d=uM@6~k%_0?z-f7jsC>Lt(-t#)l;Fhl5 zCuUWIP@1y(D5BBSnH#-Nc6)x}gs>9N#1@Dd`E`O}e47loCV{<+N+qq)kAFZcAH3g` zR<)`^W(c-4kaRPP2Y1nnzbiLl7N+q@q9Wrha}l6IdQVCJW0_ z#cqY@o*GC{f$c0DSq(yeamT+QLUX7Lio-C)29?M?V)UnZZHQwFK~`XxMO?JUKD_FP z@lJ1nlqGFcT5?UfQN?mUT(G_7sm6dV3nS)?rF||#XjuV>O#eGrM}I)aEY6KLr2*#{n4BAcvp+nOGQ2pnRSxj z2qpvLP`m~4k(AM91$N_@8T2Hzt{LOq*WF{j;W67n?DYc&P^*<64hUs zn_IokL(L3#0tX&KHo&Gqafs6I7td!I)VAs#0NOu7)2V+(mVA9~-)xlL{~&Nw`iw(p{8zlb#hs9CFYq;vGqJ%{<(K=O z^@464$F=e@WU1>VuE0{kTk5r(7F%AEC9r%YzR|shJo{i9rcA@M6Z9(Nu%Hq!QpQLl z6I1I=)ovp^lcjLj!Qr~`M$>s~eV;FFp7RPitYY*=1tvr9;u5Qj(mR;WNp`_}?S0*NZ!0O17jS5$qW4qOgdqc(E}HrWIl;#kEx#ljhbX~C zsF5pQ1Ii$E;zqw^G$J0cwP$(_Pm4b}xl>l{n=!JQ?H~xAq1vSpBXbRji@5qGIxCp; zTLGcJ8iU;&IZ@!sS}N*QA1sz<9}bJGA;PHO8k-c@8%b@6d17(T%qj7qUYsZ0?6z56+I?~sasnVb9`n?ZjVtZ3B7%oF~GNLhe#LwZ#q;};^oZisv30;4}CYxss%Jin` zJ}ZSZkL0KdZN}0x5OJ4Su%;$1BJvgNy`Pe@RVcB;2Gwk@0U%wNCx0E^V&GL8LmRKu z-sSM6qzFZ{UIIDm+n#|kOp)bT#;B*P(fM$jQr|k)hk>_=uK0@ZWl@L*4 zD2uZ*`|z;_)RsDT;*`4^IDXN**v3#jGDu;n$2hu2e_hm9F0NmR5z)R^LnX>9WdC4L U9#E?5!l?r;*e8trGk!h)KW4JmQUCw| diff --git a/transupp.c b/transupp.c deleted file mode 100644 index e5ec5642..00000000 --- a/transupp.c +++ /dev/null @@ -1,928 +0,0 @@ -/* - * transupp.c - * - * Copyright (C) 1997, 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. - * - * This file contains image transformation routines and other utility code - * used by the jpegtran sample application. These are NOT part of the core - * JPEG library. But we keep these routines separate from jpegtran.c to - * ease the task of maintaining jpegtran-like programs that have other user - * interfaces. - */ - -/* Although this file really shouldn't have access to the library internals, - * it's helpful to let it call jround_up() and jcopy_block_row(). - */ -#define JPEG_INTERNALS - -#include "jinclude.h" -#include "jpeglib.h" -#include "transupp.h" /* My own external interface */ - - -#if TRANSFORMS_SUPPORTED - -/* - * Lossless image transformation routines. These routines work on DCT - * coefficient arrays and thus do not require any lossy decompression - * or recompression of the image. - * Thanks to Guido Vollbeding for the initial design and code of this feature. - * - * Horizontal flipping is done in-place, using a single top-to-bottom - * pass through the virtual source array. It will thus be much the - * fastest option for images larger than main memory. - * - * The other routines require a set of destination virtual arrays, so they - * need twice as much memory as jpegtran normally does. The destination - * arrays are always written in normal scan order (top to bottom) because - * the virtual array manager expects this. The source arrays will be scanned - * in the corresponding order, which means multiple passes through the source - * arrays for most of the transforms. That could result in much thrashing - * if the image is larger than main memory. - * - * Some notes about the operating environment of the individual transform - * routines: - * 1. Both the source and destination virtual arrays are allocated from the - * source JPEG object, and therefore should be manipulated by calling the - * source's memory manager. - * 2. The destination's component count should be used. It may be smaller - * than the source's when forcing to grayscale. - * 3. Likewise the destination's sampling factors should be used. When - * forcing to grayscale the destination's sampling factors will be all 1, - * and we may as well take that as the effective iMCU size. - * 4. When "trim" is in effect, the destination's dimensions will be the - * trimmed values but the source's will be untrimmed. - * 5. All the routines assume that the source and destination buffers are - * padded out to a full iMCU boundary. This is true, although for the - * source buffer it is an undocumented property of jdcoefct.c. - * Notes 2,3,4 boil down to this: generally we should use the destination's - * dimensions and ignore the source's. - */ - - -LOCAL(void) -do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays) -/* Horizontal flip; done in-place, so no separate dest array is required */ -{ - JDIMENSION MCU_cols, comp_width, blk_x, blk_y; - int ci, k, offset_y; - JBLOCKARRAY buffer; - JCOEFPTR ptr1, ptr2; - JCOEF temp1, temp2; - jpeg_component_info *compptr; - - /* Horizontal mirroring of DCT blocks is accomplished by swapping - * pairs of blocks in-place. Within a DCT block, we perform horizontal - * mirroring by changing the signs of odd-numbered columns. - * Partial iMCUs at the right edge are left untouched. - */ - MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_width = MCU_cols * compptr->h_samp_factor; - for (blk_y = 0; blk_y < compptr->height_in_blocks; - blk_y += compptr->v_samp_factor) { - buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) { - ptr1 = buffer[offset_y][blk_x]; - ptr2 = buffer[offset_y][comp_width - blk_x - 1]; - /* this unrolled loop doesn't need to know which row it's on... */ - for (k = 0; k < DCTSIZE2; k += 2) { - temp1 = *ptr1; /* swap even column */ - temp2 = *ptr2; - *ptr1++ = temp2; - *ptr2++ = temp1; - temp1 = *ptr1; /* swap odd column with sign change */ - temp2 = *ptr2; - *ptr1++ = -temp2; - *ptr2++ = -temp1; - } - } - } - } - } -} - - -LOCAL(void) -do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* Vertical flip */ -{ - JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; - int ci, i, j, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JBLOCKROW src_row_ptr, dst_row_ptr; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - /* We output into a separate array because we can't touch different - * rows of the source virtual array simultaneously. Otherwise, this - * is a pretty straightforward analog of horizontal flip. - * Within a DCT block, vertical mirroring is done by changing the signs - * of odd-numbered rows. - * Partial iMCUs at the bottom edge are copied verbatim. - */ - MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_height = MCU_rows * compptr->v_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - if (dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } else { - /* Bottom-edge blocks will be copied verbatim. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - if (dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - dst_row_ptr = dst_buffer[offset_y]; - src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[dst_blk_x]; - for (i = 0; i < DCTSIZE; i += 2) { - /* copy even row */ - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = *src_ptr++; - /* copy odd row with sign change */ - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = - *src_ptr++; - } - } - } else { - /* Just copy row verbatim. */ - jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y], - compptr->width_in_blocks); - } - } - } - } -} - - -LOCAL(void) -do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* Transpose source into destination */ -{ - JDIMENSION dst_blk_x, dst_blk_y; - int ci, i, j, offset_x, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - /* Transposing pixels within a block just requires transposing the - * DCT coefficients. - * Partial iMCUs at the edges require no special treatment; we simply - * process all the available DCT blocks for every component. - */ - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } - } - } -} - - -LOCAL(void) -do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* 90 degree rotation is equivalent to - * 1. Transposing the image; - * 2. Horizontal mirroring. - * These two steps are merged into a single processing routine. - */ -{ - JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y; - int ci, i, j, offset_x, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - /* Because of the horizontal mirror step, we can't process partial iMCUs - * at the (output) right edge properly. They just get transposed and - * not mirrored. - */ - MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_width = MCU_cols * compptr->h_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; - if (dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - dst_ptr = dst_buffer[offset_y] - [comp_width - dst_blk_x - offset_x - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - i++; - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } else { - /* Edge blocks are transposed but not mirrored. */ - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } - } - } - } -} - - -LOCAL(void) -do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* 270 degree rotation is equivalent to - * 1. Horizontal mirroring; - * 2. Transposing the image. - * These two steps are merged into a single processing routine. - */ -{ - JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; - int ci, i, j, offset_x, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - /* Because of the horizontal mirror step, we can't process partial iMCUs - * at the (output) bottom edge properly. They just get transposed and - * not mirrored. - */ - MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_height = MCU_rows * compptr->v_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - if (dst_blk_y < comp_height) { - /* Block is within the mirrorable area. */ - src_ptr = src_buffer[offset_x] - [comp_height - dst_blk_y - offset_y - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } - } else { - /* Edge blocks are transposed but not mirrored. */ - src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } - } - } - } -} - - -LOCAL(void) -do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* 180 degree rotation is equivalent to - * 1. Vertical mirroring; - * 2. Horizontal mirroring. - * These two steps are merged into a single processing routine. - */ -{ - JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; - int ci, i, j, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JBLOCKROW src_row_ptr, dst_row_ptr; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); - MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_width = MCU_cols * compptr->h_samp_factor; - comp_height = MCU_rows * compptr->v_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - if (dst_blk_y < comp_height) { - /* Row is within the vertically mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } else { - /* Bottom-edge rows are only mirrored horizontally. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, FALSE); - } - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - if (dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - dst_row_ptr = dst_buffer[offset_y]; - src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; - /* Process the blocks that can be mirrored both ways. */ - for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; - for (i = 0; i < DCTSIZE; i += 2) { - /* For even row, negate every odd column. */ - for (j = 0; j < DCTSIZE; j += 2) { - *dst_ptr++ = *src_ptr++; - *dst_ptr++ = - *src_ptr++; - } - /* For odd row, negate every even column. */ - for (j = 0; j < DCTSIZE; j += 2) { - *dst_ptr++ = - *src_ptr++; - *dst_ptr++ = *src_ptr++; - } - } - } - /* Any remaining right-edge blocks are only mirrored vertically. */ - for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[dst_blk_x]; - for (i = 0; i < DCTSIZE; i += 2) { - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = *src_ptr++; - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = - *src_ptr++; - } - } - } else { - /* Remaining rows are just mirrored horizontally. */ - dst_row_ptr = dst_buffer[offset_y]; - src_row_ptr = src_buffer[offset_y]; - /* Process the blocks that can be mirrored. */ - for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[comp_width - dst_blk_x - 1]; - for (i = 0; i < DCTSIZE2; i += 2) { - *dst_ptr++ = *src_ptr++; - *dst_ptr++ = - *src_ptr++; - } - } - /* Any remaining right-edge blocks are only copied. */ - for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[dst_blk_x]; - for (i = 0; i < DCTSIZE2; i++) - *dst_ptr++ = *src_ptr++; - } - } - } - } - } -} - - -LOCAL(void) -do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) -/* Transverse transpose is equivalent to - * 1. 180 degree rotation; - * 2. Transposition; - * or - * 1. Horizontal mirroring; - * 2. Transposition; - * 3. Horizontal mirroring. - * These steps are merged into a single processing routine. - */ -{ - JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y; - int ci, i, j, offset_x, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - JCOEFPTR src_ptr, dst_ptr; - jpeg_component_info *compptr; - - MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); - MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); - - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - comp_width = MCU_cols * compptr->h_samp_factor; - comp_height = MCU_rows * compptr->v_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - if (dst_blk_y < comp_height) { - src_ptr = src_buffer[offset_x] - [comp_height - dst_blk_y - offset_y - 1]; - if (dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - dst_ptr = dst_buffer[offset_y] - [comp_width - dst_blk_x - offset_x - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - i++; - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } else { - /* Right-edge blocks are mirrored in y only */ - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } - } - } else { - src_ptr = src_buffer[offset_x][dst_blk_y + offset_y]; - if (dst_blk_x < comp_width) { - /* Bottom-edge blocks are mirrored in x only */ - dst_ptr = dst_buffer[offset_y] - [comp_width - dst_blk_x - offset_x - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - i++; - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } else { - /* At lower right corner, just transpose, no mirroring */ - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } - } - } - } - } -} - - -/* Request any required workspace. - * - * We allocate the workspace virtual arrays from the source decompression - * object, so that all the arrays (both the original data and the workspace) - * will be taken into account while making memory management decisions. - * Hence, this routine must be called after jpeg_read_header (which reads - * the image dimensions) and before jpeg_read_coefficients (which realizes - * the source's virtual arrays). - */ - -GLOBAL(void) -jtransform_request_workspace (j_decompress_ptr srcinfo, - jpeg_transform_info *info) -{ - jvirt_barray_ptr *coef_arrays = NULL; - jpeg_component_info *compptr; - int ci; - - if (info->force_grayscale && - srcinfo->jpeg_color_space == JCS_YCbCr && - srcinfo->num_components == 3) { - /* We'll only process the first component */ - info->num_components = 1; - } else { - /* Process all the components */ - info->num_components = srcinfo->num_components; - } - - switch (info->transform) { - case JXFORM_NONE: - case JXFORM_FLIP_H: - /* Don't need a workspace array */ - break; - case JXFORM_FLIP_V: - case JXFORM_ROT_180: - /* Need workspace arrays having same dimensions as source image. - * Note that we allocate arrays padded out to the next iMCU boundary, - * so that transform routines need not worry about missing edge blocks. - */ - coef_arrays = (jvirt_barray_ptr *) - (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, - SIZEOF(jvirt_barray_ptr) * info->num_components); - for (ci = 0; ci < info->num_components; ci++) { - compptr = srcinfo->comp_info + ci; - coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) - ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) compptr->v_samp_factor); - } - break; - case JXFORM_TRANSPOSE: - case JXFORM_TRANSVERSE: - case JXFORM_ROT_90: - case JXFORM_ROT_270: - /* Need workspace arrays having transposed dimensions. - * Note that we allocate arrays padded out to the next iMCU boundary, - * so that transform routines need not worry about missing edge blocks. - */ - coef_arrays = (jvirt_barray_ptr *) - (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, - SIZEOF(jvirt_barray_ptr) * info->num_components); - for (ci = 0; ci < info->num_components; ci++) { - compptr = srcinfo->comp_info + ci; - coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) - ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) compptr->h_samp_factor); - } - break; - } - info->workspace_coef_arrays = coef_arrays; -} - - -/* Transpose destination image parameters */ - -LOCAL(void) -transpose_critical_parameters (j_compress_ptr dstinfo) -{ - int tblno, i, j, ci, itemp; - jpeg_component_info *compptr; - JQUANT_TBL *qtblptr; - JDIMENSION dtemp; - UINT16 qtemp; - - /* Transpose basic image dimensions */ - dtemp = dstinfo->image_width; - dstinfo->image_width = dstinfo->image_height; - dstinfo->image_height = dtemp; - - /* Transpose sampling factors */ - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; - itemp = compptr->h_samp_factor; - compptr->h_samp_factor = compptr->v_samp_factor; - compptr->v_samp_factor = itemp; - } - - /* Transpose quantization tables */ - for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { - qtblptr = dstinfo->quant_tbl_ptrs[tblno]; - if (qtblptr != NULL) { - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < i; j++) { - qtemp = qtblptr->quantval[i*DCTSIZE+j]; - qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i]; - qtblptr->quantval[j*DCTSIZE+i] = qtemp; - } - } - } - } -} - - -/* Trim off any partial iMCUs on the indicated destination edge */ - -LOCAL(void) -trim_right_edge (j_compress_ptr dstinfo) -{ - int ci, max_h_samp_factor; - JDIMENSION MCU_cols; - - /* We have to compute max_h_samp_factor ourselves, - * because it hasn't been set yet in the destination - * (and we don't want to use the source's value). - */ - max_h_samp_factor = 1; - for (ci = 0; ci < dstinfo->num_components; ci++) { - int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor; - max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor); - } - MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE); - if (MCU_cols > 0) /* can't trim to 0 pixels */ - dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE); -} - -LOCAL(void) -trim_bottom_edge (j_compress_ptr dstinfo) -{ - int ci, max_v_samp_factor; - JDIMENSION MCU_rows; - - /* We have to compute max_v_samp_factor ourselves, - * because it hasn't been set yet in the destination - * (and we don't want to use the source's value). - */ - max_v_samp_factor = 1; - for (ci = 0; ci < dstinfo->num_components; ci++) { - int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor; - max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor); - } - MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE); - if (MCU_rows > 0) /* can't trim to 0 pixels */ - dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE); -} - - -/* Adjust output image parameters as needed. - * - * This must be called after jpeg_copy_critical_parameters() - * and before jpeg_write_coefficients(). - * - * The return value is the set of virtual coefficient arrays to be written - * (either the ones allocated by jtransform_request_workspace, or the - * original source data arrays). The caller will need to pass this value - * to jpeg_write_coefficients(). - */ - -GLOBAL(jvirt_barray_ptr *) -jtransform_adjust_parameters (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info) -{ - /* If force-to-grayscale is requested, adjust destination parameters */ - if (info->force_grayscale) { - /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed - * properly. Among other things, the target h_samp_factor & v_samp_factor - * will get set to 1, which typically won't match the source. - * In fact we do this even if the source is already grayscale; that - * provides an easy way of coercing a grayscale JPEG with funny sampling - * factors to the customary 1,1. (Some decoders fail on other factors.) - */ - if ((dstinfo->jpeg_color_space == JCS_YCbCr && - dstinfo->num_components == 3) || - (dstinfo->jpeg_color_space == JCS_GRAYSCALE && - dstinfo->num_components == 1)) { - /* We have to preserve the source's quantization table number. */ - int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no; - jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE); - dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no; - } else { - /* Sorry, can't do it */ - ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL); - } - } - - /* Correct the destination's image dimensions etc if necessary */ - switch (info->transform) { - case JXFORM_NONE: - /* Nothing to do */ - break; - case JXFORM_FLIP_H: - if (info->trim) - trim_right_edge(dstinfo); - break; - case JXFORM_FLIP_V: - if (info->trim) - trim_bottom_edge(dstinfo); - break; - case JXFORM_TRANSPOSE: - transpose_critical_parameters(dstinfo); - /* transpose does NOT have to trim anything */ - break; - case JXFORM_TRANSVERSE: - transpose_critical_parameters(dstinfo); - if (info->trim) { - trim_right_edge(dstinfo); - trim_bottom_edge(dstinfo); - } - break; - case JXFORM_ROT_90: - transpose_critical_parameters(dstinfo); - if (info->trim) - trim_right_edge(dstinfo); - break; - case JXFORM_ROT_180: - if (info->trim) { - trim_right_edge(dstinfo); - trim_bottom_edge(dstinfo); - } - break; - case JXFORM_ROT_270: - transpose_critical_parameters(dstinfo); - if (info->trim) - trim_bottom_edge(dstinfo); - break; - } - - /* Return the appropriate output data set */ - if (info->workspace_coef_arrays != NULL) - return info->workspace_coef_arrays; - return src_coef_arrays; -} - - -/* Execute the actual transformation, if any. - * - * This must be called *after* jpeg_write_coefficients, because it depends - * on jpeg_write_coefficients to have computed subsidiary values such as - * the per-component width and height fields in the destination object. - * - * Note that some transformations will modify the source data arrays! - */ - -GLOBAL(void) -jtransform_execute_transformation (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info) -{ - jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays; - - switch (info->transform) { - case JXFORM_NONE: - break; - case JXFORM_FLIP_H: - do_flip_h(srcinfo, dstinfo, src_coef_arrays); - break; - case JXFORM_FLIP_V: - do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - case JXFORM_TRANSPOSE: - do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - case JXFORM_TRANSVERSE: - do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - case JXFORM_ROT_90: - do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - case JXFORM_ROT_180: - do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - case JXFORM_ROT_270: - do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays); - break; - } -} - -#endif /* TRANSFORMS_SUPPORTED */ - - -/* Setup decompression object to save desired markers in memory. - * This must be called before jpeg_read_header() to have the desired effect. - */ - -GLOBAL(void) -jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option) -{ -#ifdef SAVE_MARKERS_SUPPORTED - int m; - - /* Save comments except under NONE option */ - if (option != JCOPYOPT_NONE) { - jpeg_save_markers(srcinfo, JPEG_COM, 0xFFFF); - } - /* Save all types of APPn markers iff ALL option */ - if (option == JCOPYOPT_ALL) { - for (m = 0; m < 16; m++) - jpeg_save_markers(srcinfo, JPEG_APP0 + m, 0xFFFF); - } -#endif /* SAVE_MARKERS_SUPPORTED */ -} - -/* Copy markers saved in the given source object to the destination object. - * This should be called just after jpeg_start_compress() or - * jpeg_write_coefficients(). - * Note that those routines will have written the SOI, and also the - * JFIF APP0 or Adobe APP14 markers if selected. - */ - -GLOBAL(void) -jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JCOPY_OPTION option) -{ - jpeg_saved_marker_ptr marker; - - /* In the current implementation, we don't actually need to examine the - * option flag here; we just copy everything that got saved. - * But to avoid confusion, we do not output JFIF and Adobe APP14 markers - * if the encoder library already wrote one. - */ - for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) { - if (dstinfo->write_JFIF_header && - marker->marker == JPEG_APP0 && - marker->data_length >= 5 && - GETJOCTET(marker->data[0]) == 0x4A && - GETJOCTET(marker->data[1]) == 0x46 && - GETJOCTET(marker->data[2]) == 0x49 && - GETJOCTET(marker->data[3]) == 0x46 && - GETJOCTET(marker->data[4]) == 0) - continue; /* reject duplicate JFIF */ - if (dstinfo->write_Adobe_marker && - marker->marker == JPEG_APP0+14 && - marker->data_length >= 5 && - GETJOCTET(marker->data[0]) == 0x41 && - GETJOCTET(marker->data[1]) == 0x64 && - GETJOCTET(marker->data[2]) == 0x6F && - GETJOCTET(marker->data[3]) == 0x62 && - GETJOCTET(marker->data[4]) == 0x65) - continue; /* reject duplicate Adobe */ -#ifdef NEED_FAR_POINTERS - /* We could use jpeg_write_marker if the data weren't FAR... */ - { - unsigned int i; - jpeg_write_m_header(dstinfo, marker->marker, marker->data_length); - for (i = 0; i < marker->data_length; i++) - jpeg_write_m_byte(dstinfo, marker->data[i]); - } -#else - jpeg_write_marker(dstinfo, marker->marker, - marker->data, marker->data_length); -#endif - } -} diff --git a/transupp.h b/transupp.h deleted file mode 100644 index 5c2d32af..00000000 --- a/transupp.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * transupp.h - * - * Copyright (C) 1997, 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. - * - * This file contains declarations for image transformation routines and - * other utility code used by the jpegtran sample application. These are - * NOT part of the core JPEG library. But we keep these routines separate - * from jpegtran.c to ease the task of maintaining jpegtran-like programs - * that have other user interfaces. - * - * NOTE: all the routines declared here have very specific requirements - * about when they are to be executed during the reading and writing of the - * source and destination files. See the comments in transupp.c, or see - * jpegtran.c for an example of correct usage. - */ - -/* If you happen not to want the image transform support, disable it here */ -#ifndef TRANSFORMS_SUPPORTED -#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ -#endif - -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jtransform_request_workspace jTrRequest -#define jtransform_adjust_parameters jTrAdjust -#define jtransform_execute_transformation jTrExec -#define jcopy_markers_setup jCMrkSetup -#define jcopy_markers_execute jCMrkExec -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - -/* - * Codes for supported types of image transformations. - */ - -typedef enum { - JXFORM_NONE, /* no transformation */ - JXFORM_FLIP_H, /* horizontal flip */ - JXFORM_FLIP_V, /* vertical flip */ - JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ - JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ - JXFORM_ROT_90, /* 90-degree clockwise rotation */ - JXFORM_ROT_180, /* 180-degree rotation */ - JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ -} JXFORM_CODE; - -/* - * Although rotating and flipping data expressed as DCT coefficients is not - * hard, there is an asymmetry in the JPEG format specification for images - * whose dimensions aren't multiples of the iMCU size. The right and bottom - * image edges are padded out to the next iMCU boundary with junk data; but - * no padding is possible at the top and left edges. If we were to flip - * the whole image including the pad data, then pad garbage would become - * visible at the top and/or left, and real pixels would disappear into the - * pad margins --- perhaps permanently, since encoders & decoders may not - * bother to preserve DCT blocks that appear to be completely outside the - * nominal image area. So, we have to exclude any partial iMCUs from the - * basic transformation. - * - * Transpose is the only transformation that can handle partial iMCUs at the - * right and bottom edges completely cleanly. flip_h can flip partial iMCUs - * at the bottom, but leaves any partial iMCUs at the right edge untouched. - * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched. - * The other transforms are defined as combinations of these basic transforms - * and process edge blocks in a way that preserves the equivalence. - * - * The "trim" option causes untransformable partial iMCUs to be dropped; - * this is not strictly lossless, but it usually gives the best-looking - * result for odd-size images. Note that when this option is active, - * the expected mathematical equivalences between the transforms may not hold. - * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim - * followed by -rot 180 -trim trims both edges.) - * - * We also offer a "force to grayscale" option, which simply discards the - * chrominance channels of a YCbCr image. This is lossless in the sense that - * the luminance channel is preserved exactly. It's not the same kind of - * thing as the rotate/flip transformations, but it's convenient to handle it - * as part of this package, mainly because the transformation routines have to - * be aware of the option to know how many components to work on. - */ - -typedef struct { - /* Options: set by caller */ - JXFORM_CODE transform; /* image transform operator */ - boolean trim; /* if TRUE, trim partial MCUs as needed */ - boolean force_grayscale; /* if TRUE, convert color image to grayscale */ - - /* Internal workspace: caller should not touch these */ - int num_components; /* # of components in workspace */ - jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ -} jpeg_transform_info; - - -#if TRANSFORMS_SUPPORTED - -/* Request any required workspace */ -EXTERN(void) jtransform_request_workspace - JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); -/* Adjust output image parameters */ -EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); -/* Execute the actual transformation, if any */ -EXTERN(void) jtransform_execute_transformation - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); - -#endif /* TRANSFORMS_SUPPORTED */ - - -/* - * Support for copying optional markers from source to destination file. - */ - -typedef enum { - JCOPYOPT_NONE, /* copy no optional markers */ - JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ - JCOPYOPT_ALL /* copy all optional markers */ -} JCOPY_OPTION; - -#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ - -/* Setup decompression object to save desired markers in memory */ -EXTERN(void) jcopy_markers_setup - JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); -/* Copy markers saved in the given source object to the destination object */ -EXTERN(void) jcopy_markers_execute - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JCOPY_OPTION option)); diff --git a/usage.doc b/usage.doc deleted file mode 100644 index 8c4970af..00000000 --- a/usage.doc +++ /dev/null @@ -1,562 +0,0 @@ -USAGE instructions for the Independent JPEG Group's JPEG software -================================================================= - -This file describes usage of the JPEG conversion programs cjpeg and djpeg, -as well as the utility programs jpegtran, rdjpgcom and wrjpgcom. (See -the other documentation files if you wish to use the JPEG library within -your own programs.) - -If you are on a Unix machine you may prefer to read the Unix-style manual -pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1. - - -INTRODUCTION - -These programs implement JPEG image compression and decompression. JPEG -(pronounced "jay-peg") is a standardized compression method for full-color -and gray-scale images. JPEG is designed to handle "real-world" scenes, -for example scanned photographs. Cartoons, line drawings, and other -non-realistic images are not JPEG's strong suit; on that sort of material -you may get poor image quality and/or little compression. - -JPEG is lossy, meaning that the output image is not necessarily identical to -the input image. Hence you should not use JPEG if you have to have identical -output bits. However, on typical real-world images, very good compression -levels can be obtained with no visible change, and amazingly high compression -is possible if you can tolerate a low-quality image. You can trade off image -quality against file size by adjusting the compressor's "quality" setting. - - -GENERAL USAGE - -We provide two programs, cjpeg to compress an image file into JPEG format, -and djpeg to decompress a JPEG file back into a conventional image format. - -On Unix-like systems, you say: - cjpeg [switches] [imagefile] >jpegfile -or - djpeg [switches] [jpegfile] >imagefile -The programs read the specified input file, or standard input if none is -named. They always write to standard output (with trace/error messages to -standard error). These conventions are handy for piping images between -programs. - -On most non-Unix systems, you say: - cjpeg [switches] imagefile jpegfile -or - djpeg [switches] jpegfile imagefile -i.e., both the input and output files are named on the command line. This -style is a little more foolproof, and it loses no functionality if you don't -have pipes. (You can get this style on Unix too, if you prefer, by defining -TWO_FILE_COMMANDLINE when you compile the programs; see install.doc.) - -You can also say: - cjpeg [switches] -outfile jpegfile imagefile -or - djpeg [switches] -outfile imagefile jpegfile -This syntax works on all systems, so it is useful for scripts. - -The currently supported image file formats are: PPM (PBMPLUS color format), -PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit -format). (RLE is supported only if the URT library is available.) -cjpeg recognizes the input image format automatically, with the exception -of some Targa-format files. You have to tell djpeg which format to generate. - -JPEG files are in the defacto standard JFIF file format. There are other, -less widely used JPEG-based file formats, but we don't support them. - -All switch names may be abbreviated; for example, -grayscale may be written --gray or -gr. Most of the "basic" switches can be abbreviated to as little as -one letter. Upper and lower case are equivalent (-BMP is the same as -bmp). -British spellings are also accepted (e.g., -greyscale), though for brevity -these are not mentioned below. - - -CJPEG DETAILS - -The basic command line switches for cjpeg are: - - -quality N Scale quantization tables to adjust image quality. - Quality is 0 (worst) to 100 (best); default is 75. - (See below for more info.) - - -grayscale Create monochrome JPEG file from color input. - Be sure to use this switch when compressing a grayscale - BMP file, because cjpeg isn't bright enough to notice - whether a BMP file uses only shades of gray. By - saying -grayscale, you'll get a smaller JPEG file that - takes less time to process. - - -optimize Perform optimization of entropy encoding parameters. - Without this, default encoding parameters are used. - -optimize usually makes the JPEG file a little smaller, - but cjpeg runs somewhat slower and needs much more - memory. Image quality and speed of decompression are - unaffected by -optimize. - - -progressive Create progressive JPEG file (see below). - - -targa Input file is Targa format. Targa files that contain - an "identification" field will not be automatically - recognized by cjpeg; for such files you must specify - -targa to make cjpeg treat the input as Targa format. - For most Targa files, you won't need this switch. - -The -quality switch lets you trade off compressed file size against quality of -the reconstructed image: the higher the quality setting, the larger the JPEG -file, and the closer the output image will be to the original input. Normally -you want to use the lowest quality setting (smallest file) that decompresses -into something visually indistinguishable from the original image. For this -purpose the quality setting should be between 50 and 95; the default of 75 is -often about right. If you see defects at -quality 75, then go up 5 or 10 -counts at a time until you are happy with the output image. (The optimal -setting will vary from one image to another.) - --quality 100 will generate a quantization table of all 1's, minimizing loss -in the quantization step (but there is still information loss in subsampling, -as well as roundoff error). This setting is mainly of interest for -experimental purposes. Quality values above about 95 are NOT recommended for -normal use; the compressed file size goes up dramatically for hardly any gain -in output image quality. - -In the other direction, quality values below 50 will produce very small files -of low image quality. Settings around 5 to 10 might be useful in preparing an -index of a large image library, for example. Try -quality 2 (or so) for some -amusing Cubist effects. (Note: quality values below about 25 generate 2-byte -quantization tables, which are considered optional in the JPEG standard. -cjpeg emits a warning message when you give such a quality value, because some -other JPEG programs may be unable to decode the resulting file. Use -baseline -if you need to ensure compatibility at low quality values.) - -The -progressive switch creates a "progressive JPEG" file. In this type of -JPEG file, the data is stored in multiple scans of increasing quality. If the -file is being transmitted over a slow communications link, the decoder can use -the first scan to display a low-quality image very quickly, and can then -improve the display with each subsequent scan. The final image is exactly -equivalent to a standard JPEG file of the same quality setting, and the total -file size is about the same --- often a little smaller. CAUTION: progressive -JPEG is not yet widely implemented, so many decoders will be unable to view a -progressive JPEG file at all. - -Switches for advanced users: - - -dct int Use integer DCT method (default). - -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. - - -restart N Emit a JPEG restart marker every N MCU rows, or every - N MCU blocks if "B" is attached to the number. - -restart 0 (the default) means no restart markers. - - -smooth N Smooth the input image to eliminate dithering noise. - N, ranging from 1 to 100, indicates the strength of - smoothing. 0 (the default) means no smoothing. - - -maxmemory N Set limit for amount of memory to use in processing - large images. Value is in thousands of bytes, or - millions of bytes if "M" is attached to the number. - For example, -max 4m selects 4000000 bytes. If more - space is needed, temporary files will be used. - - -verbose Enable debug printout. More -v's give more printout. - or -debug Also, version information is printed at startup. - -The -restart option inserts extra markers that allow a JPEG decoder to -resynchronize after a transmission error. Without restart markers, any damage -to a compressed file will usually ruin the image from the point of the error -to the end of the image; with restart markers, the damage is usually confined -to the portion of the image up to the next restart marker. Of course, the -restart markers occupy extra space. We recommend -restart 1 for images that -will be transmitted across unreliable networks such as Usenet. - -The -smooth option filters the input to eliminate fine-scale noise. This is -often useful when converting dithered images to JPEG: a moderate smoothing -factor of 10 to 50 gets rid of dithering patterns in the input file, resulting -in a smaller JPEG file and a better-looking image. Too large a smoothing -factor will visibly blur the image, however. - -Switches for wizards: - - -baseline Force baseline-compatible quantization tables to be - generated. This clamps quantization values to 8 bits - even at low quality settings. (This switch is poorly - named, since it does not ensure that the output is - actually baseline JPEG. For example, you can use - -baseline and -progressive together.) - - -qtables file Use the quantization tables given in the specified - text file. - - -qslots N[,...] Select which quantization table to use for each color - component. - - -sample HxV[,...] Set JPEG sampling factors for each color component. - - -scans file Use the scan script given in the specified text file. - -The "wizard" switches are intended for experimentation with JPEG. If you -don't know what you are doing, DON'T USE THEM. These switches are documented -further in the file wizard.doc. - - -DJPEG DETAILS - -The basic command line switches for djpeg are: - - -colors N Reduce image to at most N colors. This reduces the - or -quantize N number of colors used in the output image, so that it - can be displayed on a colormapped display or stored in - a colormapped file format. For example, if you have - an 8-bit display, you'd need to reduce to 256 or fewer - colors. (-colors is the recommended name, -quantize - is provided only for backwards compatibility.) - - -fast Select recommended processing options for fast, low - quality output. (The default options are chosen for - highest quality output.) Currently, this is equivalent - to "-dct fast -nosmooth -onepass -dither ordered". - - -grayscale Force gray-scale output even if JPEG file is color. - Useful for viewing on monochrome displays; also, - djpeg runs noticeably faster in this mode. - - -scale M/N Scale the output image by a factor M/N. Currently - the scale factor must be 1/1, 1/2, 1/4, or 1/8. - Scaling is handy if the image is larger than your - screen; also, djpeg runs much faster when scaling - down the output. - - -bmp Select BMP output format (Windows flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; - otherwise, 24-bit full-color format is emitted. - - -gif Select GIF output format. Since GIF does not support - more than 256 colors, -colors 256 is assumed (unless - you specify a smaller number of colors). If you - specify -fast, the default number of colors is 216. - - -os2 Select BMP output format (OS/2 1.x flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; - otherwise, 24-bit full-color format is emitted. - - -pnm Select PBMPLUS (PPM/PGM) output format (this is the - default format). PGM is emitted if the JPEG file is - gray-scale or if -grayscale is specified; otherwise - PPM is emitted. - - -rle Select RLE output format. (Requires URT library.) - - -targa Select Targa output format. Gray-scale format is - emitted if the JPEG file is gray-scale or if - -grayscale is specified; otherwise, colormapped format - is emitted if -colors is specified; otherwise, 24-bit - full-color format is emitted. - -Switches for advanced users: - - -dct int Use integer DCT method (default). - -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. - - -dither fs Use Floyd-Steinberg dithering in color quantization. - -dither ordered Use ordered dithering in color quantization. - -dither none Do not use dithering in color quantization. - By default, Floyd-Steinberg dithering is applied when - quantizing colors; this is slow but usually produces - the best results. Ordered dither is a compromise - between speed and quality; no dithering is fast but - usually looks awful. Note that these switches have - no effect unless color quantization is being done. - Ordered dither is only available in -onepass mode. - - -map FILE Quantize to the colors used in the specified image - file. This is useful for producing multiple files - with identical color maps, or for forcing a predefined - set of colors to be used. The FILE must be a GIF - or PPM file. This option overrides -colors and - -onepass. - - -nosmooth Use a faster, lower-quality upsampling routine. - - -onepass Use one-pass instead of two-pass color quantization. - The one-pass method is faster and needs less memory, - but it produces a lower-quality image. -onepass is - ignored unless you also say -colors N. Also, - the one-pass method is always used for gray-scale - output (the two-pass method is no improvement then). - - -maxmemory N Set limit for amount of memory to use in processing - large images. Value is in thousands of bytes, or - millions of bytes if "M" is attached to the number. - For example, -max 4m selects 4000000 bytes. If more - space is needed, temporary files will be used. - - -verbose Enable debug printout. More -v's give more printout. - or -debug Also, version information is printed at startup. - - -HINTS FOR CJPEG - -Color GIF files are not the ideal input for JPEG; JPEG is really intended for -compressing full-color (24-bit) images. In particular, don't try to convert -cartoons, line drawings, and other images that have only a few distinct -colors. GIF works great on these, JPEG does not. If you want to convert a -GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options -to get a satisfactory conversion. -smooth 10 or so is often helpful. - -Avoid running an image through a series of JPEG compression/decompression -cycles. Image quality loss will accumulate; after ten or so cycles the image -may be noticeably worse than it was after one cycle. It's best to use a -lossless format while manipulating an image, then convert to JPEG format when -you are ready to file the image away. - -The -optimize option to cjpeg is worth using when you are making a "final" -version for posting or archiving. It's also a win when you are using low -quality settings to make very small JPEG files; the percentage improvement -is often a lot more than it is on larger files. (At present, -optimize -mode is always selected when generating progressive JPEG files.) - -GIF input files are no longer supported, to avoid the Unisys LZW patent. -Use a Unisys-licensed program if you need to read a GIF file. (Conversion -of GIF files to JPEG is usually a bad idea anyway.) - - -HINTS FOR DJPEG - -To get a quick preview of an image, use the -grayscale and/or -scale switches. -"-grayscale -scale 1/8" is the fastest case. - -Several options are available that trade off image quality to gain speed. -"-fast" turns on the recommended settings. - -"-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality. -When producing a color-quantized image, "-onepass -dither ordered" is fast but -much lower quality than the default behavior. "-dither none" may give -acceptable results in two-pass mode, but is seldom tolerable in one-pass mode. - -If you are fortunate enough to have very fast floating point hardware, -"-dct float" may be even faster than "-dct fast". But on most machines -"-dct float" is slower than "-dct int"; in this case it is not worth using, -because its theoretical accuracy advantage is too small to be significant -in practice. - -Two-pass color quantization requires a good deal of memory; on MS-DOS machines -it may run out of memory even with -maxmemory 0. In that case you can still -decompress, with some loss of image quality, by specifying -onepass for -one-pass quantization. - -To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These -are larger than they should be, but are readable by standard GIF decoders. - - -HINTS FOR BOTH PROGRAMS - -If more space is needed than will fit in the available main memory (as -determined by -maxmemory), temporary files will be used. (MS-DOS versions -will try to get extended or expanded memory first.) The temporary files are -often rather large: in typical cases they occupy three bytes per pixel, for -example 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough -free disk space, leave out -progressive and -optimize (for cjpeg) or specify --onepass (for djpeg). - -On MS-DOS, the temporary files are created in the directory named by the TMP -or TEMP environment variable, or in the current directory if neither of those -exist. Amiga implementations put the temp files in the directory named by -JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free -space. - -The default memory usage limit (-maxmemory) is set when the software is -compiled. If you get an "insufficient memory" error, try specifying a smaller --maxmemory value, even -maxmemory 0 to use the absolute minimum space. You -may want to recompile with a smaller default value if this happens often. - -On machines that have "environment" variables, you can define the environment -variable JPEGMEM to set the default memory limit. The value is specified as -described for the -maxmemory switch. JPEGMEM overrides the default value -specified when the program was compiled, and itself is overridden by an -explicit -maxmemory switch. - -On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to -use. (Extended or expanded memory is also used if available.) Most -DOS-specific versions of this software do their own memory space estimation -and do not need you to specify -maxmemory. - - -JPEGTRAN - -jpegtran performs various useful transformations of JPEG files. -It can translate the coded representation from one variant of JPEG to another, -for example from baseline JPEG to progressive JPEG or vice versa. It can also -perform some rearrangements of the image data, for example turning an image -from landscape to portrait format by rotation. - -jpegtran works by rearranging the compressed data (DCT coefficients), without -ever fully decoding the image. Therefore, its transformations are lossless: -there is no image degradation at all, which would not be true if you used -djpeg followed by cjpeg to accomplish the same conversion. But by the same -token, jpegtran cannot perform lossy operations such as changing the image -quality. - -jpegtran uses a command line syntax similar to cjpeg or djpeg. -On Unix-like systems, you say: - jpegtran [switches] [inputfile] >outputfile -On most non-Unix systems, you say: - jpegtran [switches] inputfile outputfile -where both the input and output files are JPEG files. - -To specify the coded JPEG representation used in the output file, -jpegtran accepts a subset of the switches recognized by cjpeg: - -optimize Perform optimization of entropy encoding parameters. - -progressive Create progressive JPEG file. - -restart N Emit a JPEG restart marker every N MCU rows, or every - N MCU blocks if "B" is attached to the number. - -scans file Use the scan script given in the specified text file. -See the previous discussion of cjpeg for more details about these switches. -If you specify none of these switches, you get a plain baseline-JPEG output -file. The quality setting and so forth are determined by the input file. - -The image can be losslessly transformed by giving one of these switches: - -flip horizontal Mirror image horizontally (left-right). - -flip vertical Mirror image vertically (top-bottom). - -rotate 90 Rotate image 90 degrees clockwise. - -rotate 180 Rotate image 180 degrees. - -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw). - -transpose Transpose image (across UL-to-LR axis). - -transverse Transverse transpose (across UR-to-LL axis). - -The transpose transformation has no restrictions regarding image dimensions. -The other transformations operate rather oddly if the image dimensions are not -a multiple of the iMCU size (usually 8 or 16 pixels), because they can only -transform complete blocks of DCT coefficient data in the desired way. - -jpegtran's default behavior when transforming an odd-size image is designed -to preserve exact reversibility and mathematical consistency of the -transformation set. As stated, transpose is able to flip the entire image -area. Horizontal mirroring leaves any partial iMCU column at the right edge -untouched, but is able to flip all rows of the image. Similarly, vertical -mirroring leaves any partial iMCU row at the bottom edge untouched, but is -able to flip all columns. The other transforms can be built up as sequences -of transpose and flip operations; for consistency, their actions on edge -pixels are defined to be the same as the end result of the corresponding -transpose-and-flip sequence. - -For practical use, you may prefer to discard any untransformable edge pixels -rather than having a strange-looking strip along the right and/or bottom edges -of a transformed image. To do this, add the -trim switch: - -trim Drop non-transformable edge blocks. -Obviously, a transformation with -trim is not reversible, so strictly speaking -jpegtran with this switch is not lossless. Also, the expected mathematical -equivalences between the transformations no longer hold. For example, -"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by -"-rot 180 -trim" trims both edges. - -Another not-strictly-lossless transformation switch is: - -grayscale Force grayscale output. -This option discards the chrominance channels if the input image is YCbCr -(ie, a standard color JPEG), resulting in a grayscale JPEG file. The -luminance channel is preserved exactly, so this is a better method of reducing -to grayscale than decompression, conversion, and recompression. This switch -is particularly handy for fixing a monochrome picture that was mistakenly -encoded as a color JPEG. (In such a case, the space savings from getting rid -of the near-empty chroma channels won't be large; but the decoding time for -a grayscale JPEG is substantially less than that for a color JPEG.) - -jpegtran also recognizes these switches that control what to do with "extra" -markers, such as comment blocks: - -copy none Copy no extra markers from source file. This setting - suppresses all comments and other excess baggage - present in the source file. - -copy comments Copy only comment markers. This setting copies - comments from the source file, but discards - any other inessential data. - -copy all Copy all extra markers. This setting preserves - miscellaneous markers found in the source file, such - as JFIF thumbnails and Photoshop settings. In some - files these extra markers can be sizable. -The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, -jpegtran always did the equivalent of -copy none.) - -Additional switches recognized by jpegtran are: - -outfile filename - -maxmemory N - -verbose - -debug -These work the same as in cjpeg or djpeg. - - -THE COMMENT UTILITIES - -The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. -Although the standard doesn't actually define what COM blocks are for, they -are widely used to hold user-supplied text strings. This lets you add -annotations, titles, index terms, etc to your JPEG files, and later retrieve -them as text. COM blocks do not interfere with the image stored in the JPEG -file. The maximum size of a COM block is 64K, but you can have as many of -them as you like in one JPEG file. - -We provide two utility programs to display COM block contents and add COM -blocks to a JPEG file. - -rdjpgcom searches a JPEG file and prints the contents of any COM blocks on -standard output. The command line syntax is - rdjpgcom [-verbose] [inputfilename] -The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG -image dimensions. If you omit the input file name from the command line, -the JPEG file is read from standard input. (This may not work on some -operating systems, if binary data can't be read from stdin.) - -wrjpgcom adds a COM block, containing text you provide, to a JPEG file. -Ordinarily, the COM block is added after any existing COM blocks, but you -can delete the old COM blocks if you wish. wrjpgcom produces a new JPEG -file; it does not modify the input file. DO NOT try to overwrite the input -file by directing wrjpgcom's output back into it; on most systems this will -just destroy your file. - -The command line syntax for wrjpgcom is similar to cjpeg's. On Unix-like -systems, it is - wrjpgcom [switches] [inputfilename] -The output file is written to standard output. The input file comes from -the named file, or from standard input if no input file is named. - -On most non-Unix systems, the syntax is - wrjpgcom [switches] inputfilename outputfilename -where both input and output file names must be given explicitly. - -wrjpgcom understands three switches: - -replace Delete any existing COM blocks from the file. - -comment "Comment text" Supply new COM text on command line. - -cfile name Read text for new COM block from named file. -(Switch names can be abbreviated.) If you have only one line of comment text -to add, you can provide it on the command line with -comment. The comment -text must be surrounded with quotes so that it is treated as a single -argument. Longer comments can be read from a text file. - -If you give neither -comment nor -cfile, then wrjpgcom will read the comment -text from standard input. (In this case an input image file name MUST be -supplied, so that the source JPEG file comes from somewhere else.) You can -enter multiple lines, up to 64KB worth. Type an end-of-file indicator -(usually control-D or control-Z) to terminate the comment text entry. - -wrjpgcom will not add a COM block if the provided comment string is empty. -Therefore -replace -comment "" can be used to delete all COM blocks from a -file. - -These utility programs do not depend on the IJG JPEG library. In -particular, the source code for rdjpgcom is intended as an illustration of -the minimum amount of code required to parse a JPEG file header correctly. diff --git a/wizard.doc b/wizard.doc deleted file mode 100644 index 54170b22..00000000 --- a/wizard.doc +++ /dev/null @@ -1,211 +0,0 @@ -Advanced usage instructions for the Independent JPEG Group's JPEG software -========================================================================== - -This file describes cjpeg's "switches for wizards". - -The "wizard" switches are intended for experimentation with JPEG by persons -who are reasonably knowledgeable about the JPEG standard. If you don't know -what you are doing, DON'T USE THESE SWITCHES. You'll likely produce files -with worse image quality and/or poorer compression than you'd get from the -default settings. Furthermore, these switches must be used with caution -when making files intended for general use, because not all JPEG decoders -will support unusual JPEG parameter settings. - - -Quantization Table Adjustment ------------------------------ - -Ordinarily, cjpeg starts with a default set of tables (the same ones given -as examples in the JPEG standard) and scales them up or down according to -the -quality setting. The details of the scaling algorithm can be found in -jcparam.c. At very low quality settings, some quantization table entries -can get scaled up to values exceeding 255. Although 2-byte quantization -values are supported by the IJG software, this feature is not in baseline -JPEG and is not supported by all implementations. If you need to ensure -wide compatibility of low-quality files, you can constrain the scaled -quantization values to no more than 255 by giving the -baseline switch. -Note that use of -baseline will result in poorer quality for the same file -size, since more bits than necessary are expended on higher AC coefficients. - -You can substitute a different set of quantization values by using the --qtables switch: - - -qtables file Use the quantization tables given in the named file. - -The specified file should be a text file containing decimal quantization -values. The file should contain one to four tables, each of 64 elements. -The tables are implicitly numbered 0,1,etc. in order of appearance. Table -entries appear in normal array order (NOT in the zigzag order in which they -will be stored in the JPEG file). - -Quantization table files are free format, in that arbitrary whitespace can -appear between numbers. Also, comments can be included: a comment starts -with '#' and extends to the end of the line. Here is an example file that -duplicates the default quantization tables: - - # Quantization tables given in JPEG spec, section K.1 - - # This is table 0 (the luminance table): - 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 - - # This is table 1 (the chrominance table): - 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 - -If the -qtables switch is used without -quality, then the specified tables -are used exactly as-is. If both -qtables and -quality are used, then the -tables taken from the file are scaled in the same fashion that the default -tables would be scaled for that quality setting. If -baseline appears, then -the quantization values are constrained to the range 1-255. - -By default, cjpeg will use quantization table 0 for luminance components and -table 1 for chrominance components. To override this choice, use the -qslots -switch: - - -qslots N[,...] Select which quantization table to use for - each color component. - -The -qslots switch specifies a quantization table number for each color -component, in the order in which the components appear in the JPEG SOF marker. -For example, to create a separate table for each of Y,Cb,Cr, you could -provide a -qtables file that defines three quantization tables and say -"-qslots 0,1,2". If -qslots gives fewer table numbers than there are color -components, then the last table number is repeated as necessary. - - -Sampling Factor Adjustment --------------------------- - -By default, cjpeg uses 2:1 horizontal and vertical downsampling when -compressing YCbCr data, and no downsampling for all other color spaces. -You can override this default with the -sample switch: - - -sample HxV[,...] Set JPEG sampling factors for each color - component. - -The -sample switch specifies the JPEG sampling factors for each color -component, in the order in which they appear in the JPEG SOF marker. -If you specify fewer HxV pairs than there are components, the remaining -components are set to 1x1 sampling. For example, the default YCbCr setting -is equivalent to "-sample 2x2,1x1,1x1", which can be abbreviated to -"-sample 2x2". - -There are still some JPEG decoders in existence that support only 2x1 -sampling (also called 4:2:2 sampling). Compatibility with such decoders can -be achieved by specifying "-sample 2x1". This is not recommended unless -really necessary, since it increases file size and encoding/decoding time -with very little quality gain. - - -Multiple Scan / Progression Control ------------------------------------ - -By default, cjpeg emits a single-scan sequential JPEG file. The --progressive switch generates a progressive JPEG file using a default series -of progression parameters. You can create multiple-scan sequential JPEG -files or progressive JPEG files with custom progression parameters by using -the -scans switch: - - -scans file Use the scan sequence given in the named file. - -The specified file should be a text file containing a "scan script". -The script specifies the contents and ordering of the scans to be emitted. -Each entry in the script defines one scan. A scan definition specifies -the components to be included in the scan, and for progressive JPEG it also -specifies the progression parameters Ss,Se,Ah,Al for the scan. Scan -definitions are separated by semicolons (';'). A semicolon after the last -scan definition is optional. - -Each scan definition contains one to four component indexes, optionally -followed by a colon (':') and the four progressive-JPEG parameters. The -component indexes denote which color component(s) are to be transmitted in -the scan. Components are numbered in the order in which they appear in the -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.) - -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 -comment starts with '#' and extends to the end of the line. For additional -legibility, commas or dashes can be placed between values. (Actually, any -single punctuation character other than ':' or ';' can be inserted.) For -example, the following two scan definitions are equivalent: - 0 1 2: 0 63 0 0; - 0,1,2 : 0-63, 0,0 ; - -Here is an example of a scan script that generates a partially interleaved -sequential JPEG file: - - 0; # Y only in first scan - 1 2; # Cb and Cr in second scan - -Here is an example of a progressive scan script using only spectral selection -(no successive approximation): - - # Interleaved DC scan for Y,Cb,Cr: - 0,1,2: 0-0, 0, 0 ; - # AC scans: - 0: 1-2, 0, 0 ; # First two Y AC coefficients - 0: 3-5, 0, 0 ; # Three more - 1: 1-63, 0, 0 ; # All AC coefficients for Cb - 2: 1-63, 0, 0 ; # All AC coefficients for Cr - 0: 6-9, 0, 0 ; # More Y coefficients - 0: 10-63, 0, 0 ; # Remaining Y coefficients - -Here is an example of a successive-approximation script. This is equivalent -to the default script used by "cjpeg -progressive" for YCbCr images: - - # Initial DC scan for Y,Cb,Cr (lowest bit not sent) - 0,1,2: 0-0, 0, 1 ; - # First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits: - 0: 1-5, 0, 2 ; - # Send all Cr,Cb AC coefficients, minus lowest bit: - # (chroma data is usually too small to be worth subdividing further; - # but note we send Cr first since eye is least sensitive to Cb) - 2: 1-63, 0, 1 ; - 1: 1-63, 0, 1 ; - # Send remaining Y AC coefficients, minus 2 lowest bits: - 0: 6-63, 0, 2 ; - # Send next-to-lowest bit of all Y AC coefficients: - 0: 1-63, 2, 1 ; - # At this point we've sent all but the lowest bit of all coefficients. - # Send lowest bit of DC coefficients - 0,1,2: 0-0, 1, 0 ; - # Send lowest bit of AC coefficients - 2: 1-63, 1, 0 ; - 1: 1-63, 1, 0 ; - # Y AC lowest bit scan is last; it's usually the largest scan - 0: 1-63, 1, 0 ; - -It may be worth pointing out that this script is tuned for quality settings -of around 50 to 75. For lower quality settings, you'd probably want to use -a script with fewer stages of successive approximation (otherwise the -initial scans will be really bad). For higher quality settings, you might -want to use more stages of successive approximation (so that the initial -scans are not too large). diff --git a/wrbmp.c b/wrbmp.c deleted file mode 100644 index 3283b0f1..00000000 --- a/wrbmp.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * wrbmp.c - * - * 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. - * - * This file contains routines to write output images in Microsoft "BMP" - * format (MS Windows 3.x and OS/2 1.x flavors). - * Either 8-bit colormapped or 24-bit full-color format can be written. - * No compression is supported. - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume output to - * an ordinary stdio stream. - * - * This code contributed by James Arthur Boucher. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef BMP_SUPPORTED - - -/* - * To support 12-bit JPEG data, we'd have to scale output down to 8 bits. - * This is not yet implemented. - */ - -#if BITS_IN_JSAMPLE != 8 - Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ -#endif - -/* - * Since BMP stores scanlines bottom-to-top, we have to invert the image - * from JPEG's top-to-bottom order. To do this, we save the outgoing data - * in a virtual array during put_pixel_row calls, then actually emit the - * BMP file during finish_output. The virtual array contains one JSAMPLE per - * pixel if the output is grayscale or colormapped, three if it is full color. - */ - -/* Private version of data destination object */ - -typedef struct { - struct djpeg_dest_struct pub; /* public fields */ - - boolean is_os2; /* saves the OS2 format request flag */ - - jvirt_sarray_ptr whole_image; /* needed to reverse row order */ - JDIMENSION data_width; /* JSAMPLEs per row */ - JDIMENSION row_width; /* physical width of one row in the BMP file */ - int pad_bytes; /* number of padding bytes needed per row */ - JDIMENSION cur_output_row; /* next row# to write to virtual array */ -} bmp_dest_struct; - -typedef bmp_dest_struct * bmp_dest_ptr; - - -/* Forward declarations */ -LOCAL(void) write_colormap - JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, - int map_colors, int map_entry_size)); - - -/* - * Write some pixel data. - * In this module rows_supplied will always be 1. - */ - -METHODDEF(void) -put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -/* This version is for writing 24-bit pixels */ -{ - bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; - JSAMPARRAY image_ptr; - register JSAMPROW inptr, outptr; - register JDIMENSION col; - int pad; - - /* Access next row in virtual array */ - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->whole_image, - dest->cur_output_row, (JDIMENSION) 1, TRUE); - dest->cur_output_row++; - - /* Transfer data. Note destination values must be in BGR order - * (even though Microsoft's own documents say the opposite). - */ - inptr = dest->pub.buffer[0]; - outptr = image_ptr[0]; - for (col = cinfo->output_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ - outptr[1] = *inptr++; - outptr[0] = *inptr++; - outptr += 3; - } - - /* Zero out the pad bytes. */ - pad = dest->pad_bytes; - while (--pad >= 0) - *outptr++ = 0; -} - -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 */ -{ - bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; - JSAMPARRAY image_ptr; - register JSAMPROW inptr, outptr; - register JDIMENSION col; - int pad; - - /* Access next row in virtual array */ - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->whole_image, - dest->cur_output_row, (JDIMENSION) 1, TRUE); - dest->cur_output_row++; - - /* Transfer data. */ - inptr = dest->pub.buffer[0]; - outptr = image_ptr[0]; - for (col = cinfo->output_width; col > 0; col--) { - *outptr++ = *inptr++; /* can omit GETJSAMPLE() safely */ - } - - /* Zero out the pad bytes. */ - pad = dest->pad_bytes; - while (--pad >= 0) - *outptr++ = 0; -} - - -/* - * Startup: normally writes the file header. - * In this module we may as well postpone everything until finish_output. - */ - -METHODDEF(void) -start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - /* no work here */ -} - - -/* - * Finish up at the end of the file. - * - * Here is where we really output the BMP file. - * - * First, routines to write the Windows and OS/2 variants of the file header. - */ - -LOCAL(void) -write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) -/* Write a Windows-style BMP file header, including colormap if needed */ -{ - char bmpfileheader[14]; - char bmpinfoheader[40]; -#define PUT_2B(array,offset,value) \ - (array[offset] = (char) ((value) & 0xFF), \ - array[offset+1] = (char) (((value) >> 8) & 0xFF)) -#define PUT_4B(array,offset,value) \ - (array[offset] = (char) ((value) & 0xFF), \ - array[offset+1] = (char) (((value) >> 8) & 0xFF), \ - array[offset+2] = (char) (((value) >> 16) & 0xFF), \ - array[offset+3] = (char) (((value) >> 24) & 0xFF)) - INT32 headersize, bfSize; - int bits_per_pixel, cmap_entries; - - /* Compute colormap size and total file size */ - if (cinfo->out_color_space == JCS_RGB) { - if (cinfo->quantize_colors) { - /* Colormapped RGB */ - bits_per_pixel = 8; - cmap_entries = 256; - } else { - /* Unquantized, full color RGB */ - bits_per_pixel = 24; - cmap_entries = 0; - } - } else { - /* Grayscale output. We need to fake a 256-entry colormap. */ - bits_per_pixel = 8; - cmap_entries = 256; - } - /* File size */ - headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */ - bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; - - /* Set unused fields of header to 0 */ - MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); - MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader)); - - /* Fill the file header */ - bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ - bmpfileheader[1] = 0x4D; - PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ - /* we leave bfReserved1 & bfReserved2 = 0 */ - PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ - - /* Fill the info header (Microsoft calls this a BITMAPINFOHEADER) */ - PUT_2B(bmpinfoheader, 0, 40); /* biSize */ - PUT_4B(bmpinfoheader, 4, cinfo->output_width); /* biWidth */ - PUT_4B(bmpinfoheader, 8, cinfo->output_height); /* biHeight */ - PUT_2B(bmpinfoheader, 12, 1); /* biPlanes - must be 1 */ - PUT_2B(bmpinfoheader, 14, bits_per_pixel); /* biBitCount */ - /* we leave biCompression = 0, for none */ - /* we leave biSizeImage = 0; this is correct for uncompressed data */ - if (cinfo->density_unit == 2) { /* if have density in dots/cm, then */ - PUT_4B(bmpinfoheader, 24, (INT32) (cinfo->X_density*100)); /* XPels/M */ - PUT_4B(bmpinfoheader, 28, (INT32) (cinfo->Y_density*100)); /* XPels/M */ - } - PUT_2B(bmpinfoheader, 32, cmap_entries); /* biClrUsed */ - /* we leave biClrImportant = 0 */ - - if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14) - ERREXIT(cinfo, JERR_FILE_WRITE); - if (JFWRITE(dest->pub.output_file, bmpinfoheader, 40) != (size_t) 40) - ERREXIT(cinfo, JERR_FILE_WRITE); - - if (cmap_entries > 0) - write_colormap(cinfo, dest, cmap_entries, 4); -} - - -LOCAL(void) -write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) -/* Write an OS2-style BMP file header, including colormap if needed */ -{ - char bmpfileheader[14]; - char bmpcoreheader[12]; - INT32 headersize, bfSize; - int bits_per_pixel, cmap_entries; - - /* Compute colormap size and total file size */ - if (cinfo->out_color_space == JCS_RGB) { - if (cinfo->quantize_colors) { - /* Colormapped RGB */ - bits_per_pixel = 8; - cmap_entries = 256; - } else { - /* Unquantized, full color RGB */ - bits_per_pixel = 24; - cmap_entries = 0; - } - } else { - /* Grayscale output. We need to fake a 256-entry colormap. */ - bits_per_pixel = 8; - cmap_entries = 256; - } - /* File size */ - headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */ - bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; - - /* Set unused fields of header to 0 */ - MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); - MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader)); - - /* Fill the file header */ - bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ - bmpfileheader[1] = 0x4D; - PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ - /* we leave bfReserved1 & bfReserved2 = 0 */ - PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ - - /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */ - PUT_2B(bmpcoreheader, 0, 12); /* bcSize */ - PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */ - PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */ - PUT_2B(bmpcoreheader, 8, 1); /* bcPlanes - must be 1 */ - PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */ - - if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14) - ERREXIT(cinfo, JERR_FILE_WRITE); - if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12) - ERREXIT(cinfo, JERR_FILE_WRITE); - - if (cmap_entries > 0) - write_colormap(cinfo, dest, cmap_entries, 3); -} - - -/* - * Write the colormap. - * Windows uses BGR0 map entries; OS/2 uses BGR entries. - */ - -LOCAL(void) -write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, - int map_colors, int map_entry_size) -{ - JSAMPARRAY colormap = cinfo->colormap; - int num_colors = cinfo->actual_number_of_colors; - FILE * outfile = dest->pub.output_file; - int i; - - if (colormap != NULL) { - if (cinfo->out_color_components == 3) { - /* Normal case with RGB colormap */ - for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(colormap[2][i]), outfile); - putc(GETJSAMPLE(colormap[1][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - if (map_entry_size == 4) - putc(0, outfile); - } - } else { - /* Grayscale colormap (only happens with grayscale quantization) */ - for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(colormap[0][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - if (map_entry_size == 4) - putc(0, outfile); - } - } - } else { - /* If no colormap, must be grayscale data. Generate a linear "map". */ - for (i = 0; i < 256; i++) { - putc(i, outfile); - putc(i, outfile); - putc(i, outfile); - if (map_entry_size == 4) - putc(0, outfile); - } - } - /* Pad colormap with zeros to ensure specified number of colormap entries */ - if (i > map_colors) - ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, i); - for (; i < map_colors; i++) { - putc(0, outfile); - putc(0, outfile); - putc(0, outfile); - if (map_entry_size == 4) - putc(0, outfile); - } -} - - -METHODDEF(void) -finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; - register FILE * outfile = dest->pub.output_file; - JSAMPARRAY image_ptr; - register JSAMPROW data_ptr; - JDIMENSION row; - register JDIMENSION col; - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - - /* Write the header and colormap */ - if (dest->is_os2) - write_os2_header(cinfo, dest); - else - write_bmp_header(cinfo, dest); - - /* Write the file body from our virtual array */ - for (row = cinfo->output_height; row > 0; row--) { - if (progress != NULL) { - progress->pub.pass_counter = (long) (cinfo->output_height - row); - progress->pub.pass_limit = (long) cinfo->output_height; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } - image_ptr = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->whole_image, row-1, (JDIMENSION) 1, FALSE); - data_ptr = image_ptr[0]; - for (col = dest->row_width; col > 0; col--) { - putc(GETJSAMPLE(*data_ptr), outfile); - data_ptr++; - } - } - if (progress != NULL) - progress->completed_extra_passes++; - - /* Make sure we wrote the output file OK */ - fflush(outfile); - if (ferror(outfile)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * The module selection routine for BMP format output. - */ - -GLOBAL(djpeg_dest_ptr) -jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) -{ - bmp_dest_ptr dest; - JDIMENSION row_width; - - /* Create module interface object, fill in method pointers */ - dest = (bmp_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_dest_struct)); - dest->pub.start_output = start_output_bmp; - dest->pub.finish_output = finish_output_bmp; - dest->is_os2 = is_os2; - - if (cinfo->out_color_space == JCS_GRAYSCALE) { - dest->pub.put_pixel_rows = put_gray_rows; - } else if (cinfo->out_color_space == JCS_RGB) { - if (cinfo->quantize_colors) - dest->pub.put_pixel_rows = put_gray_rows; - else - dest->pub.put_pixel_rows = put_pixel_rows; - } else { - ERREXIT(cinfo, JERR_BMP_COLORSPACE); - } - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions(cinfo); - - /* Determine width of rows in the BMP file (padded to 4-byte boundary). */ - row_width = cinfo->output_width * cinfo->output_components; - dest->data_width = row_width; - while ((row_width & 3) != 0) row_width++; - dest->row_width = row_width; - dest->pad_bytes = (int) (row_width - dest->data_width); - - /* Allocate space for inversion array, prepare for write pass */ - dest->whole_image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - row_width, cinfo->output_height, (JDIMENSION) 1); - dest->cur_output_row = 0; - if (cinfo->progress != NULL) { - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; - progress->total_extra_passes++; /* count file input as separate pass */ - } - - /* Create decompressor output buffer. */ - dest->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, row_width, (JDIMENSION) 1); - dest->pub.buffer_height = 1; - - return (djpeg_dest_ptr) dest; -} - -#endif /* BMP_SUPPORTED */ diff --git a/wrgif.c b/wrgif.c deleted file mode 100644 index 5fe83283..00000000 --- a/wrgif.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * wrgif.c - * - * Copyright (C) 1991-1997, 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. - * - * This file contains routines to write output images in GIF format. - * - ************************************************************************** - * NOTE: to avoid entanglements with Unisys' patent on LZW compression, * - * this code has been modified to output "uncompressed GIF" files. * - * There is no trace of the LZW algorithm in this file. * - ************************************************************************** - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume output to - * an ordinary stdio stream. - */ - -/* - * This code is loosely based on ppmtogif from the PBMPLUS distribution - * of Feb. 1991. That file contains the following copyright notice: - * Based on GIFENCODE by David Rowley . - * Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al. - * Copyright (C) 1989 by Jef Poskanzer. - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. This software is provided "as is" without express or - * implied warranty. - * - * We are also required to state that - * "The Graphics Interchange Format(c) is the Copyright property of - * CompuServe Incorporated. GIF(sm) is a Service Mark property of - * CompuServe Incorporated." - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef GIF_SUPPORTED - - -/* Private version of data destination object */ - -typedef struct { - struct djpeg_dest_struct pub; /* public fields */ - - j_decompress_ptr cinfo; /* back link saves passing separate parm */ - - /* State for packing variable-width codes into a bitstream */ - int n_bits; /* current number of bits/code */ - int maxcode; /* maximum code, given n_bits */ - INT32 cur_accum; /* holds bits not yet output */ - int cur_bits; /* # of bits in cur_accum */ - - /* State for GIF code assignment */ - int ClearCode; /* clear code (doesn't change) */ - int EOFCode; /* EOF code (ditto) */ - int code_counter; /* counts output symbols */ - - /* GIF data packet construction buffer */ - int bytesinpkt; /* # of bytes in current packet */ - char packetbuf[256]; /* workspace for accumulating packet */ - -} gif_dest_struct; - -typedef gif_dest_struct * gif_dest_ptr; - -/* Largest value that will fit in N bits */ -#define MAXCODE(n_bits) ((1 << (n_bits)) - 1) - - -/* - * Routines to package finished data bytes into GIF data blocks. - * A data block consists of a count byte (1..255) and that many data bytes. - */ - -LOCAL(void) -flush_packet (gif_dest_ptr dinfo) -/* flush any accumulated data */ -{ - if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */ - dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++; - if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt) - != (size_t) dinfo->bytesinpkt) - ERREXIT(dinfo->cinfo, JERR_FILE_WRITE); - dinfo->bytesinpkt = 0; - } -} - - -/* Add a character to current packet; flush to disk if necessary */ -#define CHAR_OUT(dinfo,c) \ - { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \ - if ((dinfo)->bytesinpkt >= 255) \ - flush_packet(dinfo); \ - } - - -/* Routine to convert variable-width codes into a byte stream */ - -LOCAL(void) -output (gif_dest_ptr dinfo, int code) -/* Emit a code of n_bits bits */ -/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */ -{ - dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits; - dinfo->cur_bits += dinfo->n_bits; - - while (dinfo->cur_bits >= 8) { - CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); - dinfo->cur_accum >>= 8; - dinfo->cur_bits -= 8; - } -} - - -/* The pseudo-compression algorithm. - * - * In this module we simply output each pixel value as a separate symbol; - * thus, no compression occurs. In fact, there is expansion of one bit per - * pixel, because we use a symbol width one bit wider than the pixel width. - * - * GIF ordinarily uses variable-width symbols, and the decoder will expect - * to ratchet up the symbol width after a fixed number of symbols. - * To simplify the logic and keep the expansion penalty down, we emit a - * GIF Clear code to reset the decoder just before the width would ratchet up. - * Thus, all the symbols in the output file will have the same bit width. - * Note that emitting the Clear codes at the right times is a mere matter of - * counting output symbols and is in no way dependent on the LZW patent. - * - * With a small basic pixel width (low color count), Clear codes will be - * needed very frequently, causing the file to expand even more. So this - * simplistic approach wouldn't work too well on bilevel images, for example. - * But for output of JPEG conversions the pixel width will usually be 8 bits - * (129 to 256 colors), so the overhead added by Clear symbols is only about - * one symbol in every 256. - */ - -LOCAL(void) -compress_init (gif_dest_ptr dinfo, int i_bits) -/* Initialize pseudo-compressor */ -{ - /* init all the state variables */ - dinfo->n_bits = i_bits; - dinfo->maxcode = MAXCODE(dinfo->n_bits); - dinfo->ClearCode = (1 << (i_bits - 1)); - dinfo->EOFCode = dinfo->ClearCode + 1; - dinfo->code_counter = dinfo->ClearCode + 2; - /* init output buffering vars */ - dinfo->bytesinpkt = 0; - dinfo->cur_accum = 0; - dinfo->cur_bits = 0; - /* GIF specifies an initial Clear code */ - output(dinfo, dinfo->ClearCode); -} - - -LOCAL(void) -compress_pixel (gif_dest_ptr dinfo, int c) -/* Accept and "compress" one pixel value. - * The given value must be less than n_bits wide. - */ -{ - /* Output the given pixel value as a symbol. */ - output(dinfo, c); - /* Issue Clear codes often enough to keep the reader from ratcheting up - * its symbol size. - */ - if (dinfo->code_counter < dinfo->maxcode) { - dinfo->code_counter++; - } else { - output(dinfo, dinfo->ClearCode); - dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */ - } -} - - -LOCAL(void) -compress_term (gif_dest_ptr dinfo) -/* Clean up at end */ -{ - /* Send an EOF code */ - output(dinfo, dinfo->EOFCode); - /* Flush the bit-packing buffer */ - if (dinfo->cur_bits > 0) { - CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); - } - /* Flush the packet buffer */ - flush_packet(dinfo); -} - - -/* GIF header construction */ - - -LOCAL(void) -put_word (gif_dest_ptr dinfo, unsigned int w) -/* Emit a 16-bit word, LSB first */ -{ - putc(w & 0xFF, dinfo->pub.output_file); - putc((w >> 8) & 0xFF, dinfo->pub.output_file); -} - - -LOCAL(void) -put_3bytes (gif_dest_ptr dinfo, int val) -/* Emit 3 copies of same byte value --- handy subr for colormap construction */ -{ - putc(val, dinfo->pub.output_file); - putc(val, dinfo->pub.output_file); - putc(val, dinfo->pub.output_file); -} - - -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 */ -{ - int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; - int cshift = dinfo->cinfo->data_precision - 8; - int i; - - if (num_colors > 256) - ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors); - /* Compute bits/pixel and related values */ - BitsPerPixel = 1; - while (num_colors > (1 << BitsPerPixel)) - BitsPerPixel++; - ColorMapSize = 1 << BitsPerPixel; - if (BitsPerPixel <= 1) - InitCodeSize = 2; - else - InitCodeSize = BitsPerPixel; - /* - * Write the GIF header. - * Note that we generate a plain GIF87 header for maximum compatibility. - */ - putc('G', dinfo->pub.output_file); - putc('I', dinfo->pub.output_file); - putc('F', dinfo->pub.output_file); - putc('8', dinfo->pub.output_file); - putc('7', dinfo->pub.output_file); - putc('a', dinfo->pub.output_file); - /* Write the Logical Screen Descriptor */ - put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); - put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); - FlagByte = 0x80; /* Yes, there is a global color table */ - FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */ - FlagByte |= (BitsPerPixel-1); /* size of global color table */ - putc(FlagByte, dinfo->pub.output_file); - putc(0, dinfo->pub.output_file); /* Background color index */ - putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */ - /* Write the Global Color Map */ - /* If the color map is more than 8 bits precision, */ - /* we reduce it to 8 bits by shifting */ - for (i=0; i < ColorMapSize; i++) { - if (i < num_colors) { - if (colormap != NULL) { - if (dinfo->cinfo->out_color_space == JCS_RGB) { - /* Normal case: RGB color map */ - putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file); - putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file); - putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file); - } else { - /* Grayscale "color map": possible if quantizing grayscale image */ - put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); - } - } else { - /* Create a gray-scale map of num_colors values, range 0..255 */ - put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); - } - } else { - /* fill out the map to a power of 2 */ - put_3bytes(dinfo, 0); - } - } - /* Write image separator and Image Descriptor */ - putc(',', dinfo->pub.output_file); /* separator */ - put_word(dinfo, 0); /* left/top offset */ - put_word(dinfo, 0); - put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */ - put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); - /* flag byte: not interlaced, no local color map */ - putc(0x00, dinfo->pub.output_file); - /* Write Initial Code Size byte */ - putc(InitCodeSize, dinfo->pub.output_file); - - /* Initialize for "compression" of image data */ - compress_init(dinfo, InitCodeSize+1); -} - - -/* - * Startup: write the file header. - */ - -METHODDEF(void) -start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - gif_dest_ptr dest = (gif_dest_ptr) dinfo; - - if (cinfo->quantize_colors) - emit_header(dest, cinfo->actual_number_of_colors, cinfo->colormap); - else - emit_header(dest, 256, (JSAMPARRAY) NULL); -} - - -/* - * Write some pixel data. - * In this module rows_supplied will always be 1. - */ - -METHODDEF(void) -put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - gif_dest_ptr dest = (gif_dest_ptr) dinfo; - register JSAMPROW ptr; - register JDIMENSION col; - - ptr = dest->pub.buffer[0]; - for (col = cinfo->output_width; col > 0; col--) { - compress_pixel(dest, GETJSAMPLE(*ptr++)); - } -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - gif_dest_ptr dest = (gif_dest_ptr) dinfo; - - /* Flush "compression" mechanism */ - compress_term(dest); - /* Write a zero-length data block to end the series */ - putc(0, dest->pub.output_file); - /* Write the GIF terminator mark */ - putc(';', dest->pub.output_file); - /* Make sure we wrote the output file OK */ - fflush(dest->pub.output_file); - if (ferror(dest->pub.output_file)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * The module selection routine for GIF format output. - */ - -GLOBAL(djpeg_dest_ptr) -jinit_write_gif (j_decompress_ptr cinfo) -{ - gif_dest_ptr dest; - - /* Create module interface object, fill in method pointers */ - dest = (gif_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(gif_dest_struct)); - dest->cinfo = cinfo; /* make back link for subroutines */ - dest->pub.start_output = start_output_gif; - dest->pub.put_pixel_rows = put_pixel_rows; - dest->pub.finish_output = finish_output_gif; - - if (cinfo->out_color_space != JCS_GRAYSCALE && - cinfo->out_color_space != JCS_RGB) - ERREXIT(cinfo, JERR_GIF_COLORSPACE); - - /* Force quantization if color or if > 8 bits input */ - if (cinfo->out_color_space != JCS_GRAYSCALE || cinfo->data_precision > 8) { - /* Force quantization to at most 256 colors */ - cinfo->quantize_colors = TRUE; - if (cinfo->desired_number_of_colors > 256) - cinfo->desired_number_of_colors = 256; - } - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions(cinfo); - - if (cinfo->output_components != 1) /* safety check: just one component? */ - ERREXIT(cinfo, JERR_GIF_BUG); - - /* Create decompressor output buffer. */ - dest->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1); - dest->pub.buffer_height = 1; - - return (djpeg_dest_ptr) dest; -} - -#endif /* GIF_SUPPORTED */ diff --git a/wrjpgcom.1 b/wrjpgcom.1 deleted file mode 100644 index d419a999..00000000 --- a/wrjpgcom.1 +++ /dev/null @@ -1,103 +0,0 @@ -.TH WRJPGCOM 1 "15 June 1995" -.SH NAME -wrjpgcom \- insert text comments into a JPEG file -.SH SYNOPSIS -.B wrjpgcom -[ -.B \-replace -] -[ -.BI \-comment " text" -] -[ -.BI \-cfile " name" -] -[ -.I filename -] -.LP -.SH DESCRIPTION -.LP -.B wrjpgcom -reads the named JPEG/JFIF file, or the standard input if no file is named, -and generates a new JPEG/JFIF file on standard output. A comment block is -added to the file. -.PP -The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. -Although the standard doesn't actually define what COM blocks are for, they -are widely used to hold user-supplied text strings. This lets you add -annotations, titles, index terms, etc to your JPEG files, and later retrieve -them as text. COM blocks do not interfere with the image stored in the JPEG -file. The maximum size of a COM block is 64K, but you can have as many of -them as you like in one JPEG file. -.PP -.B wrjpgcom -adds a COM block, containing text you provide, to a JPEG file. -Ordinarily, the COM block is added after any existing COM blocks; but you -can delete the old COM blocks if you wish. -.SH OPTIONS -Switch names may be abbreviated, and are not case sensitive. -.TP -.B \-replace -Delete any existing COM blocks from the file. -.TP -.BI \-comment " text" -Supply text for new COM block on command line. -.TP -.BI \-cfile " name" -Read text for new COM block from named file. -.PP -If you have only one line of comment text to add, you can provide it on the -command line with -.BR \-comment . -The comment text must be surrounded with quotes so that it is treated as a -single argument. Longer comments can be read from a text file. -.PP -If you give neither -.B \-comment -nor -.BR \-cfile , -then -.B wrjpgcom -will read the comment text from standard input. (In this case an input image -file name MUST be supplied, so that the source JPEG file comes from somewhere -else.) You can enter multiple lines, up to 64KB worth. Type an end-of-file -indicator (usually control-D) to terminate the comment text entry. -.PP -.B wrjpgcom -will not add a COM block if the provided comment string is empty. Therefore -\fB\-replace \-comment ""\fR can be used to delete all COM blocks from a file. -.SH EXAMPLES -.LP -Add a short comment to in.jpg, producing out.jpg: -.IP -.B wrjpgcom \-c -\fI"View of my back yard" in.jpg -.B > -.I out.jpg -.PP -Attach a long comment previously stored in comment.txt: -.IP -.B wrjpgcom -.I in.jpg -.B < -.I comment.txt -.B > -.I out.jpg -.PP -or equivalently -.IP -.B wrjpgcom -.B -cfile -.I comment.txt -.B < -.I in.jpg -.B > -.I out.jpg -.SH SEE ALSO -.BR cjpeg (1), -.BR djpeg (1), -.BR jpegtran (1), -.BR rdjpgcom (1) -.SH AUTHOR -Independent JPEG Group diff --git a/wrjpgcom.c b/wrjpgcom.c deleted file mode 100644 index 8c04b055..00000000 --- a/wrjpgcom.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * wrjpgcom.c - * - * Copyright (C) 1994-1997, 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. - * - * This file contains a very simple stand-alone application that inserts - * user-supplied text as a COM (comment) marker in a JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - */ - -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jinclude.h" /* get auto-config symbols, */ - -#ifndef HAVE_STDLIB_H /* should declare malloc() */ -extern void * malloc (); -#endif -#include /* to declare isupper(), tolower() */ -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif - -/* Reduce this value if your malloc() can't allocate blocks up to 64K. - * On DOS, compiling in large model is usually a better solution. - */ - -#ifndef MAX_COM_LENGTH -#define MAX_COM_LENGTH 65000L /* must be <= 65533 in any case */ -#endif - - -/* - * These macros are used to read the input file and write the output file. - * To reuse this code in another application, you might need to change these. - */ - -static FILE * infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - -static FILE * outfile; /* output JPEG file */ - -/* Emit an output byte */ -#define PUTBYTE(x) putc((x), outfile) - - -/* Error exit handler */ -#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) - - -/* Read one byte, testing for EOF */ -static int -read_1_byte (void) -{ - int c; - - c = NEXTBYTE(); - if (c == EOF) - ERREXIT("Premature EOF in JPEG file"); - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int -read_2_bytes (void) -{ - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - ERREXIT("Premature EOF in JPEG file"); - c2 = NEXTBYTE(); - if (c2 == EOF) - ERREXIT("Premature EOF in JPEG file"); - return (((unsigned int) c1) << 8) + ((unsigned int) c2); -} - - -/* Routines to write data to output file */ - -static void -write_1_byte (int c) -{ - PUTBYTE(c); -} - -static void -write_2_bytes (unsigned int val) -{ - PUTBYTE((val >> 8) & 0xFF); - PUTBYTE(val & 0xFF); -} - -static void -write_marker (int marker) -{ - PUTBYTE(0xFF); - PUTBYTE(marker); -} - -static void -copy_rest_of_file (void) -{ - int c; - - while ((c = NEXTBYTE()) != EOF) - PUTBYTE(c); -} - - -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_COM 0xFE /* COMment */ - - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. (Padding FFs will NOT be replicated in the output file.) - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ - -static int -next_marker (void) -{ - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - fprintf(stderr, "Warning: garbage data found in JPEG file\n"); - } - - return c; -} - - -/* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - -static int -first_marker (void) -{ - int c1, c2; - - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - ERREXIT("Not a JPEG file"); - return c2; -} - - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ - -static void -copy_variable (void) -/* Copy an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - write_2_bytes(length); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - write_1_byte(read_1_byte()); - length--; - } -} - -static void -skip_variable (void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void) read_1_byte(); - length--; - } -} - - -/* - * Parse the marker stream until SOFn or EOI is seen; - * copy data to output, but discard COM markers unless keep_COM is true. - */ - -static int -scan_JPEG_header (int keep_COM) -{ - int marker; - - /* Expect SOI at start of file */ - if (first_marker() != M_SOI) - ERREXIT("Expected SOI marker first"); - write_marker(M_SOI); - - /* Scan miscellaneous markers until we reach SOFn. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - return marker; - - case M_SOS: /* should not see compressed data before SOF */ - ERREXIT("SOS without prior SOFn"); - break; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: /* Existing COM: conditionally discard */ - if (keep_COM) { - write_marker(marker); - copy_variable(); - } else { - skip_variable(); - } - break; - - default: /* Anything else just gets copied */ - write_marker(marker); - copy_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - - -/* Command line parsing code */ - -static const char * progname; /* program name for error messages */ - - -static void -usage (void) -/* complain about bad command line */ -{ - fprintf(stderr, "wrjpgcom inserts a textual comment in a JPEG file.\n"); - fprintf(stderr, "You can add to or replace any existing comment(s).\n"); - - fprintf(stderr, "Usage: %s [switches] ", progname); -#ifdef TWO_FILE_COMMANDLINE - fprintf(stderr, "inputfile outputfile\n"); -#else - fprintf(stderr, "[inputfile]\n"); -#endif - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf(stderr, " -replace Delete any existing comments\n"); - fprintf(stderr, " -comment \"text\" Insert comment with given text\n"); - fprintf(stderr, " -cfile name Read comment from named file\n"); - fprintf(stderr, "Notice that you must put quotes around the comment text\n"); - fprintf(stderr, "when you use -comment.\n"); - fprintf(stderr, "If you do not give either -comment or -cfile on the command line,\n"); - fprintf(stderr, "then the comment text is read from standard input.\n"); - fprintf(stderr, "It can be multiple lines, up to %u characters total.\n", - (unsigned int) MAX_COM_LENGTH); -#ifndef TWO_FILE_COMMANDLINE - fprintf(stderr, "You must specify an input JPEG file name when supplying\n"); - fprintf(stderr, "comment text from standard input.\n"); -#endif - - exit(EXIT_FAILURE); -} - - -static int -keymatch (char * arg, const char * keyword, int minchars) -/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ -/* keyword is the constant keyword (must be lower case already), */ -/* minchars is length of minimum legal abbreviation. */ -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return 0; - return 1; /* A-OK */ -} - - -/* - * The main program. - */ - -int -main (int argc, char **argv) -{ - int argn; - char * arg; - int keep_COM = 1; - char * comment_arg = NULL; - FILE * comment_file = NULL; - unsigned int comment_length = 0; - int marker; - - /* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "wrjpgcom"; /* in case C library doesn't provide it */ - - /* Parse switches, if any */ - for (argn = 1; argn < argc; argn++) { - arg = argv[argn]; - if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ - if (keymatch(arg, "replace", 1)) { - keep_COM = 0; - } else if (keymatch(arg, "cfile", 2)) { - if (++argn >= argc) usage(); - if ((comment_file = fopen(argv[argn], "r")) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } else if (keymatch(arg, "comment", 1)) { - if (++argn >= argc) usage(); - comment_arg = argv[argn]; - /* If the comment text starts with '"', then we are probably running - * under MS-DOG and must parse out the quoted string ourselves. Sigh. - */ - if (comment_arg[0] == '"') { - comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); - if (comment_arg == NULL) - ERREXIT("Insufficient memory"); - strcpy(comment_arg, argv[argn]+1); - for (;;) { - comment_length = (unsigned int) strlen(comment_arg); - if (comment_length > 0 && comment_arg[comment_length-1] == '"') { - comment_arg[comment_length-1] = '\0'; /* zap terminating quote */ - break; - } - if (++argn >= argc) - ERREXIT("Missing ending quote mark"); - strcat(comment_arg, " "); - strcat(comment_arg, argv[argn]); - } - } - comment_length = (unsigned int) strlen(comment_arg); - } else - usage(); - } - - /* Cannot use both -comment and -cfile. */ - if (comment_arg != NULL && comment_file != NULL) - usage(); - /* If there is neither -comment nor -cfile, we will read the comment text - * from stdin; in this case there MUST be an input JPEG file name. - */ - if (comment_arg == NULL && comment_file == NULL && argn >= argc) - usage(); - - /* Open the input file. */ - if (argn < argc) { - if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } else { - /* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open stdin\n", progname); - exit(EXIT_FAILURE); - } -#else - infile = stdin; -#endif - } - - /* Open the output file. */ -#ifdef TWO_FILE_COMMANDLINE - /* Must have explicit output file name */ - if (argn != argc-2) { - fprintf(stderr, "%s: must name one input and one output file\n", - progname); - usage(); - } - if ((outfile = fopen(argv[argn+1], WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn+1]); - exit(EXIT_FAILURE); - } -#else - /* Unix style: expect zero or one file name */ - if (argn < argc-1) { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } - /* default output file is stdout */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdout), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((outfile = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open stdout\n", progname); - exit(EXIT_FAILURE); - } -#else - outfile = stdout; -#endif -#endif /* TWO_FILE_COMMANDLINE */ - - /* Collect comment text from comment_file or stdin, if necessary */ - if (comment_arg == NULL) { - FILE * src_file; - int c; - - comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); - if (comment_arg == NULL) - ERREXIT("Insufficient memory"); - comment_length = 0; - src_file = (comment_file != NULL ? comment_file : stdin); - while ((c = getc(src_file)) != EOF) { - if (comment_length >= (unsigned int) MAX_COM_LENGTH) { - fprintf(stderr, "Comment text may not exceed %u bytes\n", - (unsigned int) MAX_COM_LENGTH); - exit(EXIT_FAILURE); - } - comment_arg[comment_length++] = (char) c; - } - if (comment_file != NULL) - fclose(comment_file); - } - - /* Copy JPEG headers until SOFn marker; - * we will insert the new comment marker just before SOFn. - * This (a) causes the new comment to appear after, rather than before, - * existing comments; and (b) ensures that comments come after any JFIF - * or JFXX markers, as required by the JFIF specification. - */ - marker = scan_JPEG_header(keep_COM); - /* Insert the new COM marker, but only if nonempty text has been supplied */ - if (comment_length > 0) { - write_marker(M_COM); - write_2_bytes(comment_length + 2); - while (comment_length > 0) { - write_1_byte(*comment_arg++); - comment_length--; - } - } - /* Duplicate the remainder of the source file. - * Note that any COM markers occuring after SOF will not be touched. - */ - write_marker(marker); - copy_rest_of_file(); - - /* All done. */ - exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ -} diff --git a/wrppm.c b/wrppm.c deleted file mode 100644 index 6c6d9088..00000000 --- a/wrppm.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * wrppm.c - * - * 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. - * - * This file contains routines to write output images in PPM/PGM format. - * The extended 2-byte-per-sample raw PPM/PGM formats are supported. - * The PBMPLUS library is NOT required to compile this software - * (but it is highly useful as a set of PPM image manipulation programs). - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume output to - * an ordinary stdio stream. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef PPM_SUPPORTED - - -/* - * For 12-bit JPEG data, we either downscale the values to 8 bits - * (to write standard byte-per-sample PPM/PGM files), or output - * nonstandard word-per-sample PPM/PGM files. Downscaling is done - * if PPM_NORAWWORD is defined (this can be done in the Makefile - * or in jconfig.h). - * (When the core library supports data precision reduction, a cleaner - * implementation will be to ask for that instead.) - */ - -#if BITS_IN_JSAMPLE == 8 -#define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) (v) -#define BYTESPERSAMPLE 1 -#define PPM_MAXVAL 255 -#else -#ifdef PPM_NORAWWORD -#define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) ((v) >> (BITS_IN_JSAMPLE-8)) -#define BYTESPERSAMPLE 1 -#define PPM_MAXVAL 255 -#else -/* The word-per-sample format always puts the LSB first. */ -#define PUTPPMSAMPLE(ptr,v) \ - { register int val_ = v; \ - *ptr++ = (char) (val_ & 0xFF); \ - *ptr++ = (char) ((val_ >> 8) & 0xFF); \ - } -#define BYTESPERSAMPLE 2 -#define PPM_MAXVAL ((1<pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -/* - * This code is used when we have to copy the data and apply a pixel - * format translation. Typically this only happens in 12-bit mode. - */ - -METHODDEF(void) -copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char * bufferptr; - register JSAMPROW ptr; - register JDIMENSION col; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = dest->samples_per_row; col > 0; col--) { - PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++)); - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -/* - * Write some pixel data when color quantization is in effect. - * We have to demap the color index values to straight data. - */ - -METHODDEF(void) -put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char * bufferptr; - register int pixval; - register JSAMPROW ptr; - register JSAMPROW color_map0 = cinfo->colormap[0]; - register JSAMPROW color_map1 = cinfo->colormap[1]; - register JSAMPROW color_map2 = cinfo->colormap[2]; - register JDIMENSION col; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) { - pixval = GETJSAMPLE(*ptr++); - PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[pixval])); - PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map1[pixval])); - PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map2[pixval])); - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -METHODDEF(void) -put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - register char * bufferptr; - register JSAMPROW ptr; - register JSAMPROW color_map = cinfo->colormap[0]; - register JDIMENSION col; - - ptr = dest->pub.buffer[0]; - bufferptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) { - PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)])); - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -/* - * Startup: write the file header. - */ - -METHODDEF(void) -start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - ppm_dest_ptr dest = (ppm_dest_ptr) dinfo; - - /* Emit file header */ - switch (cinfo->out_color_space) { - case JCS_GRAYSCALE: - /* emit header for raw PGM format */ - fprintf(dest->pub.output_file, "P5\n%ld %ld\n%d\n", - (long) cinfo->output_width, (long) cinfo->output_height, - PPM_MAXVAL); - break; - case JCS_RGB: - /* emit header for raw PPM format */ - fprintf(dest->pub.output_file, "P6\n%ld %ld\n%d\n", - (long) cinfo->output_width, (long) cinfo->output_height, - PPM_MAXVAL); - break; - default: - ERREXIT(cinfo, JERR_PPM_COLORSPACE); - } -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - /* Make sure we wrote the output file OK */ - fflush(dinfo->output_file); - if (ferror(dinfo->output_file)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * The module selection routine for PPM format output. - */ - -GLOBAL(djpeg_dest_ptr) -jinit_write_ppm (j_decompress_ptr cinfo) -{ - ppm_dest_ptr dest; - - /* Create module interface object, fill in method pointers */ - dest = (ppm_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_dest_struct)); - dest->pub.start_output = start_output_ppm; - dest->pub.finish_output = finish_output_ppm; - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions(cinfo); - - /* Create physical I/O buffer. Note we make this near on a PC. */ - dest->samples_per_row = cinfo->output_width * cinfo->out_color_components; - dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char)); - dest->iobuffer = (char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width); - - if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 || - SIZEOF(JSAMPLE) != SIZEOF(char)) { - /* When quantizing, we need an output buffer for colormap indexes - * that's separate from the physical I/O buffer. We also need a - * separate buffer if pixel format translation must take place. - */ - dest->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->output_width * cinfo->output_components, (JDIMENSION) 1); - dest->pub.buffer_height = 1; - if (! cinfo->quantize_colors) - dest->pub.put_pixel_rows = copy_pixel_rows; - else if (cinfo->out_color_space == JCS_GRAYSCALE) - dest->pub.put_pixel_rows = put_demapped_gray; - else - dest->pub.put_pixel_rows = put_demapped_rgb; - } else { - /* We will fwrite() directly from decompressor output buffer. */ - /* Synthesize a JSAMPARRAY pointer structure */ - /* Cast here implies near->far pointer conversion on PCs */ - dest->pixrow = (JSAMPROW) dest->iobuffer; - dest->pub.buffer = & dest->pixrow; - dest->pub.buffer_height = 1; - dest->pub.put_pixel_rows = put_pixel_rows; - } - - return (djpeg_dest_ptr) dest; -} - -#endif /* PPM_SUPPORTED */ diff --git a/wrrle.c b/wrrle.c deleted file mode 100644 index a4e73372..00000000 --- a/wrrle.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * wrrle.c - * - * 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. - * - * This file contains routines to write output images in RLE format. - * The Utah Raster Toolkit library is required (version 3.1 or later). - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume output to - * an ordinary stdio stream. - * - * Based on code contributed by Mike Lijewski, - * with updates from Robert Hutchinson. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef RLE_SUPPORTED - -/* rle.h is provided by the Utah Raster Toolkit. */ - -#include - -/* - * We assume that JSAMPLE has the same representation as rle_pixel, - * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples. - */ - -#if BITS_IN_JSAMPLE != 8 - Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ -#endif - - -/* - * Since RLE stores scanlines bottom-to-top, we have to invert the image - * from JPEG's top-to-bottom order. To do this, we save the outgoing data - * in a virtual array during put_pixel_row calls, then actually emit the - * RLE file during finish_output. - */ - - -/* - * For now, if we emit an RLE color map then it is always 256 entries long, - * though not all of the entries need be used. - */ - -#define CMAPBITS 8 -#define CMAPLENGTH (1<<(CMAPBITS)) - -typedef struct { - struct djpeg_dest_struct pub; /* public fields */ - - jvirt_sarray_ptr image; /* virtual array to store the output image */ - rle_map *colormap; /* RLE-style color map, or NULL if none */ - rle_pixel **rle_row; /* To pass rows to rle_putrow() */ - -} rle_dest_struct; - -typedef rle_dest_struct * rle_dest_ptr; - -/* Forward declarations */ -METHODDEF(void) rle_put_pixel_rows - JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); - - -/* - * Write the file header. - * - * In this module it's easier to wait till finish_output to write anything. - */ - -METHODDEF(void) -start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - rle_dest_ptr dest = (rle_dest_ptr) dinfo; - size_t cmapsize; - int i, ci; -#ifdef PROGRESS_REPORT - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; -#endif - - /* - * Make sure the image can be stored in RLE format. - * - * - RLE stores image dimensions as *signed* 16 bit integers. JPEG - * uses unsigned, so we have to check the width. - * - * - Colorspace is expected to be grayscale or RGB. - * - * - The number of channels (components) is expected to be 1 (grayscale/ - * pseudocolor) or 3 (truecolor/directcolor). - * (could be 2 or 4 if using an alpha channel, but we aren't) - */ - - if (cinfo->output_width > 32767 || cinfo->output_height > 32767) - ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width, - cinfo->output_height); - - if (cinfo->out_color_space != JCS_GRAYSCALE && - cinfo->out_color_space != JCS_RGB) - ERREXIT(cinfo, JERR_RLE_COLORSPACE); - - if (cinfo->output_components != 1 && cinfo->output_components != 3) - ERREXIT1(cinfo, JERR_RLE_TOOMANYCHANNELS, cinfo->num_components); - - /* Convert colormap, if any, to RLE format. */ - - dest->colormap = NULL; - - if (cinfo->quantize_colors) { - /* Allocate storage for RLE-style cmap, zero any extra entries */ - cmapsize = cinfo->out_color_components * CMAPLENGTH * SIZEOF(rle_map); - dest->colormap = (rle_map *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize); - MEMZERO(dest->colormap, cmapsize); - - /* Save away data in RLE format --- note 8-bit left shift! */ - /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */ - for (ci = 0; ci < cinfo->out_color_components; ci++) { - for (i = 0; i < cinfo->actual_number_of_colors; i++) { - dest->colormap[ci * CMAPLENGTH + i] = - GETJSAMPLE(cinfo->colormap[ci][i]) << 8; - } - } - } - - /* Set the output buffer to the first row */ - dest->pub.buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->image, (JDIMENSION) 0, (JDIMENSION) 1, TRUE); - dest->pub.buffer_height = 1; - - dest->pub.put_pixel_rows = rle_put_pixel_rows; - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->total_extra_passes++; /* count file writing as separate pass */ - } -#endif -} - - -/* - * Write some pixel data. - * - * This routine just saves the data away in a virtual array. - */ - -METHODDEF(void) -rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - rle_dest_ptr dest = (rle_dest_ptr) dinfo; - - if (cinfo->output_scanline < cinfo->output_height) { - dest->pub.buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->image, - cinfo->output_scanline, (JDIMENSION) 1, TRUE); - } -} - -/* - * Finish up at the end of the file. - * - * Here is where we really output the RLE file. - */ - -METHODDEF(void) -finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - rle_dest_ptr dest = (rle_dest_ptr) dinfo; - rle_hdr header; /* Output file information */ - rle_pixel **rle_row, *red, *green, *blue; - JSAMPROW output_row; - char cmapcomment[80]; - int row, col; - int ci; -#ifdef PROGRESS_REPORT - cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; -#endif - - /* Initialize the header info */ - header = *rle_hdr_init(NULL); - header.rle_file = dest->pub.output_file; - header.xmin = 0; - header.xmax = cinfo->output_width - 1; - header.ymin = 0; - header.ymax = cinfo->output_height - 1; - header.alpha = 0; - header.ncolors = cinfo->output_components; - for (ci = 0; ci < cinfo->output_components; ci++) { - RLE_SET_BIT(header, ci); - } - if (cinfo->quantize_colors) { - header.ncmap = cinfo->out_color_components; - header.cmaplen = CMAPBITS; - header.cmap = dest->colormap; - /* Add a comment to the output image with the true colormap length. */ - sprintf(cmapcomment, "color_map_length=%d", cinfo->actual_number_of_colors); - rle_putcom(cmapcomment, &header); - } - - /* Emit the RLE header and color map (if any) */ - rle_put_setup(&header); - - /* Now output the RLE data from our virtual array. - * We assume here that (a) rle_pixel is represented the same as JSAMPLE, - * and (b) we are not on a machine where FAR pointers differ from regular. - */ - -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_limit = cinfo->output_height; - progress->pub.pass_counter = 0; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - - if (cinfo->output_components == 1) { - for (row = cinfo->output_height-1; row >= 0; row--) { - rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->image, - (JDIMENSION) row, (JDIMENSION) 1, FALSE); - rle_putrow(rle_row, (int) cinfo->output_width, &header); -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_counter++; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - } - } else { - for (row = cinfo->output_height-1; row >= 0; row--) { - rle_row = (rle_pixel **) dest->rle_row; - output_row = * (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, dest->image, - (JDIMENSION) row, (JDIMENSION) 1, FALSE); - red = rle_row[0]; - green = rle_row[1]; - blue = rle_row[2]; - for (col = cinfo->output_width; col > 0; col--) { - *red++ = GETJSAMPLE(*output_row++); - *green++ = GETJSAMPLE(*output_row++); - *blue++ = GETJSAMPLE(*output_row++); - } - rle_putrow(rle_row, (int) cinfo->output_width, &header); -#ifdef PROGRESS_REPORT - if (progress != NULL) { - progress->pub.pass_counter++; - (*progress->pub.progress_monitor) ((j_common_ptr) cinfo); - } -#endif - } - } - -#ifdef PROGRESS_REPORT - if (progress != NULL) - progress->completed_extra_passes++; -#endif - - /* Emit file trailer */ - rle_puteof(&header); - fflush(dest->pub.output_file); - if (ferror(dest->pub.output_file)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * The module selection routine for RLE format output. - */ - -GLOBAL(djpeg_dest_ptr) -jinit_write_rle (j_decompress_ptr cinfo) -{ - rle_dest_ptr dest; - - /* Create module interface object, fill in method pointers */ - dest = (rle_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(rle_dest_struct)); - dest->pub.start_output = start_output_rle; - dest->pub.finish_output = finish_output_rle; - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions(cinfo); - - /* Allocate a work array for output to the RLE library. */ - dest->rle_row = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->output_width, (JDIMENSION) cinfo->output_components); - - /* Allocate a virtual array to hold the image. */ - dest->image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) (cinfo->output_width * cinfo->output_components), - cinfo->output_height, (JDIMENSION) 1); - - return (djpeg_dest_ptr) dest; -} - -#endif /* RLE_SUPPORTED */ diff --git a/wrtarga.c b/wrtarga.c deleted file mode 100644 index cf104d2d..00000000 --- a/wrtarga.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * wrtarga.c - * - * 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. - * - * This file contains routines to write output images in Targa format. - * - * These routines may need modification for non-Unix environments or - * specialized applications. As they stand, they assume output to - * an ordinary stdio stream. - * - * Based on code contributed by Lee Daniel Crocker. - */ - -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - -#ifdef TARGA_SUPPORTED - - -/* - * To support 12-bit JPEG data, we'd have to scale output down to 8 bits. - * This is not yet implemented. - */ - -#if BITS_IN_JSAMPLE != 8 - Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ -#endif - -/* - * The output buffer needs to be writable by fwrite(). On PCs, we must - * allocate the buffer in near data space, because we are assuming small-data - * memory model, wherein fwrite() can't reach far memory. If you need to - * process very wide images on a PC, you might have to compile in large-memory - * model, or else replace fwrite() with a putc() loop --- which will be much - * slower. - */ - - -/* Private version of data destination object */ - -typedef struct { - struct djpeg_dest_struct pub; /* public fields */ - - char *iobuffer; /* physical I/O buffer */ - JDIMENSION buffer_width; /* width of one row */ -} tga_dest_struct; - -typedef tga_dest_struct * tga_dest_ptr; - - -LOCAL(void) -write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) -/* Create and write a Targa header */ -{ - char targaheader[18]; - - /* Set unused fields of header to 0 */ - MEMZERO(targaheader, SIZEOF(targaheader)); - - if (num_colors > 0) { - targaheader[1] = 1; /* color map type 1 */ - targaheader[5] = (char) (num_colors & 0xFF); - targaheader[6] = (char) (num_colors >> 8); - targaheader[7] = 24; /* 24 bits per cmap entry */ - } - - targaheader[12] = (char) (cinfo->output_width & 0xFF); - targaheader[13] = (char) (cinfo->output_width >> 8); - targaheader[14] = (char) (cinfo->output_height & 0xFF); - targaheader[15] = (char) (cinfo->output_height >> 8); - targaheader[17] = 0x20; /* Top-down, non-interlaced */ - - if (cinfo->out_color_space == JCS_GRAYSCALE) { - targaheader[2] = 3; /* image type = uncompressed gray-scale */ - targaheader[16] = 8; /* bits per pixel */ - } else { /* must be RGB */ - if (num_colors > 0) { - targaheader[2] = 1; /* image type = colormapped RGB */ - targaheader[16] = 8; - } else { - targaheader[2] = 2; /* image type = uncompressed RGB */ - targaheader[16] = 24; - } - } - - if (JFWRITE(dinfo->output_file, targaheader, 18) != (size_t) 18) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * Write some pixel data. - * In this module rows_supplied will always be 1. - */ - -METHODDEF(void) -put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -/* used for unquantized full-color output */ -{ - tga_dest_ptr dest = (tga_dest_ptr) dinfo; - register JSAMPROW inptr; - register char * outptr; - register JDIMENSION col; - - inptr = dest->pub.buffer[0]; - outptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) { - outptr[0] = (char) GETJSAMPLE(inptr[2]); /* RGB to BGR order */ - outptr[1] = (char) GETJSAMPLE(inptr[1]); - outptr[2] = (char) GETJSAMPLE(inptr[0]); - inptr += 3, outptr += 3; - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - -METHODDEF(void) -put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -/* used for grayscale OR quantized color output */ -{ - tga_dest_ptr dest = (tga_dest_ptr) dinfo; - register JSAMPROW inptr; - register char * outptr; - register JDIMENSION col; - - inptr = dest->pub.buffer[0]; - outptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) { - *outptr++ = (char) GETJSAMPLE(*inptr++); - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -/* - * Write some demapped pixel data when color quantization is in effect. - * For Targa, this is only applied to grayscale data. - */ - -METHODDEF(void) -put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) -{ - tga_dest_ptr dest = (tga_dest_ptr) dinfo; - register JSAMPROW inptr; - register char * outptr; - register JSAMPROW color_map0 = cinfo->colormap[0]; - register JDIMENSION col; - - inptr = dest->pub.buffer[0]; - outptr = dest->iobuffer; - for (col = cinfo->output_width; col > 0; col--) { - *outptr++ = (char) GETJSAMPLE(color_map0[GETJSAMPLE(*inptr++)]); - } - (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width); -} - - -/* - * Startup: write the file header. - */ - -METHODDEF(void) -start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - tga_dest_ptr dest = (tga_dest_ptr) dinfo; - int num_colors, i; - FILE *outfile; - - if (cinfo->out_color_space == JCS_GRAYSCALE) { - /* Targa doesn't have a mapped grayscale format, so we will */ - /* demap quantized gray output. Never emit a colormap. */ - write_header(cinfo, dinfo, 0); - if (cinfo->quantize_colors) - dest->pub.put_pixel_rows = put_demapped_gray; - else - dest->pub.put_pixel_rows = put_gray_rows; - } else if (cinfo->out_color_space == JCS_RGB) { - if (cinfo->quantize_colors) { - /* We only support 8-bit colormap indexes, so only 256 colors */ - num_colors = cinfo->actual_number_of_colors; - if (num_colors > 256) - ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors); - write_header(cinfo, dinfo, num_colors); - /* Write the colormap. Note Targa uses BGR byte order */ - outfile = dest->pub.output_file; - for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile); - putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile); - putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile); - } - dest->pub.put_pixel_rows = put_gray_rows; - } else { - write_header(cinfo, dinfo, 0); - dest->pub.put_pixel_rows = put_pixel_rows; - } - } else { - ERREXIT(cinfo, JERR_TGA_COLORSPACE); - } -} - - -/* - * Finish up at the end of the file. - */ - -METHODDEF(void) -finish_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) -{ - /* Make sure we wrote the output file OK */ - fflush(dinfo->output_file); - if (ferror(dinfo->output_file)) - ERREXIT(cinfo, JERR_FILE_WRITE); -} - - -/* - * The module selection routine for Targa format output. - */ - -GLOBAL(djpeg_dest_ptr) -jinit_write_targa (j_decompress_ptr cinfo) -{ - tga_dest_ptr dest; - - /* Create module interface object, fill in method pointers */ - dest = (tga_dest_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_dest_struct)); - dest->pub.start_output = start_output_tga; - dest->pub.finish_output = finish_output_tga; - - /* Calculate output image dimensions so we can allocate space */ - jpeg_calc_output_dimensions(cinfo); - - /* Create I/O buffer. Note we make this near on a PC. */ - dest->buffer_width = cinfo->output_width * cinfo->output_components; - dest->iobuffer = (char *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (dest->buffer_width * SIZEOF(char))); - - /* Create decompressor output buffer. */ - dest->pub.buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1); - dest->pub.buffer_height = 1; - - return (djpeg_dest_ptr) dest; -} - -#endif /* TARGA_SUPPORTED */ From d88cc24540691328620c410dc9c8b7c1b2bc81ae Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Thu, 3 Apr 2008 13:29:28 +0000 Subject: [PATCH 002/985] - introduced common/jpeg/{configure.ac,Makefile.am} - removed autogenerated stuff (jconfig.h, configure, config.guess, config.sub, jconfig.h, install-sh) - minor macros changes in jchuff.c, jcphuff.c, jmorecfg.h (same with configure produced macros) --- Makefile.am | 11 + config.guess | 883 ---------------------- config.sub | 954 ------------------------ configure | 2011 -------------------------------------------------- configure.ac | 79 ++ install-sh | 250 ------- jchuff.c | 2 +- jconfig.cfg | 44 -- jconfig.h | 45 -- jcphuff.c | 4 +- jmorecfg.h | 29 +- 11 files changed, 100 insertions(+), 4212 deletions(-) create mode 100644 Makefile.am delete mode 100755 config.guess delete mode 100755 config.sub delete mode 100755 configure create mode 100644 configure.ac delete mode 100755 install-sh delete mode 100644 jconfig.cfg delete mode 100644 jconfig.h diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..530b8ded --- /dev/null +++ b/Makefile.am @@ -0,0 +1,11 @@ +noinst_LTLIBRARIES = libjpeg.la + +libjpeg_la_SOURCES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ + jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c \ + jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ + jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c \ + jdhuff.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 jmemnobs.c + diff --git a/config.guess b/config.guess deleted file mode 100755 index 413ed41c..00000000 --- a/config.guess +++ /dev/null @@ -1,883 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Written by Per Bothner . -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:4) - if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=4.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[3478]??:HP-UX:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; - 9000/8?? ) HP_ARCH=hppa1.0 ;; - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i?86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo i386-pc-cygwin32 - exit 0 ;; - i*:MINGW*:*) - echo i386-pc-mingw32 - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >dummy.c < -main(argc, argv) - int argc; - char *argv[]; -{ -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i?86:LynxOS:2.*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/config.sub b/config.sub deleted file mode 100755 index 213a6d47..00000000 --- a/config.sub +++ /dev/null @@ -1,954 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - linux-gnu*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) - os= - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 \ - | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) - basic_machine=$basic_machine-unknown - ;; - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i[3456]86) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - os=-mvs - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[3456]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[3456]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[3456]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[3456]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - miniframe) - basic_machine=m68000-convergent - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - np1) - basic_machine=np1-gould - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5) - basic_machine=i586-intel - ;; - pentiumpro | p6) - basic_machine=i686-intel - ;; - pentium-* | p5-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - k5) - # We don't have specific support for AMD's K5 yet, so just call it a Pentium - basic_machine=i586-amd - ;; - nexen) - # We don't have specific support for Nexgen yet, so just call it a Pentium - basic_machine=i586-nexgen - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -xenix) - os=-xenix - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-semi) - os=-aout - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-ibm) - os=-aix - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f301-fujitsu) - os=-uxpv - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -hpux*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/configure b/configure deleted file mode 100755 index 35c9db5c..00000000 --- a/configure +++ /dev/null @@ -1,2011 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-shared build shared library using GNU libtool" -ac_help="$ac_help - --enable-static build static library using GNU libtool" -ac_help="$ac_help - --enable-maxmem[=N] enable use of temp files, set max mem usage to N MB" -ac_help="$ac_help -" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -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= -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -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=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --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. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_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 -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --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 -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -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 ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --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=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -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=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -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=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *=*) - varname=`echo "$ac_option"|sed -e 's/=.*//'` - # Reject names that aren't valid shell variable names. - if test -n "`echo $varname| sed 's/[a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $varname: invalid shell variable name" 1>&2; exit 1; } - fi - val="`echo "$ac_option"|sed 's/[^=]*=//'`" - test -n "$verbose" && echo " setting shell variable $varname to $val" - 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 - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=jcmaster.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -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' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:538: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:567: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:615: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -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' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:649: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:654: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - test "${CFLAGS+set}" = set || CFLAGS="-O2" -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-O" -fi - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:681: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 -echo "configure:742: checking for function prototypes" >&5 -if eval "test \"`echo '$''{'ijg_cv_have_prototypes'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ijg_cv_have_prototypes=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ijg_cv_have_prototypes=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ijg_cv_have_prototypes" 1>&6 -if test $ijg_cv_have_prototypes = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_PROTOTYPES -EOF - -else - echo Your compiler does not seem to know about function prototypes. - echo Perhaps it needs a special switch to enable ANSI C mode. - echo If so, we recommend running configure like this: - echo " ./configure CC='cc -switch'" - echo where -switch is the proper switch. -fi -ac_safe=`echo "stddef.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for stddef.h""... $ac_c" 1>&6 -echo "configure:792: checking for stddef.h" >&5 -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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_STDDEF_H -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for stdlib.h""... $ac_c" 1>&6 -echo "configure:828: checking for stdlib.h" >&5 -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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_STDLIB_H -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for string.h""... $ac_c" 1>&6 -echo "configure:864: checking for string.h" >&5 -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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define NEED_BSD_STRINGS -EOF - -fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:900: checking for size_t" >&5 -cat > conftest.$ac_ext < -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#ifdef NEED_BSD_STRINGS -#include -#else -#include -#endif -typedef size_t my_size_t; - -int main() { - my_size_t foovar; -; return 0; } -EOF -if { (eval echo configure:923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ijg_size_t_ok=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h" -fi -rm -f conftest* -echo "$ac_t""$ijg_size_t_ok" 1>&6 -if test "$ijg_size_t_ok" != yes; then -ac_safe=`echo "sys/types.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for sys/types.h""... $ac_c" 1>&6 -echo "configure:937: checking for sys/types.h" >&5 -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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define NEED_SYS_TYPES_H -EOF - -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "size_t" >/dev/null 2>&1; then - rm -rf conftest* - ijg_size_t_ok="size_t is in sys/types.h" -else - rm -rf conftest* - ijg_size_t_ok=no -fi -rm -f conftest* - -else - echo "$ac_t""no" 1>&6 -ijg_size_t_ok=no -fi - -echo "$ac_t""$ijg_size_t_ok" 1>&6 -if test "$ijg_size_t_ok" = no; then - echo Type size_t is not defined in any of the usual places. - echo Try putting '"typedef unsigned int size_t;"' in jconfig.h. -fi -fi -echo $ac_n "checking for type unsigned char""... $ac_c" 1>&6 -echo "configure:994: checking for type unsigned char" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -cat >> confdefs.h <<\EOF -#define HAVE_UNSIGNED_CHAR -EOF - -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* -echo $ac_n "checking for type unsigned short""... $ac_c" 1>&6 -echo "configure:1018: checking for type unsigned short" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -cat >> confdefs.h <<\EOF -#define HAVE_UNSIGNED_SHORT -EOF - -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* -echo $ac_n "checking for type void""... $ac_c" 1>&6 -echo "configure:1042: checking for type void" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define void char -EOF - -fi -rm -f conftest* - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1088: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1163: checking for inline" >&5 -ijg_cv_inline="" -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ijg_cv_inline="__inline__" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ijg_cv_inline="__inline" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ijg_cv_inline="inline" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* -echo "$ac_t""$ijg_cv_inline" 1>&6 -cat >> confdefs.h <&6 -echo "configure:1224: checking for broken incomplete types" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - echo "$ac_t""ok" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""broken" 1>&6 -cat >> confdefs.h <<\EOF -#define INCOMPLETE_TYPES_BROKEN -EOF - -fi -rm -f conftest* -echo $ac_n "checking for short external names""... $ac_c" 1>&6 -echo "configure:1248: checking for short external names" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - echo "$ac_t""ok" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""short" 1>&6 -cat >> confdefs.h <<\EOF -#define NEED_SHORT_EXTERNAL_NAMES -EOF - -fi -rm -f conftest* -echo $ac_n "checking to see if char is signed""... $ac_c" 1>&6 -echo "configure:1275: checking to see if char is signed" >&5 -if test "$cross_compiling" = yes; then - echo Assuming that char is signed on target machine. -echo If it is unsigned, this will be a little bit inefficient. - -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define CHAR_IS_UNSIGNED -EOF - -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - echo "$ac_t""yes" 1>&6 -fi -rm -fr conftest* -fi - -echo $ac_n "checking to see if right shift is signed""... $ac_c" 1>&6 -echo "configure:1323: checking to see if right shift is signed" >&5 -if test "$cross_compiling" = yes; then - echo "$ac_t""Assuming that right shift is signed on target machine." 1>&6 -else - cat > conftest.$ac_ext <> 4; - - if (res == -0x7F7E80CL) { /* expected result for signed shift */ - return 1; /* right shift is signed */ - } - /* see if unsigned-shift hack will fix it. */ - /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); - if (res == -0x7F7E80CL) { /* expected result now? */ - return 0; /* right shift is unsigned */ - } - printf("Right shift isn't acting as I expect it to.\n"); - printf("I fear the JPEG software will not work at all.\n\n"); - return 0; /* try it with unsigned anyway */ -} -main() { - exit(is_shifting_signed(-0x7F7E80B1L)); -} -EOF -if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define RIGHT_SHIFT_IS_UNSIGNED -EOF - -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - echo "$ac_t""yes" 1>&6 -fi -rm -fr conftest* -fi - -echo $ac_n "checking to see if fopen accepts b spec""... $ac_c" 1>&6 -echo "configure:1375: checking to see if fopen accepts b spec" >&5 -if test "$cross_compiling" = yes; then - echo "$ac_t""Assuming that it does." 1>&6 -else - cat > conftest.$ac_ext < -main() { - if (fopen("conftestdata", "wb") != NULL) - exit(0); - exit(1); -} -EOF -if { (eval echo configure:1390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define DONT_USE_B_MODE -EOF - -fi -rm -fr conftest* -fi - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1436: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1488: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -# Decide whether to use libtool, -# and if so whether to build shared, static, or both flavors of library. -LTSHARED="no" -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - LTSHARED="$enableval" -fi - -LTSTATIC="no" -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - LTSTATIC="$enableval" -fi - -if test "x$LTSHARED" != xno -o "x$LTSTATIC" != xno; then - USELIBTOOL="yes" - LIBTOOL="./libtool" - O="lo" - A="la" - LN='$(LIBTOOL) --mode=link $(CC)' - INSTALL_LIB='$(LIBTOOL) --mode=install ${INSTALL}' - INSTALL_PROGRAM="\$(LIBTOOL) --mode=install $INSTALL_PROGRAM" -else - USELIBTOOL="no" - LIBTOOL="" - O="o" - A="a" - LN='$(CC)' - INSTALL_LIB="$INSTALL_DATA" -fi - - - - - - -# Configure libtool if needed. -if test $USELIBTOOL = yes; then - disable_shared= - disable_static= - if test "x$LTSHARED" = xno; then - disable_shared="--disable-shared" - fi - if test "x$LTSTATIC" = xno; then - disable_static="--disable-static" - fi - $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh -fi - -# Select memory manager depending on user input. -# If no "-enable-maxmem", use jmemnobs -MEMORYMGR='jmemnobs.$(O)' -MAXMEM="no" -# Check whether --enable-maxmem or --disable-maxmem was given. -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. -if test "${with_maxmem+set}" = set; then - withval="$with_maxmem" - MAXMEM="$withval" -fi - -if test "x$MAXMEM" = xyes; then - MAXMEM=1 -fi -if test "x$MAXMEM" != xno; then - if test -n "`echo $MAXMEM | sed 's/[0-9]//g'`"; then - { echo "configure: error: non-numeric argument to --enable-maxmem" 1>&2; exit 1; } - fi - DEFAULTMAXMEM=`expr $MAXMEM \* 1048576` -cat >> confdefs.h <&6 -echo "configure:1596: checking for 'tmpfile()'" >&5 -cat > conftest.$ac_ext < -int main() { - FILE * tfile = tmpfile(); -; return 0; } -EOF -if { (eval echo configure:1605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -MEMORYMGR='jmemansi.$(O)' -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 -MEMORYMGR='jmemname.$(O)' -cat >> confdefs.h <<\EOF -#define NEED_SIGNAL_CATCHER -EOF - -echo $ac_n "checking for 'mktemp()'""... $ac_c" 1>&6 -echo "configure:1620: checking for 'mktemp()'" >&5 -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 -cat >> confdefs.h <<\EOF -#define NO_MKTEMP -EOF - -fi -rm -f conftest* -fi -rm -f conftest* -fi - - -# Extract the library version ID from jpeglib.h. -echo $ac_n "checking libjpeg version number""... $ac_c" 1>&6 -echo "configure:1650: checking libjpeg version number" >&5 -JPEG_LIB_VERSION=`sed -e '/^#define JPEG_LIB_VERSION/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h` -echo "$ac_t""$JPEG_LIB_VERSION" 1>&6 - - -# Prepare to massage makefile.cfg correctly. -if test $ijg_cv_have_prototypes = yes; then - A2K_DEPS="" - COM_A2K="# " -else - A2K_DEPS="ansi2knr" - COM_A2K="" -fi - - -# ansi2knr needs -DBSD if string.h is missing -if test $ac_cv_header_string_h = no; then - ANSI2KNRFLAGS="-DBSD" -else - ANSI2KNRFLAGS="" -fi - -# Substitutions to enable or disable libtool-related stuff -if test $USELIBTOOL = yes -a $ijg_cv_have_prototypes = yes; then - COM_LT="" -else - COM_LT="# " -fi - -if test "x$LTSHARED" != xno; then - FORCE_INSTALL_LIB="install-lib" -else - FORCE_INSTALL_LIB="" -fi - -# Set up -I directives -if test "x$srcdir" = x.; then - INCLUDEFLAGS='-I$(srcdir)' -else - INCLUDEFLAGS='-I. -I$(srcdir)' -fi - -trap '' 1 2 15 - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile:makefile.cfg jconfig.h:jconfig.cfg" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -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_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@RANLIB@%$RANLIB%g -s%@LIBTOOL@%$LIBTOOL%g -s%@O@%$O%g -s%@A@%$A%g -s%@LN@%$LN%g -s%@INSTALL_LIB@%$INSTALL_LIB%g -s%@MEMORYMGR@%$MEMORYMGR%g -s%@JPEG_LIB_VERSION@%$JPEG_LIB_VERSION%g -s%@A2K_DEPS@%$A2K_DEPS%g -s%@COM_A2K@%$COM_A2K%g -s%@ANSI2KNRFLAGS@%$ANSI2KNRFLAGS%g -s%@COM_LT@%$COM_LT%g -s%@FORCE_INSTALL_LIB@%$FORCE_INSTALL_LIB%g -s%@INCLUDEFLAGS@%$INCLUDEFLAGS%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -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 in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - -rm -f conftest.tail -while : -do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS - echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..28d86389 --- /dev/null +++ b/configure.ac @@ -0,0 +1,79 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.61]) +AC_INIT([libjpeg], [6.b]) + +AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) + +# Always build with prototypes +AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) +# Don't use undefined types +AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LIBTOOL +AC_PROG_LN_S + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) +AC_CHECK_HEADER([sys/types.h], AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_CHAR_UNSIGNED +AC_C_INLINE +AC_TYPE_SIZE_T +AC_CHECK_TYPES([unsigned char, unsigned short]) + +AC_MSG_CHECKING([if right shift is signed]) +AC_TRY_RUN( + [#include + int is_shifting_signed (long arg) { + long res = arg >> 4; + + if (res == -0x7F7E80CL) + return 1; /* right shift is signed */ + + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= (~0L) << (32-4); + if (res == -0x7F7E80CL) + return 0; /* right shift is unsigned */ + + printf("Right shift isn't acting as I expect it to.\n"); + printf("I fear the JPEG software will not work at all.\n\n"); + return 0; /* try it with unsigned anyway */ + } + int main (void) { + exit(is_shifting_signed(-0x7F7E80B1L)); + }], + [AC_MSG_RESULT(no) + AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) + +# test whether global names are unique to at least 15 chars +AC_MSG_CHECKING([for short external names]) +AC_TRY_LINK( + [int possibly_duplicate_function () { return 0; } + int possibly_dupli_function () { return 1; }], [ ], + [AC_MSG_RESULT(ok)], + [AC_MSG_RESULT(short) + AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) + +# Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([memset memcpy], [], + [AC_DEFINE([NEED_BSD_STRINGS], 1, + [Define if you have BSD-like bzero and bcopy])]) + + +AC_CONFIG_HEADER([jconfig.h:config.h.in]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/install-sh b/install-sh deleted file mode 100755 index e8436696..00000000 --- a/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/jchuff.c b/jchuff.c index f2352505..20388bd4 100644 --- a/jchuff.c +++ b/jchuff.c @@ -297,7 +297,7 @@ dump_buffer (working_state * state) * between calls, so 24 bits are sufficient. */ -INLINE +inline LOCAL(boolean) emit_bits (working_state * state, unsigned int code, int size) /* Emit some bits; return TRUE if successful, FALSE if must suspend */ diff --git a/jconfig.cfg b/jconfig.cfg deleted file mode 100644 index 36a04fa8..00000000 --- a/jconfig.cfg +++ /dev/null @@ -1,44 +0,0 @@ -/* jconfig.cfg --- source file edited by configure script */ -/* see jconfig.doc for explanations */ - -#undef HAVE_PROTOTYPES -#undef HAVE_UNSIGNED_CHAR -#undef HAVE_UNSIGNED_SHORT -#undef void -#undef const -#undef CHAR_IS_UNSIGNED -#undef HAVE_STDDEF_H -#undef HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS -#undef NEED_SHORT_EXTERNAL_NAMES -/* Define this if you get warnings about undefined structures. */ -#undef INCOMPLETE_TYPES_BROKEN - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED -#undef INLINE -/* These are for configuring the JPEG memory manager. */ -#undef DEFAULT_MAX_MEM -#undef NO_MKTEMP - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#undef TWO_FILE_COMMANDLINE -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE - -/* Define this if you want percent-done progress reports from cjpeg/djpeg. */ -#undef PROGRESS_REPORT - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jconfig.h b/jconfig.h deleted file mode 100644 index 7e291c75..00000000 --- a/jconfig.h +++ /dev/null @@ -1,45 +0,0 @@ -/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ -/* see jconfig.doc for explanations */ - -#define HAVE_PROTOTYPES -#define HAVE_UNSIGNED_CHAR -#define HAVE_UNSIGNED_SHORT -/* #define void char */ -/* #define const */ -#undef CHAR_IS_UNSIGNED -#define HAVE_STDDEF_H -#define HAVE_STDLIB_H -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN - -/* Define "boolean" as unsigned char, not int, per Windows custom */ -#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ -typedef unsigned char boolean; -#endif -#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ - - -#ifdef JPEG_INTERNALS - -#undef RIGHT_SHIFT_IS_UNSIGNED - -#endif /* JPEG_INTERNALS */ - -#ifdef JPEG_CJPEG_DJPEG - -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ - -#define TWO_FILE_COMMANDLINE /* optional */ -#define USE_SETMODE /* Microsoft has setmode() */ -#undef NEED_SIGNAL_CATCHER -#undef DONT_USE_B_MODE -#undef PROGRESS_REPORT /* optional */ - -#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jcphuff.c b/jcphuff.c index 07f9178b..7b235d7b 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -223,7 +223,7 @@ dump_buffer (phuff_entropy_ptr entropy) * between calls, so 24 bits are sufficient. */ -INLINE +inline LOCAL(void) emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ @@ -276,7 +276,7 @@ flush_bits (phuff_entropy_ptr entropy) * Emit (or just count) a Huffman symbol. */ -INLINE +inline LOCAL(void) emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) { diff --git a/jmorecfg.h b/jmorecfg.h index 54a7d1c4..69d4fe02 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -62,11 +62,11 @@ typedef unsigned char JSAMPLE; #else /* not HAVE_UNSIGNED_CHAR */ typedef char JSAMPLE; -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ #define GETJSAMPLE(value) ((int) (value)) #else #define GETJSAMPLE(value) ((int) (value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ +#endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ @@ -113,11 +113,11 @@ typedef unsigned char JOCTET; #else /* not HAVE_UNSIGNED_CHAR */ typedef char JOCTET; -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ #define GETJOCTET(value) (value) #else #define GETJOCTET(value) ((value) & 0xFF) -#endif /* CHAR_IS_UNSIGNED */ +#endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ @@ -134,11 +134,11 @@ typedef char JOCTET; #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char UINT8; #else /* not HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ typedef char UINT8; -#else /* not CHAR_IS_UNSIGNED */ +#else /* not __CHAR_UNSIGNED__ */ typedef short UINT8; -#endif /* CHAR_IS_UNSIGNED */ +#endif /* __CHAR_UNSIGNED__ */ #endif /* HAVE_UNSIGNED_CHAR */ /* UINT16 must hold at least the values 0..65535. */ @@ -319,21 +319,6 @@ typedef int boolean; /* Definitions for speed-related optimizations. */ - -/* If your compiler supports inline functions, define INLINE - * as the inline keyword; otherwise define it as empty. - */ - -#ifndef INLINE -#ifdef __GNUC__ /* for instance, GNU C knows about inline */ -#define INLINE __inline__ -#endif -#ifndef INLINE -#define INLINE /* default is to define it as empty */ -#endif -#endif - - /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER * as short on such a machine. MULTIPLIER must be at least 16 bits wide. From 66876653120d67b1d734c4e7fd1c56c952c5e85b Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Mon, 14 Apr 2008 13:11:58 +0000 Subject: [PATCH 003/985] - introduced common/jpeg/jconfig.h.in - minimal jconfig.h template --- configure.ac | 5 +++-- jconfig.h.in | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 jconfig.h.in diff --git a/configure.ac b/configure.ac index 28d86389..b8ada44c 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,8 @@ AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) - -AC_CONFIG_HEADER([jconfig.h:config.h.in]) +# config.h should not be included +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_HEADERS([jconfig.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/jconfig.h.in b/jconfig.h.in new file mode 100644 index 00000000..4a106977 --- /dev/null +++ b/jconfig.h.in @@ -0,0 +1,46 @@ +/* Define if your compiler supports prototypes */ +#undef HAVE_PROTOTYPES + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if the system has the type `unsigned char'. */ +#undef HAVE_UNSIGNED_CHAR + +/* Define to 1 if the system has the type `unsigned short'. */ +#undef HAVE_UNSIGNED_SHORT + +/* Define if you want use complete types */ +#undef INCOMPLETE_TYPES_BROKEN + +/* Define if you have BSD-like bzero and bcopy */ +#undef NEED_BSD_STRINGS + +/* Define if you need short function names */ +#undef NEED_SHORT_EXTERNAL_NAMES + +/* Define if you have sys/types.h */ +#undef NEED_SYS_TYPES_H + +/* Define if shift is unsigned */ +#undef RIGHT_SHIFT_IS_UNSIGNED + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t From 2d830a0e0c8db291854fa9e8650eb5aa7d7d7c0d Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Wed, 18 Jun 2008 15:29:19 +0000 Subject: [PATCH 004/985] Add headers to Makefile.am-s to fix "make dist" command in common/* subtree --- Makefile.am | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 530b8ded..b63c6025 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,14 @@ noinst_LTLIBRARIES = libjpeg.la -libjpeg_la_SOURCES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ - jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c \ - jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ - jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c \ - jdhuff.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 jmemnobs.c +HDRS = jchuff.h jdct.h jdhuff.h jinclude.h jmemsys.h jpegint.h jpeglib.h \ + jversion.h + +libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ + jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ + jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \ + jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ + jddctmgr.c jdhuff.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 jmemnobs.c From c653640b0d48815618cd36deb3684c672658638a Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Wed, 22 Oct 2008 11:19:25 +0000 Subject: [PATCH 005/985] [Bugfix] Include man files and more jpeg libraries in tarball --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index b63c6025..7404d10b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libjpeg.la -HDRS = jchuff.h jdct.h jdhuff.h jinclude.h jmemsys.h jpegint.h jpeglib.h \ - jversion.h +HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ + jpegint.h jpeglib.h jversion.h libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ From e2796477e6fc29aab25b82a8cee7945e4ab7a6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Tue, 2 Dec 2008 09:56:26 +0000 Subject: [PATCH 006/985] This should be the final modification to restore a working Visual Studio build. A static jconfig.h has been re-added, but in a separate directory, to avoid clash with jconfig.h generated by configure script. Also, jconfig.h now includes the inline macro. jpeg.dsp has been modified to search in the "win" subdir, to find jconfig.h. This patch is in spirit similar to r121. --- jpeg.dsp | 4 ++-- win/jconfig.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 win/jconfig.h diff --git a/jpeg.dsp b/jpeg.dsp index c5685926..27edabf7 100644 --- a/jpeg.dsp +++ b/jpeg.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "..\Release\jpeg" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c /I "win" # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c /I "win" # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe diff --git a/win/jconfig.h b/win/jconfig.h new file mode 100644 index 00000000..7987ba6f --- /dev/null +++ b/win/jconfig.h @@ -0,0 +1,46 @@ +/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ +/* see jconfig.doc for explanations */ + +#define HAVE_PROTOTYPES +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +/* #define void char */ +/* #define const */ +#undef CHAR_IS_UNSIGNED +#define HAVE_STDDEF_H +#define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ +#undef NEED_SHORT_EXTERNAL_NAMES +#undef INCOMPLETE_TYPES_BROKEN + +/* Define "boolean" as unsigned char, not int, per Windows custom */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ + +#define inline __inline + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +#endif /* JPEG_INTERNALS */ + +#ifdef JPEG_CJPEG_DJPEG + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef RLE_SUPPORTED /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ + +#define TWO_FILE_COMMANDLINE /* optional */ +#define USE_SETMODE /* Microsoft has setmode() */ +#undef NEED_SIGNAL_CATCHER +#undef DONT_USE_B_MODE +#undef PROGRESS_REPORT /* optional */ + +#endif /* JPEG_CJPEG_DJPEG */ From f83b43b7c9950b9aaa737298e4419db3d3cd488c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Fri, 27 Feb 2009 10:12:14 +0000 Subject: [PATCH 007/985] Rebrand the source as TigerVNC. It is my hope that this patch is minimal but still complete. The rebranding was done using a script: find trunk -name .svn -prune -o -type f -exec rep.sh \{\} \; pushd trunk svn revert doc/TODO doc/registered-codes.txt doc/ft-protocol-problems.txt doc/rfbtight.tex perl -pi -e 's|tightvnc|tigervnc|g' unix/configure.ac win/configure.ac unix/README With rep.sh looking like: perl -pi -e 's|TightVNC|TigerVNC|g' "$@" perl -pi -e 's|www\.tightvnc\.com/bugs\.html|www\.tigervnc\.org|g' "$@" perl -pi -e 's|www\.tightvnc\.com|www\.tigervnc\.org|g' "$@" perl -pi -e 's|devteam\@tightvnc\.com|tigervnc-devel\@lists\.sourceforge\.net|g' "$@" perl -pi -e 's|TigerVNC Team|TightVNC Team|g' "$@" perl -pi -e 's|TigerVNC Group|TightVNC Group|g' "$@" perl -pi -e 's|TigerVNC protocol|TightVNC protocol|g' "$@" perl -pi -e 's|TigerVNC-specific|TightVNC-specific|g' "$@" perl -pi -e 's|Vendor signatures: standard VNC/RealVNC, TridiaVNC, and TigerVNC|Vendor signatures: standard VNC/RealVNC, TridiaVNC, and TightVNC|g' "$@" perl -pi -e 's|TigerVNC vendor|TightVNC vendor|g' "$@" perl -pi -e 's|TigerVNC extension|TightVNC extension|g' "$@" perl -pi -e 's|protocolTigerVNC|protocolTightVNC|g' "$@" perl -pi -e 's|TigerVNC additions were|TightVNC additions were|g' "$@" perl -pi -e 's|TigerVNC 1\.2|TightVNC 1\.2|g' "$@" perl -pi -e 's|TigerVNC authentication type|TightVNC authentication type|g' "$@" --- README_TightVNC.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_TightVNC.txt b/README_TightVNC.txt index 72d502dc..c73070a6 100644 --- a/README_TightVNC.txt +++ b/README_TightVNC.txt @@ -1,5 +1,5 @@ This directory includes a copy of the Independent JPEG Group's JPEG library (see the README file for more information). Not all the files -from the original distribution have been included into the TightVNC +from the original distribution have been included into the TigerVNC codebase. To obtain the original library, please see the README file, section "ARCHIVE LOCATIONS". From ebd61664881f1bc07209ebffc614ae3de7fe5aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Tue, 3 Mar 2009 12:04:47 +0000 Subject: [PATCH 008/985] Renamed README_TightVNC.txt as README_TigerVNC.txt --- README_TightVNC.txt => README_TigerVNC.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README_TightVNC.txt => README_TigerVNC.txt (100%) diff --git a/README_TightVNC.txt b/README_TigerVNC.txt similarity index 100% rename from README_TightVNC.txt rename to README_TigerVNC.txt From 8622727c098c751d33f121a265532ee053425570 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 6 Mar 2009 15:00:56 +0000 Subject: [PATCH 009/985] Don't test for GNU malloc as we don't need it (or even check the result of the test). --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index b8ada44c..bc8a4621 100644 --- a/configure.ac +++ b/configure.ac @@ -68,7 +68,6 @@ AC_TRY_LINK( AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, [Define if you need short function names])]) # Checks for library functions. -AC_FUNC_MALLOC AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) From f1962bc0ceaaaae6fcf50229c69e99e96ebd075e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 6 Mar 2009 15:30:42 +0000 Subject: [PATCH 010/985] Explain the config header voodoo. --- configure.ac | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bc8a4621..79bdb456 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,10 @@ AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) -# config.h should not be included +# jconfig.h is the file we use, but we have another before that to +# fool autoheader. the reason is that we include this header in our +# API headers, which can screw things up for users of the lib. +# jconfig.h is a minimal version that allows this package to be built AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([jconfig.h]) AC_CONFIG_FILES([Makefile]) From d7bacc072182f603d7d31730fedb5e92af2475b6 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 10:34:53 +0000 Subject: [PATCH 011/985] Improve memory allocater alignment handling Fix some broken assumptions and allow any alignment, not just those associated with C types. --- jmemmgr.c | 164 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 92 insertions(+), 72 deletions(-) diff --git a/jmemmgr.c b/jmemmgr.c index d801b322..5b335673 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -57,23 +57,22 @@ extern char * getenv JPP((const char * name)); * requirement, and we had better do so too. * There isn't any really portable way to determine the worst-case alignment * requirement. This module assumes that the alignment requirement is - * multiples of sizeof(ALIGN_TYPE). - * By default, we define ALIGN_TYPE as double. This is necessary on some + * multiples of ALIGN_SIZE. + * By default, we define ALIGN_SIZE as sizeof(double). This is necessary on some * workstations (where doubles really do need 8-byte alignment) and will work * fine on nearly everything. If your machine has lesser alignment needs, - * you can save a few bytes by making ALIGN_TYPE smaller. + * you can save a few bytes by making ALIGN_SIZE smaller. * The only place I know of where this will NOT work is certain Macintosh * 680x0 compilers that define double as a 10-byte IEEE extended float. * Doing 10-byte alignment is counterproductive because longwords won't be - * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have + * aligned well. Put "#define ALIGN_SIZE 4" in jconfig.h if you have * such a compiler. */ -#ifndef ALIGN_TYPE /* so can override from jconfig.h */ -#define ALIGN_TYPE double +#ifndef ALIGN_SIZE /* so can override from jconfig.h */ +#define ALIGN_SIZE SIZEOF(double) #endif - /* * We allocate objects from "pools", where each pool is gotten with a single * request to jpeg_get_small() or jpeg_get_large(). There is no per-object @@ -81,34 +80,24 @@ extern char * getenv JPP((const char * name)); * header with a link to the next pool of the same class. * Small and large pool headers are identical except that the latter's * link pointer must be FAR on 80x86 machines. - * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE - * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple - * of the alignment requirement of ALIGN_TYPE. */ -typedef union small_pool_struct * small_pool_ptr; +typedef struct small_pool_struct * small_pool_ptr; -typedef union small_pool_struct { - struct { - small_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ - } hdr; - ALIGN_TYPE dummy; /* included in union to ensure alignment */ +typedef struct small_pool_struct { + small_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ } small_pool_hdr; -typedef union large_pool_struct FAR * large_pool_ptr; +typedef struct large_pool_struct FAR * large_pool_ptr; -typedef union large_pool_struct { - struct { - large_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ - } hdr; - ALIGN_TYPE dummy; /* included in union to ensure alignment */ +typedef struct large_pool_struct { + large_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ } large_pool_hdr; - /* * Here is the full definition of a memory manager object. */ @@ -197,16 +186,16 @@ print_mem_stats (j_common_ptr cinfo, int pool_id) pool_id, mem->total_space_allocated); for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; - lhdr_ptr = lhdr_ptr->hdr.next) { + lhdr_ptr = lhdr_ptr->next) { fprintf(stderr, " Large chunk used %ld\n", - (long) lhdr_ptr->hdr.bytes_used); + (long) lhdr_ptr->bytes_used); } for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; - shdr_ptr = shdr_ptr->hdr.next) { + shdr_ptr = shdr_ptr->next) { fprintf(stderr, " Small chunk used %ld free %ld\n", - (long) shdr_ptr->hdr.bytes_used, - (long) shdr_ptr->hdr.bytes_left); + (long) shdr_ptr->bytes_used, + (long) shdr_ptr->bytes_left); } } @@ -236,6 +225,10 @@ out_of_memory (j_common_ptr cinfo, int which) * and we also distinguish the first pool of a class from later ones. * NOTE: the values given work fairly well on both 16- and 32-bit-int * machines, but may be too small if longs are 64 bits or more. + * + * Since we do not know what alignment malloc() gives us, we have to + * allocate ALIGN_SIZE-1 extra space per pool to have room for alignment + * adjustment. */ static const size_t first_pool_slop[JPOOL_NUMPOOLS] = @@ -260,33 +253,36 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) my_mem_ptr mem = (my_mem_ptr) cinfo->mem; small_pool_ptr hdr_ptr, prev_hdr_ptr; char * data_ptr; - size_t odd_bytes, min_request, slop; + size_t min_request, slop; + + /* + * Round up the requested size to a multiple of ALIGN_SIZE in order + * to assure alignment for the next object allocated in the same pool + * and so that algorithms can straddle outside the proper area up + * to the next alignment. + */ + sizeofobject = jround_up(sizeofobject, ALIGN_SIZE); /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr))) + if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ - /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ - odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); - if (odd_bytes > 0) - sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; - /* See if space is available in any existing pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ prev_hdr_ptr = NULL; hdr_ptr = mem->small_list[pool_id]; while (hdr_ptr != NULL) { - if (hdr_ptr->hdr.bytes_left >= sizeofobject) + if (hdr_ptr->bytes_left >= sizeofobject) break; /* found pool with enough space */ prev_hdr_ptr = hdr_ptr; - hdr_ptr = hdr_ptr->hdr.next; + hdr_ptr = hdr_ptr->next; } /* Time to make a new pool? */ if (hdr_ptr == NULL) { /* min_request is what we need now, slop is what will be leftover */ - min_request = sizeofobject + SIZEOF(small_pool_hdr); + min_request = SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1; if (prev_hdr_ptr == NULL) /* first pool in class? */ slop = first_pool_slop[pool_id]; else @@ -305,20 +301,23 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) } mem->total_space_allocated += min_request + slop; /* Success, initialize the new pool header and add to end of list */ - hdr_ptr->hdr.next = NULL; - hdr_ptr->hdr.bytes_used = 0; - hdr_ptr->hdr.bytes_left = sizeofobject + slop; + hdr_ptr->next = NULL; + hdr_ptr->bytes_used = 0; + hdr_ptr->bytes_left = sizeofobject + slop; if (prev_hdr_ptr == NULL) /* first pool in class? */ mem->small_list[pool_id] = hdr_ptr; else - prev_hdr_ptr->hdr.next = hdr_ptr; + prev_hdr_ptr->next = hdr_ptr; } /* OK, allocate the object from the current pool */ - data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */ - data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */ - hdr_ptr->hdr.bytes_used += sizeofobject; - hdr_ptr->hdr.bytes_left -= sizeofobject; + data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */ + data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */ + if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */ + data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE; + data_ptr += hdr_ptr->bytes_used; /* point to place for object */ + hdr_ptr->bytes_used += sizeofobject; + hdr_ptr->bytes_left -= sizeofobject; return (void *) data_ptr; } @@ -344,37 +343,45 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; large_pool_ptr hdr_ptr; - size_t odd_bytes; + char FAR * data_ptr; + + /* + * Round up the requested size to a multiple of ALIGN_SIZE so that + * algorithms can straddle outside the proper area up to the next + * alignment. + */ + sizeofobject = jround_up(sizeofobject, ALIGN_SIZE); /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr))) + if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ - /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ - odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); - if (odd_bytes > 0) - sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; - /* Always make a new pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + - SIZEOF(large_pool_hdr)); + SIZEOF(large_pool_hdr) + + ALIGN_SIZE - 1); if (hdr_ptr == NULL) out_of_memory(cinfo, 4); /* jpeg_get_large failed */ - mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr); + mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr) + ALIGN_SIZE - 1; /* Success, initialize the new pool header and add to list */ - hdr_ptr->hdr.next = mem->large_list[pool_id]; + hdr_ptr->next = mem->large_list[pool_id]; /* We maintain space counts in each pool header for statistical purposes, * even though they are not needed for allocation. */ - hdr_ptr->hdr.bytes_used = sizeofobject; - hdr_ptr->hdr.bytes_left = 0; + hdr_ptr->bytes_used = sizeofobject; + hdr_ptr->bytes_left = 0; mem->large_list[pool_id] = hdr_ptr; - return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */ + data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */ + data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */ + if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */ + data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE; + + return (void FAR *) data_ptr; } @@ -389,6 +396,10 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) * this chunking of rows. The rowsperchunk value is left in the mem manager * object so that it can be saved away if this sarray is the workspace for * a virtual array. + * + * Since we are often upsampling with a factor 2, we align the size (not + * the start) to 2 * ALIGN_SIZE so that the upsampling routines don't have + * to be as careful about size. */ METHODDEF(JSAMPARRAY) @@ -402,6 +413,11 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, JDIMENSION rowsperchunk, currow, i; long ltemp; + /* Make sure each row is properly aligned */ + if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0) + out_of_memory(cinfo, 5); /* safety check */ + samplesperrow = jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE)); + /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / ((long) samplesperrow * SIZEOF(JSAMPLE)); @@ -450,6 +466,10 @@ alloc_barray (j_common_ptr cinfo, int pool_id, JDIMENSION rowsperchunk, currow, i; long ltemp; + /* Make sure each row is properly aligned */ + if ((SIZEOF(JBLOCK) % ALIGN_SIZE) != 0) + out_of_memory(cinfo, 6); /* safety check */ + /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / ((long) blocksperrow * SIZEOF(JBLOCK)); @@ -968,9 +988,9 @@ free_pool (j_common_ptr cinfo, int pool_id) mem->large_list[pool_id] = NULL; while (lhdr_ptr != NULL) { - large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next; - space_freed = lhdr_ptr->hdr.bytes_used + - lhdr_ptr->hdr.bytes_left + + large_pool_ptr next_lhdr_ptr = lhdr_ptr->next; + space_freed = lhdr_ptr->bytes_used + + lhdr_ptr->bytes_left + SIZEOF(large_pool_hdr); jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); mem->total_space_allocated -= space_freed; @@ -982,9 +1002,9 @@ free_pool (j_common_ptr cinfo, int pool_id) mem->small_list[pool_id] = NULL; while (shdr_ptr != NULL) { - small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next; - space_freed = shdr_ptr->hdr.bytes_used + - shdr_ptr->hdr.bytes_left + + small_pool_ptr next_shdr_ptr = shdr_ptr->next; + space_freed = shdr_ptr->bytes_used + + shdr_ptr->bytes_left + SIZEOF(small_pool_hdr); jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); mem->total_space_allocated -= space_freed; @@ -1041,16 +1061,16 @@ jinit_memory_mgr (j_common_ptr cinfo) * in common if and only if X is a power of 2, ie has only one one-bit. * Some compilers may give an "unreachable code" warning here; ignore it. */ - if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0) + if ((ALIGN_SIZE & (ALIGN_SIZE-1)) != 0) ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE); /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be - * a multiple of SIZEOF(ALIGN_TYPE). + * a multiple of ALIGN_SIZE. * Again, an "unreachable code" warning may be ignored here. * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK. */ test_mac = (size_t) MAX_ALLOC_CHUNK; if ((long) test_mac != MAX_ALLOC_CHUNK || - (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0) + (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0) ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */ From a4f55b50c9169ad209e06f5867fe8ae3ed8c8aa0 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 10:37:20 +0000 Subject: [PATCH 012/985] Split up the forward DCT routine into three stages Divide it into sample conversion, DCT and quantization in order to easily provide alternative implementations of each stage. --- jcdctmgr.c | 311 ++++++++++++++++++++++++++++++++++------------------- jdct.h | 3 - 2 files changed, 201 insertions(+), 113 deletions(-) diff --git a/jcdctmgr.c b/jcdctmgr.c index 61fa79b9..45b9c0dc 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -19,11 +19,30 @@ /* Private subobject for this module */ +typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); +typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); + +typedef JMETHOD(void, convsamp_method_ptr, + (JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM * workspace)); +typedef JMETHOD(void, float_convsamp_method_ptr, + (JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT *workspace)); + +typedef JMETHOD(void, quantize_method_ptr, + (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace)); +typedef JMETHOD(void, float_quantize_method_ptr, + (JCOEFPTR coef_block, FAST_FLOAT * divisors, + FAST_FLOAT * workspace)); + typedef struct { struct jpeg_forward_dct pub; /* public fields */ /* Pointer to the DCT routine actually in use */ - forward_DCT_method_ptr do_dct; + forward_DCT_method_ptr dct; + convsamp_method_ptr convsamp; + quantize_method_ptr quantize; /* The actual post-DCT divisors --- not identical to the quant table * entries, because of scaling (especially for an unnormalized DCT). @@ -33,7 +52,9 @@ typedef struct { #ifdef DCT_FLOAT_SUPPORTED /* Same as above for the floating-point case. */ - float_DCT_method_ptr do_float_dct; + float_DCT_method_ptr float_dct; + float_convsamp_method_ptr float_convsamp; + float_quantize_method_ptr float_quantize; FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; #endif } my_fdct_controller; @@ -168,6 +189,88 @@ start_pass_fdctmgr (j_compress_ptr cinfo) } +/* + * Load data into workspace, applying unsigned->signed conversion. + */ + +METHODDEF(void) +convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) +{ + register DCTELEM *workspaceptr; + register JSAMPROW elemptr; + register int elemr; + + workspaceptr = workspace; + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = sample_data[elemr] + start_col; + +#if DCTSIZE == 8 /* unroll the inner loop */ + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; +#else + { + register int elemc; + for (elemc = DCTSIZE; elemc > 0; elemc--) + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + } +#endif + } +} + + +/* + * Quantize/descale the coefficients, and store into coef_blocks[]. + */ + +METHODDEF(void) +quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) +{ + register DCTELEM temp, qval; + register int i; + register JCOEFPTR output_ptr = coef_block; + + for (i = 0; i < DCTSIZE2; i++) { + qval = divisors[i]; + temp = workspace[i]; + + /* Divide the coefficient value by qval, ensuring proper rounding. + * Since C does not specify the direction of rounding for negative + * quotients, we have to force the dividend positive for portability. + * + * In most files, at least half of the output values will be zero + * (at default quantization settings, more like three-quarters...) + * so we should ensure that this case is fast. On many machines, + * a comparison is enough cheaper than a divide to make a special test + * a win. Since both inputs will be nonnegative, we need only test + * for a < b to discover whether a/b is 0. + * If your machine's division is fast enough, define FAST_DIVIDE. + */ +#ifdef FAST_DIVIDE +#define DIVIDE_BY(a,b) a /= b +#else +#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 +#endif + + if (temp < 0) { + temp = -temp; + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + temp = -temp; + } else { + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + } + output_ptr[i] = (JCOEF) temp; + } +} + + /* * Perform forward DCT on one or more blocks of a component. * @@ -185,87 +288,86 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, { /* This routine is heavily used, so it's worth coding it tightly. */ my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; - forward_DCT_method_ptr do_dct = fdct->do_dct; DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ JDIMENSION bi; + /* Make sure the compiler doesn't look up these every pass */ + forward_DCT_method_ptr do_dct = fdct->dct; + convsamp_method_ptr do_convsamp = fdct->convsamp; + quantize_method_ptr do_quantize = fdct->quantize; + sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ - { register DCTELEM *workspaceptr; - register JSAMPROW elemptr; - register int elemr; - - workspaceptr = workspace; - for (elemr = 0; elemr < DCTSIZE; elemr++) { - elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; -#else - { register int elemc; - for (elemc = DCTSIZE; elemc > 0; elemc--) { - *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; - } - } -#endif - } - } + (*do_convsamp) (sample_data, start_col, workspace); /* Perform the DCT */ (*do_dct) (workspace); /* Quantize/descale the coefficients, and store into coef_blocks[] */ - { register DCTELEM temp, qval; - register int i; - register JCOEFPTR output_ptr = coef_blocks[bi]; - - for (i = 0; i < DCTSIZE2; i++) { - qval = divisors[i]; - temp = workspace[i]; - /* Divide the coefficient value by qval, ensuring proper rounding. - * Since C does not specify the direction of rounding for negative - * quotients, we have to force the dividend positive for portability. - * - * In most files, at least half of the output values will be zero - * (at default quantization settings, more like three-quarters...) - * so we should ensure that this case is fast. On many machines, - * a comparison is enough cheaper than a divide to make a special test - * a win. Since both inputs will be nonnegative, we need only test - * for a < b to discover whether a/b is 0. - * If your machine's division is fast enough, define FAST_DIVIDE. - */ -#ifdef FAST_DIVIDE -#define DIVIDE_BY(a,b) a /= b -#else -#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 -#endif - if (temp < 0) { - temp = -temp; - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - temp = -temp; - } else { - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - } - output_ptr[i] = (JCOEF) temp; - } - } + (*do_quantize) (coef_blocks[bi], divisors, workspace); } } #ifdef DCT_FLOAT_SUPPORTED + +METHODDEF(void) +convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) +{ + register FAST_FLOAT *workspaceptr; + register JSAMPROW elemptr; + register int elemr; + + workspaceptr = workspace; + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = sample_data[elemr] + start_col; +#if DCTSIZE == 8 /* unroll the inner loop */ + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); +#else + { + register int elemc; + for (elemc = DCTSIZE; elemc > 0; elemc--) + *workspaceptr++ = (FAST_FLOAT) + (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + } +#endif + } +} + + +METHODDEF(void) +quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) +{ + register FAST_FLOAT temp; + register int i; + register JCOEFPTR output_ptr = coef_block; + + for (i = 0; i < DCTSIZE2; i++) { + /* Apply the quantization and scaling factor */ + temp = workspace[i] * divisors[i]; + + /* Round to nearest integer. + * Since C does not specify the direction of rounding for negative + * quotients, we have to force the dividend positive for portability. + * The maximum coefficient size is +-16K (for 12-bit data), so this + * code should work for either 16-bit or 32-bit ints. + */ + output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); + } +} + + METHODDEF(void) forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, @@ -275,62 +377,26 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, { /* This routine is heavily used, so it's worth coding it tightly. */ my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; - float_DCT_method_ptr do_dct = fdct->do_float_dct; FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ JDIMENSION bi; + /* Make sure the compiler doesn't look up these every pass */ + float_DCT_method_ptr do_dct = fdct->float_dct; + float_convsamp_method_ptr do_convsamp = fdct->float_convsamp; + float_quantize_method_ptr do_quantize = fdct->float_quantize; + sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ - { register FAST_FLOAT *workspaceptr; - register JSAMPROW elemptr; - register int elemr; - - workspaceptr = workspace; - for (elemr = 0; elemr < DCTSIZE; elemr++) { - elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); -#else - { register int elemc; - for (elemc = DCTSIZE; elemc > 0; elemc--) { - *workspaceptr++ = (FAST_FLOAT) - (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); - } - } -#endif - } - } + (*do_convsamp) (sample_data, start_col, workspace); /* Perform the DCT */ (*do_dct) (workspace); /* Quantize/descale the coefficients, and store into coef_blocks[] */ - { register FAST_FLOAT temp; - register int i; - register JCOEFPTR output_ptr = coef_blocks[bi]; - - for (i = 0; i < DCTSIZE2; i++) { - /* Apply the quantization and scaling factor */ - temp = workspace[i] * divisors[i]; - /* Round to nearest integer. - * Since C does not specify the direction of rounding for negative - * quotients, we have to force the dividend positive for portability. - * The maximum coefficient size is +-16K (for 12-bit data), so this - * code should work for either 16-bit or 32-bit ints. - */ - output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); - } - } + (*do_quantize) (coef_blocks[bi], divisors, workspace); } } @@ -353,23 +419,48 @@ jinit_forward_dct (j_compress_ptr cinfo) cinfo->fdct = (struct jpeg_forward_dct *) fdct; fdct->pub.start_pass = start_pass_fdctmgr; + /* First determine the DCT... */ switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: fdct->pub.forward_DCT = forward_DCT; - fdct->do_dct = jpeg_fdct_islow; + fdct->dct = jpeg_fdct_islow; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: fdct->pub.forward_DCT = forward_DCT; - fdct->do_dct = jpeg_fdct_ifast; + fdct->dct = jpeg_fdct_ifast; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: fdct->pub.forward_DCT = forward_DCT_float; - fdct->do_float_dct = jpeg_fdct_float; + fdct->float_dct = jpeg_fdct_float; + break; +#endif + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } + + /* ...then the supporting stages. */ + switch (cinfo->dct_method) { +#ifdef DCT_ISLOW_SUPPORTED + case JDCT_ISLOW: +#endif +#ifdef DCT_IFAST_SUPPORTED + case JDCT_IFAST: +#endif +#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) + fdct->convsamp = convsamp; + fdct->quantize = quantize; + break; +#endif +#ifdef DCT_FLOAT_SUPPORTED + case JDCT_FLOAT: + fdct->float_convsamp = convsamp_float; + fdct->float_quantize = quantize_float; break; #endif default: diff --git a/jdct.h b/jdct.h index 04192a26..c3650ea0 100644 --- a/jdct.h +++ b/jdct.h @@ -32,9 +32,6 @@ typedef int DCTELEM; /* 16 or 32 bits is fine */ typedef INT32 DCTELEM; /* must have 32 bits */ #endif -typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); -typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); - /* * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer From c5cf41164af937772acea60c19f18dc2955458bf Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:15:56 +0000 Subject: [PATCH 013/985] Framework for supporting SIMD acceleration Designed to impose minimal changes on the "normal" code. --- Makefile.am | 5 +- configure.ac | 8 ++ jccolor.c | 10 +- jcdctmgr.c | 37 +++++- jconfig.h.in | 3 + jcsample.c | 12 +- jdcolor.c | 10 +- jddctmgr.c | 27 +++- jdmerge.c | 12 +- jdsample.c | 30 ++++- jsimd.c | 359 +++++++++++++++++++++++++++++++++++++++++++++++++++ jsimd.h | 89 +++++++++++++ jsimddct.h | 101 +++++++++++++++ 13 files changed, 674 insertions(+), 29 deletions(-) create mode 100644 jsimd.c create mode 100644 jsimd.h create mode 100644 jsimddct.h diff --git a/Makefile.am b/Makefile.am index 7404d10b..114dd7d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libjpeg.la HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ - jpegint.h jpeglib.h jversion.h + jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ @@ -10,5 +10,6 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jddctmgr.c jdhuff.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 jmemnobs.c + jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c \ + jsimd.c diff --git a/configure.ac b/configure.ac index 79bdb456..c2263f26 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,14 @@ AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) +# SIMD is optional +# todo: detect automatically when it can be enabled +AC_ARG_WITH([simd], + AC_HELP_STRING([--with-simd],[Include accelerated SIMD routines.])) +if test "x${with_simd}" != "xno"; then + AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) +fi + # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our # API headers, which can screw things up for users of the lib. diff --git a/jccolor.c b/jccolor.c index 0a8a4b5d..2407456c 100644 --- a/jccolor.c +++ b/jccolor.c @@ -2,6 +2,7 @@ * jccolor.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -11,6 +12,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" /* Private subobject */ @@ -420,8 +422,12 @@ jinit_color_converter (j_compress_ptr cinfo) if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_RGB) { - cconvert->pub.start_pass = rgb_ycc_start; - cconvert->pub.color_convert = rgb_ycc_convert; + if (jsimd_can_rgb_ycc()) + cconvert->pub.color_convert = jsimd_rgb_ycc_convert; + else { + cconvert->pub.start_pass = rgb_ycc_start; + cconvert->pub.color_convert = rgb_ycc_convert; + } } else if (cinfo->in_color_space == JCS_YCbCr) cconvert->pub.color_convert = null_convert; else diff --git a/jcdctmgr.c b/jcdctmgr.c index 45b9c0dc..75d48e02 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -2,6 +2,7 @@ * jcdctmgr.c * * Copyright (C) 1994-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -15,6 +16,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jsimddct.h" /* Private subobject for this module */ @@ -424,19 +426,28 @@ jinit_forward_dct (j_compress_ptr cinfo) #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: fdct->pub.forward_DCT = forward_DCT; - fdct->dct = jpeg_fdct_islow; + if (jsimd_can_fdct_islow()) + fdct->dct = jsimd_fdct_islow; + else + fdct->dct = jpeg_fdct_islow; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: fdct->pub.forward_DCT = forward_DCT; - fdct->dct = jpeg_fdct_ifast; + if (jsimd_can_fdct_ifast()) + fdct->dct = jsimd_fdct_ifast; + else + fdct->dct = jpeg_fdct_ifast; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: fdct->pub.forward_DCT = forward_DCT_float; - fdct->float_dct = jpeg_fdct_float; + if (jsimd_can_fdct_float()) + fdct->float_dct = jsimd_fdct_float; + else + fdct->float_dct = jpeg_fdct_float; break; #endif default: @@ -453,14 +464,26 @@ jinit_forward_dct (j_compress_ptr cinfo) case JDCT_IFAST: #endif #if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) - fdct->convsamp = convsamp; - fdct->quantize = quantize; + if (jsimd_can_convsamp()) + fdct->convsamp = jsimd_convsamp; + else + fdct->convsamp = convsamp; + if (jsimd_can_quantize()) + fdct->quantize = jsimd_quantize; + else + fdct->quantize = quantize; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: - fdct->float_convsamp = convsamp_float; - fdct->float_quantize = quantize_float; + if (jsimd_can_convsamp_float()) + fdct->float_convsamp = jsimd_convsamp_float; + else + fdct->float_convsamp = convsamp_float; + if (jsimd_can_quantize_float()) + fdct->float_quantize = jsimd_quantize_float; + else + fdct->float_quantize = quantize_float; break; #endif default: diff --git a/jconfig.h.in b/jconfig.h.in index 4a106977..4e5e80ed 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -28,6 +28,9 @@ /* Define if shift is unsigned */ #undef RIGHT_SHIFT_IS_UNSIGNED +/* Use accelerated SIMD routines. */ +#undef WITH_SIMD + /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ diff --git a/jcsample.c b/jcsample.c index 212ec875..eea376f9 100644 --- a/jcsample.c +++ b/jcsample.c @@ -2,6 +2,7 @@ * jcsample.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -48,6 +49,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" /* Pointer to routine to downsample a single component */ @@ -494,7 +496,10 @@ jinit_downsampler (j_compress_ptr cinfo) } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && compptr->v_samp_factor == cinfo->max_v_samp_factor) { smoothok = FALSE; - downsample->methods[ci] = h2v1_downsample; + if (jsimd_can_h2v1_downsample()) + downsample->methods[ci] = jsimd_h2v1_downsample; + else + downsample->methods[ci] = h2v1_downsample; } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED @@ -503,7 +508,10 @@ jinit_downsampler (j_compress_ptr cinfo) downsample->pub.need_context_rows = TRUE; } else #endif - downsample->methods[ci] = h2v2_downsample; + if (jsimd_can_h2v2_downsample()) + downsample->methods[ci] = jsimd_h2v2_downsample; + else + downsample->methods[ci] = h2v2_downsample; } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { smoothok = FALSE; diff --git a/jdcolor.c b/jdcolor.c index 6c04dfe8..d2d1483d 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -2,6 +2,7 @@ * jdcolor.c * * Copyright (C) 1991-1997, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -11,6 +12,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" /* Private subobject */ @@ -358,8 +360,12 @@ jinit_color_deconverter (j_decompress_ptr cinfo) case JCS_RGB: cinfo->out_color_components = RGB_PIXELSIZE; if (cinfo->jpeg_color_space == JCS_YCbCr) { - cconvert->pub.color_convert = ycc_rgb_convert; - build_ycc_rgb_table(cinfo); + if (jsimd_can_ycc_rgb()) + cconvert->pub.color_convert = jsimd_ycc_rgb_convert; + else { + cconvert->pub.color_convert = ycc_rgb_convert; + build_ycc_rgb_table(cinfo); + } } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { cconvert->pub.color_convert = gray_rgb_convert; } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { diff --git a/jddctmgr.c b/jddctmgr.c index bbf8d0e9..52f50906 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -2,6 +2,7 @@ * jddctmgr.c * * Copyright (C) 1994-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -19,6 +20,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jsimddct.h" /* @@ -105,11 +107,17 @@ start_pass (j_decompress_ptr cinfo) method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 2: - method_ptr = jpeg_idct_2x2; + if (jsimd_can_idct_2x2()) + method_ptr = jsimd_idct_2x2; + else + method_ptr = jpeg_idct_2x2; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 4: - method_ptr = jpeg_idct_4x4; + if (jsimd_can_idct_4x4()) + method_ptr = jsimd_idct_4x4; + else + method_ptr = jpeg_idct_4x4; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; #endif @@ -117,19 +125,28 @@ start_pass (j_decompress_ptr cinfo) switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: - method_ptr = jpeg_idct_islow; + if (jsimd_can_idct_islow()) + method_ptr = jsimd_idct_islow; + else + method_ptr = jpeg_idct_islow; method = JDCT_ISLOW; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: - method_ptr = jpeg_idct_ifast; + if (jsimd_can_idct_ifast()) + method_ptr = jsimd_idct_ifast; + else + method_ptr = jpeg_idct_ifast; method = JDCT_IFAST; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: - method_ptr = jpeg_idct_float; + if (jsimd_can_idct_float()) + method_ptr = jsimd_idct_float; + else + method_ptr = jpeg_idct_float; method = JDCT_FLOAT; break; #endif diff --git a/jdmerge.c b/jdmerge.c index 37444468..77429412 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -2,6 +2,7 @@ * jdmerge.c * * Copyright (C) 1994-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -35,6 +36,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" #ifdef UPSAMPLE_MERGING_SUPPORTED @@ -382,14 +384,20 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) if (cinfo->max_v_samp_factor == 2) { upsample->pub.upsample = merged_2v_upsample; - upsample->upmethod = h2v2_merged_upsample; + if (jsimd_can_h2v2_merged_upsample()) + upsample->upmethod = jsimd_h2v2_merged_upsample; + else + upsample->upmethod = h2v2_merged_upsample; /* Allocate a spare row buffer */ upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); } else { upsample->pub.upsample = merged_1v_upsample; - upsample->upmethod = h2v1_merged_upsample; + if (jsimd_can_h2v1_merged_upsample()) + upsample->upmethod = jsimd_h2v1_merged_upsample; + else + upsample->upmethod = h2v1_merged_upsample; /* No spare row needed */ upsample->spare_row = NULL; } diff --git a/jdsample.c b/jdsample.c index 80ffefb2..4e0b8b40 100644 --- a/jdsample.c +++ b/jdsample.c @@ -2,6 +2,7 @@ * jdsample.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -21,6 +22,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" /* Pointer to routine to upsample a single component */ @@ -447,18 +449,32 @@ jinit_upsampler (j_decompress_ptr cinfo) } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { /* Special cases for 2h1v upsampling */ - if (do_fancy && compptr->downsampled_width > 2) - upsample->methods[ci] = h2v1_fancy_upsample; - else - upsample->methods[ci] = h2v1_upsample; + if (do_fancy && compptr->downsampled_width > 2) { + if (jsimd_can_h2v1_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v1_fancy_upsample; + else + upsample->methods[ci] = h2v1_fancy_upsample; + } else { + if (jsimd_can_h2v1_upsample()) + upsample->methods[ci] = jsimd_h2v1_upsample; + else + upsample->methods[ci] = h2v1_upsample; + } } else if (h_in_group * 2 == h_out_group && v_in_group * 2 == v_out_group) { /* Special cases for 2h2v upsampling */ if (do_fancy && compptr->downsampled_width > 2) { - upsample->methods[ci] = h2v2_fancy_upsample; + if (jsimd_can_h2v2_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v2_fancy_upsample; + else + upsample->methods[ci] = h2v2_fancy_upsample; upsample->pub.need_context_rows = TRUE; - } else - upsample->methods[ci] = h2v2_upsample; + } else { + if (jsimd_can_h2v2_upsample()) + upsample->methods[ci] = jsimd_h2v2_upsample; + else + upsample->methods[ci] = h2v2_upsample; + } } else if ((h_out_group % h_in_group) == 0 && (v_out_group % v_in_group) == 0) { /* Generic integral-factors upsampling method */ diff --git a/jsimd.c b/jsimd.c new file mode 100644 index 00000000..c6378e86 --- /dev/null +++ b/jsimd.c @@ -0,0 +1,359 @@ +/* + * jsimd.c + * + * Copyright 2009 Pierre Ossman for Cendio AB + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + * This file contains the interface between the "normal" portions + * of the library and the SIMD implementations. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" + +#define JSIMD_NONE 0x00 + +static unsigned int simd_support = ~0; + +/* + * Check what SIMD accelerations are supported. + * + * FIXME: This code is racy under a multi-threaded environment. + */ +LOCAL(void) +init_simd (void) +{ + if (simd_support != ~0) + return; + + simd_support = JSIMD_NONE; +} + +GLOBAL(int) +jsimd_can_rgb_ycc (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_ycc_rgb (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_rgb_ycc_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ +} + +GLOBAL(void) +jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_downsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_downsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ +} + +GLOBAL(void) +jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(void) +jsimd_h2v1_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_fancy_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_fancy_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(void) +jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_merged_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_merged_upsample (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ +} + +GLOBAL(void) +jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ +} + +GLOBAL(int) +jsimd_can_convsamp (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_convsamp_float (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM * workspace) +{ +} + +GLOBAL(void) +jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT * workspace) +{ +} + +GLOBAL(int) +jsimd_can_fdct_islow (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_ifast (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_float (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_fdct_islow (DCTELEM * data) +{ +} + +GLOBAL(void) +jsimd_fdct_ifast (DCTELEM * data) +{ +} + +GLOBAL(void) +jsimd_fdct_float (FAST_FLOAT * data) +{ +} + +GLOBAL(int) +jsimd_can_quantize (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_quantize_float (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace) +{ +} + +GLOBAL(void) +jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, + FAST_FLOAT * workspace) +{ +} + +GLOBAL(int) +jsimd_can_idct_2x2 (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_4x4 (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(int) +jsimd_can_idct_islow (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_ifast (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(int) +jsimd_can_idct_float (void) +{ + init_simd(); + + return 0; +} + +GLOBAL(void) +jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + diff --git a/jsimd.h b/jsimd.h new file mode 100644 index 00000000..90be19ee --- /dev/null +++ b/jsimd.h @@ -0,0 +1,89 @@ +/* + * jsimd.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + */ + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jsimd_can_rgb_ycc jSCanRgbYcc +#define jsimd_can_ycc_rgb jSCanYccRgb +#define jsimd_rgb_ycc_convert jSRgbYccConv +#define jsimd_ycc_rgb_convert jSYccRgbConv +#define jsimd_can_h2v2_downsample jSCanH2V2Down +#define jsimd_can_h2v1_downsample jSCanH2V1Down +#define jsimd_h2v2_downsample jSH2V2Down +#define jsimd_h2v1_downsample jSH2V1Down +#define jsimd_can_h2v2_upsample jSCanH2V2Up +#define jsimd_can_h2v1_upsample jSCanH2V1Up +#define jsimd_h2v2_upsample jSH2V2Up +#define jsimd_h2v1_upsample jSH2V1Up +#define jsimd_can_h2v2_fancy_upsample jSCanH2V2FUp +#define jsimd_can_h2v1_fancy_upsample jSCanH2V1FUp +#define jsimd_h2v2_fancy_upsample jSH2V2FUp +#define jsimd_h2v1_fancy_upsample jSH2V1FUp +#define jsimd_can_h2v2_merged_upsample jSCanH2V2MUp +#define jsimd_can_h2v1_merged_upsample jSCanH2V1MUp +#define jsimd_h2v2_merged_upsample jSH2V2MUp +#define jsimd_h2v1_merged_upsample jSH2V1MUp +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +EXTERN(int) jsimd_can_rgb_ycc JPP((void)); +EXTERN(int) jsimd_can_ycc_rgb JPP((void)); + +EXTERN(void) jsimd_rgb_ycc_convert + JPP((j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_ycc_rgb_convert + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); + +EXTERN(int) jsimd_can_h2v2_downsample JPP((void)); +EXTERN(int) jsimd_can_h2v1_downsample JPP((void)); + +EXTERN(void) jsimd_h2v2_downsample + JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data)); +EXTERN(void) jsimd_h2v1_downsample + JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data)); + +EXTERN(int) jsimd_can_h2v2_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v1_upsample JPP((void)); + +EXTERN(void) jsimd_h2v2_upsample + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_upsample + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +EXTERN(int) jsimd_can_h2v2_fancy_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v1_fancy_upsample JPP((void)); + +EXTERN(void) jsimd_h2v2_fancy_upsample + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_fancy_upsample + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +EXTERN(int) jsimd_can_h2v2_merged_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v1_merged_upsample JPP((void)); + +EXTERN(void) jsimd_h2v2_merged_upsample + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_merged_upsample + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf)); + diff --git a/jsimddct.h b/jsimddct.h new file mode 100644 index 00000000..d73d0c49 --- /dev/null +++ b/jsimddct.h @@ -0,0 +1,101 @@ +/* + * jsimddct.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + */ + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jsimd_can_convsamp jSCanConv +#define jsimd_can_convsamp_float jSCanConvF +#define jsimd_convsamp jSConv +#define jsimd_convsamp_float jSConvF +#define jsimd_can_fdct_islow jSCanFDCTIS +#define jsimd_can_fdct_ifast jSCanFDCTIF +#define jsimd_can_fdct_float jSCanFDCTFl +#define jsimd_fdct_islow jSFDCTIS +#define jsimd_fdct_ifast jSFDCTIF +#define jsimd_fdct_float jSFDCTFl +#define jsimd_can_quantize jSCanQuant +#define jsimd_can_quantize_float jSCanQuantF +#define jsimd_quantize jSQuant +#define jsimd_quantize_float jSQuantF +#define jsimd_can_idct_2x2 jSCanIDCT22 +#define jsimd_can_idct_4x4 jSCanIDCT44 +#define jsimd_idct_2x2 jSIDCT22 +#define jsimd_idct_4x4 jSIDCT44 +#define jsimd_can_idct_islow jSCanIDCTIS +#define jsimd_can_idct_ifast jSCanIDCTIF +#define jsimd_can_idct_float jSCanIDCTFl +#define jsimd_idct_islow jSIDCTIS +#define jsimd_idct_ifast jSIDCTIF +#define jsimd_idct_float jSIDCTFl +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +EXTERN(int) jsimd_can_convsamp JPP((void)); +EXTERN(int) jsimd_can_convsamp_float JPP((void)); + +EXTERN(void) jsimd_convsamp JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_float JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT * workspace)); + +EXTERN(int) jsimd_can_fdct_islow JPP((void)); +EXTERN(int) jsimd_can_fdct_ifast JPP((void)); +EXTERN(int) jsimd_can_fdct_float JPP((void)); + +EXTERN(void) jsimd_fdct_islow JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_ifast JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_float JPP((FAST_FLOAT * data)); + +EXTERN(int) jsimd_can_quantize JPP((void)); +EXTERN(int) jsimd_can_quantize_float JPP((void)); + +EXTERN(void) jsimd_quantize JPP((JCOEFPTR coef_block, + DCTELEM * divisors, + DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_float JPP((JCOEFPTR coef_block, + FAST_FLOAT * divisors, + FAST_FLOAT * workspace)); + +EXTERN(int) jsimd_can_idct_2x2 JPP((void)); +EXTERN(int) jsimd_can_idct_4x4 JPP((void)); + +EXTERN(void) jsimd_idct_2x2 JPP((j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_4x4 JPP((j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + +EXTERN(int) jsimd_can_idct_islow JPP((void)); +EXTERN(int) jsimd_can_idct_ifast JPP((void)); +EXTERN(int) jsimd_can_idct_float JPP((void)); + +EXTERN(void) jsimd_idct_islow JPP((j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_ifast JPP((j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_float JPP((j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + From 863946aebdf7a2b6a93f20b0da64dc545893add3 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:21:27 +0000 Subject: [PATCH 014/985] Implement x86 SIMD framework Add NASM support and stub routine for detecting SIMD extensions. --- Makefile.am | 17 ++++ acinclude.m4 | 99 ++++++++++++++++++ configure.ac | 27 ++++- jsimd.c | 9 +- nasm_lt.sh | 57 +++++++++++ simd/jsimd.h | 23 +++++ simd/jsimdcfg.inc.h | 29 ++++++ simd/jsimdcpu.asm | 63 ++++++++++++ simd/jsimdext.inc | 243 ++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 562 insertions(+), 5 deletions(-) create mode 100644 acinclude.m4 create mode 100755 nasm_lt.sh create mode 100644 simd/jsimd.h create mode 100644 simd/jsimdcfg.inc.h create mode 100644 simd/jsimdcpu.asm create mode 100644 simd/jsimdext.inc diff --git a/Makefile.am b/Makefile.am index 114dd7d2..85dcd845 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,3 +13,20 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c \ jsimd.c +if WITH_SIMD + +BUILT_SOURCES = simd/jsimdcfg.inc + +EXTRA_DIST = nasm_lt.sh + +libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ + simd/jsimdext.inc simd/jsimdcpu.asm + +endif + +.asm.lo: + $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ + +simd/jsimdcfg.inc: simd/jsimdcfg.inc.h jpeglib.h jconfig.h jmorecfg.h + $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ + diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..9150799b --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,99 @@ +# AC_PROG_NASM +# -------------------------- +# Check that NASM exists and determine flags +AC_DEFUN([AC_PROG_NASM],[ + +AC_CHECK_PROGS(NASM, [nasm nasmw]) +test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found]) + +AC_MSG_CHECKING([for object file format of host system]) +case "$host_os" in + cygwin* | mingw* | pw32* | interix*) + objfmt='Win32-COFF' + ;; + msdosdjgpp* | go32*) + objfmt='COFF' + ;; + os2-emx*) # not tested + objfmt='MSOMF' # obj + ;; + linux*coff* | linux*oldld*) + objfmt='COFF' # ??? + ;; + linux*aout*) + objfmt='a.out' + ;; + linux*) + objfmt='ELF' + ;; + freebsd* | netbsd* | openbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + objfmt='BSD-a.out' + else + objfmt='ELF' + fi + ;; + solaris* | sunos* | sysv* | sco*) + objfmt='ELF' + ;; + darwin* | rhapsody* | nextstep* | openstep* | macos*) + objfmt='Mach-O' + ;; + *) + objfmt='ELF ?' + ;; +esac + +AC_MSG_RESULT([$objfmt]) +if test "$objfmt" = 'ELF ?'; then + objfmt='ELF' + AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.]) +fi + +AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ]) +case "$objfmt" in + MSOMF) NAFLAGS='-fobj -DOBJ32';; + Win32-COFF) NAFLAGS='-fwin32 -DWIN32';; + COFF) NAFLAGS='-fcoff -DCOFF';; + a.out) NAFLAGS='-faout -DAOUT';; + BSD-a.out) NAFLAGS='-faoutb -DAOUT';; + ELF) NAFLAGS='-felf -DELF';; + RDF) NAFLAGS='-frdf -DRDF';; + Mach-O) NAFLAGS='-fmacho -DMACHO';; +esac +AC_MSG_RESULT([$NAFLAGS]) +AC_SUBST([NAFLAGS]) + +AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works]) +cat > conftest.asm <&AC_FD_CC + cat conftest.asm >&AC_FD_CC + rm -rf conftest* + AC_MSG_RESULT(no) + AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.]) +fi + +AC_MSG_CHECKING([whether the linker accepts assembler output]) +try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC' +if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then + rm -rf conftest* + AC_MSG_RESULT(yes) +else + rm -rf conftest* + AC_MSG_RESULT(no) + AC_MSG_ERROR([configuration problem: maybe object file format mismatch.]) +fi + +]) diff --git a/configure.ac b/configure.ac index c2263f26..683ca7e7 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,7 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) # Checks for programs. +AC_PROG_CPP AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL @@ -72,13 +73,33 @@ AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, [Define if you have BSD-like bzero and bcopy])]) +# Set flags to indicate platform +case "$host_os" in + cygwin* | mingw* | pw32* | interix*) + is_win32=1 + ;; +esac +AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"]) + # SIMD is optional -# todo: detect automatically when it can be enabled AC_ARG_WITH([simd], - AC_HELP_STRING([--with-simd],[Include accelerated SIMD routines.])) + AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) if test "x${with_simd}" != "xno"; then - AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + # Check if we're on a supported CPU + AC_MSG_CHECKING([if host cpu type is i386 or compatible]) + case "$host_cpu" in + i*86 | x86 | ia32) + AC_MSG_RESULT(yes) + AC_PROG_NASM + AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + ;; + *) + AC_MSG_RESULT([no ("$host_cpu")]) + with_simd=no + ;; + esac fi +AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our diff --git a/jsimd.c b/jsimd.c index c6378e86..c92ae602 100644 --- a/jsimd.c +++ b/jsimd.c @@ -13,9 +13,10 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" #include "jdct.h" - -#define JSIMD_NONE 0x00 +#include "jsimddct.h" +#include "simd/jsimd.h" static unsigned int simd_support = ~0; @@ -30,7 +31,11 @@ init_simd (void) if (simd_support != ~0) return; +#ifdef WITH_SIMD + simd_support = jpeg_simd_cpu_support(); +#else simd_support = JSIMD_NONE; +#endif } GLOBAL(int) diff --git a/nasm_lt.sh b/nasm_lt.sh new file mode 100755 index 00000000..ef5a591e --- /dev/null +++ b/nasm_lt.sh @@ -0,0 +1,57 @@ +#! /bin/sh +command="" +infile="" +o_opt=no +pic=no +while [ $# -gt 0 ]; do + case "$1" in + -DPIC|-fPIC|-fpic) + if [ "$pic" != "yes" ] ; then + command="$command -DPIC" + pic=yes + fi + ;; + -f|-fbin|-faout|-faoutb|-fcoff|-felf|-fas86| \ + -fobj|-fwin32|-frdf|-fieee|-fmacho) + # it's a file format specifier for nasm. + command="$command $1" + ;; + -f*) + # maybe a code-generation flag for gcc. + ;; + -[Ii]*) + incdir=`echo "$1" | sed 's/^-[Ii]//'` + if [ "x$incdir" = x -a "x$2" != x ] ; then + case "$2" in + -*) ;; + *) incdir="$2"; shift;; + esac + fi + if [ "x$incdir" != x ] ; then + # In the case of NASM, the trailing slash is necessary. + incdir=`echo "$incdir" | sed 's%/*$%/%'` + command="$command -I$incdir" + fi + ;; + -o*) + o_opt=yes + command="$command $1" + ;; + *.asm) + infile=$1 + command="$command $1" + ;; + *) + command="$command $1" + ;; + esac + shift +done +if [ "$o_opt" != yes ] ; then + # By default, NASM creates an output file + # in the same directory as the input file. + outfile="-o `echo $infile | sed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.o" + command="$command $outfile" +fi +echo $command +exec $command diff --git a/simd/jsimd.h b/simd/jsimd.h new file mode 100644 index 00000000..09ec46dc --- /dev/null +++ b/simd/jsimd.h @@ -0,0 +1,23 @@ +/* + * simd/jsimd.h + * + * Copyright 2009 Pierre Ossman for Cendio AB + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + */ + +/* Bitmask for supported acceleration methods */ + +#define JSIMD_NONE 0x00 + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_simd_cpu_support jSiCpuSupport +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +/* SIMD Ext: retrieve SIMD/CPU information */ +EXTERN(unsigned int) jpeg_simd_cpu_support JPP((void)); + diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h new file mode 100644 index 00000000..bc2ff9f6 --- /dev/null +++ b/simd/jsimdcfg.inc.h @@ -0,0 +1,29 @@ +// This file generates the include file for the assembly +// implementations by abusing the C preprocessor. + +; +; Automatically generated include file from jsimdcfg.inc.h +; + +#define JPEG_INTERNALS + +#include "../jpeglib.h" +#include "../jconfig.h" +#include "../jmorecfg.h" +#include "jsimd.h" + +#define define(var) %define _cpp_protection_##var +#define definev(var) %define _cpp_protection_##var var + +; +; -- jsimd.h +; + +definev(JSIMD_NONE) + +; Short forms of external names for systems with brain-damaged linkers. +; +#ifdef NEED_SHORT_EXTERNAL_NAMES +definev(jpeg_simd_cpu_support) +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm new file mode 100644 index 00000000..6bb4e325 --- /dev/null +++ b/simd/jsimdcpu.asm @@ -0,0 +1,63 @@ +; +; jsimdcpu.asm - SIMD instruction support check +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Check if the CPU supports SIMD instructions +; +; GLOBAL(unsigned int) +; jpeg_simd_cpu_support (void) +; + + align 16 + global EXTN(jpeg_simd_cpu_support) + +EXTN(jpeg_simd_cpu_support): + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused + push edi + + xor edi,edi ; simd support flag + + pushfd + pop eax + mov edx,eax + xor eax, 1<<21 ; flip ID bit in EFLAGS + push eax + popfd + pushfd + pop eax + xor eax,edx + jz short .return ; CPUID is not supported + +.return: + mov eax,edi + + pop edi +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + ret + diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc new file mode 100644 index 00000000..c0bd54cc --- /dev/null +++ b/simd/jsimdext.inc @@ -0,0 +1,243 @@ +; +; jsimdext.inc - common declarations +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library - version 1.02 +; +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. +; +; [TAB8] + +; ========================================================================== +; System-dependent configurations + +%ifdef WIN32 ; ----(nasm -fwin32 -DWIN32 ...)-------- +; * Microsoft Visual C++ +; * MinGW (Minimalist GNU for Windows) +; * CygWin +; * LCC-Win32 + +; -- segment definition -- +; +%define SEG_TEXT .text align=16 public use32 class=CODE +%define SEG_CONST .rdata align=16 public use32 class=CONST + +%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)---------- +; * Borland C++ (Win32) + +; -- segment definition -- +; +%define SEG_TEXT .text align=16 public use32 class=CODE +%define SEG_CONST .data align=16 public use32 class=DATA + +%elifdef ELF ; ----(nasm -felf -DELF ...)------------ +; * Linux +; * *BSD family Unix using elf format +; * Unix System V, including Solaris x86, UnixWare and SCO Unix + +; -- segment definition -- +; +%define SEG_TEXT .text progbits alloc exec nowrite align=16 +%define SEG_CONST .rodata progbits alloc noexec nowrite align=16 + +; To make the code position-independent, append -DPIC to the commandline +; +%define GOT_SYMBOL _GLOBAL_OFFSET_TABLE_ ; ELF supports PIC +%define EXTN(name) name ; foo() -> foo + +%elifdef AOUT ; ----(nasm -faoutb/aout -DAOUT ...)---- +; * Older Linux using a.out format (nasm -f aout -DAOUT ...) +; * *BSD family Unix using a.out format (nasm -f aoutb -DAOUT ...) + +; -- segment definition -- +; +%define SEG_TEXT .text +%define SEG_CONST .data + +; To make the code position-independent, append -DPIC to the commandline +; +%define GOT_SYMBOL __GLOBAL_OFFSET_TABLE_ ; BSD-style a.out supports PIC + +%elifdef MACHO ; ----(nasm -fmacho -DMACHO ...)-------- +; * NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (Mach-O format) + +; -- segment definition -- +; +%define SEG_TEXT .text ;align=16 ; nasm doesn't accept align=16. why? +%define SEG_CONST .rodata align=16 + +; The generation of position-independent code (PIC) is the default on Darwin. +; +%define PIC +%define GOT_SYMBOL _MACHO_PIC_ ; Mach-O style code-relative addressing + +%else ; ----(Other case)---------------------- + +; -- segment definition -- +; +%define SEG_TEXT .text +%define SEG_CONST .data + +%endif ; ---------------------------------------------- + +; ========================================================================== + +; -------------------------------------------------------------------------- +; Common types +; +%define POINTER dword ; general pointer type +%define SIZEOF_POINTER SIZEOF_DWORD ; sizeof(POINTER) +%define POINTER_BIT DWORD_BIT ; sizeof(POINTER)*BYTE_BIT + +; -------------------------------------------------------------------------- +; External Symbol Name +; +%ifndef EXTN +%define EXTN(name) _ %+ name ; foo() -> _foo +%endif + +; -------------------------------------------------------------------------- +; Macros for position-independent code (PIC) support +; +%ifndef GOT_SYMBOL +%undef PIC +%endif + +%ifdef PIC ; ------------------------------------------- + +%ifidn GOT_SYMBOL,_MACHO_PIC_ ; -------------------- + +; At present, nasm doesn't seem to support PIC generation for Mach-O. +; The PIC support code below is a little tricky. + + SECTION SEG_CONST +const_base: + +%define GOTOFF(got,sym) (got) + (sym) - const_base + +%imacro get_GOT 1 + ; NOTE: this macro destroys ecx resister. + call %%geteip + add ecx, byte (%%ref - $) + jmp short %%adjust +%%geteip: + mov ecx, POINTER [esp] + ret +%%adjust: + push ebp + xor ebp,ebp ; ebp = 0 +%ifidni %1,ebx ; (%1 == ebx) + ; db 0x8D,0x9C + jmp near const_base = + ; lea ebx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,9C,E9,(offset32) + db 0x8D,0x9C ; 8D,9C + jmp near const_base ; E9,(const_base-%%ref) +%%ref: +%else ; (%1 != ebx) + ; db 0x8D,0x8C + jmp near const_base = + ; lea ecx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,8C,E9,(offset32) + db 0x8D,0x8C ; 8D,8C + jmp near const_base ; E9,(const_base-%%ref) +%%ref: mov %1, ecx +%endif ; (%1 == ebx) + pop ebp +%endmacro + +%else ; GOT_SYMBOL != _MACHO_PIC_ ---------------- + +%define GOTOFF(got,sym) (got) + (sym) wrt ..gotoff + +%imacro get_GOT 1 + extern GOT_SYMBOL + call %%geteip + add %1, GOT_SYMBOL + $$ - $ wrt ..gotpc + jmp short %%done +%%geteip: + mov %1, POINTER [esp] + ret +%%done: +%endmacro + +%endif ; GOT_SYMBOL == _MACHO_PIC_ ---------------- + +%imacro pushpic 1.nolist + push %1 +%endmacro +%imacro poppic 1.nolist + pop %1 +%endmacro +%imacro movpic 2.nolist + mov %1,%2 +%endmacro + +%else ; !PIC ----------------------------------------- + +%define GOTOFF(got,sym) (sym) + +%imacro get_GOT 1.nolist +%endmacro +%imacro pushpic 1.nolist +%endmacro +%imacro poppic 1.nolist +%endmacro +%imacro movpic 2.nolist +%endmacro + +%endif ; PIC ----------------------------------------- + +; -------------------------------------------------------------------------- +; Align the next instruction on {2,4,8,16,..}-byte boundary. +; ".balign n,,m" in GNU as +; +%define MSKLE(x,y) (~(((y) & 0xFFFF) - ((x) & 0xFFFF)) >> 16) +%define FILLB(b,n) (($$-(b)) & ((n)-1)) + +%imacro alignx 1-2.nolist 0xFFFF +%%bs: times MSKLE(FILLB(%%bs,%1),%2) & MSKLE(16,FILLB($,%1)) & FILLB($,%1) \ + db 0x90 ; nop + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/9 \ + db 0x8D,0x9C,0x23,0x00,0x00,0x00,0x00 ; lea ebx,[ebx+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/7 \ + db 0x8D,0xAC,0x25,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/6 \ + db 0x8D,0xAD,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/4 \ + db 0x8D,0x6C,0x25,0x00 ; lea ebp,[ebp+0x00] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/3 \ + db 0x8D,0x6D,0x00 ; lea ebp,[ebp+0x00] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/2 \ + db 0x8B,0xED ; mov ebp,ebp + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/1 \ + db 0x90 ; nop +%endmacro + +; Align the next data on {2,4,8,16,..}-byte boundary. +; +%imacro alignz 1.nolist + align %1, db 0 ; filling zeros +%endmacro + + +; -------------------------------------------------------------------------- +; Defines picked up from the C headers +; +%include "simd/jsimdcfg.inc" + +; -------------------------------------------------------------------------- From e1594812ac32323c374e0a6f76db69c9aea5247a Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:23:04 +0000 Subject: [PATCH 015/985] "Optimise" quantization step by replacing the division by a multiplication. This has no measurable difference right now but makes it possible to do SIMD implementations of this stage. --- jcdctmgr.c | 174 +++++++++++++++++++++++++++++++++++++++++++---------- jdct.h | 7 ++- 2 files changed, 149 insertions(+), 32 deletions(-) diff --git a/jcdctmgr.c b/jcdctmgr.c index 75d48e02..539ccc41 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -2,6 +2,7 @@ * jcdctmgr.c * * Copyright (C) 1994-1996, Thomas G. Lane. + * Copyright (C) 1999-2006, MIYASAKA Masaru. * Copyright 2009 Pierre Ossman for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. @@ -64,6 +65,128 @@ typedef struct { typedef my_fdct_controller * my_fdct_ptr; +/* + * Find the highest bit in an integer through binary search. + */ +LOCAL(int) +fls (UINT16 val) +{ + int bit; + + bit = 16; + + if (!val) + return 0; + + if (!(val & 0xff00)) { + bit -= 8; + val <<= 8; + } + if (!(val & 0xf000)) { + bit -= 4; + val <<= 4; + } + if (!(val & 0xc000)) { + bit -= 2; + val <<= 2; + } + if (!(val & 0x8000)) { + bit -= 1; + val <<= 1; + } + + return bit; +} + +/* + * Compute values to do a division using reciprocal. + * + * This implementation is based on an algorithm described in + * "How to optimize for the Pentium family of microprocessors" + * (http://www.agner.org/assem/). + * More information about the basic algorithm can be found in + * the paper "Integer Division Using Reciprocals" by Robert Alverson. + * + * The basic idea is to replace x/d by x * d^-1. In order to store + * d^-1 with enough precision we shift it left a few places. It turns + * out that this algoright gives just enough precision, and also fits + * into DCTELEM: + * + * b = (the number of significant bits in divisor) - 1 + * r = (word size) + b + * f = 2^r / divisor + * + * f will not be an integer for most cases, so we need to compensate + * for the rounding error introduced: + * + * no fractional part: + * + * result = input >> r + * + * fractional part of f < 0.5: + * + * round f down to nearest integer + * result = ((input + 1) * f) >> r + * + * fractional part of f > 0.5: + * + * round f up to nearest integer + * result = (input * f) >> r + * + * This is the original algorithm that gives truncated results. But we + * want properly rounded results, so we replace "input" with + * "input + divisor/2". + * + * In order to allow SIMD implementations we also tweak the values to + * allow the same calculation to be made at all times: + * + * dctbl[0] = f rounded to nearest integer + * dctbl[1] = divisor / 2 (+ 1 if fractional part of f < 0.5) + * dctbl[2] = 1 << ((word size) * 2 - r) + * dctbl[3] = r - (word size) + * + * dctbl[2] is for stupid instruction sets where the shift operation + * isn't member wise (e.g. MMX). + * + * The reason dctbl[2] and dctbl[3] reduce the shift with (word size) + * is that most SIMD implementations have a "multiply and store top + * half" operation. + * + * Lastly, we store each of the values in their own table instead + * of in a consecutive manner, yet again in order to allow SIMD + * routines. + */ +LOCAL(void) +compute_reciprocal (UINT16 divisor, DCTELEM * dtbl) +{ + UDCTELEM2 fq, fr; + UDCTELEM c; + int b, r; + + b = fls(divisor) - 1; + r = sizeof(DCTELEM) * 8 + b; + + fq = ((UDCTELEM2)1 << r) / divisor; + fr = ((UDCTELEM2)1 << r) % divisor; + + c = divisor / 2; /* for rounding */ + + if (fr == 0) { /* divisor is power of two */ + /* fq will be one bit too large to fit in DCTELEM, so adjust */ + fq >>= 1; + r--; + } else if (fr <= (divisor / 2)) { /* fractional part is < 0.5 */ + c++; + } else { /* fractional part is > 0.5 */ + fq++; + } + + dtbl[DCTSIZE2 * 0] = (DCTELEM) fq; /* reciprocal */ + dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */ + dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */ + dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */ +} + /* * Initialize for a processing pass. * Verify that all referenced Q-tables are present, and set up @@ -101,11 +224,11 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(DCTELEM)); + (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; + compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]); } break; #endif @@ -135,14 +258,14 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(DCTELEM)); + (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { - dtbl[i] = (DCTELEM) + compute_reciprocal( DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), - CONST_BITS-3); + CONST_BITS-3), &dtbl[i]); } } break; @@ -233,41 +356,30 @@ convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) METHODDEF(void) quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { - register DCTELEM temp, qval; - register int i; - register JCOEFPTR output_ptr = coef_block; + int i; + DCTELEM temp; + UDCTELEM recip, corr, shift; + UDCTELEM2 product; + JCOEFPTR output_ptr = coef_block; for (i = 0; i < DCTSIZE2; i++) { - qval = divisors[i]; temp = workspace[i]; - - /* Divide the coefficient value by qval, ensuring proper rounding. - * Since C does not specify the direction of rounding for negative - * quotients, we have to force the dividend positive for portability. - * - * In most files, at least half of the output values will be zero - * (at default quantization settings, more like three-quarters...) - * so we should ensure that this case is fast. On many machines, - * a comparison is enough cheaper than a divide to make a special test - * a win. Since both inputs will be nonnegative, we need only test - * for a < b to discover whether a/b is 0. - * If your machine's division is fast enough, define FAST_DIVIDE. - */ -#ifdef FAST_DIVIDE -#define DIVIDE_BY(a,b) a /= b -#else -#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 -#endif + recip = divisors[i + DCTSIZE2 * 0]; + corr = divisors[i + DCTSIZE2 * 1]; + shift = divisors[i + DCTSIZE2 * 3]; if (temp < 0) { temp = -temp; - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); + product = (UDCTELEM2)(temp + corr) * recip; + product >>= shift + sizeof(DCTELEM)*8; + temp = product; temp = -temp; } else { - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); + product = (UDCTELEM2)(temp + corr) * recip; + product >>= shift + sizeof(DCTELEM)*8; + temp = product; } + output_ptr[i] = (JCOEF) temp; } } diff --git a/jdct.h b/jdct.h index c3650ea0..c8344108 100644 --- a/jdct.h +++ b/jdct.h @@ -23,13 +23,18 @@ * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This * convention improves accuracy in integer implementations and saves some * work in floating-point ones. - * Quantization of the output coefficients is done by jcdctmgr.c. + * Quantization of the output coefficients is done by jcdctmgr.c. This + * step requires an unsigned type and also one with twice the bits. */ #if BITS_IN_JSAMPLE == 8 typedef int DCTELEM; /* 16 or 32 bits is fine */ +typedef unsigned int UDCTELEM; +typedef unsigned long long UDCTELEM2; #else typedef INT32 DCTELEM; /* must have 32 bits */ +typedef UINT32 UDCTELEM; +typedef unsigned long long UDCTELEM2; #endif From 649fe159ce7fb79893e5c3cf1dae19e11bf024ae Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:25:30 +0000 Subject: [PATCH 016/985] Add MMX SIMD implementation of computationally intensive routines. --- Makefile.am | 7 +- jdct.h | 6 + jmorecfg.h | 4 + jsimd.c | 282 +++++++++++++++ simd/jccolmmx.asm | 508 ++++++++++++++++++++++++++ simd/jcolsamp.inc | 73 ++++ simd/jcqntmmx.asm | 271 ++++++++++++++ simd/jcsammmx.asm | 321 +++++++++++++++++ simd/jdcolmmx.asm | 433 ++++++++++++++++++++++ simd/jdct.inc | 27 ++ simd/jdmermmx.asm | 492 +++++++++++++++++++++++++ simd/jdsammmx.asm | 734 ++++++++++++++++++++++++++++++++++++++ simd/jfmmxfst.asm | 394 ++++++++++++++++++++ simd/jfmmxint.asm | 619 ++++++++++++++++++++++++++++++++ simd/jimmxfst.asm | 497 ++++++++++++++++++++++++++ simd/jimmxint.asm | 849 ++++++++++++++++++++++++++++++++++++++++++++ simd/jimmxred.asm | 703 ++++++++++++++++++++++++++++++++++++ simd/jsimd.h | 97 ++++- simd/jsimdcfg.inc.h | 89 +++++ simd/jsimdcpu.asm | 16 + simd/jsimdext.inc | 18 + 21 files changed, 6438 insertions(+), 2 deletions(-) create mode 100644 simd/jccolmmx.asm create mode 100644 simd/jcolsamp.inc create mode 100644 simd/jcqntmmx.asm create mode 100644 simd/jcsammmx.asm create mode 100644 simd/jdcolmmx.asm create mode 100644 simd/jdct.inc create mode 100644 simd/jdmermmx.asm create mode 100644 simd/jdsammmx.asm create mode 100644 simd/jfmmxfst.asm create mode 100644 simd/jfmmxint.asm create mode 100644 simd/jimmxfst.asm create mode 100644 simd/jimmxint.asm create mode 100644 simd/jimmxred.asm diff --git a/Makefile.am b/Makefile.am index 85dcd845..cc4d5c7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,12 @@ BUILT_SOURCES = simd/jsimdcfg.inc EXTRA_DIST = nasm_lt.sh libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ - simd/jsimdext.inc simd/jsimdcpu.asm + simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ + simd/jsimdcpu.asm \ + simd/jccolmmx.asm simd/jdcolmmx.asm \ + simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ + simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ + simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm endif diff --git a/jdct.h b/jdct.h index c8344108..7b49a975 100644 --- a/jdct.h +++ b/jdct.h @@ -28,10 +28,16 @@ */ #if BITS_IN_JSAMPLE == 8 +#ifndef WITH_SIMD typedef int DCTELEM; /* 16 or 32 bits is fine */ typedef unsigned int UDCTELEM; typedef unsigned long long UDCTELEM2; #else +typedef short DCTELEM; /* prefer 16 bit with SIMD for parellelism */ +typedef unsigned short UDCTELEM; +typedef unsigned int UDCTELEM2; +#endif +#else typedef INT32 DCTELEM; /* must have 32 bits */ typedef UINT32 UDCTELEM; typedef unsigned long long UDCTELEM2; diff --git a/jmorecfg.h b/jmorecfg.h index 69d4fe02..18670ec6 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -325,7 +325,11 @@ typedef int boolean; */ #ifndef MULTIPLIER +#ifndef WITH_SIMD #define MULTIPLIER int /* type for fastest integer multiply */ +#else +#define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ +#endif #endif diff --git a/jsimd.c b/jsimd.c index c92ae602..eb1f37bd 100644 --- a/jsimd.c +++ b/jsimd.c @@ -43,6 +43,17 @@ jsimd_can_rgb_ycc (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -51,6 +62,17 @@ jsimd_can_ycc_rgb (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -59,6 +81,11 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_rgb_ycc_convert_mmx(cinfo->image_width, input_buf, + output_buf, output_row, num_rows); +#endif } GLOBAL(void) @@ -66,6 +93,11 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_ycc_rgb_convert_mmx(cinfo->output_width, input_buf, + input_row, output_buf, num_rows); +#endif } GLOBAL(int) @@ -73,6 +105,15 @@ jsimd_can_h2v2_downsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -81,6 +122,15 @@ jsimd_can_h2v1_downsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -88,12 +138,24 @@ GLOBAL(void) jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); +#endif } GLOBAL(void) jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); +#endif } GLOBAL(int) @@ -101,6 +163,15 @@ jsimd_can_h2v2_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -109,6 +180,15 @@ jsimd_can_h2v1_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -118,6 +198,11 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, + cinfo->output_width, input_data, output_data_ptr); +#endif } GLOBAL(void) @@ -126,6 +211,11 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, + cinfo->output_width, input_data, output_data_ptr); +#endif } GLOBAL(int) @@ -133,6 +223,15 @@ jsimd_can_h2v2_fancy_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -141,6 +240,15 @@ jsimd_can_h2v1_fancy_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -150,6 +258,11 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, output_data_ptr); +#endif } GLOBAL(void) @@ -158,6 +271,11 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, output_data_ptr); +#endif } GLOBAL(int) @@ -165,6 +283,15 @@ jsimd_can_h2v2_merged_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -173,6 +300,15 @@ jsimd_can_h2v1_merged_upsample (void) { init_simd(); + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -182,6 +318,11 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v2_merged_upsample_mmx(cinfo->output_width, input_buf, + in_row_group_ctr, output_buf); +#endif } GLOBAL(void) @@ -190,6 +331,11 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_h2v1_merged_upsample_mmx(cinfo->output_width, input_buf, + in_row_group_ctr, output_buf); +#endif } GLOBAL(int) @@ -197,6 +343,19 @@ jsimd_can_convsamp (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -212,6 +371,10 @@ GLOBAL(void) jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_convsamp_mmx(sample_data, start_col, workspace); +#endif } GLOBAL(void) @@ -225,6 +388,15 @@ jsimd_can_fdct_islow (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -233,6 +405,15 @@ jsimd_can_fdct_ifast (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -247,11 +428,19 @@ jsimd_can_fdct_float (void) GLOBAL(void) jsimd_fdct_islow (DCTELEM * data) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_fdct_islow_mmx(data); +#endif } GLOBAL(void) jsimd_fdct_ifast (DCTELEM * data) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_fdct_ifast_mmx(data); +#endif } GLOBAL(void) @@ -264,6 +453,17 @@ jsimd_can_quantize (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -279,6 +479,10 @@ GLOBAL(void) jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_quantize_mmx(coef_block, divisors, workspace); +#endif } GLOBAL(void) @@ -292,6 +496,21 @@ jsimd_can_idct_2x2 (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -300,6 +519,21 @@ jsimd_can_idct_4x4 (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -308,6 +542,10 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { +#if WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); +#endif } GLOBAL(void) @@ -315,6 +553,10 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { +#if WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); +#endif } GLOBAL(int) @@ -322,6 +564,21 @@ jsimd_can_idct_islow (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -330,6 +587,23 @@ jsimd_can_idct_ifast (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(IFAST_MULT_TYPE) != 2) + return 0; + if (IFAST_SCALE_BITS != 2) + return 0; + + if (simd_support & JSIMD_MMX) + return 1; + return 0; } @@ -346,6 +620,10 @@ jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { +#if WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); +#endif } GLOBAL(void) @@ -353,6 +631,10 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { +#if WITH_SIMD + if (simd_support & JSIMD_MMX) + jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); +#endif } GLOBAL(void) diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm new file mode 100644 index 00000000..701a3271 --- /dev/null +++ b/simd/jccolmmx.asm @@ -0,0 +1,508 @@ +; +; jccolmmx.asm - colorspace conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_rgb_ycc_convert_mmx) + +EXTN(jconst_rgb_ycc_convert_mmx): + +PW_F0299_F0337 times 2 dw F_0_299, F_0_337 +PW_F0114_F0250 times 2 dw F_0_114, F_0_250 +PW_MF016_MF033 times 2 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 2 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 2 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_mmx (JDIMENSION img_width, +; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, +; JDIMENSION output_row, int num_rows); +; + +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_rgb_ycc_convert_mmx) + +EXTN(jsimd_rgb_ycc_convert_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [img_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + cmp ecx, byte SIZEOF_MMWORD + jae short .columnloop + alignx 16,7 + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + xor eax,eax + mov al, BYTE [esi+ecx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + xor edx,edx + mov dx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx +.column_ld4: + movd mmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd mmG, DWORD [esi+ecx] + psllq mmA, DWORD_BIT + por mmA,mmG +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + movq mmG,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + mov ecx, SIZEOF_MMWORD + jmp short .rgb_ycc_cnv +.column_ld16: + test cl, 2*SIZEOF_MMWORD + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmF,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] + +.rgb_ycc_cnv: + ; mmA=(00 10 20 01 11 21 02 12) + ; mmG=(22 03 13 23 04 14 24 05) + ; mmF=(15 25 06 16 26 07 17 27) + + movq mmD,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) + psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) + + punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) + psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) + + punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) + punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) + + movq mmE,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) + psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) + + punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) + + punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) + punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) + + pxor mmH,mmH + + movq mmC,mmA + punpcklbw mmA,mmH ; mmA=(00 02 04 06) + punpckhbw mmC,mmH ; mmC=(10 12 14 16) + + movq mmB,mmE + punpcklbw mmE,mmH ; mmE=(20 22 24 26) + punpckhbw mmB,mmH ; mmB=(01 03 05 07) + + movq mmF,mmD + punpcklbw mmD,mmH ; mmD=(11 13 15 17) + punpckhbw mmF,mmH ; mmF=(21 23 25 27) + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_MMWORD/8 + jz short .column_ld2 + sub ecx, byte SIZEOF_MMWORD/8 + movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_MMWORD/4 + jz short .column_ld4 + sub ecx, byte SIZEOF_MMWORD/4 + movq mmF,mmA + movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld4: + test cl, SIZEOF_MMWORD/2 + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmD,mmA + movq mmC,mmF + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] + +.rgb_ycc_cnv: + ; mmA=(00 10 20 30 01 11 21 31) + ; mmF=(02 12 22 32 03 13 23 33) + ; mmD=(04 14 24 34 05 15 25 35) + ; mmC=(06 16 26 36 07 17 27 37) + + movq mmB,mmA + punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) + punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) + + movq mmG,mmD + punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) + punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) + + movq mmE,mmA + punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) + + movq mmH,mmB + punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) + punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) + + pxor mmF,mmF + + movq mmC,mmA + punpcklbw mmA,mmF ; mmA=(00 02 04 06) + punpckhbw mmC,mmF ; mmC=(10 12 14 16) + + movq mmD,mmB + punpcklbw mmB,mmF ; mmB=(01 03 05 07) + punpckhbw mmD,mmF ; mmD=(11 13 15 17) + + movq mmG,mmE + punpcklbw mmE,mmF ; mmE=(20 22 24 26) + punpckhbw mmG,mmF ; mmG=(30 32 34 36) + + punpcklbw mmF,mmH + punpckhbw mmH,mmH + psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) + psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) + +%endif ; RGB_PIXELSIZE ; --------------- + + ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE + ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO + + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movq MMWORD [wk(0)], mm0 ; wk(0)=RE + movq MMWORD [wk(1)], mm1 ; wk(1)=RO + movq MMWORD [wk(2)], mm4 ; wk(2)=BE + movq MMWORD [wk(3)], mm5 ; wk(3)=BO + + movq mm6,mm1 + punpcklwd mm1,mm3 + punpckhwd mm6,mm3 + movq mm7,mm1 + movq mm4,mm6 + pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd mm7,[GOTOFF(eax,PW_MF016_MF033)] ; mm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + + movq MMWORD [wk(4)], mm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movq MMWORD [wk(5)], mm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor mm1,mm1 + pxor mm6,mm6 + punpcklwd mm1,mm5 ; mm1=BOL + punpckhwd mm6,mm5 ; mm6=BOH + psrld mm1,1 ; mm1=BOL*FIX(0.500) + psrld mm6,1 ; mm6=BOH*FIX(0.500) + + movq mm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm5=[PD_ONEHALFM1_CJ] + + paddd mm7,mm1 + paddd mm4,mm6 + paddd mm7,mm5 + paddd mm4,mm5 + psrld mm7,SCALEBITS ; mm7=CbOL + psrld mm4,SCALEBITS ; mm4=CbOH + packssdw mm7,mm4 ; mm7=CbO + + movq mm1, MMWORD [wk(2)] ; mm1=BE + + movq mm6,mm0 + punpcklwd mm0,mm2 + punpckhwd mm6,mm2 + movq mm5,mm0 + movq mm4,mm6 + pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd mm5,[GOTOFF(eax,PW_MF016_MF033)] ; mm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + + movq MMWORD [wk(6)], mm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movq MMWORD [wk(7)], mm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor mm0,mm0 + pxor mm6,mm6 + punpcklwd mm0,mm1 ; mm0=BEL + punpckhwd mm6,mm1 ; mm6=BEH + psrld mm0,1 ; mm0=BEL*FIX(0.500) + psrld mm6,1 ; mm6=BEH*FIX(0.500) + + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + + paddd mm5,mm0 + paddd mm4,mm6 + paddd mm5,mm1 + paddd mm4,mm1 + psrld mm5,SCALEBITS ; mm5=CbEL + psrld mm4,SCALEBITS ; mm4=CbEH + packssdw mm5,mm4 ; mm5=CbE + + psllw mm7,BYTE_BIT + por mm5,mm7 ; mm5=Cb + movq MMWORD [ebx], mm5 ; Save Cb + + movq mm0, MMWORD [wk(3)] ; mm0=BO + movq mm6, MMWORD [wk(2)] ; mm6=BE + movq mm1, MMWORD [wk(1)] ; mm1=RO + + movq mm4,mm0 + punpcklwd mm0,mm3 + punpckhwd mm4,mm3 + movq mm7,mm0 + movq mm5,mm4 + pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd mm7,[GOTOFF(eax,PW_MF008_MF041)] ; mm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + + movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] + + paddd mm0, MMWORD [wk(4)] + paddd mm4, MMWORD [wk(5)] + paddd mm0,mm3 + paddd mm4,mm3 + psrld mm0,SCALEBITS ; mm0=YOL + psrld mm4,SCALEBITS ; mm4=YOH + packssdw mm0,mm4 ; mm0=YO + + pxor mm3,mm3 + pxor mm4,mm4 + punpcklwd mm3,mm1 ; mm3=ROL + punpckhwd mm4,mm1 ; mm4=ROH + psrld mm3,1 ; mm3=ROL*FIX(0.500) + psrld mm4,1 ; mm4=ROH*FIX(0.500) + + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + + paddd mm7,mm3 + paddd mm5,mm4 + paddd mm7,mm1 + paddd mm5,mm1 + psrld mm7,SCALEBITS ; mm7=CrOL + psrld mm5,SCALEBITS ; mm5=CrOH + packssdw mm7,mm5 ; mm7=CrO + + movq mm3, MMWORD [wk(0)] ; mm3=RE + + movq mm4,mm6 + punpcklwd mm6,mm2 + punpckhwd mm4,mm2 + movq mm1,mm6 + movq mm5,mm4 + pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd mm1,[GOTOFF(eax,PW_MF008_MF041)] ; mm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + + movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] + + paddd mm6, MMWORD [wk(6)] + paddd mm4, MMWORD [wk(7)] + paddd mm6,mm2 + paddd mm4,mm2 + psrld mm6,SCALEBITS ; mm6=YEL + psrld mm4,SCALEBITS ; mm4=YEH + packssdw mm6,mm4 ; mm6=YE + + psllw mm0,BYTE_BIT + por mm6,mm0 ; mm6=Y + movq MMWORD [edi], mm6 ; Save Y + + pxor mm2,mm2 + pxor mm4,mm4 + punpcklwd mm2,mm3 ; mm2=REL + punpckhwd mm4,mm3 ; mm4=REH + psrld mm2,1 ; mm2=REL*FIX(0.500) + psrld mm4,1 ; mm4=REH*FIX(0.500) + + movq mm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm0=[PD_ONEHALFM1_CJ] + + paddd mm1,mm2 + paddd mm5,mm4 + paddd mm1,mm0 + paddd mm5,mm0 + psrld mm1,SCALEBITS ; mm1=CrEL + psrld mm5,SCALEBITS ; mm5=CrEH + packssdw mm1,mm5 ; mm1=CrE + + psllw mm7,BYTE_BIT + por mm1,mm7 ; mm1=Cr + movq MMWORD [edx], mm1 ; Save Cr + + sub ecx, byte SIZEOF_MMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr + add edi, byte SIZEOF_MMWORD ; outptr0 + add ebx, byte SIZEOF_MMWORD ; outptr1 + add edx, byte SIZEOF_MMWORD ; outptr2 + cmp ecx, byte SIZEOF_MMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 + + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax + + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jcolsamp.inc b/simd/jcolsamp.inc new file mode 100644 index 00000000..56b6bfd0 --- /dev/null +++ b/simd/jcolsamp.inc @@ -0,0 +1,73 @@ +; +; jcolsamp.inc - private declarations for color conversion & up/downsampling +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; [TAB8] + +; -------------------------------------------------------------------------- + +; pseudo-resisters to make ordering of RGB configurable +; +%if RGB_RED == 0 +%define mmA mm0 +%define mmB mm1 +%elif RGB_GREEN == 0 +%define mmA mm2 +%define mmB mm3 +%elif RGB_BLUE == 0 +%define mmA mm4 +%define mmB mm5 +%else +%define mmA mm6 +%define mmB mm7 +%endif + +%if RGB_RED == 1 +%define mmC mm0 +%define mmD mm1 +%elif RGB_GREEN == 1 +%define mmC mm2 +%define mmD mm3 +%elif RGB_BLUE == 1 +%define mmC mm4 +%define mmD mm5 +%else +%define mmC mm6 +%define mmD mm7 +%endif + +%if RGB_RED == 2 +%define mmE mm0 +%define mmF mm1 +%elif RGB_GREEN == 2 +%define mmE mm2 +%define mmF mm3 +%elif RGB_BLUE == 2 +%define mmE mm4 +%define mmF mm5 +%else +%define mmE mm6 +%define mmF mm7 +%endif + +%if RGB_RED == 3 +%define mmG mm0 +%define mmH mm1 +%elif RGB_GREEN == 3 +%define mmG mm2 +%define mmH mm3 +%elif RGB_BLUE == 3 +%define mmG mm4 +%define mmH mm5 +%else +%define mmG mm6 +%define mmH mm7 +%endif + +; -------------------------------------------------------------------------- diff --git a/simd/jcqntmmx.asm b/simd/jcqntmmx.asm new file mode 100644 index 00000000..6096eaa9 --- /dev/null +++ b/simd/jcqntmmx.asm @@ -0,0 +1,271 @@ +; +; jcqntmmx.asm - sample data conversion and quantization (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_mmx (JSAMPARRAY sample_data, JDIMENSION start_col, +; DCTELEM * workspace); +; + +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; DCTELEM * workspace + + align 16 + global EXTN(jsimd_convsamp_mmx) + +EXTN(jsimd_convsamp_mmx): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + pxor mm6,mm6 ; mm6=(all 0's) + pcmpeqw mm7,mm7 + psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} + + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.convloop: + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm0=(01234567) + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm1=(89ABCDEF) + + mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq mm2, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm2=(GHIJKLMN) + movq mm3, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm3=(OPQRSTUV) + + movq mm4,mm0 + punpcklbw mm0,mm6 ; mm0=(0123) + punpckhbw mm4,mm6 ; mm4=(4567) + movq mm5,mm1 + punpcklbw mm1,mm6 ; mm1=(89AB) + punpckhbw mm5,mm6 ; mm5=(CDEF) + + paddw mm0,mm7 + paddw mm4,mm7 + paddw mm1,mm7 + paddw mm5,mm7 + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_DCTELEM)], mm5 + + movq mm0,mm2 + punpcklbw mm2,mm6 ; mm2=(GHIJ) + punpckhbw mm0,mm6 ; mm0=(KLMN) + movq mm4,mm3 + punpcklbw mm3,mm6 ; mm3=(OPQR) + punpckhbw mm4,mm6 ; mm4=(STUV) + + paddw mm2,mm7 + paddw mm0,mm7 + paddw mm3,mm7 + paddw mm4,mm7 + + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_DCTELEM)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_DCTELEM)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_DCTELEM)], mm4 + + add esi, byte 4*SIZEOF_JSAMPROW + add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz short .convloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; This implementation is based on an algorithm described in +; "How to optimize for the Pentium family of microprocessors" +; (http://www.agner.org/assem/). +; +; GLOBAL(void) +; jsimd_quantize_mmx (JCOEFPTR coef_block, DCTELEM * divisors, +; DCTELEM * workspace); +; + +%define RECIPROCAL(m,n,b) MMBLOCK(DCTSIZE*0+(m),(n),(b),SIZEOF_DCTELEM) +%define CORRECTION(m,n,b) MMBLOCK(DCTSIZE*1+(m),(n),(b),SIZEOF_DCTELEM) +%define SCALE(m,n,b) MMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) +%define SHIFT(m,n,b) MMBLOCK(DCTSIZE*3+(m),(n),(b),SIZEOF_DCTELEM) + +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; DCTELEM * divisors +%define workspace ebp+16 ; DCTELEM * workspace + + align 16 + global EXTN(jsimd_quantize_mmx) + +EXTN(jsimd_quantize_mmx): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov ah, 2 + alignx 16,7 +.quantloop1: + mov al, DCTSIZE2/8/2 + alignx 16,7 +.quantloop2: + movq mm2, MMWORD [MMBLOCK(0,0,esi,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(0,1,esi,SIZEOF_DCTELEM)] + + movq mm0,mm2 + movq mm1,mm3 + + psraw mm2,(WORD_BIT-1) ; -1 if value < 0, 0 otherwise + psraw mm3,(WORD_BIT-1) + + pxor mm0,mm2 ; val = -val + pxor mm1,mm3 + psubw mm0,mm2 + psubw mm1,mm3 + + ; + ; MMX is an annoyingly crappy instruction set. It has two + ; misfeatures that are causing problems here: + ; + ; - All multiplications are signed. + ; + ; - The second operand for the shifts is not treated as packed. + ; + ; + ; We work around the first problem by implementing this algorithm: + ; + ; unsigned long unsigned_multiply(unsigned short x, unsigned short y) + ; { + ; enum { SHORT_BIT = 16 }; + ; signed short sx = (signed short) x; + ; signed short sy = (signed short) y; + ; signed long sz; + ; + ; sz = (long) sx * (long) sy; /* signed multiply */ + ; + ; if (sx < 0) sz += (long) sy << SHORT_BIT; + ; if (sy < 0) sz += (long) sx << SHORT_BIT; + ; + ; return (unsigned long) sz; + ; } + ; + ; (note that a negative sx adds _sy_ and vice versa) + ; + ; For the second problem, we replace the shift by a multiplication. + ; Unfortunately that means we have to deal with the signed issue again. + ; + + paddw mm0, MMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor + paddw mm1, MMWORD [CORRECTION(0,1,edx)] + + movq mm4,mm0 ; store current value for later + movq mm5,mm1 + pmulhw mm0, MMWORD [RECIPROCAL(0,0,edx)] ; reciprocal + pmulhw mm1, MMWORD [RECIPROCAL(0,1,edx)] + paddw mm0,mm4 ; reciprocal is always negative (MSB=1), + paddw mm1,mm5 ; so we always need to add the initial value + ; (input value is never negative as we + ; inverted it at the start of this routine) + + ; here it gets a bit tricky as both scale + ; and mm0/mm1 can be negative + movq mm6, MMWORD [SCALE(0,0,edx)] ; scale + movq mm7, MMWORD [SCALE(0,1,edx)] + movq mm4,mm0 + movq mm5,mm1 + pmulhw mm0,mm6 + pmulhw mm1,mm7 + + psraw mm6,(WORD_BIT-1) ; determine if scale is negative + psraw mm7,(WORD_BIT-1) + + pand mm6,mm4 ; and add input if it is + pand mm7,mm5 + paddw mm0,mm6 + paddw mm1,mm7 + + psraw mm4,(WORD_BIT-1) ; then check if negative input + psraw mm5,(WORD_BIT-1) + + pand mm4, MMWORD [SCALE(0,0,edx)] ; and add scale if it is + pand mm5, MMWORD [SCALE(0,1,edx)] + paddw mm0,mm4 + paddw mm1,mm5 + + pxor mm0,mm2 ; val = -val + pxor mm1,mm3 + psubw mm0,mm2 + psubw mm1,mm3 + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm1 + + add esi, byte 8*SIZEOF_DCTELEM + add edx, byte 8*SIZEOF_DCTELEM + add edi, byte 8*SIZEOF_JCOEF + dec al + jnz near .quantloop2 + dec ah + jnz near .quantloop1 ; to avoid branch misprediction + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jcsammmx.asm b/simd/jcsammmx.asm new file mode 100644 index 00000000..5de36372 --- /dev/null +++ b/simd/jcsammmx.asm @@ -0,0 +1,321 @@ +; +; jcsammmx.asm - downsampling (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Downsample pixel values of a single component. +; This version handles the common case of 2:1 horizontal and 1:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v1_downsample_mmx (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v1_downsample_mmx) + +EXTN(jsimd_h2v1_downsample_mmx): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return + + mov edx, JDIMENSION [img_width(ebp)] + + ; -- expand_right_edge + + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end + + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end + + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 +.expandloop: + push eax + push ecx + + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] + + rep stosb + + pop ecx + pop eax + + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop + +.expand_end: + pop ecx ; output_cols + + ; -- h2v1_downsample + + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle short .return + + mov edx, 0x00010000 ; bias pattern + movd mm7,edx + pcmpeqw mm6,mm6 + punpckldq mm7,mm7 ; mm7={0, 1, 0, 1} + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 +.rowloop: + push ecx + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm1, MMWORD [esi+1*SIZEOF_MMWORD] + movq mm2,mm0 + movq mm3,mm1 + + pand mm0,mm6 + psrlw mm2,BYTE_BIT + pand mm1,mm6 + psrlw mm3,BYTE_BIT + + paddw mm0,mm2 + paddw mm1,mm3 + paddw mm0,mm7 + paddw mm1,mm7 + psrlw mm0,1 + psrlw mm1,1 + + packuswb mm0,mm1 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + + add esi, byte 2*SIZEOF_MMWORD ; inptr + add edi, byte 1*SIZEOF_MMWORD ; outptr + sub ecx, byte SIZEOF_MMWORD ; outcol + jnz short .columnloop + + pop esi + pop edi + pop ecx + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg short .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Downsample pixel values of a single component. +; This version handles the standard case of 2:1 horizontal and 2:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v2_downsample_mmx (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v2_downsample_mmx) + +EXTN(jsimd_h2v2_downsample_mmx): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return + + mov edx, JDIMENSION [img_width(ebp)] + + ; -- expand_right_edge + + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end + + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end + + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 +.expandloop: + push eax + push ecx + + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] + + rep stosb + + pop ecx + pop eax + + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop + +.expand_end: + pop ecx ; output_cols + + ; -- h2v2_downsample + + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return + + mov edx, 0x00020001 ; bias pattern + movd mm7,edx + pcmpeqw mm6,mm6 + punpckldq mm7,mm7 ; mm7={1, 2, 1, 2} + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 +.rowloop: + push ecx + push edi + push esi + + mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 + mov edi, JSAMPROW [edi] ; outptr + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [edx+0*SIZEOF_MMWORD] + movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm2, MMWORD [edx+1*SIZEOF_MMWORD] + movq mm3, MMWORD [esi+1*SIZEOF_MMWORD] + + movq mm4,mm0 + movq mm5,mm1 + pand mm0,mm6 + psrlw mm4,BYTE_BIT + pand mm1,mm6 + psrlw mm5,BYTE_BIT + paddw mm0,mm4 + paddw mm1,mm5 + + movq mm4,mm2 + movq mm5,mm3 + pand mm2,mm6 + psrlw mm4,BYTE_BIT + pand mm3,mm6 + psrlw mm5,BYTE_BIT + paddw mm2,mm4 + paddw mm3,mm5 + + paddw mm0,mm1 + paddw mm2,mm3 + paddw mm0,mm7 + paddw mm2,mm7 + psrlw mm0,2 + psrlw mm2,2 + + packuswb mm0,mm2 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + + add edx, byte 2*SIZEOF_MMWORD ; inptr0 + add esi, byte 2*SIZEOF_MMWORD ; inptr1 + add edi, byte 1*SIZEOF_MMWORD ; outptr + sub ecx, byte SIZEOF_MMWORD ; outcol + jnz near .columnloop + + pop esi + pop edi + pop ecx + + add esi, byte 2*SIZEOF_JSAMPROW ; input_data + add edi, byte 1*SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm new file mode 100644 index 00000000..33d50634 --- /dev/null +++ b/simd/jdcolmmx.asm @@ -0,0 +1,433 @@ +; +; jdcolmmx.asm - colorspace conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_ycc_rgb_convert_mmx) + +EXTN(jconst_ycc_rgb_convert_mmx): + +PW_F0402 times 4 dw F_0_402 +PW_MF0228 times 4 dw -F_0_228 +PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 +PW_ONE times 4 dw 1 +PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_ycc_rgb_convert_mmx (JDIMENSION out_width, +; JSAMPIMAGE input_buf, JDIMENSION input_row, +; JSAMPARRAY output_buf, int num_rows) +; + +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_ycc_rgb_convert_mmx) + +EXTN(jsimd_ycc_rgb_convert_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + push eax + push edi + push edx + push ebx + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 +.columnloop: + + movq mm5, MMWORD [ebx] ; mm5=Cb(01234567) + movq mm1, MMWORD [edx] ; mm1=Cr(01234567) + + pcmpeqw mm4,mm4 + pcmpeqw mm7,mm7 + psrlw mm4,BYTE_BIT + psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} + movq mm0,mm4 ; mm0=mm4={0xFF 0x00 0xFF 0x00 ..} + + pand mm4,mm5 ; mm4=Cb(0246)=CbE + psrlw mm5,BYTE_BIT ; mm5=Cb(1357)=CbO + pand mm0,mm1 ; mm0=Cr(0246)=CrE + psrlw mm1,BYTE_BIT ; mm1=Cr(1357)=CrO + + paddw mm4,mm7 + paddw mm5,mm7 + paddw mm0,mm7 + paddw mm1,mm7 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movq mm2,mm4 ; mm2=CbE + movq mm3,mm5 ; mm3=CbO + paddw mm4,mm4 ; mm4=2*CbE + paddw mm5,mm5 ; mm5=2*CbO + movq mm6,mm0 ; mm6=CrE + movq mm7,mm1 ; mm7=CrO + paddw mm0,mm0 ; mm0=2*CrE + paddw mm1,mm1 ; mm1=2*CrO + + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbE * -FIX(0.22800)) + pmulhw mm5,[GOTOFF(eax,PW_MF0228)] ; mm5=(2*CbO * -FIX(0.22800)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrE * FIX(0.40200)) + pmulhw mm1,[GOTOFF(eax,PW_F0402)] ; mm1=(2*CrO * FIX(0.40200)) + + paddw mm4,[GOTOFF(eax,PW_ONE)] + paddw mm5,[GOTOFF(eax,PW_ONE)] + psraw mm4,1 ; mm4=(CbE * -FIX(0.22800)) + psraw mm5,1 ; mm5=(CbO * -FIX(0.22800)) + paddw mm0,[GOTOFF(eax,PW_ONE)] + paddw mm1,[GOTOFF(eax,PW_ONE)] + psraw mm0,1 ; mm0=(CrE * FIX(0.40200)) + psraw mm1,1 ; mm1=(CrO * FIX(0.40200)) + + paddw mm4,mm2 + paddw mm5,mm3 + paddw mm4,mm2 ; mm4=(CbE * FIX(1.77200))=(B-Y)E + paddw mm5,mm3 ; mm5=(CbO * FIX(1.77200))=(B-Y)O + paddw mm0,mm6 ; mm0=(CrE * FIX(1.40200))=(R-Y)E + paddw mm1,mm7 ; mm1=(CrO * FIX(1.40200))=(R-Y)O + + movq MMWORD [wk(0)], mm4 ; wk(0)=(B-Y)E + movq MMWORD [wk(1)], mm5 ; wk(1)=(B-Y)O + + movq mm4,mm2 + movq mm5,mm3 + punpcklwd mm2,mm6 + punpckhwd mm4,mm6 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm3,mm7 + punpckhwd mm5,mm7 + pmaddwd mm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm4,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm4,SCALEBITS + paddd mm3,[GOTOFF(eax,PD_ONEHALF)] + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + psrad mm3,SCALEBITS + psrad mm5,SCALEBITS + + packssdw mm2,mm4 ; mm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw mm3,mm5 ; mm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw mm2,mm6 ; mm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw mm3,mm7 ; mm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + + movq mm5, MMWORD [esi] ; mm5=Y(01234567) + + pcmpeqw mm4,mm4 + psrlw mm4,BYTE_BIT ; mm4={0xFF 0x00 0xFF 0x00 ..} + pand mm4,mm5 ; mm4=Y(0246)=YE + psrlw mm5,BYTE_BIT ; mm5=Y(1357)=YO + + paddw mm0,mm4 ; mm0=((R-Y)E+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm5 ; mm1=((R-Y)O+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + + paddw mm2,mm4 ; mm2=((G-Y)E+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm5 ; mm3=((G-Y)O+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + + paddw mm4, MMWORD [wk(0)] ; mm4=(YE+(B-Y)E)=BE=(B0 B2 B4 B6) + paddw mm5, MMWORD [wk(1)] ; mm5=(YO+(B-Y)O)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow + + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 + +.column_st16: + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 +.column_st8: + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD +.column_st4: + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD +.column_st2: + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD +.column_st1: + cmp ecx, byte SIZEOF_BYTE + jb short .nextrow + mov BYTE [edi+0*SIZEOF_BYTE], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%else + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%endif + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow + + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 + +.column_st16: + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD +.column_st8: + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD +.column_st4: + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .nextrow + movd DWORD [edi+0*SIZEOF_DWORD], mmA + +%endif ; RGB_PIXELSIZE ; --------------- + + alignx 16,7 + +.nextrow: + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jdct.inc b/simd/jdct.inc new file mode 100644 index 00000000..e53f66e6 --- /dev/null +++ b/simd/jdct.inc @@ -0,0 +1,27 @@ +; +; jdct.inc - private declarations for forward & reverse DCT subsystems +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; [TAB8] + +; Each IDCT routine is responsible for range-limiting its results and +; converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could +; be quite far out of range if the input data is corrupt, so a bulletproof +; range-limiting step is required. We use a mask-and-table-lookup method +; to do the combined operations quickly. +; +%define RANGE_MASK (MAXJSAMPLE * 4 + 3) ; 2 bits wider than legal samples + +%define ROW(n,b,s) ((b)+(n)*(s)) +%define COL(n,b,s) ((b)+(n)*(s)*DCTSIZE) + +%define DWBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_DWORD) +%define MMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_MMWORD) + +; -------------------------------------------------------------------------- diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm new file mode 100644 index 00000000..8d82e40a --- /dev/null +++ b/simd/jdmermmx.asm @@ -0,0 +1,492 @@ +; +; jdmermmx.asm - merged upsampling/color conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_merged_upsample_mmx) + +EXTN(jconst_merged_upsample_mmx): + +PW_F0402 times 4 dw F_0_402 +PW_MF0228 times 4 dw -F_0_228 +PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 +PW_ONE times 4 dw 1 +PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v1_merged_upsample_mmx) + +EXTN(jsimd_h2v1_merged_upsample_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + + pop ecx ; col + + alignx 16,7 +.columnloop: + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) + movq mm7, MMWORD [edx] ; mm7=Cr(01234567) + + pxor mm1,mm1 ; mm1=(all 0's) + pcmpeqw mm3,mm3 + psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} + + movq mm4,mm6 + punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH + punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL + movq mm0,mm7 + punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH + punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL + + paddw mm6,mm3 + paddw mm4,mm3 + paddw mm7,mm3 + paddw mm0,mm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movq mm5,mm6 ; mm5=CbH + movq mm2,mm4 ; mm2=CbL + paddw mm6,mm6 ; mm6=2*CbH + paddw mm4,mm4 ; mm4=2*CbL + movq mm1,mm7 ; mm1=CrH + movq mm3,mm0 ; mm3=CrL + paddw mm7,mm7 ; mm7=2*CrH + paddw mm0,mm0 ; mm0=2*CrL + + pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) + pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) + + paddw mm6,[GOTOFF(eax,PW_ONE)] + paddw mm4,[GOTOFF(eax,PW_ONE)] + psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) + psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) + paddw mm7,[GOTOFF(eax,PW_ONE)] + paddw mm0,[GOTOFF(eax,PW_ONE)] + psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) + psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) + + paddw mm6,mm5 + paddw mm4,mm2 + paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H + paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L + paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H + paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L + + movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H + movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H + + movq mm6,mm5 + movq mm7,mm2 + punpcklwd mm5,mm1 + punpckhwd mm6,mm1 + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm2,mm3 + punpckhwd mm7,mm3 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + paddd mm6,[GOTOFF(eax,PD_ONEHALF)] + psrad mm5,SCALEBITS + psrad mm6,SCALEBITS + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm7,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm7,SCALEBITS + + packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + + movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H + + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 + +.Yloop_2nd: + movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H + movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H + movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H + alignx 16,7 + +.Yloop_1st: + movq mm7, MMWORD [esi] ; mm7=Y(01234567) + + pcmpeqw mm6,mm6 + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + pand mm6,mm7 ; mm6=Y(0246)=YE + psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO + + movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) + movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) + movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) + + paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + + paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + + paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) + paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + + sub ecx, byte SIZEOF_MMWORD + jz short .endcolumn + + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st16: + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 +.column_st8: + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD +.column_st4: + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD +.column_st2: + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD +.column_st1: + cmp ecx, byte SIZEOF_BYTE + jb short .endcolumn + mov BYTE [edi+0*SIZEOF_BYTE], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%else + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%endif + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + + sub ecx, byte SIZEOF_MMWORD + jz short .endcolumn + + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st16: + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD +.column_st8: + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD +.column_st4: + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .endcolumn + movd DWORD [edi+0*SIZEOF_DWORD], mmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + + align 16 + global EXTN(jsimd_h2v2_merged_upsample_mmx) + +EXTN(jsimd_h2v2_merged_upsample_mmx): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov eax, JDIMENSION [output_width(ebp)] + + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp + + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width + + call near EXTN(jsimd_h2v1_merged_upsample_mmx) + + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi + + call near EXTN(jsimd_h2v1_merged_upsample_mmx) + + add esp, byte 7*SIZEOF_DWORD + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jdsammmx.asm b/simd/jdsammmx.asm new file mode 100644 index 00000000..f061ee93 --- /dev/null +++ b/simd/jdsammmx.asm @@ -0,0 +1,734 @@ +; +; jdsammmx.asm - upsampling (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fancy_upsample_mmx) + +EXTN(jconst_fancy_upsample_mmx): + +PW_ONE times 4 dw 1 +PW_TWO times 4 dw 2 +PW_THREE times 4 dw 3 +PW_SEVEN times 4 dw 7 +PW_EIGHT times 4 dw 8 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. +; +; The upsampling algorithm is linear interpolation between pixel centers, +; also known as a "triangle filter". This is a good compromise between +; speed and visual quality. The centers of the output pixels are 1/4 and 3/4 +; of the way between input pixel centers. +; +; GLOBAL(void) +; jsimd_h2v1_fancy_upsample_mmx (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_mmx) + +EXTN(jsimd_h2v1_fancy_upsample_mmx): + push ebp + mov ebp,esp + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr + test eax,eax + jz near .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push eax ; colctr + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + + test eax, SIZEOF_MMWORD-1 + jz short .skip + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample +.skip: + pxor mm0,mm0 ; mm0=(all 0's) + pcmpeqb mm7,mm7 + psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT + pand mm7, MMWORD [esi+0*SIZEOF_MMWORD] + + add eax, byte SIZEOF_MMWORD-1 + and eax, byte -SIZEOF_MMWORD + cmp eax, byte SIZEOF_MMWORD + ja short .columnloop + alignx 16,7 + +.columnloop_last: + pcmpeqb mm6,mm6 + psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT + pand mm6, MMWORD [esi+0*SIZEOF_MMWORD] + jmp short .upsample + alignx 16,7 + +.columnloop: + movq mm6, MMWORD [esi+1*SIZEOF_MMWORD] + psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT + +.upsample: + movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm2,mm1 + movq mm3,mm1 ; mm1=( 0 1 2 3 4 5 6 7) + psllq mm2,BYTE_BIT ; mm2=( - 0 1 2 3 4 5 6) + psrlq mm3,BYTE_BIT ; mm3=( 1 2 3 4 5 6 7 -) + + por mm2,mm7 ; mm2=(-1 0 1 2 3 4 5 6) + por mm3,mm6 ; mm3=( 1 2 3 4 5 6 7 8) + + movq mm7,mm1 + psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT ; mm7=( 7 - - - - - - -) + + movq mm4,mm1 + punpcklbw mm1,mm0 ; mm1=( 0 1 2 3) + punpckhbw mm4,mm0 ; mm4=( 4 5 6 7) + movq mm5,mm2 + punpcklbw mm2,mm0 ; mm2=(-1 0 1 2) + punpckhbw mm5,mm0 ; mm5=( 3 4 5 6) + movq mm6,mm3 + punpcklbw mm3,mm0 ; mm3=( 1 2 3 4) + punpckhbw mm6,mm0 ; mm6=( 5 6 7 8) + + pmullw mm1,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + paddw mm2,[GOTOFF(ebx,PW_ONE)] + paddw mm5,[GOTOFF(ebx,PW_ONE)] + paddw mm3,[GOTOFF(ebx,PW_TWO)] + paddw mm6,[GOTOFF(ebx,PW_TWO)] + + paddw mm2,mm1 + paddw mm5,mm4 + psrlw mm2,2 ; mm2=OutLE=( 0 2 4 6) + psrlw mm5,2 ; mm5=OutHE=( 8 10 12 14) + paddw mm3,mm1 + paddw mm6,mm4 + psrlw mm3,2 ; mm3=OutLO=( 1 3 5 7) + psrlw mm6,2 ; mm6=OutHO=( 9 11 13 15) + + psllw mm3,BYTE_BIT + psllw mm6,BYTE_BIT + por mm2,mm3 ; mm2=OutL=( 0 1 2 3 4 5 6 7) + por mm5,mm6 ; mm5=OutH=( 8 9 10 11 12 13 14 15) + + movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm5 + + sub eax, byte SIZEOF_MMWORD + add esi, byte 1*SIZEOF_MMWORD ; inptr + add edi, byte 2*SIZEOF_MMWORD ; outptr + cmp eax, byte SIZEOF_MMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last + + pop esi + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. +; Again a triangle filter; see comments for h2v1 case, above. +; +; GLOBAL(void) +; jsimd_h2v2_fancy_upsample_mmx (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 4 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_mmx) + +EXTN(jsimd_h2v2_fancy_upsample_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov edx,eax ; edx = original ebp + mov eax, JDIMENSION [downsamp_width(edx)] ; colctr + test eax,eax + jz near .return + + mov ecx, INT [max_v_samp(edx)] ; rowctr + test ecx,ecx + jz near .return + + mov esi, JSAMPARRAY [input_data(edx)] ; input_data + mov edi, POINTER [output_data_ptr(edx)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push eax ; colctr + push ecx + push edi + push esi + + mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + + test eax, SIZEOF_MMWORD-1 + jz short .skip + push edx + mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop edx +.skip: + ; -- process the first column block + + movq mm0, MMWORD [ebx+0*SIZEOF_MMWORD] ; mm0=row[ 0][0] + movq mm1, MMWORD [ecx+0*SIZEOF_MMWORD] ; mm1=row[-1][0] + movq mm2, MMWORD [esi+0*SIZEOF_MMWORD] ; mm2=row[+1][0] + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pxor mm3,mm3 ; mm3=(all 0's) + movq mm4,mm0 + punpcklbw mm0,mm3 ; mm0=row[ 0][0]( 0 1 2 3) + punpckhbw mm4,mm3 ; mm4=row[ 0][0]( 4 5 6 7) + movq mm5,mm1 + punpcklbw mm1,mm3 ; mm1=row[-1][0]( 0 1 2 3) + punpckhbw mm5,mm3 ; mm5=row[-1][0]( 4 5 6 7) + movq mm6,mm2 + punpcklbw mm2,mm3 ; mm2=row[+1][0]( 0 1 2 3) + punpckhbw mm6,mm3 ; mm6=row[+1][0]( 4 5 6 7) + + pmullw mm0,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + + pcmpeqb mm7,mm7 + psrlq mm7,(SIZEOF_MMWORD-2)*BYTE_BIT + + paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) + paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) + paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) + paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) + + movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 ; temporarily save + movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 ; the intermediate data + movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm6 + + pand mm1,mm7 ; mm1=( 0 - - -) + pand mm2,mm7 ; mm2=( 0 - - -) + + movq MMWORD [wk(0)], mm1 + movq MMWORD [wk(1)], mm2 + + poppic ebx + + add eax, byte SIZEOF_MMWORD-1 + and eax, byte -SIZEOF_MMWORD + cmp eax, byte SIZEOF_MMWORD + ja short .columnloop + alignx 16,7 + +.columnloop_last: + ; -- process the last column block + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pcmpeqb mm1,mm1 + psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT + movq mm2,mm1 + + pand mm1, MMWORD [edx+1*SIZEOF_MMWORD] ; mm1=( - - - 7) + pand mm2, MMWORD [edi+1*SIZEOF_MMWORD] ; mm2=( - - - 7) + + movq MMWORD [wk(2)], mm1 + movq MMWORD [wk(3)], mm2 + + jmp short .upsample + alignx 16,7 + +.columnloop: + ; -- process the next column block + + movq mm0, MMWORD [ebx+1*SIZEOF_MMWORD] ; mm0=row[ 0][1] + movq mm1, MMWORD [ecx+1*SIZEOF_MMWORD] ; mm1=row[-1][1] + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] ; mm2=row[+1][1] + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pxor mm3,mm3 ; mm3=(all 0's) + movq mm4,mm0 + punpcklbw mm0,mm3 ; mm0=row[ 0][1]( 0 1 2 3) + punpckhbw mm4,mm3 ; mm4=row[ 0][1]( 4 5 6 7) + movq mm5,mm1 + punpcklbw mm1,mm3 ; mm1=row[-1][1]( 0 1 2 3) + punpckhbw mm5,mm3 ; mm5=row[-1][1]( 4 5 6 7) + movq mm6,mm2 + punpcklbw mm2,mm3 ; mm2=row[+1][1]( 0 1 2 3) + punpckhbw mm6,mm3 ; mm6=row[+1][1]( 4 5 6 7) + + pmullw mm0,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + + paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) + paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) + paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) + paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) + + movq MMWORD [edx+2*SIZEOF_MMWORD], mm1 ; temporarily save + movq MMWORD [edx+3*SIZEOF_MMWORD], mm5 ; the intermediate data + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm6 + + psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm1=( - - - 0) + psllq mm2,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm2=( - - - 0) + + movq MMWORD [wk(2)], mm1 + movq MMWORD [wk(3)], mm2 + +.upsample: + ; -- process the upper row + + movq mm7, MMWORD [edx+0*SIZEOF_MMWORD] ; mm7=Int0L=( 0 1 2 3) + movq mm3, MMWORD [edx+1*SIZEOF_MMWORD] ; mm3=Int0H=( 4 5 6 7) + + movq mm0,mm7 + movq mm4,mm3 + psrlq mm0,2*BYTE_BIT ; mm0=( 1 2 3 -) + psllq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( - - - 4) + movq mm5,mm7 + movq mm6,mm3 + psrlq mm5,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm5=( 3 - - -) + psllq mm6,2*BYTE_BIT ; mm6=( - 4 5 6) + + por mm0,mm4 ; mm0=( 1 2 3 4) + por mm5,mm6 ; mm5=( 3 4 5 6) + + movq mm1,mm7 + movq mm2,mm3 + psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) + psrlq mm2,2*BYTE_BIT ; mm2=( 5 6 7 -) + movq mm4,mm3 + psrlq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( 7 - - -) + + por mm1, MMWORD [wk(0)] ; mm1=(-1 0 1 2) + por mm2, MMWORD [wk(2)] ; mm2=( 5 6 7 8) + + movq MMWORD [wk(0)], mm4 + + pmullw mm7,[GOTOFF(ebx,PW_THREE)] + pmullw mm3,[GOTOFF(ebx,PW_THREE)] + paddw mm1,[GOTOFF(ebx,PW_EIGHT)] + paddw mm5,[GOTOFF(ebx,PW_EIGHT)] + paddw mm0,[GOTOFF(ebx,PW_SEVEN)] + paddw mm2,[GOTOFF(ebx,PW_SEVEN)] + + paddw mm1,mm7 + paddw mm5,mm3 + psrlw mm1,4 ; mm1=Out0LE=( 0 2 4 6) + psrlw mm5,4 ; mm5=Out0HE=( 8 10 12 14) + paddw mm0,mm7 + paddw mm2,mm3 + psrlw mm0,4 ; mm0=Out0LO=( 1 3 5 7) + psrlw mm2,4 ; mm2=Out0HO=( 9 11 13 15) + + psllw mm0,BYTE_BIT + psllw mm2,BYTE_BIT + por mm1,mm0 ; mm1=Out0L=( 0 1 2 3 4 5 6 7) + por mm5,mm2 ; mm5=Out0H=( 8 9 10 11 12 13 14 15) + + movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 + movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 + + ; -- process the lower row + + movq mm6, MMWORD [edi+0*SIZEOF_MMWORD] ; mm6=Int1L=( 0 1 2 3) + movq mm4, MMWORD [edi+1*SIZEOF_MMWORD] ; mm4=Int1H=( 4 5 6 7) + + movq mm7,mm6 + movq mm3,mm4 + psrlq mm7,2*BYTE_BIT ; mm7=( 1 2 3 -) + psllq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( - - - 4) + movq mm0,mm6 + movq mm2,mm4 + psrlq mm0,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm0=( 3 - - -) + psllq mm2,2*BYTE_BIT ; mm2=( - 4 5 6) + + por mm7,mm3 ; mm7=( 1 2 3 4) + por mm0,mm2 ; mm0=( 3 4 5 6) + + movq mm1,mm6 + movq mm5,mm4 + psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) + psrlq mm5,2*BYTE_BIT ; mm5=( 5 6 7 -) + movq mm3,mm4 + psrlq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( 7 - - -) + + por mm1, MMWORD [wk(1)] ; mm1=(-1 0 1 2) + por mm5, MMWORD [wk(3)] ; mm5=( 5 6 7 8) + + movq MMWORD [wk(1)], mm3 + + pmullw mm6,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + paddw mm1,[GOTOFF(ebx,PW_EIGHT)] + paddw mm0,[GOTOFF(ebx,PW_EIGHT)] + paddw mm7,[GOTOFF(ebx,PW_SEVEN)] + paddw mm5,[GOTOFF(ebx,PW_SEVEN)] + + paddw mm1,mm6 + paddw mm0,mm4 + psrlw mm1,4 ; mm1=Out1LE=( 0 2 4 6) + psrlw mm0,4 ; mm0=Out1HE=( 8 10 12 14) + paddw mm7,mm6 + paddw mm5,mm4 + psrlw mm7,4 ; mm7=Out1LO=( 1 3 5 7) + psrlw mm5,4 ; mm5=Out1HO=( 9 11 13 15) + + psllw mm7,BYTE_BIT + psllw mm5,BYTE_BIT + por mm1,mm7 ; mm1=Out1L=( 0 1 2 3 4 5 6 7) + por mm0,mm5 ; mm0=Out1H=( 8 9 10 11 12 13 14 15) + + movq MMWORD [edi+0*SIZEOF_MMWORD], mm1 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm0 + + poppic ebx + + sub eax, byte SIZEOF_MMWORD + add ecx, byte 1*SIZEOF_MMWORD ; inptr1(above) + add ebx, byte 1*SIZEOF_MMWORD ; inptr0 + add esi, byte 1*SIZEOF_MMWORD ; inptr1(below) + add edx, byte 2*SIZEOF_MMWORD ; outptr0 + add edi, byte 2*SIZEOF_MMWORD ; outptr1 + cmp eax, byte SIZEOF_MMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last + + pop esi + pop edi + pop ecx + pop eax + + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 1:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v1_upsample_mmx (int max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_upsample_mmx) + +EXTN(jsimd_h2v1_upsample_mmx): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_MMWORD)-1 + and edx, byte -(2*SIZEOF_MMWORD) + jz short .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + mov eax,edx ; colctr + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + + movq mm1,mm0 + punpcklbw mm0,mm0 + punpckhbw mm1,mm1 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 + + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow + + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] + + movq mm3,mm2 + punpcklbw mm2,mm2 + punpckhbw mm3,mm3 + + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 + + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow + + add esi, byte 2*SIZEOF_MMWORD ; inptr + add edi, byte 4*SIZEOF_MMWORD ; outptr + jmp short .columnloop + alignx 16,7 + +.nextrow: + pop esi + pop edi + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg short .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 2:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v2_upsample_mmx (int max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v2_upsample_mmx) + +EXTN(jsimd_h2v2_upsample_mmx): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_MMWORD)-1 + and edx, byte -(2*SIZEOF_MMWORD) + jz near .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov eax,edx ; colctr + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + + movq mm1,mm0 + punpcklbw mm0,mm0 + punpckhbw mm1,mm1 + + movq MMWORD [ebx+0*SIZEOF_MMWORD], mm0 + movq MMWORD [ebx+1*SIZEOF_MMWORD], mm1 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 + + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow + + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] + + movq mm3,mm2 + punpcklbw mm2,mm2 + punpckhbw mm3,mm3 + + movq MMWORD [ebx+2*SIZEOF_MMWORD], mm2 + movq MMWORD [ebx+3*SIZEOF_MMWORD], mm3 + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 + + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow + + add esi, byte 2*SIZEOF_MMWORD ; inptr + add ebx, byte 4*SIZEOF_MMWORD ; outptr0 + add edi, byte 4*SIZEOF_MMWORD ; outptr1 + jmp short .columnloop + alignx 16,7 + +.nextrow: + pop esi + pop edi + + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg short .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jfmmxfst.asm b/simd/jfmmxfst.asm new file mode 100644 index 00000000..46556b13 --- /dev/null +++ b/simd/jfmmxfst.asm @@ -0,0 +1,394 @@ +; +; jfmmxfst.asm - fast integer FDCT (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the forward DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jfdctfst.c; see the jfdctfst.c +; for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. + +%if CONST_BITS == 8 +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_fdct_ifast_mmx) + +EXTN(jconst_fdct_ifast_mmx): + +PW_F0707 times 4 dw F_0_707 << CONST_SHIFT +PW_F0382 times 4 dw F_0_382 << CONST_SHIFT +PW_F0541 times 4 dw F_0_541 << CONST_SHIFT +PW_F1306 times 4 dw F_1_306 << CONST_SHIFT + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_ifast_mmx (DCTELEM * data) +; + +%define data(b) (b)+8 ; DCTELEM * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_ifast_mmx) + +EXTN(jsimd_fdct_ifast_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.rowloop: + + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] + + ; mm0=(20 21 22 23), mm2=(24 25 26 27) + ; mm1=(30 31 32 33), mm3=(34 35 36 37) + + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(24 34 25 35) + punpckhwd mm5,mm3 ; mm5=(26 36 27 37) + + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] + + ; mm6=(00 01 02 03), mm1=(04 05 06 07) + ; mm7=(10 11 12 13), mm3=(14 15 16 17) + + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) + + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm4,mm7 ; mm4=(02 12 03 13) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(04 14 05 15) + punpckhwd mm2,mm3 ; mm2=(06 16 07 17) + + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 + punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 + punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 + + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 + + movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) + movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 + punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 + punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 + + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 + + ; -- Even part + + movq mm1,mm5 + movq mm6,mm0 + psubw mm5,mm7 ; mm5=tmp13 + psubw mm0,mm4 ; mm0=tmp12 + paddw mm1,mm7 ; mm1=tmp10 + paddw mm6,mm4 ; mm6=tmp11 + + paddw mm0,mm5 + psllw mm0,PRE_MULTIPLY_SCALE_BITS + pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 + + movq mm7,mm1 + movq mm4,mm5 + psubw mm1,mm6 ; mm1=data4 + psubw mm5,mm0 ; mm5=data6 + paddw mm7,mm6 ; mm7=data0 + paddw mm4,mm0 ; mm4=data2 + + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + + ; -- Odd part + + movq mm6, MMWORD [wk(0)] ; mm6=tmp6 + movq mm0, MMWORD [wk(1)] ; mm0=tmp7 + + paddw mm2,mm3 ; mm2=tmp10 + paddw mm3,mm6 ; mm3=tmp11 + paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 + + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm6,PRE_MULTIPLY_SCALE_BITS + + psllw mm3,PRE_MULTIPLY_SCALE_BITS + pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 + + movq mm1,mm2 ; mm1=tmp10 + psubw mm2,mm6 + pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 + pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) + pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) + paddw mm1,mm2 ; mm1=z2 + paddw mm6,mm2 ; mm6=z4 + + movq mm5,mm0 + psubw mm0,mm3 ; mm0=z13 + paddw mm5,mm3 ; mm5=z11 + + movq mm7,mm0 + movq mm4,mm5 + psubw mm0,mm1 ; mm0=data3 + psubw mm5,mm6 ; mm5=data7 + paddw mm7,mm1 ; mm7=data5 + paddw mm4,mm6 ; mm4=data1 + + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 + + add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + + ; mm0=(02 12 22 32), mm2=(42 52 62 72) + ; mm1=(03 13 23 33), mm3=(43 53 63 73) + + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(02 03 12 13) + punpckhwd mm4,mm1 ; mm4=(22 23 32 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(42 43 52 53) + punpckhwd mm5,mm3 ; mm5=(62 63 72 73) + + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + + ; mm6=(00 10 20 30), mm1=(40 50 60 70) + ; mm7=(01 11 21 31), mm3=(41 51 61 71) + + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) + + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 01 10 11) + punpckhwd mm4,mm7 ; mm4=(20 21 30 31) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(40 41 50 51) + punpckhwd mm2,mm3 ; mm2=(60 61 70 71) + + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 + punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 + punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 + + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 + + movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) + movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 + punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 + punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 + + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 + + ; -- Even part + + movq mm1,mm5 + movq mm6,mm0 + psubw mm5,mm7 ; mm5=tmp13 + psubw mm0,mm4 ; mm0=tmp12 + paddw mm1,mm7 ; mm1=tmp10 + paddw mm6,mm4 ; mm6=tmp11 + + paddw mm0,mm5 + psllw mm0,PRE_MULTIPLY_SCALE_BITS + pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 + + movq mm7,mm1 + movq mm4,mm5 + psubw mm1,mm6 ; mm1=data4 + psubw mm5,mm0 ; mm5=data6 + paddw mm7,mm6 ; mm7=data0 + paddw mm4,mm0 ; mm4=data2 + + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + + ; -- Odd part + + movq mm6, MMWORD [wk(0)] ; mm6=tmp6 + movq mm0, MMWORD [wk(1)] ; mm0=tmp7 + + paddw mm2,mm3 ; mm2=tmp10 + paddw mm3,mm6 ; mm3=tmp11 + paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 + + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm6,PRE_MULTIPLY_SCALE_BITS + + psllw mm3,PRE_MULTIPLY_SCALE_BITS + pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 + + movq mm1,mm2 ; mm1=tmp10 + psubw mm2,mm6 + pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 + pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) + pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) + paddw mm1,mm2 ; mm1=z2 + paddw mm6,mm2 ; mm6=z4 + + movq mm5,mm0 + psubw mm0,mm3 ; mm0=z13 + paddw mm5,mm3 ; mm5=z11 + + movq mm7,mm0 + movq mm4,mm5 + psubw mm0,mm1 ; mm0=data3 + psubw mm5,mm6 ; mm5=data7 + paddw mm7,mm1 ; mm7=data5 + paddw mm4,mm6 ; mm4=data1 + + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 + + add edx, byte 4*SIZEOF_DCTELEM + dec ecx + jnz near .columnloop + + emms ; empty MMX state + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jfmmxint.asm b/simd/jfmmxint.asm new file mode 100644 index 00000000..87935a97 --- /dev/null +++ b/simd/jfmmxint.asm @@ -0,0 +1,619 @@ +; +; jfmmxint.asm - accurate integer FDCT (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; forward DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jfdctint.c; see the jfdctint.c for +; more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_islow_mmx) + +EXTN(jconst_fdct_islow_mmx): + +PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 4 dw 1 << (PASS1_BITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_islow_mmx (DCTELEM * data) +; + +%define data(b) (b)+8 ; DCTELEM * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_islow_mmx) + +EXTN(jsimd_fdct_islow_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.rowloop: + + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] + + ; mm0=(20 21 22 23), mm2=(24 25 26 27) + ; mm1=(30 31 32 33), mm3=(34 35 36 37) + + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(24 34 25 35) + punpckhwd mm5,mm3 ; mm5=(26 36 27 37) + + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] + + ; mm6=(00 01 02 03), mm1=(04 05 06 07) + ; mm7=(10 11 12 13), mm3=(14 15 16 17) + + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) + + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm4,mm7 ; mm4=(02 12 03 13) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(04 14 05 15) + punpckhwd mm2,mm3 ; mm2=(06 16 07 17) + + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 + punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 + punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 + + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 + + movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) + movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 + punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 + punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 + + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 + + ; -- Even part + + movq mm1,mm5 + movq mm6,mm0 + paddw mm5,mm7 ; mm5=tmp10 + paddw mm0,mm4 ; mm0=tmp11 + psubw mm1,mm7 ; mm1=tmp13 + psubw mm6,mm4 ; mm6=tmp12 + + movq mm7,mm5 + paddw mm5,mm0 ; mm5=tmp10+tmp11 + psubw mm7,mm0 ; mm7=tmp10-tmp11 + + psllw mm5,PASS1_BITS ; mm5=data0 + psllw mm7,PASS1_BITS ; mm7=data4 + + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm7 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movq mm4,mm1 ; mm1=tmp13 + movq mm0,mm1 + punpcklwd mm4,mm6 ; mm6=tmp12 + punpckhwd mm0,mm6 + movq mm1,mm4 + movq mm6,mm0 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L + pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L + pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H + + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm0,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm4,DESCALE_P1 + psrad mm0,DESCALE_P1 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm6,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm1,DESCALE_P1 + psrad mm6,DESCALE_P1 + + packssdw mm4,mm0 ; mm4=data2 + packssdw mm1,mm6 ; mm1=data6 + + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm1 + + ; -- Odd part + + movq mm5, MMWORD [wk(0)] ; mm5=tmp6 + movq mm7, MMWORD [wk(1)] ; mm7=tmp7 + + movq mm0,mm2 ; mm2=tmp4 + movq mm6,mm3 ; mm3=tmp5 + paddw mm0,mm5 ; mm0=z3 + paddw mm6,mm7 ; mm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movq mm4,mm0 + movq mm1,mm0 + punpcklwd mm4,mm6 + punpckhwd mm1,mm6 + movq mm0,mm4 + movq mm6,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L + pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H + pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L + pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H + + movq MMWORD [wk(0)], mm4 ; wk(0)=z3L + movq MMWORD [wk(1)], mm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movq mm4,mm2 + movq mm1,mm2 + punpcklwd mm4,mm7 + punpckhwd mm1,mm7 + movq mm2,mm4 + movq mm7,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L + pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H + pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L + pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H + + paddd mm4, MMWORD [wk(0)] ; mm4=data7L + paddd mm1, MMWORD [wk(1)] ; mm1=data7H + paddd mm2,mm0 ; mm2=data1L + paddd mm7,mm6 ; mm7=data1H + + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm4,DESCALE_P1 + psrad mm1,DESCALE_P1 + paddd mm2,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm2,DESCALE_P1 + psrad mm7,DESCALE_P1 + + packssdw mm4,mm1 ; mm4=data7 + packssdw mm2,mm7 ; mm2=data1 + + movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 + + movq mm1,mm3 + movq mm7,mm3 + punpcklwd mm1,mm5 + punpckhwd mm7,mm5 + movq mm3,mm1 + movq mm5,mm7 + pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L + pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H + pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L + pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H + + paddd mm1,mm0 ; mm1=data5L + paddd mm7,mm6 ; mm7=data5H + paddd mm3, MMWORD [wk(0)] ; mm3=data3L + paddd mm5, MMWORD [wk(1)] ; mm5=data3H + + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm1,DESCALE_P1 + psrad mm7,DESCALE_P1 + paddd mm3,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm5,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm3,DESCALE_P1 + psrad mm5,DESCALE_P1 + + packssdw mm1,mm7 ; mm1=data5 + packssdw mm3,mm5 ; mm3=data3 + + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 + + add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + + ; mm0=(02 12 22 32), mm2=(42 52 62 72) + ; mm1=(03 13 23 33), mm3=(43 53 63 73) + + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(02 03 12 13) + punpckhwd mm4,mm1 ; mm4=(22 23 32 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(42 43 52 53) + punpckhwd mm5,mm3 ; mm5=(62 63 72 73) + + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + + ; mm6=(00 10 20 30), mm1=(40 50 60 70) + ; mm7=(01 11 21 31), mm3=(41 51 61 71) + + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) + + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 01 10 11) + punpckhwd mm4,mm7 ; mm4=(20 21 30 31) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(40 41 50 51) + punpckhwd mm2,mm3 ; mm2=(60 61 70 71) + + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 + punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 + punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 + + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 + + movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) + movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 + punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 + punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 + + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 + + ; -- Even part + + movq mm1,mm5 + movq mm6,mm0 + paddw mm5,mm7 ; mm5=tmp10 + paddw mm0,mm4 ; mm0=tmp11 + psubw mm1,mm7 ; mm1=tmp13 + psubw mm6,mm4 ; mm6=tmp12 + + movq mm7,mm5 + paddw mm5,mm0 ; mm5=tmp10+tmp11 + psubw mm7,mm0 ; mm7=tmp10-tmp11 + + paddw mm5,[GOTOFF(ebx,PW_DESCALE_P2X)] + paddw mm7,[GOTOFF(ebx,PW_DESCALE_P2X)] + psraw mm5,PASS1_BITS ; mm5=data0 + psraw mm7,PASS1_BITS ; mm7=data4 + + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm7 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movq mm4,mm1 ; mm1=tmp13 + movq mm0,mm1 + punpcklwd mm4,mm6 ; mm6=tmp12 + punpckhwd mm0,mm6 + movq mm1,mm4 + movq mm6,mm0 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L + pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L + pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H + + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm0,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm4,DESCALE_P2 + psrad mm0,DESCALE_P2 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm6,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm1,DESCALE_P2 + psrad mm6,DESCALE_P2 + + packssdw mm4,mm0 ; mm4=data2 + packssdw mm1,mm6 ; mm1=data6 + + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm1 + + ; -- Odd part + + movq mm5, MMWORD [wk(0)] ; mm5=tmp6 + movq mm7, MMWORD [wk(1)] ; mm7=tmp7 + + movq mm0,mm2 ; mm2=tmp4 + movq mm6,mm3 ; mm3=tmp5 + paddw mm0,mm5 ; mm0=z3 + paddw mm6,mm7 ; mm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movq mm4,mm0 + movq mm1,mm0 + punpcklwd mm4,mm6 + punpckhwd mm1,mm6 + movq mm0,mm4 + movq mm6,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L + pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H + pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L + pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H + + movq MMWORD [wk(0)], mm4 ; wk(0)=z3L + movq MMWORD [wk(1)], mm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movq mm4,mm2 + movq mm1,mm2 + punpcklwd mm4,mm7 + punpckhwd mm1,mm7 + movq mm2,mm4 + movq mm7,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L + pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H + pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L + pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H + + paddd mm4, MMWORD [wk(0)] ; mm4=data7L + paddd mm1, MMWORD [wk(1)] ; mm1=data7H + paddd mm2,mm0 ; mm2=data1L + paddd mm7,mm6 ; mm7=data1H + + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm4,DESCALE_P2 + psrad mm1,DESCALE_P2 + paddd mm2,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm2,DESCALE_P2 + psrad mm7,DESCALE_P2 + + packssdw mm4,mm1 ; mm4=data7 + packssdw mm2,mm7 ; mm2=data1 + + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 + + movq mm1,mm3 + movq mm7,mm3 + punpcklwd mm1,mm5 + punpckhwd mm7,mm5 + movq mm3,mm1 + movq mm5,mm7 + pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L + pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H + pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L + pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H + + paddd mm1,mm0 ; mm1=data5L + paddd mm7,mm6 ; mm7=data5H + paddd mm3, MMWORD [wk(0)] ; mm3=data3L + paddd mm5, MMWORD [wk(1)] ; mm5=data3H + + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm1,DESCALE_P2 + psrad mm7,DESCALE_P2 + paddd mm3,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm3,DESCALE_P2 + psrad mm5,DESCALE_P2 + + packssdw mm1,mm7 ; mm1=data5 + packssdw mm3,mm5 ; mm3=data3 + + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 + + add edx, byte 4*SIZEOF_DCTELEM + dec ecx + jnz near .columnloop + + emms ; empty MMX state + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jimmxfst.asm b/simd/jimmxfst.asm new file mode 100644 index 00000000..662a522f --- /dev/null +++ b/simd/jimmxfst.asm @@ -0,0 +1,497 @@ +; +; jimmxfst.asm - fast integer IDCT (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the inverse DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jidctfst.c; see the jidctfst.c +; for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 + +%if IFAST_SCALE_BITS != PASS1_BITS +%error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." +%endif + +%if CONST_BITS == 8 +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_idct_ifast_mmx) + +EXTN(jconst_idct_ifast_mmx): + +PW_F1414 times 4 dw F_1_414 << CONST_SHIFT +PW_F1847 times 4 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 4 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 4 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 8 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_ifast_mmx (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_ifast_mmx) + +EXTN(jsimd_idct_ifast_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_IFAST_MMX + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] + + movq mm4,mm0 + movq mm5,mm1 + psubw mm0,mm2 ; mm0=tmp11 + psubw mm1,mm3 + paddw mm4,mm2 ; mm4=tmp10 + paddw mm5,mm3 ; mm5=tmp13 + + psllw mm1,PRE_MULTIPLY_SCALE_BITS + pmulhw mm1,[GOTOFF(ebx,PW_F1414)] + psubw mm1,mm5 ; mm1=tmp12 + + movq mm6,mm4 + movq mm7,mm0 + psubw mm4,mm5 ; mm4=tmp3 + psubw mm0,mm1 ; mm0=tmp2 + paddw mm6,mm5 ; mm6=tmp0 + paddw mm7,mm1 ; mm7=tmp1 + + movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 + movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 + + ; -- Odd part + + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] + + movq mm4,mm2 + movq mm0,mm5 + psubw mm2,mm1 ; mm2=z12 + psubw mm5,mm3 ; mm5=z10 + paddw mm4,mm1 ; mm4=z11 + paddw mm0,mm3 ; mm0=z13 + + movq mm1,mm5 ; mm1=z10(unscaled) + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm5,PRE_MULTIPLY_SCALE_BITS + + movq mm3,mm4 + psubw mm4,mm0 + paddw mm3,mm0 ; mm3=tmp7 + + psllw mm4,PRE_MULTIPLY_SCALE_BITS + pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movq mm0,mm5 + paddw mm5,mm2 + pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 + pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw mm2,[GOTOFF(ebx,PW_F1082)] + psubw mm0,mm1 + psubw mm2,mm5 ; mm2=tmp10 + paddw mm0,mm5 ; mm0=tmp12 + + ; -- Final output stage + + psubw mm0,mm3 ; mm0=tmp6 + movq mm1,mm6 + movq mm5,mm7 + paddw mm6,mm3 ; mm6=data0=(00 01 02 03) + paddw mm7,mm0 ; mm7=data1=(10 11 12 13) + psubw mm1,mm3 ; mm1=data7=(70 71 72 73) + psubw mm5,mm0 ; mm5=data6=(60 61 62 63) + psubw mm4,mm0 ; mm4=tmp5 + + movq mm3,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm3,mm7 ; mm3=(02 12 03 13) + movq mm0,mm5 ; transpose coefficients(phase 1) + punpcklwd mm5,mm1 ; mm5=(60 70 61 71) + punpckhwd mm0,mm1 ; mm0=(62 72 63 73) + + movq mm7, MMWORD [wk(0)] ; mm7=tmp2 + movq mm1, MMWORD [wk(1)] ; mm1=tmp3 + + movq MMWORD [wk(0)], mm5 ; wk(0)=(60 70 61 71) + movq MMWORD [wk(1)], mm0 ; wk(1)=(62 72 63 73) + + paddw mm2,mm4 ; mm2=tmp4 + movq mm5,mm7 + movq mm0,mm1 + paddw mm7,mm4 ; mm7=data2=(20 21 22 23) + paddw mm1,mm2 ; mm1=data4=(40 41 42 43) + psubw mm5,mm4 ; mm5=data5=(50 51 52 53) + psubw mm0,mm2 ; mm0=data3=(30 31 32 33) + + movq mm4,mm7 ; transpose coefficients(phase 1) + punpcklwd mm7,mm0 ; mm7=(20 30 21 31) + punpckhwd mm4,mm0 ; mm4=(22 32 23 33) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm5 ; mm1=(40 50 41 51) + punpckhwd mm2,mm5 ; mm2=(42 52 43 53) + + movq mm0,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm7 ; mm6=(00 10 20 30) + punpckhdq mm0,mm7 ; mm0=(01 11 21 31) + movq mm5,mm3 ; transpose coefficients(phase 2) + punpckldq mm3,mm4 ; mm3=(02 12 22 32) + punpckhdq mm5,mm4 ; mm5=(03 13 23 33) + + movq mm7, MMWORD [wk(0)] ; mm7=(60 70 61 71) + movq mm4, MMWORD [wk(1)] ; mm4=(62 72 63 73) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 + + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm7 ; mm1=(40 50 60 70) + punpckhdq mm6,mm7 ; mm6=(41 51 61 71) + movq mm0,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm4 ; mm2=(42 52 62 72) + punpckhdq mm0,mm4 ; mm0=(43 53 63 73) + + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm0 + +.nextcolumn: + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_IFAST_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.rowloop: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + + movq mm4,mm0 + movq mm5,mm1 + psubw mm0,mm2 ; mm0=tmp11 + psubw mm1,mm3 + paddw mm4,mm2 ; mm4=tmp10 + paddw mm5,mm3 ; mm5=tmp13 + + psllw mm1,PRE_MULTIPLY_SCALE_BITS + pmulhw mm1,[GOTOFF(ebx,PW_F1414)] + psubw mm1,mm5 ; mm1=tmp12 + + movq mm6,mm4 + movq mm7,mm0 + psubw mm4,mm5 ; mm4=tmp3 + psubw mm0,mm1 ; mm0=tmp2 + paddw mm6,mm5 ; mm6=tmp0 + paddw mm7,mm1 ; mm7=tmp1 + + movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 + movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 + + ; -- Odd part + + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + + movq mm4,mm2 + movq mm0,mm5 + psubw mm2,mm1 ; mm2=z12 + psubw mm5,mm3 ; mm5=z10 + paddw mm4,mm1 ; mm4=z11 + paddw mm0,mm3 ; mm0=z13 + + movq mm1,mm5 ; mm1=z10(unscaled) + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm5,PRE_MULTIPLY_SCALE_BITS + + movq mm3,mm4 + psubw mm4,mm0 + paddw mm3,mm0 ; mm3=tmp7 + + psllw mm4,PRE_MULTIPLY_SCALE_BITS + pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movq mm0,mm5 + paddw mm5,mm2 + pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 + pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw mm2,[GOTOFF(ebx,PW_F1082)] + psubw mm0,mm1 + psubw mm2,mm5 ; mm2=tmp10 + paddw mm0,mm5 ; mm0=tmp12 + + ; -- Final output stage + + psubw mm0,mm3 ; mm0=tmp6 + movq mm1,mm6 + movq mm5,mm7 + paddw mm6,mm3 ; mm6=data0=(00 10 20 30) + paddw mm7,mm0 ; mm7=data1=(01 11 21 31) + psraw mm6,(PASS1_BITS+3) ; descale + psraw mm7,(PASS1_BITS+3) ; descale + psubw mm1,mm3 ; mm1=data7=(07 17 27 37) + psubw mm5,mm0 ; mm5=data6=(06 16 26 36) + psraw mm1,(PASS1_BITS+3) ; descale + psraw mm5,(PASS1_BITS+3) ; descale + psubw mm4,mm0 ; mm4=tmp5 + + packsswb mm6,mm5 ; mm6=(00 10 20 30 06 16 26 36) + packsswb mm7,mm1 ; mm7=(01 11 21 31 07 17 27 37) + + movq mm3, MMWORD [wk(0)] ; mm3=tmp2 + movq mm0, MMWORD [wk(1)] ; mm0=tmp3 + + paddw mm2,mm4 ; mm2=tmp4 + movq mm5,mm3 + movq mm1,mm0 + paddw mm3,mm4 ; mm3=data2=(02 12 22 32) + paddw mm0,mm2 ; mm0=data4=(04 14 24 34) + psraw mm3,(PASS1_BITS+3) ; descale + psraw mm0,(PASS1_BITS+3) ; descale + psubw mm5,mm4 ; mm5=data5=(05 15 25 35) + psubw mm1,mm2 ; mm1=data3=(03 13 23 33) + psraw mm5,(PASS1_BITS+3) ; descale + psraw mm1,(PASS1_BITS+3) ; descale + + movq mm4,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm4=[PB_CENTERJSAMP] + + packsswb mm3,mm0 ; mm3=(02 12 22 32 04 14 24 34) + packsswb mm1,mm5 ; mm1=(03 13 23 33 05 15 25 35) + + paddb mm6,mm4 + paddb mm7,mm4 + paddb mm3,mm4 + paddb mm1,mm4 + + movq mm2,mm6 ; transpose coefficients(phase 1) + punpcklbw mm6,mm7 ; mm6=(00 01 10 11 20 21 30 31) + punpckhbw mm2,mm7 ; mm2=(06 07 16 17 26 27 36 37) + movq mm0,mm3 ; transpose coefficients(phase 1) + punpcklbw mm3,mm1 ; mm3=(02 03 12 13 22 23 32 33) + punpckhbw mm0,mm1 ; mm0=(04 05 14 15 24 25 34 35) + + movq mm5,mm6 ; transpose coefficients(phase 2) + punpcklwd mm6,mm3 ; mm6=(00 01 02 03 10 11 12 13) + punpckhwd mm5,mm3 ; mm5=(20 21 22 23 30 31 32 33) + movq mm4,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm2 ; mm0=(04 05 06 07 14 15 16 17) + punpckhwd mm4,mm2 ; mm4=(24 25 26 27 34 35 36 37) + + movq mm7,mm6 ; transpose coefficients(phase 3) + punpckldq mm6,mm0 ; mm6=(00 01 02 03 04 05 06 07) + punpckhdq mm7,mm0 ; mm7=(10 11 12 13 14 15 16 17) + movq mm1,mm5 ; transpose coefficients(phase 3) + punpckldq mm5,mm4 ; mm5=(20 21 22 23 24 25 26 27) + punpckhdq mm1,mm4 ; mm1=(30 31 32 33 34 35 36 37) + + pushpic ebx ; save GOT address + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 + + poppic ebx ; restore GOT address + + add esi, byte 4*SIZEOF_JCOEF ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jimmxint.asm b/simd/jimmxint.asm new file mode 100644 index 00000000..775b1e8c --- /dev/null +++ b/simd/jimmxint.asm @@ -0,0 +1,849 @@ +; +; jimmxint.asm - accurate integer IDCT (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctint.c; see the jidctint.c for +; more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_islow_mmx) + +EXTN(jconst_idct_islow_mmx): + +PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_islow_mmx (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 12 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_islow_mmx) + +EXTN(jsimd_idct_islow_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_ISLOW_MMX + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw mm0,PASS1_BITS + + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movq mm4,mm1 ; mm1=in2=z2 + movq mm5,mm1 + punpcklwd mm4,mm3 ; mm3=in6=z3 + punpckhwd mm5,mm3 + movq mm1,mm4 + movq mm3,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L + pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H + + movq mm6,mm0 + paddw mm0,mm2 ; mm0=in0+in4 + psubw mm6,mm2 ; mm6=in0-in4 + + pxor mm7,mm7 + pxor mm2,mm2 + punpcklwd mm7,mm0 ; mm7=tmp0L + punpckhwd mm2,mm0 ; mm2=tmp0H + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS + + movq mm0,mm7 + paddd mm7,mm4 ; mm7=tmp10L + psubd mm0,mm4 ; mm0=tmp13L + movq mm4,mm2 + paddd mm2,mm5 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp13H + + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L + movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H + movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L + movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H + + pxor mm5,mm5 + pxor mm7,mm7 + punpcklwd mm5,mm6 ; mm5=tmp1L + punpckhwd mm7,mm6 ; mm7=tmp1H + psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + + movq mm2,mm5 + paddd mm5,mm1 ; mm5=tmp11L + psubd mm2,mm1 ; mm2=tmp12L + movq mm0,mm7 + paddd mm7,mm3 ; mm7=tmp11H + psubd mm0,mm3 ; mm0=tmp12H + + movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L + movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H + movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L + movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H + + ; -- Odd part + + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm4, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm6, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm1, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + movq mm5,mm6 + movq mm7,mm4 + paddw mm5,mm3 ; mm5=z3 + paddw mm7,mm1 ; mm7=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movq mm2,mm5 + movq mm0,mm5 + punpcklwd mm2,mm7 + punpckhwd mm0,mm7 + movq mm5,mm2 + movq mm7,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L + pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H + pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L + pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H + + movq MMWORD [wk(10)], mm2 ; wk(10)=z3L + movq MMWORD [wk(11)], mm0 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movq mm2,mm3 + movq mm0,mm3 + punpcklwd mm2,mm4 + punpckhwd mm0,mm4 + movq mm3,mm2 + movq mm4,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L + pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H + pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L + pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H + + paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L + paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H + paddd mm3,mm5 ; mm3=tmp3L + paddd mm4,mm7 ; mm4=tmp3H + + movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L + movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H + + movq mm2,mm1 + movq mm0,mm1 + punpcklwd mm2,mm6 + punpckhwd mm0,mm6 + movq mm1,mm2 + movq mm6,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L + pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H + pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L + pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H + + paddd mm2,mm5 ; mm2=tmp1L + paddd mm0,mm7 ; mm0=tmp1H + paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L + paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H + + movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L + movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H + + ; -- Final output stage + + movq mm5, MMWORD [wk(0)] ; mm5=tmp10L + movq mm7, MMWORD [wk(1)] ; mm7=tmp10H + + movq mm2,mm5 + movq mm0,mm7 + paddd mm5,mm3 ; mm5=data0L + paddd mm7,mm4 ; mm7=data0H + psubd mm2,mm3 ; mm2=data7L + psubd mm0,mm4 ; mm0=data7H + + movq mm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm3=[PD_DESCALE_P1] + + paddd mm5,mm3 + paddd mm7,mm3 + psrad mm5,DESCALE_P1 + psrad mm7,DESCALE_P1 + paddd mm2,mm3 + paddd mm0,mm3 + psrad mm2,DESCALE_P1 + psrad mm0,DESCALE_P1 + + packssdw mm5,mm7 ; mm5=data0=(00 01 02 03) + packssdw mm2,mm0 ; mm2=data7=(70 71 72 73) + + movq mm4, MMWORD [wk(4)] ; mm4=tmp11L + movq mm3, MMWORD [wk(5)] ; mm3=tmp11H + + movq mm7,mm4 + movq mm0,mm3 + paddd mm4,mm1 ; mm4=data1L + paddd mm3,mm6 ; mm3=data1H + psubd mm7,mm1 ; mm7=data6L + psubd mm0,mm6 ; mm0=data6H + + movq mm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm1=[PD_DESCALE_P1] + + paddd mm4,mm1 + paddd mm3,mm1 + psrad mm4,DESCALE_P1 + psrad mm3,DESCALE_P1 + paddd mm7,mm1 + paddd mm0,mm1 + psrad mm7,DESCALE_P1 + psrad mm0,DESCALE_P1 + + packssdw mm4,mm3 ; mm4=data1=(10 11 12 13) + packssdw mm7,mm0 ; mm7=data6=(60 61 62 63) + + movq mm6,mm5 ; transpose coefficients(phase 1) + punpcklwd mm5,mm4 ; mm5=(00 10 01 11) + punpckhwd mm6,mm4 ; mm6=(02 12 03 13) + movq mm1,mm7 ; transpose coefficients(phase 1) + punpcklwd mm7,mm2 ; mm7=(60 70 61 71) + punpckhwd mm1,mm2 ; mm1=(62 72 63 73) + + movq mm3, MMWORD [wk(6)] ; mm3=tmp12L + movq mm0, MMWORD [wk(7)] ; mm0=tmp12H + movq mm4, MMWORD [wk(10)] ; mm4=tmp1L + movq mm2, MMWORD [wk(11)] ; mm2=tmp1H + + movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 01 11) + movq MMWORD [wk(1)], mm6 ; wk(1)=(02 12 03 13) + movq MMWORD [wk(4)], mm7 ; wk(4)=(60 70 61 71) + movq MMWORD [wk(5)], mm1 ; wk(5)=(62 72 63 73) + + movq mm5,mm3 + movq mm6,mm0 + paddd mm3,mm4 ; mm3=data2L + paddd mm0,mm2 ; mm0=data2H + psubd mm5,mm4 ; mm5=data5L + psubd mm6,mm2 ; mm6=data5H + + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm7=[PD_DESCALE_P1] + + paddd mm3,mm7 + paddd mm0,mm7 + psrad mm3,DESCALE_P1 + psrad mm0,DESCALE_P1 + paddd mm5,mm7 + paddd mm6,mm7 + psrad mm5,DESCALE_P1 + psrad mm6,DESCALE_P1 + + packssdw mm3,mm0 ; mm3=data2=(20 21 22 23) + packssdw mm5,mm6 ; mm5=data5=(50 51 52 53) + + movq mm1, MMWORD [wk(2)] ; mm1=tmp13L + movq mm4, MMWORD [wk(3)] ; mm4=tmp13H + movq mm2, MMWORD [wk(8)] ; mm2=tmp0L + movq mm7, MMWORD [wk(9)] ; mm7=tmp0H + + movq mm0,mm1 + movq mm6,mm4 + paddd mm1,mm2 ; mm1=data3L + paddd mm4,mm7 ; mm4=data3H + psubd mm0,mm2 ; mm0=data4L + psubd mm6,mm7 ; mm6=data4H + + movq mm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm2=[PD_DESCALE_P1] + + paddd mm1,mm2 + paddd mm4,mm2 + psrad mm1,DESCALE_P1 + psrad mm4,DESCALE_P1 + paddd mm0,mm2 + paddd mm6,mm2 + psrad mm0,DESCALE_P1 + psrad mm6,DESCALE_P1 + + packssdw mm1,mm4 ; mm1=data3=(30 31 32 33) + packssdw mm0,mm6 ; mm0=data4=(40 41 42 43) + + movq mm7, MMWORD [wk(0)] ; mm7=(00 10 01 11) + movq mm2, MMWORD [wk(1)] ; mm2=(02 12 03 13) + + movq mm4,mm3 ; transpose coefficients(phase 1) + punpcklwd mm3,mm1 ; mm3=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm6,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm5 ; mm0=(40 50 41 51) + punpckhwd mm6,mm5 ; mm6=(42 52 43 53) + + movq mm1,mm7 ; transpose coefficients(phase 2) + punpckldq mm7,mm3 ; mm7=(00 10 20 30) + punpckhdq mm1,mm3 ; mm1=(01 11 21 31) + movq mm5,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm4 ; mm2=(02 12 22 32) + punpckhdq mm5,mm4 ; mm5=(03 13 23 33) + + movq mm3, MMWORD [wk(4)] ; mm3=(60 70 61 71) + movq mm4, MMWORD [wk(5)] ; mm4=(62 72 63 73) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm7 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 + + movq mm7,mm0 ; transpose coefficients(phase 2) + punpckldq mm0,mm3 ; mm0=(40 50 60 70) + punpckhdq mm7,mm3 ; mm7=(41 51 61 71) + movq mm1,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm4 ; mm6=(42 52 62 72) + punpckhdq mm1,mm4 ; mm1=(43 53 63 73) + + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm7 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm1 + +.nextcolumn: + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.rowloop: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movq mm4,mm1 ; mm1=in2=z2 + movq mm5,mm1 + punpcklwd mm4,mm3 ; mm3=in6=z3 + punpckhwd mm5,mm3 + movq mm1,mm4 + movq mm3,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L + pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H + + movq mm6,mm0 + paddw mm0,mm2 ; mm0=in0+in4 + psubw mm6,mm2 ; mm6=in0-in4 + + pxor mm7,mm7 + pxor mm2,mm2 + punpcklwd mm7,mm0 ; mm7=tmp0L + punpckhwd mm2,mm0 ; mm2=tmp0H + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS + + movq mm0,mm7 + paddd mm7,mm4 ; mm7=tmp10L + psubd mm0,mm4 ; mm0=tmp13L + movq mm4,mm2 + paddd mm2,mm5 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp13H + + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L + movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H + movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L + movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H + + pxor mm5,mm5 + pxor mm7,mm7 + punpcklwd mm5,mm6 ; mm5=tmp1L + punpckhwd mm7,mm6 ; mm7=tmp1H + psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + + movq mm2,mm5 + paddd mm5,mm1 ; mm5=tmp11L + psubd mm2,mm1 ; mm2=tmp12L + movq mm0,mm7 + paddd mm7,mm3 ; mm7=tmp11H + psubd mm0,mm3 ; mm0=tmp12H + + movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L + movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H + movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L + movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H + + ; -- Odd part + + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + + movq mm5,mm6 + movq mm7,mm4 + paddw mm5,mm3 ; mm5=z3 + paddw mm7,mm1 ; mm7=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movq mm2,mm5 + movq mm0,mm5 + punpcklwd mm2,mm7 + punpckhwd mm0,mm7 + movq mm5,mm2 + movq mm7,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L + pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H + pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L + pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H + + movq MMWORD [wk(10)], mm2 ; wk(10)=z3L + movq MMWORD [wk(11)], mm0 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movq mm2,mm3 + movq mm0,mm3 + punpcklwd mm2,mm4 + punpckhwd mm0,mm4 + movq mm3,mm2 + movq mm4,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L + pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H + pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L + pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H + + paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L + paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H + paddd mm3,mm5 ; mm3=tmp3L + paddd mm4,mm7 ; mm4=tmp3H + + movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L + movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H + + movq mm2,mm1 + movq mm0,mm1 + punpcklwd mm2,mm6 + punpckhwd mm0,mm6 + movq mm1,mm2 + movq mm6,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L + pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H + pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L + pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H + + paddd mm2,mm5 ; mm2=tmp1L + paddd mm0,mm7 ; mm0=tmp1H + paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L + paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H + + movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L + movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H + + ; -- Final output stage + + movq mm5, MMWORD [wk(0)] ; mm5=tmp10L + movq mm7, MMWORD [wk(1)] ; mm7=tmp10H + + movq mm2,mm5 + movq mm0,mm7 + paddd mm5,mm3 ; mm5=data0L + paddd mm7,mm4 ; mm7=data0H + psubd mm2,mm3 ; mm2=data7L + psubd mm0,mm4 ; mm0=data7H + + movq mm3,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm3=[PD_DESCALE_P2] + + paddd mm5,mm3 + paddd mm7,mm3 + psrad mm5,DESCALE_P2 + psrad mm7,DESCALE_P2 + paddd mm2,mm3 + paddd mm0,mm3 + psrad mm2,DESCALE_P2 + psrad mm0,DESCALE_P2 + + packssdw mm5,mm7 ; mm5=data0=(00 10 20 30) + packssdw mm2,mm0 ; mm2=data7=(07 17 27 37) + + movq mm4, MMWORD [wk(4)] ; mm4=tmp11L + movq mm3, MMWORD [wk(5)] ; mm3=tmp11H + + movq mm7,mm4 + movq mm0,mm3 + paddd mm4,mm1 ; mm4=data1L + paddd mm3,mm6 ; mm3=data1H + psubd mm7,mm1 ; mm7=data6L + psubd mm0,mm6 ; mm0=data6H + + movq mm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm1=[PD_DESCALE_P2] + + paddd mm4,mm1 + paddd mm3,mm1 + psrad mm4,DESCALE_P2 + psrad mm3,DESCALE_P2 + paddd mm7,mm1 + paddd mm0,mm1 + psrad mm7,DESCALE_P2 + psrad mm0,DESCALE_P2 + + packssdw mm4,mm3 ; mm4=data1=(01 11 21 31) + packssdw mm7,mm0 ; mm7=data6=(06 16 26 36) + + packsswb mm5,mm7 ; mm5=(00 10 20 30 06 16 26 36) + packsswb mm4,mm2 ; mm4=(01 11 21 31 07 17 27 37) + + movq mm6, MMWORD [wk(6)] ; mm6=tmp12L + movq mm1, MMWORD [wk(7)] ; mm1=tmp12H + movq mm3, MMWORD [wk(10)] ; mm3=tmp1L + movq mm0, MMWORD [wk(11)] ; mm0=tmp1H + + movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 20 30 06 16 26 36) + movq MMWORD [wk(1)], mm4 ; wk(1)=(01 11 21 31 07 17 27 37) + + movq mm7,mm6 + movq mm2,mm1 + paddd mm6,mm3 ; mm6=data2L + paddd mm1,mm0 ; mm1=data2H + psubd mm7,mm3 ; mm7=data5L + psubd mm2,mm0 ; mm2=data5H + + movq mm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm5=[PD_DESCALE_P2] + + paddd mm6,mm5 + paddd mm1,mm5 + psrad mm6,DESCALE_P2 + psrad mm1,DESCALE_P2 + paddd mm7,mm5 + paddd mm2,mm5 + psrad mm7,DESCALE_P2 + psrad mm2,DESCALE_P2 + + packssdw mm6,mm1 ; mm6=data2=(02 12 22 32) + packssdw mm7,mm2 ; mm7=data5=(05 15 25 35) + + movq mm4, MMWORD [wk(2)] ; mm4=tmp13L + movq mm3, MMWORD [wk(3)] ; mm3=tmp13H + movq mm0, MMWORD [wk(8)] ; mm0=tmp0L + movq mm5, MMWORD [wk(9)] ; mm5=tmp0H + + movq mm1,mm4 + movq mm2,mm3 + paddd mm4,mm0 ; mm4=data3L + paddd mm3,mm5 ; mm3=data3H + psubd mm1,mm0 ; mm1=data4L + psubd mm2,mm5 ; mm2=data4H + + movq mm0,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm0=[PD_DESCALE_P2] + + paddd mm4,mm0 + paddd mm3,mm0 + psrad mm4,DESCALE_P2 + psrad mm3,DESCALE_P2 + paddd mm1,mm0 + paddd mm2,mm0 + psrad mm1,DESCALE_P2 + psrad mm2,DESCALE_P2 + + movq mm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm5=[PB_CENTERJSAMP] + + packssdw mm4,mm3 ; mm4=data3=(03 13 23 33) + packssdw mm1,mm2 ; mm1=data4=(04 14 24 34) + + movq mm0, MMWORD [wk(0)] ; mm0=(00 10 20 30 06 16 26 36) + movq mm3, MMWORD [wk(1)] ; mm3=(01 11 21 31 07 17 27 37) + + packsswb mm6,mm1 ; mm6=(02 12 22 32 04 14 24 34) + packsswb mm4,mm7 ; mm4=(03 13 23 33 05 15 25 35) + + paddb mm0,mm5 + paddb mm3,mm5 + paddb mm6,mm5 + paddb mm4,mm5 + + movq mm2,mm0 ; transpose coefficients(phase 1) + punpcklbw mm0,mm3 ; mm0=(00 01 10 11 20 21 30 31) + punpckhbw mm2,mm3 ; mm2=(06 07 16 17 26 27 36 37) + movq mm1,mm6 ; transpose coefficients(phase 1) + punpcklbw mm6,mm4 ; mm6=(02 03 12 13 22 23 32 33) + punpckhbw mm1,mm4 ; mm1=(04 05 14 15 24 25 34 35) + + movq mm7,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm6 ; mm0=(00 01 02 03 10 11 12 13) + punpckhwd mm7,mm6 ; mm7=(20 21 22 23 30 31 32 33) + movq mm5,mm1 ; transpose coefficients(phase 2) + punpcklwd mm1,mm2 ; mm1=(04 05 06 07 14 15 16 17) + punpckhwd mm5,mm2 ; mm5=(24 25 26 27 34 35 36 37) + + movq mm3,mm0 ; transpose coefficients(phase 3) + punpckldq mm0,mm1 ; mm0=(00 01 02 03 04 05 06 07) + punpckhdq mm3,mm1 ; mm3=(10 11 12 13 14 15 16 17) + movq mm4,mm7 ; transpose coefficients(phase 3) + punpckldq mm7,mm5 ; mm7=(20 21 22 23 24 25 26 27) + punpckhdq mm4,mm5 ; mm4=(30 31 32 33 34 35 36 37) + + pushpic ebx ; save GOT address + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm3 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm7 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 + + poppic ebx ; restore GOT address + + add esi, byte 4*SIZEOF_JCOEF ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jimmxred.asm b/simd/jimmxred.asm new file mode 100644 index 00000000..a5ad52bc --- /dev/null +++ b/simd/jimmxred.asm @@ -0,0 +1,703 @@ +; +; jimmxred.asm - reduced-size IDCT (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains inverse-DCT routines that produce reduced-size +; output: either 4x4 or 2x2 pixels from an 8x8 DCT block. +; The following code is based directly on the IJG's original jidctred.c; +; see the jidctred.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) + +%if CONST_BITS == 13 +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_red_mmx) + +EXTN(jconst_idct_red_mmx): + +PW_F184_MF076 times 2 dw F_1_847,-F_0_765 +PW_F256_F089 times 2 dw F_2_562, F_0_899 +PW_F106_MF217 times 2 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 2 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 2 dw F_1_451,-F_0_211 +PW_F362_MF127 times 2 dw F_3_624,-F_1_272 +PW_F085_MF072 times 2 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 2 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 2 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 2 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 2 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 4x4 output block. +; +; GLOBAL(void) +; jsimd_idct_4x4_mmx (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_4x4_mmx) + +EXTN(jsimd_idct_4x4_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_4X4_MMX + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm0,mm1 + packsswb mm0,mm0 + movd eax,mm0 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw mm0,PASS1_BITS + + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Odd part + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + movq mm4,mm0 + movq mm5,mm0 + punpcklwd mm4,mm1 + punpckhwd mm5,mm1 + movq mm0,mm4 + movq mm1,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) + pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) + pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) + pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) + + movq mm6,mm2 + movq mm7,mm2 + punpcklwd mm6,mm3 + punpckhwd mm7,mm3 + movq mm2,mm6 + movq mm3,mm7 + pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) + pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) + pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) + pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) + + paddd mm6,mm4 ; mm6=tmp2L + paddd mm7,mm5 ; mm7=tmp2H + paddd mm2,mm0 ; mm2=tmp0L + paddd mm3,mm1 ; mm3=tmp0H + + movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L + movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H + + ; -- Even part + + movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm4, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm0, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + pxor mm1,mm1 + pxor mm2,mm2 + punpcklwd mm1,mm4 ; mm1=tmp0L + punpckhwd mm2,mm4 ; mm2=tmp0H + psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 + psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 + + movq mm3,mm5 ; mm5=in2=z2 + punpcklwd mm5,mm0 ; mm0=in6=z3 + punpckhwd mm3,mm0 + pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H + + movq mm4,mm1 + movq mm0,mm2 + paddd mm1,mm5 ; mm1=tmp10L + paddd mm2,mm3 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp12L + psubd mm0,mm3 ; mm0=tmp12H + + ; -- Final output stage + + movq mm5,mm1 + movq mm3,mm2 + paddd mm1,mm6 ; mm1=data0L + paddd mm2,mm7 ; mm2=data0H + psubd mm5,mm6 ; mm5=data3L + psubd mm3,mm7 ; mm3=data3H + + movq mm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm6=[PD_DESCALE_P1_4] + + paddd mm1,mm6 + paddd mm2,mm6 + psrad mm1,DESCALE_P1_4 + psrad mm2,DESCALE_P1_4 + paddd mm5,mm6 + paddd mm3,mm6 + psrad mm5,DESCALE_P1_4 + psrad mm3,DESCALE_P1_4 + + packssdw mm1,mm2 ; mm1=data0=(00 01 02 03) + packssdw mm5,mm3 ; mm5=data3=(30 31 32 33) + + movq mm7, MMWORD [wk(0)] ; mm7=tmp0L + movq mm6, MMWORD [wk(1)] ; mm6=tmp0H + + movq mm2,mm4 + movq mm3,mm0 + paddd mm4,mm7 ; mm4=data1L + paddd mm0,mm6 ; mm0=data1H + psubd mm2,mm7 ; mm2=data2L + psubd mm3,mm6 ; mm3=data2H + + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm7=[PD_DESCALE_P1_4] + + paddd mm4,mm7 + paddd mm0,mm7 + psrad mm4,DESCALE_P1_4 + psrad mm0,DESCALE_P1_4 + paddd mm2,mm7 + paddd mm3,mm7 + psrad mm2,DESCALE_P1_4 + psrad mm3,DESCALE_P1_4 + + packssdw mm4,mm0 ; mm4=data1=(10 11 12 13) + packssdw mm2,mm3 ; mm2=data2=(20 21 22 23) + + movq mm6,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm4 ; mm1=(00 10 01 11) + punpckhwd mm6,mm4 ; mm6=(02 12 03 13) + movq mm7,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm5 ; mm2=(20 30 21 31) + punpckhwd mm7,mm5 ; mm7=(22 32 23 33) + + movq mm0,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm2 ; mm1=(00 10 20 30) + punpckhdq mm0,mm2 ; mm0=(01 11 21 31) + movq mm3,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm7 ; mm6=(02 12 22 32) + punpckhdq mm3,mm7 ; mm3=(03 13 23 33) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + +.nextcolumn: + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + + ; -- Odd part + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + + movq mm4,mm0 + movq mm5,mm0 + punpcklwd mm4,mm1 + punpckhwd mm5,mm1 + movq mm0,mm4 + movq mm1,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) + pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) + pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) + pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) + + movq mm6,mm2 + movq mm7,mm2 + punpcklwd mm6,mm3 + punpckhwd mm7,mm3 + movq mm2,mm6 + movq mm3,mm7 + pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) + pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) + pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) + pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) + + paddd mm6,mm4 ; mm6=tmp2L + paddd mm7,mm5 ; mm7=tmp2H + paddd mm2,mm0 ; mm2=tmp0L + paddd mm3,mm1 ; mm3=tmp0H + + movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L + movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H + + ; -- Even part + + movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + + pxor mm1,mm1 + pxor mm2,mm2 + punpcklwd mm1,mm4 ; mm1=tmp0L + punpckhwd mm2,mm4 ; mm2=tmp0H + psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 + psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 + + movq mm3,mm5 ; mm5=in2=z2 + punpcklwd mm5,mm0 ; mm0=in6=z3 + punpckhwd mm3,mm0 + pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H + + movq mm4,mm1 + movq mm0,mm2 + paddd mm1,mm5 ; mm1=tmp10L + paddd mm2,mm3 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp12L + psubd mm0,mm3 ; mm0=tmp12H + + ; -- Final output stage + + movq mm5,mm1 + movq mm3,mm2 + paddd mm1,mm6 ; mm1=data0L + paddd mm2,mm7 ; mm2=data0H + psubd mm5,mm6 ; mm5=data3L + psubd mm3,mm7 ; mm3=data3H + + movq mm6,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm6=[PD_DESCALE_P2_4] + + paddd mm1,mm6 + paddd mm2,mm6 + psrad mm1,DESCALE_P2_4 + psrad mm2,DESCALE_P2_4 + paddd mm5,mm6 + paddd mm3,mm6 + psrad mm5,DESCALE_P2_4 + psrad mm3,DESCALE_P2_4 + + packssdw mm1,mm2 ; mm1=data0=(00 10 20 30) + packssdw mm5,mm3 ; mm5=data3=(03 13 23 33) + + movq mm7, MMWORD [wk(0)] ; mm7=tmp0L + movq mm6, MMWORD [wk(1)] ; mm6=tmp0H + + movq mm2,mm4 + movq mm3,mm0 + paddd mm4,mm7 ; mm4=data1L + paddd mm0,mm6 ; mm0=data1H + psubd mm2,mm7 ; mm2=data2L + psubd mm3,mm6 ; mm3=data2H + + movq mm7,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm7=[PD_DESCALE_P2_4] + + paddd mm4,mm7 + paddd mm0,mm7 + psrad mm4,DESCALE_P2_4 + psrad mm0,DESCALE_P2_4 + paddd mm2,mm7 + paddd mm3,mm7 + psrad mm2,DESCALE_P2_4 + psrad mm3,DESCALE_P2_4 + + packssdw mm4,mm0 ; mm4=data1=(01 11 21 31) + packssdw mm2,mm3 ; mm2=data2=(02 12 22 32) + + movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] + + packsswb mm1,mm2 ; mm1=(00 10 20 30 02 12 22 32) + packsswb mm4,mm5 ; mm4=(01 11 21 31 03 13 23 33) + paddb mm1,mm6 + paddb mm4,mm6 + + movq mm7,mm1 ; transpose coefficients(phase 1) + punpcklbw mm1,mm4 ; mm1=(00 01 10 11 20 21 30 31) + punpckhbw mm7,mm4 ; mm7=(02 03 12 13 22 23 32 33) + + movq mm0,mm1 ; transpose coefficients(phase 2) + punpcklwd mm1,mm7 ; mm1=(00 01 02 03 10 11 12 13) + punpckhwd mm0,mm7 ; mm0=(20 21 22 23 30 31 32 33) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 + movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 + + psrlq mm1,4*BYTE_BIT + psrlq mm0,4*BYTE_BIT + + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 + movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + + +; -------------------------------------------------------------------------- +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 2x2 output block. +; +; GLOBAL(void) +; jsimd_idct_2x2_mmx (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + + align 16 + global EXTN(jsimd_idct_2x2_mmx) + +EXTN(jsimd_idct_2x2_mmx): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input. + + mov edx, POINTER [dct_table(ebp)] ; quantptr + mov esi, JCOEFPTR [coef_block(ebp)] ; inptr + + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | + + ; -- Odd part + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; mm0=(10 11 ** 13), mm1=(30 31 ** 33) + ; mm2=(50 51 ** 53), mm3=(70 71 ** 73) + + pcmpeqd mm7,mm7 + pslld mm7,WORD_BIT ; mm7={0x0000 0xFFFF 0x0000 0xFFFF} + + movq mm4,mm0 ; mm4=(10 11 ** 13) + movq mm5,mm2 ; mm5=(50 51 ** 53) + punpcklwd mm4,mm1 ; mm4=(10 30 11 31) + punpcklwd mm5,mm3 ; mm5=(50 70 51 71) + pmaddwd mm4,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] + + psrld mm0,WORD_BIT ; mm0=(11 -- 13 --) + pand mm1,mm7 ; mm1=(-- 31 -- 33) + psrld mm2,WORD_BIT ; mm2=(51 -- 53 --) + pand mm3,mm7 ; mm3=(-- 71 -- 73) + por mm0,mm1 ; mm0=(11 31 13 33) + por mm2,mm3 ; mm2=(51 71 53 73) + pmaddwd mm0,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm2,[GOTOFF(ebx,PW_F085_MF072)] + + paddd mm4,mm5 ; mm4=tmp0[col0 col1] + + movq mm6, MMWORD [MMBLOCK(1,1,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,1,esi,SIZEOF_JCOEF)] + pmullw mm6, MMWORD [MMBLOCK(1,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm3, MMWORD [MMBLOCK(5,1,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(7,1,esi,SIZEOF_JCOEF)] + pmullw mm3, MMWORD [MMBLOCK(5,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(7,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; mm6=(** 15 ** 17), mm1=(** 35 ** 37) + ; mm3=(** 55 ** 57), mm5=(** 75 ** 77) + + psrld mm6,WORD_BIT ; mm6=(15 -- 17 --) + pand mm1,mm7 ; mm1=(-- 35 -- 37) + psrld mm3,WORD_BIT ; mm3=(55 -- 57 --) + pand mm5,mm7 ; mm5=(-- 75 -- 77) + por mm6,mm1 ; mm6=(15 35 17 37) + por mm3,mm5 ; mm3=(55 75 57 77) + pmaddwd mm6,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm3,[GOTOFF(ebx,PW_F085_MF072)] + + paddd mm0,mm2 ; mm0=tmp0[col1 col3] + paddd mm6,mm3 ; mm6=tmp0[col5 col7] + + ; -- Even part + + movq mm1, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(0,1,esi,SIZEOF_JCOEF)] + pmullw mm1, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(0,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; mm1=(00 01 ** 03), mm5=(** 05 ** 07) + + movq mm2,mm1 ; mm2=(00 01 ** 03) + pslld mm1,WORD_BIT ; mm1=(-- 00 -- **) + psrad mm1,(WORD_BIT-CONST_BITS-2) ; mm1=tmp10[col0 ****] + + pand mm2,mm7 ; mm2=(-- 01 -- 03) + pand mm5,mm7 ; mm5=(-- 05 -- 07) + psrad mm2,(WORD_BIT-CONST_BITS-2) ; mm2=tmp10[col1 col3] + psrad mm5,(WORD_BIT-CONST_BITS-2) ; mm5=tmp10[col5 col7] + + ; -- Final output stage + + movq mm3,mm1 + paddd mm1,mm4 ; mm1=data0[col0 ****]=(A0 **) + psubd mm3,mm4 ; mm3=data1[col0 ****]=(B0 **) + punpckldq mm1,mm3 ; mm1=(A0 B0) + + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; mm7=[PD_DESCALE_P1_2] + + movq mm4,mm2 + movq mm3,mm5 + paddd mm2,mm0 ; mm2=data0[col1 col3]=(A1 A3) + paddd mm5,mm6 ; mm5=data0[col5 col7]=(A5 A7) + psubd mm4,mm0 ; mm4=data1[col1 col3]=(B1 B3) + psubd mm3,mm6 ; mm3=data1[col5 col7]=(B5 B7) + + paddd mm1,mm7 + psrad mm1,DESCALE_P1_2 + + paddd mm2,mm7 + paddd mm5,mm7 + psrad mm2,DESCALE_P1_2 + psrad mm5,DESCALE_P1_2 + paddd mm4,mm7 + paddd mm3,mm7 + psrad mm4,DESCALE_P1_2 + psrad mm3,DESCALE_P1_2 + + ; ---- Pass 2: process rows, store into output array. + + mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(ebp)] + + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | + + ; -- Odd part + + packssdw mm2,mm4 ; mm2=(A1 A3 B1 B3) + packssdw mm5,mm3 ; mm5=(A5 A7 B5 B7) + pmaddwd mm2,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] + + paddd mm2,mm5 ; mm2=tmp0[row0 row1] + + ; -- Even part + + pslld mm1,(CONST_BITS+2) ; mm1=tmp10[row0 row1] + + ; -- Final output stage + + movq mm0,[GOTOFF(ebx,PD_DESCALE_P2_2)] ; mm0=[PD_DESCALE_P2_2] + + movq mm6,mm1 + paddd mm1,mm2 ; mm1=data0[row0 row1]=(C0 C1) + psubd mm6,mm2 ; mm6=data1[row0 row1]=(D0 D1) + + paddd mm1,mm0 + paddd mm6,mm0 + psrad mm1,DESCALE_P2_2 + psrad mm6,DESCALE_P2_2 + + movq mm7,mm1 ; transpose coefficients + punpckldq mm1,mm6 ; mm1=(C0 D0) + punpckhdq mm7,mm6 ; mm7=(C1 D1) + + packssdw mm1,mm7 ; mm1=(C0 D0 C1 D1) + packsswb mm1,mm1 ; mm1=(C0 D0 C1 D1 C0 D0 C1 D1) + paddb mm1,[GOTOFF(ebx,PB_CENTERJSAMP)] + + movd ecx,mm1 + movd ebx,mm1 ; ebx=(C0 D0 C1 D1) + shr ecx,2*BYTE_BIT ; ecx=(C1 D1 -- --) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov WORD [edx+eax*SIZEOF_JSAMPLE], bx + mov WORD [esi+eax*SIZEOF_JSAMPLE], cx + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jsimd.h b/simd/jsimd.h index 09ec46dc..be48b84d 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -11,13 +11,108 @@ /* Bitmask for supported acceleration methods */ #define JSIMD_NONE 0x00 +#define JSIMD_MMX 0x01 /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_simd_cpu_support jSiCpuSupport +#define jpeg_simd_cpu_support jSiCpuSupport +#define jsimd_rgb_ycc_convert_mmx jSRGBYCCM +#define jsimd_ycc_rgb_convert_mmx jSYCCRGBM +#define jsimd_h2v2_downsample_mmx jSDnH2V2M +#define jsimd_h2v1_downsample_mmx jSDnH2V1M +#define jsimd_h2v2_upsample_mmx jSUpH2V2M +#define jsimd_h2v1_upsample_mmx jSUpH2V1M +#define jsimd_h2v2_fancy_upsample_mmx jSFUpH2V2M +#define jsimd_h2v1_fancy_upsample_mmx jSFUpH2V1M +#define jsimd_h2v2_merged_upsample_mmx jSMUpH2V2M +#define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M +#define jsimd_convsamp_mmx jSConvM +#define jsimd_fdct_islow_mmx jSFDMIS +#define jsimd_fdct_ifast_mmx jSFDMIF +#define jsimd_quantize_mmx jSQuantM +#define jsimd_idct_2x2_mmx jSIDM22 +#define jsimd_idct_4x4_mmx jSIDM44 +#define jsimd_idct_islow_mmx jSIDMIS +#define jsimd_idct_ifast_mmx jSIDMIF #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* SIMD Ext: retrieve SIMD/CPU information */ EXTERN(unsigned int) jpeg_simd_cpu_support JPP((void)); +/* SIMD Color Space Conversion */ +EXTERN(void) jsimd_rgb_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_ycc_rgb_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); + +/* SIMD Downsample */ +EXTERN(void) jsimd_h2v2_downsample_mmx + JPP((JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data)); +EXTERN(void) jsimd_h2v1_downsample_mmx + JPP((JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data)); + +/* SIMD Upsample */ +EXTERN(void) jsimd_h2v2_upsample_mmx + JPP((int max_v_samp_factor, JDIMENSION output_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_upsample_mmx + JPP((int max_v_samp_factor, JDIMENSION output_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +EXTERN(void) jsimd_h2v2_fancy_upsample_mmx + JPP((int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_fancy_upsample_mmx + JPP((int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); + +/* SIMD Sample Conversion */ +EXTERN(void) jsimd_convsamp_mmx JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + DCTELEM * workspace)); + +/* SIMD Forward DCT */ +EXTERN(void) jsimd_fdct_islow_mmx JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_ifast_mmx JPP((DCTELEM * data)); + +/* SIMD Quantization */ +EXTERN(void) jsimd_quantize_mmx JPP((JCOEFPTR coef_block, + DCTELEM * divisors, + DCTELEM * workspace)); + +/* SIMD Reduced Inverse DCT */ +EXTERN(void) jsimd_idct_2x2_mmx JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_4x4_mmx JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + +/* SIMD Inverse DCT */ +EXTERN(void) jsimd_idct_islow_mmx JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_ifast_mmx JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index bc2ff9f6..8fcbe471 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -1,5 +1,8 @@ // This file generates the include file for the assembly // implementations by abusing the C preprocessor. +// +// Note: Some things are manually defined as they need to +// be mapped to NASM types. ; ; Automatically generated include file from jsimdcfg.inc.h @@ -15,15 +18,101 @@ #define define(var) %define _cpp_protection_##var #define definev(var) %define _cpp_protection_##var var +; +; -- jpeglib.h +; + +definev(DCTSIZE) +definev(DCTSIZE2) + +; +; -- jmorecfg.h +; + +definev(RGB_RED) +definev(RGB_GREEN) +definev(RGB_BLUE) + +definev(RGB_PIXELSIZE) + +; Representation of a single sample (pixel element value). +; On this SIMD implementation, this must be 'unsigned char'. +; + +%define JSAMPLE byte ; unsigned char +%define SIZEOF_JSAMPLE SIZEOF_BYTE ; sizeof(JSAMPLE) + +definev(CENTERJSAMPLE) + +; Representation of a DCT frequency coefficient. +; On this SIMD implementation, this must be 'short'. +; +%define JCOEF word ; short +%define SIZEOF_JCOEF SIZEOF_WORD ; sizeof(JCOEF) + +; Datatype used for image dimensions. +; On this SIMD implementation, this must be 'unsigned int'. +; +%define JDIMENSION dword ; unsigned int +%define SIZEOF_JDIMENSION SIZEOF_DWORD ; sizeof(JDIMENSION) + +%define JSAMPROW POINTER ; JSAMPLE FAR * (jpeglib.h) +%define JSAMPARRAY POINTER ; JSAMPROW * (jpeglib.h) +%define JSAMPIMAGE POINTER ; JSAMPARRAY * (jpeglib.h) +%define JCOEFPTR POINTER ; JCOEF FAR * (jpeglib.h) +%define SIZEOF_JSAMPROW SIZEOF_POINTER ; sizeof(JSAMPROW) +%define SIZEOF_JSAMPARRAY SIZEOF_POINTER ; sizeof(JSAMPARRAY) +%define SIZEOF_JSAMPIMAGE SIZEOF_POINTER ; sizeof(JSAMPIMAGE) +%define SIZEOF_JCOEFPTR SIZEOF_POINTER ; sizeof(JCOEFPTR) + +; +; -- jdct.h +; + +; A forward DCT routine is given a pointer to a work area of type DCTELEM[]; +; the DCT is to be performed in-place in that buffer. +; To maximize parallelism, Type DCTELEM is changed to short (originally, int). +; +%define DCTELEM word ; short +%define SIZEOF_DCTELEM SIZEOF_WORD ; sizeof(DCTELEM) + +; To maximize parallelism, Type MULTIPLIER is changed to short. +; +%define ISLOW_MULT_TYPE word ; must be short +%define SIZEOF_ISLOW_MULT_TYPE SIZEOF_WORD ; sizeof(ISLOW_MULT_TYPE) + +%define IFAST_MULT_TYPE word ; must be short +%define SIZEOF_IFAST_MULT_TYPE SIZEOF_WORD ; sizeof(IFAST_MULT_TYPE) +%define IFAST_SCALE_BITS 2 ; fractional bits in scale factors + ; ; -- jsimd.h ; definev(JSIMD_NONE) +definev(JSIMD_MMX) ; Short forms of external names for systems with brain-damaged linkers. ; #ifdef NEED_SHORT_EXTERNAL_NAMES definev(jpeg_simd_cpu_support) +definev(jsimd_rgb_ycc_convert_mmx) +definev(jsimd_ycc_rgb_convert_mmx) +definev(jsimd_h2v2_downsample_mmx) +definev(jsimd_h2v1_downsample_mmx) +definev(jsimd_h2v2_upsample_mmx) +definev(jsimd_h2v1_upsample_mmx) +definev(jsimd_h2v1_fancy_upsample_mmx) +definev(jsimd_h2v2_fancy_upsample_mmx) +definev(jsimd_h2v1_merged_upsample_mmx) +definev(jsimd_h2v2_merged_upsample_mmx) +definev(jsimd_convsamp_mmx) +definev(jsimd_fdct_islow_mmx) +definev(jsimd_fdct_ifast_mmx) +definev(jsimd_quantize_mmx) +definev(jsimd_idct_2x2_mmx) +definev(jsimd_idct_4x4_mmx) +definev(jsimd_idct_islow_mmx) +definev(jsimd_idct_ifast_mmx) #endif /* NEED_SHORT_EXTERNAL_NAMES */ diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index 6bb4e325..862de298 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -51,6 +51,22 @@ EXTN(jpeg_simd_cpu_support): xor eax,edx jz short .return ; CPUID is not supported + ; Check for MMX instruction support + xor eax,eax + cpuid + test eax,eax + jz short .return + + xor eax,eax + inc eax + cpuid + mov eax,edx ; eax = Standard feature flags + + test eax, 1<<23 ; bit23:MMX + jz short .no_mmx + or edi, byte JSIMD_MMX +.no_mmx: + .return: mov eax,edi diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index c0bd54cc..08e3a04b 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -107,6 +107,24 @@ %define SIZEOF_POINTER SIZEOF_DWORD ; sizeof(POINTER) %define POINTER_BIT DWORD_BIT ; sizeof(POINTER)*BYTE_BIT +%define INT dword ; signed integer type +%define SIZEOF_INT SIZEOF_DWORD ; sizeof(INT) +%define INT_BIT DWORD_BIT ; sizeof(INT)*BYTE_BIT + +%define MMWORD qword ; int64 (MMX register) +%define SIZEOF_MMWORD SIZEOF_QWORD ; sizeof(MMWORD) +%define MMWORD_BIT QWORD_BIT ; sizeof(MMWORD)*BYTE_BIT + +%define SIZEOF_BYTE 1 ; sizeof(BYTE) +%define SIZEOF_WORD 2 ; sizeof(WORD) +%define SIZEOF_DWORD 4 ; sizeof(DWORD) +%define SIZEOF_QWORD 8 ; sizeof(QWORD) + +%define BYTE_BIT 8 ; CHAR_BIT in C +%define WORD_BIT 16 ; sizeof(WORD)*BYTE_BIT +%define DWORD_BIT 32 ; sizeof(DWORD)*BYTE_BIT +%define QWORD_BIT 64 ; sizeof(QWORD)*BYTE_BIT + ; -------------------------------------------------------------------------- ; External Symbol Name ; From 9a4a8bb7219749403fd8d69ce1a04f87c689e8af Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:28:10 +0000 Subject: [PATCH 017/985] Add 3DNow SIMD implementation of computationally intensive routines. --- Makefile.am | 3 +- jsimd.c | 66 +++++++ simd/jcqnt3dn.asm | 230 +++++++++++++++++++++++ simd/jf3dnflt.asm | 317 +++++++++++++++++++++++++++++++ simd/ji3dnflt.asm | 449 ++++++++++++++++++++++++++++++++++++++++++++ simd/jsimd.h | 20 ++ simd/jsimdcfg.inc.h | 11 ++ simd/jsimdcpu.asm | 15 ++ simd/jsimdext.inc | 4 + 9 files changed, 1114 insertions(+), 1 deletion(-) create mode 100644 simd/jcqnt3dn.asm create mode 100644 simd/jf3dnflt.asm create mode 100644 simd/ji3dnflt.asm diff --git a/Makefile.am b/Makefile.am index cc4d5c7f..9df41600 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,8 @@ libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ simd/jccolmmx.asm simd/jdcolmmx.asm \ simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ - simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm + simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ + simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm endif diff --git a/jsimd.c b/jsimd.c index eb1f37bd..d8acba5a 100644 --- a/jsimd.c +++ b/jsimd.c @@ -364,6 +364,19 @@ jsimd_can_convsamp_float (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (simd_support & JSIMD_3DNOW) + return 1; + return 0; } @@ -381,6 +394,10 @@ GLOBAL(void) jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_3DNOW) + jsimd_convsamp_float_3dnow(sample_data, start_col, workspace); +#endif } GLOBAL(int) @@ -422,6 +439,15 @@ jsimd_can_fdct_float (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (simd_support & JSIMD_3DNOW) + return 1; + return 0; } @@ -446,6 +472,10 @@ jsimd_fdct_ifast (DCTELEM * data) GLOBAL(void) jsimd_fdct_float (FAST_FLOAT * data) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_3DNOW) + jsimd_fdct_float_3dnow(data); +#endif } GLOBAL(int) @@ -472,6 +502,17 @@ jsimd_can_quantize_float (void) { init_simd(); + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (simd_support & JSIMD_3DNOW) + return 1; + return 0; } @@ -489,6 +530,10 @@ GLOBAL(void) jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { +#ifdef WITH_SIMD + if (simd_support & JSIMD_3DNOW) + jsimd_quantize_float_3dnow(coef_block, divisors, workspace); +#endif } GLOBAL(int) @@ -612,6 +657,22 @@ jsimd_can_idct_float (void) { init_simd(); + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + if (sizeof(FLOAT_MULT_TYPE) != 4) + return 0; + + if (simd_support & JSIMD_3DNOW) + return 1; + return 0; } @@ -642,5 +703,10 @@ jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { +#if WITH_SIMD + if (simd_support & JSIMD_3DNOW) + jsimd_idct_float_3dnow(compptr->dct_table, coef_block, + output_buf, output_col); +#endif } diff --git a/simd/jcqnt3dn.asm b/simd/jcqnt3dn.asm new file mode 100644 index 00000000..bc9b0273 --- /dev/null +++ b/simd/jcqnt3dn.asm @@ -0,0 +1,230 @@ +; +; jcqnt3dn.asm - sample data conversion and quantization (3DNow! & MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_float_3dnow (JSAMPARRAY sample_data, JDIMENSION start_col, +; FAST_FLOAT * workspace); +; + +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_convsamp_float_3dnow) + +EXTN(jsimd_convsamp_float_3dnow): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + pcmpeqw mm7,mm7 + psllw mm7,7 + packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) + + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 +.convloop: + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] + + psubb mm0,mm7 ; mm0=(01234567) + psubb mm1,mm7 ; mm1=(89ABCDEF) + + punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) + punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) + punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) + punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) + + punpcklwd mm4,mm2 ; mm4=(***0***1) + punpckhwd mm2,mm2 ; mm2=(***2***3) + punpcklwd mm5,mm0 ; mm5=(***4***5) + punpckhwd mm0,mm0 ; mm0=(***6***7) + + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) + psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) + pi2fd mm4,mm4 + pi2fd mm2,mm2 + psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) + psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) + pi2fd mm5,mm5 + pi2fd mm0,mm0 + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + + punpcklwd mm6,mm3 ; mm6=(***8***9) + punpckhwd mm3,mm3 ; mm3=(***A***B) + punpcklwd mm4,mm1 ; mm4=(***C***D) + punpckhwd mm1,mm1 ; mm1=(***E***F) + + psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) + psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) + pi2fd mm6,mm6 + pi2fd mm3,mm3 + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) + psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) + pi2fd mm4,mm4 + pi2fd mm1,mm1 + + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm3 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 + + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .convloop + + femms ; empty MMX/3DNow! state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; GLOBAL(void) +; jsimd_quantize_float_3dnow (JCOEFPTR coef_block, FAST_FLOAT * divisors, +; FAST_FLOAT * workspace); +; + +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_quantize_float_3dnow) + +EXTN(jsimd_quantize_float_3dnow): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + mov eax, 0x4B400000 ; (float)0x00C00000 (rndint_magic) + movd mm7,eax + punpckldq mm7,mm7 ; mm7={12582912.0F 12582912.0F} + + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 +.quantloop: + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + pfmul mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,2,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(0,3,esi,SIZEOF_FAST_FLOAT)] + pfmul mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] + pfmul mm3, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] + + pfadd mm0,mm7 ; mm0=(00 ** 01 **) + pfadd mm1,mm7 ; mm1=(02 ** 03 **) + pfadd mm2,mm7 ; mm0=(04 ** 05 **) + pfadd mm3,mm7 ; mm1=(06 ** 07 **) + + movq mm4,mm0 + punpcklwd mm0,mm1 ; mm0=(00 02 ** **) + punpckhwd mm4,mm1 ; mm4=(01 03 ** **) + movq mm5,mm2 + punpcklwd mm2,mm3 ; mm2=(04 06 ** **) + punpckhwd mm5,mm3 ; mm5=(05 07 ** **) + + punpcklwd mm0,mm4 ; mm0=(00 01 02 03) + punpcklwd mm2,mm5 ; mm2=(04 05 06 07) + + movq mm6, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + pfmul mm6, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + pfmul mm1, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,2,esi,SIZEOF_FAST_FLOAT)] + movq mm4, MMWORD [MMBLOCK(1,3,esi,SIZEOF_FAST_FLOAT)] + pfmul mm3, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] + pfmul mm4, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] + + pfadd mm6,mm7 ; mm0=(10 ** 11 **) + pfadd mm1,mm7 ; mm4=(12 ** 13 **) + pfadd mm3,mm7 ; mm0=(14 ** 15 **) + pfadd mm4,mm7 ; mm4=(16 ** 17 **) + + movq mm5,mm6 + punpcklwd mm6,mm1 ; mm6=(10 12 ** **) + punpckhwd mm5,mm1 ; mm5=(11 13 ** **) + movq mm1,mm3 + punpcklwd mm3,mm4 ; mm3=(14 16 ** **) + punpckhwd mm1,mm4 ; mm1=(15 17 ** **) + + punpcklwd mm6,mm5 ; mm6=(10 11 12 13) + punpcklwd mm3,mm1 ; mm3=(14 15 16 17) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 + + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz near .quantloop + + femms ; empty MMX/3DNow! state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jf3dnflt.asm b/simd/jf3dnflt.asm new file mode 100644 index 00000000..30d33403 --- /dev/null +++ b/simd/jf3dnflt.asm @@ -0,0 +1,317 @@ +; +; jf3dnflt.asm - floating-point FDCT (3DNow!) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the forward DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jfdctflt.c; see the jfdctflt.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_float_3dnow) + +EXTN(jconst_fdct_float_3dnow): + +PD_0_382 times 2 dd 0.382683432365089771728460 +PD_0_707 times 2 dd 0.707106781186547524400844 +PD_0_541 times 2 dd 0.541196100146196984399723 +PD_1_306 times 2 dd 1.306562964876376527856643 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_float_3dnow (FAST_FLOAT * data) +; + +%define data(b) (b)+8 ; FAST_FLOAT * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_float_3dnow) + +EXTN(jsimd_fdct_float_3dnow): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/2 + alignx 16,7 +.rowloop: + + movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] + + ; mm0=(00 01), mm1=(10 11), mm2=(06 07), mm3=(16 17) + + movq mm4,mm0 ; transpose coefficients + punpckldq mm0,mm1 ; mm0=(00 10)=data0 + punpckhdq mm4,mm1 ; mm4=(01 11)=data1 + movq mm5,mm2 ; transpose coefficients + punpckldq mm2,mm3 ; mm2=(06 16)=data6 + punpckhdq mm5,mm3 ; mm5=(07 17)=data7 + + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm2 ; mm4=data1-data6=tmp6 + pfsub mm0,mm5 ; mm0=data0-data7=tmp7 + pfadd mm6,mm2 ; mm6=data1+data6=tmp1 + pfadd mm7,mm5 ; mm7=data0+data7=tmp0 + + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] + + ; mm1=(02 03), mm3=(12 13), mm2=(04 05), mm5=(14 15) + + movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 + + movq mm4,mm1 ; transpose coefficients + punpckldq mm1,mm3 ; mm1=(02 12)=data2 + punpckhdq mm4,mm3 ; mm4=(03 13)=data3 + movq mm0,mm2 ; transpose coefficients + punpckldq mm2,mm5 ; mm2=(04 14)=data4 + punpckhdq mm0,mm5 ; mm0=(05 15)=data5 + + movq mm3,mm4 + movq mm5,mm1 + pfadd mm4,mm2 ; mm4=data3+data4=tmp3 + pfadd mm1,mm0 ; mm1=data2+data5=tmp2 + pfsub mm3,mm2 ; mm3=data3-data4=tmp4 + pfsub mm5,mm0 ; mm5=data2-data5=tmp5 + + ; -- Even part + + movq mm2,mm7 + movq mm0,mm6 + pfsub mm7,mm4 ; mm7=tmp13 + pfsub mm6,mm1 ; mm6=tmp12 + pfadd mm2,mm4 ; mm2=tmp10 + pfadd mm0,mm1 ; mm0=tmp11 + + pfadd mm6,mm7 + pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 + + movq mm4,mm2 + movq mm1,mm7 + pfsub mm2,mm0 ; mm2=data4 + pfsub mm7,mm6 ; mm7=data6 + pfadd mm4,mm0 ; mm4=data0 + pfadd mm1,mm6 ; mm1=data2 + + movq MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], mm1 + + ; -- Odd part + + movq mm0, MMWORD [wk(0)] ; mm0=tmp6 + movq mm6, MMWORD [wk(1)] ; mm6=tmp7 + + pfadd mm3,mm5 ; mm3=tmp10 + pfadd mm5,mm0 ; mm5=tmp11 + pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 + + pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 + + movq mm2,mm3 ; mm2=tmp10 + pfsub mm3,mm0 + pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 + pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) + pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) + pfadd mm2,mm3 ; mm2=z2 + pfadd mm0,mm3 ; mm0=z4 + + movq mm7,mm6 + pfsub mm6,mm5 ; mm6=z13 + pfadd mm7,mm5 ; mm7=z11 + + movq mm4,mm6 + movq mm1,mm7 + pfsub mm6,mm2 ; mm6=data3 + pfsub mm7,mm0 ; mm7=data7 + pfadd mm4,mm2 ; mm4=data5 + pfadd mm1,mm0 ; mm1=data1 + + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 + + add edx, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/2 + alignx 16,7 +.columnloop: + + movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] + + ; mm0=(00 10), mm1=(01 11), mm2=(60 70), mm3=(61 71) + + movq mm4,mm0 ; transpose coefficients + punpckldq mm0,mm1 ; mm0=(00 01)=data0 + punpckhdq mm4,mm1 ; mm4=(10 11)=data1 + movq mm5,mm2 ; transpose coefficients + punpckldq mm2,mm3 ; mm2=(60 61)=data6 + punpckhdq mm5,mm3 ; mm5=(70 71)=data7 + + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm2 ; mm4=data1-data6=tmp6 + pfsub mm0,mm5 ; mm0=data0-data7=tmp7 + pfadd mm6,mm2 ; mm6=data1+data6=tmp1 + pfadd mm7,mm5 ; mm7=data0+data7=tmp0 + + movq mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] + + ; mm1=(20 30), mm3=(21 31), mm2=(40 50), mm5=(41 51) + + movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 + + movq mm4,mm1 ; transpose coefficients + punpckldq mm1,mm3 ; mm1=(20 21)=data2 + punpckhdq mm4,mm3 ; mm4=(30 31)=data3 + movq mm0,mm2 ; transpose coefficients + punpckldq mm2,mm5 ; mm2=(40 41)=data4 + punpckhdq mm0,mm5 ; mm0=(50 51)=data5 + + movq mm3,mm4 + movq mm5,mm1 + pfadd mm4,mm2 ; mm4=data3+data4=tmp3 + pfadd mm1,mm0 ; mm1=data2+data5=tmp2 + pfsub mm3,mm2 ; mm3=data3-data4=tmp4 + pfsub mm5,mm0 ; mm5=data2-data5=tmp5 + + ; -- Even part + + movq mm2,mm7 + movq mm0,mm6 + pfsub mm7,mm4 ; mm7=tmp13 + pfsub mm6,mm1 ; mm6=tmp12 + pfadd mm2,mm4 ; mm2=tmp10 + pfadd mm0,mm1 ; mm0=tmp11 + + pfadd mm6,mm7 + pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 + + movq mm4,mm2 + movq mm1,mm7 + pfsub mm2,mm0 ; mm2=data4 + pfsub mm7,mm6 ; mm7=data6 + pfadd mm4,mm0 ; mm4=data0 + pfadd mm1,mm6 ; mm1=data2 + + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], mm1 + + ; -- Odd part + + movq mm0, MMWORD [wk(0)] ; mm0=tmp6 + movq mm6, MMWORD [wk(1)] ; mm6=tmp7 + + pfadd mm3,mm5 ; mm3=tmp10 + pfadd mm5,mm0 ; mm5=tmp11 + pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 + + pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 + + movq mm2,mm3 ; mm2=tmp10 + pfsub mm3,mm0 + pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 + pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) + pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) + pfadd mm2,mm3 ; mm2=z2 + pfadd mm0,mm3 ; mm0=z4 + + movq mm7,mm6 + pfsub mm6,mm5 ; mm6=z13 + pfadd mm7,mm5 ; mm7=z11 + + movq mm4,mm6 + movq mm1,mm7 + pfsub mm6,mm2 ; mm6=data3 + pfsub mm7,mm0 ; mm7=data7 + pfadd mm4,mm2 ; mm4=data5 + pfadd mm1,mm0 ; mm1=data1 + + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 + + add edx, byte 2*SIZEOF_FAST_FLOAT + dec ecx + jnz near .columnloop + + femms ; empty MMX/3DNow! state + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/ji3dnflt.asm b/simd/ji3dnflt.asm new file mode 100644 index 00000000..0f5cbd81 --- /dev/null +++ b/simd/ji3dnflt.asm @@ -0,0 +1,449 @@ +; +; ji3dnflt.asm - floating-point IDCT (3DNow! & MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the inverse DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jidctflt.c; see the jidctflt.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_float_3dnow) + +EXTN(jconst_idct_float_3dnow): + +PD_1_414 times 2 dd 1.414213562373095048801689 +PD_1_847 times 2 dd 1.847759065022573512256366 +PD_1_082 times 2 dd 1.082392200292393968799446 +PD_2_613 times 2 dd 2.613125929752753055713286 +PD_RNDINT_MAGIC times 2 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_float_3dnow (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_float_3dnow) + +EXTN(jsimd_idct_float_3dnow): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/2 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_FLOAT_3DNOW + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT + + pushpic ebx ; save GOT address + mov ebx, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] + mov eax, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] + or ebx, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] + or ebx, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] + or eax,ebx + poppic ebx ; restore GOT address + jnz short .columnDCT + + ; -- AC terms all zero + + movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] + + punpcklwd mm0,mm0 + psrad mm0,(DWORD_BIT-WORD_BIT) + pi2fd mm0,mm0 + + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movq mm1,mm0 + punpckldq mm0,mm0 + punpckhdq mm1,mm1 + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] + movd mm1, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + movd mm2, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] + movd mm3, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] + + punpcklwd mm0,mm0 + punpcklwd mm1,mm1 + psrad mm0,(DWORD_BIT-WORD_BIT) + psrad mm1,(DWORD_BIT-WORD_BIT) + pi2fd mm0,mm0 + pi2fd mm1,mm1 + + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + punpcklwd mm2,mm2 + punpcklwd mm3,mm3 + psrad mm2,(DWORD_BIT-WORD_BIT) + psrad mm3,(DWORD_BIT-WORD_BIT) + pi2fd mm2,mm2 + pi2fd mm3,mm3 + + pfmul mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movq mm4,mm0 + movq mm5,mm1 + pfsub mm0,mm2 ; mm0=tmp11 + pfsub mm1,mm3 + pfadd mm4,mm2 ; mm4=tmp10 + pfadd mm5,mm3 ; mm5=tmp13 + + pfmul mm1,[GOTOFF(ebx,PD_1_414)] + pfsub mm1,mm5 ; mm1=tmp12 + + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm5 ; mm4=tmp3 + pfsub mm0,mm1 ; mm0=tmp2 + pfadd mm6,mm5 ; mm6=tmp0 + pfadd mm7,mm1 ; mm7=tmp1 + + movq MMWORD [wk(1)], mm4 ; tmp3 + movq MMWORD [wk(0)], mm0 ; tmp2 + + ; -- Odd part + + movd mm2, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + movd mm3, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] + movd mm5, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] + movd mm1, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] + + punpcklwd mm2,mm2 + punpcklwd mm3,mm3 + psrad mm2,(DWORD_BIT-WORD_BIT) + psrad mm3,(DWORD_BIT-WORD_BIT) + pi2fd mm2,mm2 + pi2fd mm3,mm3 + + pfmul mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + punpcklwd mm5,mm5 + punpcklwd mm1,mm1 + psrad mm5,(DWORD_BIT-WORD_BIT) + psrad mm1,(DWORD_BIT-WORD_BIT) + pi2fd mm5,mm5 + pi2fd mm1,mm1 + + pfmul mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movq mm4,mm2 + movq mm0,mm5 + pfadd mm2,mm1 ; mm2=z11 + pfadd mm5,mm3 ; mm5=z13 + pfsub mm4,mm1 ; mm4=z12 + pfsub mm0,mm3 ; mm0=z10 + + movq mm1,mm2 + pfsub mm2,mm5 + pfadd mm1,mm5 ; mm1=tmp7 + + pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 + + movq mm3,mm0 + pfadd mm0,mm4 + pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 + pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) + pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) + pfsubr mm3,mm0 ; mm3=tmp12 + pfsub mm4,mm0 ; mm4=tmp10 + + ; -- Final output stage + + pfsub mm3,mm1 ; mm3=tmp6 + movq mm5,mm6 + movq mm0,mm7 + pfadd mm6,mm1 ; mm6=data0=(00 01) + pfadd mm7,mm3 ; mm7=data1=(10 11) + pfsub mm5,mm1 ; mm5=data7=(70 71) + pfsub mm0,mm3 ; mm0=data6=(60 61) + pfsub mm2,mm3 ; mm2=tmp5 + + movq mm1,mm6 ; transpose coefficients + punpckldq mm6,mm7 ; mm6=(00 10) + punpckhdq mm1,mm7 ; mm1=(01 11) + movq mm3,mm0 ; transpose coefficients + punpckldq mm0,mm5 ; mm0=(60 70) + punpckhdq mm3,mm5 ; mm3=(61 71) + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm3 + + movq mm7, MMWORD [wk(0)] ; mm7=tmp2 + movq mm5, MMWORD [wk(1)] ; mm5=tmp3 + + pfadd mm4,mm2 ; mm4=tmp4 + movq mm6,mm7 + movq mm1,mm5 + pfadd mm7,mm2 ; mm7=data2=(20 21) + pfadd mm5,mm4 ; mm5=data4=(40 41) + pfsub mm6,mm2 ; mm6=data5=(50 51) + pfsub mm1,mm4 ; mm1=data3=(30 31) + + movq mm0,mm7 ; transpose coefficients + punpckldq mm7,mm1 ; mm7=(20 30) + punpckhdq mm0,mm1 ; mm0=(21 31) + movq mm3,mm5 ; transpose coefficients + punpckldq mm5,mm6 ; mm5=(40 50) + punpckhdq mm3,mm6 ; mm3=(41 51) + + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm3 + +.nextcolumn: + add esi, byte 2*SIZEOF_JCOEF ; coef_block + add edx, byte 2*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; -- Prefetch the next coefficient block + + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/2 ; ctr + alignx 16,7 +.rowloop: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + + movq mm4,mm0 + movq mm5,mm1 + pfsub mm0,mm2 ; mm0=tmp11 + pfsub mm1,mm3 + pfadd mm4,mm2 ; mm4=tmp10 + pfadd mm5,mm3 ; mm5=tmp13 + + pfmul mm1,[GOTOFF(ebx,PD_1_414)] + pfsub mm1,mm5 ; mm1=tmp12 + + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm5 ; mm4=tmp3 + pfsub mm0,mm1 ; mm0=tmp2 + pfadd mm6,mm5 ; mm6=tmp0 + pfadd mm7,mm1 ; mm7=tmp1 + + movq MMWORD [wk(1)], mm4 ; tmp3 + movq MMWORD [wk(0)], mm0 ; tmp2 + + ; -- Odd part + + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + + movq mm4,mm2 + movq mm0,mm5 + pfadd mm2,mm1 ; mm2=z11 + pfadd mm5,mm3 ; mm5=z13 + pfsub mm4,mm1 ; mm4=z12 + pfsub mm0,mm3 ; mm0=z10 + + movq mm1,mm2 + pfsub mm2,mm5 + pfadd mm1,mm5 ; mm1=tmp7 + + pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 + + movq mm3,mm0 + pfadd mm0,mm4 + pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 + pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) + pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) + pfsubr mm3,mm0 ; mm3=tmp12 + pfsub mm4,mm0 ; mm4=tmp10 + + ; -- Final output stage + + pfsub mm3,mm1 ; mm3=tmp6 + movq mm5,mm6 + movq mm0,mm7 + pfadd mm6,mm1 ; mm6=data0=(00 10) + pfadd mm7,mm3 ; mm7=data1=(01 11) + pfsub mm5,mm1 ; mm5=data7=(07 17) + pfsub mm0,mm3 ; mm0=data6=(06 16) + pfsub mm2,mm3 ; mm2=tmp5 + + movq mm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm1=[PD_RNDINT_MAGIC] + pcmpeqd mm3,mm3 + psrld mm3,WORD_BIT ; mm3={0xFFFF 0x0000 0xFFFF 0x0000} + + pfadd mm6,mm1 ; mm6=roundint(data0/8)=(00 ** 10 **) + pfadd mm7,mm1 ; mm7=roundint(data1/8)=(01 ** 11 **) + pfadd mm0,mm1 ; mm0=roundint(data6/8)=(06 ** 16 **) + pfadd mm5,mm1 ; mm5=roundint(data7/8)=(07 ** 17 **) + + pand mm6,mm3 ; mm6=(00 -- 10 --) + pslld mm7,WORD_BIT ; mm7=(-- 01 -- 11) + pand mm0,mm3 ; mm0=(06 -- 16 --) + pslld mm5,WORD_BIT ; mm5=(-- 07 -- 17) + por mm6,mm7 ; mm6=(00 01 10 11) + por mm0,mm5 ; mm0=(06 07 16 17) + + movq mm1, MMWORD [wk(0)] ; mm1=tmp2 + movq mm3, MMWORD [wk(1)] ; mm3=tmp3 + + pfadd mm4,mm2 ; mm4=tmp4 + movq mm7,mm1 + movq mm5,mm3 + pfadd mm1,mm2 ; mm1=data2=(02 12) + pfadd mm3,mm4 ; mm3=data4=(04 14) + pfsub mm7,mm2 ; mm7=data5=(05 15) + pfsub mm5,mm4 ; mm5=data3=(03 13) + + movq mm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm2=[PD_RNDINT_MAGIC] + pcmpeqd mm4,mm4 + psrld mm4,WORD_BIT ; mm4={0xFFFF 0x0000 0xFFFF 0x0000} + + pfadd mm3,mm2 ; mm3=roundint(data4/8)=(04 ** 14 **) + pfadd mm7,mm2 ; mm7=roundint(data5/8)=(05 ** 15 **) + pfadd mm1,mm2 ; mm1=roundint(data2/8)=(02 ** 12 **) + pfadd mm5,mm2 ; mm5=roundint(data3/8)=(03 ** 13 **) + + pand mm3,mm4 ; mm3=(04 -- 14 --) + pslld mm7,WORD_BIT ; mm7=(-- 05 -- 15) + pand mm1,mm4 ; mm1=(02 -- 12 --) + pslld mm5,WORD_BIT ; mm5=(-- 03 -- 13) + por mm3,mm7 ; mm3=(04 05 14 15) + por mm1,mm5 ; mm1=(02 03 12 13) + + movq mm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm2=[PB_CENTERJSAMP] + + packsswb mm6,mm3 ; mm6=(00 01 10 11 04 05 14 15) + packsswb mm1,mm0 ; mm1=(02 03 12 13 06 07 16 17) + paddb mm6,mm2 + paddb mm1,mm2 + + movq mm4,mm6 ; transpose coefficients(phase 2) + punpcklwd mm6,mm1 ; mm6=(00 01 02 03 10 11 12 13) + punpckhwd mm4,mm1 ; mm4=(04 05 06 07 14 15 16 17) + + movq mm7,mm6 ; transpose coefficients(phase 3) + punpckldq mm6,mm4 ; mm6=(00 01 02 03 04 05 06 07) + punpckhdq mm7,mm4 ; mm7=(10 11 12 13 14 15 16 17) + + pushpic ebx ; save GOT address + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 + + poppic ebx ; restore GOT address + + add esi, byte 2*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 2*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop + + femms ; empty MMX/3DNow! state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jsimd.h b/simd/jsimd.h index be48b84d..8e78eabc 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -12,6 +12,7 @@ #define JSIMD_NONE 0x00 #define JSIMD_MMX 0x01 +#define JSIMD_3DNOW 0x02 /* Short forms of external names for systems with brain-damaged linkers. */ @@ -28,13 +29,17 @@ #define jsimd_h2v2_merged_upsample_mmx jSMUpH2V2M #define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M #define jsimd_convsamp_mmx jSConvM +#define jsimd_convsamp_float_3dnow jSConvF3D #define jsimd_fdct_islow_mmx jSFDMIS #define jsimd_fdct_ifast_mmx jSFDMIF +#define jsimd_fdct_float_3dnow jSFD3DF #define jsimd_quantize_mmx jSQuantM +#define jsimd_quantize_float_3dnow jSQuantF3D #define jsimd_idct_2x2_mmx jSIDM22 #define jsimd_idct_4x4_mmx jSIDM44 #define jsimd_idct_islow_mmx jSIDMIS #define jsimd_idct_ifast_mmx jSIDMIF +#define jsimd_idct_float_3dnow jSID3DF #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* SIMD Ext: retrieve SIMD/CPU information */ @@ -87,15 +92,25 @@ EXTERN(void) jsimd_convsamp_mmx JPP((JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT * workspace)); + /* SIMD Forward DCT */ EXTERN(void) jsimd_fdct_islow_mmx JPP((DCTELEM * data)); EXTERN(void) jsimd_fdct_ifast_mmx JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data)); + /* SIMD Quantization */ EXTERN(void) jsimd_quantize_mmx JPP((JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block, + FAST_FLOAT * divisors, + FAST_FLOAT * workspace)); + /* SIMD Reduced Inverse DCT */ EXTERN(void) jsimd_idct_2x2_mmx JPP((void * dct_table, JCOEFPTR coef_block, @@ -116,3 +131,8 @@ EXTERN(void) jsimd_idct_ifast_mmx JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jsimd_idct_float_3dnow JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index 8fcbe471..e1f2bdd1 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -76,6 +76,9 @@ definev(CENTERJSAMPLE) %define DCTELEM word ; short %define SIZEOF_DCTELEM SIZEOF_WORD ; sizeof(DCTELEM) +%define FAST_FLOAT FP32 ; float +%define SIZEOF_FAST_FLOAT SIZEOF_FP32 ; sizeof(FAST_FLOAT) + ; To maximize parallelism, Type MULTIPLIER is changed to short. ; %define ISLOW_MULT_TYPE word ; must be short @@ -85,12 +88,16 @@ definev(CENTERJSAMPLE) %define SIZEOF_IFAST_MULT_TYPE SIZEOF_WORD ; sizeof(IFAST_MULT_TYPE) %define IFAST_SCALE_BITS 2 ; fractional bits in scale factors +%define FLOAT_MULT_TYPE FP32 ; must be float +%define SIZEOF_FLOAT_MULT_TYPE SIZEOF_FP32 ; sizeof(FLOAT_MULT_TYPE) + ; ; -- jsimd.h ; definev(JSIMD_NONE) definev(JSIMD_MMX) +definev(JSIMD_3DNOW) ; Short forms of external names for systems with brain-damaged linkers. ; @@ -107,12 +114,16 @@ definev(jsimd_h2v2_fancy_upsample_mmx) definev(jsimd_h2v1_merged_upsample_mmx) definev(jsimd_h2v2_merged_upsample_mmx) definev(jsimd_convsamp_mmx) +definev(jsimd_convsamp_float_3dnow) definev(jsimd_fdct_islow_mmx) definev(jsimd_fdct_ifast_mmx) +definev(jsimd_fdct_float_3dnow) definev(jsimd_quantize_mmx) +definev(jsimd_quantize_float_3dnow) definev(jsimd_idct_2x2_mmx) definev(jsimd_idct_4x4_mmx) definev(jsimd_idct_islow_mmx) definev(jsimd_idct_ifast_mmx) +definev(jsimd_idct_float_3dnow) #endif /* NEED_SHORT_EXTERNAL_NAMES */ diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index 862de298..b65699e6 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -67,6 +67,21 @@ EXTN(jpeg_simd_cpu_support): or edi, byte JSIMD_MMX .no_mmx: + ; Check for 3DNow! instruction support + mov eax, 0x80000000 + cpuid + cmp eax, 0x80000000 + jbe short .return + + mov eax, 0x80000001 + cpuid + mov eax,edx ; eax = Extended feature flags + + test eax, 1<<31 ; bit31:3DNow!(vendor independent) + jz short .no_3dnow + or edi, byte JSIMD_3DNOW +.no_3dnow: + .return: mov eax,edi diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 08e3a04b..509e95d1 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -111,6 +111,10 @@ %define SIZEOF_INT SIZEOF_DWORD ; sizeof(INT) %define INT_BIT DWORD_BIT ; sizeof(INT)*BYTE_BIT +%define FP32 dword ; IEEE754 single +%define SIZEOF_FP32 SIZEOF_DWORD ; sizeof(FP32) +%define FP32_BIT DWORD_BIT ; sizeof(FP32)*BYTE_BIT + %define MMWORD qword ; int64 (MMX register) %define SIZEOF_MMWORD SIZEOF_QWORD ; sizeof(MMWORD) %define MMWORD_BIT QWORD_BIT ; sizeof(MMWORD)*BYTE_BIT From c7de3b4d83ea75dfaf95bf2cd2af56b01a894176 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:29:37 +0000 Subject: [PATCH 018/985] Make sure the work space memory is properly aligned We use the heap allocators to avoid having more than one implementation of the alignment logic. --- jcdctmgr.c | 23 +++++++++++++++++++++-- jdcoefct.c | 13 ++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/jcdctmgr.c b/jcdctmgr.c index 539ccc41..ba835448 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -53,12 +53,16 @@ typedef struct { */ DCTELEM * divisors[NUM_QUANT_TBLS]; + /* work area for FDCT subroutine */ + DCTELEM * workspace; + #ifdef DCT_FLOAT_SUPPORTED /* Same as above for the floating-point case. */ float_DCT_method_ptr float_dct; float_convsamp_method_ptr float_convsamp; float_quantize_method_ptr float_quantize; FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; + FAST_FLOAT * float_workspace; #endif } my_fdct_controller; @@ -403,10 +407,11 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, /* This routine is heavily used, so it's worth coding it tightly. */ my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; - DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ + DCTELEM * workspace; JDIMENSION bi; /* Make sure the compiler doesn't look up these every pass */ + workspace = fdct->workspace; forward_DCT_method_ptr do_dct = fdct->dct; convsamp_method_ptr do_convsamp = fdct->convsamp; quantize_method_ptr do_quantize = fdct->quantize; @@ -492,10 +497,12 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, /* This routine is heavily used, so it's worth coding it tightly. */ my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; - FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ + FAST_FLOAT * workspace; JDIMENSION bi; + /* Make sure the compiler doesn't look up these every pass */ + workspace = fdct->float_workspace; float_DCT_method_ptr do_dct = fdct->float_dct; float_convsamp_method_ptr do_convsamp = fdct->float_convsamp; float_quantize_method_ptr do_quantize = fdct->float_quantize; @@ -603,6 +610,18 @@ jinit_forward_dct (j_compress_ptr cinfo) break; } + /* Allocate workspace memory */ +#ifdef DCT_FLOAT_SUPPORTED + if (cinfo->dct_method == JDCT_FLOAT) + fdct->float_workspace = (FAST_FLOAT *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(FAST_FLOAT) * DCTSIZE2); + else +#endif + fdct->workspace = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(DCTELEM) * DCTSIZE2); + /* Mark divisor tables unallocated */ for (i = 0; i < NUM_QUANT_TBLS; i++) { fdct->divisors[i] = NULL; diff --git a/jdcoefct.c b/jdcoefct.c index 4938d20f..f56af5fc 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -47,6 +47,9 @@ typedef struct { */ JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; + /* Temporary workspace for one MCU */ + JCOEF * workspace; + #ifdef D_MULTISCAN_FILES_SUPPORTED /* In multi-pass modes, we need a virtual block array for each component. */ jvirt_barray_ptr whole_image[MAX_COMPONENTS]; @@ -471,13 +474,16 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) jpeg_component_info *compptr; inverse_DCT_method_ptr inverse_DCT; boolean first_row, last_row; - JBLOCK workspace; + JCOEF * workspace; int *coef_bits; JQUANT_TBL *quanttbl; INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; int Al, pred; + /* Keep a local variable to avoid looking it up more than once */ + workspace = coef->workspace; + /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number <= cinfo->output_scan_number && ! cinfo->inputctl->eoi_reached) { @@ -733,4 +739,9 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) coef->pub.decompress_data = decompress_onepass; coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ } + + /* Allocate the workspace buffer */ + coef->workspace = (JCOEF *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(JCOEF) * DCTSIZE2); } From a5cccc9dbfda2f990bd0abe468c8f063d7d12020 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:30:47 +0000 Subject: [PATCH 019/985] Most SIMD implementations need 16 byte alignment --- jmemmgr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jmemmgr.c b/jmemmgr.c index 5b335673..058a1157 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -70,7 +70,11 @@ extern char * getenv JPP((const char * name)); */ #ifndef ALIGN_SIZE /* so can override from jconfig.h */ +#ifndef WITH_SIMD #define ALIGN_SIZE SIZEOF(double) +#else +#define ALIGN_SIZE 16 /* Most SIMD implementations require this */ +#endif #endif /* From 205cdc87d4f6b13e7f9ef1a80a2f746437eb6bc2 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:31:56 +0000 Subject: [PATCH 020/985] Add SSE SIMD implementation of computationally intensive routines. --- Makefile.am | 3 +- jsimd.c | 37 ++- simd/jcqntsse.asm | 208 ++++++++++++++++ simd/jdct.inc | 1 + simd/jfsseflt.asm | 367 ++++++++++++++++++++++++++++ simd/jisseflt.asm | 569 ++++++++++++++++++++++++++++++++++++++++++++ simd/jsimd.h | 24 ++ simd/jsimdcfg.inc.h | 7 + simd/jsimdcpu.asm | 4 + simd/jsimdext.inc | 8 + 10 files changed, 1223 insertions(+), 5 deletions(-) create mode 100644 simd/jcqntsse.asm create mode 100644 simd/jfsseflt.asm create mode 100644 simd/jisseflt.asm diff --git a/Makefile.am b/Makefile.am index 9df41600..655e2074 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,8 @@ libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ - simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm + simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ + simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm endif diff --git a/jsimd.c b/jsimd.c index d8acba5a..6c60b5b0 100644 --- a/jsimd.c +++ b/jsimd.c @@ -18,6 +18,18 @@ #include "jsimddct.h" #include "simd/jsimd.h" +/* + * In the PIC cases, we have no guarantee that constants will keep + * their alignment. This macro allows us to verify it at runtime. + */ +#ifdef WITH_SIMD +#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0) +#else +#define IS_ALIGNED(ptr, order) (0) +#endif + +#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ + static unsigned int simd_support = ~0; /* @@ -374,6 +386,8 @@ jsimd_can_convsamp_float (void) if (sizeof(FAST_FLOAT) != 4) return 0; + if (simd_support & JSIMD_SSE) + return 1; if (simd_support & JSIMD_3DNOW) return 1; @@ -395,7 +409,9 @@ jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_3DNOW) + if (simd_support & JSIMD_SSE) + jsimd_convsamp_float_sse(sample_data, start_col, workspace); + else if (simd_support & JSIMD_3DNOW) jsimd_convsamp_float_3dnow(sample_data, start_col, workspace); #endif } @@ -445,6 +461,8 @@ jsimd_can_fdct_float (void) if (sizeof(FAST_FLOAT) != 4) return 0; + if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) + return 1; if (simd_support & JSIMD_3DNOW) return 1; @@ -473,7 +491,9 @@ GLOBAL(void) jsimd_fdct_float (FAST_FLOAT * data) { #ifdef WITH_SIMD - if (simd_support & JSIMD_3DNOW) + if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) + jsimd_fdct_float_sse(data); + else if (simd_support & JSIMD_3DNOW) jsimd_fdct_float_3dnow(data); #endif } @@ -510,6 +530,8 @@ jsimd_can_quantize_float (void) if (sizeof(FAST_FLOAT) != 4) return 0; + if (simd_support & JSIMD_SSE) + return 1; if (simd_support & JSIMD_3DNOW) return 1; @@ -531,7 +553,9 @@ jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_3DNOW) + if (simd_support & JSIMD_SSE) + jsimd_quantize_float_sse(coef_block, divisors, workspace); + else if (simd_support & JSIMD_3DNOW) jsimd_quantize_float_3dnow(coef_block, divisors, workspace); #endif } @@ -670,6 +694,8 @@ jsimd_can_idct_float (void) if (sizeof(FLOAT_MULT_TYPE) != 4) return 0; + if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) + return 1; if (simd_support & JSIMD_3DNOW) return 1; @@ -704,7 +730,10 @@ jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if (simd_support & JSIMD_3DNOW) + if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) + jsimd_idct_float_sse(compptr->dct_table, coef_block, + output_buf, output_col); + else if (simd_support & JSIMD_3DNOW) jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf, output_col); #endif diff --git a/simd/jcqntsse.asm b/simd/jcqntsse.asm new file mode 100644 index 00000000..da7a3ff6 --- /dev/null +++ b/simd/jcqntsse.asm @@ -0,0 +1,208 @@ +; +; jcqntsse.asm - sample data conversion and quantization (SSE & MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_float_sse (JSAMPARRAY sample_data, JDIMENSION start_col, +; FAST_FLOAT * workspace); +; + +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_convsamp_float_sse) + +EXTN(jsimd_convsamp_float_sse): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + pcmpeqw mm7,mm7 + psllw mm7,7 + packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) + + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 +.convloop: + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] + + psubb mm0,mm7 ; mm0=(01234567) + psubb mm1,mm7 ; mm1=(89ABCDEF) + + punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) + punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) + punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) + punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) + + punpcklwd mm4,mm2 ; mm4=(***0***1) + punpckhwd mm2,mm2 ; mm2=(***2***3) + punpcklwd mm5,mm0 ; mm5=(***4***5) + punpckhwd mm0,mm0 ; mm0=(***6***7) + + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) + psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) + cvtpi2ps xmm0,mm4 ; xmm0=(01**) + cvtpi2ps xmm1,mm2 ; xmm1=(23**) + psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) + psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) + cvtpi2ps xmm2,mm5 ; xmm2=(45**) + cvtpi2ps xmm3,mm0 ; xmm3=(67**) + + punpcklwd mm6,mm3 ; mm6=(***8***9) + punpckhwd mm3,mm3 ; mm3=(***A***B) + punpcklwd mm4,mm1 ; mm4=(***C***D) + punpckhwd mm1,mm1 ; mm1=(***E***F) + + psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) + psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) + cvtpi2ps xmm4,mm6 ; xmm4=(89**) + cvtpi2ps xmm5,mm3 ; xmm5=(AB**) + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) + psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) + cvtpi2ps xmm6,mm4 ; xmm6=(CD**) + cvtpi2ps xmm7,mm1 ; xmm7=(EF**) + + movlhps xmm0,xmm1 ; xmm0=(0123) + movlhps xmm2,xmm3 ; xmm2=(4567) + movlhps xmm4,xmm5 ; xmm4=(89AB) + movlhps xmm6,xmm7 ; xmm6=(CDEF) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .convloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; GLOBAL(void) +; jsimd_quantize_float_sse (JCOEFPTR coef_block, FAST_FLOAT * divisors, +; FAST_FLOAT * workspace); +; + +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_quantize_float_sse) + +EXTN(jsimd_quantize_float_sse): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 +.quantloop: + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + + movhlps xmm4,xmm0 + movhlps xmm5,xmm1 + + cvtps2pi mm0,xmm0 + cvtps2pi mm1,xmm1 + cvtps2pi mm4,xmm4 + cvtps2pi mm5,xmm5 + + movhlps xmm6,xmm2 + movhlps xmm7,xmm3 + + cvtps2pi mm2,xmm2 + cvtps2pi mm3,xmm3 + cvtps2pi mm6,xmm6 + cvtps2pi mm7,xmm7 + + packssdw mm0,mm4 + packssdw mm1,mm5 + packssdw mm2,mm6 + packssdw mm3,mm7 + + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 + + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz short .quantloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jdct.inc b/simd/jdct.inc index e53f66e6..cc627042 100644 --- a/simd/jdct.inc +++ b/simd/jdct.inc @@ -23,5 +23,6 @@ %define DWBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_DWORD) %define MMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_MMWORD) +%define XMMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_XMMWORD) ; -------------------------------------------------------------------------- diff --git a/simd/jfsseflt.asm b/simd/jfsseflt.asm new file mode 100644 index 00000000..6469f3c4 --- /dev/null +++ b/simd/jfsseflt.asm @@ -0,0 +1,367 @@ +; +; jfsseflt.asm - floating-point FDCT (SSE) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the forward DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jfdctflt.c; see the jfdctflt.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 +%endmacro + +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_float_sse) + +EXTN(jconst_fdct_float_sse): + +PD_0_382 times 4 dd 0.382683432365089771728460 +PD_0_707 times 4 dd 0.707106781186547524400844 +PD_0_541 times 4 dd 0.541196100146196984399723 +PD_1_306 times 4 dd 1.306562964876376527856643 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_float_sse (FAST_FLOAT * data) +; + +%define data(b) (b)+8 ; FAST_FLOAT * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_float_sse) + +EXTN(jsimd_fdct_float_sse): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.rowloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)] + + ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) + ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) + + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) + unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) + unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) + + movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + + ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) + ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) + + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) + unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) + + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 + + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 + + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 + + addps xmm0,xmm5 + mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 + + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 + + movaps XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + + mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 + + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 + mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 + + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 + + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 + + movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + + add edx, 4*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.columnloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] + + ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) + ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) + + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) + unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) + unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) + + movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] + + ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) + ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) + + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) + unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) + unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) + + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 + + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 + + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 + + addps xmm0,xmm5 + mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 + + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 + + movaps XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + + mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 + + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 + mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 + + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 + + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 + + movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + + add edx, byte 4*SIZEOF_FAST_FLOAT + dec ecx + jnz near .columnloop + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jisseflt.asm b/simd/jisseflt.asm new file mode 100644 index 00000000..6de93ada --- /dev/null +++ b/simd/jisseflt.asm @@ -0,0 +1,569 @@ +; +; jisseflt.asm - floating-point IDCT (SSE & MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the inverse DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jidctflt.c; see the jidctflt.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 +%endmacro + +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_float_sse) + +EXTN(jconst_idct_float_sse): + +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_0_125 times 4 dd 0.125 ; 1/8 +PB_CENTERJSAMP times 8 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_float_sse (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_float_sse) + +EXTN(jsimd_idct_float_sse): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + + punpckhwd mm1,mm0 ; mm1=(** 02 ** 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in0H=(02 03) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) + cvtpi2ps xmm3,mm1 ; xmm3=(02 03 ** **) + cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) + movlhps xmm0,xmm3 ; xmm0=in0=(00 01 02 03) + + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 + + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + + punpckhwd mm4,mm0 ; mm4=(** 02 ** 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm5,mm1 ; mm5=(** 22 ** 23) + punpcklwd mm1,mm1 ; mm1=(20 20 21 21) + + psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in0H=(02 03) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) + cvtpi2ps xmm4,mm4 ; xmm4=(02 03 ** **) + cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) + psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in2H=(22 23) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in2L=(20 21) + cvtpi2ps xmm5,mm5 ; xmm5=(22 23 ** **) + cvtpi2ps xmm1,mm1 ; xmm1=(20 21 ** **) + + punpckhwd mm6,mm2 ; mm6=(** 42 ** 43) + punpcklwd mm2,mm2 ; mm2=(40 40 41 41) + punpckhwd mm7,mm3 ; mm7=(** 62 ** 63) + punpcklwd mm3,mm3 ; mm3=(60 60 61 61) + + psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in4H=(42 43) + psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in4L=(40 41) + cvtpi2ps xmm6,mm6 ; xmm6=(42 43 ** **) + cvtpi2ps xmm2,mm2 ; xmm2=(40 41 ** **) + psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in6H=(62 63) + psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in6L=(60 61) + cvtpi2ps xmm7,mm7 ; xmm7=(62 63 ** **) + cvtpi2ps xmm3,mm3 ; xmm3=(60 61 ** **) + + movlhps xmm0,xmm4 ; xmm0=in0=(00 01 02 03) + movlhps xmm1,xmm5 ; xmm1=in2=(20 21 22 23) + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movlhps xmm2,xmm6 ; xmm2=in4=(40 41 42 43) + movlhps xmm3,xmm7 ; xmm3=in6=(60 61 62 63) + mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + + punpckhwd mm6,mm4 ; mm6=(** 12 ** 13) + punpcklwd mm4,mm4 ; mm4=(10 10 11 11) + punpckhwd mm2,mm0 ; mm2=(** 32 ** 33) + punpcklwd mm0,mm0 ; mm0=(30 30 31 31) + + psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in1H=(12 13) + psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in1L=(10 11) + cvtpi2ps xmm4,mm6 ; xmm4=(12 13 ** **) + cvtpi2ps xmm2,mm4 ; xmm2=(10 11 ** **) + psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in3H=(32 33) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in3L=(30 31) + cvtpi2ps xmm0,mm2 ; xmm0=(32 33 ** **) + cvtpi2ps xmm3,mm0 ; xmm3=(30 31 ** **) + + punpckhwd mm7,mm5 ; mm7=(** 52 ** 53) + punpcklwd mm5,mm5 ; mm5=(50 50 51 51) + punpckhwd mm3,mm1 ; mm3=(** 72 ** 73) + punpcklwd mm1,mm1 ; mm1=(70 70 71 71) + + movlhps xmm2,xmm4 ; xmm2=in1=(10 11 12 13) + movlhps xmm3,xmm0 ; xmm3=in3=(30 31 32 33) + + psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in5H=(52 53) + psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in5L=(50 51) + cvtpi2ps xmm4,mm7 ; xmm4=(52 53 ** **) + cvtpi2ps xmm5,mm5 ; xmm5=(50 51 ** **) + psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in7H=(72 73) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in7L=(70 71) + cvtpi2ps xmm0,mm3 ; xmm0=(72 73 ** **) + cvtpi2ps xmm1,mm1 ; xmm1=(70 71 ** **) + + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movlhps xmm5,xmm4 ; xmm5=in5=(50 51 52 53) + movlhps xmm1,xmm0 ; xmm1=in7=(70 71 72 73) + mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + +.nextcolumn: + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.rowloop: + + ; -- Even part + + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,[GOTOFF(ebx,PD_0_125)] ; xmm1=[PD_0_125] + + mulps xmm6,xmm1 ; descale(1/8) + mulps xmm7,xmm1 ; descale(1/8) + mulps xmm5,xmm1 ; descale(1/8) + mulps xmm0,xmm1 ; descale(1/8) + + movhlps xmm3,xmm6 + movhlps xmm1,xmm7 + cvtps2pi mm0,xmm6 ; round to int32, mm0=data0L=(00 10) + cvtps2pi mm1,xmm7 ; round to int32, mm1=data1L=(01 11) + cvtps2pi mm2,xmm3 ; round to int32, mm2=data0H=(20 30) + cvtps2pi mm3,xmm1 ; round to int32, mm3=data1H=(21 31) + packssdw mm0,mm2 ; mm0=data0=(00 10 20 30) + packssdw mm1,mm3 ; mm1=data1=(01 11 21 31) + + movhlps xmm6,xmm5 + movhlps xmm7,xmm0 + cvtps2pi mm4,xmm5 ; round to int32, mm4=data7L=(07 17) + cvtps2pi mm5,xmm0 ; round to int32, mm5=data6L=(06 16) + cvtps2pi mm6,xmm6 ; round to int32, mm6=data7H=(27 37) + cvtps2pi mm7,xmm7 ; round to int32, mm7=data6H=(26 36) + packssdw mm4,mm6 ; mm4=data7=(07 17 27 37) + packssdw mm5,mm7 ; mm5=data6=(06 16 26 36) + + packsswb mm0,mm5 ; mm0=(00 10 20 30 06 16 26 36) + packsswb mm1,mm4 ; mm1=(01 11 21 31 07 17 27 37) + + movaps xmm3, XMMWORD [wk(0)] ; xmm3=tmp2 + movaps xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + + movaps xmm6,[GOTOFF(ebx,PD_0_125)] ; xmm6=[PD_0_125] + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm5,xmm3 + movaps xmm0,xmm1 + addps xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + addps xmm1,xmm4 ; xmm1=data4=(04 14 24 34) + subps xmm5,xmm2 ; xmm5=data5=(05 15 25 35) + subps xmm0,xmm4 ; xmm0=data3=(03 13 23 33) + + mulps xmm3,xmm6 ; descale(1/8) + mulps xmm1,xmm6 ; descale(1/8) + mulps xmm5,xmm6 ; descale(1/8) + mulps xmm0,xmm6 ; descale(1/8) + + movhlps xmm7,xmm3 + movhlps xmm2,xmm1 + cvtps2pi mm2,xmm3 ; round to int32, mm2=data2L=(02 12) + cvtps2pi mm3,xmm1 ; round to int32, mm3=data4L=(04 14) + cvtps2pi mm6,xmm7 ; round to int32, mm6=data2H=(22 32) + cvtps2pi mm7,xmm2 ; round to int32, mm7=data4H=(24 34) + packssdw mm2,mm6 ; mm2=data2=(02 12 22 32) + packssdw mm3,mm7 ; mm3=data4=(04 14 24 34) + + movhlps xmm4,xmm5 + movhlps xmm6,xmm0 + cvtps2pi mm5,xmm5 ; round to int32, mm5=data5L=(05 15) + cvtps2pi mm4,xmm0 ; round to int32, mm4=data3L=(03 13) + cvtps2pi mm6,xmm4 ; round to int32, mm6=data5H=(25 35) + cvtps2pi mm7,xmm6 ; round to int32, mm7=data3H=(23 33) + packssdw mm5,mm6 ; mm5=data5=(05 15 25 35) + packssdw mm4,mm7 ; mm4=data3=(03 13 23 33) + + movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] + + packsswb mm2,mm3 ; mm2=(02 12 22 32 04 14 24 34) + packsswb mm4,mm5 ; mm4=(03 13 23 33 05 15 25 35) + + paddb mm0,mm6 + paddb mm1,mm6 + paddb mm2,mm6 + paddb mm4,mm6 + + movq mm7,mm0 ; transpose coefficients(phase 1) + punpcklbw mm0,mm1 ; mm0=(00 01 10 11 20 21 30 31) + punpckhbw mm7,mm1 ; mm7=(06 07 16 17 26 27 36 37) + movq mm3,mm2 ; transpose coefficients(phase 1) + punpcklbw mm2,mm4 ; mm2=(02 03 12 13 22 23 32 33) + punpckhbw mm3,mm4 ; mm3=(04 05 14 15 24 25 34 35) + + movq mm5,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm2 ; mm0=(00 01 02 03 10 11 12 13) + punpckhwd mm5,mm2 ; mm5=(20 21 22 23 30 31 32 33) + movq mm6,mm3 ; transpose coefficients(phase 2) + punpcklwd mm3,mm7 ; mm3=(04 05 06 07 14 15 16 17) + punpckhwd mm6,mm7 ; mm6=(24 25 26 27 34 35 36 37) + + movq mm1,mm0 ; transpose coefficients(phase 3) + punpckldq mm0,mm3 ; mm0=(00 01 02 03 04 05 06 07) + punpckhdq mm1,mm3 ; mm1=(10 11 12 13 14 15 16 17) + movq mm4,mm5 ; transpose coefficients(phase 3) + punpckldq mm5,mm6 ; mm5=(20 21 22 23 24 25 26 27) + punpckhdq mm4,mm6 ; mm4=(30 31 32 33 34 35 36 37) + + pushpic ebx ; save GOT address + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 + + poppic ebx ; restore GOT address + + add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop + + emms ; empty MMX state + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jsimd.h b/simd/jsimd.h index 8e78eabc..98bcebc1 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -13,6 +13,7 @@ #define JSIMD_NONE 0x00 #define JSIMD_MMX 0x01 #define JSIMD_3DNOW 0x02 +#define JSIMD_SSE 0x04 /* Short forms of external names for systems with brain-damaged linkers. */ @@ -30,16 +31,22 @@ #define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M #define jsimd_convsamp_mmx jSConvM #define jsimd_convsamp_float_3dnow jSConvF3D +#define jsimd_convsamp_float_sse jSConvFS #define jsimd_fdct_islow_mmx jSFDMIS #define jsimd_fdct_ifast_mmx jSFDMIF #define jsimd_fdct_float_3dnow jSFD3DF +#define jconst_fdct_float_sse jSCFDSF +#define jsimd_fdct_float_sse jSFDSF #define jsimd_quantize_mmx jSQuantM #define jsimd_quantize_float_3dnow jSQuantF3D +#define jsimd_quantize_float_sse jSQuantFS #define jsimd_idct_2x2_mmx jSIDM22 #define jsimd_idct_4x4_mmx jSIDM44 #define jsimd_idct_islow_mmx jSIDMIS #define jsimd_idct_ifast_mmx jSIDMIF #define jsimd_idct_float_3dnow jSID3DF +#define jconst_fdct_float_sse jSCIDSF +#define jsimd_idct_float_sse jSIDSF #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* SIMD Ext: retrieve SIMD/CPU information */ @@ -96,12 +103,19 @@ EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp_float_sse JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT * workspace)); + /* SIMD Forward DCT */ EXTERN(void) jsimd_fdct_islow_mmx JPP((DCTELEM * data)); EXTERN(void) jsimd_fdct_ifast_mmx JPP((DCTELEM * data)); EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data)); +extern const int jconst_fdct_float_sse[]; +EXTERN(void) jsimd_fdct_float_sse JPP((FAST_FLOAT * data)); + /* SIMD Quantization */ EXTERN(void) jsimd_quantize_mmx JPP((JCOEFPTR coef_block, DCTELEM * divisors, @@ -111,6 +125,10 @@ EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize_float_sse JPP((JCOEFPTR coef_block, + FAST_FLOAT * divisors, + FAST_FLOAT * workspace)); + /* SIMD Reduced Inverse DCT */ EXTERN(void) jsimd_idct_2x2_mmx JPP((void * dct_table, JCOEFPTR coef_block, @@ -136,3 +154,9 @@ EXTERN(void) jsimd_idct_float_3dnow JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +extern const int jconst_idct_float_sse[]; +EXTERN(void) jsimd_idct_float_sse JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index e1f2bdd1..2779565f 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -98,6 +98,7 @@ definev(CENTERJSAMPLE) definev(JSIMD_NONE) definev(JSIMD_MMX) definev(JSIMD_3DNOW) +definev(JSIMD_SSE) ; Short forms of external names for systems with brain-damaged linkers. ; @@ -115,15 +116,21 @@ definev(jsimd_h2v1_merged_upsample_mmx) definev(jsimd_h2v2_merged_upsample_mmx) definev(jsimd_convsamp_mmx) definev(jsimd_convsamp_float_3dnow) +definev(jsimd_convsamp_float_sse) definev(jsimd_fdct_islow_mmx) definev(jsimd_fdct_ifast_mmx) definev(jsimd_fdct_float_3dnow) +definev(jconst_fdct_float_sse) +definev(jsimd_fdct_float_sse) definev(jsimd_quantize_mmx) definev(jsimd_quantize_float_3dnow) +definev(jsimd_quantize_float_sse) definev(jsimd_idct_2x2_mmx) definev(jsimd_idct_4x4_mmx) definev(jsimd_idct_islow_mmx) definev(jsimd_idct_ifast_mmx) definev(jsimd_idct_float_3dnow) +definev(jconst_idct_float_sse) +definev(jsimd_idct_float_sse) #endif /* NEED_SHORT_EXTERNAL_NAMES */ diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index b65699e6..3561b088 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -66,6 +66,10 @@ EXTN(jpeg_simd_cpu_support): jz short .no_mmx or edi, byte JSIMD_MMX .no_mmx: + test eax, 1<<25 ; bit25:SSE + jz short .no_sse + or edi, byte JSIMD_SSE +.no_sse: ; Check for 3DNow! instruction support mov eax, 0x80000000 diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 509e95d1..5fcd7be2 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -119,15 +119,23 @@ %define SIZEOF_MMWORD SIZEOF_QWORD ; sizeof(MMWORD) %define MMWORD_BIT QWORD_BIT ; sizeof(MMWORD)*BYTE_BIT +; NASM is buggy and doesn't properly handle operand sizes for SSE +; instructions, so for now we have to define XMMWORD as blank. +%define XMMWORD ; int128 (SSE register) +%define SIZEOF_XMMWORD SIZEOF_OWORD ; sizeof(XMMWORD) +%define XMMWORD_BIT OWORD_BIT ; sizeof(XMMWORD)*BYTE_BIT + %define SIZEOF_BYTE 1 ; sizeof(BYTE) %define SIZEOF_WORD 2 ; sizeof(WORD) %define SIZEOF_DWORD 4 ; sizeof(DWORD) %define SIZEOF_QWORD 8 ; sizeof(QWORD) +%define SIZEOF_OWORD 16 ; sizeof(OWORD) %define BYTE_BIT 8 ; CHAR_BIT in C %define WORD_BIT 16 ; sizeof(WORD)*BYTE_BIT %define DWORD_BIT 32 ; sizeof(DWORD)*BYTE_BIT %define QWORD_BIT 64 ; sizeof(QWORD)*BYTE_BIT +%define OWORD_BIT 128 ; sizeof(OWORD)*BYTE_BIT ; -------------------------------------------------------------------------- ; External Symbol Name From 093fe3bb51372e7b2b06a35072ac46aa81e8ac3e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Mar 2009 13:34:17 +0000 Subject: [PATCH 021/985] Add SSE2 SIMD implementation of computationally intensive routines. --- Makefile.am | 7 +- jsimd.c | 151 ++++++-- simd/jccolss2.asm | 533 +++++++++++++++++++++++++++ simd/jcolsamp.inc | 32 ++ simd/jcqnts2f.asm | 168 +++++++++ simd/jcqnts2i.asm | 197 ++++++++++ simd/jcsamss2.asm | 348 ++++++++++++++++++ simd/jdcolss2.asm | 531 +++++++++++++++++++++++++++ simd/jdmerss2.asm | 590 ++++++++++++++++++++++++++++++ simd/jdsamss2.asm | 726 +++++++++++++++++++++++++++++++++++++ simd/jfss2fst.asm | 401 +++++++++++++++++++++ simd/jfss2int.asm | 631 ++++++++++++++++++++++++++++++++ simd/jiss2flt.asm | 495 +++++++++++++++++++++++++ simd/jiss2fst.asm | 499 ++++++++++++++++++++++++++ simd/jiss2int.asm | 856 ++++++++++++++++++++++++++++++++++++++++++++ simd/jiss2red.asm | 591 ++++++++++++++++++++++++++++++ simd/jsimd.h | 123 +++++++ simd/jsimdcfg.inc.h | 32 ++ simd/jsimdcpu.asm | 4 + simd/jsimdext.inc | 4 + 20 files changed, 6897 insertions(+), 22 deletions(-) create mode 100644 simd/jccolss2.asm create mode 100644 simd/jcqnts2f.asm create mode 100644 simd/jcqnts2i.asm create mode 100644 simd/jcsamss2.asm create mode 100644 simd/jdcolss2.asm create mode 100644 simd/jdmerss2.asm create mode 100644 simd/jdsamss2.asm create mode 100644 simd/jfss2fst.asm create mode 100644 simd/jfss2int.asm create mode 100644 simd/jiss2flt.asm create mode 100644 simd/jiss2fst.asm create mode 100644 simd/jiss2int.asm create mode 100644 simd/jiss2red.asm diff --git a/Makefile.am b/Makefile.am index 655e2074..7f67542e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,12 @@ libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ - simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm + simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ + simd/jccolss2.asm simd/jdcolss2.asm \ + simd/jcsamss2.asm simd/jdsamss2.asm simd/jdmerss2.asm \ + simd/jcqnts2i.asm simd/jfss2fst.asm simd/jfss2int.asm \ + simd/jiss2red.asm simd/jiss2int.asm simd/jiss2fst.asm \ + simd/jcqnts2f.asm simd/jiss2flt.asm endif diff --git a/jsimd.c b/jsimd.c index 6c60b5b0..32489116 100644 --- a/jsimd.c +++ b/jsimd.c @@ -63,6 +63,9 @@ jsimd_can_rgb_ycc (void) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -82,6 +85,9 @@ jsimd_can_ycc_rgb (void) if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -94,7 +100,11 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) + jsimd_rgb_ycc_convert_sse2(cinfo->image_width, input_buf, + output_buf, output_row, num_rows); + else if (simd_support & JSIMD_MMX) jsimd_rgb_ycc_convert_mmx(cinfo->image_width, input_buf, output_buf, output_row, num_rows); #endif @@ -106,7 +116,11 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPARRAY output_buf, int num_rows) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) + jsimd_ycc_rgb_convert_sse2(cinfo->output_width, input_buf, + input_row, output_buf, num_rows); + else if (simd_support & JSIMD_MMX) jsimd_ycc_rgb_convert_mmx(cinfo->output_width, input_buf, input_row, output_buf, num_rows); #endif @@ -123,6 +137,8 @@ jsimd_can_h2v2_downsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -140,6 +156,8 @@ jsimd_can_h2v1_downsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -151,7 +169,11 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); + else if (simd_support & JSIMD_MMX) jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); @@ -163,7 +185,11 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); + else if (simd_support & JSIMD_MMX) jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); @@ -181,6 +207,8 @@ jsimd_can_h2v2_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -198,6 +226,8 @@ jsimd_can_h2v1_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -211,7 +241,10 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, + cinfo->output_width, input_data, output_data_ptr); + else if (simd_support & JSIMD_MMX) jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); #endif @@ -224,7 +257,10 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, + cinfo->output_width, input_data, output_data_ptr); + else if (simd_support & JSIMD_MMX) jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); #endif @@ -241,6 +277,9 @@ jsimd_can_h2v2_fancy_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -258,6 +297,9 @@ jsimd_can_h2v1_fancy_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -271,7 +313,11 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, output_data_ptr); + else if (simd_support & JSIMD_MMX) jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); #endif @@ -284,7 +330,11 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, input_data, output_data_ptr); + else if (simd_support & JSIMD_MMX) jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); #endif @@ -301,6 +351,9 @@ jsimd_can_h2v2_merged_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -318,6 +371,9 @@ jsimd_can_h2v1_merged_upsample (void) if (sizeof(JDIMENSION) != 4) return 0; + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -331,7 +387,11 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JSAMPARRAY output_buf) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + jsimd_h2v2_merged_upsample_sse2(cinfo->output_width, input_buf, + in_row_group_ctr, output_buf); + else if (simd_support & JSIMD_MMX) jsimd_h2v2_merged_upsample_mmx(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); #endif @@ -344,7 +404,11 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JSAMPARRAY output_buf) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && + IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + jsimd_h2v1_merged_upsample_sse2(cinfo->output_width, input_buf, + in_row_group_ctr, output_buf); + else if (simd_support & JSIMD_MMX) jsimd_h2v1_merged_upsample_mmx(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); #endif @@ -365,6 +429,8 @@ jsimd_can_convsamp (void) if (sizeof(DCTELEM) != 2) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -386,6 +452,8 @@ jsimd_can_convsamp_float (void) if (sizeof(FAST_FLOAT) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_SSE) return 1; if (simd_support & JSIMD_3DNOW) @@ -399,7 +467,9 @@ jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_convsamp_sse2(sample_data, start_col, workspace); + else if (simd_support & JSIMD_MMX) jsimd_convsamp_mmx(sample_data, start_col, workspace); #endif } @@ -409,7 +479,9 @@ jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_SSE) + if (simd_support & JSIMD_SSE2) + jsimd_convsamp_float_sse2(sample_data, start_col, workspace); + else if (simd_support & JSIMD_SSE) jsimd_convsamp_float_sse(sample_data, start_col, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_convsamp_float_3dnow(sample_data, start_col, workspace); @@ -427,6 +499,8 @@ jsimd_can_fdct_islow (void) if (sizeof(DCTELEM) != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -444,6 +518,8 @@ jsimd_can_fdct_ifast (void) if (sizeof(DCTELEM) != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -473,7 +549,9 @@ GLOBAL(void) jsimd_fdct_islow (DCTELEM * data) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) + jsimd_fdct_islow_sse2(data); + else if (simd_support & JSIMD_MMX) jsimd_fdct_islow_mmx(data); #endif } @@ -482,7 +560,9 @@ GLOBAL(void) jsimd_fdct_ifast (DCTELEM * data) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) + jsimd_fdct_ifast_sse2(data); + else if (simd_support & JSIMD_MMX) jsimd_fdct_ifast_mmx(data); #endif } @@ -511,6 +591,8 @@ jsimd_can_quantize (void) if (sizeof(DCTELEM) != 2) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -530,6 +612,8 @@ jsimd_can_quantize_float (void) if (sizeof(FAST_FLOAT) != 4) return 0; + if (simd_support & JSIMD_SSE2) + return 1; if (simd_support & JSIMD_SSE) return 1; if (simd_support & JSIMD_3DNOW) @@ -543,7 +627,9 @@ jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_MMX) + if (simd_support & JSIMD_SSE2) + jsimd_quantize_sse2(coef_block, divisors, workspace); + else if (simd_support & JSIMD_MMX) jsimd_quantize_mmx(coef_block, divisors, workspace); #endif } @@ -553,7 +639,9 @@ jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { #ifdef WITH_SIMD - if (simd_support & JSIMD_SSE) + if (simd_support & JSIMD_SSE2) + jsimd_quantize_float_sse2(coef_block, divisors, workspace); + else if (simd_support & JSIMD_SSE) jsimd_quantize_float_sse(coef_block, divisors, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_quantize_float_3dnow(coef_block, divisors, workspace); @@ -577,6 +665,8 @@ jsimd_can_idct_2x2 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -600,6 +690,8 @@ jsimd_can_idct_4x4 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -612,7 +704,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); + else if (simd_support & JSIMD_MMX) jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); #endif } @@ -623,7 +717,9 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) + jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); + else if (simd_support & JSIMD_MMX) jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); #endif } @@ -645,6 +741,8 @@ jsimd_can_idct_islow (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -670,6 +768,8 @@ jsimd_can_idct_ifast (void) if (IFAST_SCALE_BITS != 2) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) + return 1; if (simd_support & JSIMD_MMX) return 1; @@ -694,6 +794,8 @@ jsimd_can_idct_float (void) if (sizeof(FLOAT_MULT_TYPE) != 4) return 0; + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) + return 1; if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) return 1; if (simd_support & JSIMD_3DNOW) @@ -708,7 +810,9 @@ jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) + jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); + else if (simd_support & JSIMD_MMX) jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); #endif } @@ -719,7 +823,9 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if (simd_support & JSIMD_MMX) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) + jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); + else if (simd_support & JSIMD_MMX) jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); #endif } @@ -730,7 +836,10 @@ jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { #if WITH_SIMD - if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) + jsimd_idct_float_sse2(compptr->dct_table, coef_block, + output_buf, output_col); + else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_3DNOW) diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm new file mode 100644 index 00000000..99473b65 --- /dev/null +++ b/simd/jccolss2.asm @@ -0,0 +1,533 @@ +; +; jccolss2.asm - colorspace conversion (SSE2) +; +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_rgb_ycc_convert_sse2) + +EXTN(jconst_rgb_ycc_convert_sse2): + +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_sse2 (JDIMENSION img_width, +; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, +; JDIMENSION output_row, int num_rows); +; + +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_rgb_ycc_convert_sse2) + +EXTN(jsimd_rgb_ycc_convert_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [img_width(eax)] + test ecx,ecx + jz near .return + + push ecx + + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + alignx 16,7 + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + movzx eax, BYTE [esi+ecx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + movzx edx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx +.column_ld4: + movd xmmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [esi+ecx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub ecx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [esi+ecx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB +.column_ld16: + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + mov ecx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv +.column_ld32: + test cl, 2*SIZEOF_XMMWORD + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + + pxor xmmH,xmmH + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub ecx, byte SIZEOF_XMMWORD/16 + movd xmmA, _DWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub ecx, byte SIZEOF_XMMWORD/8 + movq xmmE, _MMWORD [esi+ecx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE +.column_ld4: + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub ecx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld8: + test cl, SIZEOF_XMMWORD/2 + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + + pxor xmmF,xmmF + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + +%endif ; RGB_PIXELSIZE ; --------------- + + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + movdqa xmm7,xmm1 + movdqa xmm4,xmm6 + pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[GOTOFF(eax,PW_MF016_MF033)] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor xmm1,xmm1 + pxor xmm6,xmm6 + punpcklwd xmm1,xmm5 ; xmm1=BOL + punpckhwd xmm6,xmm5 ; xmm6=BOH + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm6,1 ; xmm6=BOH*FIX(0.500) + + movdqa xmm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm5=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm1 + paddd xmm4,xmm6 + paddd xmm7,xmm5 + paddd xmm4,xmm5 + psrld xmm7,SCALEBITS ; xmm7=CbOL + psrld xmm4,SCALEBITS ; xmm4=CbOH + packssdw xmm7,xmm4 ; xmm7=CbO + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + movdqa xmm5,xmm0 + movdqa xmm4,xmm6 + pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[GOTOFF(eax,PW_MF016_MF033)] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor xmm0,xmm0 + pxor xmm6,xmm6 + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + psrld xmm6,1 ; xmm6=BEH*FIX(0.500) + + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm5,xmm0 + paddd xmm4,xmm6 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrld xmm5,SCALEBITS ; xmm5=CbEL + psrld xmm4,SCALEBITS ; xmm4=CbEH + packssdw xmm5,xmm4 ; xmm5=CbE + + psllw xmm7,BYTE_BIT + por xmm5,xmm7 ; xmm5=Cb + movdqa XMMWORD [ebx], xmm5 ; Save Cb + + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + movdqa xmm7,xmm0 + movdqa xmm5,xmm4 + pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[GOTOFF(eax,PW_MF008_MF041)] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + + movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] + + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO + + pxor xmm3,xmm3 + pxor xmm4,xmm4 + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH + psrld xmm3,1 ; xmm3=ROL*FIX(0.500) + psrld xmm4,1 ; xmm4=ROH*FIX(0.500) + + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm3 + paddd xmm5,xmm4 + paddd xmm7,xmm1 + paddd xmm5,xmm1 + psrld xmm7,SCALEBITS ; xmm7=CrOL + psrld xmm5,SCALEBITS ; xmm5=CrOH + packssdw xmm7,xmm5 ; xmm7=CrO + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[GOTOFF(eax,PW_MF008_MF041)] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + + movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] + + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE + + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [edi], xmm6 ; Save Y + + pxor xmm2,xmm2 + pxor xmm4,xmm4 + punpcklwd xmm2,xmm3 ; xmm2=REL + punpckhwd xmm4,xmm3 ; xmm4=REH + psrld xmm2,1 ; xmm2=REL*FIX(0.500) + psrld xmm4,1 ; xmm4=REH*FIX(0.500) + + movdqa xmm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm0=[PD_ONEHALFM1_CJ] + + paddd xmm1,xmm2 + paddd xmm5,xmm4 + paddd xmm1,xmm0 + paddd xmm5,xmm0 + psrld xmm1,SCALEBITS ; xmm1=CrEL + psrld xmm5,SCALEBITS ; xmm5=CrEH + packssdw xmm1,xmm5 ; xmm1=CrE + + psllw xmm7,BYTE_BIT + por xmm1,xmm7 ; xmm1=Cr + movdqa XMMWORD [edx], xmm1 ; Save Cr + + sub ecx, byte SIZEOF_XMMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add edi, byte SIZEOF_XMMWORD ; outptr0 + add ebx, byte SIZEOF_XMMWORD ; outptr1 + add edx, byte SIZEOF_XMMWORD ; outptr2 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 + + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax + + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jcolsamp.inc b/simd/jcolsamp.inc index 56b6bfd0..79751b7c 100644 --- a/simd/jcolsamp.inc +++ b/simd/jcolsamp.inc @@ -17,57 +17,89 @@ %if RGB_RED == 0 %define mmA mm0 %define mmB mm1 +%define xmmA xmm0 +%define xmmB xmm1 %elif RGB_GREEN == 0 %define mmA mm2 %define mmB mm3 +%define xmmA xmm2 +%define xmmB xmm3 %elif RGB_BLUE == 0 %define mmA mm4 %define mmB mm5 +%define xmmA xmm4 +%define xmmB xmm5 %else %define mmA mm6 %define mmB mm7 +%define xmmA xmm6 +%define xmmB xmm7 %endif %if RGB_RED == 1 %define mmC mm0 %define mmD mm1 +%define xmmC xmm0 +%define xmmD xmm1 %elif RGB_GREEN == 1 %define mmC mm2 %define mmD mm3 +%define xmmC xmm2 +%define xmmD xmm3 %elif RGB_BLUE == 1 %define mmC mm4 %define mmD mm5 +%define xmmC xmm4 +%define xmmD xmm5 %else %define mmC mm6 %define mmD mm7 +%define xmmC xmm6 +%define xmmD xmm7 %endif %if RGB_RED == 2 %define mmE mm0 %define mmF mm1 +%define xmmE xmm0 +%define xmmF xmm1 %elif RGB_GREEN == 2 %define mmE mm2 %define mmF mm3 +%define xmmE xmm2 +%define xmmF xmm3 %elif RGB_BLUE == 2 %define mmE mm4 %define mmF mm5 +%define xmmE xmm4 +%define xmmF xmm5 %else %define mmE mm6 %define mmF mm7 +%define xmmE xmm6 +%define xmmF xmm7 %endif %if RGB_RED == 3 %define mmG mm0 %define mmH mm1 +%define xmmG xmm0 +%define xmmH xmm1 %elif RGB_GREEN == 3 %define mmG mm2 %define mmH mm3 +%define xmmG xmm2 +%define xmmH xmm3 %elif RGB_BLUE == 3 %define mmG mm4 %define mmH mm5 +%define xmmG xmm4 +%define xmmH xmm5 %else %define mmG mm6 %define mmH mm7 +%define xmmG xmm6 +%define xmmH xmm7 %endif ; -------------------------------------------------------------------------- diff --git a/simd/jcqnts2f.asm b/simd/jcqnts2f.asm new file mode 100644 index 00000000..eef547a6 --- /dev/null +++ b/simd/jcqnts2f.asm @@ -0,0 +1,168 @@ +; +; jcqnts2f.asm - sample data conversion and quantization (SSE & SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_float_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col, +; FAST_FLOAT * workspace); +; + +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_convsamp_float_sse2) + +EXTN(jsimd_convsamp_float_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + pcmpeqw xmm7,xmm7 + psllw xmm7,7 + packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) + + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 +.convloop: + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] + + psubb xmm0,xmm7 ; xmm0=(01234567) + psubb xmm1,xmm7 ; xmm1=(89ABCDEF) + + punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) + punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) + + punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) + punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) + punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) + punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) + + psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) + psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) + cvtdq2ps xmm2,xmm2 ; xmm2=(0123) + cvtdq2ps xmm0,xmm0 ; xmm0=(4567) + psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) + psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) + cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) + cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz short .convloop + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; GLOBAL(void) +; jsimd_quantize_float_sse2 (JCOEFPTR coef_block, FAST_FLOAT * divisors, +; FAST_FLOAT * workspace); +; + +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_quantize_float_sse2) + +EXTN(jsimd_quantize_float_sse2): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 +.quantloop: + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + + cvtps2dq xmm0,xmm0 + cvtps2dq xmm1,xmm1 + cvtps2dq xmm2,xmm2 + cvtps2dq xmm3,xmm3 + + packssdw xmm0,xmm1 + packssdw xmm2,xmm3 + + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_JCOEF)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_JCOEF)], xmm2 + + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz short .quantloop + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jcqnts2i.asm b/simd/jcqnts2i.asm new file mode 100644 index 00000000..7414e41a --- /dev/null +++ b/simd/jcqnts2i.asm @@ -0,0 +1,197 @@ +; +; jcqnts2i.asm - sample data conversion and quantization (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col, +; DCTELEM * workspace); +; + +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; DCTELEM * workspace + + align 16 + global EXTN(jsimd_convsamp_sse2) + +EXTN(jsimd_convsamp_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + pxor xmm6,xmm6 ; xmm6=(all 0's) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 +.convloop: + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm0=(01234567) + movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) + + mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm2, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) + movq xmm3, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) + + punpcklbw xmm0,xmm6 ; xmm0=(01234567) + punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) + paddw xmm0,xmm7 + paddw xmm1,xmm7 + punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) + punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) + paddw xmm2,xmm7 + paddw xmm3,xmm7 + + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 + + add esi, byte 4*SIZEOF_JSAMPROW + add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz short .convloop + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; This implementation is based on an algorithm described in +; "How to optimize for the Pentium family of microprocessors" +; (http://www.agner.org/assem/). +; +; GLOBAL(void) +; jsimd_quantize_sse2 (JCOEFPTR coef_block, DCTELEM * divisors, +; DCTELEM * workspace); +; + +%define RECIPROCAL(m,n,b) XMMBLOCK(DCTSIZE*0+(m),(n),(b),SIZEOF_DCTELEM) +%define CORRECTION(m,n,b) XMMBLOCK(DCTSIZE*1+(m),(n),(b),SIZEOF_DCTELEM) +%define SCALE(m,n,b) XMMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) + +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; DCTELEM * divisors +%define workspace ebp+16 ; DCTELEM * workspace + + align 16 + global EXTN(jsimd_quantize_sse2) + +EXTN(jsimd_quantize_sse2): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/32 + alignx 16,7 +.quantloop: + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + psraw xmm4,(WORD_BIT-1) + psraw xmm5,(WORD_BIT-1) + psraw xmm6,(WORD_BIT-1) + psraw xmm7,(WORD_BIT-1) + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; + psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; + psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; + psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; + + paddw xmm0, XMMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor + paddw xmm1, XMMWORD [CORRECTION(1,0,edx)] + paddw xmm2, XMMWORD [CORRECTION(2,0,edx)] + paddw xmm3, XMMWORD [CORRECTION(3,0,edx)] + pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,edx)] ; reciprocal + pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,edx)] + pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,edx)] + pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,edx)] + pmulhuw xmm0, XMMWORD [SCALE(0,0,edx)] ; scale + pmulhuw xmm1, XMMWORD [SCALE(1,0,edx)] + pmulhuw xmm2, XMMWORD [SCALE(2,0,edx)] + pmulhuw xmm3, XMMWORD [SCALE(3,0,edx)] + + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 + psubw xmm1,xmm5 + psubw xmm2,xmm6 + psubw xmm3,xmm7 + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 + + add esi, byte 32*SIZEOF_DCTELEM + add edx, byte 32*SIZEOF_DCTELEM + add edi, byte 32*SIZEOF_JCOEF + dec eax + jnz near .quantloop + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jcsamss2.asm b/simd/jcsamss2.asm new file mode 100644 index 00000000..ec2df9ae --- /dev/null +++ b/simd/jcsamss2.asm @@ -0,0 +1,348 @@ +; +; jcsamss2.asm - downsampling (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Downsample pixel values of a single component. +; This version handles the common case of 2:1 horizontal and 1:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v1_downsample_sse2 (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v1_downsample_sse2) + +EXTN(jsimd_h2v1_downsample_sse2): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return + + mov edx, JDIMENSION [img_width(ebp)] + + ; -- expand_right_edge + + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end + + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end + + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 +.expandloop: + push eax + push ecx + + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] + + rep stosb + + pop ecx + pop eax + + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop + +.expand_end: + pop ecx ; output_cols + + ; -- h2v1_downsample + + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return + + mov edx, 0x00010000 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 +.rowloop: + push ecx + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + alignx 16,7 + +.columnloop_r8: + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + pxor xmm1,xmm1 + mov ecx, SIZEOF_XMMWORD + jmp short .downsample + alignx 16,7 + +.columnloop: + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+1*SIZEOF_XMMWORD] + +.downsample: + movdqa xmm2,xmm0 + movdqa xmm3,xmm1 + + pand xmm0,xmm6 + psrlw xmm2,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm3,BYTE_BIT + + paddw xmm0,xmm2 + paddw xmm1,xmm3 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + psrlw xmm0,1 + psrlw xmm1,1 + + packuswb xmm0,xmm1 + + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + + sub ecx, byte SIZEOF_XMMWORD ; outcol + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add edi, byte 1*SIZEOF_XMMWORD ; outptr + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + test ecx,ecx + jnz short .columnloop_r8 + + pop esi + pop edi + pop ecx + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Downsample pixel values of a single component. +; This version handles the standard case of 2:1 horizontal and 2:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v2_downsample_sse2 (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v2_downsample_sse2) + +EXTN(jsimd_h2v2_downsample_sse2): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return + + mov edx, JDIMENSION [img_width(ebp)] + + ; -- expand_right_edge + + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end + + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end + + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 +.expandloop: + push eax + push ecx + + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] + + rep stosb + + pop ecx + pop eax + + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop + +.expand_end: + pop ecx ; output_cols + + ; -- h2v2_downsample + + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return + + mov edx, 0x00020001 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 +.rowloop: + push ecx + push edi + push esi + + mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 + mov edi, JSAMPROW [edi] ; outptr + + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + alignx 16,7 + +.columnloop_r8: + movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + pxor xmm2,xmm2 + pxor xmm3,xmm3 + mov ecx, SIZEOF_XMMWORD + jmp short .downsample + alignx 16,7 + +.columnloop: + movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [edx+1*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [esi+1*SIZEOF_XMMWORD] + +.downsample: + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + pand xmm0,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm0,xmm4 + paddw xmm1,xmm5 + + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + pand xmm2,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm3,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm2,xmm4 + paddw xmm3,xmm5 + + paddw xmm0,xmm1 + paddw xmm2,xmm3 + paddw xmm0,xmm7 + paddw xmm2,xmm7 + psrlw xmm0,2 + psrlw xmm2,2 + + packuswb xmm0,xmm2 + + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + + sub ecx, byte SIZEOF_XMMWORD ; outcol + add edx, byte 2*SIZEOF_XMMWORD ; inptr0 + add esi, byte 2*SIZEOF_XMMWORD ; inptr1 + add edi, byte 1*SIZEOF_XMMWORD ; outptr + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .columnloop_r8 + + pop esi + pop edi + pop ecx + + add esi, byte 2*SIZEOF_JSAMPROW ; input_data + add edi, byte 1*SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm new file mode 100644 index 00000000..3fd591b5 --- /dev/null +++ b/simd/jdcolss2.asm @@ -0,0 +1,531 @@ +; +; jdcolss2.asm - colorspace conversion (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_ycc_rgb_convert_sse2) + +EXTN(jconst_ycc_rgb_convert_sse2): + +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_ycc_rgb_convert_sse2 (JDIMENSION out_width, +; JSAMPIMAGE input_buf, JDIMENSION input_row, +; JSAMPARRAY output_buf, int num_rows) +; + +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_ycc_rgb_convert_sse2) + +EXTN(jsimd_ycc_rgb_convert_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + push eax + push edi + push edx + push ebx + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 +.columnloop: + + movdqa xmm5, XMMWORD [ebx] ; xmm5=Cb(0123456789ABCDEF) + movdqa xmm1, XMMWORD [edx] ; xmm1=Cr(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + pcmpeqw xmm7,xmm7 + psrlw xmm4,BYTE_BIT + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} + + pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE + psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO + pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE + psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO + + paddw xmm4,xmm7 + paddw xmm5,xmm7 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm2,xmm4 ; xmm2=CbE + movdqa xmm3,xmm5 ; xmm3=CbO + paddw xmm4,xmm4 ; xmm4=2*CbE + paddw xmm5,xmm5 ; xmm5=2*CbO + movdqa xmm6,xmm0 ; xmm6=CrE + movdqa xmm7,xmm1 ; xmm7=CrO + paddw xmm0,xmm0 ; xmm0=2*CrE + paddw xmm1,xmm1 ; xmm1=2*CrO + + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[GOTOFF(eax,PW_MF0228)] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[GOTOFF(eax,PW_F0402)] ; xmm1=(2*CrO * FIX(0.40200)) + + paddw xmm4,[GOTOFF(eax,PW_ONE)] + paddw xmm5,[GOTOFF(eax,PW_ONE)] + psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) + psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) + paddw xmm0,[GOTOFF(eax,PW_ONE)] + paddw xmm1,[GOTOFF(eax,PW_ONE)] + psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) + psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) + + paddw xmm4,xmm2 + paddw xmm5,xmm3 + paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E + paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O + paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E + paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O + + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + punpcklwd xmm2,xmm6 + punpckhwd xmm4,xmm6 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm3,xmm7 + punpckhwd xmm5,xmm7 + pmaddwd xmm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm4,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm4,SCALEBITS + paddd xmm3,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm3,SCALEBITS + psrad xmm5,SCALEBITS + + packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + + movdqa xmm5, XMMWORD [esi] ; xmm5=Y(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} + pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE + psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO + + paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) + paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) + paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) + paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow + + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD +.column_st15: + mov eax,ecx + xor ecx, byte 0x0F + shl ecx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add eax,ecx + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg ecx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow + + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp ecx, byte SIZEOF_XMMWORD/16 + jb short .nextrow + mov eax,ecx + xor ecx, byte 0x03 + inc ecx + shl ecx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea eax, [ecx+eax*4] ; RGB_PIXELSIZE + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg ecx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + + alignx 16,7 + +.nextrow: + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop + + sfence ; flush the write buffer + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm new file mode 100644 index 00000000..c0804ecd --- /dev/null +++ b/simd/jdmerss2.asm @@ -0,0 +1,590 @@ +; +; jdmerss2.asm - merged upsampling/color conversion (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jcolsamp.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_merged_upsample_sse2) + +EXTN(jconst_merged_upsample_sse2): + +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v1_merged_upsample_sse2) + +EXTN(jsimd_h2v1_merged_upsample_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + + pop ecx ; col + + alignx 16,7 +.columnloop: + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + movdqa xmm6, XMMWORD [ebx] ; xmm6=Cb(0123456789ABCDEF) + movdqa xmm7, XMMWORD [edx] ; xmm7=Cr(0123456789ABCDEF) + + pxor xmm1,xmm1 ; xmm1=(all 0's) + pcmpeqw xmm3,xmm3 + psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} + + movdqa xmm4,xmm6 + punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH + punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL + movdqa xmm0,xmm7 + punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH + punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL + + paddw xmm6,xmm3 + paddw xmm4,xmm3 + paddw xmm7,xmm3 + paddw xmm0,xmm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm5,xmm6 ; xmm5=CbH + movdqa xmm2,xmm4 ; xmm2=CbL + paddw xmm6,xmm6 ; xmm6=2*CbH + paddw xmm4,xmm4 ; xmm4=2*CbL + movdqa xmm1,xmm7 ; xmm1=CrH + movdqa xmm3,xmm0 ; xmm3=CrL + paddw xmm7,xmm7 ; xmm7=2*CrH + paddw xmm0,xmm0 ; xmm0=2*CrL + + pmulhw xmm6,[GOTOFF(eax,PW_MF0228)] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[GOTOFF(eax,PW_F0402)] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrL * FIX(0.40200)) + + paddw xmm6,[GOTOFF(eax,PW_ONE)] + paddw xmm4,[GOTOFF(eax,PW_ONE)] + psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) + psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) + paddw xmm7,[GOTOFF(eax,PW_ONE)] + paddw xmm0,[GOTOFF(eax,PW_ONE)] + psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) + psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) + + paddw xmm6,xmm5 + paddw xmm4,xmm2 + paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H + paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L + paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H + paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L + + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H + + movdqa xmm6,xmm5 + movdqa xmm7,xmm2 + punpcklwd xmm5,xmm1 + punpckhwd xmm6,xmm1 + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm2,xmm3 + punpckhwd xmm7,xmm3 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm7,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm6,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm5,SCALEBITS + psrad xmm6,SCALEBITS + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm7,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm7,SCALEBITS + + packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + + movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H + + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 + +.Yloop_2nd: + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H + alignx 16,7 + +.Yloop_1st: + movdqa xmm7, XMMWORD [esi] ; xmm7=Y(0123456789ABCDEF) + + pcmpeqw xmm6,xmm6 + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE + psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO + + movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) + movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) + movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) + + paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) + paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) + paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) + paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD +.column_st15: + mov eax,ecx + xor ecx, byte 0x0F + shl ecx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add eax,ecx + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg ecx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp ecx, byte SIZEOF_XMMWORD/16 + jb short .endcolumn + mov eax,ecx + xor ecx, byte 0x03 + inc ecx + shl ecx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea eax, [ecx+eax*4] ; RGB_PIXELSIZE + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg ecx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + sfence ; flush the write buffer + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + + align 16 + global EXTN(jsimd_h2v2_merged_upsample_sse2) + +EXTN(jsimd_h2v2_merged_upsample_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov eax, POINTER [output_width(ebp)] + + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp + + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width + + call near EXTN(jsimd_h2v1_merged_upsample_sse2) + + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi + + call near EXTN(jsimd_h2v1_merged_upsample_sse2) + + add esp, byte 7*SIZEOF_DWORD + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jdsamss2.asm b/simd/jdsamss2.asm new file mode 100644 index 00000000..bd967dba --- /dev/null +++ b/simd/jdsamss2.asm @@ -0,0 +1,726 @@ +; +; jdsamss2.asm - upsampling (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "simd/jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fancy_upsample_sse2) + +EXTN(jconst_fancy_upsample_sse2): + +PW_ONE times 8 dw 1 +PW_TWO times 8 dw 2 +PW_THREE times 8 dw 3 +PW_SEVEN times 8 dw 7 +PW_EIGHT times 8 dw 8 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. +; +; The upsampling algorithm is linear interpolation between pixel centers, +; also known as a "triangle filter". This is a good compromise between +; speed and visual quality. The centers of the output pixels are 1/4 and 3/4 +; of the way between input pixel centers. +; +; GLOBAL(void) +; jsimd_h2v1_fancy_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_sse2) + +EXTN(jsimd_h2v1_fancy_upsample_sse2): + push ebp + mov ebp,esp + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr + test eax,eax + jz near .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push eax ; colctr + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + + test eax, SIZEOF_XMMWORD-1 + jz short .skip + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample +.skip: + pxor xmm0,xmm0 ; xmm0=(all 0's) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-1) + pand xmm7, XMMWORD [esi+0*SIZEOF_XMMWORD] + + add eax, byte SIZEOF_XMMWORD-1 + and eax, byte -SIZEOF_XMMWORD + cmp eax, byte SIZEOF_XMMWORD + ja short .columnloop + alignx 16,7 + +.columnloop_last: + pcmpeqb xmm6,xmm6 + pslldq xmm6,(SIZEOF_XMMWORD-1) + pand xmm6, XMMWORD [esi+0*SIZEOF_XMMWORD] + jmp short .upsample + alignx 16,7 + +.columnloop: + movdqa xmm6, XMMWORD [esi+1*SIZEOF_XMMWORD] + pslldq xmm6,(SIZEOF_XMMWORD-1) + +.upsample: + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm2,xmm1 + movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) + pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) + psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) + + por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) + por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) + + movdqa xmm7,xmm1 + psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) + + movdqa xmm4,xmm1 + punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm2 + punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) + punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) + movdqa xmm6,xmm3 + punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) + punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) + + pmullw xmm1,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + paddw xmm2,[GOTOFF(ebx,PW_ONE)] + paddw xmm5,[GOTOFF(ebx,PW_ONE)] + paddw xmm3,[GOTOFF(ebx,PW_TWO)] + paddw xmm6,[GOTOFF(ebx,PW_TWO)] + + paddw xmm2,xmm1 + paddw xmm5,xmm4 + psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) + paddw xmm3,xmm1 + paddw xmm6,xmm4 + psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) + psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) + + psllw xmm3,BYTE_BIT + psllw xmm6,BYTE_BIT + por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) + por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm5 + + sub eax, byte SIZEOF_XMMWORD + add esi, byte 1*SIZEOF_XMMWORD ; inptr + add edi, byte 2*SIZEOF_XMMWORD ; outptr + cmp eax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last + + pop esi + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. +; Again a triangle filter; see comments for h2v1 case, above. +; +; GLOBAL(void) +; jsimd_h2v2_fancy_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 4 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_sse2) + +EXTN(jsimd_h2v2_fancy_upsample_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov edx,eax ; edx = original ebp + mov eax, JDIMENSION [downsamp_width(edx)] ; colctr + test eax,eax + jz near .return + + mov ecx, INT [max_v_samp(edx)] ; rowctr + test ecx,ecx + jz near .return + + mov esi, JSAMPARRAY [input_data(edx)] ; input_data + mov edi, POINTER [output_data_ptr(edx)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push eax ; colctr + push ecx + push edi + push esi + + mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + + test eax, SIZEOF_XMMWORD-1 + jz short .skip + push edx + mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop edx +.skip: + ; -- process the first column block + + movdqa xmm0, XMMWORD [ebx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] + movdqa xmm1, XMMWORD [ecx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] + movdqa xmm2, XMMWORD [esi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-2) + + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + + movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm6 + + pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) + pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) + + movdqa XMMWORD [wk(0)], xmm1 + movdqa XMMWORD [wk(1)], xmm2 + + poppic ebx + + add eax, byte SIZEOF_XMMWORD-1 + and eax, byte -SIZEOF_XMMWORD + cmp eax, byte SIZEOF_XMMWORD + ja short .columnloop + alignx 16,7 + +.columnloop_last: + ; -- process the last column block + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pcmpeqb xmm1,xmm1 + pslldq xmm1,(SIZEOF_XMMWORD-2) + movdqa xmm2,xmm1 + + pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] + pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] + + movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) + + jmp near .upsample + alignx 16,7 + +.columnloop: + ; -- process the next column block + + movdqa xmm0, XMMWORD [ebx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] + movdqa xmm1, XMMWORD [ecx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] + + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address + + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + + movdqa XMMWORD [edx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [edx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm6 + + pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) + pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) + + movdqa XMMWORD [wk(2)], xmm1 + movdqa XMMWORD [wk(3)], xmm2 + +.upsample: + ; -- process the upper row + + movdqa xmm7, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [edx+1*SIZEOF_XMMWORD] + + movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) + movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) + psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) + pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) + movdqa xmm5,xmm7 + movdqa xmm6,xmm3 + psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) + pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) + + por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) + por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) + + movdqa xmm1,xmm7 + movdqa xmm2,xmm3 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) + movdqa xmm4,xmm3 + psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(0)], xmm4 + + pmullw xmm7,[GOTOFF(ebx,PW_THREE)] + pmullw xmm3,[GOTOFF(ebx,PW_THREE)] + paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm5,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm0,[GOTOFF(ebx,PW_SEVEN)] + paddw xmm2,[GOTOFF(ebx,PW_SEVEN)] + + paddw xmm1,xmm7 + paddw xmm5,xmm3 + psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) + paddw xmm0,xmm7 + paddw xmm2,xmm3 + psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) + psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) + + psllw xmm0,BYTE_BIT + psllw xmm2,BYTE_BIT + por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) + por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 + + ; -- process the lower row + + movdqa xmm6, XMMWORD [edi+0*SIZEOF_XMMWORD] + movdqa xmm4, XMMWORD [edi+1*SIZEOF_XMMWORD] + + movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) + movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) + psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) + pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) + movdqa xmm0,xmm6 + movdqa xmm2,xmm4 + psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) + pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) + + por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) + por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) + + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) + movdqa xmm3,xmm4 + psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(1)], xmm3 + + pmullw xmm6,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm0,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm7,[GOTOFF(ebx,PW_SEVEN)] + paddw xmm5,[GOTOFF(ebx,PW_SEVEN)] + + paddw xmm1,xmm6 + paddw xmm0,xmm4 + psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) + psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) + paddw xmm7,xmm6 + paddw xmm5,xmm4 + psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) + psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) + + psllw xmm7,BYTE_BIT + psllw xmm5,BYTE_BIT + por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) + por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm0 + + poppic ebx + + sub eax, byte SIZEOF_XMMWORD + add ecx, byte 1*SIZEOF_XMMWORD ; inptr1(above) + add ebx, byte 1*SIZEOF_XMMWORD ; inptr0 + add esi, byte 1*SIZEOF_XMMWORD ; inptr1(below) + add edx, byte 2*SIZEOF_XMMWORD ; outptr0 + add edi, byte 2*SIZEOF_XMMWORD ; outptr1 + cmp eax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last + + pop esi + pop edi + pop ecx + pop eax + + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 1:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v1_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_upsample_sse2) + +EXTN(jsimd_h2v1_upsample_sse2): + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_XMMWORD)-1 + and edx, byte -(2*SIZEOF_XMMWORD) + jz short .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + mov eax,edx ; colctr + alignx 16,7 +.columnloop: + + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 + + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 + + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] + + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 + + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 + + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add edi, byte 4*SIZEOF_XMMWORD ; outptr + jmp short .columnloop + alignx 16,7 + +.nextrow: + pop esi + pop edi + + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg short .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 2:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v2_upsample_sse2 (nt max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v2_upsample_sse2) + +EXTN(jsimd_h2v2_upsample_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_XMMWORD)-1 + and edx, byte -(2*SIZEOF_XMMWORD) + jz near .return + + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return + + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 +.rowloop: + push edi + push esi + + mov esi, JSAMPROW [esi] ; inptr + mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov eax,edx ; colctr + alignx 16,7 +.columnloop: + + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 + + movdqa XMMWORD [ebx+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [ebx+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 + + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] + + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 + + movdqa XMMWORD [ebx+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [ebx+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 + + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add ebx, byte 4*SIZEOF_XMMWORD ; outptr0 + add edi, byte 4*SIZEOF_XMMWORD ; outptr1 + jmp short .columnloop + alignx 16,7 + +.nextrow: + pop esi + pop edi + + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg short .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jfss2fst.asm b/simd/jfss2fst.asm new file mode 100644 index 00000000..e42d2251 --- /dev/null +++ b/simd/jfss2fst.asm @@ -0,0 +1,401 @@ +; +; jfss2fst.asm - fast integer FDCT (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the forward DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jfdctfst.c; see the jfdctfst.c +; for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. + +%if CONST_BITS == 8 +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_fdct_ifast_sse2) + +EXTN(jconst_fdct_ifast_sse2): + +PW_F0707 times 8 dw F_0_707 << CONST_SHIFT +PW_F0382 times 8 dw F_0_382 << CONST_SHIFT +PW_F0541 times 8 dw F_0_541 << CONST_SHIFT +PW_F1306 times 8 dw F_1_306 << CONST_SHIFT + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_ifast_sse2 (DCTELEM * data) +; + +%define data(b) (b)+8 ; DCTELEM * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_ifast_sse2) + +EXTN(jsimd_fdct_ifast_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + psubw xmm3,xmm1 ; xmm3=tmp13 + psubw xmm6,xmm7 ; xmm6=tmp12 + paddw xmm4,xmm1 ; xmm4=tmp10 + paddw xmm0,xmm7 ; xmm0=tmp11 + + paddw xmm6,xmm3 + psllw xmm6,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm6,[GOTOFF(ebx,PW_F0707)] ; xmm6=z1 + + movdqa xmm1,xmm4 + movdqa xmm7,xmm3 + psubw xmm4,xmm0 ; xmm4=data4 + psubw xmm3,xmm6 ; xmm3=data6 + paddw xmm1,xmm0 ; xmm1=data0 + paddw xmm7,xmm6 ; xmm7=data2 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 + + ; -- Odd part + + paddw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm5,xmm0 ; xmm5=tmp11 + paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 + + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z3 + + movdqa xmm4,xmm2 ; xmm4=tmp10 + psubw xmm2,xmm0 + pmulhw xmm2,[GOTOFF(ebx,PW_F0382)] ; xmm2=z5 + pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[GOTOFF(ebx,PW_F1306)] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm2 ; xmm4=z2 + paddw xmm0,xmm2 ; xmm0=z4 + + movdqa xmm3,xmm6 + psubw xmm6,xmm5 ; xmm6=z13 + paddw xmm3,xmm5 ; xmm3=z11 + + movdqa xmm2,xmm6 + movdqa xmm5,xmm3 + psubw xmm6,xmm4 ; xmm6=data3 + psubw xmm3,xmm0 ; xmm3=data7 + paddw xmm2,xmm4 ; xmm2=data5 + paddw xmm5,xmm0 ; xmm5=data1 + + ; ---- Pass 2: process columns. + +; mov edx, POINTER [data(eax)] ; (DCTELEM *) + + ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) + ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) + + movdqa xmm4,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) + punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 + + ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) + ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm7,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) + punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) + punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) + + movdqa xmm2,xmm5 ; transpose coefficients(phase 2) + punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) + punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) + movdqa xmm3,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) + punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) + + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) + + movdqa xmm2,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) + punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) + movdqa xmm7,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) + punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) + + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm0,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm5,xmm6 + movdqa xmm3,xmm1 + psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 + psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 + paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 + paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 + + movdqa xmm6,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm1,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm7,xmm6 + movdqa xmm0,xmm2 + paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 + paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 + psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 + psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm1,xmm5 + psubw xmm3,xmm6 ; xmm3=tmp13 + psubw xmm5,xmm2 ; xmm5=tmp12 + paddw xmm4,xmm6 ; xmm4=tmp10 + paddw xmm1,xmm2 ; xmm1=tmp11 + + paddw xmm5,xmm3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z1 + + movdqa xmm6,xmm4 + movdqa xmm2,xmm3 + psubw xmm4,xmm1 ; xmm4=data4 + psubw xmm3,xmm5 ; xmm3=data6 + paddw xmm6,xmm1 ; xmm6=data0 + paddw xmm2,xmm5 ; xmm2=data2 + + movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm2 + + ; -- Odd part + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + paddw xmm7,xmm0 ; xmm7=tmp10 + paddw xmm0,xmm1 ; xmm0=tmp11 + paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 + + psllw xmm7,PRE_MULTIPLY_SCALE_BITS + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm0,[GOTOFF(ebx,PW_F0707)] ; xmm0=z3 + + movdqa xmm4,xmm7 ; xmm4=tmp10 + psubw xmm7,xmm1 + pmulhw xmm7,[GOTOFF(ebx,PW_F0382)] ; xmm7=z5 + pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[GOTOFF(ebx,PW_F1306)] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm7 ; xmm4=z2 + paddw xmm1,xmm7 ; xmm1=z4 + + movdqa xmm3,xmm5 + psubw xmm5,xmm0 ; xmm5=z13 + paddw xmm3,xmm0 ; xmm3=z11 + + movdqa xmm6,xmm5 + movdqa xmm2,xmm3 + psubw xmm5,xmm4 ; xmm5=data3 + psubw xmm3,xmm1 ; xmm3=data7 + paddw xmm6,xmm4 ; xmm6=data5 + paddw xmm2,xmm1 ; xmm2=data1 + + movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm2 + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jfss2int.asm b/simd/jfss2int.asm new file mode 100644 index 00000000..6e37497c --- /dev/null +++ b/simd/jfss2int.asm @@ -0,0 +1,631 @@ +; +; jfss2int.asm - accurate integer FDCT (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; forward DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jfdctint.c; see the jfdctint.c for +; more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_islow_sse2) + +EXTN(jconst_fdct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_islow_sse2 (DCTELEM * data) +; + +%define data(b) (b)+8 ; DCTELEM * data + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 + + align 16 + global EXTN(jsimd_fdct_islow_sse2) + +EXTN(jsimd_fdct_islow_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + paddw xmm3,xmm1 ; xmm3=tmp10 + paddw xmm6,xmm7 ; xmm6=tmp11 + psubw xmm4,xmm1 ; xmm4=tmp13 + psubw xmm0,xmm7 ; xmm0=tmp12 + + movdqa xmm1,xmm3 + paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 + psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 + + psllw xmm3,PASS1_BITS ; xmm3=data0 + psllw xmm1,PASS1_BITS ; xmm1=data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm7,xmm4 ; xmm4=tmp13 + movdqa xmm6,xmm4 + punpcklwd xmm7,xmm0 ; xmm0=tmp12 + punpckhwd xmm6,xmm0 + movdqa xmm4,xmm7 + movdqa xmm0,xmm6 + pmaddwd xmm7,[GOTOFF(ebx,PW_F130_F054)] ; xmm7=data2L + pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=data2H + pmaddwd xmm4,[GOTOFF(ebx,PW_F054_MF130)] ; xmm4=data6L + pmaddwd xmm0,[GOTOFF(ebx,PW_F054_MF130)] ; xmm0=data6H + + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm7,DESCALE_P1 + psrad xmm6,DESCALE_P1 + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm4,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm7,xmm6 ; xmm7=data2 + packssdw xmm4,xmm0 ; xmm4=data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 + + ; -- Odd part + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 + + movdqa xmm6,xmm2 ; xmm2=tmp4 + movdqa xmm0,xmm5 ; xmm5=tmp5 + paddw xmm6,xmm3 ; xmm6=z3 + paddw xmm0,xmm1 ; xmm0=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm7,xmm6 + movdqa xmm4,xmm6 + punpcklwd xmm7,xmm0 + punpckhwd xmm4,xmm0 + movdqa xmm6,xmm7 + movdqa xmm0,xmm4 + pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3H + pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4L + pmaddwd xmm0,[GOTOFF(ebx,PW_F117_F078)] ; xmm0=z4H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm7,xmm2 + movdqa xmm4,xmm2 + punpcklwd xmm7,xmm1 + punpckhwd xmm4,xmm1 + movdqa xmm2,xmm7 + movdqa xmm1,xmm4 + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp4L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4H + pmaddwd xmm2,[GOTOFF(ebx,PW_MF089_F060)] ; xmm2=tmp7L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp7H + + paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H + paddd xmm2,xmm6 ; xmm2=data1L + paddd xmm1,xmm0 ; xmm1=data1H + + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm7,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm2,DESCALE_P1 + psrad xmm1,DESCALE_P1 + + packssdw xmm7,xmm4 ; xmm7=data7 + packssdw xmm2,xmm1 ; xmm2=data1 + + movdqa xmm4,xmm5 + movdqa xmm1,xmm5 + punpcklwd xmm4,xmm3 + punpckhwd xmm1,xmm3 + movdqa xmm5,xmm4 + movdqa xmm3,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm4=tmp5L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5H + pmaddwd xmm5,[GOTOFF(ebx,PW_MF256_F050)] ; xmm5=tmp6L + pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6H + + paddd xmm4,xmm6 ; xmm4=data5L + paddd xmm1,xmm0 ; xmm1=data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm4,DESCALE_P1 + psrad xmm1,DESCALE_P1 + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm5,DESCALE_P1 + psrad xmm3,DESCALE_P1 + + packssdw xmm4,xmm1 ; xmm4=data5 + packssdw xmm5,xmm3 ; xmm5=data3 + + ; ---- Pass 2: process columns. + +; mov edx, POINTER [data(eax)] ; (DCTELEM *) + + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 + + ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) + ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) + + movdqa xmm1,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) + punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) + movdqa xmm3,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) + punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) + + movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 + + ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) + ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm0,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) + + movdqa xmm4,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) + punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) + punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) + punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) + punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) + + movdqa xmm5,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm2,xmm5 + movdqa xmm7,xmm6 + psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 + psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 + paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 + paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movdqa xmm5,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm0,xmm5 + movdqa xmm3,xmm4 + paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 + paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 + psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 + psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm1,xmm7 + movdqa xmm6,xmm2 + paddw xmm7,xmm5 ; xmm7=tmp10 + paddw xmm2,xmm4 ; xmm2=tmp11 + psubw xmm1,xmm5 ; xmm1=tmp13 + psubw xmm6,xmm4 ; xmm6=tmp12 + + movdqa xmm5,xmm7 + paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 + psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 + + paddw xmm7,[GOTOFF(ebx,PW_DESCALE_P2X)] + paddw xmm5,[GOTOFF(ebx,PW_DESCALE_P2X)] + psraw xmm7,PASS1_BITS ; xmm7=data0 + psraw xmm5,PASS1_BITS ; xmm5=data4 + + movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm5 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm4,xmm1 ; xmm1=tmp13 + movdqa xmm2,xmm1 + punpcklwd xmm4,xmm6 ; xmm6=tmp12 + punpckhwd xmm2,xmm6 + movdqa xmm1,xmm4 + movdqa xmm6,xmm2 + pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=data2L + pmaddwd xmm2,[GOTOFF(ebx,PW_F130_F054)] ; xmm2=data2H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=data6L + pmaddwd xmm6,[GOTOFF(ebx,PW_F054_MF130)] ; xmm6=data6H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm4,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm1,DESCALE_P2 + psrad xmm6,DESCALE_P2 + + packssdw xmm4,xmm2 ; xmm4=data2 + packssdw xmm1,xmm6 ; xmm1=data6 + + movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm1 + + ; -- Odd part + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + movdqa xmm2,xmm0 ; xmm0=tmp4 + movdqa xmm6,xmm3 ; xmm3=tmp5 + paddw xmm2,xmm7 ; xmm2=z3 + paddw xmm6,xmm5 ; xmm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm4,xmm2 + movdqa xmm1,xmm2 + punpcklwd xmm4,xmm6 + punpckhwd xmm1,xmm6 + movdqa xmm2,xmm4 + movdqa xmm6,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF078_F117)] ; xmm1=z3H + pmaddwd xmm2,[GOTOFF(ebx,PW_F117_F078)] ; xmm2=z4L + pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm4,xmm0 + movdqa xmm1,xmm0 + punpcklwd xmm4,xmm5 + punpckhwd xmm1,xmm5 + movdqa xmm0,xmm4 + movdqa xmm5,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm1=tmp4H + pmaddwd xmm0,[GOTOFF(ebx,PW_MF089_F060)] ; xmm0=tmp7L + pmaddwd xmm5,[GOTOFF(ebx,PW_MF089_F060)] ; xmm5=tmp7H + + paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H + paddd xmm0,xmm2 ; xmm0=data1L + paddd xmm5,xmm6 ; xmm5=data1H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm4,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm0,DESCALE_P2 + psrad xmm5,DESCALE_P2 + + packssdw xmm4,xmm1 ; xmm4=data7 + packssdw xmm0,xmm5 ; xmm0=data1 + + movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1,xmm3 + movdqa xmm5,xmm3 + punpcklwd xmm1,xmm7 + punpckhwd xmm5,xmm7 + movdqa xmm3,xmm1 + movdqa xmm7,xmm5 + pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5L + pmaddwd xmm5,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm5=tmp5H + pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF256_F050)] ; xmm7=tmp6H + + paddd xmm1,xmm2 ; xmm1=data5L + paddd xmm5,xmm6 ; xmm5=data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H + + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm1,DESCALE_P2 + psrad xmm5,DESCALE_P2 + paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm3,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm1,xmm5 ; xmm1=data5 + packssdw xmm3,xmm7 ; xmm3=data3 + + movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm3 + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jiss2flt.asm b/simd/jiss2flt.asm new file mode 100644 index 00000000..6bb429a2 --- /dev/null +++ b/simd/jiss2flt.asm @@ -0,0 +1,495 @@ +; +; jiss2flt.asm - floating-point IDCT (SSE & SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the inverse DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jidctflt.c; see the jidctflt.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 +%endmacro + +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_float_sse2) + +EXTN(jconst_idct_float_sse2): + +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_float_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_float_sse2) + +EXTN(jsimd_idct_float_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input, store into work array. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movq xmm1, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq xmm4, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq xmm6, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq xmm7, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm2 + por xmm3,xmm4 + por xmm5,xmm6 + por xmm1,xmm3 + por xmm5,xmm7 + por xmm1,xmm5 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 + + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) + + punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) + punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) + cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) + cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) + + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movq xmm2, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + + punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) + punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) + cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) + cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) + + punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) + punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) + psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) + cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) + cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) + + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + +.nextcolumn: + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 +.rowloop: + + ; -- Even part + + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm1=[PD_RNDINT_MAGIC] + pcmpeqd xmm3,xmm3 + psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} + + addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) + addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) + addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) + addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) + + pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) + pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) + por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) + por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) + + movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 + movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm7,xmm1 + movaps xmm5,xmm3 + addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) + addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) + subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) + subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) + + movaps xmm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm2=[PD_RNDINT_MAGIC] + pcmpeqd xmm4,xmm4 + psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} + + addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) + addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) + addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) + addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) + + pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) + pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) + por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) + por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) + + movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] + + packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) + packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) + paddb xmm6,xmm2 + paddb xmm1,xmm2 + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 3) + punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + + pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + + pushpic ebx ; save GOT address + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm7 + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm3 + + poppic ebx ; restore GOT address + + add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jiss2fst.asm b/simd/jiss2fst.asm new file mode 100644 index 00000000..aafa8101 --- /dev/null +++ b/simd/jiss2fst.asm @@ -0,0 +1,499 @@ +; +; jiss2fst.asm - fast integer IDCT (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the inverse DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jidctfst.c; see the jidctfst.c +; for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 + +%if IFAST_SCALE_BITS != PASS1_BITS +%error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." +%endif + +%if CONST_BITS == 8 +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_idct_ifast_sse2) + +EXTN(jconst_idct_ifast_sse2): + +PW_F1414 times 8 dw F_1_414 << CONST_SHIFT +PW_F1847 times 8 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 8 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_ifast_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_idct_ifast_sse2) + +EXTN(jsimd_idct_ifast_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) + + pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) + pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) + pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) + pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) + pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) + pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) + pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) + pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 + jmp near .column_end + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + psubw xmm0,xmm2 ; xmm0=tmp11 + psubw xmm1,xmm3 + paddw xmm4,xmm2 ; xmm4=tmp10 + paddw xmm5,xmm3 ; xmm5=tmp13 + + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[GOTOFF(ebx,PW_F1414)] + psubw xmm1,xmm5 ; xmm1=tmp12 + + movdqa xmm6,xmm4 + movdqa xmm7,xmm0 + psubw xmm4,xmm5 ; xmm4=tmp3 + psubw xmm0,xmm1 ; xmm0=tmp2 + paddw xmm6,xmm5 ; xmm6=tmp0 + paddw xmm7,xmm1 ; xmm7=tmp1 + + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 + + ; -- Odd part + + movdqa xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4,xmm2 + movdqa xmm0,xmm5 + psubw xmm2,xmm1 ; xmm2=z12 + psubw xmm5,xmm3 ; xmm5=z10 + paddw xmm4,xmm1 ; xmm4=z11 + paddw xmm0,xmm3 ; xmm0=z13 + + movdqa xmm1,xmm5 ; xmm1=z10(unscaled) + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + + movdqa xmm3,xmm4 + psubw xmm4,xmm0 + paddw xmm3,xmm0 ; xmm3=tmp7 + + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm4,[GOTOFF(ebx,PW_F1414)] ; xmm4=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm0,xmm5 + paddw xmm5,xmm2 + pmulhw xmm5,[GOTOFF(ebx,PW_F1847)] ; xmm5=z5 + pmulhw xmm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw xmm2,[GOTOFF(ebx,PW_F1082)] + psubw xmm0,xmm1 + psubw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm0,xmm5 ; xmm0=tmp12 + + ; -- Final output stage + + psubw xmm0,xmm3 ; xmm0=tmp6 + movdqa xmm1,xmm6 + movdqa xmm5,xmm7 + paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) + paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) + psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) + psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) + psubw xmm4,xmm0 ; xmm4=tmp5 + + movdqa xmm3,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) + punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) + movdqa xmm0,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) + + paddw xmm2,xmm4 ; xmm2=tmp4 + movdqa xmm5,xmm7 + movdqa xmm0,xmm1 + paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) + paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) + psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) + psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm2,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) + + movdqa xmm0,xmm3 ; transpose coefficients(phase 2) + punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) + punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) + punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) + + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) + + movdqa xmm3,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) + punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) + movdqa xmm0,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) + movdqa xmm7,xmm5 ; transpose coefficients(phase 3) + punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 + + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) + movdqa xmm7,xmm3 ; transpose coefficients(phase 3) + punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + + ; -- Even part + + ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 + + movdqa xmm2,xmm6 + movdqa xmm0,xmm5 + psubw xmm6,xmm1 ; xmm6=tmp11 + psubw xmm5,xmm3 + paddw xmm2,xmm1 ; xmm2=tmp10 + paddw xmm0,xmm3 ; xmm0=tmp13 + + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F1414)] + psubw xmm5,xmm0 ; xmm5=tmp12 + + movdqa xmm1,xmm2 + movdqa xmm3,xmm6 + psubw xmm2,xmm0 ; xmm2=tmp3 + psubw xmm6,xmm5 ; xmm6=tmp2 + paddw xmm1,xmm0 ; xmm1=tmp0 + paddw xmm3,xmm5 ; xmm3=tmp1 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 + + ; -- Odd part + + ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 + + movdqa xmm2,xmm0 + movdqa xmm6,xmm4 + psubw xmm0,xmm7 ; xmm0=z12 + psubw xmm4,xmm5 ; xmm4=z10 + paddw xmm2,xmm7 ; xmm2=z11 + paddw xmm6,xmm5 ; xmm6=z13 + + movdqa xmm7,xmm4 ; xmm7=z10(unscaled) + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + + movdqa xmm5,xmm2 + psubw xmm2,xmm6 + paddw xmm5,xmm6 ; xmm5=tmp7 + + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm2,[GOTOFF(ebx,PW_F1414)] ; xmm2=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm6,xmm4 + paddw xmm4,xmm0 + pmulhw xmm4,[GOTOFF(ebx,PW_F1847)] ; xmm4=z5 + pmulhw xmm6,[GOTOFF(ebx,PW_MF1613)] + pmulhw xmm0,[GOTOFF(ebx,PW_F1082)] + psubw xmm6,xmm7 + psubw xmm0,xmm4 ; xmm0=tmp10 + paddw xmm6,xmm4 ; xmm6=tmp12 + + ; -- Final output stage + + psubw xmm6,xmm5 ; xmm6=tmp6 + movdqa xmm7,xmm1 + movdqa xmm4,xmm3 + paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) + paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) + psraw xmm1,(PASS1_BITS+3) ; descale + psraw xmm3,(PASS1_BITS+3) ; descale + psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) + psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) + psraw xmm7,(PASS1_BITS+3) ; descale + psraw xmm4,(PASS1_BITS+3) ; descale + psubw xmm2,xmm6 ; xmm2=tmp5 + + packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 + + paddw xmm0,xmm2 ; xmm0=tmp4 + movdqa xmm4,xmm5 + movdqa xmm7,xmm6 + paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) + paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) + psraw xmm5,(PASS1_BITS+3) ; descale + psraw xmm6,(PASS1_BITS+3) ; descale + psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) + psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) + psraw xmm4,(PASS1_BITS+3) ; descale + psraw xmm7,(PASS1_BITS+3) ; descale + + movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] + + packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm1,xmm2 + paddb xmm3,xmm2 + paddb xmm5,xmm2 + paddb xmm7,xmm2 + + movdqa xmm0,xmm1 ; transpose coefficients(phase 1) + punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + movdqa xmm4,xmm1 ; transpose coefficients(phase 2) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm2,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + movdqa xmm3,xmm1 ; transpose coefficients(phase 3) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm7 + + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 + mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jiss2int.asm b/simd/jiss2int.asm new file mode 100644 index 00000000..4122c640 --- /dev/null +++ b/simd/jiss2int.asm @@ -0,0 +1,856 @@ +; +; jiss2int.asm - accurate integer IDCT (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctint.c; see the jidctint.c for +; more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_islow_sse2) + +EXTN(jconst_idct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_islow_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 12 + + align 16 + global EXTN(jsimd_idct_islow_sse2) + +EXTN(jsimd_idct_islow_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_ISLOW_SSE2 + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm5, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm5,PASS1_BITS + + movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) + punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) + + pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) + pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) + pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) + pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) + pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) + pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) + pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) + pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + jmp near .column_end + alignx 16,7 +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm4,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm4,xmm3 ; xmm3=in6=z3 + punpckhwd xmm5,xmm3 + movdqa xmm1,xmm4 + movdqa xmm3,xmm5 + pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=tmp3L + pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L + pmaddwd xmm3,[GOTOFF(ebx,PW_F054_MF130)] ; xmm3=tmp2H + + movdqa xmm6,xmm0 + paddw xmm0,xmm2 ; xmm0=in0+in4 + psubw xmm6,xmm2 ; xmm6=in0-in4 + + pxor xmm7,xmm7 + pxor xmm2,xmm2 + punpcklwd xmm7,xmm0 ; xmm7=tmp0L + punpckhwd xmm2,xmm0 ; xmm2=tmp0H + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS + + movdqa xmm0,xmm7 + paddd xmm7,xmm4 ; xmm7=tmp10L + psubd xmm0,xmm4 ; xmm0=tmp13L + movdqa xmm4,xmm2 + paddd xmm2,xmm5 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp13H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H + + pxor xmm5,xmm5 + pxor xmm7,xmm7 + punpcklwd xmm5,xmm6 ; xmm5=tmp1L + punpckhwd xmm7,xmm6 ; xmm7=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + + movdqa xmm2,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm2,xmm1 ; xmm2=tmp12L + movdqa xmm0,xmm7 + paddd xmm7,xmm3 ; xmm7=tmp11H + psubd xmm0,xmm3 ; xmm0=tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H + + ; -- Odd part + + movdqa xmm4, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm6, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm6, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm1, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm5,xmm6 + movdqa xmm7,xmm4 + paddw xmm5,xmm3 ; xmm5=z3 + paddw xmm7,xmm1 ; xmm7=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm2,xmm5 + movdqa xmm0,xmm5 + punpcklwd xmm2,xmm7 + punpckhwd xmm0,xmm7 + movdqa xmm5,xmm2 + movdqa xmm7,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF078_F117)] ; xmm2=z3L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3H + pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L + pmaddwd xmm7,[GOTOFF(ebx,PW_F117_F078)] ; xmm7=z4H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm2,xmm3 + movdqa xmm0,xmm3 + punpcklwd xmm2,xmm4 + punpckhwd xmm0,xmm4 + movdqa xmm3,xmm2 + movdqa xmm4,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm2=tmp0L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0H + pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF089_F060)] ; xmm4=tmp3H + + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L + paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H + paddd xmm3,xmm5 ; xmm3=tmp3L + paddd xmm4,xmm7 ; xmm4=tmp3H + + movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H + + movdqa xmm2,xmm1 + movdqa xmm0,xmm1 + punpcklwd xmm2,xmm6 + punpckhwd xmm0,xmm6 + movdqa xmm1,xmm2 + movdqa xmm6,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm2=tmp1L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1H + pmaddwd xmm1,[GOTOFF(ebx,PW_MF256_F050)] ; xmm1=tmp2L + pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H + + paddd xmm2,xmm5 ; xmm2=tmp1L + paddd xmm0,xmm7 ; xmm0=tmp1H + paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H + + movdqa xmm2,xmm5 + movdqa xmm0,xmm7 + paddd xmm5,xmm3 ; xmm5=data0L + paddd xmm7,xmm4 ; xmm7=data0H + psubd xmm2,xmm3 ; xmm2=data7L + psubd xmm0,xmm4 ; xmm0=data7H + + movdqa xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm3=[PD_DESCALE_P1] + + paddd xmm5,xmm3 + paddd xmm7,xmm3 + psrad xmm5,DESCALE_P1 + psrad xmm7,DESCALE_P1 + paddd xmm2,xmm3 + paddd xmm0,xmm3 + psrad xmm2,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) + packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) + + movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L + movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H + + movdqa xmm7,xmm4 + movdqa xmm0,xmm3 + paddd xmm4,xmm1 ; xmm4=data1L + paddd xmm3,xmm6 ; xmm3=data1H + psubd xmm7,xmm1 ; xmm7=data6L + psubd xmm0,xmm6 ; xmm0=data6H + + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm1=[PD_DESCALE_P1] + + paddd xmm4,xmm1 + paddd xmm3,xmm1 + psrad xmm4,DESCALE_P1 + psrad xmm3,DESCALE_P1 + paddd xmm7,xmm1 + paddd xmm0,xmm1 + psrad xmm7,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) + + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) + punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) + + movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L + movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H + movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L + movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) + + movdqa xmm5,xmm3 + movdqa xmm6,xmm0 + paddd xmm3,xmm4 ; xmm3=data2L + paddd xmm0,xmm2 ; xmm0=data2H + psubd xmm5,xmm4 ; xmm5=data5L + psubd xmm6,xmm2 ; xmm6=data5H + + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm7=[PD_DESCALE_P1] + + paddd xmm3,xmm7 + paddd xmm0,xmm7 + psrad xmm3,DESCALE_P1 + psrad xmm0,DESCALE_P1 + paddd xmm5,xmm7 + paddd xmm6,xmm7 + psrad xmm5,DESCALE_P1 + psrad xmm6,DESCALE_P1 + + packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) + packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L + movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H + movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L + movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H + + movdqa xmm0,xmm1 + movdqa xmm6,xmm4 + paddd xmm1,xmm2 ; xmm1=data3L + paddd xmm4,xmm7 ; xmm4=data3H + psubd xmm0,xmm2 ; xmm0=data4L + psubd xmm6,xmm7 ; xmm6=data4H + + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm2=[PD_DESCALE_P1] + + paddd xmm1,xmm2 + paddd xmm4,xmm2 + psrad xmm1,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm0,xmm2 + paddd xmm6,xmm2 + psrad xmm0,DESCALE_P1 + psrad xmm6,DESCALE_P1 + + packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) + packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) + movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) + + movdqa xmm4,xmm3 ; transpose coefficients(phase 1) + punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) + punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) + + movdqa xmm1,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) + punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) + punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) + movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) + + movdqa xmm2,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) + punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) + punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) + + movdqa xmm3,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) + + movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 + + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) + movdqa xmm4,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + + ; -- Even part + + ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm6,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm6,xmm2 ; xmm2=in6=z3 + punpckhwd xmm5,xmm2 + movdqa xmm1,xmm6 + movdqa xmm2,xmm5 + pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=tmp3L + pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L + pmaddwd xmm2,[GOTOFF(ebx,PW_F054_MF130)] ; xmm2=tmp2H + + movdqa xmm3,xmm7 + paddw xmm7,xmm0 ; xmm7=in0+in4 + psubw xmm3,xmm0 ; xmm3=in0-in4 + + pxor xmm4,xmm4 + pxor xmm0,xmm0 + punpcklwd xmm4,xmm7 ; xmm4=tmp0L + punpckhwd xmm0,xmm7 ; xmm0=tmp0H + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS + + movdqa xmm7,xmm4 + paddd xmm4,xmm6 ; xmm4=tmp10L + psubd xmm7,xmm6 ; xmm7=tmp13L + movdqa xmm6,xmm0 + paddd xmm0,xmm5 ; xmm0=tmp10H + psubd xmm6,xmm5 ; xmm6=tmp13H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H + + pxor xmm5,xmm5 + pxor xmm4,xmm4 + punpcklwd xmm5,xmm3 ; xmm5=tmp1L + punpckhwd xmm4,xmm3 ; xmm4=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + + movdqa xmm0,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm0,xmm1 ; xmm0=tmp12L + movdqa xmm7,xmm4 + paddd xmm4,xmm2 ; xmm4=tmp11H + psubd xmm7,xmm2 ; xmm7=tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H + + ; -- Odd part + + movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 + movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 + movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 + movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 + + movdqa xmm5,xmm6 + movdqa xmm4,xmm3 + paddw xmm5,xmm1 ; xmm5=z3 + paddw xmm4,xmm2 ; xmm4=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm0,xmm5 + movdqa xmm7,xmm5 + punpcklwd xmm0,xmm4 + punpckhwd xmm7,xmm4 + movdqa xmm5,xmm0 + movdqa xmm4,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3H + pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L + pmaddwd xmm4,[GOTOFF(ebx,PW_F117_F078)] ; xmm4=z4H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm0,xmm1 + movdqa xmm7,xmm1 + punpcklwd xmm0,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm1,xmm0 + movdqa xmm3,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp0H + pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp3L + pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3H + + paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L + paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H + paddd xmm1,xmm5 ; xmm1=tmp3L + paddd xmm3,xmm4 ; xmm3=tmp3H + + movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H + + movdqa xmm0,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm0,xmm6 + punpckhwd xmm7,xmm6 + movdqa xmm2,xmm0 + movdqa xmm6,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm7=tmp1H + pmaddwd xmm2,[GOTOFF(ebx,PW_MF256_F050)] ; xmm2=tmp2L + pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H + + paddd xmm0,xmm5 ; xmm0=tmp1L + paddd xmm7,xmm4 ; xmm7=tmp1H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H + + movdqa xmm0,xmm5 + movdqa xmm7,xmm4 + paddd xmm5,xmm1 ; xmm5=data0L + paddd xmm4,xmm3 ; xmm4=data0H + psubd xmm0,xmm1 ; xmm0=data7L + psubd xmm7,xmm3 ; xmm7=data7H + + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm1=[PD_DESCALE_P2] + + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrad xmm5,DESCALE_P2 + psrad xmm4,DESCALE_P2 + paddd xmm0,xmm1 + paddd xmm7,xmm1 + psrad xmm0,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) + packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L + movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H + + movdqa xmm4,xmm3 + movdqa xmm7,xmm1 + paddd xmm3,xmm2 ; xmm3=data1L + paddd xmm1,xmm6 ; xmm1=data1H + psubd xmm4,xmm2 ; xmm4=data6L + psubd xmm7,xmm6 ; xmm7=data6H + + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm2=[PD_DESCALE_P2] + + paddd xmm3,xmm2 + paddd xmm1,xmm2 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm4,xmm2 + paddd xmm7,xmm2 + psrad xmm4,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) + packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) + + packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H + movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L + movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm4,xmm6 + movdqa xmm0,xmm2 + paddd xmm6,xmm1 ; xmm6=data2L + paddd xmm2,xmm7 ; xmm2=data2H + psubd xmm4,xmm1 ; xmm4=data5L + psubd xmm0,xmm7 ; xmm0=data5H + + movdqa xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm5=[PD_DESCALE_P2] + + paddd xmm6,xmm5 + paddd xmm2,xmm5 + psrad xmm6,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm4,xmm5 + paddd xmm0,xmm5 + psrad xmm4,DESCALE_P2 + psrad xmm0,DESCALE_P2 + + packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) + packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) + + movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L + movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H + movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L + movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H + + movdqa xmm2,xmm3 + movdqa xmm0,xmm1 + paddd xmm3,xmm7 ; xmm3=data3L + paddd xmm1,xmm5 ; xmm1=data3H + psubd xmm2,xmm7 ; xmm2=data4L + psubd xmm0,xmm5 ; xmm0=data4H + + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm7=[PD_DESCALE_P2] + + paddd xmm3,xmm7 + paddd xmm1,xmm7 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm2,xmm7 + paddd xmm0,xmm7 + psrad xmm2,DESCALE_P2 + psrad xmm0,DESCALE_P2 + + movdqa xmm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm5=[PB_CENTERJSAMP] + + packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) + packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm7,xmm5 + paddb xmm1,xmm5 + paddb xmm6,xmm5 + paddb xmm3,xmm5 + + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + movdqa xmm4,xmm7 ; transpose coefficients(phase 2) + punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm3,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm7 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm1 + mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 + mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm5 + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jiss2red.asm b/simd/jiss2red.asm new file mode 100644 index 00000000..b31346a8 --- /dev/null +++ b/simd/jiss2red.asm @@ -0,0 +1,591 @@ +; +; jiss2red.asm - reduced-size IDCT (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains inverse-DCT routines that produce reduced-size +; output: either 4x4 or 2x2 pixels from an 8x8 DCT block. +; The following code is based directly on the IJG's original jidctred.c; +; see the jidctred.c for more details. +; +; [TAB8] + +%include "simd/jsimdext.inc" +%include "simd/jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) + +%if CONST_BITS == 13 +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_red_sse2) + +EXTN(jconst_idct_red_sse2): + +PW_F184_MF076 times 4 dw F_1_847,-F_0_765 +PW_F256_F089 times 4 dw F_2_562, F_0_899 +PW_F106_MF217 times 4 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 4 dw F_1_451,-F_0_211 +PW_F362_MF127 times 4 dw F_3_624,-F_1_272 +PW_F085_MF072 times 4 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 4x4 output block. +; +; GLOBAL(void) +; jsimd_idct_4x4_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_idct_4x4_sse2) + +EXTN(jsimd_idct_4x4_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input. + +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_4X4_SSE2 + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm0,xmm1 + packsswb xmm0,xmm0 + packsswb xmm0,xmm0 + movd eax,xmm0 + test eax,eax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm0,PASS1_BITS + + movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) + + pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) + pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) + pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) + pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) + + jmp near .column_end + alignx 16,7 +%endif +.columnDCT: + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm4,xmm0 + movdqa xmm5,xmm0 + punpcklwd xmm4,xmm1 + punpckhwd xmm5,xmm1 + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + pmaddwd xmm4,[GOTOFF(ebx,PW_F256_F089)] ; xmm4=(tmp2L) + pmaddwd xmm5,[GOTOFF(ebx,PW_F256_F089)] ; xmm5=(tmp2H) + pmaddwd xmm0,[GOTOFF(ebx,PW_F106_MF217)] ; xmm0=(tmp0L) + pmaddwd xmm1,[GOTOFF(ebx,PW_F106_MF217)] ; xmm1=(tmp0H) + + movdqa xmm6,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm6,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2L) + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm7=(tmp2H) + pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0L) + pmaddwd xmm3,[GOTOFF(ebx,PW_F145_MF021)] ; xmm3=(tmp0H) + + paddd xmm6,xmm4 ; xmm6=tmp2L + paddd xmm7,xmm5 ; xmm7=tmp2H + paddd xmm2,xmm0 ; xmm2=tmp0L + paddd xmm3,xmm1 ; xmm3=tmp0H + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H + + ; -- Even part + + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm5, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movdqa xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm5, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm0, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + pxor xmm1,xmm1 + pxor xmm2,xmm2 + punpcklwd xmm1,xmm4 ; xmm1=tmp0L + punpckhwd xmm2,xmm4 ; xmm2=tmp0H + psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 + psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 + + movdqa xmm3,xmm5 ; xmm5=in2=z2 + punpcklwd xmm5,xmm0 ; xmm0=in6=z3 + punpckhwd xmm3,xmm0 + pmaddwd xmm5,[GOTOFF(ebx,PW_F184_MF076)] ; xmm5=tmp2L + pmaddwd xmm3,[GOTOFF(ebx,PW_F184_MF076)] ; xmm3=tmp2H + + movdqa xmm4,xmm1 + movdqa xmm0,xmm2 + paddd xmm1,xmm5 ; xmm1=tmp10L + paddd xmm2,xmm3 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp12L + psubd xmm0,xmm3 ; xmm0=tmp12H + + ; -- Final output stage + + movdqa xmm5,xmm1 + movdqa xmm3,xmm2 + paddd xmm1,xmm6 ; xmm1=data0L + paddd xmm2,xmm7 ; xmm2=data0H + psubd xmm5,xmm6 ; xmm5=data3L + psubd xmm3,xmm7 ; xmm3=data3H + + movdqa xmm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm6=[PD_DESCALE_P1_4] + + paddd xmm1,xmm6 + paddd xmm2,xmm6 + psrad xmm1,DESCALE_P1_4 + psrad xmm2,DESCALE_P1_4 + paddd xmm5,xmm6 + paddd xmm3,xmm6 + psrad xmm5,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 + + packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) + packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H + + movdqa xmm2,xmm4 + movdqa xmm3,xmm0 + paddd xmm4,xmm7 ; xmm4=data1L + paddd xmm0,xmm6 ; xmm0=data1H + psubd xmm2,xmm7 ; xmm2=data2L + psubd xmm3,xmm6 ; xmm3=data2H + + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm7=[PD_DESCALE_P1_4] + + paddd xmm4,xmm7 + paddd xmm0,xmm7 + psrad xmm4,DESCALE_P1_4 + psrad xmm0,DESCALE_P1_4 + paddd xmm2,xmm7 + paddd xmm3,xmm7 + psrad xmm2,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 + + packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) + + movdqa xmm6,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm7,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) + + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) + punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) + movdqa xmm3,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) + punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows, store into output array. + + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + + ; -- Even part + + pxor xmm4,xmm4 + punpcklwd xmm4,xmm1 ; xmm4=tmp0 + psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 + + ; -- Odd part + + punpckhwd xmm1,xmm0 + punpckhwd xmm6,xmm3 + movdqa xmm5,xmm1 + movdqa xmm2,xmm6 + pmaddwd xmm1,[GOTOFF(ebx,PW_F256_F089)] ; xmm1=(tmp2) + pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2) + pmaddwd xmm5,[GOTOFF(ebx,PW_F106_MF217)] ; xmm5=(tmp0) + pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0) + + paddd xmm6,xmm1 ; xmm6=tmp2 + paddd xmm2,xmm5 ; xmm2=tmp0 + + ; -- Even part + + punpcklwd xmm0,xmm3 + pmaddwd xmm0,[GOTOFF(ebx,PW_F184_MF076)] ; xmm0=tmp2 + + movdqa xmm7,xmm4 + paddd xmm4,xmm0 ; xmm4=tmp10 + psubd xmm7,xmm0 ; xmm7=tmp12 + + ; -- Final output stage + + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; xmm1=[PD_DESCALE_P2_4] + + movdqa xmm5,xmm4 + movdqa xmm3,xmm7 + paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) + paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) + psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) + psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + + paddd xmm4,xmm1 + paddd xmm7,xmm1 + psrad xmm4,DESCALE_P2_4 + psrad xmm7,DESCALE_P2_4 + paddd xmm5,xmm1 + paddd xmm3,xmm1 + psrad xmm5,DESCALE_P2_4 + psrad xmm3,DESCALE_P2_4 + + packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) + packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) + + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) + punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) + + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) + punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) + + packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) + paddb xmm4,[GOTOFF(ebx,PB_CENTERJSAMP)] + + pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) + pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) + pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 + movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + + +; -------------------------------------------------------------------------- +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 2x2 output block. +; +; GLOBAL(void) +; jsimd_idct_2x2_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col + + align 16 + global EXTN(jsimd_idct_2x2_sse2) + +EXTN(jsimd_idct_2x2_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process columns from input. + + mov edx, POINTER [dct_table(ebp)] ; quantptr + mov esi, JCOEFPTR [coef_block(ebp)] ; inptr + + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) + ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) + + pcmpeqd xmm7,xmm7 + pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} + + movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) + movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) + punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) + punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) + pmaddwd xmm4,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm5,[GOTOFF(ebx,PW_F085_MF072)] + + psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) + pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) + psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) + pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) + por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) + por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) + pmaddwd xmm0,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm2,[GOTOFF(ebx,PW_F085_MF072)] + + paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] + paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] + + ; -- Even part + + movdqa xmm6, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm6=(00 01 ** 03 ** 05 ** 07) + + movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) + pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) + pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) + psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] + psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] + + ; -- Final output stage + + movdqa xmm3,xmm6 + movdqa xmm5,xmm1 + paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) + paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) + psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) + psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) + + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; xmm2=[PD_DESCALE_P1_2] + + punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) + + movdqa xmm7,xmm1 + punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) + punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) + + paddd xmm6,xmm2 + psrad xmm6,DESCALE_P1_2 + + paddd xmm1,xmm2 + paddd xmm7,xmm2 + psrad xmm1,DESCALE_P1_2 + psrad xmm7,DESCALE_P1_2 + + ; -- Prefetch the next coefficient block + + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows, store into output array. + + mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(ebp)] + + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | + + ; -- Odd part + + packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) + packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) + pmaddwd xmm1,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm7,[GOTOFF(ebx,PW_F085_MF072)] + + paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] + + ; -- Even part + + pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] + + ; -- Final output stage + + movdqa xmm4,xmm6 + paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) + psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) + + punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) + + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2_2)] + psrad xmm6,DESCALE_P2_2 + + packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) + packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) + paddb xmm6,[GOTOFF(ebx,PB_CENTERJSAMP)] + + pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) + pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) + + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov WORD [edx+eax*SIZEOF_JSAMPLE], bx + mov WORD [esi+eax*SIZEOF_JSAMPLE], cx + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jsimd.h b/simd/jsimd.h index 98bcebc1..371586e6 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -14,6 +14,7 @@ #define JSIMD_MMX 0x01 #define JSIMD_3DNOW 0x02 #define JSIMD_SSE 0x04 +#define JSIMD_SSE2 0x08 /* Short forms of external names for systems with brain-damaged linkers. */ @@ -21,32 +22,63 @@ #define jpeg_simd_cpu_support jSiCpuSupport #define jsimd_rgb_ycc_convert_mmx jSRGBYCCM #define jsimd_ycc_rgb_convert_mmx jSYCCRGBM +#define jconst_rgb_ycc_convert_sse2 jSCRGBYCCS2 +#define jsimd_rgb_ycc_convert_sse2 jSRGBYCCS2 +#define jconst_ycc_rgb_convert_sse2 jSCYCCRGBS2 +#define jsimd_ycc_rgb_convert_sse2 jSYCCRGBS2 #define jsimd_h2v2_downsample_mmx jSDnH2V2M #define jsimd_h2v1_downsample_mmx jSDnH2V1M +#define jsimd_h2v2_downsample_sse2 jSDnH2V2S2 +#define jsimd_h2v1_downsample_sse2 jSDnH2V1S2 #define jsimd_h2v2_upsample_mmx jSUpH2V2M #define jsimd_h2v1_upsample_mmx jSUpH2V1M #define jsimd_h2v2_fancy_upsample_mmx jSFUpH2V2M #define jsimd_h2v1_fancy_upsample_mmx jSFUpH2V1M #define jsimd_h2v2_merged_upsample_mmx jSMUpH2V2M #define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M +#define jsimd_h2v2_upsample_sse2 jSUpH2V2S2 +#define jsimd_h2v1_upsample_sse2 jSUpH2V1S2 +#define jconst_fancy_upsample_sse2 jSCFUpS2 +#define jsimd_h2v2_fancy_upsample_sse2 jSFUpH2V2S2 +#define jsimd_h2v1_fancy_upsample_sse2 jSFUpH2V1S2 +#define jconst_merged_upsample_sse2 jSCMUpS2 +#define jsimd_h2v2_merged_upsample_sse2 jSMUpH2V2S2 +#define jsimd_h2v1_merged_upsample_sse2 jSMUpH2V1S2 #define jsimd_convsamp_mmx jSConvM +#define jsimd_convsamp_sse2 jSConvS2 #define jsimd_convsamp_float_3dnow jSConvF3D #define jsimd_convsamp_float_sse jSConvFS +#define jsimd_convsamp_float_sse2 jSConvFS2 #define jsimd_fdct_islow_mmx jSFDMIS #define jsimd_fdct_ifast_mmx jSFDMIF +#define jconst_fdct_islow_sse2 jSCFDS2IS +#define jsimd_fdct_islow_sse2 jSFDS2IS +#define jconst_fdct_ifast_sse2 jSCFDS2IF +#define jsimd_fdct_ifast_sse2 jSFDS2IF #define jsimd_fdct_float_3dnow jSFD3DF #define jconst_fdct_float_sse jSCFDSF #define jsimd_fdct_float_sse jSFDSF #define jsimd_quantize_mmx jSQuantM +#define jsimd_quantize_sse2 jSQuantS2 #define jsimd_quantize_float_3dnow jSQuantF3D #define jsimd_quantize_float_sse jSQuantFS +#define jsimd_quantize_float_sse2 jSQuantFS2 #define jsimd_idct_2x2_mmx jSIDM22 #define jsimd_idct_4x4_mmx jSIDM44 +#define jconst_idct_red_sse2 jSCIDS2R +#define jsimd_idct_2x2_sse2 jSIDS222 +#define jsimd_idct_4x4_sse2 jSIDS244 #define jsimd_idct_islow_mmx jSIDMIS #define jsimd_idct_ifast_mmx jSIDMIF +#define jconst_idct_islow_sse2 jSCIDS2IS +#define jsimd_idct_islow_sse2 jSIDS2IS +#define jconst_idct_ifast_sse2 jSCIDS2IF +#define jsimd_idct_ifast_sse2 jSIDS2IF #define jsimd_idct_float_3dnow jSID3DF #define jconst_fdct_float_sse jSCIDSF #define jsimd_idct_float_sse jSIDSF +#define jconst_fdct_float_sse2 jSCIDS2F +#define jsimd_idct_float_sse2 jSIDS2F #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* SIMD Ext: retrieve SIMD/CPU information */ @@ -62,6 +94,17 @@ EXTERN(void) jsimd_ycc_rgb_convert_mmx JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); +extern const int jconst_rgb_ycc_convert_sse2[]; +EXTERN(void) jsimd_rgb_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +extern const int jconst_ycc_rgb_convert_sse2[]; +EXTERN(void) jsimd_ycc_rgb_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); + /* SIMD Downsample */ EXTERN(void) jsimd_h2v2_downsample_mmx JPP((JDIMENSION image_width, int max_v_samp_factor, @@ -72,6 +115,15 @@ EXTERN(void) jsimd_h2v1_downsample_mmx JDIMENSION v_samp_factor, JDIMENSION width_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data)); +EXTERN(void) jsimd_h2v2_downsample_sse2 + JPP((JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data)); +EXTERN(void) jsimd_h2v1_downsample_sse2 + JPP((JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data)); + /* SIMD Upsample */ EXTERN(void) jsimd_h2v2_upsample_mmx JPP((int max_v_samp_factor, JDIMENSION output_width, @@ -94,11 +146,38 @@ EXTERN(void) jsimd_h2v1_merged_upsample_mmx JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_upsample_sse2 + JPP((int max_v_samp_factor, JDIMENSION output_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_upsample_sse2 + JPP((int max_v_samp_factor, JDIMENSION output_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +extern const int jconst_fancy_upsample_sse2[]; +EXTERN(void) jsimd_h2v2_fancy_upsample_sse2 + JPP((int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v1_fancy_upsample_sse2 + JPP((int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +extern const int jconst_merged_upsample_sse2[]; +EXTERN(void) jsimd_h2v2_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); + /* SIMD Sample Conversion */ EXTERN(void) jsimd_convsamp_mmx JPP((JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_sse2 JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + DCTELEM * workspace)); + EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace)); @@ -107,10 +186,19 @@ EXTERN(void) jsimd_convsamp_float_sse JPP((JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp_float_sse2 JPP((JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT * workspace)); + /* SIMD Forward DCT */ EXTERN(void) jsimd_fdct_islow_mmx JPP((DCTELEM * data)); EXTERN(void) jsimd_fdct_ifast_mmx JPP((DCTELEM * data)); +extern const int jconst_fdct_ifast_sse2[]; +EXTERN(void) jsimd_fdct_islow_sse2 JPP((DCTELEM * data)); +extern const int jconst_fdct_islow_sse2[]; +EXTERN(void) jsimd_fdct_ifast_sse2 JPP((DCTELEM * data)); + EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data)); extern const int jconst_fdct_float_sse[]; @@ -121,6 +209,10 @@ EXTERN(void) jsimd_quantize_mmx JPP((JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_sse2 JPP((JCOEFPTR coef_block, + DCTELEM * divisors, + DCTELEM * workspace)); + EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace)); @@ -129,6 +221,10 @@ EXTERN(void) jsimd_quantize_float_sse JPP((JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize_float_sse2 JPP((JCOEFPTR coef_block, + FAST_FLOAT * divisors, + FAST_FLOAT * workspace)); + /* SIMD Reduced Inverse DCT */ EXTERN(void) jsimd_idct_2x2_mmx JPP((void * dct_table, JCOEFPTR coef_block, @@ -139,6 +235,16 @@ EXTERN(void) jsimd_idct_4x4_mmx JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +extern const int jconst_idct_red_sse2[]; +EXTERN(void) jsimd_idct_2x2_sse2 JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +EXTERN(void) jsimd_idct_4x4_sse2 JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + /* SIMD Inverse DCT */ EXTERN(void) jsimd_idct_islow_mmx JPP((void * dct_table, JCOEFPTR coef_block, @@ -149,6 +255,17 @@ EXTERN(void) jsimd_idct_ifast_mmx JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +extern const int jconst_idct_islow_sse2[]; +EXTERN(void) jsimd_idct_islow_sse2 JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); +extern const int jconst_idct_ifast_sse2[]; +EXTERN(void) jsimd_idct_ifast_sse2 JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + EXTERN(void) jsimd_idct_float_3dnow JPP((void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, @@ -160,3 +277,9 @@ EXTERN(void) jsimd_idct_float_sse JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +extern const int jconst_idct_float_sse2[]; +EXTERN(void) jsimd_idct_float_sse2 JPP((void * dct_table, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col)); + diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index 2779565f..4876038b 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -99,6 +99,7 @@ definev(JSIMD_NONE) definev(JSIMD_MMX) definev(JSIMD_3DNOW) definev(JSIMD_SSE) +definev(JSIMD_SSE2) ; Short forms of external names for systems with brain-damaged linkers. ; @@ -106,31 +107,62 @@ definev(JSIMD_SSE) definev(jpeg_simd_cpu_support) definev(jsimd_rgb_ycc_convert_mmx) definev(jsimd_ycc_rgb_convert_mmx) +definev(jconst_rgb_ycc_convert_sse2) +definev(jsimd_rgb_ycc_convert_sse2) +definev(jconst_ycc_rgb_convert_sse2) +definev(jsimd_ycc_rgb_convert_sse2) definev(jsimd_h2v2_downsample_mmx) definev(jsimd_h2v1_downsample_mmx) +definev(jsimd_h2v2_downsample_sse2) +definev(jsimd_h2v1_downsample_sse2) definev(jsimd_h2v2_upsample_mmx) definev(jsimd_h2v1_upsample_mmx) definev(jsimd_h2v1_fancy_upsample_mmx) definev(jsimd_h2v2_fancy_upsample_mmx) definev(jsimd_h2v1_merged_upsample_mmx) definev(jsimd_h2v2_merged_upsample_mmx) +definev(jsimd_h2v2_upsample_sse2) +definev(jsimd_h2v1_upsample_sse2) +definev(jconst_fancy_upsample_sse2) +definev(jsimd_h2v1_fancy_upsample_sse2) +definev(jsimd_h2v2_fancy_upsample_sse2) +definev(jconst_merged_upsample_sse2) +definev(jsimd_h2v1_merged_upsample_sse2) +definev(jsimd_h2v2_merged_upsample_sse2) definev(jsimd_convsamp_mmx) +definev(jsimd_convsamp_sse2) definev(jsimd_convsamp_float_3dnow) definev(jsimd_convsamp_float_sse) +definev(jsimd_convsamp_float_sse2) definev(jsimd_fdct_islow_mmx) definev(jsimd_fdct_ifast_mmx) +definev(jconst_fdct_islow_sse2) +definev(jsimd_fdct_islow_sse2) +definev(jconst_fdct_ifast_sse2) +definev(jsimd_fdct_ifast_sse2) definev(jsimd_fdct_float_3dnow) definev(jconst_fdct_float_sse) definev(jsimd_fdct_float_sse) definev(jsimd_quantize_mmx) +definev(jsimd_quantize_sse2) definev(jsimd_quantize_float_3dnow) definev(jsimd_quantize_float_sse) +definev(jsimd_quantize_float_sse2) definev(jsimd_idct_2x2_mmx) definev(jsimd_idct_4x4_mmx) +definev(jconst_idct_red_sse2) +definev(jsimd_idct_2x2_sse2) +definev(jsimd_idct_4x4_sse2) definev(jsimd_idct_islow_mmx) definev(jsimd_idct_ifast_mmx) +definev(jconst_idct_islow_sse2) +definev(jsimd_idct_islow_sse2) +definev(jconst_idct_ifast_sse2) +definev(jsimd_idct_ifast_sse2) definev(jsimd_idct_float_3dnow) definev(jconst_idct_float_sse) definev(jsimd_idct_float_sse) +definev(jconst_idct_float_sse2) +definev(jsimd_idct_float_sse2) #endif /* NEED_SHORT_EXTERNAL_NAMES */ diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index 3561b088..7838e27a 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -70,6 +70,10 @@ EXTN(jpeg_simd_cpu_support): jz short .no_sse or edi, byte JSIMD_SSE .no_sse: + test eax, 1<<26 ; bit26:SSE2 + jz short .no_sse2 + or edi, byte JSIMD_SSE2 +.no_sse2: ; Check for 3DNow! instruction support mov eax, 0x80000000 diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 5fcd7be2..8bbf64eb 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -125,6 +125,10 @@ %define SIZEOF_XMMWORD SIZEOF_OWORD ; sizeof(XMMWORD) %define XMMWORD_BIT OWORD_BIT ; sizeof(XMMWORD)*BYTE_BIT +; Similar hacks for when we load a dword or MMWORD into an xmm# register +%define XMM_DWORD +%define XMM_MMWORD + %define SIZEOF_BYTE 1 ; sizeof(BYTE) %define SIZEOF_WORD 2 ; sizeof(WORD) %define SIZEOF_DWORD 4 ; sizeof(DWORD) From 4a7a6cc081f0eeaefc80399354d4d4e52545aebf Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Wed, 11 Mar 2009 11:14:37 +0000 Subject: [PATCH 022/985] Import autogenerated files for unix/ and common/ subdirs to make source compilable without GNU autotools. --- Makefile.in | 835 +++ aclocal.m4 | 8827 +++++++++++++++++++++++++++ config.guess | 1542 +++++ config.h.in | 112 + config.sub | 1677 ++++++ configure | 15765 +++++++++++++++++++++++++++++++++++++++++++++++++ depcomp | 589 ++ install-sh | 519 ++ ltmain.sh | 8406 ++++++++++++++++++++++++++ missing | 367 ++ 10 files changed, 38639 insertions(+) create mode 100644 Makefile.in create mode 100644 aclocal.m4 create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100755 configure create mode 100755 depcomp create mode 100755 install-sh create mode 100755 ltmain.sh create mode 100755 missing diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..30ca8a34 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,835 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WITH_SIMD_TRUE@am__append_1 = simd/jsimd.h simd/jsimdcfg.inc.h \ +@WITH_SIMD_TRUE@ simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ +@WITH_SIMD_TRUE@ simd/jsimdcpu.asm \ +@WITH_SIMD_TRUE@ simd/jccolmmx.asm simd/jdcolmmx.asm \ +@WITH_SIMD_TRUE@ simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ +@WITH_SIMD_TRUE@ simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ +@WITH_SIMD_TRUE@ simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ +@WITH_SIMD_TRUE@ simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ +@WITH_SIMD_TRUE@ simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ +@WITH_SIMD_TRUE@ simd/jccolss2.asm simd/jdcolss2.asm \ +@WITH_SIMD_TRUE@ simd/jcsamss2.asm simd/jdsamss2.asm simd/jdmerss2.asm \ +@WITH_SIMD_TRUE@ simd/jcqnts2i.asm simd/jfss2fst.asm simd/jfss2int.asm \ +@WITH_SIMD_TRUE@ simd/jiss2red.asm simd/jiss2int.asm simd/jiss2fst.asm \ +@WITH_SIMD_TRUE@ simd/jcqnts2f.asm simd/jiss2flt.asm + +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/jconfig.h.in $(top_srcdir)/configure config.guess \ + config.sub depcomp install-sh ltmain.sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h jconfig.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libjpeg_la_LIBADD = +am__libjpeg_la_SOURCES_DIST = jchuff.h jdct.h jdhuff.h jerror.h \ + jinclude.h jmemsys.h jmorecfg.h jpegint.h jpeglib.h jversion.h \ + jsimd.h jsimddct.h jcapimin.c jcapistd.c jccoefct.c jccolor.c \ + jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ + jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \ + jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c \ + jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c jsimd.c simd/jsimd.h simd/jsimdcfg.inc.h \ + simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ + simd/jsimdcpu.asm simd/jccolmmx.asm simd/jdcolmmx.asm \ + simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ + simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ + simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ + simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ + simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ + simd/jccolss2.asm simd/jdcolss2.asm simd/jcsamss2.asm \ + simd/jdsamss2.asm simd/jdmerss2.asm simd/jcqnts2i.asm \ + simd/jfss2fst.asm simd/jfss2int.asm simd/jiss2red.asm \ + simd/jiss2int.asm simd/jiss2fst.asm simd/jcqnts2f.asm \ + simd/jiss2flt.asm +am__objects_1 = +am__dirstamp = $(am__leading_dot)dirstamp +@WITH_SIMD_TRUE@am__objects_2 = simd/jsimdcpu.lo simd/jccolmmx.lo \ +@WITH_SIMD_TRUE@ simd/jdcolmmx.lo simd/jcsammmx.lo \ +@WITH_SIMD_TRUE@ simd/jdsammmx.lo simd/jdmermmx.lo \ +@WITH_SIMD_TRUE@ simd/jcqntmmx.lo simd/jfmmxfst.lo \ +@WITH_SIMD_TRUE@ simd/jfmmxint.lo simd/jimmxred.lo \ +@WITH_SIMD_TRUE@ simd/jimmxint.lo simd/jimmxfst.lo \ +@WITH_SIMD_TRUE@ simd/jcqnt3dn.lo simd/jf3dnflt.lo \ +@WITH_SIMD_TRUE@ simd/ji3dnflt.lo simd/jcqntsse.lo \ +@WITH_SIMD_TRUE@ simd/jfsseflt.lo simd/jisseflt.lo \ +@WITH_SIMD_TRUE@ simd/jccolss2.lo simd/jdcolss2.lo \ +@WITH_SIMD_TRUE@ simd/jcsamss2.lo simd/jdsamss2.lo \ +@WITH_SIMD_TRUE@ simd/jdmerss2.lo simd/jcqnts2i.lo \ +@WITH_SIMD_TRUE@ simd/jfss2fst.lo simd/jfss2int.lo \ +@WITH_SIMD_TRUE@ simd/jiss2red.lo simd/jiss2int.lo \ +@WITH_SIMD_TRUE@ simd/jiss2fst.lo simd/jcqnts2f.lo \ +@WITH_SIMD_TRUE@ simd/jiss2flt.lo +am_libjpeg_la_OBJECTS = $(am__objects_1) jcapimin.lo jcapistd.lo \ + jccoefct.lo jccolor.lo jcdctmgr.lo jchuff.lo jcinit.lo \ + jcmainct.lo jcmarker.lo jcmaster.lo jcomapi.lo jcparam.lo \ + jcphuff.lo jcprepct.lo jcsample.lo jctrans.lo jdapimin.lo \ + jdapistd.lo jdatadst.lo jdatasrc.lo jdcoefct.lo jdcolor.lo \ + jddctmgr.lo jdhuff.lo jdinput.lo jdmainct.lo jdmarker.lo \ + jdmaster.lo jdmerge.lo jdphuff.lo jdpostct.lo jdsample.lo \ + jdtrans.lo jerror.lo jfdctflt.lo jfdctfst.lo jfdctint.lo \ + jidctflt.lo jidctfst.lo jidctint.lo jidctred.lo jquant1.lo \ + jquant2.lo jutils.lo jmemmgr.lo jmemnobs.lo jsimd.lo \ + $(am__objects_2) +libjpeg_la_OBJECTS = $(am_libjpeg_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libjpeg_la_SOURCES) +DIST_SOURCES = $(am__libjpeg_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NAFLAGS = @NAFLAGS@ +NASM = @NASM@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libjpeg.la +HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ + jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h + +libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c \ + jccolor.c jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c \ + jcmaster.c jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c \ + jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c \ + jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c jsimd.c \ + $(am__append_1) +@WITH_SIMD_TRUE@BUILT_SOURCES = simd/jsimdcfg.inc +@WITH_SIMD_TRUE@EXTRA_DIST = nasm_lt.sh +all: $(BUILT_SOURCES) config.h jconfig.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .asm .c .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +jconfig.h: stamp-h2 + @if test ! -f $@; then \ + rm -f stamp-h2; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h2; \ + else :; fi + +stamp-h2: $(srcdir)/jconfig.h.in $(top_builddir)/config.status + @rm -f stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status jconfig.h + +distclean-hdr: + -rm -f config.h stamp-h1 jconfig.h stamp-h2 + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +simd/$(am__dirstamp): + @$(MKDIR_P) simd + @: > simd/$(am__dirstamp) +simd/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) simd/$(DEPDIR) + @: > simd/$(DEPDIR)/$(am__dirstamp) +simd/jsimdcpu.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jccolmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdcolmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcsammmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdsammmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdmermmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcqntmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jfmmxfst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jfmmxint.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jimmxred.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jimmxint.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jimmxfst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcqnt3dn.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jf3dnflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/ji3dnflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcqntsse.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jfsseflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jisseflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jccolss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdcolss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcsamss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdsamss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jdmerss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcqnts2i.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jfss2fst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jfss2int.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jiss2red.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jiss2int.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jiss2fst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jcqnts2f.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +simd/jiss2flt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) +libjpeg.la: $(libjpeg_la_OBJECTS) $(libjpeg_la_DEPENDENCIES) + $(LINK) $(libjpeg_la_OBJECTS) $(libjpeg_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f simd/jccolmmx.$(OBJEXT) + -rm -f simd/jccolmmx.lo + -rm -f simd/jccolss2.$(OBJEXT) + -rm -f simd/jccolss2.lo + -rm -f simd/jcqnt3dn.$(OBJEXT) + -rm -f simd/jcqnt3dn.lo + -rm -f simd/jcqntmmx.$(OBJEXT) + -rm -f simd/jcqntmmx.lo + -rm -f simd/jcqnts2f.$(OBJEXT) + -rm -f simd/jcqnts2f.lo + -rm -f simd/jcqnts2i.$(OBJEXT) + -rm -f simd/jcqnts2i.lo + -rm -f simd/jcqntsse.$(OBJEXT) + -rm -f simd/jcqntsse.lo + -rm -f simd/jcsammmx.$(OBJEXT) + -rm -f simd/jcsammmx.lo + -rm -f simd/jcsamss2.$(OBJEXT) + -rm -f simd/jcsamss2.lo + -rm -f simd/jdcolmmx.$(OBJEXT) + -rm -f simd/jdcolmmx.lo + -rm -f simd/jdcolss2.$(OBJEXT) + -rm -f simd/jdcolss2.lo + -rm -f simd/jdmermmx.$(OBJEXT) + -rm -f simd/jdmermmx.lo + -rm -f simd/jdmerss2.$(OBJEXT) + -rm -f simd/jdmerss2.lo + -rm -f simd/jdsammmx.$(OBJEXT) + -rm -f simd/jdsammmx.lo + -rm -f simd/jdsamss2.$(OBJEXT) + -rm -f simd/jdsamss2.lo + -rm -f simd/jf3dnflt.$(OBJEXT) + -rm -f simd/jf3dnflt.lo + -rm -f simd/jfmmxfst.$(OBJEXT) + -rm -f simd/jfmmxfst.lo + -rm -f simd/jfmmxint.$(OBJEXT) + -rm -f simd/jfmmxint.lo + -rm -f simd/jfss2fst.$(OBJEXT) + -rm -f simd/jfss2fst.lo + -rm -f simd/jfss2int.$(OBJEXT) + -rm -f simd/jfss2int.lo + -rm -f simd/jfsseflt.$(OBJEXT) + -rm -f simd/jfsseflt.lo + -rm -f simd/ji3dnflt.$(OBJEXT) + -rm -f simd/ji3dnflt.lo + -rm -f simd/jimmxfst.$(OBJEXT) + -rm -f simd/jimmxfst.lo + -rm -f simd/jimmxint.$(OBJEXT) + -rm -f simd/jimmxint.lo + -rm -f simd/jimmxred.$(OBJEXT) + -rm -f simd/jimmxred.lo + -rm -f simd/jiss2flt.$(OBJEXT) + -rm -f simd/jiss2flt.lo + -rm -f simd/jiss2fst.$(OBJEXT) + -rm -f simd/jiss2fst.lo + -rm -f simd/jiss2int.$(OBJEXT) + -rm -f simd/jiss2int.lo + -rm -f simd/jiss2red.$(OBJEXT) + -rm -f simd/jiss2red.lo + -rm -f simd/jisseflt.$(OBJEXT) + -rm -f simd/jisseflt.lo + -rm -f simd/jsimdcpu.$(OBJEXT) + -rm -f simd/jsimdcpu.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcapimin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcapistd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jccoefct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jccolor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcdctmgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jchuff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcinit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmainct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmarker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmaster.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcomapi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcparam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcphuff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcprepct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcsample.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jctrans.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdapimin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdapistd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdatadst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdatasrc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdcoefct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdcolor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jddctmgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdhuff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdinput.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmainct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmarker.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmaster.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmerge.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdphuff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdpostct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdsample.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdtrans.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctflt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctfst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctflt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctfst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctred.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmemmgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmemnobs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jsimd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jutils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf simd/.libs simd/_libs + +distclean-libtool: + -rm -f libtool config.lt + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in jconfig.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in jconfig.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in jconfig.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) config.h.in jconfig.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) config.h jconfig.h +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f simd/$(DEPDIR)/$(am__dirstamp) + -rm -f simd/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES ctags dist \ + dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ + dist-zip distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +.asm.lo: + $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ + +simd/jsimdcfg.inc: simd/jsimdcfg.inc.h jpeglib.h jconfig.h jmorecfg.h + $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..9f5b503d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,8827 @@ +# generated automatically by aclocal 1.10.2 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, +[m4_warning([this file was generated for autoconf 2.63. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 56 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl +_LT_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\[$]0 --fallback-echo"')dnl " + lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` + ;; +esac + +_LT_OUTPUT_LIBTOOL_INIT +]) + + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. + +lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AS_SHELL_SANITIZE +_AS_PREPARE + +exec AS_MESSAGE_FD>&1 +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +if test "$no_create" != yes; then + lt_cl_success=: + test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" + exec AS_MESSAGE_LOG_FD>/dev/null + $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false + exec AS_MESSAGE_LOG_FD>>config.log + $lt_cl_success || AS_EXIT(1) +fi +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_XSI_SHELLFNS + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES +# -------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX +# ----------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_SHELL_INIT + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[_LT_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +[$]* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(lt_ECHO) +]) +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], + [An echo program that does not interpret backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[AC_CHECK_TOOL(AR, ar, false) +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1]) + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method == "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC*) + # IBM XL 8.0 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac +AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE(int foo(void) {}, + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + ) + LDFLAGS="$save_LDFLAGS" + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], + [[If ld is used when linking, flag to hardcode $libdir into a binary + during linking. This must work even if $libdir does not exist]]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [fix_srcfile_path], [1], + [Fix the shell variable $srcfile for the compiler]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_PROG_CXX +# ------------ +# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ +# compiler, we have our own version here. +m4_defun([_LT_PROG_CXX], +[ +pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) +AC_PROG_CXX +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_CXX + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_CXX], []) + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[AC_REQUIRE([_LT_PROG_CXX])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 will use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + xl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=echo + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_PROG_F77 +# ------------ +# Since AC_PROG_F77 is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_F77], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) +AC_PROG_F77 +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_F77 + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_F77], []) + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_REQUIRE([_LT_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${F77-"f77"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_PROG_FC +# ----------- +# Since AC_PROG_FC is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_FC], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) +AC_PROG_FC +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_FC + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_FC], []) + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_REQUIRE([_LT_PROG_FC])dnl +AC_LANG_PUSH(Fortran) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${FC-"f95"} + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC="$lt_save_CC" +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC="$lt_save_CC" +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_XSI_SHELLFNS +# --------------------- +# Bourne and XSI compatible variants of some useful shell functions. +m4_defun([_LT_PROG_XSI_SHELLFNS], +[case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $[*] )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +dnl func_dirname_and_basename +dnl A portable version of this function is already defined in general.m4sh +dnl so there is no need for it here. + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[[^=]]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$[@]"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]+=\$[2]" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]=\$$[1]\$[2]" +} + +_LT_EOF + ;; + esac +]) + +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [0], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) + +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) + +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# Generated from ltversion.in. + +# serial 3012 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.2.6]) +m4_define([LT_PACKAGE_REVISION], [1.3012]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.2.6' +macro_revision='1.3012' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) + +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 4 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.2], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.2])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 4 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[# Autoconf 2.62 quotes --file arguments for eval, but not when files +# are listed without --file. Let's play safe and only enable the eval +# if we detect the quoting. +case $CONFIG_FILES in +*\'*) eval set x "$CONFIG_FILES" ;; +*) set x $CONFIG_FILES ;; +esac +shift +for mf +do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/config.guess b/config.guess new file mode 100755 index 00000000..7b24a872 --- /dev/null +++ b/config.guess @@ -0,0 +1,1542 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-11-15' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..c4bd138f --- /dev/null +++ b/config.h.in @@ -0,0 +1,112 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define if your compiler supports prototypes */ +#undef HAVE_PROTOTYPES + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `unsigned char'. */ +#undef HAVE_UNSIGNED_CHAR + +/* Define to 1 if the system has the type `unsigned short'. */ +#undef HAVE_UNSIGNED_SHORT + +/* Define if you want use complete types */ +#undef INCOMPLETE_TYPES_BROKEN + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define if you have BSD-like bzero and bcopy */ +#undef NEED_BSD_STRINGS + +/* Define if you need short function names */ +#undef NEED_SHORT_EXTERNAL_NAMES + +/* Define if you have sys/types.h */ +#undef NEED_SYS_TYPES_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define if shift is unsigned */ +#undef RIGHT_SHIFT_IS_UNSIGNED + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Use accelerated SIMD routines. */ +#undef WITH_SIMD + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..053e7381 --- /dev/null +++ b/config.sub @@ -0,0 +1,1677 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-09-08' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 00000000..403175e3 --- /dev/null +++ b/configure @@ -0,0 +1,15765 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.63 for libjpeg 6.b. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='libjpeg' +PACKAGE_TARNAME='libjpeg' +PACKAGE_VERSION='6.b' +PACKAGE_STRING='libjpeg 6.b' +PACKAGE_BUGREPORT='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +WITH_SIMD_FALSE +WITH_SIMD_TRUE +NAFLAGS +NASM +IS_WIN32_FALSE +IS_WIN32_TRUE +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +AR +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +enable_libtool_lock +with_simd +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --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=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -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=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libjpeg 6.b to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libjpeg] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libjpeg 6.b:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --without-simd Omit accelerated SIMD routines. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libjpeg configure 6.b +generated by GNU Autoconf 2.63 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libjpeg $as_me 6.b, which was +generated by GNU Autoconf 2.63. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +am__api_version='1.10' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + +done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libjpeg' + VERSION='6.b' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +# Always build with prototypes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PROTOTYPES 1 +_ACEOF + +# Don't use undefined types + +cat >>confdefs.h <<\_ACEOF +#define INCOMPLETE_TYPES_BROKEN 1 +_ACEOF + + +# Checks for programs. +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + +done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.6' +macro_revision='1.3012' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:$LINENO: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + $as_unset ac_script || ac_script= + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:5453: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:5456: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:5459: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:$LINENO: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:$LINENO: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:$LINENO: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:$LINENO: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 6665 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + lt_cv_cc_needs_belf=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:$LINENO: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + lt_cv_ld_exported_symbols_list=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_ld_exported_symbols_list=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + + +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:$LINENO: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; then + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:$LINENO: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8282: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:8286: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8621: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:8625: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8726: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8730: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8781: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8785: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:$LINENO: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat >conftest.$ac_ext <<_ACEOF +int foo(void) {} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then + shlibpath_overrides_runpath=yes +fi + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dl_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { $as_echo "$as_me:$LINENO: checking for shl_load" >&5 +$as_echo_n "checking for shl_load... " >&6; } +if test "${ac_cv_func_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +$as_echo "$ac_cv_func_shl_load" >&6; } +if test "x$ac_cv_func_shl_load" = x""yes; then + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dld_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + { $as_echo "$as_me:$LINENO: checking for dlopen" >&5 +$as_echo_n "checking for dlopen... " >&6; } +if test "${ac_cv_func_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +$as_echo "$ac_cv_func_dlopen" >&6; } +if test "x$ac_cv_func_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dl_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_svld_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dld_dld_link=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 11584 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 11680 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:$LINENO: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + +{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + + +# Checks for libraries. + +# Checks for header files. +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + +for ac_header in stddef.h stdlib.h string.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +if test "${ac_cv_header_sys_types_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5 +$as_echo_n "checking for sys/types.h... " >&6; } +if test "${ac_cv_header_sys_types_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 +$as_echo "$ac_cv_header_sys_types_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking sys/types.h usability" >&5 +$as_echo_n "checking sys/types.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking sys/types.h presence" >&5 +$as_echo_n "checking sys/types.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: sys/types.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: sys/types.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: sys/types.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: sys/types.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: sys/types.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: sys/types.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5 +$as_echo_n "checking for sys/types.h... " >&6; } +if test "${ac_cv_header_sys_types_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_sys_types_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 +$as_echo "$ac_cv_header_sys_types_h" >&6; } + +fi +if test "x$ac_cv_header_sys_types_h" = x""yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_SYS_TYPES_H 1 +_ACEOF + +fi + + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_const=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_const=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const /**/ +_ACEOF + +fi + + +{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5 +$as_echo_n "checking whether char is unsigned... " >&6; } +if test "${ac_cv_c_char_unsigned+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_char_unsigned=no +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_char_unsigned=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 +$as_echo "$ac_cv_c_char_unsigned" >&6; } +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + cat >>confdefs.h <<\_ACEOF +#define __CHAR_UNSIGNED__ 1 +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_inline=$ac_kw +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 +$as_echo_n "checking for size_t... " >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_size_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((size_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +$as_echo "$ac_cv_type_size_t" >&6; } +if test "x$ac_cv_type_size_t" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for unsigned char" >&5 +$as_echo_n "checking for unsigned char... " >&6; } +if test "${ac_cv_type_unsigned_char+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_unsigned_char=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (unsigned char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((unsigned char))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_char=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_char" >&5 +$as_echo "$ac_cv_type_unsigned_char" >&6; } +if test "x$ac_cv_type_unsigned_char" = x""yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UNSIGNED_CHAR 1 +_ACEOF + + +fi +{ $as_echo "$as_me:$LINENO: checking for unsigned short" >&5 +$as_echo_n "checking for unsigned short... " >&6; } +if test "${ac_cv_type_unsigned_short+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_unsigned_short=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (unsigned short)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((unsigned short))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_short=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5 +$as_echo "$ac_cv_type_unsigned_short" >&6; } +if test "x$ac_cv_type_unsigned_short" = x""yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UNSIGNED_SHORT 1 +_ACEOF + + +fi + + +{ $as_echo "$as_me:$LINENO: checking if right shift is signed" >&5 +$as_echo_n "checking if right shift is signed... " >&6; } +if test "$cross_compiling" = yes; then + { $as_echo "$as_me:$LINENO: result: Assuming that right shift is signed on target machine." >&5 +$as_echo "Assuming that right shift is signed on target machine." >&6; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + int is_shifting_signed (long arg) { + long res = arg >> 4; + + if (res == -0x7F7E80CL) + return 1; /* right shift is signed */ + + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= (~0L) << (32-4); + if (res == -0x7F7E80CL) + return 0; /* right shift is unsigned */ + + printf("Right shift isn't acting as I expect it to.\n"); + printf("I fear the JPEG software will not work at all.\n\n"); + return 0; /* try it with unsigned anyway */ + } + int main (void) { + exit(is_shifting_signed(-0x7F7E80B1L)); + } +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define RIGHT_SHIFT_IS_UNSIGNED 1 +_ACEOF + +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +# test whether global names are unique to at least 15 chars +{ $as_echo "$as_me:$LINENO: checking for short external names" >&5 +$as_echo_n "checking for short external names... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int possibly_duplicate_function () { return 0; } + int possibly_dupli_function () { return 1; } +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + { $as_echo "$as_me:$LINENO: result: ok" >&5 +$as_echo "ok" >&6; } +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: short" >&5 +$as_echo "short" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NEED_SHORT_EXTERNAL_NAMES 1 +_ACEOF + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +# Checks for library functions. + + +for ac_func in memset memcpy +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define NEED_BSD_STRINGS 1 +_ACEOF + +fi +done + + +# Set flags to indicate platform +case "$host_os" in + cygwin* | mingw* | pw32* | interix*) + is_win32=1 + ;; +esac + if test "x$is_win32" = "x1"; then + IS_WIN32_TRUE= + IS_WIN32_FALSE='#' +else + IS_WIN32_TRUE='#' + IS_WIN32_FALSE= +fi + + +# SIMD is optional + +# Check whether --with-simd was given. +if test "${with_simd+set}" = set; then + withval=$with_simd; +fi + +if test "x${with_simd}" != "xno"; then + # Check if we're on a supported CPU + { $as_echo "$as_me:$LINENO: checking if host cpu type is i386 or compatible" >&5 +$as_echo_n "checking if host cpu type is i386 or compatible... " >&6; } + case "$host_cpu" in + i*86 | x86 | ia32) + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + +for ac_prog in nasm nasmw +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NASM+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$NASM"; then + ac_cv_prog_NASM="$NASM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NASM="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +NASM=$ac_cv_prog_NASM +if test -n "$NASM"; then + { $as_echo "$as_me:$LINENO: result: $NASM" >&5 +$as_echo "$NASM" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$NASM" && break +done + +test -z "$NASM" && { { $as_echo "$as_me:$LINENO: error: no nasm (Netwide Assembler) found" >&5 +$as_echo "$as_me: error: no nasm (Netwide Assembler) found" >&2;} + { (exit 1); exit 1; }; } + +{ $as_echo "$as_me:$LINENO: checking for object file format of host system" >&5 +$as_echo_n "checking for object file format of host system... " >&6; } +case "$host_os" in + cygwin* | mingw* | pw32* | interix*) + objfmt='Win32-COFF' + ;; + msdosdjgpp* | go32*) + objfmt='COFF' + ;; + os2-emx*) # not tested + objfmt='MSOMF' # obj + ;; + linux*coff* | linux*oldld*) + objfmt='COFF' # ??? + ;; + linux*aout*) + objfmt='a.out' + ;; + linux*) + objfmt='ELF' + ;; + freebsd* | netbsd* | openbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + objfmt='BSD-a.out' + else + objfmt='ELF' + fi + ;; + solaris* | sunos* | sysv* | sco*) + objfmt='ELF' + ;; + darwin* | rhapsody* | nextstep* | openstep* | macos*) + objfmt='Mach-O' + ;; + *) + objfmt='ELF ?' + ;; +esac + +{ $as_echo "$as_me:$LINENO: result: $objfmt" >&5 +$as_echo "$objfmt" >&6; } +if test "$objfmt" = 'ELF ?'; then + objfmt='ELF' + { $as_echo "$as_me:$LINENO: WARNING: unexpected host system. assumed that the format is $objfmt." >&5 +$as_echo "$as_me: WARNING: unexpected host system. assumed that the format is $objfmt." >&2;} +fi + +{ $as_echo "$as_me:$LINENO: checking for object file format specifier (NAFLAGS) " >&5 +$as_echo_n "checking for object file format specifier (NAFLAGS) ... " >&6; } +case "$objfmt" in + MSOMF) NAFLAGS='-fobj -DOBJ32';; + Win32-COFF) NAFLAGS='-fwin32 -DWIN32';; + COFF) NAFLAGS='-fcoff -DCOFF';; + a.out) NAFLAGS='-faout -DAOUT';; + BSD-a.out) NAFLAGS='-faoutb -DAOUT';; + ELF) NAFLAGS='-felf -DELF';; + RDF) NAFLAGS='-frdf -DRDF';; + Mach-O) NAFLAGS='-fmacho -DMACHO';; +esac +{ $as_echo "$as_me:$LINENO: result: $NAFLAGS" >&5 +$as_echo "$NAFLAGS" >&6; } + + +{ $as_echo "$as_me:$LINENO: checking whether the assembler ($NASM $NAFLAGS) works" >&5 +$as_echo_n "checking whether the assembler ($NASM $NAFLAGS) works... " >&6; } +cat > conftest.asm <&5 + (eval $try_nasm) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest.o; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + echo "configure: failed program was:" >&5 + cat conftest.asm >&5 + rm -rf conftest* + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:$LINENO: error: installation or configuration problem: assembler cannot create object files." >&5 +$as_echo "$as_me: error: installation or configuration problem: assembler cannot create object files." >&2;} + { (exit 1); exit 1; }; } +fi + +{ $as_echo "$as_me:$LINENO: checking whether the linker accepts assembler output" >&5 +$as_echo_n "checking whether the linker accepts assembler output... " >&6; } +try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&5' +if { (eval echo "$as_me:$LINENO: \"$try_nasm\"") >&5 + (eval $try_nasm) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + rm -rf conftest* + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + rm -rf conftest* + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:$LINENO: error: configuration problem: maybe object file format mismatch." >&5 +$as_echo "$as_me: error: configuration problem: maybe object file format mismatch." >&2;} + { (exit 1); exit 1; }; } +fi + + + +cat >>confdefs.h <<\_ACEOF +#define WITH_SIMD 1 +_ACEOF + + ;; + *) + { $as_echo "$as_me:$LINENO: result: no (\"$host_cpu\")" >&5 +$as_echo "no (\"$host_cpu\")" >&6; } + with_simd=no + ;; + esac +fi + if test "x$with_simd" != "xno"; then + WITH_SIMD_TRUE= + WITH_SIMD_FALSE='#' +else + WITH_SIMD_TRUE='#' + WITH_SIMD_FALSE= +fi + + +# jconfig.h is the file we use, but we have another before that to +# fool autoheader. the reason is that we include this header in our +# API headers, which can screw things up for users of the lib. +# jconfig.h is a minimal version that allows this package to be built +ac_config_headers="$ac_config_headers config.h" + +ac_config_headers="$ac_config_headers jconfig.h" + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${IS_WIN32_TRUE}" && test -z "${IS_WIN32_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"IS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"IS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${WITH_SIMD_TRUE}" && test -z "${WITH_SIMD_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_SIMD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"WITH_SIMD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libjpeg $as_me 6.b, which was +generated by GNU Autoconf 2.63. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTION]... [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +libjpeg config.status 6.b +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "jconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS jconfig.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=' ' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$ac_file_inputs '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || # Autoconf 2.62 quotes --file arguments for eval, but not when files +# are listed without --file. Let's play safe and only enable the eval +# if we detect the quoting. +case $CONFIG_FILES in +*\'*) eval set x "$CONFIG_FILES" ;; +*) set x $CONFIG_FILES ;; +esac +shift +for mf +do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/depcomp b/depcomp new file mode 100755 index 00000000..e5f9736c --- /dev/null +++ b/depcomp @@ -0,0 +1,589 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2007-03-29.01 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software +# Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..a5897de6 --- /dev/null +++ b/install-sh @@ -0,0 +1,519 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-12-25.00 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/ltmain.sh b/ltmain.sh new file mode 100755 index 00000000..6939dcc4 --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,8406 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=2.2.6 +TIMESTAMP="" +package_revision=1.3012 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? value : ""))); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + + +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/missing b/missing new file mode 100755 index 00000000..1c8ff704 --- /dev/null +++ b/missing @@ -0,0 +1,367 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: From 0a22f153ea9cba29ca453c9b708dd075a6cfd20a Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 12 Mar 2009 17:24:27 +0000 Subject: [PATCH 023/985] Include Huffman codec optimizations borrowed from TurboJPEG --- jchuff.c | 254 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 146 insertions(+), 108 deletions(-) diff --git a/jchuff.c b/jchuff.c index 20388bd4..94a66c5a 100644 --- a/jchuff.c +++ b/jchuff.c @@ -14,12 +14,34 @@ * permanent JPEG objects only upon successful completion of an MCU. */ +/* Modifications: + * Copyright (C)2007 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" #include "jchuff.h" /* Declarations shared with jcphuff.c */ +static unsigned char jpeg_first_bit_table[65536]; +int jpeg_first_bit_table_init=0; + +#define CALC_FIRST_BIT(nbits, t) \ + nbits = jpeg_first_bit_table[t&255]; \ + if (t > 255) nbits = jpeg_first_bit_table[t>>8] + 8; + /* Expanded entropy encoder object for Huffman encoding. * * The savable_state subrecord contains fields that change within an MCU, @@ -261,6 +283,15 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, dtbl->ehufco[i] = huffcode[p]; dtbl->ehufsi[i] = huffsize[p]; } + + if(!jpeg_first_bit_table_init) { + for(i = 0; i < 65536; i++) { + int bit = 0, val = i; + while (val) {val >>= 1; bit++;} + jpeg_first_bit_table[i] = bit; + } + jpeg_first_bit_table_init = 1; + } } @@ -297,147 +328,154 @@ dump_buffer (working_state * state) * between calls, so 24 bits are sufficient. */ -inline -LOCAL(boolean) -emit_bits (working_state * state, unsigned int code, int size) -/* Emit some bits; return TRUE if successful, FALSE if must suspend */ -{ - /* This routine is heavily used, so it's worth coding tightly. */ - register INT32 put_buffer = (INT32) code; - register int put_bits = state->cur.put_bits; +/***************************************************************/ - /* if size is 0, caller used an invalid Huffman table entry */ - if (size == 0) - ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); +#define DUMP_BITS_(code, size) { \ + put_bits += size; \ + put_buffer = (put_buffer << size) | code; \ + if (put_bits > 7) \ + while(put_bits > 7) \ + if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ + *buffer++ = 0; \ + } - put_buffer &= (((INT32) 1)<cur.put_buffer; /* and merge with old buffer contents */ - - while (put_bits >= 8) { - int c = (int) ((put_buffer >> 16) & 0xFF); - - emit_byte(state, c, return FALSE); - if (c == 0xFF) { /* need to stuff a zero byte? */ - emit_byte(state, 0, return FALSE); - } - put_buffer <<= 8; - put_bits -= 8; - } +#define DUMP_BITS(code, size) { \ + put_bits += size; \ + put_buffer = (put_buffer << size) | code; \ + if (put_bits > 15) { \ + if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ + *buffer++ = 0; \ + if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ + *buffer++ = 0; \ + } \ + } - state->cur.put_buffer = put_buffer; /* update state variables */ - state->cur.put_bits = put_bits; +/***************************************************************/ - return TRUE; -} +#define DUMP_SINGLE_VALUE(ht, codevalue) { \ + size = ht->ehufsi[codevalue]; \ + code = ht->ehufco[codevalue]; \ + \ + DUMP_BITS(code, size) \ + } + +/***************************************************************/ + +#define DUMP_VALUE(ht, codevalue, t, nbits) { \ + size = ht->ehufsi[codevalue]; \ + code = ht->ehufco[codevalue]; \ + t &= ~(-1 << nbits); \ + DUMP_BITS(code, size) \ + DUMP_BITS(t, nbits) \ + } + +/***************************************************************/ LOCAL(boolean) flush_bits (working_state * state) { - if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ - return FALSE; + unsigned char *buffer; + int put_buffer, put_bits; + + if ((state)->free_in_buffer < DCTSIZE2 * 2) + if (! dump_buffer(state)) return FALSE; + + buffer = state->next_output_byte; + put_buffer = state->cur.put_buffer; + put_bits = state->cur.put_bits; + + DUMP_BITS_(0x7F, 7) + state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ state->cur.put_bits = 0; + state->free_in_buffer -= (buffer - state->next_output_byte); + state->next_output_byte = buffer; + + if ((state)->free_in_buffer < DCTSIZE2 * 2) + if (! dump_buffer(state)) return FALSE; + return TRUE; } - /* Encode a single block's worth of coefficients */ LOCAL(boolean) encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, c_derived_tbl *dctbl, c_derived_tbl *actbl) { - register int temp, temp2; - register int nbits; - register int k, r, i; - + int temp, temp2; + int nbits; + int r, sflag, size, code; + unsigned char *buffer; + int put_buffer, put_bits; + int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; + + if ((state)->free_in_buffer < DCTSIZE2 * 2) + if (! dump_buffer(state)) return FALSE; + + buffer = state->next_output_byte; + put_buffer = state->cur.put_buffer; + put_bits = state->cur.put_bits; + /* Encode the DC coefficient difference per section F.1.2.1 */ temp = temp2 = block[0] - last_dc_val; - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* For a negative input, want temp2 = bitwise complement of abs(input) */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - - /* Emit the Huffman-coded symbol for the number of bits */ - if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) - return FALSE; - - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ - if (! emit_bits(state, (unsigned int) temp2, nbits)) - return FALSE; + sflag = temp >> 31; + temp -= ((temp + temp) & sflag); + temp2 += sflag; + CALC_FIRST_BIT(nbits, temp) + DUMP_VALUE(dctbl, nbits, temp2, nbits) /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ - - for (k = 1; k < DCTSIZE2; k++) { - if ((temp = block[jpeg_natural_order[k]]) == 0) { - r++; - } else { - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) - return FALSE; - r -= 16; - } - temp2 = temp; - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - - /* Emit Huffman symbol for run length / number of bits */ - i = (r << 4) + nbits; - if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i])) - return FALSE; +#define innerloop(order) { \ + temp2 = *(JCOEF*)((unsigned char*)block + order); \ + if(temp2 == 0) r++; \ + else { \ + temp = (JCOEF)temp2; \ + sflag = temp >> 31; \ + temp = (temp ^ sflag) - sflag; \ + temp2 += sflag; \ + nbits = jpeg_first_bit_table[temp]; \ + for(; r > 15; r -= 16) DUMP_BITS(code_0xf0, size_0xf0) \ + sflag = (r << 4) + nbits; \ + DUMP_VALUE(actbl, sflag, temp2, nbits) \ + r = 0; \ + }} - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (! emit_bits(state, (unsigned int) temp2, nbits)) - return FALSE; - - r = 0; - } - } + innerloop(2*1); innerloop(2*8); innerloop(2*16); innerloop(2*9); + innerloop(2*2); innerloop(2*3); innerloop(2*10); innerloop(2*17); + innerloop(2*24); innerloop(2*32); innerloop(2*25); innerloop(2*18); + innerloop(2*11); innerloop(2*4); innerloop(2*5); innerloop(2*12); + innerloop(2*19); innerloop(2*26); innerloop(2*33); innerloop(2*40); + innerloop(2*48); innerloop(2*41); innerloop(2*34); innerloop(2*27); + innerloop(2*20); innerloop(2*13); innerloop(2*6); innerloop(2*7); + innerloop(2*14); innerloop(2*21); innerloop(2*28); innerloop(2*35); + innerloop(2*42); innerloop(2*49); innerloop(2*56); innerloop(2*57); + innerloop(2*50); innerloop(2*43); innerloop(2*36); innerloop(2*29); + innerloop(2*22); innerloop(2*15); innerloop(2*23); innerloop(2*30); + innerloop(2*37); innerloop(2*44); innerloop(2*51); innerloop(2*58); + innerloop(2*59); innerloop(2*52); innerloop(2*45); innerloop(2*38); + innerloop(2*31); innerloop(2*39); innerloop(2*46); innerloop(2*53); + innerloop(2*60); innerloop(2*61); innerloop(2*54); innerloop(2*47); + innerloop(2*55); innerloop(2*62); innerloop(2*63); /* If the last coef(s) were zero, emit an end-of-block code */ - if (r > 0) - if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0])) - return FALSE; + if (r > 0) DUMP_SINGLE_VALUE(actbl, 0x0) + + state->cur.put_buffer = put_buffer; + state->cur.put_bits = put_bits; + state->free_in_buffer -= (buffer - state->next_output_byte); + state->next_output_byte = buffer; + + if ((state)->free_in_buffer < DCTSIZE2 * 2) + if (! dump_buffer(state)) return FALSE; return TRUE; } From a06a8bc9284d701e599a08d2cc49ae8bd83dd02d Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Mar 2009 12:16:51 +0000 Subject: [PATCH 024/985] Don't mix LOCAL() and qualifiers. --- jcphuff.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/jcphuff.c b/jcphuff.c index 7b235d7b..31028717 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -223,7 +223,6 @@ dump_buffer (phuff_entropy_ptr entropy) * between calls, so 24 bits are sufficient. */ -inline LOCAL(void) emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ @@ -276,7 +275,6 @@ flush_bits (phuff_entropy_ptr entropy) * Emit (or just count) a Huffman symbol. */ -inline LOCAL(void) emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) { From 59641bb95f569ab48b05e8b365003d779e0c556e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Mar 2009 12:17:26 +0000 Subject: [PATCH 025/985] Move variable init around a bit to please crappy compilers. --- jcdctmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jcdctmgr.c b/jcdctmgr.c index ba835448..67f82280 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -411,10 +411,10 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION bi; /* Make sure the compiler doesn't look up these every pass */ - workspace = fdct->workspace; forward_DCT_method_ptr do_dct = fdct->dct; convsamp_method_ptr do_convsamp = fdct->convsamp; quantize_method_ptr do_quantize = fdct->quantize; + workspace = fdct->workspace; sample_data += start_row; /* fold in the vertical offset once */ @@ -502,10 +502,10 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, /* Make sure the compiler doesn't look up these every pass */ - workspace = fdct->float_workspace; float_DCT_method_ptr do_dct = fdct->float_dct; float_convsamp_method_ptr do_convsamp = fdct->float_convsamp; float_quantize_method_ptr do_quantize = fdct->float_quantize; + workspace = fdct->float_workspace; sample_data += start_row; /* fold in the vertical offset once */ From 89e518a09877d5dc47da8ae71d6602cfede8d3ba Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Mar 2009 12:24:28 +0000 Subject: [PATCH 026/985] Add new simd files to Visual Studio project file. --- jpeg.dsp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jpeg.dsp b/jpeg.dsp index 27edabf7..37566e51 100644 --- a/jpeg.dsp +++ b/jpeg.dsp @@ -265,6 +265,10 @@ SOURCE=.\jquant2.c # End Source File # Begin Source File +SOURCE=.\jsimd.c +# End Source File +# Begin Source File + SOURCE=.\jutils.c # End Source File # End Group @@ -313,6 +317,14 @@ SOURCE=.\jpeglib.h # End Source File # Begin Source File +SOURCE=.\jsimd.h +# End Source File +# Begin Source File + +SOURCE=.\jsimddct.h +# End Source File +# Begin Source File + SOURCE=.\jversion.h # End Source File # End Group From de0008d00e5a9ee41862bf5c52d42ffeec5181be Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Fri, 13 Mar 2009 13:44:18 +0000 Subject: [PATCH 027/985] Revert r3657 (import of autogenerated) files. --- Makefile.in | 835 --- aclocal.m4 | 8827 --------------------------- config.guess | 1542 ----- config.h.in | 112 - config.sub | 1677 ------ configure | 15765 ------------------------------------------------- depcomp | 589 -- install-sh | 519 -- ltmain.sh | 8406 -------------------------- missing | 367 -- 10 files changed, 38639 deletions(-) delete mode 100644 Makefile.in delete mode 100644 aclocal.m4 delete mode 100755 config.guess delete mode 100644 config.h.in delete mode 100755 config.sub delete mode 100755 configure delete mode 100755 depcomp delete mode 100755 install-sh delete mode 100755 ltmain.sh delete mode 100755 missing diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 30ca8a34..00000000 --- a/Makefile.in +++ /dev/null @@ -1,835 +0,0 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WITH_SIMD_TRUE@am__append_1 = simd/jsimd.h simd/jsimdcfg.inc.h \ -@WITH_SIMD_TRUE@ simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ -@WITH_SIMD_TRUE@ simd/jsimdcpu.asm \ -@WITH_SIMD_TRUE@ simd/jccolmmx.asm simd/jdcolmmx.asm \ -@WITH_SIMD_TRUE@ simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ -@WITH_SIMD_TRUE@ simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ -@WITH_SIMD_TRUE@ simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ -@WITH_SIMD_TRUE@ simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ -@WITH_SIMD_TRUE@ simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ -@WITH_SIMD_TRUE@ simd/jccolss2.asm simd/jdcolss2.asm \ -@WITH_SIMD_TRUE@ simd/jcsamss2.asm simd/jdsamss2.asm simd/jdmerss2.asm \ -@WITH_SIMD_TRUE@ simd/jcqnts2i.asm simd/jfss2fst.asm simd/jfss2int.asm \ -@WITH_SIMD_TRUE@ simd/jiss2red.asm simd/jiss2int.asm simd/jiss2fst.asm \ -@WITH_SIMD_TRUE@ simd/jcqnts2f.asm simd/jiss2flt.asm - -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/jconfig.h.in $(top_srcdir)/configure config.guess \ - config.sub depcomp install-sh ltmain.sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h jconfig.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libjpeg_la_LIBADD = -am__libjpeg_la_SOURCES_DIST = jchuff.h jdct.h jdhuff.h jerror.h \ - jinclude.h jmemsys.h jmorecfg.h jpegint.h jpeglib.h jversion.h \ - jsimd.h jsimddct.h jcapimin.c jcapistd.c jccoefct.c jccolor.c \ - jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ - jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \ - jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c \ - jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c jsimd.c simd/jsimd.h simd/jsimdcfg.inc.h \ - simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ - simd/jsimdcpu.asm simd/jccolmmx.asm simd/jdcolmmx.asm \ - simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ - simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ - simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ - simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ - simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ - simd/jccolss2.asm simd/jdcolss2.asm simd/jcsamss2.asm \ - simd/jdsamss2.asm simd/jdmerss2.asm simd/jcqnts2i.asm \ - simd/jfss2fst.asm simd/jfss2int.asm simd/jiss2red.asm \ - simd/jiss2int.asm simd/jiss2fst.asm simd/jcqnts2f.asm \ - simd/jiss2flt.asm -am__objects_1 = -am__dirstamp = $(am__leading_dot)dirstamp -@WITH_SIMD_TRUE@am__objects_2 = simd/jsimdcpu.lo simd/jccolmmx.lo \ -@WITH_SIMD_TRUE@ simd/jdcolmmx.lo simd/jcsammmx.lo \ -@WITH_SIMD_TRUE@ simd/jdsammmx.lo simd/jdmermmx.lo \ -@WITH_SIMD_TRUE@ simd/jcqntmmx.lo simd/jfmmxfst.lo \ -@WITH_SIMD_TRUE@ simd/jfmmxint.lo simd/jimmxred.lo \ -@WITH_SIMD_TRUE@ simd/jimmxint.lo simd/jimmxfst.lo \ -@WITH_SIMD_TRUE@ simd/jcqnt3dn.lo simd/jf3dnflt.lo \ -@WITH_SIMD_TRUE@ simd/ji3dnflt.lo simd/jcqntsse.lo \ -@WITH_SIMD_TRUE@ simd/jfsseflt.lo simd/jisseflt.lo \ -@WITH_SIMD_TRUE@ simd/jccolss2.lo simd/jdcolss2.lo \ -@WITH_SIMD_TRUE@ simd/jcsamss2.lo simd/jdsamss2.lo \ -@WITH_SIMD_TRUE@ simd/jdmerss2.lo simd/jcqnts2i.lo \ -@WITH_SIMD_TRUE@ simd/jfss2fst.lo simd/jfss2int.lo \ -@WITH_SIMD_TRUE@ simd/jiss2red.lo simd/jiss2int.lo \ -@WITH_SIMD_TRUE@ simd/jiss2fst.lo simd/jcqnts2f.lo \ -@WITH_SIMD_TRUE@ simd/jiss2flt.lo -am_libjpeg_la_OBJECTS = $(am__objects_1) jcapimin.lo jcapistd.lo \ - jccoefct.lo jccolor.lo jcdctmgr.lo jchuff.lo jcinit.lo \ - jcmainct.lo jcmarker.lo jcmaster.lo jcomapi.lo jcparam.lo \ - jcphuff.lo jcprepct.lo jcsample.lo jctrans.lo jdapimin.lo \ - jdapistd.lo jdatadst.lo jdatasrc.lo jdcoefct.lo jdcolor.lo \ - jddctmgr.lo jdhuff.lo jdinput.lo jdmainct.lo jdmarker.lo \ - jdmaster.lo jdmerge.lo jdphuff.lo jdpostct.lo jdsample.lo \ - jdtrans.lo jerror.lo jfdctflt.lo jfdctfst.lo jfdctint.lo \ - jidctflt.lo jidctfst.lo jidctint.lo jidctred.lo jquant1.lo \ - jquant2.lo jutils.lo jmemmgr.lo jmemnobs.lo jsimd.lo \ - $(am__objects_2) -libjpeg_la_OBJECTS = $(am_libjpeg_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libjpeg_la_SOURCES) -DIST_SOURCES = $(am__libjpeg_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NAFLAGS = @NAFLAGS@ -NASM = @NASM@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libjpeg.la -HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ - jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h - -libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c \ - jccolor.c jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c \ - jcmaster.c jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c \ - jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c \ - jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c jsimd.c \ - $(am__append_1) -@WITH_SIMD_TRUE@BUILT_SOURCES = simd/jsimdcfg.inc -@WITH_SIMD_TRUE@EXTRA_DIST = nasm_lt.sh -all: $(BUILT_SOURCES) config.h jconfig.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .asm .c .lo .o .obj -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -jconfig.h: stamp-h2 - @if test ! -f $@; then \ - rm -f stamp-h2; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h2; \ - else :; fi - -stamp-h2: $(srcdir)/jconfig.h.in $(top_builddir)/config.status - @rm -f stamp-h2 - cd $(top_builddir) && $(SHELL) ./config.status jconfig.h - -distclean-hdr: - -rm -f config.h stamp-h1 jconfig.h stamp-h2 - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -simd/$(am__dirstamp): - @$(MKDIR_P) simd - @: > simd/$(am__dirstamp) -simd/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) simd/$(DEPDIR) - @: > simd/$(DEPDIR)/$(am__dirstamp) -simd/jsimdcpu.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jccolmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdcolmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcsammmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdsammmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdmermmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcqntmmx.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jfmmxfst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jfmmxint.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jimmxred.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jimmxint.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jimmxfst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcqnt3dn.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jf3dnflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/ji3dnflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcqntsse.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jfsseflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jisseflt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jccolss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdcolss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcsamss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdsamss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jdmerss2.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcqnts2i.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jfss2fst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jfss2int.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jiss2red.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jiss2int.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jiss2fst.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jcqnts2f.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -simd/jiss2flt.lo: simd/$(am__dirstamp) simd/$(DEPDIR)/$(am__dirstamp) -libjpeg.la: $(libjpeg_la_OBJECTS) $(libjpeg_la_DEPENDENCIES) - $(LINK) $(libjpeg_la_OBJECTS) $(libjpeg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f simd/jccolmmx.$(OBJEXT) - -rm -f simd/jccolmmx.lo - -rm -f simd/jccolss2.$(OBJEXT) - -rm -f simd/jccolss2.lo - -rm -f simd/jcqnt3dn.$(OBJEXT) - -rm -f simd/jcqnt3dn.lo - -rm -f simd/jcqntmmx.$(OBJEXT) - -rm -f simd/jcqntmmx.lo - -rm -f simd/jcqnts2f.$(OBJEXT) - -rm -f simd/jcqnts2f.lo - -rm -f simd/jcqnts2i.$(OBJEXT) - -rm -f simd/jcqnts2i.lo - -rm -f simd/jcqntsse.$(OBJEXT) - -rm -f simd/jcqntsse.lo - -rm -f simd/jcsammmx.$(OBJEXT) - -rm -f simd/jcsammmx.lo - -rm -f simd/jcsamss2.$(OBJEXT) - -rm -f simd/jcsamss2.lo - -rm -f simd/jdcolmmx.$(OBJEXT) - -rm -f simd/jdcolmmx.lo - -rm -f simd/jdcolss2.$(OBJEXT) - -rm -f simd/jdcolss2.lo - -rm -f simd/jdmermmx.$(OBJEXT) - -rm -f simd/jdmermmx.lo - -rm -f simd/jdmerss2.$(OBJEXT) - -rm -f simd/jdmerss2.lo - -rm -f simd/jdsammmx.$(OBJEXT) - -rm -f simd/jdsammmx.lo - -rm -f simd/jdsamss2.$(OBJEXT) - -rm -f simd/jdsamss2.lo - -rm -f simd/jf3dnflt.$(OBJEXT) - -rm -f simd/jf3dnflt.lo - -rm -f simd/jfmmxfst.$(OBJEXT) - -rm -f simd/jfmmxfst.lo - -rm -f simd/jfmmxint.$(OBJEXT) - -rm -f simd/jfmmxint.lo - -rm -f simd/jfss2fst.$(OBJEXT) - -rm -f simd/jfss2fst.lo - -rm -f simd/jfss2int.$(OBJEXT) - -rm -f simd/jfss2int.lo - -rm -f simd/jfsseflt.$(OBJEXT) - -rm -f simd/jfsseflt.lo - -rm -f simd/ji3dnflt.$(OBJEXT) - -rm -f simd/ji3dnflt.lo - -rm -f simd/jimmxfst.$(OBJEXT) - -rm -f simd/jimmxfst.lo - -rm -f simd/jimmxint.$(OBJEXT) - -rm -f simd/jimmxint.lo - -rm -f simd/jimmxred.$(OBJEXT) - -rm -f simd/jimmxred.lo - -rm -f simd/jiss2flt.$(OBJEXT) - -rm -f simd/jiss2flt.lo - -rm -f simd/jiss2fst.$(OBJEXT) - -rm -f simd/jiss2fst.lo - -rm -f simd/jiss2int.$(OBJEXT) - -rm -f simd/jiss2int.lo - -rm -f simd/jiss2red.$(OBJEXT) - -rm -f simd/jiss2red.lo - -rm -f simd/jisseflt.$(OBJEXT) - -rm -f simd/jisseflt.lo - -rm -f simd/jsimdcpu.$(OBJEXT) - -rm -f simd/jsimdcpu.lo - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcapimin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcapistd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jccoefct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jccolor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcdctmgr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jchuff.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcinit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmainct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmarker.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcmaster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcomapi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcparam.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcphuff.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcprepct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcsample.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jctrans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdapimin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdapistd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdatadst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdatasrc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdcoefct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdcolor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jddctmgr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdhuff.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdinput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmainct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmarker.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmaster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdmerge.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdphuff.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdpostct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdsample.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jdtrans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jerror.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctflt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctfst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jfdctint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctflt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctfst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctred.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmemmgr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmemnobs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jsimd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jutils.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf simd/.libs simd/_libs - -distclean-libtool: - -rm -f libtool config.lt - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) config.h.in jconfig.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in jconfig.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) config.h.in jconfig.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) config.h.in jconfig.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) config.h jconfig.h -installdirs: -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -rm -f simd/$(DEPDIR)/$(am__dirstamp) - -rm -f simd/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES ctags dist \ - dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ - dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - - -.asm.lo: - $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ - -simd/jsimdcfg.inc: simd/jsimdcfg.inc.h jpeglib.h jconfig.h jmorecfg.h - $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 9f5b503d..00000000 --- a/aclocal.m4 +++ /dev/null @@ -1,8827 +0,0 @@ -# generated automatically by aclocal 1.10.2 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, -[m4_warning([this file was generated for autoconf 2.63. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 56 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - -_LT_OUTPUT_LIBTOOL_INIT -]) - - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2008 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(lt_ECHO) -]) -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 will use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - xl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=echo - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${F77-"f77"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${FC-"f95"} - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC="$lt_save_CC" -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac -]) - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# Generated from ltversion.in. - -# serial 3012 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.2.6]) -m4_define([LT_PACKAGE_REVISION], [1.3012]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6' -macro_revision='1.3012' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 4 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.10' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10.2], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10.2])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 9 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 4 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[# Autoconf 2.62 quotes --file arguments for eval, but not when files -# are listed without --file. Let's play safe and only enable the eval -# if we detect the quoting. -case $CONFIG_FILES in -*\'*) eval set x "$CONFIG_FILES" ;; -*) set x $CONFIG_FILES ;; -esac -shift -for mf -do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 13 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.60])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([acinclude.m4]) diff --git a/config.guess b/config.guess deleted file mode 100755 index 7b24a872..00000000 --- a/config.guess +++ /dev/null @@ -1,1542 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2008-11-15' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[456]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd | genuineintel) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.h.in b/config.h.in deleted file mode 100644 index c4bd138f..00000000 --- a/config.h.in +++ /dev/null @@ -1,112 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define if your compiler supports prototypes */ -#undef HAVE_PROTOTYPES - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if the system has the type `unsigned char'. */ -#undef HAVE_UNSIGNED_CHAR - -/* Define to 1 if the system has the type `unsigned short'. */ -#undef HAVE_UNSIGNED_SHORT - -/* Define if you want use complete types */ -#undef INCOMPLETE_TYPES_BROKEN - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define if you have BSD-like bzero and bcopy */ -#undef NEED_BSD_STRINGS - -/* Define if you need short function names */ -#undef NEED_SHORT_EXTERNAL_NAMES - -/* Define if you have sys/types.h */ -#undef NEED_SYS_TYPES_H - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define if shift is unsigned */ -#undef RIGHT_SHIFT_IS_UNSIGNED - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Use accelerated SIMD routines. */ -#undef WITH_SIMD - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -# undef __CHAR_UNSIGNED__ -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `unsigned int' if does not define. */ -#undef size_t diff --git a/config.sub b/config.sub deleted file mode 100755 index 053e7381..00000000 --- a/config.sub +++ /dev/null @@ -1,1677 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2008-09-08' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/configure b/configure deleted file mode 100755 index 403175e3..00000000 --- a/configure +++ /dev/null @@ -1,15765 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for libjpeg 6.b. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='libjpeg' -PACKAGE_TARNAME='libjpeg' -PACKAGE_VERSION='6.b' -PACKAGE_STRING='libjpeg 6.b' -PACKAGE_BUGREPORT='' - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -WITH_SIMD_FALSE -WITH_SIMD_TRUE -NAFLAGS -NASM -IS_WIN32_FALSE -IS_WIN32_TRUE -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -lt_ECHO -RANLIB -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -LIBTOOL -CPP -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_dependency_tracking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -enable_libtool_lock -with_simd -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -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_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$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 ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - 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 ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --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=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -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=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -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_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures libjpeg 6.b to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/libjpeg] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --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 - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of libjpeg 6.b:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --without-simd Omit accelerated SIMD routines. - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -libjpeg configure 6.b -generated by GNU Autoconf 2.63 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by libjpeg $as_me 6.b, which was -generated by GNU Autoconf 2.63. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -am__api_version='1.10' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - -done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -$as_echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS - -fi - - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='libjpeg' - VERSION='6.b' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - -# Always build with prototypes - -cat >>confdefs.h <<\_ACEOF -#define HAVE_PROTOTYPES 1 -_ACEOF - -# Don't use undefined types - -cat >>confdefs.h <<\_ACEOF -#define INCOMPLETE_TYPES_BROKEN 1 -_ACEOF - - -# Checks for programs. -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - -# Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - fi - fi -fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - -# Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - -done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.2.6' -macro_revision='1.3012' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ $as_echo "$as_me:$LINENO: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -$as_echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:$LINENO: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -$as_echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - $as_unset ac_script || ac_script= - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 -$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if test "${lt_cv_nm_interface+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5453: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:5456: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:5459: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:$LINENO: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:$LINENO: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:$LINENO: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:$LINENO: result: ok" >&5 -$as_echo "ok" >&6; } -fi - - - - - - - - - - - - - - - - - - - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 6665 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - lt_cv_cc_needs_belf=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_cc_needs_belf=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:$LINENO: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - lt_cv_ld_exported_symbols_list=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_ld_exported_symbols_list=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - - -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_header in dlfcn.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:$LINENO: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - - - - - - - - - - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:$LINENO: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8282: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:8286: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8621: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:8625: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8726: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8730: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8781: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8785: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:$LINENO: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat >conftest.$ac_ext <<_ACEOF -int foo(void) {} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then - shlibpath_overrides_runpath=yes -fi - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_dl_dlopen=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - { $as_echo "$as_me:$LINENO: checking for shl_load" >&5 -$as_echo_n "checking for shl_load... " >&6; } -if test "${ac_cv_func_shl_load+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_shl_load || defined __stub___shl_load -choke me -#endif - -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_func_shl_load=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_shl_load=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -$as_echo "$ac_cv_func_shl_load" >&6; } -if test "x$ac_cv_func_shl_load" = x""yes; then - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_dld_shl_load=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_shl_load=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - { $as_echo "$as_me:$LINENO: checking for dlopen" >&5 -$as_echo_n "checking for dlopen... " >&6; } -if test "${ac_cv_func_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_dlopen || defined __stub___dlopen -choke me -#endif - -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_func_dlopen=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_dlopen=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -$as_echo "$ac_cv_func_dlopen" >&6; } -if test "x$ac_cv_func_dlopen" = x""yes; then - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_dl_dlopen=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_svld_dlopen=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_svld_dlopen=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_dld_dld_link=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_dld_link=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 11584 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 11680 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:$LINENO: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - -{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - - -# Checks for libraries. - -# Checks for header files. -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - - - -for ac_header in stddef.h stdlib.h string.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -if test "${ac_cv_header_sys_types_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5 -$as_echo_n "checking for sys/types.h... " >&6; } -if test "${ac_cv_header_sys_types_h+set}" = set; then - $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 -$as_echo "$ac_cv_header_sys_types_h" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking sys/types.h usability" >&5 -$as_echo_n "checking sys/types.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking sys/types.h presence" >&5 -$as_echo_n "checking sys/types.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: sys/types.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: sys/types.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: sys/types.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: sys/types.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: sys/types.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: sys/types.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5 -$as_echo_n "checking for sys/types.h... " >&6; } -if test "${ac_cv_header_sys_types_h+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_header_sys_types_h=$ac_header_preproc -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 -$as_echo "$ac_cv_header_sys_types_h" >&6; } - -fi -if test "x$ac_cv_header_sys_types_h" = x""yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_SYS_TYPES_H 1 -_ACEOF - -fi - - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_const=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const /**/ -_ACEOF - -fi - - -{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5 -$as_echo_n "checking whether char is unsigned... " >&6; } -if test "${ac_cv_c_char_unsigned+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((char) -1) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_char_unsigned=no -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_char_unsigned=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 -$as_echo "$ac_cv_c_char_unsigned" >&6; } -if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then - cat >>confdefs.h <<\_ACEOF -#define __CHAR_UNSIGNED__ 1 -_ACEOF - -fi - -{ $as_echo "$as_me:$LINENO: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_inline=$ac_kw -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 -$as_echo_n "checking for size_t... " >&6; } -if test "${ac_cv_type_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_type_size_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof ((size_t))) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -$as_echo "$ac_cv_type_size_t" >&6; } -if test "x$ac_cv_type_size_t" = x""yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -{ $as_echo "$as_me:$LINENO: checking for unsigned char" >&5 -$as_echo_n "checking for unsigned char... " >&6; } -if test "${ac_cv_type_unsigned_char+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_type_unsigned_char=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (unsigned char)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof ((unsigned char))) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned_char=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_char" >&5 -$as_echo "$ac_cv_type_unsigned_char" >&6; } -if test "x$ac_cv_type_unsigned_char" = x""yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UNSIGNED_CHAR 1 -_ACEOF - - -fi -{ $as_echo "$as_me:$LINENO: checking for unsigned short" >&5 -$as_echo_n "checking for unsigned short... " >&6; } -if test "${ac_cv_type_unsigned_short+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_type_unsigned_short=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (unsigned short)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof ((unsigned short))) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned_short=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5 -$as_echo "$ac_cv_type_unsigned_short" >&6; } -if test "x$ac_cv_type_unsigned_short" = x""yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UNSIGNED_SHORT 1 -_ACEOF - - -fi - - -{ $as_echo "$as_me:$LINENO: checking if right shift is signed" >&5 -$as_echo_n "checking if right shift is signed... " >&6; } -if test "$cross_compiling" = yes; then - { $as_echo "$as_me:$LINENO: result: Assuming that right shift is signed on target machine." >&5 -$as_echo "Assuming that right shift is signed on target machine." >&6; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - int is_shifting_signed (long arg) { - long res = arg >> 4; - - if (res == -0x7F7E80CL) - return 1; /* right shift is signed */ - - /* see if unsigned-shift hack will fix it. */ - /* we can't just test exact value since it depends on width of long... */ - res |= (~0L) << (32-4); - if (res == -0x7F7E80CL) - return 0; /* right shift is unsigned */ - - printf("Right shift isn't acting as I expect it to.\n"); - printf("I fear the JPEG software will not work at all.\n\n"); - return 0; /* try it with unsigned anyway */ - } - int main (void) { - exit(is_shifting_signed(-0x7F7E80B1L)); - } -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define RIGHT_SHIFT_IS_UNSIGNED 1 -_ACEOF - -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - -# test whether global names are unique to at least 15 chars -{ $as_echo "$as_me:$LINENO: checking for short external names" >&5 -$as_echo_n "checking for short external names... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int possibly_duplicate_function () { return 0; } - int possibly_dupli_function () { return 1; } -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - { $as_echo "$as_me:$LINENO: result: ok" >&5 -$as_echo "ok" >&6; } -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: short" >&5 -$as_echo "short" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define NEED_SHORT_EXTERNAL_NAMES 1 -_ACEOF - -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -# Checks for library functions. - - -for ac_func in memset memcpy -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - -cat >>confdefs.h <<\_ACEOF -#define NEED_BSD_STRINGS 1 -_ACEOF - -fi -done - - -# Set flags to indicate platform -case "$host_os" in - cygwin* | mingw* | pw32* | interix*) - is_win32=1 - ;; -esac - if test "x$is_win32" = "x1"; then - IS_WIN32_TRUE= - IS_WIN32_FALSE='#' -else - IS_WIN32_TRUE='#' - IS_WIN32_FALSE= -fi - - -# SIMD is optional - -# Check whether --with-simd was given. -if test "${with_simd+set}" = set; then - withval=$with_simd; -fi - -if test "x${with_simd}" != "xno"; then - # Check if we're on a supported CPU - { $as_echo "$as_me:$LINENO: checking if host cpu type is i386 or compatible" >&5 -$as_echo_n "checking if host cpu type is i386 or compatible... " >&6; } - case "$host_cpu" in - i*86 | x86 | ia32) - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - - -for ac_prog in nasm nasmw -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NASM+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$NASM"; then - ac_cv_prog_NASM="$NASM" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NASM="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -NASM=$ac_cv_prog_NASM -if test -n "$NASM"; then - { $as_echo "$as_me:$LINENO: result: $NASM" >&5 -$as_echo "$NASM" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$NASM" && break -done - -test -z "$NASM" && { { $as_echo "$as_me:$LINENO: error: no nasm (Netwide Assembler) found" >&5 -$as_echo "$as_me: error: no nasm (Netwide Assembler) found" >&2;} - { (exit 1); exit 1; }; } - -{ $as_echo "$as_me:$LINENO: checking for object file format of host system" >&5 -$as_echo_n "checking for object file format of host system... " >&6; } -case "$host_os" in - cygwin* | mingw* | pw32* | interix*) - objfmt='Win32-COFF' - ;; - msdosdjgpp* | go32*) - objfmt='COFF' - ;; - os2-emx*) # not tested - objfmt='MSOMF' # obj - ;; - linux*coff* | linux*oldld*) - objfmt='COFF' # ??? - ;; - linux*aout*) - objfmt='a.out' - ;; - linux*) - objfmt='ELF' - ;; - freebsd* | netbsd* | openbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - objfmt='BSD-a.out' - else - objfmt='ELF' - fi - ;; - solaris* | sunos* | sysv* | sco*) - objfmt='ELF' - ;; - darwin* | rhapsody* | nextstep* | openstep* | macos*) - objfmt='Mach-O' - ;; - *) - objfmt='ELF ?' - ;; -esac - -{ $as_echo "$as_me:$LINENO: result: $objfmt" >&5 -$as_echo "$objfmt" >&6; } -if test "$objfmt" = 'ELF ?'; then - objfmt='ELF' - { $as_echo "$as_me:$LINENO: WARNING: unexpected host system. assumed that the format is $objfmt." >&5 -$as_echo "$as_me: WARNING: unexpected host system. assumed that the format is $objfmt." >&2;} -fi - -{ $as_echo "$as_me:$LINENO: checking for object file format specifier (NAFLAGS) " >&5 -$as_echo_n "checking for object file format specifier (NAFLAGS) ... " >&6; } -case "$objfmt" in - MSOMF) NAFLAGS='-fobj -DOBJ32';; - Win32-COFF) NAFLAGS='-fwin32 -DWIN32';; - COFF) NAFLAGS='-fcoff -DCOFF';; - a.out) NAFLAGS='-faout -DAOUT';; - BSD-a.out) NAFLAGS='-faoutb -DAOUT';; - ELF) NAFLAGS='-felf -DELF';; - RDF) NAFLAGS='-frdf -DRDF';; - Mach-O) NAFLAGS='-fmacho -DMACHO';; -esac -{ $as_echo "$as_me:$LINENO: result: $NAFLAGS" >&5 -$as_echo "$NAFLAGS" >&6; } - - -{ $as_echo "$as_me:$LINENO: checking whether the assembler ($NASM $NAFLAGS) works" >&5 -$as_echo_n "checking whether the assembler ($NASM $NAFLAGS) works... " >&6; } -cat > conftest.asm <&5 - (eval $try_nasm) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest.o; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - echo "configure: failed program was:" >&5 - cat conftest.asm >&5 - rm -rf conftest* - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:$LINENO: error: installation or configuration problem: assembler cannot create object files." >&5 -$as_echo "$as_me: error: installation or configuration problem: assembler cannot create object files." >&2;} - { (exit 1); exit 1; }; } -fi - -{ $as_echo "$as_me:$LINENO: checking whether the linker accepts assembler output" >&5 -$as_echo_n "checking whether the linker accepts assembler output... " >&6; } -try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&5' -if { (eval echo "$as_me:$LINENO: \"$try_nasm\"") >&5 - (eval $try_nasm) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - rm -rf conftest* - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - rm -rf conftest* - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:$LINENO: error: configuration problem: maybe object file format mismatch." >&5 -$as_echo "$as_me: error: configuration problem: maybe object file format mismatch." >&2;} - { (exit 1); exit 1; }; } -fi - - - -cat >>confdefs.h <<\_ACEOF -#define WITH_SIMD 1 -_ACEOF - - ;; - *) - { $as_echo "$as_me:$LINENO: result: no (\"$host_cpu\")" >&5 -$as_echo "no (\"$host_cpu\")" >&6; } - with_simd=no - ;; - esac -fi - if test "x$with_simd" != "xno"; then - WITH_SIMD_TRUE= - WITH_SIMD_FALSE='#' -else - WITH_SIMD_TRUE='#' - WITH_SIMD_FALSE= -fi - - -# jconfig.h is the file we use, but we have another before that to -# fool autoheader. the reason is that we include this header in our -# API headers, which can screw things up for users of the lib. -# jconfig.h is a minimal version that allows this package to be built -ac_config_headers="$ac_config_headers config.h" - -ac_config_headers="$ac_config_headers jconfig.h" - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${IS_WIN32_TRUE}" && test -z "${IS_WIN32_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"IS_WIN32\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"IS_WIN32\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${WITH_SIMD_TRUE}" && test -z "${WITH_SIMD_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_SIMD\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"WITH_SIMD\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by libjpeg $as_me 6.b, which was -generated by GNU Autoconf 2.63. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTION]... [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -libjpeg config.status 6.b -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2008 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -AR \ -AR_FLAGS \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ -lt_prog_compiler_pic \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -fix_srcfile_path \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "jconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS jconfig.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=' ' -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || # Autoconf 2.62 quotes --file arguments for eval, but not when files -# are listed without --file. Let's play safe and only enable the eval -# if we detect the quoting. -case $CONFIG_FILES in -*\'*) eval set x "$CONFIG_FILES" ;; -*) set x $CONFIG_FILES ;; -esac -shift -for mf -do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/depcomp b/depcomp deleted file mode 100755 index e5f9736c..00000000 --- a/depcomp +++ /dev/null @@ -1,589 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2007-03-29.01 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software -# Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/install-sh b/install-sh deleted file mode 100755 index a5897de6..00000000 --- a/install-sh +++ /dev/null @@ -1,519 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2006-12-25.00 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/ltmain.sh b/ltmain.sh deleted file mode 100755 index 6939dcc4..00000000 --- a/ltmain.sh +++ /dev/null @@ -1,8406 +0,0 @@ -# Generated from ltmain.m4sh. - -# ltmain.sh (GNU libtool) 2.2.6 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=2.2.6 -TIMESTAMP="" -package_revision=1.3012 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done - -$lt_unset CDPATH - - - - - -: ${CP="cp -f"} -: ${ECHO="echo"} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -# Generated shell functions inserted here. - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: -func_dirname_and_basename "$progpath" -progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname${mode+: }$mode: $*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` - done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "X$my_tmpdir" | $Xsed -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - - - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $SED -n '/^# Usage:/,/# -h/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - $ECHO - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help -# Echo long help message to standard output and exit. -func_help () -{ - $SED -n '/^# Usage:/,/# Report bugs to/ { - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - }' < "$progpath" - exit $? -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - func_error "missing argument for $1" - exit_cmd=exit -} - -exit_cmd=: - - - - - -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - case "$@ " in - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T <?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - removelist="$removelist $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { -test "$mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$mode'" - ;; - esac - - $ECHO - $ECHO "Try \`$progname --help' for more information about other modes." - - exit $? -} - - # Now that we've collected a possible --mode arg, show help if necessary - $opt_help && func_mode_help - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - $ECHO "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - $ECHO "X----------------------------------------------------------------------" | $Xsed - $ECHO "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - $ECHO - $ECHO "If you ever happen to want to link against installed libraries" - $ECHO "in a given directory, LIBDIR, you must either use libtool, and" - $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" - $ECHO "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" - $ECHO " during execution" - fi - if test -n "$runpath_var"; then - $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" - $ECHO " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $ECHO - - $ECHO "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" - $ECHO "pages." - ;; - *) - $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - $ECHO "X----------------------------------------------------------------------" | $Xsed - exit $EXIT_SUCCESS -} - -test "$mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $ECHO "X$nonopt" | $GREP shtool >/dev/null; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - $ECHO >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - $ECHO >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - - -# func_emit_wrapper_part1 [arg=no] -# -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () -{ - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $ECHO "\ - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} -# end: func_emit_wrapper_part2 - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} - - -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result="" - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" - fi - fi - fi - IFS=: - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result" ; then - func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -# define setmode _setmode -#else -# include -# include -# ifdef __CYGWIN__ -# include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} -#else -# define LTWRAPPER_DEBUGPRINTF(args) -#endif - -const char *program_name = NULL; - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = -EOF - - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" - cat <"))); - for (i = 0; i < newargc; i++) - { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); - } - -EOF - - case $host_os in - mingw*) - cat <<"EOF" - /* execv doesn't actually work on mingw as expected on unix */ - rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); - if (rval == -1) - { - /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); - return 127; - } - return rval; -EOF - ;; - *) - cat <<"EOF" - execv (lt_argv_zero, newargz); - return rval; /* =127, but avoids unused variable warning */ -EOF - ;; - esac - - cat <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void *p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), - string) : NULL; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char) name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable (const char *path) -{ - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal ("Could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} - -void -lt_setenv (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - - -EOF -} -# end: func_emit_cwrapperexe_src - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - weak_libs="$weak_libs $arg" - prev= - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_duplicate_deps ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - case $lib in - *.la) func_source "$lib" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` - case " $weak_libs " in - *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - dir=$func_stripname_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $ECHO - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." - else - $ECHO - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $ECHO - $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_dirname "$deplib" "" "." - dir="$func_dirname_result" - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - $ECHO - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $ECHO - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $ECHO - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` - done - fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO - if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." - else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." - fi - $ECHO "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output - for obj in $save_libobjs - do - $ECHO "$obj" >> $output - done - $ECHO ')' >> $output - delfiles="$delfiles $output" - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - $ECHO "$obj" >> $output - done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - delfiles="$delfiles $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $ECHO "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" - ;; - *) newdlfiles="$newdlfiles $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$mode" = link || test "$mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$mode" = uninstall || test "$mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/missing b/missing deleted file mode 100755 index 1c8ff704..00000000 --- a/missing +++ /dev/null @@ -1,367 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2006-05-10.23 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case $1 in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $1 in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: From de4b417a81f85b2832bbef6d7d20e67260c2c008 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Fri, 13 Mar 2009 13:58:44 +0000 Subject: [PATCH 028/985] Make source compilable via GNU autotools which are part of RHEL 5. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 683ca7e7..ea03c740 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ([2.61]) +AC_PREREQ([2.57]) AC_INIT([libjpeg], [6.b]) AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) From 98d1d692b5bb9849a3dee9c104082c19fc498341 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 14 Mar 2009 01:21:13 +0000 Subject: [PATCH 029/985] Fix broken buffered I/O (to make cjpeg work) --- jchuff.c | 14 +++++++------- jdatadst.c | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/jchuff.c b/jchuff.c index 94a66c5a..23b29b8b 100644 --- a/jchuff.c +++ b/jchuff.c @@ -311,6 +311,8 @@ dump_buffer (working_state * state) { struct jpeg_destination_mgr * dest = state->cinfo->dest; + dest->free_in_buffer = state->free_in_buffer; + if (! (*dest->empty_output_buffer) (state->cinfo)) return FALSE; /* After a successful buffer dump, must reset buffer pointers */ @@ -380,8 +382,10 @@ flush_bits (working_state * state) unsigned char *buffer; int put_buffer, put_bits; - if ((state)->free_in_buffer < DCTSIZE2 * 2) + if ((state)->free_in_buffer < 1) if (! dump_buffer(state)) return FALSE; + if ((state)->free_in_buffer < 1) + ERREXIT(state->cinfo, JERR_BUFFER_SIZE); buffer = state->next_output_byte; put_buffer = state->cur.put_buffer; @@ -394,9 +398,6 @@ flush_bits (working_state * state) state->free_in_buffer -= (buffer - state->next_output_byte); state->next_output_byte = buffer; - if ((state)->free_in_buffer < DCTSIZE2 * 2) - if (! dump_buffer(state)) return FALSE; - return TRUE; } @@ -415,6 +416,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, if ((state)->free_in_buffer < DCTSIZE2 * 2) if (! dump_buffer(state)) return FALSE; + if ((state)->free_in_buffer < DCTSIZE2 * 2) + ERREXIT(state->cinfo, JERR_BUFFER_SIZE); buffer = state->next_output_byte; put_buffer = state->cur.put_buffer; @@ -474,9 +477,6 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, state->free_in_buffer -= (buffer - state->next_output_byte); state->next_output_byte = buffer; - if ((state)->free_in_buffer < DCTSIZE2 * 2) - if (! dump_buffer(state)) return FALSE; - return TRUE; } diff --git a/jdatadst.c b/jdatadst.c index a8f6fb0e..b8748154 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -82,8 +82,9 @@ empty_output_buffer (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != - (size_t) OUTPUT_BUF_SIZE) + if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE + - dest->pub.free_in_buffer) != + (size_t) (OUTPUT_BUF_SIZE - dest->pub.free_in_buffer)) ERREXIT(cinfo, JERR_FILE_WRITE); dest->pub.next_output_byte = dest->buffer; From a63544a357b023af6bc5e141711b08c80ec2882b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 16 Mar 2009 13:34:18 +0000 Subject: [PATCH 030/985] Work around subdirectory bug in older automake. Older versions of automake doesn't properly support no-recursive make. Reimplement the build system by having a local Makefile.am in the simd/ directory. --- Makefile.am | 26 ++------------------------ configure.ac | 2 +- simd/Makefile.am | 27 +++++++++++++++++++++++++++ simd/jccolmmx.asm | 4 ++-- simd/jccolss2.asm | 4 ++-- simd/jcqnt3dn.asm | 4 ++-- simd/jcqntmmx.asm | 4 ++-- simd/jcqnts2f.asm | 4 ++-- simd/jcqnts2i.asm | 4 ++-- simd/jcqntsse.asm | 4 ++-- simd/jcsammmx.asm | 2 +- simd/jcsamss2.asm | 2 +- simd/jdcolmmx.asm | 4 ++-- simd/jdcolss2.asm | 4 ++-- simd/jdmermmx.asm | 4 ++-- simd/jdmerss2.asm | 4 ++-- simd/jdsammmx.asm | 2 +- simd/jdsamss2.asm | 2 +- simd/jf3dnflt.asm | 4 ++-- simd/jfmmxfst.asm | 4 ++-- simd/jfmmxint.asm | 4 ++-- simd/jfss2fst.asm | 4 ++-- simd/jfss2int.asm | 4 ++-- simd/jfsseflt.asm | 4 ++-- simd/ji3dnflt.asm | 4 ++-- simd/jimmxfst.asm | 4 ++-- simd/jimmxint.asm | 4 ++-- simd/jimmxred.asm | 4 ++-- simd/jiss2flt.asm | 4 ++-- simd/jiss2fst.asm | 4 ++-- simd/jiss2int.asm | 4 ++-- simd/jiss2red.asm | 4 ++-- simd/jisseflt.asm | 4 ++-- simd/jsimdcpu.asm | 2 +- simd/jsimdext.inc | 2 +- nasm_lt.sh => simd/nasm_lt.sh | 0 36 files changed, 88 insertions(+), 83 deletions(-) create mode 100644 simd/Makefile.am rename nasm_lt.sh => simd/nasm_lt.sh (100%) diff --git a/Makefile.am b/Makefile.am index 7f67542e..1d868b7b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,30 +15,8 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ if WITH_SIMD -BUILT_SOURCES = simd/jsimdcfg.inc - -EXTRA_DIST = nasm_lt.sh - -libjpeg_la_SOURCES += simd/jsimd.h simd/jsimdcfg.inc.h \ - simd/jsimdext.inc simd/jcolsamp.inc simd/jdct.inc \ - simd/jsimdcpu.asm \ - simd/jccolmmx.asm simd/jdcolmmx.asm \ - simd/jcsammmx.asm simd/jdsammmx.asm simd/jdmermmx.asm \ - simd/jcqntmmx.asm simd/jfmmxfst.asm simd/jfmmxint.asm \ - simd/jimmxred.asm simd/jimmxint.asm simd/jimmxfst.asm \ - simd/jcqnt3dn.asm simd/jf3dnflt.asm simd/ji3dnflt.asm \ - simd/jcqntsse.asm simd/jfsseflt.asm simd/jisseflt.asm \ - simd/jccolss2.asm simd/jdcolss2.asm \ - simd/jcsamss2.asm simd/jdsamss2.asm simd/jdmerss2.asm \ - simd/jcqnts2i.asm simd/jfss2fst.asm simd/jfss2int.asm \ - simd/jiss2red.asm simd/jiss2int.asm simd/jiss2fst.asm \ - simd/jcqnts2f.asm simd/jiss2flt.asm +SUBDIRS = simd +libjpeg_la_LIBADD = simd/libsimd.la endif -.asm.lo: - $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ - -simd/jsimdcfg.inc: simd/jsimdcfg.inc.h jpeglib.h jconfig.h jmorecfg.h - $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ - diff --git a/configure.ac b/configure.ac index ea03c740..8c23a501 100644 --- a/configure.ac +++ b/configure.ac @@ -107,5 +107,5 @@ AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) # jconfig.h is a minimal version that allows this package to be built AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([jconfig.h]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile simd/Makefile]) AC_OUTPUT diff --git a/simd/Makefile.am b/simd/Makefile.am new file mode 100644 index 00000000..ea53fee4 --- /dev/null +++ b/simd/Makefile.am @@ -0,0 +1,27 @@ +noinst_LTLIBRARIES = libsimd.la + +BUILT_SOURCES = jsimdcfg.inc + +EXTRA_DIST = nasm_lt.sh + +libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ + jsimdext.inc jcolsamp.inc jdct.inc \ + jsimdcpu.asm \ + jccolmmx.asm jdcolmmx.asm \ + jcsammmx.asm jdsammmx.asm jdmermmx.asm \ + jcqntmmx.asm jfmmxfst.asm jfmmxint.asm \ + jimmxred.asm jimmxint.asm jimmxfst.asm \ + jcqnt3dn.asm jf3dnflt.asm ji3dnflt.asm \ + jcqntsse.asm jfsseflt.asm jisseflt.asm \ + jccolss2.asm jdcolss2.asm \ + jcsamss2.asm jdsamss2.asm jdmerss2.asm \ + jcqnts2i.asm jfss2fst.asm jfss2int.asm \ + jiss2red.asm jiss2int.asm jiss2fst.asm \ + jcqnts2f.asm jiss2flt.asm + +.asm.lo: + $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ + +jsimdcfg.inc: jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h + $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ + diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm index 701a3271..340af00a 100644 --- a/simd/jccolmmx.asm +++ b/simd/jccolmmx.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index 99473b65..c13f89e2 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -13,8 +13,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jcqnt3dn.asm b/simd/jcqnt3dn.asm index bc9b0273..194b7f9b 100644 --- a/simd/jcqnt3dn.asm +++ b/simd/jcqnt3dn.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcqntmmx.asm b/simd/jcqntmmx.asm index 6096eaa9..fa54902a 100644 --- a/simd/jcqntmmx.asm +++ b/simd/jcqntmmx.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcqnts2f.asm b/simd/jcqnts2f.asm index eef547a6..19c1d017 100644 --- a/simd/jcqnts2f.asm +++ b/simd/jcqnts2f.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcqnts2i.asm b/simd/jcqnts2i.asm index 7414e41a..404ae957 100644 --- a/simd/jcqnts2i.asm +++ b/simd/jcqnts2i.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcqntsse.asm b/simd/jcqntsse.asm index da7a3ff6..0f412d7e 100644 --- a/simd/jcqntsse.asm +++ b/simd/jcqntsse.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcsammmx.asm b/simd/jcsammmx.asm index 5de36372..982a6e0d 100644 --- a/simd/jcsammmx.asm +++ b/simd/jcsammmx.asm @@ -16,7 +16,7 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" +%include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jcsamss2.asm b/simd/jcsamss2.asm index ec2df9ae..98e97da4 100644 --- a/simd/jcsamss2.asm +++ b/simd/jcsamss2.asm @@ -16,7 +16,7 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" +%include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm index 33d50634..742c9ceb 100644 --- a/simd/jdcolmmx.asm +++ b/simd/jdcolmmx.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm index 3fd591b5..6f74cc63 100644 --- a/simd/jdcolss2.asm +++ b/simd/jdcolss2.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm index 8d82e40a..8ebe243d 100644 --- a/simd/jdmermmx.asm +++ b/simd/jdmermmx.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm index c0804ecd..8a7c68f0 100644 --- a/simd/jdmerss2.asm +++ b/simd/jdmerss2.asm @@ -16,8 +16,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jcolsamp.inc" +%include "jsimdext.inc" +%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdsammmx.asm b/simd/jdsammmx.asm index f061ee93..e05d540e 100644 --- a/simd/jdsammmx.asm +++ b/simd/jdsammmx.asm @@ -16,7 +16,7 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" +%include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_CONST diff --git a/simd/jdsamss2.asm b/simd/jdsamss2.asm index bd967dba..7d787f1c 100644 --- a/simd/jdsamss2.asm +++ b/simd/jdsamss2.asm @@ -16,7 +16,7 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" +%include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_CONST diff --git a/simd/jf3dnflt.asm b/simd/jf3dnflt.asm index 30d33403..ed7e6a0b 100644 --- a/simd/jf3dnflt.asm +++ b/simd/jf3dnflt.asm @@ -20,8 +20,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_CONST diff --git a/simd/jfmmxfst.asm b/simd/jfmmxfst.asm index 46556b13..3511457d 100644 --- a/simd/jfmmxfst.asm +++ b/simd/jfmmxfst.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jfmmxint.asm b/simd/jfmmxint.asm index 87935a97..e018e6bf 100644 --- a/simd/jfmmxint.asm +++ b/simd/jfmmxint.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jfss2fst.asm b/simd/jfss2fst.asm index e42d2251..f0ad9621 100644 --- a/simd/jfss2fst.asm +++ b/simd/jfss2fst.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jfss2int.asm b/simd/jfss2int.asm index 6e37497c..5338db32 100644 --- a/simd/jfss2int.asm +++ b/simd/jfss2int.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jfsseflt.asm b/simd/jfsseflt.asm index 6469f3c4..9b8d04ce 100644 --- a/simd/jfsseflt.asm +++ b/simd/jfsseflt.asm @@ -20,8 +20,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/ji3dnflt.asm b/simd/ji3dnflt.asm index 0f5cbd81..6c9abca7 100644 --- a/simd/ji3dnflt.asm +++ b/simd/ji3dnflt.asm @@ -20,8 +20,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- SECTION SEG_CONST diff --git a/simd/jimmxfst.asm b/simd/jimmxfst.asm index 662a522f..e5802ace 100644 --- a/simd/jimmxfst.asm +++ b/simd/jimmxfst.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jimmxint.asm b/simd/jimmxint.asm index 775b1e8c..563f41c5 100644 --- a/simd/jimmxint.asm +++ b/simd/jimmxint.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jimmxred.asm b/simd/jimmxred.asm index a5ad52bc..4ee34a0a 100644 --- a/simd/jimmxred.asm +++ b/simd/jimmxred.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jiss2flt.asm b/simd/jiss2flt.asm index 6bb429a2..fc9e21a2 100644 --- a/simd/jiss2flt.asm +++ b/simd/jiss2flt.asm @@ -20,8 +20,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jiss2fst.asm b/simd/jiss2fst.asm index aafa8101..fda073f5 100644 --- a/simd/jiss2fst.asm +++ b/simd/jiss2fst.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jiss2int.asm b/simd/jiss2int.asm index 4122c640..d568dada 100644 --- a/simd/jiss2int.asm +++ b/simd/jiss2int.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jiss2red.asm b/simd/jiss2red.asm index b31346a8..10046e9a 100644 --- a/simd/jiss2red.asm +++ b/simd/jiss2red.asm @@ -21,8 +21,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jisseflt.asm b/simd/jisseflt.asm index 6de93ada..db9d1a39 100644 --- a/simd/jisseflt.asm +++ b/simd/jisseflt.asm @@ -20,8 +20,8 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" -%include "simd/jdct.inc" +%include "jsimdext.inc" +%include "jdct.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index 7838e27a..31f2a6ac 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -16,7 +16,7 @@ ; ; [TAB8] -%include "simd/jsimdext.inc" +%include "jsimdext.inc" ; -------------------------------------------------------------------------- SECTION SEG_TEXT diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 8bbf64eb..d82b970e 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -272,6 +272,6 @@ const_base: ; -------------------------------------------------------------------------- ; Defines picked up from the C headers ; -%include "simd/jsimdcfg.inc" +%include "jsimdcfg.inc" ; -------------------------------------------------------------------------- diff --git a/nasm_lt.sh b/simd/nasm_lt.sh similarity index 100% rename from nasm_lt.sh rename to simd/nasm_lt.sh From bf9f8d041b2db268a1b05ac0fc7454347da977d6 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 16 Mar 2009 23:58:30 +0000 Subject: [PATCH 031/985] Eliminate backward incompatibility that required empty_output_buffer() to handle cases in which the buffer wasn't 100% full --- jchuff.c | 62 ++++++++++++++++++++++++++++++++++++++---------------- jdatadst.c | 5 ++--- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/jchuff.c b/jchuff.c index 23b29b8b..13afab22 100644 --- a/jchuff.c +++ b/jchuff.c @@ -42,6 +42,10 @@ int jpeg_first_bit_table_init=0; nbits = jpeg_first_bit_table[t&255]; \ if (t > 255) nbits = jpeg_first_bit_table[t>>8] + 8; +#ifndef min + #define min(a,b) ((a)<(b)?(a):(b)) +#endif + /* Expanded entropy encoder object for Huffman encoding. * * The savable_state subrecord contains fields that change within an MCU, @@ -375,28 +379,55 @@ dump_buffer (working_state * state) /***************************************************************/ +#define BUFSIZE (DCTSIZE2 * 2) + +#define LOAD_BUFFER() { \ + if (state->free_in_buffer < BUFSIZE) { \ + localbuf = 1; \ + buffer = _buffer; \ + } \ + else buffer = state->next_output_byte; \ + } + +#define STORE_BUFFER() { \ + if (localbuf) { \ + bytes = buffer - _buffer; \ + buffer = _buffer; \ + while (bytes > 0) { \ + bytestocopy = min(bytes, state->free_in_buffer); \ + MEMCOPY(state->next_output_byte, buffer, bytestocopy); \ + state->next_output_byte += bytestocopy; \ + buffer += bytestocopy; \ + state->free_in_buffer -= bytestocopy; \ + if (state->free_in_buffer == 0) \ + if (! dump_buffer(state)) return FALSE; \ + bytes -= bytestocopy; \ + } \ + } \ + else { \ + state->free_in_buffer -= (buffer - state->next_output_byte); \ + state->next_output_byte = buffer; \ + } \ + } + +/***************************************************************/ LOCAL(boolean) flush_bits (working_state * state) { - unsigned char *buffer; + unsigned char _buffer[BUFSIZE], *buffer; int put_buffer, put_bits; + int bytes, bytestocopy, localbuf = 0; - if ((state)->free_in_buffer < 1) - if (! dump_buffer(state)) return FALSE; - if ((state)->free_in_buffer < 1) - ERREXIT(state->cinfo, JERR_BUFFER_SIZE); - - buffer = state->next_output_byte; put_buffer = state->cur.put_buffer; put_bits = state->cur.put_bits; + LOAD_BUFFER() DUMP_BITS_(0x7F, 7) state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ state->cur.put_bits = 0; - state->free_in_buffer -= (buffer - state->next_output_byte); - state->next_output_byte = buffer; + STORE_BUFFER() return TRUE; } @@ -410,18 +441,14 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, int temp, temp2; int nbits; int r, sflag, size, code; - unsigned char *buffer; + unsigned char _buffer[BUFSIZE], *buffer; int put_buffer, put_bits; int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; + int bytes, bytestocopy, localbuf = 0; - if ((state)->free_in_buffer < DCTSIZE2 * 2) - if (! dump_buffer(state)) return FALSE; - if ((state)->free_in_buffer < DCTSIZE2 * 2) - ERREXIT(state->cinfo, JERR_BUFFER_SIZE); - - buffer = state->next_output_byte; put_buffer = state->cur.put_buffer; put_bits = state->cur.put_bits; + LOAD_BUFFER() /* Encode the DC coefficient difference per section F.1.2.1 */ @@ -474,8 +501,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, state->cur.put_buffer = put_buffer; state->cur.put_bits = put_bits; - state->free_in_buffer -= (buffer - state->next_output_byte); - state->next_output_byte = buffer; + STORE_BUFFER() return TRUE; } diff --git a/jdatadst.c b/jdatadst.c index b8748154..a8f6fb0e 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -82,9 +82,8 @@ empty_output_buffer (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE - - dest->pub.free_in_buffer) != - (size_t) (OUTPUT_BUF_SIZE - dest->pub.free_in_buffer)) + if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != + (size_t) OUTPUT_BUF_SIZE) ERREXIT(cinfo, JERR_FILE_WRITE); dest->pub.next_output_byte = dest->buffer; From 3901fbb143a0b97c160519ecfbce8b89966c0f57 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 1 Apr 2009 20:02:14 +0000 Subject: [PATCH 032/985] Fix build for RGB_PIXELSIZE==4 --- simd/jccolss2.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index c13f89e2..4d06bb89 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -242,12 +242,12 @@ EXTN(jsimd_rgb_ycc_convert_sse2): test cl, SIZEOF_XMMWORD/16 jz short .column_ld2 sub ecx, byte SIZEOF_XMMWORD/16 - movd xmmA, _DWORD [esi+ecx*RGB_PIXELSIZE] + movd xmmA, DWORD [esi+ecx*RGB_PIXELSIZE] .column_ld2: test cl, SIZEOF_XMMWORD/8 jz short .column_ld4 sub ecx, byte SIZEOF_XMMWORD/8 - movq xmmE, _MMWORD [esi+ecx*RGB_PIXELSIZE] + movq xmmE, MMWORD [esi+ecx*RGB_PIXELSIZE] pslldq xmmA, SIZEOF_MMWORD por xmmA,xmmE .column_ld4: From 6b7eeb745c039e1307dfde3b4c8ca8bdf24c8490 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 3 Apr 2009 11:27:17 +0000 Subject: [PATCH 033/985] Add environment variables to force MMX/SSE2 code path selection --- jsimd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jsimd.c b/jsimd.c index 32489116..7f81ddad 100644 --- a/jsimd.c +++ b/jsimd.c @@ -40,11 +40,18 @@ static unsigned int simd_support = ~0; LOCAL(void) init_simd (void) { +#ifdef WITH_SIMD + char *env = NULL; +#endif if (simd_support != ~0) return; #ifdef WITH_SIMD simd_support = jpeg_simd_cpu_support(); + if((env=getenv("JSIMD_FORCEMMX"))!=NULL && !strcmp(env, "1")) + simd_support = JSIMD_MMX; + else if((env=getenv("JSIMD_FORCESSE2"))!=NULL && !strcmp(env, "1")) + simd_support = JSIMD_SSE2; #else simd_support = JSIMD_NONE; #endif From f7e0f6d5f59643a741137aab45ebf21f001845f9 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 3 Apr 2009 12:00:51 +0000 Subject: [PATCH 034/985] Implement new colorspaces to allow directly compressing from/decompressing to RGB/RGBX/BGR/BGRX/XBGR/XRGB without conversion --- jccolor.c | 52 ++++- jcparam.c | 6 + jdcolor.c | 25 ++- jdmerge.c | 58 ++--- jmorecfg.h | 18 ++ jpeglib.h | 13 +- jquant1.c | 5 +- jquant2.c | 46 ++-- jsimd.c | 75 ++++++- simd/Makefile.am | 5 + simd/jcclrmmx.asm | 474 +++++++++++++++++++++++++++++++++++++++ simd/jcclrss2.asm | 500 +++++++++++++++++++++++++++++++++++++++++ simd/jccolmmx.asm | 523 ++++++------------------------------------- simd/jccolss2.asm | 551 ++++++---------------------------------------- simd/jdclrmmx.asm | 402 +++++++++++++++++++++++++++++++++ simd/jdclrss2.asm | 500 +++++++++++++++++++++++++++++++++++++++++ simd/jdcolmmx.asm | 439 ++++++------------------------------ simd/jdcolss2.asm | 537 ++++++-------------------------------------- simd/jsimd.h | 122 ++++++++++ 19 files changed, 2474 insertions(+), 1877 deletions(-) create mode 100644 simd/jcclrmmx.asm create mode 100644 simd/jcclrss2.asm create mode 100644 simd/jdclrmmx.asm create mode 100644 simd/jdclrss2.asm diff --git a/jccolor.c b/jccolor.c index 2407456c..f20ed9de 100644 --- a/jccolor.c +++ b/jccolor.c @@ -3,6 +3,7 @@ * * Copyright (C) 1991-1996, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright 2009 D. R. Commander * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -148,10 +149,10 @@ rgb_ycc_convert (j_compress_ptr cinfo, outptr2 = output_buf[2][output_row]; output_row++; for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[RGB_RED]); - g = GETJSAMPLE(inptr[RGB_GREEN]); - b = GETJSAMPLE(inptr[RGB_BLUE]); - inptr += RGB_PIXELSIZE; + r = GETJSAMPLE(inptr[rgb_red[cinfo->in_color_space]]); + g = GETJSAMPLE(inptr[rgb_green[cinfo->in_color_space]]); + b = GETJSAMPLE(inptr[rgb_blue[cinfo->in_color_space]]); + inptr += rgb_pixelsize[cinfo->in_color_space]; /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. * Hence the value being shifted is never negative, and we don't @@ -202,10 +203,10 @@ rgb_gray_convert (j_compress_ptr cinfo, outptr = output_buf[0][output_row]; output_row++; for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[RGB_RED]); - g = GETJSAMPLE(inptr[RGB_GREEN]); - b = GETJSAMPLE(inptr[RGB_BLUE]); - inptr += RGB_PIXELSIZE; + r = GETJSAMPLE(inptr[rgb_red[cinfo->in_color_space]]); + g = GETJSAMPLE(inptr[rgb_green[cinfo->in_color_space]]); + b = GETJSAMPLE(inptr[rgb_blue[cinfo->in_color_space]]); + inptr += rgb_pixelsize[cinfo->in_color_space]; /* Y */ outptr[col] = (JSAMPLE) ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) @@ -376,6 +377,16 @@ jinit_color_converter (j_compress_ptr cinfo) break; #endif /* else share code with YCbCr */ + case JCS_EXT_RGB: + case JCS_EXT_RGBX: + case JCS_EXT_BGR: + case JCS_EXT_BGRX: + case JCS_EXT_XBGR: + case JCS_EXT_XRGB: + if (cinfo->input_components != rgb_pixelsize[cinfo->in_color_space]) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; + case JCS_YCbCr: if (cinfo->input_components != 3) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); @@ -400,7 +411,13 @@ jinit_color_converter (j_compress_ptr cinfo) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); if (cinfo->in_color_space == JCS_GRAYSCALE) cconvert->pub.color_convert = grayscale_convert; - else if (cinfo->in_color_space == JCS_RGB) { + else if (cinfo->in_color_space == JCS_RGB || + cinfo->in_color_space == JCS_EXT_RGB || + cinfo->in_color_space == JCS_EXT_RGBX || + cinfo->in_color_space == JCS_EXT_BGR || + cinfo->in_color_space == JCS_EXT_BGRX || + cinfo->in_color_space == JCS_EXT_XBGR || + cinfo->in_color_space == JCS_EXT_XRGB) { cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = rgb_gray_convert; } else if (cinfo->in_color_space == JCS_YCbCr) @@ -410,9 +427,16 @@ jinit_color_converter (j_compress_ptr cinfo) break; case JCS_RGB: + case JCS_EXT_RGB: + case JCS_EXT_RGBX: + case JCS_EXT_BGR: + case JCS_EXT_BGRX: + case JCS_EXT_XBGR: + case JCS_EXT_XRGB: if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3) + if (cinfo->in_color_space == cinfo->jpeg_color_space && + rgb_pixelsize[cinfo->in_color_space] == 3) cconvert->pub.color_convert = null_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); @@ -421,7 +445,13 @@ jinit_color_converter (j_compress_ptr cinfo) case JCS_YCbCr: if (cinfo->num_components != 3) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_RGB) { + if (cinfo->in_color_space == JCS_RGB || + cinfo->in_color_space == JCS_EXT_RGB || + cinfo->in_color_space == JCS_EXT_RGBX || + cinfo->in_color_space == JCS_EXT_BGR || + cinfo->in_color_space == JCS_EXT_BGRX || + cinfo->in_color_space == JCS_EXT_XBGR || + cinfo->in_color_space == JCS_EXT_XRGB) { if (jsimd_can_rgb_ycc()) cconvert->pub.color_convert = jsimd_rgb_ycc_convert; else { diff --git a/jcparam.c b/jcparam.c index 6fc48f53..2954f635 100644 --- a/jcparam.c +++ b/jcparam.c @@ -363,6 +363,12 @@ jpeg_default_colorspace (j_compress_ptr cinfo) jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); break; case JCS_RGB: + case JCS_EXT_RGB: + case JCS_EXT_RGBX: + case JCS_EXT_BGR: + case JCS_EXT_BGRX: + case JCS_EXT_XBGR: + case JCS_EXT_XRGB: jpeg_set_colorspace(cinfo, JCS_YCbCr); break; case JCS_YCbCr: diff --git a/jdcolor.c b/jdcolor.c index d2d1483d..e1dd3ff5 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -148,12 +148,12 @@ ycc_rgb_convert (j_decompress_ptr cinfo, cb = GETJSAMPLE(inptr1[col]); cr = GETJSAMPLE(inptr2[col]); /* Range-limiting is essential due to noise introduced by DCT losses. */ - outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; - outptr[RGB_GREEN] = range_limit[y + + outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + Crrtab[cr]]; + outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS))]; - outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; - outptr += RGB_PIXELSIZE; + outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + Cbbtab[cb]]; + outptr += rgb_pixelsize[cinfo->out_color_space]; } } } @@ -229,8 +229,10 @@ gray_rgb_convert (j_decompress_ptr cinfo, outptr = *output_buf++; for (col = 0; col < num_cols; col++) { /* We can dispense with GETJSAMPLE() here */ - outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; - outptr += RGB_PIXELSIZE; + outptr[rgb_red[cinfo->out_color_space]] = + outptr[rgb_green[cinfo->out_color_space]] = + outptr[rgb_blue[cinfo->out_color_space]] = inptr[col]; + outptr += rgb_pixelsize[cinfo->out_color_space]; } } } @@ -358,7 +360,13 @@ jinit_color_deconverter (j_decompress_ptr cinfo) break; case JCS_RGB: - cinfo->out_color_components = RGB_PIXELSIZE; + case JCS_EXT_RGB: + case JCS_EXT_RGBX: + case JCS_EXT_BGR: + case JCS_EXT_BGRX: + case JCS_EXT_XBGR: + case JCS_EXT_XRGB: + cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space]; if (cinfo->jpeg_color_space == JCS_YCbCr) { if (jsimd_can_ycc_rgb()) cconvert->pub.color_convert = jsimd_ycc_rgb_convert; @@ -368,7 +376,8 @@ jinit_color_deconverter (j_decompress_ptr cinfo) } } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { cconvert->pub.color_convert = gray_rgb_convert; - } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { + } else if (cinfo->jpeg_color_space == cinfo->out_color_space && + rgb_pixelsize[cinfo->out_color_space] == 3) { cconvert->pub.color_convert = null_convert; } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); diff --git a/jdmerge.c b/jdmerge.c index 77429412..7b1a079f 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -257,15 +257,15 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, cblue = Cbbtab[cb]; /* Fetch 2 Y values and emit 2 pixels */ y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; - outptr += RGB_PIXELSIZE; + outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; + outptr += rgb_pixelsize[cinfo->out_color_space]; y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; - outptr += RGB_PIXELSIZE; + outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; + outptr += rgb_pixelsize[cinfo->out_color_space]; } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { @@ -275,9 +275,9 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr0); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; } } @@ -321,24 +321,24 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, cblue = Cbbtab[cb]; /* Fetch 4 Y values and emit 4 pixels */ y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; } /* If image width is odd, do the last output column separately */ @@ -349,13 +349,13 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr00); - outptr0[RGB_RED] = range_limit[y + cred]; - outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; y = GETJSAMPLE(*inptr01); - outptr1[RGB_RED] = range_limit[y + cred]; - outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred]; + outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen]; + outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue]; } } diff --git a/jmorecfg.h b/jmorecfg.h index 18670ec6..0e7fb720 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -2,6 +2,7 @@ * jmorecfg.h * * Copyright (C) 1991-1997, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -316,6 +317,23 @@ typedef int boolean; #define RGB_BLUE 2 /* Offset of Blue */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ +#define JPEG_NUMCS 12 + +static const int rgb_red[JPEG_NUMCS] = { + -1, -1, RGB_RED, -1, -1, -1, 0, 0, 2, 2, 3, 1 +}; + +static const int rgb_green[JPEG_NUMCS] = { + -1, -1, RGB_GREEN, -1, -1, -1, 1, 1, 1, 1, 2, 2 +}; + +static const int rgb_blue[JPEG_NUMCS] = { + -1, -1, RGB_BLUE, -1, -1, -1, 2, 2, 0, 0, 1, 3 +}; + +static const int rgb_pixelsize[JPEG_NUMCS] = { + -1, -1, RGB_PIXELSIZE, -1, -1, -1, 3, 4, 3, 4, 4, 4 +}; /* Definitions for speed-related optimizations. */ diff --git a/jpeglib.h b/jpeglib.h index d1be8dde..b28ff8df 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -203,13 +203,22 @@ struct jpeg_marker_struct { /* Known color spaces. */ +#define JCS_EXTENSIONS 1 + typedef enum { JCS_UNKNOWN, /* error/unspecified */ JCS_GRAYSCALE, /* monochrome */ - JCS_RGB, /* red/green/blue */ + JCS_RGB, /* red/green/blue as specified by the RGB_RED, RGB_GREEN, + RGB_BLUE, and RGB_PIXELSIZE macros */ JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ JCS_CMYK, /* C/M/Y/K */ - JCS_YCCK /* Y/Cb/Cr/K */ + JCS_YCCK, /* Y/Cb/Cr/K */ + JCS_EXT_RGB, /* red/green/blue */ + JCS_EXT_RGBX, /* red/green/blue/x */ + JCS_EXT_BGR, /* blue/green/red */ + JCS_EXT_BGRX, /* blue/green/red/x */ + JCS_EXT_XBGR, /* x/blue/green/red */ + JCS_EXT_XRGB, /* x/red/green/blue */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ diff --git a/jquant1.c b/jquant1.c index b2f96aa1..eac65a37 100644 --- a/jquant1.c +++ b/jquant1.c @@ -193,7 +193,10 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) int total_colors, iroot, i, j; boolean changed; long temp; - static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; + int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; + RGB_order[0] = rgb_green[cinfo->out_color_space]; + RGB_order[1] = rgb_red[cinfo->out_color_space]; + RGB_order[2] = rgb_blue[cinfo->out_color_space]; /* We can allocate at least the nc'th root of max_colors per component. */ /* Compute floor(nc'th root of max_colors). */ diff --git a/jquant2.c b/jquant2.c index af601e33..9ce3ff36 100644 --- a/jquant2.c +++ b/jquant2.c @@ -74,29 +74,10 @@ #define G_SCALE 3 /* scale G distances by this much */ #define B_SCALE 1 /* and B by this much */ -/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined - * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B - * and B,G,R orders. If you define some other weird order in jmorecfg.h, - * you'll get compile errors until you extend this logic. In that case - * you'll probably want to tweak the histogram sizes too. - */ - -#if RGB_RED == 0 -#define C0_SCALE R_SCALE -#endif -#if RGB_BLUE == 0 -#define C0_SCALE B_SCALE -#endif -#if RGB_GREEN == 1 -#define C1_SCALE G_SCALE -#endif -#if RGB_RED == 2 -#define C2_SCALE R_SCALE -#endif -#if RGB_BLUE == 2 -#define C2_SCALE B_SCALE -#endif - +static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE}; +#define C0_SCALE c_scales[rgb_red[cinfo->out_color_space]] +#define C1_SCALE c_scales[rgb_green[cinfo->out_color_space]] +#define C2_SCALE c_scales[rgb_blue[cinfo->out_color_space]] /* * First we have the histogram data structure and routines for creating it. @@ -454,15 +435,16 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, /* We want to break any ties in favor of green, then red, blue last. * This code does the right thing for R,G,B or B,G,R color orders only. */ -#if RGB_RED == 0 - cmax = c1; n = 1; - if (c0 > cmax) { cmax = c0; n = 0; } - if (c2 > cmax) { n = 2; } -#else - cmax = c1; n = 1; - if (c2 > cmax) { cmax = c2; n = 2; } - if (c0 > cmax) { n = 0; } -#endif + if (rgb_red[cinfo->out_color_space] == 0) { + cmax = c1; n = 1; + if (c0 > cmax) { cmax = c0; n = 0; } + if (c2 > cmax) { n = 2; } + } + else { + cmax = c1; n = 1; + if (c2 > cmax) { cmax = c2; n = 2; } + if (c0 > cmax) { n = 0; } + } /* Choose split point along selected axis, and update box bounds. * Current algorithm: split at halfway point. * (Since the box has been shrunk to minimum volume, diff --git a/jsimd.c b/jsimd.c index 7f81ddad..2c49a6bd 100644 --- a/jsimd.c +++ b/jsimd.c @@ -2,6 +2,7 @@ * jsimd.c * * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright 2009 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -107,12 +108,45 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { #ifdef WITH_SIMD + void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + switch(cinfo->in_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_extrgb_ycc_convert_sse2; + mmxfct=jsimd_extrgb_ycc_convert_mmx; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_extrgbx_ycc_convert_sse2; + mmxfct=jsimd_extrgbx_ycc_convert_mmx; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_extbgr_ycc_convert_sse2; + mmxfct=jsimd_extbgr_ycc_convert_mmx; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_extbgrx_ycc_convert_sse2; + mmxfct=jsimd_extbgrx_ycc_convert_mmx; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_extxbgr_ycc_convert_sse2; + mmxfct=jsimd_extxbgr_ycc_convert_mmx; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_extxrgb_ycc_convert_sse2; + mmxfct=jsimd_extxrgb_ycc_convert_mmx; + break; + default: + sse2fct=jsimd_rgb_ycc_convert_sse2; + mmxfct=jsimd_rgb_ycc_convert_mmx; + break; + } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) - jsimd_rgb_ycc_convert_sse2(cinfo->image_width, input_buf, + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); else if (simd_support & JSIMD_MMX) - jsimd_rgb_ycc_convert_mmx(cinfo->image_width, input_buf, + mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); #endif } @@ -123,12 +157,45 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPARRAY output_buf, int num_rows) { #ifdef WITH_SIMD + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_ycc_extrgb_convert_sse2; + mmxfct=jsimd_ycc_extrgb_convert_mmx; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_ycc_extrgbx_convert_sse2; + mmxfct=jsimd_ycc_extrgbx_convert_mmx; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_ycc_extbgr_convert_sse2; + mmxfct=jsimd_ycc_extbgr_convert_mmx; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_ycc_extbgrx_convert_sse2; + mmxfct=jsimd_ycc_extbgrx_convert_mmx; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_ycc_extxbgr_convert_sse2; + mmxfct=jsimd_ycc_extxbgr_convert_mmx; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_ycc_extxrgb_convert_sse2; + mmxfct=jsimd_ycc_extxrgb_convert_mmx; + break; + default: + sse2fct=jsimd_ycc_rgb_convert_sse2; + mmxfct=jsimd_ycc_rgb_convert_mmx; + break; + } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) - jsimd_ycc_rgb_convert_sse2(cinfo->output_width, input_buf, + sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); else if (simd_support & JSIMD_MMX) - jsimd_ycc_rgb_convert_mmx(cinfo->output_width, input_buf, + mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); #endif } diff --git a/simd/Makefile.am b/simd/Makefile.am index ea53fee4..22828047 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -19,6 +19,11 @@ libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ jiss2red.asm jiss2int.asm jiss2fst.asm \ jcqnts2f.asm jiss2flt.asm +jccolmmx.lo: jcclrmmx.asm +jccolss2.lo: jcclrss2.asm +jdcolmmx.lo: jdclrmmx.asm +jdcolss2.lo: jdclrss2.asm + .asm.lo: $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ diff --git a/simd/jcclrmmx.asm b/simd/jcclrmmx.asm new file mode 100644 index 00000000..9cbae72e --- /dev/null +++ b/simd/jcclrmmx.asm @@ -0,0 +1,474 @@ +; +; jcclrmmx.asm - colorspace conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_mmx (JDIMENSION img_width, +; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, +; JDIMENSION output_row, int num_rows); +; + +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_rgb_ycc_convert_mmx) + +EXTN(jsimd_rgb_ycc_convert_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [img_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + cmp ecx, byte SIZEOF_MMWORD + jae short .columnloop + alignx 16,7 + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + xor eax,eax + mov al, BYTE [esi+ecx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + xor edx,edx + mov dx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx +.column_ld4: + movd mmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd mmG, DWORD [esi+ecx] + psllq mmA, DWORD_BIT + por mmA,mmG +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + movq mmG,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + mov ecx, SIZEOF_MMWORD + jmp short .rgb_ycc_cnv +.column_ld16: + test cl, 2*SIZEOF_MMWORD + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmF,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] + +.rgb_ycc_cnv: + ; mmA=(00 10 20 01 11 21 02 12) + ; mmG=(22 03 13 23 04 14 24 05) + ; mmF=(15 25 06 16 26 07 17 27) + + movq mmD,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) + psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) + + punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) + psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) + + punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) + punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) + + movq mmE,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) + psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) + + punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) + + punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) + punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) + + pxor mmH,mmH + + movq mmC,mmA + punpcklbw mmA,mmH ; mmA=(00 02 04 06) + punpckhbw mmC,mmH ; mmC=(10 12 14 16) + + movq mmB,mmE + punpcklbw mmE,mmH ; mmE=(20 22 24 26) + punpckhbw mmB,mmH ; mmB=(01 03 05 07) + + movq mmF,mmD + punpcklbw mmD,mmH ; mmD=(11 13 15 17) + punpckhbw mmF,mmH ; mmF=(21 23 25 27) + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_MMWORD/8 + jz short .column_ld2 + sub ecx, byte SIZEOF_MMWORD/8 + movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_MMWORD/4 + jz short .column_ld4 + sub ecx, byte SIZEOF_MMWORD/4 + movq mmF,mmA + movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld4: + test cl, SIZEOF_MMWORD/2 + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmD,mmA + movq mmC,mmF + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] + +.rgb_ycc_cnv: + ; mmA=(00 10 20 30 01 11 21 31) + ; mmF=(02 12 22 32 03 13 23 33) + ; mmD=(04 14 24 34 05 15 25 35) + ; mmC=(06 16 26 36 07 17 27 37) + + movq mmB,mmA + punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) + punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) + + movq mmG,mmD + punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) + punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) + + movq mmE,mmA + punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) + + movq mmH,mmB + punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) + punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) + + pxor mmF,mmF + + movq mmC,mmA + punpcklbw mmA,mmF ; mmA=(00 02 04 06) + punpckhbw mmC,mmF ; mmC=(10 12 14 16) + + movq mmD,mmB + punpcklbw mmB,mmF ; mmB=(01 03 05 07) + punpckhbw mmD,mmF ; mmD=(11 13 15 17) + + movq mmG,mmE + punpcklbw mmE,mmF ; mmE=(20 22 24 26) + punpckhbw mmG,mmF ; mmG=(30 32 34 36) + + punpcklbw mmF,mmH + punpckhbw mmH,mmH + psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) + psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) + +%endif ; RGB_PIXELSIZE ; --------------- + + ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE + ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO + + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movq MMWORD [wk(0)], mm0 ; wk(0)=RE + movq MMWORD [wk(1)], mm1 ; wk(1)=RO + movq MMWORD [wk(2)], mm4 ; wk(2)=BE + movq MMWORD [wk(3)], mm5 ; wk(3)=BO + + movq mm6,mm1 + punpcklwd mm1,mm3 + punpckhwd mm6,mm3 + movq mm7,mm1 + movq mm4,mm6 + pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd mm7,[GOTOFF(eax,PW_MF016_MF033)] ; mm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + + movq MMWORD [wk(4)], mm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movq MMWORD [wk(5)], mm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor mm1,mm1 + pxor mm6,mm6 + punpcklwd mm1,mm5 ; mm1=BOL + punpckhwd mm6,mm5 ; mm6=BOH + psrld mm1,1 ; mm1=BOL*FIX(0.500) + psrld mm6,1 ; mm6=BOH*FIX(0.500) + + movq mm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm5=[PD_ONEHALFM1_CJ] + + paddd mm7,mm1 + paddd mm4,mm6 + paddd mm7,mm5 + paddd mm4,mm5 + psrld mm7,SCALEBITS ; mm7=CbOL + psrld mm4,SCALEBITS ; mm4=CbOH + packssdw mm7,mm4 ; mm7=CbO + + movq mm1, MMWORD [wk(2)] ; mm1=BE + + movq mm6,mm0 + punpcklwd mm0,mm2 + punpckhwd mm6,mm2 + movq mm5,mm0 + movq mm4,mm6 + pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd mm5,[GOTOFF(eax,PW_MF016_MF033)] ; mm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + + movq MMWORD [wk(6)], mm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movq MMWORD [wk(7)], mm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor mm0,mm0 + pxor mm6,mm6 + punpcklwd mm0,mm1 ; mm0=BEL + punpckhwd mm6,mm1 ; mm6=BEH + psrld mm0,1 ; mm0=BEL*FIX(0.500) + psrld mm6,1 ; mm6=BEH*FIX(0.500) + + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + + paddd mm5,mm0 + paddd mm4,mm6 + paddd mm5,mm1 + paddd mm4,mm1 + psrld mm5,SCALEBITS ; mm5=CbEL + psrld mm4,SCALEBITS ; mm4=CbEH + packssdw mm5,mm4 ; mm5=CbE + + psllw mm7,BYTE_BIT + por mm5,mm7 ; mm5=Cb + movq MMWORD [ebx], mm5 ; Save Cb + + movq mm0, MMWORD [wk(3)] ; mm0=BO + movq mm6, MMWORD [wk(2)] ; mm6=BE + movq mm1, MMWORD [wk(1)] ; mm1=RO + + movq mm4,mm0 + punpcklwd mm0,mm3 + punpckhwd mm4,mm3 + movq mm7,mm0 + movq mm5,mm4 + pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd mm7,[GOTOFF(eax,PW_MF008_MF041)] ; mm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + + movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] + + paddd mm0, MMWORD [wk(4)] + paddd mm4, MMWORD [wk(5)] + paddd mm0,mm3 + paddd mm4,mm3 + psrld mm0,SCALEBITS ; mm0=YOL + psrld mm4,SCALEBITS ; mm4=YOH + packssdw mm0,mm4 ; mm0=YO + + pxor mm3,mm3 + pxor mm4,mm4 + punpcklwd mm3,mm1 ; mm3=ROL + punpckhwd mm4,mm1 ; mm4=ROH + psrld mm3,1 ; mm3=ROL*FIX(0.500) + psrld mm4,1 ; mm4=ROH*FIX(0.500) + + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + + paddd mm7,mm3 + paddd mm5,mm4 + paddd mm7,mm1 + paddd mm5,mm1 + psrld mm7,SCALEBITS ; mm7=CrOL + psrld mm5,SCALEBITS ; mm5=CrOH + packssdw mm7,mm5 ; mm7=CrO + + movq mm3, MMWORD [wk(0)] ; mm3=RE + + movq mm4,mm6 + punpcklwd mm6,mm2 + punpckhwd mm4,mm2 + movq mm1,mm6 + movq mm5,mm4 + pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd mm1,[GOTOFF(eax,PW_MF008_MF041)] ; mm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + + movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] + + paddd mm6, MMWORD [wk(6)] + paddd mm4, MMWORD [wk(7)] + paddd mm6,mm2 + paddd mm4,mm2 + psrld mm6,SCALEBITS ; mm6=YEL + psrld mm4,SCALEBITS ; mm4=YEH + packssdw mm6,mm4 ; mm6=YE + + psllw mm0,BYTE_BIT + por mm6,mm0 ; mm6=Y + movq MMWORD [edi], mm6 ; Save Y + + pxor mm2,mm2 + pxor mm4,mm4 + punpcklwd mm2,mm3 ; mm2=REL + punpckhwd mm4,mm3 ; mm4=REH + psrld mm2,1 ; mm2=REL*FIX(0.500) + psrld mm4,1 ; mm4=REH*FIX(0.500) + + movq mm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm0=[PD_ONEHALFM1_CJ] + + paddd mm1,mm2 + paddd mm5,mm4 + paddd mm1,mm0 + paddd mm5,mm0 + psrld mm1,SCALEBITS ; mm1=CrEL + psrld mm5,SCALEBITS ; mm5=CrEH + packssdw mm1,mm5 ; mm1=CrE + + psllw mm7,BYTE_BIT + por mm1,mm7 ; mm1=Cr + movq MMWORD [edx], mm1 ; Save Cr + + sub ecx, byte SIZEOF_MMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr + add edi, byte SIZEOF_MMWORD ; outptr0 + add ebx, byte SIZEOF_MMWORD ; outptr1 + add edx, byte SIZEOF_MMWORD ; outptr2 + cmp ecx, byte SIZEOF_MMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 + + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax + + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jcclrss2.asm b/simd/jcclrss2.asm new file mode 100644 index 00000000..10b11f9f --- /dev/null +++ b/simd/jcclrss2.asm @@ -0,0 +1,500 @@ +; +; jcclrss2.asm - colorspace conversion (SSE2) +; +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_sse2 (JDIMENSION img_width, +; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, +; JDIMENSION output_row, int num_rows); +; + +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + + global EXTN(jsimd_rgb_ycc_convert_sse2) + +EXTN(jsimd_rgb_ycc_convert_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [img_width(eax)] + test ecx,ecx + jz near .return + + push ecx + + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + alignx 16,7 + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + movzx eax, BYTE [esi+ecx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + movzx edx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx +.column_ld4: + movd xmmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [esi+ecx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub ecx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [esi+ecx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB +.column_ld16: + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + mov ecx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv +.column_ld32: + test cl, 2*SIZEOF_XMMWORD + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + + pxor xmmH,xmmH + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub ecx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub ecx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE +.column_ld4: + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub ecx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] +.column_ld8: + test cl, SIZEOF_XMMWORD/2 + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 + +.columnloop: + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + + pxor xmmF,xmmF + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + +%endif ; RGB_PIXELSIZE ; --------------- + + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + movdqa xmm7,xmm1 + movdqa xmm4,xmm6 + pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[GOTOFF(eax,PW_MF016_MF033)] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor xmm1,xmm1 + pxor xmm6,xmm6 + punpcklwd xmm1,xmm5 ; xmm1=BOL + punpckhwd xmm6,xmm5 ; xmm6=BOH + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm6,1 ; xmm6=BOH*FIX(0.500) + + movdqa xmm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm5=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm1 + paddd xmm4,xmm6 + paddd xmm7,xmm5 + paddd xmm4,xmm5 + psrld xmm7,SCALEBITS ; xmm7=CbOL + psrld xmm4,SCALEBITS ; xmm4=CbOH + packssdw xmm7,xmm4 ; xmm7=CbO + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + movdqa xmm5,xmm0 + movdqa xmm4,xmm6 + pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[GOTOFF(eax,PW_MF016_MF033)] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor xmm0,xmm0 + pxor xmm6,xmm6 + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + psrld xmm6,1 ; xmm6=BEH*FIX(0.500) + + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm5,xmm0 + paddd xmm4,xmm6 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrld xmm5,SCALEBITS ; xmm5=CbEL + psrld xmm4,SCALEBITS ; xmm4=CbEH + packssdw xmm5,xmm4 ; xmm5=CbE + + psllw xmm7,BYTE_BIT + por xmm5,xmm7 ; xmm5=Cb + movdqa XMMWORD [ebx], xmm5 ; Save Cb + + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + movdqa xmm7,xmm0 + movdqa xmm5,xmm4 + pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[GOTOFF(eax,PW_MF008_MF041)] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + + movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] + + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO + + pxor xmm3,xmm3 + pxor xmm4,xmm4 + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH + psrld xmm3,1 ; xmm3=ROL*FIX(0.500) + psrld xmm4,1 ; xmm4=ROH*FIX(0.500) + + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm3 + paddd xmm5,xmm4 + paddd xmm7,xmm1 + paddd xmm5,xmm1 + psrld xmm7,SCALEBITS ; xmm7=CrOL + psrld xmm5,SCALEBITS ; xmm5=CrOH + packssdw xmm7,xmm5 ; xmm7=CrO + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[GOTOFF(eax,PW_MF008_MF041)] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + + movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] + + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE + + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [edi], xmm6 ; Save Y + + pxor xmm2,xmm2 + pxor xmm4,xmm4 + punpcklwd xmm2,xmm3 ; xmm2=REL + punpckhwd xmm4,xmm3 ; xmm4=REH + psrld xmm2,1 ; xmm2=REL*FIX(0.500) + psrld xmm4,1 ; xmm4=REH*FIX(0.500) + + movdqa xmm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm0=[PD_ONEHALFM1_CJ] + + paddd xmm1,xmm2 + paddd xmm5,xmm4 + paddd xmm1,xmm0 + paddd xmm5,xmm0 + psrld xmm1,SCALEBITS ; xmm1=CrEL + psrld xmm5,SCALEBITS ; xmm5=CrEH + packssdw xmm1,xmm5 ; xmm1=CrE + + psllw xmm7,BYTE_BIT + por xmm1,xmm7 ; xmm1=Cr + movdqa XMMWORD [edx], xmm1 ; Save Cr + + sub ecx, byte SIZEOF_XMMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add edi, byte SIZEOF_XMMWORD ; outptr0 + add ebx, byte SIZEOF_XMMWORD ; outptr1 + add edx, byte SIZEOF_XMMWORD ; outptr2 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 + + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax + + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm index 340af00a..8352fc35 100644 --- a/simd/jccolmmx.asm +++ b/simd/jccolmmx.asm @@ -2,6 +2,7 @@ ; jccolmmx.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -51,458 +52,70 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Convert some rows of samples to the output colorspace. -; -; GLOBAL(void) -; jsimd_rgb_ycc_convert_mmx (JDIMENSION img_width, -; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, -; JDIMENSION output_row, int num_rows); -; - -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows - -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 8 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - - align 16 - global EXTN(jsimd_rgb_ycc_convert_mmx) - -EXTN(jsimd_rgb_ycc_convert_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [img_width(eax)] ; num_cols - test ecx,ecx - jz near .return - - push ecx - - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] - - pop ecx - - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 -.rowloop: - pushpic eax - push edx - push ebx - push edi - push esi - push ecx ; col - - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - mov ebx, JSAMPROW [ebx] ; outptr1 - mov edx, JSAMPROW [edx] ; outptr2 - movpic eax, POINTER [gotptr] ; load GOT address (eax) - - cmp ecx, byte SIZEOF_MMWORD - jae short .columnloop - alignx 16,7 - -%if RGB_PIXELSIZE == 3 ; --------------- - -.column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - xor eax,eax - mov al, BYTE [esi+ecx] -.column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - xor edx,edx - mov dx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx -.column_ld4: - movd mmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd mmG, DWORD [esi+ecx] - psllq mmA, DWORD_BIT - por mmA,mmG -.column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - movq mmG,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - mov ecx, SIZEOF_MMWORD - jmp short .rgb_ycc_cnv -.column_ld16: - test cl, 2*SIZEOF_MMWORD - mov ecx, SIZEOF_MMWORD - jz short .rgb_ycc_cnv - movq mmF,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 - -.columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] - -.rgb_ycc_cnv: - ; mmA=(00 10 20 01 11 21 02 12) - ; mmG=(22 03 13 23 04 14 24 05) - ; mmF=(15 25 06 16 26 07 17 27) - - movq mmD,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) - psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) - - punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) - psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) - - punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) - punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) - - movq mmE,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) - psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) - - punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) - - punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) - punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) - - pxor mmH,mmH - - movq mmC,mmA - punpcklbw mmA,mmH ; mmA=(00 02 04 06) - punpckhbw mmC,mmH ; mmC=(10 12 14 16) - - movq mmB,mmE - punpcklbw mmE,mmH ; mmE=(20 22 24 26) - punpckhbw mmB,mmH ; mmB=(01 03 05 07) - - movq mmF,mmD - punpcklbw mmD,mmH ; mmD=(11 13 15 17) - punpckhbw mmF,mmH ; mmF=(21 23 25 27) - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -.column_ld1: - test cl, SIZEOF_MMWORD/8 - jz short .column_ld2 - sub ecx, byte SIZEOF_MMWORD/8 - movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] -.column_ld2: - test cl, SIZEOF_MMWORD/4 - jz short .column_ld4 - sub ecx, byte SIZEOF_MMWORD/4 - movq mmF,mmA - movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] -.column_ld4: - test cl, SIZEOF_MMWORD/2 - mov ecx, SIZEOF_MMWORD - jz short .rgb_ycc_cnv - movq mmD,mmA - movq mmC,mmF - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 - -.columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] - movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] - -.rgb_ycc_cnv: - ; mmA=(00 10 20 30 01 11 21 31) - ; mmF=(02 12 22 32 03 13 23 33) - ; mmD=(04 14 24 34 05 15 25 35) - ; mmC=(06 16 26 36 07 17 27 37) - - movq mmB,mmA - punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) - punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) - - movq mmG,mmD - punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) - punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) - - movq mmE,mmA - punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) - - movq mmH,mmB - punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) - punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) - - pxor mmF,mmF - - movq mmC,mmA - punpcklbw mmA,mmF ; mmA=(00 02 04 06) - punpckhbw mmC,mmF ; mmC=(10 12 14 16) - - movq mmD,mmB - punpcklbw mmB,mmF ; mmB=(01 03 05 07) - punpckhbw mmD,mmF ; mmD=(11 13 15 17) - - movq mmG,mmE - punpcklbw mmE,mmF ; mmE=(20 22 24 26) - punpckhbw mmG,mmF ; mmG=(30 32 34 36) - - punpcklbw mmF,mmH - punpckhbw mmH,mmH - psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) - psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) - -%endif ; RGB_PIXELSIZE ; --------------- - - ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE - ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO - - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - - movq MMWORD [wk(0)], mm0 ; wk(0)=RE - movq MMWORD [wk(1)], mm1 ; wk(1)=RO - movq MMWORD [wk(2)], mm4 ; wk(2)=BE - movq MMWORD [wk(3)], mm5 ; wk(3)=BO - - movq mm6,mm1 - punpcklwd mm1,mm3 - punpckhwd mm6,mm3 - movq mm7,mm1 - movq mm4,mm6 - pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd mm7,[GOTOFF(eax,PW_MF016_MF033)] ; mm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - - movq MMWORD [wk(4)], mm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movq MMWORD [wk(5)], mm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - - pxor mm1,mm1 - pxor mm6,mm6 - punpcklwd mm1,mm5 ; mm1=BOL - punpckhwd mm6,mm5 ; mm6=BOH - psrld mm1,1 ; mm1=BOL*FIX(0.500) - psrld mm6,1 ; mm6=BOH*FIX(0.500) - - movq mm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm5=[PD_ONEHALFM1_CJ] - - paddd mm7,mm1 - paddd mm4,mm6 - paddd mm7,mm5 - paddd mm4,mm5 - psrld mm7,SCALEBITS ; mm7=CbOL - psrld mm4,SCALEBITS ; mm4=CbOH - packssdw mm7,mm4 ; mm7=CbO - - movq mm1, MMWORD [wk(2)] ; mm1=BE - - movq mm6,mm0 - punpcklwd mm0,mm2 - punpckhwd mm6,mm2 - movq mm5,mm0 - movq mm4,mm6 - pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd mm5,[GOTOFF(eax,PW_MF016_MF033)] ; mm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - - movq MMWORD [wk(6)], mm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movq MMWORD [wk(7)], mm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - - pxor mm0,mm0 - pxor mm6,mm6 - punpcklwd mm0,mm1 ; mm0=BEL - punpckhwd mm6,mm1 ; mm6=BEH - psrld mm0,1 ; mm0=BEL*FIX(0.500) - psrld mm6,1 ; mm6=BEH*FIX(0.500) - - movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] - - paddd mm5,mm0 - paddd mm4,mm6 - paddd mm5,mm1 - paddd mm4,mm1 - psrld mm5,SCALEBITS ; mm5=CbEL - psrld mm4,SCALEBITS ; mm4=CbEH - packssdw mm5,mm4 ; mm5=CbE - - psllw mm7,BYTE_BIT - por mm5,mm7 ; mm5=Cb - movq MMWORD [ebx], mm5 ; Save Cb - - movq mm0, MMWORD [wk(3)] ; mm0=BO - movq mm6, MMWORD [wk(2)] ; mm6=BE - movq mm1, MMWORD [wk(1)] ; mm1=RO - - movq mm4,mm0 - punpcklwd mm0,mm3 - punpckhwd mm4,mm3 - movq mm7,mm0 - movq mm5,mm4 - pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd mm7,[GOTOFF(eax,PW_MF008_MF041)] ; mm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - - movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] - - paddd mm0, MMWORD [wk(4)] - paddd mm4, MMWORD [wk(5)] - paddd mm0,mm3 - paddd mm4,mm3 - psrld mm0,SCALEBITS ; mm0=YOL - psrld mm4,SCALEBITS ; mm4=YOH - packssdw mm0,mm4 ; mm0=YO - - pxor mm3,mm3 - pxor mm4,mm4 - punpcklwd mm3,mm1 ; mm3=ROL - punpckhwd mm4,mm1 ; mm4=ROH - psrld mm3,1 ; mm3=ROL*FIX(0.500) - psrld mm4,1 ; mm4=ROH*FIX(0.500) - - movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] - - paddd mm7,mm3 - paddd mm5,mm4 - paddd mm7,mm1 - paddd mm5,mm1 - psrld mm7,SCALEBITS ; mm7=CrOL - psrld mm5,SCALEBITS ; mm5=CrOH - packssdw mm7,mm5 ; mm7=CrO - - movq mm3, MMWORD [wk(0)] ; mm3=RE - - movq mm4,mm6 - punpcklwd mm6,mm2 - punpckhwd mm4,mm2 - movq mm1,mm6 - movq mm5,mm4 - pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd mm1,[GOTOFF(eax,PW_MF008_MF041)] ; mm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - - movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] - - paddd mm6, MMWORD [wk(6)] - paddd mm4, MMWORD [wk(7)] - paddd mm6,mm2 - paddd mm4,mm2 - psrld mm6,SCALEBITS ; mm6=YEL - psrld mm4,SCALEBITS ; mm4=YEH - packssdw mm6,mm4 ; mm6=YE - - psllw mm0,BYTE_BIT - por mm6,mm0 ; mm6=Y - movq MMWORD [edi], mm6 ; Save Y - - pxor mm2,mm2 - pxor mm4,mm4 - punpcklwd mm2,mm3 ; mm2=REL - punpckhwd mm4,mm3 ; mm4=REH - psrld mm2,1 ; mm2=REL*FIX(0.500) - psrld mm4,1 ; mm4=REH*FIX(0.500) - - movq mm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm0=[PD_ONEHALFM1_CJ] - - paddd mm1,mm2 - paddd mm5,mm4 - paddd mm1,mm0 - paddd mm5,mm0 - psrld mm1,SCALEBITS ; mm1=CrEL - psrld mm5,SCALEBITS ; mm5=CrEH - packssdw mm1,mm5 ; mm1=CrE - - psllw mm7,BYTE_BIT - por mm1,mm7 ; mm1=Cr - movq MMWORD [edx], mm1 ; Save Cr - - sub ecx, byte SIZEOF_MMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr - add edi, byte SIZEOF_MMWORD ; outptr0 - add ebx, byte SIZEOF_MMWORD ; outptr1 - add edx, byte SIZEOF_MMWORD ; outptr2 - cmp ecx, byte SIZEOF_MMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 - - pop ecx ; col - pop esi - pop edi - pop ebx - pop edx - poppic eax - - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop - - emms ; empty MMX state - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret - +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_mmx jsimd_extrgb_ycc_convert_mmx +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_mmx jsimd_extrgbx_ycc_convert_mmx +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_mmx jsimd_extbgr_ycc_convert_mmx +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_mmx jsimd_extbgrx_ycc_convert_mmx +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_mmx jsimd_extxbgr_ycc_convert_mmx +%include "jcclrmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_mmx jsimd_extxrgb_ycc_convert_mmx +%include "jcclrmmx.asm" diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index 4d06bb89..2d7bb576 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -3,6 +3,7 @@ ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. +; Copyright (C) 2009, D. R. Commander. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), @@ -48,486 +49,70 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Convert some rows of samples to the output colorspace. -; -; GLOBAL(void) -; jsimd_rgb_ycc_convert_sse2 (JDIMENSION img_width, -; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, -; JDIMENSION output_row, int num_rows); -; - -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows - -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 8 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - - align 16 - global EXTN(jsimd_rgb_ycc_convert_sse2) - -EXTN(jsimd_rgb_ycc_convert_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [img_width(eax)] - test ecx,ecx - jz near .return - - push ecx - - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] - - pop ecx - - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 -.rowloop: - pushpic eax - push edx - push ebx - push edi - push esi - push ecx ; col - - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - mov ebx, JSAMPROW [ebx] ; outptr1 - mov edx, JSAMPROW [edx] ; outptr2 - movpic eax, POINTER [gotptr] ; load GOT address (eax) - - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - alignx 16,7 - -%if RGB_PIXELSIZE == 3 ; --------------- - -.column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - movzx eax, BYTE [esi+ecx] -.column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - movzx edx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx -.column_ld4: - movd xmmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd xmmF, XMM_DWORD [esi+ecx] - pslldq xmmA, SIZEOF_DWORD - por xmmA,xmmF -.column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - sub ecx, byte SIZEOF_MMWORD - movq xmmB, XMM_MMWORD [esi+ecx] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmB -.column_ld16: - test cl, SIZEOF_XMMWORD - jz short .column_ld32 - movdqa xmmF,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - mov ecx, SIZEOF_XMMWORD - jmp short .rgb_ycc_cnv -.column_ld32: - test cl, 2*SIZEOF_XMMWORD - mov ecx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmB,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 - -.columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] - -.rgb_ycc_cnv: - ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - - movdqa xmmG,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) - psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) - - punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) - pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) - - punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) - punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) - - movdqa xmmD,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) - psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) - - punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) - pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) - - punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) - punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) - - movdqa xmmE,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) - psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) - - punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) - - punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) - - pxor xmmH,xmmH - - movdqa xmmC,xmmA - punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) - - movdqa xmmB,xmmE - punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) - - movdqa xmmF,xmmD - punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) - punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -.column_ld1: - test cl, SIZEOF_XMMWORD/16 - jz short .column_ld2 - sub ecx, byte SIZEOF_XMMWORD/16 - movd xmmA, DWORD [esi+ecx*RGB_PIXELSIZE] -.column_ld2: - test cl, SIZEOF_XMMWORD/8 - jz short .column_ld4 - sub ecx, byte SIZEOF_XMMWORD/8 - movq xmmE, MMWORD [esi+ecx*RGB_PIXELSIZE] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmE -.column_ld4: - test cl, SIZEOF_XMMWORD/4 - jz short .column_ld8 - sub ecx, byte SIZEOF_XMMWORD/4 - movdqa xmmE,xmmA - movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] -.column_ld8: - test cl, SIZEOF_XMMWORD/2 - mov ecx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmF,xmmA - movdqa xmmH,xmmE - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 - -.columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] - movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] - -.rgb_ycc_cnv: - ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - - movdqa xmmD,xmmA - punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) - punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) - - movdqa xmmC,xmmF - punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) - punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) - - movdqa xmmB,xmmA - punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) - punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) - - movdqa xmmG,xmmD - punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) - punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) - - movdqa xmmE,xmmA - punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) - - movdqa xmmH,xmmB - punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) - punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) - - pxor xmmF,xmmF - - movdqa xmmC,xmmA - punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) - - movdqa xmmD,xmmB - punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) - - movdqa xmmG,xmmE - punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) - - punpcklbw xmmF,xmmH - punpckhbw xmmH,xmmH - psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) - psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) - -%endif ; RGB_PIXELSIZE ; --------------- - - ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE - ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO - - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE - movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO - - movdqa xmm6,xmm1 - punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 - movdqa xmm7,xmm1 - movdqa xmm4,xmm6 - pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd xmm7,[GOTOFF(eax,PW_MF016_MF033)] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - - movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - - pxor xmm1,xmm1 - pxor xmm6,xmm6 - punpcklwd xmm1,xmm5 ; xmm1=BOL - punpckhwd xmm6,xmm5 ; xmm6=BOH - psrld xmm1,1 ; xmm1=BOL*FIX(0.500) - psrld xmm6,1 ; xmm6=BOH*FIX(0.500) - - movdqa xmm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm5=[PD_ONEHALFM1_CJ] - - paddd xmm7,xmm1 - paddd xmm4,xmm6 - paddd xmm7,xmm5 - paddd xmm4,xmm5 - psrld xmm7,SCALEBITS ; xmm7=CbOL - psrld xmm4,SCALEBITS ; xmm4=CbOH - packssdw xmm7,xmm4 ; xmm7=CbO - - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE - - movdqa xmm6,xmm0 - punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 - movdqa xmm5,xmm0 - movdqa xmm4,xmm6 - pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd xmm5,[GOTOFF(eax,PW_MF016_MF033)] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - - pxor xmm0,xmm0 - pxor xmm6,xmm6 - punpcklwd xmm0,xmm1 ; xmm0=BEL - punpckhwd xmm6,xmm1 ; xmm6=BEH - psrld xmm0,1 ; xmm0=BEL*FIX(0.500) - psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - - movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] - - paddd xmm5,xmm0 - paddd xmm4,xmm6 - paddd xmm5,xmm1 - paddd xmm4,xmm1 - psrld xmm5,SCALEBITS ; xmm5=CbEL - psrld xmm4,SCALEBITS ; xmm4=CbEH - packssdw xmm5,xmm4 ; xmm5=CbE - - psllw xmm7,BYTE_BIT - por xmm5,xmm7 ; xmm5=Cb - movdqa XMMWORD [ebx], xmm5 ; Save Cb - - movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO - - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - movdqa xmm7,xmm0 - movdqa xmm5,xmm4 - pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd xmm7,[GOTOFF(eax,PW_MF008_MF041)] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - - movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] - - paddd xmm0, XMMWORD [wk(4)] - paddd xmm4, XMMWORD [wk(5)] - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO - - pxor xmm3,xmm3 - pxor xmm4,xmm4 - punpcklwd xmm3,xmm1 ; xmm3=ROL - punpckhwd xmm4,xmm1 ; xmm4=ROH - psrld xmm3,1 ; xmm3=ROL*FIX(0.500) - psrld xmm4,1 ; xmm4=ROH*FIX(0.500) - - movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] - - paddd xmm7,xmm3 - paddd xmm5,xmm4 - paddd xmm7,xmm1 - paddd xmm5,xmm1 - psrld xmm7,SCALEBITS ; xmm7=CrOL - psrld xmm5,SCALEBITS ; xmm5=CrOH - packssdw xmm7,xmm5 ; xmm7=CrO - - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE - - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - movdqa xmm1,xmm6 - movdqa xmm5,xmm4 - pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd xmm1,[GOTOFF(eax,PW_MF008_MF041)] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - - movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] - - paddd xmm6, XMMWORD [wk(6)] - paddd xmm4, XMMWORD [wk(7)] - paddd xmm6,xmm2 - paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE - - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [edi], xmm6 ; Save Y - - pxor xmm2,xmm2 - pxor xmm4,xmm4 - punpcklwd xmm2,xmm3 ; xmm2=REL - punpckhwd xmm4,xmm3 ; xmm4=REH - psrld xmm2,1 ; xmm2=REL*FIX(0.500) - psrld xmm4,1 ; xmm4=REH*FIX(0.500) - - movdqa xmm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm0=[PD_ONEHALFM1_CJ] - - paddd xmm1,xmm2 - paddd xmm5,xmm4 - paddd xmm1,xmm0 - paddd xmm5,xmm0 - psrld xmm1,SCALEBITS ; xmm1=CrEL - psrld xmm5,SCALEBITS ; xmm5=CrEH - packssdw xmm1,xmm5 ; xmm1=CrE - - psllw xmm7,BYTE_BIT - por xmm1,xmm7 ; xmm1=Cr - movdqa XMMWORD [edx], xmm1 ; Save Cr - - sub ecx, byte SIZEOF_XMMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr - add edi, byte SIZEOF_XMMWORD ; outptr0 - add ebx, byte SIZEOF_XMMWORD ; outptr1 - add edx, byte SIZEOF_XMMWORD ; outptr2 - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 - - pop ecx ; col - pop esi - pop edi - pop ebx - pop edx - poppic eax - - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret - +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 +%include "jcclrss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 +%include "jcclrss2.asm" diff --git a/simd/jdclrmmx.asm b/simd/jdclrmmx.asm new file mode 100644 index 00000000..506500eb --- /dev/null +++ b/simd/jdclrmmx.asm @@ -0,0 +1,402 @@ +; +; jdclrmmx.asm - colorspace conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_ycc_rgb_convert_mmx (JDIMENSION out_width, +; JSAMPIMAGE input_buf, JDIMENSION input_row, +; JSAMPARRAY output_buf, int num_rows) +; + +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_ycc_rgb_convert_mmx) + +EXTN(jsimd_ycc_rgb_convert_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + push eax + push edi + push edx + push ebx + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 +.columnloop: + + movq mm5, MMWORD [ebx] ; mm5=Cb(01234567) + movq mm1, MMWORD [edx] ; mm1=Cr(01234567) + + pcmpeqw mm4,mm4 + pcmpeqw mm7,mm7 + psrlw mm4,BYTE_BIT + psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} + movq mm0,mm4 ; mm0=mm4={0xFF 0x00 0xFF 0x00 ..} + + pand mm4,mm5 ; mm4=Cb(0246)=CbE + psrlw mm5,BYTE_BIT ; mm5=Cb(1357)=CbO + pand mm0,mm1 ; mm0=Cr(0246)=CrE + psrlw mm1,BYTE_BIT ; mm1=Cr(1357)=CrO + + paddw mm4,mm7 + paddw mm5,mm7 + paddw mm0,mm7 + paddw mm1,mm7 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movq mm2,mm4 ; mm2=CbE + movq mm3,mm5 ; mm3=CbO + paddw mm4,mm4 ; mm4=2*CbE + paddw mm5,mm5 ; mm5=2*CbO + movq mm6,mm0 ; mm6=CrE + movq mm7,mm1 ; mm7=CrO + paddw mm0,mm0 ; mm0=2*CrE + paddw mm1,mm1 ; mm1=2*CrO + + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbE * -FIX(0.22800)) + pmulhw mm5,[GOTOFF(eax,PW_MF0228)] ; mm5=(2*CbO * -FIX(0.22800)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrE * FIX(0.40200)) + pmulhw mm1,[GOTOFF(eax,PW_F0402)] ; mm1=(2*CrO * FIX(0.40200)) + + paddw mm4,[GOTOFF(eax,PW_ONE)] + paddw mm5,[GOTOFF(eax,PW_ONE)] + psraw mm4,1 ; mm4=(CbE * -FIX(0.22800)) + psraw mm5,1 ; mm5=(CbO * -FIX(0.22800)) + paddw mm0,[GOTOFF(eax,PW_ONE)] + paddw mm1,[GOTOFF(eax,PW_ONE)] + psraw mm0,1 ; mm0=(CrE * FIX(0.40200)) + psraw mm1,1 ; mm1=(CrO * FIX(0.40200)) + + paddw mm4,mm2 + paddw mm5,mm3 + paddw mm4,mm2 ; mm4=(CbE * FIX(1.77200))=(B-Y)E + paddw mm5,mm3 ; mm5=(CbO * FIX(1.77200))=(B-Y)O + paddw mm0,mm6 ; mm0=(CrE * FIX(1.40200))=(R-Y)E + paddw mm1,mm7 ; mm1=(CrO * FIX(1.40200))=(R-Y)O + + movq MMWORD [wk(0)], mm4 ; wk(0)=(B-Y)E + movq MMWORD [wk(1)], mm5 ; wk(1)=(B-Y)O + + movq mm4,mm2 + movq mm5,mm3 + punpcklwd mm2,mm6 + punpckhwd mm4,mm6 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm3,mm7 + punpckhwd mm5,mm7 + pmaddwd mm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm4,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm4,SCALEBITS + paddd mm3,[GOTOFF(eax,PD_ONEHALF)] + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + psrad mm3,SCALEBITS + psrad mm5,SCALEBITS + + packssdw mm2,mm4 ; mm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw mm3,mm5 ; mm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw mm2,mm6 ; mm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw mm3,mm7 ; mm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + + movq mm5, MMWORD [esi] ; mm5=Y(01234567) + + pcmpeqw mm4,mm4 + psrlw mm4,BYTE_BIT ; mm4={0xFF 0x00 0xFF 0x00 ..} + pand mm4,mm5 ; mm4=Y(0246)=YE + psrlw mm5,BYTE_BIT ; mm5=Y(1357)=YO + + paddw mm0,mm4 ; mm0=((R-Y)E+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm5 ; mm1=((R-Y)O+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + + paddw mm2,mm4 ; mm2=((G-Y)E+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm5 ; mm3=((G-Y)O+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + + paddw mm4, MMWORD [wk(0)] ; mm4=(YE+(B-Y)E)=BE=(B0 B2 B4 B6) + paddw mm5, MMWORD [wk(1)] ; mm5=(YO+(B-Y)O)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow + + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 + +.column_st16: + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 +.column_st8: + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD +.column_st4: + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD +.column_st2: + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD +.column_st1: + cmp ecx, byte SIZEOF_BYTE + jb short .nextrow + mov BYTE [edi+0*SIZEOF_BYTE], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%else + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%endif + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow + + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 + +.column_st16: + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD +.column_st8: + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD +.column_st4: + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .nextrow + movd DWORD [edi+0*SIZEOF_DWORD], mmA + +%endif ; RGB_PIXELSIZE ; --------------- + + alignx 16,7 + +.nextrow: + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop + + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm new file mode 100644 index 00000000..b3ef195b --- /dev/null +++ b/simd/jdclrss2.asm @@ -0,0 +1,500 @@ +; +; jdclrss2.asm - colorspace conversion (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_ycc_rgb_convert_sse2 (JDIMENSION out_width, +; JSAMPIMAGE input_buf, JDIMENSION input_row, +; JSAMPARRAY output_buf, int num_rows) +; + +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_ycc_rgb_convert_sse2) + +EXTN(jsimd_ycc_rgb_convert_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] + + pop ecx + + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 +.rowloop: + push eax + push edi + push edx + push ebx + push esi + push ecx ; col + + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 +.columnloop: + + movdqa xmm5, XMMWORD [ebx] ; xmm5=Cb(0123456789ABCDEF) + movdqa xmm1, XMMWORD [edx] ; xmm1=Cr(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + pcmpeqw xmm7,xmm7 + psrlw xmm4,BYTE_BIT + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} + + pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE + psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO + pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE + psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO + + paddw xmm4,xmm7 + paddw xmm5,xmm7 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm2,xmm4 ; xmm2=CbE + movdqa xmm3,xmm5 ; xmm3=CbO + paddw xmm4,xmm4 ; xmm4=2*CbE + paddw xmm5,xmm5 ; xmm5=2*CbO + movdqa xmm6,xmm0 ; xmm6=CrE + movdqa xmm7,xmm1 ; xmm7=CrO + paddw xmm0,xmm0 ; xmm0=2*CrE + paddw xmm1,xmm1 ; xmm1=2*CrO + + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[GOTOFF(eax,PW_MF0228)] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[GOTOFF(eax,PW_F0402)] ; xmm1=(2*CrO * FIX(0.40200)) + + paddw xmm4,[GOTOFF(eax,PW_ONE)] + paddw xmm5,[GOTOFF(eax,PW_ONE)] + psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) + psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) + paddw xmm0,[GOTOFF(eax,PW_ONE)] + paddw xmm1,[GOTOFF(eax,PW_ONE)] + psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) + psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) + + paddw xmm4,xmm2 + paddw xmm5,xmm3 + paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E + paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O + paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E + paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O + + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + punpcklwd xmm2,xmm6 + punpckhwd xmm4,xmm6 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm3,xmm7 + punpckhwd xmm5,xmm7 + pmaddwd xmm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm4,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm4,SCALEBITS + paddd xmm3,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm3,SCALEBITS + psrad xmm5,SCALEBITS + + packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + + movdqa xmm5, XMMWORD [esi] ; xmm5=Y(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} + pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE + psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO + + paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) + paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) + paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) + paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow + + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD +.column_st15: + mov eax,ecx + xor ecx, byte 0x0F + shl ecx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add eax,ecx + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg ecx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow + + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp ecx, byte SIZEOF_XMMWORD/16 + jb short .nextrow + mov eax,ecx + xor ecx, byte 0x03 + inc ecx + shl ecx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea eax, [ecx+eax*4] ; RGB_PIXELSIZE + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg ecx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + + alignx 16,7 + +.nextrow: + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax + + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop + + sfence ; flush the write buffer + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm index 742c9ceb..f34387b7 100644 --- a/simd/jdcolmmx.asm +++ b/simd/jdcolmmx.asm @@ -2,6 +2,7 @@ ; jdcolmmx.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -48,386 +49,70 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Convert some rows of samples to the output colorspace. -; -; GLOBAL(void) -; jsimd_ycc_rgb_convert_mmx (JDIMENSION out_width, -; JSAMPIMAGE input_buf, JDIMENSION input_row, -; JSAMPARRAY output_buf, int num_rows) -; +%include "jdclrmmx.asm" -%define out_width(b) (b)+8 ; JDIMENSION out_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define input_row(b) (b)+16 ; JDIMENSION input_row -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define num_rows(b) (b)+24 ; int num_rows +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgb_convert_mmx +%include "jdclrmmx.asm" -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgbx_convert_mmx +%include "jdclrmmx.asm" - align 16 - global EXTN(jsimd_ycc_rgb_convert_mmx) +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgr_convert_mmx +%include "jdclrmmx.asm" -EXTN(jsimd_ycc_rgb_convert_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgrx_convert_mmx +%include "jdclrmmx.asm" - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [out_width(eax)] ; num_cols - test ecx,ecx - jz near .return - - push ecx - - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [input_row(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] - - pop ecx - - mov edi, JSAMPARRAY [output_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 -.rowloop: - push eax - push edi - push edx - push ebx - push esi - push ecx ; col - - mov esi, JSAMPROW [esi] ; inptr0 - mov ebx, JSAMPROW [ebx] ; inptr1 - mov edx, JSAMPROW [edx] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - movpic eax, POINTER [gotptr] ; load GOT address (eax) - alignx 16,7 -.columnloop: - - movq mm5, MMWORD [ebx] ; mm5=Cb(01234567) - movq mm1, MMWORD [edx] ; mm1=Cr(01234567) - - pcmpeqw mm4,mm4 - pcmpeqw mm7,mm7 - psrlw mm4,BYTE_BIT - psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} - movq mm0,mm4 ; mm0=mm4={0xFF 0x00 0xFF 0x00 ..} - - pand mm4,mm5 ; mm4=Cb(0246)=CbE - psrlw mm5,BYTE_BIT ; mm5=Cb(1357)=CbO - pand mm0,mm1 ; mm0=Cr(0246)=CrE - psrlw mm1,BYTE_BIT ; mm1=Cr(1357)=CrO - - paddw mm4,mm7 - paddw mm5,mm7 - paddw mm0,mm7 - paddw mm1,mm7 - - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb - - movq mm2,mm4 ; mm2=CbE - movq mm3,mm5 ; mm3=CbO - paddw mm4,mm4 ; mm4=2*CbE - paddw mm5,mm5 ; mm5=2*CbO - movq mm6,mm0 ; mm6=CrE - movq mm7,mm1 ; mm7=CrO - paddw mm0,mm0 ; mm0=2*CrE - paddw mm1,mm1 ; mm1=2*CrO - - pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbE * -FIX(0.22800)) - pmulhw mm5,[GOTOFF(eax,PW_MF0228)] ; mm5=(2*CbO * -FIX(0.22800)) - pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrE * FIX(0.40200)) - pmulhw mm1,[GOTOFF(eax,PW_F0402)] ; mm1=(2*CrO * FIX(0.40200)) - - paddw mm4,[GOTOFF(eax,PW_ONE)] - paddw mm5,[GOTOFF(eax,PW_ONE)] - psraw mm4,1 ; mm4=(CbE * -FIX(0.22800)) - psraw mm5,1 ; mm5=(CbO * -FIX(0.22800)) - paddw mm0,[GOTOFF(eax,PW_ONE)] - paddw mm1,[GOTOFF(eax,PW_ONE)] - psraw mm0,1 ; mm0=(CrE * FIX(0.40200)) - psraw mm1,1 ; mm1=(CrO * FIX(0.40200)) - - paddw mm4,mm2 - paddw mm5,mm3 - paddw mm4,mm2 ; mm4=(CbE * FIX(1.77200))=(B-Y)E - paddw mm5,mm3 ; mm5=(CbO * FIX(1.77200))=(B-Y)O - paddw mm0,mm6 ; mm0=(CrE * FIX(1.40200))=(R-Y)E - paddw mm1,mm7 ; mm1=(CrO * FIX(1.40200))=(R-Y)O - - movq MMWORD [wk(0)], mm4 ; wk(0)=(B-Y)E - movq MMWORD [wk(1)], mm5 ; wk(1)=(B-Y)O - - movq mm4,mm2 - movq mm5,mm3 - punpcklwd mm2,mm6 - punpckhwd mm4,mm6 - pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm4,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd mm3,mm7 - punpckhwd mm5,mm7 - pmaddwd mm3,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] - - paddd mm2,[GOTOFF(eax,PD_ONEHALF)] - paddd mm4,[GOTOFF(eax,PD_ONEHALF)] - psrad mm2,SCALEBITS - psrad mm4,SCALEBITS - paddd mm3,[GOTOFF(eax,PD_ONEHALF)] - paddd mm5,[GOTOFF(eax,PD_ONEHALF)] - psrad mm3,SCALEBITS - psrad mm5,SCALEBITS - - packssdw mm2,mm4 ; mm2=CbE*-FIX(0.344)+CrE*FIX(0.285) - packssdw mm3,mm5 ; mm3=CbO*-FIX(0.344)+CrO*FIX(0.285) - psubw mm2,mm6 ; mm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E - psubw mm3,mm7 ; mm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O - - movq mm5, MMWORD [esi] ; mm5=Y(01234567) - - pcmpeqw mm4,mm4 - psrlw mm4,BYTE_BIT ; mm4={0xFF 0x00 0xFF 0x00 ..} - pand mm4,mm5 ; mm4=Y(0246)=YE - psrlw mm5,BYTE_BIT ; mm5=Y(1357)=YO - - paddw mm0,mm4 ; mm0=((R-Y)E+YE)=RE=(R0 R2 R4 R6) - paddw mm1,mm5 ; mm1=((R-Y)O+YO)=RO=(R1 R3 R5 R7) - packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) - packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) - - paddw mm2,mm4 ; mm2=((G-Y)E+YE)=GE=(G0 G2 G4 G6) - paddw mm3,mm5 ; mm3=((G-Y)O+YO)=GO=(G1 G3 G5 G7) - packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) - packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) - - paddw mm4, MMWORD [wk(0)] ; mm4=(YE+(B-Y)E)=BE=(B0 B2 B4 B6) - paddw mm5, MMWORD [wk(1)] ; mm5=(YO+(B-Y)O)=BO=(B1 B3 B5 B7) - packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) - packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) - -%if RGB_PIXELSIZE == 3 ; --------------- - - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) - - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) - punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) - - movq mmG,mmA - movq mmH,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) - punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) - - psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) - psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) - - movq mmC,mmD - movq mmB,mmD - punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) - punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) - - psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) - - movq mmF,mmE - punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) - punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) - - punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) - punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) - punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) - - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 - - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - - sub ecx, byte SIZEOF_MMWORD - jz short .nextrow - - add esi, byte SIZEOF_MMWORD ; inptr0 - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - jmp near .columnloop - alignx 16,7 - -.column_st16: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_MMWORD - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq mmA,mmC - sub ecx, byte 2*SIZEOF_MMWORD - add edi, byte 2*SIZEOF_MMWORD - jmp short .column_st4 -.column_st8: - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmE - sub ecx, byte SIZEOF_MMWORD - add edi, byte SIZEOF_MMWORD -.column_st4: - movd eax,mmA - cmp ecx, byte SIZEOF_DWORD - jb short .column_st2 - mov DWORD [edi+0*SIZEOF_DWORD], eax - psrlq mmA,DWORD_BIT - movd eax,mmA - sub ecx, byte SIZEOF_DWORD - add edi, byte SIZEOF_DWORD -.column_st2: - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi+0*SIZEOF_WORD], ax - shr eax,WORD_BIT - sub ecx, byte SIZEOF_WORD - add edi, byte SIZEOF_WORD -.column_st1: - cmp ecx, byte SIZEOF_BYTE - jb short .nextrow - mov BYTE [edi+0*SIZEOF_BYTE], al - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -%ifdef RGBX_FILLER_0XFF - pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) -%else - pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) -%endif - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) - - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) - punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) - punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) - - movq mmC,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) - punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) - movq mmG,mmB - punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) - punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) - - movq mmD,mmA - punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) - punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) - movq mmH,mmC - punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) - punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) - - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 - - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - movq MMWORD [edi+3*SIZEOF_MMWORD], mmH - - sub ecx, byte SIZEOF_MMWORD - jz short .nextrow - - add esi, byte SIZEOF_MMWORD ; inptr0 - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - jmp near .columnloop - alignx 16,7 - -.column_st16: - cmp ecx, byte SIZEOF_MMWORD/2 - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq mmA,mmC - movq mmD,mmH - sub ecx, byte SIZEOF_MMWORD/2 - add edi, byte 2*SIZEOF_MMWORD -.column_st8: - cmp ecx, byte SIZEOF_MMWORD/4 - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmD - sub ecx, byte SIZEOF_MMWORD/4 - add edi, byte 1*SIZEOF_MMWORD -.column_st4: - cmp ecx, byte SIZEOF_MMWORD/8 - jb short .nextrow - movd DWORD [edi+0*SIZEOF_DWORD], mmA - -%endif ; RGB_PIXELSIZE ; --------------- - - alignx 16,7 - -.nextrow: - pop ecx - pop esi - pop ebx - pop edx - pop edi - pop eax - - add esi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - add edi, byte SIZEOF_JSAMPROW ; output_buf - dec eax ; num_rows - jg near .rowloop - - emms ; empty MMX state - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxbgr_convert_mmx +%include "jdclrmmx.asm" +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxrgb_convert_mmx +%include "jdclrmmx.asm" diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm index 6f74cc63..b13c9444 100644 --- a/simd/jdcolss2.asm +++ b/simd/jdcolss2.asm @@ -2,6 +2,7 @@ ; jdcolss2.asm - colorspace conversion (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -48,484 +49,70 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Convert some rows of samples to the output colorspace. -; -; GLOBAL(void) -; jsimd_ycc_rgb_convert_sse2 (JDIMENSION out_width, -; JSAMPIMAGE input_buf, JDIMENSION input_row, -; JSAMPARRAY output_buf, int num_rows) -; +%include "jdclrss2.asm" -%define out_width(b) (b)+8 ; JDIMENSION out_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define input_row(b) (b)+16 ; JDIMENSION input_row -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define num_rows(b) (b)+24 ; int num_rows +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 +%include "jdclrss2.asm" -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 +%include "jdclrss2.asm" - align 16 - global EXTN(jsimd_ycc_rgb_convert_sse2) +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 +%include "jdclrss2.asm" -EXTN(jsimd_ycc_rgb_convert_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 +%include "jdclrss2.asm" - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [out_width(eax)] ; num_cols - test ecx,ecx - jz near .return - - push ecx - - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [input_row(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] - - pop ecx - - mov edi, JSAMPARRAY [output_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 -.rowloop: - push eax - push edi - push edx - push ebx - push esi - push ecx ; col - - mov esi, JSAMPROW [esi] ; inptr0 - mov ebx, JSAMPROW [ebx] ; inptr1 - mov edx, JSAMPROW [edx] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - movpic eax, POINTER [gotptr] ; load GOT address (eax) - alignx 16,7 -.columnloop: - - movdqa xmm5, XMMWORD [ebx] ; xmm5=Cb(0123456789ABCDEF) - movdqa xmm1, XMMWORD [edx] ; xmm1=Cr(0123456789ABCDEF) - - pcmpeqw xmm4,xmm4 - pcmpeqw xmm7,xmm7 - psrlw xmm4,BYTE_BIT - psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} - movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} - - pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE - psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO - pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE - psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO - - paddw xmm4,xmm7 - paddw xmm5,xmm7 - paddw xmm0,xmm7 - paddw xmm1,xmm7 - - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb - - movdqa xmm2,xmm4 ; xmm2=CbE - movdqa xmm3,xmm5 ; xmm3=CbO - paddw xmm4,xmm4 ; xmm4=2*CbE - paddw xmm5,xmm5 ; xmm5=2*CbO - movdqa xmm6,xmm0 ; xmm6=CrE - movdqa xmm7,xmm1 ; xmm7=CrO - paddw xmm0,xmm0 ; xmm0=2*CrE - paddw xmm1,xmm1 ; xmm1=2*CrO - - pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbE * -FIX(0.22800)) - pmulhw xmm5,[GOTOFF(eax,PW_MF0228)] ; xmm5=(2*CbO * -FIX(0.22800)) - pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrE * FIX(0.40200)) - pmulhw xmm1,[GOTOFF(eax,PW_F0402)] ; xmm1=(2*CrO * FIX(0.40200)) - - paddw xmm4,[GOTOFF(eax,PW_ONE)] - paddw xmm5,[GOTOFF(eax,PW_ONE)] - psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) - psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) - paddw xmm0,[GOTOFF(eax,PW_ONE)] - paddw xmm1,[GOTOFF(eax,PW_ONE)] - psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) - psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) - - paddw xmm4,xmm2 - paddw xmm5,xmm3 - paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E - paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O - paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E - paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O - - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O - - movdqa xmm4,xmm2 - movdqa xmm5,xmm3 - punpcklwd xmm2,xmm6 - punpckhwd xmm4,xmm6 - pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm4,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd xmm3,xmm7 - punpckhwd xmm5,xmm7 - pmaddwd xmm3,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] - - paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm4,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm2,SCALEBITS - psrad xmm4,SCALEBITS - paddd xmm3,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm3,SCALEBITS - psrad xmm5,SCALEBITS - - packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) - packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) - psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E - psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O - - movdqa xmm5, XMMWORD [esi] ; xmm5=Y(0123456789ABCDEF) - - pcmpeqw xmm4,xmm4 - psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} - pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE - psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO - - paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) - paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - - paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) - paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - - paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) - paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) - -%if RGB_PIXELSIZE == 3 ; --------------- - - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 - - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - jmp short .out0 -.out1: ; --(unaligned)----------------- - pcmpeqb xmmH,xmmH ; xmmH=(all 1's) - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF - add edi, byte SIZEOF_XMMWORD ; outptr -.out0: - sub ecx, byte SIZEOF_XMMWORD - jz near .nextrow - - add esi, byte SIZEOF_XMMWORD ; inptr0 - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st32: - pcmpeqb xmmH,xmmH ; xmmH=(all 1's) - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub ecx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 -.column_st16: - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st15 - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD -.column_st15: - mov eax,ecx - xor ecx, byte 0x0F - shl ecx, 2 - movd xmmB,ecx - psrlq xmmH,4 - pcmpeqb xmmE,xmmE - psrlq xmmH,xmmB - psrlq xmmE,xmmB - punpcklbw xmmE,xmmH - ; ---------------- - mov ecx,edi - and ecx, byte SIZEOF_XMMWORD-1 - jz short .adj0 - add eax,ecx - cmp eax, byte SIZEOF_XMMWORD - ja short .adj0 - and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary - shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx - movdqa xmmG,xmmA - movdqa xmmC,xmmE - pslldq xmmA, SIZEOF_XMMWORD/2 - pslldq xmmE, SIZEOF_XMMWORD/2 - movd xmmD,ecx - sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT - jb short .adj1 - movd xmmF,ecx - psllq xmmA,xmmF - psllq xmmE,xmmF - jmp short .adj0 -.adj1: neg ecx - movd xmmF,ecx - psrlq xmmA,xmmF - psrlq xmmE,xmmF - psllq xmmG,xmmD - psllq xmmC,xmmD - por xmmA,xmmG - por xmmE,xmmC -.adj0: ; ---------------- - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -%ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) -%else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) -%endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 - - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - jmp short .out0 -.out1: ; --(unaligned)----------------- - pcmpeqb xmmE,xmmE ; xmmE=(all 1's) - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH - add edi, byte SIZEOF_XMMWORD ; outptr -.out0: - sub ecx, byte SIZEOF_XMMWORD - jz near .nextrow - - add esi, byte SIZEOF_XMMWORD ; inptr0 - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st32: - pcmpeqb xmmE,xmmE ; xmmE=(all 1's) - cmp ecx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub ecx, byte SIZEOF_XMMWORD/2 -.column_st16: - cmp ecx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD/4 -.column_st15: - cmp ecx, byte SIZEOF_XMMWORD/16 - jb short .nextrow - mov eax,ecx - xor ecx, byte 0x03 - inc ecx - shl ecx, 4 - movd xmmF,ecx - psrlq xmmE,xmmF - punpcklbw xmmE,xmmE - ; ---------------- - mov ecx,edi - and ecx, byte SIZEOF_XMMWORD-1 - jz short .adj0 - lea eax, [ecx+eax*4] ; RGB_PIXELSIZE - cmp eax, byte SIZEOF_XMMWORD - ja short .adj0 - and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary - shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx - movdqa xmmB,xmmA - movdqa xmmG,xmmE - pslldq xmmA, SIZEOF_XMMWORD/2 - pslldq xmmE, SIZEOF_XMMWORD/2 - movd xmmC,ecx - sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT - jb short .adj1 - movd xmmH,ecx - psllq xmmA,xmmH - psllq xmmE,xmmH - jmp short .adj0 -.adj1: neg ecx - movd xmmH,ecx - psrlq xmmA,xmmH - psrlq xmmE,xmmH - psllq xmmB,xmmC - psllq xmmG,xmmC - por xmmA,xmmB - por xmmE,xmmG -.adj0: ; ---------------- - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - -%endif ; RGB_PIXELSIZE ; --------------- - - alignx 16,7 - -.nextrow: - pop ecx - pop esi - pop ebx - pop edx - pop edi - pop eax - - add esi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - add edi, byte SIZEOF_JSAMPROW ; output_buf - dec eax ; num_rows - jg near .rowloop - - sfence ; flush the write buffer - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 +%include "jdclrss2.asm" +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 +%include "jdclrss2.asm" diff --git a/simd/jsimd.h b/simd/jsimd.h index 371586e6..a5b432ff 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -21,11 +21,35 @@ #ifdef NEED_SHORT_EXTERNAL_NAMES #define jpeg_simd_cpu_support jSiCpuSupport #define jsimd_rgb_ycc_convert_mmx jSRGBYCCM +#define jsimd_extrgb_ycc_convert_mmx jSEXTRGBYCCM +#define jsimd_extrgbx_ycc_convert_mmx jSEXTRGBXYCCM +#define jsimd_extbgr_ycc_convert_mmx jSEXTBGRYCCM +#define jsimd_extbgrx_ycc_convert_mmx jSEXTBGRXYCCM +#define jsimd_extxbgr_ycc_convert_mmx jSEXTXBGRYCCM +#define jsimd_extxrgb_ycc_convert_mmx jSEXTXRGBYCCM #define jsimd_ycc_rgb_convert_mmx jSYCCRGBM +#define jsimd_ycc_extrgb_convert_mmx jSYCCEXTRGBM +#define jsimd_ycc_extrgbx_convert_mmx jSYCCEXTRGBXM +#define jsimd_ycc_extbgr_convert_mmx jSYCCEXTBGRM +#define jsimd_ycc_extbgrx_convert_mmx jSYCCEXTBGRXM +#define jsimd_ycc_extxbgr_convert_mmx jSYCCEXTXBGRM +#define jsimd_ycc_extxrgb_convert_mmx jSYCCEXTXRGBM #define jconst_rgb_ycc_convert_sse2 jSCRGBYCCS2 #define jsimd_rgb_ycc_convert_sse2 jSRGBYCCS2 +#define jsimd_extrgb_ycc_convert_sse2 jSEXTRGBYCCS2 +#define jsimd_extrgbx_ycc_convert_sse2 jSEXTRGBXYCCS2 +#define jsimd_extbgr_ycc_convert_sse2 jSEXTBGRYCCS2 +#define jsimd_extbgrx_ycc_convert_sse2 jSEXTBGRXYCCS2 +#define jsimd_extxbgr_ycc_convert_sse2 jSEXTXBGRYCCS2 +#define jsimd_extxrgb_ycc_convert_sse2 jSEXTXRGBYCCS2 #define jconst_ycc_rgb_convert_sse2 jSCYCCRGBS2 #define jsimd_ycc_rgb_convert_sse2 jSYCCRGBS2 +#define jsimd_ycc_extrgb_convert_sse2 jSYCCEXTRGBS2 +#define jsimd_ycc_extrgbx_convert_sse2 jSYCCEXTRGBXS2 +#define jsimd_ycc_extbgr_convert_sse2 jSYCCEXTBGRS2 +#define jsimd_ycc_extbgrx_convert_sse2 jSYCCEXTBGRXS2 +#define jsimd_ycc_extxbgr_convert_sse2 jSYCCEXTXBGRS2 +#define jsimd_ycc_extxrgb_convert_sse2 jSYCCEXTXRGBS2 #define jsimd_h2v2_downsample_mmx jSDnH2V2M #define jsimd_h2v1_downsample_mmx jSDnH2V1M #define jsimd_h2v2_downsample_sse2 jSDnH2V2S2 @@ -89,21 +113,119 @@ EXTERN(void) jsimd_rgb_ycc_convert_mmx JPP((JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extrgb_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extrgbx_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extbgr_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extbgrx_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extxbgr_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extxrgb_ycc_convert_mmx + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); + EXTERN(void) jsimd_ycc_rgb_convert_mmx JPP((JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extrgb_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extbgr_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmx + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); extern const int jconst_rgb_ycc_convert_sse2[]; EXTERN(void) jsimd_rgb_ycc_convert_sse2 JPP((JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extrgb_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extrgbx_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extbgr_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extbgrx_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extxbgr_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +EXTERN(void) jsimd_extxrgb_ycc_convert_sse2 + JPP((JDIMENSION img_width, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); + extern const int jconst_ycc_rgb_convert_sse2[]; EXTERN(void) jsimd_ycc_rgb_convert_sse2 JPP((JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extrgb_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extrgbx_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extbgr_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extbgrx_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extxbgr_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_extxrgb_convert_sse2 + JPP((JDIMENSION out_width, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); /* SIMD Downsample */ EXTERN(void) jsimd_h2v2_downsample_mmx From 65b7cbecf3754f927552d73245974e3b911b260a Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 3 Apr 2009 12:04:24 +0000 Subject: [PATCH 035/985] Include low-level unit tests borrowed from VirtualGL --- Makefile.am | 13 +- bmp.c | 370 +++++++++++++++++++++++++++++++++++++++++++++++++ bmp.h | 48 +++++++ jpegut.c | 384 +++++++++++++++++++++++++++++++++++++++++++++++++++ jpgtest.cxx | 382 ++++++++++++++++++++++++++++++++++++++++++++++++++ rrtimer.h | 114 +++++++++++++++ rrutil.h | 81 +++++++++++ turbojpeg.h | 229 ++++++++++++++++++++++++++++++ turbojpegl.c | 352 ++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 1972 insertions(+), 1 deletion(-) create mode 100644 bmp.c create mode 100644 bmp.h create mode 100644 jpegut.c create mode 100644 jpgtest.cxx create mode 100644 rrtimer.h create mode 100644 rrutil.h create mode 100644 turbojpeg.h create mode 100644 turbojpegl.c diff --git a/Makefile.am b/Makefile.am index 1d868b7b..93120789 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libjpeg.la HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ - jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h + jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h turbojpeg.h libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ @@ -20,3 +20,14 @@ libjpeg_la_LIBADD = simd/libsimd.la endif +TSTHDRS = turbojpeg.h rrutil.h rrtimer.h + +bin_PROGRAMS = jpgtest jpegut + +jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.c turbojpegl.c + +jpgtest_LDADD = $(top_srcdir)/libjpeg.la + +jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.c turbojpegl.c + +jpegut_LDADD = $(top_srcdir)/libjpeg.la diff --git a/bmp.c b/bmp.c new file mode 100644 index 00000000..3ccc8772 --- /dev/null +++ b/bmp.c @@ -0,0 +1,370 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. +*/ + +#include +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 + #include +#else + #include +#endif +#include "./rrutil.h" +#include "./bmp.h" + +#ifndef BI_BITFIELDS +#define BI_BITFIELDS 3L +#endif +#ifndef BI_RGB +#define BI_RGB 0L +#endif + +#define BMPHDRSIZE 54 +typedef struct _bmphdr +{ + unsigned short bfType; + unsigned int bfSize; + unsigned short bfReserved1, bfReserved2; + unsigned int bfOffBits; + + unsigned int biSize; + int biWidth, biHeight; + unsigned short biPlanes, biBitCount; + unsigned int biCompression, biSizeImage; + int biXPelsPerMeter, biYPelsPerMeter; + unsigned int biClrUsed, biClrImportant; +} bmphdr; + +static const char *__bmperr="No error"; + +static const int ps[BMPPIXELFORMATS]={3, 4, 3, 4, 4, 4}; +static const int roffset[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1}; +static const int goffset[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2}; +static const int boffset[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3}; + +#define _throw(m) {__bmperr=m; retcode=-1; goto finally;} +#define _unix(f) {if((f)==-1) _throw(strerror(errno));} +#define _catch(f) {if((f)==-1) {retcode=-1; goto finally;}} + +#define readme(fd, addr, size) \ + if((bytesread=read(fd, addr, (size)))==-1) _throw(strerror(errno)); \ + if(bytesread!=(size)) _throw("Read error"); + +void pixelconvert(unsigned char *srcbuf, enum BMPPIXELFORMAT srcformat, + int srcpitch, unsigned char *dstbuf, enum BMPPIXELFORMAT dstformat, int dstpitch, + int w, int h, int flip) +{ + unsigned char *srcptr, *srcptr0, *dstptr, *dstptr0; + int i, j; + + srcptr=flip? &srcbuf[srcpitch*(h-1)]:srcbuf; + for(j=0, dstptr=dstbuf; jBMPPIXELFORMATS-1 || align<1) + _throw("invalid argument to loadbmp()"); + if((align&(align-1))!=0) + _throw("Alignment must be a power of 2"); + _unix(fd=open(filename, flags)); + + readme(fd, &bh.bfType, sizeof(unsigned short)); + if(!littleendian()) bh.bfType=byteswap16(bh.bfType); + + if(bh.bfType==0x3650) + { + _catch(loadppm(&fd, buf, w, h, f, align, dstbottomup, 0)); + goto finally; + } + if(bh.bfType==0x3350) + { + _catch(loadppm(&fd, buf, w, h, f, align, dstbottomup, 1)); + goto finally; + } + + readme(fd, &bh.bfSize, sizeof(unsigned int)); + readme(fd, &bh.bfReserved1, sizeof(unsigned short)); + readme(fd, &bh.bfReserved2, sizeof(unsigned short)); + readme(fd, &bh.bfOffBits, sizeof(unsigned int)); + readme(fd, &bh.biSize, sizeof(unsigned int)); + readme(fd, &bh.biWidth, sizeof(int)); + readme(fd, &bh.biHeight, sizeof(int)); + readme(fd, &bh.biPlanes, sizeof(unsigned short)); + readme(fd, &bh.biBitCount, sizeof(unsigned short)); + readme(fd, &bh.biCompression, sizeof(unsigned int)); + readme(fd, &bh.biSizeImage, sizeof(unsigned int)); + readme(fd, &bh.biXPelsPerMeter, sizeof(int)); + readme(fd, &bh.biYPelsPerMeter, sizeof(int)); + readme(fd, &bh.biClrUsed, sizeof(unsigned int)); + readme(fd, &bh.biClrImportant, sizeof(unsigned int)); + + if(!littleendian()) + { + bh.bfSize=byteswap(bh.bfSize); + bh.bfOffBits=byteswap(bh.bfOffBits); + bh.biSize=byteswap(bh.biSize); + bh.biWidth=byteswap(bh.biWidth); + bh.biHeight=byteswap(bh.biHeight); + bh.biPlanes=byteswap16(bh.biPlanes); + bh.biBitCount=byteswap16(bh.biBitCount); + bh.biCompression=byteswap(bh.biCompression); + bh.biSizeImage=byteswap(bh.biSizeImage); + bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter); + bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter); + bh.biClrUsed=byteswap(bh.biClrUsed); + bh.biClrImportant=byteswap(bh.biClrImportant); + } + + if(bh.bfType!=0x4d42 || bh.bfOffBitsBMPPIXELFORMATS-1 || srcpitch<0) + _throw("bad argument to savebmp()"); + + if(srcpitch==0) srcpitch=w*ps[f]; + + if((temp=strrchr(filename, '.'))!=NULL) + { + if(!stricmp(temp, ".ppm")) + return saveppm(filename, buf, w, h, f, srcpitch, srcbottomup); + } + + _unix(fd=open(filename, flags, mode)); + dstpitch=((w*3)+3)&(~3); + + bh.bfType=0x4d42; + bh.bfSize=BMPHDRSIZE+dstpitch*h; + bh.bfReserved1=0; bh.bfReserved2=0; + bh.bfOffBits=BMPHDRSIZE; + bh.biSize=40; + bh.biWidth=w; bh.biHeight=h; + bh.biPlanes=0; bh.biBitCount=24; + bh.biCompression=BI_RGB; bh.biSizeImage=0; + bh.biXPelsPerMeter=0; bh.biYPelsPerMeter=0; + bh.biClrUsed=0; bh.biClrImportant=0; + + if(!littleendian()) + { + bh.bfType=byteswap16(bh.bfType); + bh.bfSize=byteswap(bh.bfSize); + bh.bfOffBits=byteswap(bh.bfOffBits); + bh.biSize=byteswap(bh.biSize); + bh.biWidth=byteswap(bh.biWidth); + bh.biHeight=byteswap(bh.biHeight); + bh.biPlanes=byteswap16(bh.biPlanes); + bh.biBitCount=byteswap16(bh.biBitCount); + bh.biCompression=byteswap(bh.biCompression); + bh.biSizeImage=byteswap(bh.biSizeImage); + bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter); + bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter); + bh.biClrUsed=byteswap(bh.biClrUsed); + bh.biClrImportant=byteswap(bh.biClrImportant); + } + + writeme(fd, &bh.bfType, sizeof(unsigned short)); + writeme(fd, &bh.bfSize, sizeof(unsigned int)); + writeme(fd, &bh.bfReserved1, sizeof(unsigned short)); + writeme(fd, &bh.bfReserved2, sizeof(unsigned short)); + writeme(fd, &bh.bfOffBits, sizeof(unsigned int)); + writeme(fd, &bh.biSize, sizeof(unsigned int)); + writeme(fd, &bh.biWidth, sizeof(int)); + writeme(fd, &bh.biHeight, sizeof(int)); + writeme(fd, &bh.biPlanes, sizeof(unsigned short)); + writeme(fd, &bh.biBitCount, sizeof(unsigned short)); + writeme(fd, &bh.biCompression, sizeof(unsigned int)); + writeme(fd, &bh.biSizeImage, sizeof(unsigned int)); + writeme(fd, &bh.biXPelsPerMeter, sizeof(int)); + writeme(fd, &bh.biYPelsPerMeter, sizeof(int)); + writeme(fd, &bh.biClrUsed, sizeof(unsigned int)); + writeme(fd, &bh.biClrImportant, sizeof(unsigned int)); + + if((tempbuf=(unsigned char *)malloc(dstpitch*h))==NULL) + _throw("Memory allocation error"); + + pixelconvert(buf, f, srcpitch, tempbuf, BMP_BGR, dstpitch, w, h, + !srcbottomup); + + if((byteswritten=write(fd, tempbuf, dstpitch*h))!=dstpitch*h) + _throw(strerror(errno)); + + finally: + if(tempbuf) free(tempbuf); + if(fd!=-1) close(fd); + return retcode; +} + +const char *bmpgeterr(void) +{ + return __bmperr; +} diff --git a/bmp.h b/bmp.h new file mode 100644 index 00000000..437d3275 --- /dev/null +++ b/bmp.h @@ -0,0 +1,48 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. +*/ + +// This provides rudimentary facilities for loading and saving true color +// BMP and PPM files + +#ifndef __BMP_H__ +#define __BMP_H__ + +#define BMPPIXELFORMATS 6 +enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBA, BMP_BGR, BMP_BGRA, BMP_ABGR, BMP_ARGB}; + +#ifdef __cplusplus +extern "C" { +#endif + +// This will load a Windows bitmap from a file and return a buffer with the +// specified pixel format, scanline alignment, and orientation. The width and +// height are returned in w and h. + +int loadbmp(char *filename, unsigned char **buf, int *w, int *h, + enum BMPPIXELFORMAT f, int align, int dstbottomup); + +// This will save a buffer with the specified pixel format, pitch, orientation, +// width, and height as a 24-bit Windows bitmap or PPM (the filename determines +// which format to use) + +int savebmp(char *filename, unsigned char *buf, int w, int h, + enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup); + +const char *bmpgeterr(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/jpegut.c b/jpegut.c new file mode 100644 index 00000000..777cd3dd --- /dev/null +++ b/jpegut.c @@ -0,0 +1,384 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + +#include +#include +#include +#include "./rrtimer.h" +#include "./turbojpeg.h" + +#define _catch(f) {if((f)==-1) {printf("TJPEG: %s\n", tjGetErrorStr()); goto finally;}} + +const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:1:1", "GRAY"}; +const char *_subnames[NUMSUBOPT]={"444", "422", "411", "GRAY"}; + +int pixels[9][3]= +{ + {0, 255, 0}, + {255, 0, 255}, + {255, 255, 0}, + {0, 0, 255}, + {0, 255, 255}, + {255, 0, 0}, + {255, 255, 255}, + {0, 0, 0}, + {255, 0, 0} +}; + +void initbuf(unsigned char *buf, int w, int h, int ps, int flags) +{ + int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i, + _i, j; + if(flags&TJ_ALPHAFIRST) {roffset++; goffset++; boffset++;} + memset(buf, 0, w*h*ps); + for(_i=0; _i<16; _i++) + { + if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i; + for(j=0; j78 || g<74 || g>78 || b<74 || b>78) return 0; + } + } + } + for(_i=16; _i2 || g>2 || b>2) return 0; + } + else + { + if(r<224 || r>228 || g<224 || g>228 || b<224 || b>228) return 0; + } + } + } + } + else + { + for(_i=0; _i<16; _i++) + { + if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i; + for(j=0; j2) return 0; + if(buf[(w*i+j)*ps+boffset]>2) return 0; + } + } + } + for(_i=16; _i2) return 0; + if(((_i/8)+(j/8))%2==0) + { + if(buf[(w*i+j)*ps+roffset]>2) return 0; + if(buf[(w*i+j)*ps+goffset]>2) return 0; + } + else + { + if(buf[(w*i+j)*ps+roffset]<253) return 0; + if(buf[(w*i+j)*ps+goffset]<253) return 0; + } + } + } + } + return 1; +} + +void writejpeg(unsigned char *jpegbuf, unsigned long jpgbufsize, char *filename) +{ + FILE *outfile=NULL; + if((outfile=fopen(filename, "wb"))==NULL) + { + printf("ERROR: Could not open %s for writing.\n", filename); + goto finally; + } + if(fwrite(jpegbuf, jpgbufsize, 1, outfile)!=1) + { + printf("ERROR: Could not write to %s.\n", filename); + goto finally; + } + + finally: + if(outfile) fclose(outfile); +} + +void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size, + int w, int h, int ps, char *basefilename, int subsamp, int qual, int flags) +{ + char tempstr[1024]; unsigned char *bmpbuf=NULL; + const char *pixformat; double t; + + if(flags&TJ_BGR) + { + if(ps==3) pixformat="BGR"; + else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";} + } + else + { + if(ps==3) pixformat="RGB"; + else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";} + } + printf("%s %s -> %s Q%d ... ", pixformat, + (flags&TJ_BOTTOMUP)?"Bottom-Up":"Top-Down ", _subnamel[subsamp], qual); + + if((bmpbuf=(unsigned char *)malloc(w*h*ps+1))==NULL) + { + printf("ERROR: Could not allocate buffer\n"); goto finally; + } + initbuf(bmpbuf, w, h, ps, flags); + memset(jpegbuf, 0, TJBUFSIZE(w, h)); + + t=rrtime(); + _catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual, flags)); + t=rrtime()-t; + + sprintf(tempstr, "%s_enc_%s_%s_%sQ%d.jpg", basefilename, pixformat, + (flags&TJ_BOTTOMUP)? "BU":"TD", _subnames[subsamp], qual); + writejpeg(jpegbuf, *size, tempstr); + printf("Done. %f ms\n Result in %s\n", t*1000., tempstr); + + finally: + if(bmpbuf) free(bmpbuf); +} + +void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize, + int w, int h, int ps, char *basefilename, int subsamp, int qual, int flags) +{ + unsigned char *bmpbuf=NULL; + const char *pixformat; int _w=0, _h=0; double t; + + if(flags&TJ_BGR) + { + if(ps==3) pixformat="BGR"; + else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";} + } + else + { + if(ps==3) pixformat="RGB"; + else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";} + } + printf("JPEG -> %s %s ... ", pixformat, (flags&TJ_BOTTOMUP)?"Bottom-Up":"Top-Down "); + + _catch(tjDecompressHeader(hnd, jpegbuf, jpegsize, &_w, &_h)); + if(_w!=w || _h!=h) + { + printf("Incorrect JPEG header\n"); goto finally; + } + + if((bmpbuf=(unsigned char *)malloc(w*h*ps+1))==NULL) + { + printf("ERROR: Could not allocate buffer\n"); goto finally; + } + memset(bmpbuf, 0, w*ps*h); + + t=rrtime(); + _catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps, flags)); + t=rrtime()-t; + + if(checkbuf(bmpbuf, w, h, ps, subsamp, flags)) printf("Passed."); + else {printf("FAILED!"); dumpbuf(bmpbuf, w, h, ps, flags);} + + printf(" %f ms\n\n", t*1000.); + + finally: + if(bmpbuf) free(bmpbuf); +} + +void dotest(int w, int h, int ps, int subsamp, char *basefilename) +{ + tjhandle hnd=NULL, dhnd=NULL; unsigned char *jpegbuf=NULL; + unsigned long size; + + if((jpegbuf=(unsigned char *)malloc(TJBUFSIZE(w, h))) == NULL) + { + puts("ERROR: Could not allocate buffer."); goto finally; + } + + if((hnd=tjInitCompress())==NULL) + {printf("Error in tjInitCompress():\n%s\n", tjGetErrorStr()); goto finally;} + if((dhnd=tjInitDecompress())==NULL) + {printf("Error in tjInitDecompress():\n%s\n", tjGetErrorStr()); goto finally;} + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, 0); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, 0); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BGR); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_BGR); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BOTTOMUP); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_BOTTOMUP); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BGR|TJ_BOTTOMUP); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_BGR|TJ_BOTTOMUP); + + if(ps==4) + { + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BOTTOMUP); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BOTTOMUP); + + gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR|TJ_BOTTOMUP); + gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR|TJ_BOTTOMUP); + } + + finally: + if(hnd) tjDestroy(hnd); + if(dhnd) tjDestroy(dhnd); + + if(jpegbuf) free(jpegbuf); +} + +#define MAXLENGTH 2048 + +void dotest1(void) +{ + int i, j, i2; unsigned char *bmpbuf=NULL, *jpgbuf=NULL; + tjhandle hnd=NULL; unsigned long size; + if((hnd=tjInitCompress())==NULL) + {printf("Error in tjInitCompress():\n%s\n", tjGetErrorStr()); goto finally;} + printf("Buffer size regression test\n"); + for(j=1; j<48; j++) + { + for(i=1; i<(j==1?MAXLENGTH:48); i++) + { + if(i%100==0) printf("%.4d x %.4d\b\b\b\b\b\b\b\b\b\b\b", i, j); + if((bmpbuf=(unsigned char *)malloc(i*j*4))==NULL + || (jpgbuf=(unsigned char *)malloc(TJBUFSIZE(i, j)))==NULL) + { + printf("Memory allocation failure\n"); goto finally; + } + memset(bmpbuf, 0, i*j*4); + for(i2=0; i2 +#include +#include +#include +#include "./bmp.h" +#include "./rrutil.h" +#include "./rrtimer.h" +#include "./turbojpeg.h" + +#define _catch(f) {if((f)==-1) {printf("Error in %s:\n%s\n", #f, tjGetErrorStr()); goto bailout;}} + +int forcemmx=0, forcesse=0, forcesse2=0, forcesse3=0; +const int _ps[BMPPIXELFORMATS]={3, 4, 3, 4, 4, 4}; +const int _flags[BMPPIXELFORMATS]={0, 0, TJ_BGR, TJ_BGR, + TJ_BGR|TJ_ALPHAFIRST, TJ_ALPHAFIRST}; +const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1}; +const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2}; +const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3}; +const char *_pfname[]={"RGB", "RGBA", "BGR", "BGRA", "ABGR", "ARGB"}; +const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:1:1", "GRAY"}; +const char *_subnames[NUMSUBOPT]={"444", "422", "411", "GRAY"}; + +void printsigfig(double val, int figs) +{ + char format[80]; + double _l=log10(val); int l; + if(_l<0.) + { + l=(int)fabs(_l); + sprintf(format, "%%%d.%df", figs+l+2, figs+l); + } + else + { + l=(int)_l+1; + if(figs<=l) sprintf(format, "%%.0f"); + else sprintf(format, "%%%d.%df", figs+1, figs-l); + } + printf(format, val); +} + +void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu, + int jpegsub, int qual, char *filename, int dotile, int useppm, int quiet) +{ + char tempstr[1024]; + FILE *outfile; tjhandle hnd; + unsigned char **jpegbuf=NULL, *rgbbuf=NULL; + rrtimer timer; double elapsed; + int jpgbufsize=0, i, j, tilesizex, tilesizey, numtilesx, numtilesy, ITER; + unsigned long *comptilesize=NULL; + int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0) + |(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0); + int ps=_ps[pf]; + int pitch=w*ps; + + flags |= _flags[pf]; + if(bu) flags |= TJ_BOTTOMUP; + + if((rgbbuf=(unsigned char *)malloc(pitch*h)) == NULL) + { + puts("ERROR: Could not allocate image buffer."); + exit(1); + } + + if(!quiet) printf("\n>>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf], + bu?"Bottom-up":"Top-down", _subnamel[jpegsub], qual); + if(dotile) {tilesizex=tilesizey=4;} else {tilesizex=w; tilesizey=h;} + + do + { + tilesizex*=2; if(tilesizex>w) tilesizex=w; + tilesizey*=2; if(tilesizey>h) tilesizey=h; + numtilesx=(w+tilesizex-1)/tilesizex; + numtilesy=(h+tilesizey-1)/tilesizey; + if((comptilesize=(unsigned long *)malloc(sizeof(unsigned long)*numtilesx*numtilesy)) == NULL + || (jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)*numtilesx*numtilesy)) == NULL) + { + puts("ERROR: Could not allocate image buffers."); + goto bailout; + } + memset(jpegbuf, 0, sizeof(unsigned char *)*numtilesx*numtilesy); + for(i=0; i Frame rate: %f fps\n", (double)ITER/elapsed); + printf(" Output image size: %d bytes\n", jpgbufsize); + printf(" Compression ratio: %f:1\n", + (double)(w*h*ps)/(double)jpgbufsize); + printf(" Source throughput: %f Megapixels/sec\n", + (double)(w*h)/1000000.*(double)ITER/elapsed); + printf(" Output bit stream: %f Megabits/sec\n", + (double)jpgbufsize*8./1000000.*(double)ITER/elapsed); + } + if(tilesizex==w && tilesizey==h) + { + sprintf(tempstr, "%s_%sQ%d.jpg", filename, _subnames[jpegsub], qual); + if((outfile=fopen(tempstr, "wb"))==NULL) + { + puts("ERROR: Could not open reference image"); + exit(1); + } + if(fwrite(jpegbuf[0], jpgbufsize, 1, outfile)!=1) + { + puts("ERROR: Could not write reference image"); + exit(1); + } + fclose(outfile); + if(!quiet) printf("Reference image written to %s\n", tempstr); + } + + // Decompression test + memset(rgbbuf, 127, pitch*h); // Grey image means decompressor did nothing + if((hnd=tjInitDecompress())==NULL) + { + printf("Error in tjInitDecompress():\n%s\n", tjGetErrorStr()); + goto bailout; + } + _catch(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch, + tilesizey, ps, flags)); + ITER=0; + timer.start(); + do + { + int tilen=0; + for(i=0; i Frame rate: %f fps\n", (double)ITER/elapsed); + printf(" Dest. throughput: %f Megapixels/sec\n", + (double)(w*h)/1000000.*(double)ITER/elapsed); + } + if(tilesizex==w && tilesizey==h) + sprintf(tempstr, "%s_%sQ%d_full.%s", filename, _subnames[jpegsub], qual, + useppm?"ppm":"bmp"); + else sprintf(tempstr, "%s_%sQ%d_%dx%d.%s", filename, _subnames[jpegsub], + qual, tilesizex, tilesizey, useppm?"ppm":"bmp"); + if(savebmp(tempstr, rgbbuf, w, h, pf, pitch, bu)==-1) + { + printf("ERROR saving bitmap: %s\n", bmpgeterr()); + goto bailout; + } + sprintf(strrchr(tempstr, '.'), "-err.%s", useppm?"ppm":"bmp"); + if(!quiet) + printf("Computing compression error and saving to %s.\n", tempstr); + if(jpegsub==TJ_GRAYSCALE) + { + for(j=0; j255) y=255; if(y<0) y=0; + rgbbuf[pitch*j+i+_rindex[pf]]=abs(rgbbuf[pitch*j+i+_rindex[pf]]-y); + rgbbuf[pitch*j+i+_gindex[pf]]=abs(rgbbuf[pitch*j+i+_gindex[pf]]-y); + rgbbuf[pitch*j+i+_bindex[pf]]=abs(rgbbuf[pitch*j+i+_bindex[pf]]-y); + } + } + } + else + { + for(j=0; j <%% Quality>\n\n", argv[0]); + printf(" [-tile]\n"); + printf(" Test performance of the codec when the image is encoded\n"); + printf(" as separate tiles of varying sizes.\n\n"); + printf(" [-forcemmx] [-forcesse] [-forcesse2] [-forcesse3]\n"); + printf(" Force MMX, SSE, or SSE2 code paths in Intel codec\n\n"); + printf(" [-rgb | -bgr | -rgba | -bgra | -abgr | -argb]\n"); + printf(" Test the specified color conversion path in the codec (default: BGR)\n\n"); + printf(" [-quiet]\n"); + printf(" Output in tabular rather than verbose format\n\n"); + printf(" NOTE: If the quality is specified as a range, i.e. 90-100, a separate\n"); + printf(" test will be performed for all quality values in the range.\n"); + exit(1); + } + if((qual=atoi(argv[2]))<1 || qual>100) + { + puts("ERROR: Quality must be between 1 and 100."); + exit(1); + } + if((temp=strchr(argv[2], '-'))!=NULL && strlen(temp)>1 + && sscanf(&temp[1], "%d", &hiqual)==1 && hiqual>qual && hiqual>=1 + && hiqual<=100) {} + else hiqual=qual; + + if(argc>3) + { + for(i=3; i=qual; i--) + dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet); + if(quiet) printf("\n"); + for(i=hiqual; i>=qual; i--) + dotest(bmpbuf, w, h, pf, bu, TJ_411, i, argv[1], dotile, useppm, quiet); + if(quiet) printf("\n"); + for(i=hiqual; i>=qual; i--) + dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet); + if(quiet) printf("\n"); + for(i=hiqual; i>=qual; i--) + dotest(bmpbuf, w, h, pf, bu, TJ_444, i, argv[1], dotile, useppm, quiet); + + if(bmpbuf) free(bmpbuf); + return 0; +} diff --git a/rrtimer.h b/rrtimer.h new file mode 100644 index 00000000..4db5e371 --- /dev/null +++ b/rrtimer.h @@ -0,0 +1,114 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + +#ifndef __RRTIMER_H__ +#define __RRTIMER_H__ + +#ifdef __cplusplus + +#ifdef _WIN32 +#include +#else +#include +#endif + +class rrtimer +{ + public: + + rrtimer(void) : t1(0.0) + { + #ifdef _WIN32 + highres=false; tick=0.001; + LARGE_INTEGER Frequency; + if(QueryPerformanceFrequency(&Frequency)!=0) + { + tick=(double)1.0/(double)(Frequency.QuadPart); + highres=true; + } + #endif + } + + void start(void) + { + t1=time(); + } + + double time(void) + { + #ifdef _WIN32 + if(highres) + { + LARGE_INTEGER Time; + QueryPerformanceCounter(&Time); + return((double)(Time.QuadPart)*tick); + } + else + return((double)GetTickCount()*tick); + #else + struct timeval __tv; + gettimeofday(&__tv, (struct timezone *)NULL); + return((double)(__tv.tv_sec)+(double)(__tv.tv_usec)*0.000001); + #endif + } + + double elapsed(void) + { + return time()-t1; + } + + private: + + #ifdef _WIN32 + bool highres; double tick; + #endif + double t1; +}; + +#endif // __cplusplus + +#ifdef _WIN32 + +#include + +__inline double rrtime(void) +{ + LARGE_INTEGER Frequency, Time; + if(QueryPerformanceFrequency(&Frequency)!=0) + { + QueryPerformanceCounter(&Time); + return (double)Time.QuadPart/(double)Frequency.QuadPart; + } + else return (double)GetTickCount()*0.001; +} + +#else + +#include + +#ifdef sun +#define __inline inline +#endif + +static __inline double rrtime(void) +{ + struct timeval __tv; + gettimeofday(&__tv, (struct timezone *)NULL); + return((double)__tv.tv_sec+(double)__tv.tv_usec*0.000001); +} + +#endif + +#endif + diff --git a/rrutil.h b/rrutil.h new file mode 100644 index 00000000..49181204 --- /dev/null +++ b/rrutil.h @@ -0,0 +1,81 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + +#ifndef __RRUTIL_H__ +#define __RRUTIL_H__ + +#ifdef _WIN32 + #include + #define sleep(t) Sleep((t)*1000) + #define usleep(t) Sleep((t)/1000) +#else + #include + #define stricmp strcasecmp + #define strnicmp strncasecmp +#endif + +#ifndef min + #define min(a,b) ((a)<(b)?(a):(b)) +#endif + +#ifndef max + #define max(a,b) ((a)>(b)?(a):(b)) +#endif + +#define pow2(i) (1<<(i)) +#define isPow2(x) (((x)&(x-1))==0) + +#ifdef sgi +#define _SC_NPROCESSORS_CONF _SC_NPROC_CONF +#endif + +#ifdef sun +#define __inline inline +#endif + +static __inline int numprocs(void) +{ + #ifdef _WIN32 + DWORD ProcAff, SysAff, i; int count=0; + if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcAff, &SysAff)) return(1); + for(i=0; i<32; i++) if(ProcAff&(1<> 24) | \ + (((i) & 0x00ff0000) >> 8) | \ + (((i) & 0x0000ff00) << 8) | \ + (((i) & 0x000000ff) << 24) ) + +#define byteswap16(i) ( \ + (((i) & 0xff00) >> 8) | \ + (((i) & 0x00ff) << 8) ) + +static __inline int littleendian(void) +{ + unsigned int value=1; + unsigned char *ptr=(unsigned char *)(&value); + if(ptr[0]==1 && ptr[3]==0) return 1; + else return 0; +} + +#endif diff --git a/turbojpeg.h b/turbojpeg.h new file mode 100644 index 00000000..90f12789 --- /dev/null +++ b/turbojpeg.h @@ -0,0 +1,229 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005, 2006 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + +#if (defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)) && defined(_WIN32) && defined(DLLDEFINE) +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif + +#define DLLCALL + +/* Subsampling */ +#define NUMSUBOPT 4 + +enum {TJ_444=0, TJ_422, TJ_411, TJ_GRAYSCALE}; + +/* Flags */ +#define TJ_BGR 1 +#define TJ_BOTTOMUP 2 +#define TJ_FORCEMMX 8 /* Force IPP to use MMX code even if SSE available */ +#define TJ_FORCESSE 16 /* Force IPP to use SSE1 code even if SSE2 available */ +#define TJ_FORCESSE2 32 /* Force IPP to use SSE2 code (useful if auto-detect is not working properly) */ +#define TJ_ALPHAFIRST 64 /* BGR buffer is ABGR and RGB buffer is ARGB */ +#define TJ_FORCESSE3 128 /* Force IPP to use SSE3 code (useful if auto-detect is not working properly) */ + +typedef void* tjhandle; + +#define TJPAD(p) (((p)+3)&(~3)) +#ifndef max + #define max(a,b) ((a)>(b)?(a):(b)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* API follows */ + + +/* + tjhandle tjInitCompress(void) + + Creates a new JPEG compressor instance, allocates memory for the structures, + and returns a handle to the instance. Most applications will only + need to call this once at the beginning of the program or once for each + concurrent thread. Don't try to create a new instance every time you + compress an image, because this will cause performance to suffer. + + RETURNS: NULL on error +*/ +DLLEXPORT tjhandle DLLCALL tjInitCompress(void); + + +/* + int tjCompress(tjhandle j, + unsigned char *srcbuf, int width, int pitch, int height, int pixelsize, + unsigned char *dstbuf, unsigned long *size, + int jpegsubsamp, int jpegqual, int flags) + + [INPUT] j = instance handle previously returned from a call to + tjInitCompress() + [INPUT] srcbuf = pointer to user-allocated image buffer containing pixels in + RGB(A) or BGR(A) form + [INPUT] width = width (in pixels) of the source image + [INPUT] pitch = bytes per line of the source image (width*pixelsize if the + bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap + is padded to the nearest 32-bit boundary, such as is the case for Windows + bitmaps. You can also be clever and use this parameter to skip lines, etc., + as long as the pitch is greater than 0.) + [INPUT] height = height (in pixels) of the source image + [INPUT] pixelsize = size (in bytes) of each pixel in the source image + RGBA and BGRA: 4, RGB and BGR: 3 + [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + the JPEG image. Use the macro TJBUFSIZE(width, height) to determine + the appropriate size for this buffer based on the image width and height. + [OUTPUT] size = pointer to unsigned long which receives the size (in bytes) + of the compressed image + [INPUT] jpegsubsamp = Specifies either 4:1:1, 4:2:2, or 4:4:4 subsampling. + When the image is converted from the RGB to YCbCr colorspace as part of the + JPEG compression process, every other Cb and Cr (chrominance) pixel can be + discarded to produce a smaller image with little perceptible loss of + image clarity (the human eye is more sensitive to small changes in + brightness than small changes in color.) + + TJ_411: 4:1:1 subsampling. Discards every other Cb, Cr pixel in both + horizontal and vertical directions. + TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in + the horizontal direction. + TJ_444: no subsampling. + TJ_GRAYSCALE: Generate grayscale JPEG image + + [INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive.) + [INPUT] flags = the bitwise OR of one or more of the following + + TJ_BGR: The components of each pixel in the source image are stored in + B,G,R order, not R,G,B + TJ_BOTTOMUP: The source image is stored in bottom-up (Windows) order, + not top-down + TJ_FORCEMMX: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use MMX code (bypass CPU auto-detection) + TJ_FORCESSE: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use SSE code (bypass CPU auto-detection) + TJ_FORCESSE2: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use SSE2 code (bypass CPU auto-detection) + TJ_FORCESSE3: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use SSE3 code (bypass CPU auto-detection) + + RETURNS: 0 on success, -1 on error +*/ +DLLEXPORT int DLLCALL tjCompress(tjhandle j, + unsigned char *srcbuf, int width, int pitch, int height, int pixelsize, + unsigned char *dstbuf, unsigned long *size, + int jpegsubsamp, int jpegqual, int flags); + +DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height); + +/* + tjhandle tjInitDecompress(void) + + Creates a new JPEG decompressor instance, allocates memory for the + structures, and returns a handle to the instance. Most applications will + only need to call this once at the beginning of the program or once for each + concurrent thread. Don't try to create a new instance every time you + decompress an image, because this will cause performance to suffer. + + RETURNS: NULL on error +*/ +DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); + + +/* + int tjDecompressHeader(tjhandle j, + unsigned char *srcbuf, unsigned long size, + int *width, int *height) + + [INPUT] j = instance handle previously returned from a call to + tjInitDecompress() + [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image + to decompress + [INPUT] size = size of the JPEG image buffer (in bytes) + [OUTPUT] width = width (in pixels) of the JPEG image + [OUTPUT] height = height (in pixels) of the JPEG image + + RETURNS: 0 on success, -1 on error +*/ +DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j, + unsigned char *srcbuf, unsigned long size, + int *width, int *height); + + +/* + int tjDecompress(tjhandle j, + unsigned char *srcbuf, unsigned long size, + unsigned char *dstbuf, int width, int pitch, int height, int pixelsize, + int flags) + + [INPUT] j = instance handle previously returned from a call to + tjInitDecompress() + [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image + to decompress + [INPUT] size = size of the JPEG image buffer (in bytes) + [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + the bitmap image. This buffer should normally be pitch*height + bytes in size, although this pointer may also be used to decompress into + a specific region of a larger buffer. + [INPUT] width = width (in pixels) of the destination image + [INPUT] pitch = bytes per line of the destination image (width*pixelsize if the + bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap + is padded to the nearest 32-bit boundary, such as is the case for Windows + bitmaps. You can also be clever and use this parameter to skip lines, etc., + as long as the pitch is greater than 0.) + [INPUT] height = height (in pixels) of the destination image + [INPUT] pixelsize = size (in bytes) of each pixel in the destination image + RGBA/RGBx and BGRA/BGRx: 4, RGB and BGR: 3 + [INPUT] flags = the bitwise OR of one or more of the following + + TJ_BGR: The components of each pixel in the destination image should be + written in B,G,R order, not R,G,B + TJ_BOTTOMUP: The destination image should be stored in bottom-up + (Windows) order, not top-down + TJ_FORCEMMX: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use MMX code (bypass CPU auto-detection) + TJ_FORCESSE: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use SSE code (bypass CPU auto-detection) + TJ_FORCESSE2: Valid only for the Intel Performance Primitives implementation + of this codec-- force IPP to use SSE2 code (bypass CPU auto-detection) + + RETURNS: 0 on success, -1 on error +*/ +DLLEXPORT int DLLCALL tjDecompress(tjhandle j, + unsigned char *srcbuf, unsigned long size, + unsigned char *dstbuf, int width, int pitch, int height, int pixelsize, + int flags); + + +/* + int tjDestroy(tjhandle h) + + Frees structures associated with a compression or decompression instance + + [INPUT] h = instance handle (returned from a previous call to + tjInitCompress() or tjInitDecompress() + + RETURNS: 0 on success, -1 on error +*/ +DLLEXPORT int DLLCALL tjDestroy(tjhandle h); + + +/* + char *tjGetErrorStr(void) + + Returns a descriptive error message explaining why the last command failed +*/ +DLLEXPORT char* DLLCALL tjGetErrorStr(void); + +#ifdef __cplusplus +} +#endif diff --git a/turbojpegl.c b/turbojpegl.c new file mode 100644 index 00000000..3f03aed9 --- /dev/null +++ b/turbojpegl.c @@ -0,0 +1,352 @@ +/* Copyright (C)2004 Landmark Graphics Corporation + * Copyright (C)2005 Sun Microsystems, Inc. + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + +// This implements a JPEG compressor/decompressor using the libjpeg API + +#include +#include +#include +#include +#include +#include +#include "./turbojpeg.h" + + +// Error handling + +static char lasterror[JMSG_LENGTH_MAX]="No error"; + +typedef struct _error_mgr +{ + struct jpeg_error_mgr pub; + jmp_buf jb; +} error_mgr; + +static void my_error_exit(j_common_ptr cinfo) +{ + error_mgr *myerr = (error_mgr *)cinfo->err; + (*cinfo->err->output_message)(cinfo); + longjmp(myerr->jb, 1); +} + +static void my_output_message(j_common_ptr cinfo) +{ + (*cinfo->err->format_message)(cinfo, lasterror); +} + + +// Global structures, macros, etc. + +typedef struct _jpgstruct +{ + struct jpeg_compress_struct cinfo; + struct jpeg_decompress_struct dinfo; + struct jpeg_destination_mgr jdms; + struct jpeg_source_mgr jsms; + error_mgr jerr; + int initc, initd; +} jpgstruct; + +static const int hsampfactor[NUMSUBOPT]={1, 2, 2, 1}; +static const int vsampfactor[NUMSUBOPT]={1, 1, 2, 1}; + +#define _throw(c) {sprintf(lasterror, "%s", c); return -1;} +#define _catch(f) {if((f)==-1) return -1;} +#define checkhandle(h) jpgstruct *j=(jpgstruct *)h; \ + if(!j) _throw("Invalid handle"); + + +// CO + +static boolean empty_output_buffer(struct jpeg_compress_struct *cinfo) +{ + ERREXIT(cinfo, JERR_BUFFER_SIZE); + return TRUE; +} + +static void destination_noop(struct jpeg_compress_struct *cinfo) +{ +} + +DLLEXPORT tjhandle DLLCALL tjInitCompress(void) +{ + jpgstruct *j=NULL; + if((j=(jpgstruct *)malloc(sizeof(jpgstruct)))==NULL) + {sprintf(lasterror, "Memory allocation failure"); return NULL;} + memset(j, 0, sizeof(jpgstruct)); + j->cinfo.err=jpeg_std_error(&j->jerr.pub); + j->jerr.pub.error_exit=my_error_exit; + j->jerr.pub.output_message=my_output_message; + + if(setjmp(j->jerr.jb)) + { // this will execute if LIBJPEG has an error + if(j) free(j); return NULL; + } + + jpeg_create_compress(&j->cinfo); + j->cinfo.dest=&j->jdms; + j->jdms.init_destination=destination_noop; + j->jdms.empty_output_buffer=empty_output_buffer; + j->jdms.term_destination=destination_noop; + + j->initc=1; + return (tjhandle)j; +} + +DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height) +{ + // This allows enough room in case the image doesn't compress + return ((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048; +} + +DLLEXPORT int DLLCALL tjCompress(tjhandle h, + unsigned char *srcbuf, int width, int pitch, int height, int ps, + unsigned char *dstbuf, unsigned long *size, + int jpegsub, int qual, int flags) +{ + int i; JSAMPROW *row_pointer=NULL; + + checkhandle(h); + + if(srcbuf==NULL || width<=0 || pitch<0 || height<=0 + || dstbuf==NULL || size==NULL + || jpegsub<0 || jpegsub>=NUMSUBOPT || qual<0 || qual>100) + _throw("Invalid argument in tjCompress()"); + if(ps!=3 && ps!=4) _throw("This compressor can only take 24-bit or 32-bit RGB input"); + if(!j->initc) _throw("Instance has not been initialized for compression"); + + if(pitch==0) pitch=width*ps; + + j->cinfo.image_width = width; + j->cinfo.image_height = height; + j->cinfo.input_components = ps; + + #if JCS_EXTENSIONS==1 + j->cinfo.in_color_space = JCS_EXT_RGB; + if(ps==3 && (flags&TJ_BGR)) + j->cinfo.in_color_space = JCS_EXT_BGR; + else if(ps==4 && !(flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST)) + j->cinfo.in_color_space = JCS_EXT_RGBX; + else if(ps==4 && (flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST)) + j->cinfo.in_color_space = JCS_EXT_BGRX; + else if(ps==4 && (flags&TJ_BGR) && (flags&TJ_ALPHAFIRST)) + j->cinfo.in_color_space = JCS_EXT_XBGR; + else if(ps==4 && !(flags&TJ_BGR) && (flags&TJ_ALPHAFIRST)) + j->cinfo.in_color_space = JCS_EXT_XRGB; + #else + #error "TurboJPEG requires JPEG colorspace extensions" + #endif + + if(setjmp(j->jerr.jb)) + { // this will execute if LIBJPEG has an error + if(row_pointer) free(row_pointer); + return -1; + } + + jpeg_set_defaults(&j->cinfo); + + jpeg_set_quality(&j->cinfo, qual, TRUE); + if(jpegsub==TJ_GRAYSCALE) + jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE); + else + jpeg_set_colorspace(&j->cinfo, JCS_YCbCr); + j->cinfo.dct_method = JDCT_FASTEST; + + j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub]; + j->cinfo.comp_info[1].h_samp_factor=1; + j->cinfo.comp_info[2].h_samp_factor=1; + j->cinfo.comp_info[0].v_samp_factor=vsampfactor[jpegsub]; + j->cinfo.comp_info[1].v_samp_factor=1; + j->cinfo.comp_info[2].v_samp_factor=1; + + j->jdms.next_output_byte = dstbuf; + j->jdms.free_in_buffer = TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height); + + if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL) + _throw("Memory allocation failed in tjInitCompress()"); + for(i=0; icinfo, TRUE); + while(j->cinfo.next_scanlinecinfo.image_height) + { + jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline], + j->cinfo.image_height-j->cinfo.next_scanline); + } + jpeg_finish_compress(&j->cinfo); + *size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)-(j->jdms.free_in_buffer); + + if(row_pointer) free(row_pointer); + return 0; +} + + +// DEC + +static boolean fill_input_buffer (struct jpeg_decompress_struct *dinfo) +{ + ERREXIT(dinfo, JERR_BUFFER_SIZE); + return TRUE; +} + +static void skip_input_data (struct jpeg_decompress_struct *dinfo, long num_bytes) +{ + dinfo->src->next_input_byte += (size_t) num_bytes; + dinfo->src->bytes_in_buffer -= (size_t) num_bytes; +} + +static void source_noop (struct jpeg_decompress_struct *dinfo) +{ +} + +DLLEXPORT tjhandle DLLCALL tjInitDecompress(void) +{ + jpgstruct *j; + if((j=(jpgstruct *)malloc(sizeof(jpgstruct)))==NULL) + {sprintf(lasterror, "Memory allocation failure"); return NULL;} + memset(j, 0, sizeof(jpgstruct)); + j->dinfo.err=jpeg_std_error(&j->jerr.pub); + j->jerr.pub.error_exit=my_error_exit; + j->jerr.pub.output_message=my_output_message; + + if(setjmp(j->jerr.jb)) + { // this will execute if LIBJPEG has an error + free(j); return NULL; + } + + jpeg_create_decompress(&j->dinfo); + j->dinfo.src=&j->jsms; + j->jsms.init_source=source_noop; + j->jsms.fill_input_buffer = fill_input_buffer; + j->jsms.skip_input_data = skip_input_data; + j->jsms.resync_to_restart = jpeg_resync_to_restart; + j->jsms.term_source = source_noop; + + j->initd=1; + return (tjhandle)j; +} + + +DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h, + unsigned char *srcbuf, unsigned long size, + int *width, int *height) +{ + checkhandle(h); + + if(srcbuf==NULL || size<=0 || width==NULL || height==NULL) + _throw("Invalid argument in tjDecompressHeader()"); + if(!j->initd) _throw("Instance has not been initialized for decompression"); + + if(setjmp(j->jerr.jb)) + { // this will execute if LIBJPEG has an error + return -1; + } + + j->jsms.bytes_in_buffer = size; + j->jsms.next_input_byte = srcbuf; + + jpeg_read_header(&j->dinfo, TRUE); + + *width=j->dinfo.image_width; *height=j->dinfo.image_height; + + jpeg_abort_decompress(&j->dinfo); + + if(*width<1 || *height<1) _throw("Invalid data returned in header"); + return 0; +} + + +DLLEXPORT int DLLCALL tjDecompress(tjhandle h, + unsigned char *srcbuf, unsigned long size, + unsigned char *dstbuf, int width, int pitch, int height, int ps, + int flags) +{ + int i; JSAMPROW *row_pointer=NULL; + + checkhandle(h); + + if(srcbuf==NULL || size<=0 + || dstbuf==NULL || width<=0 || pitch<0 || height<=0) + _throw("Invalid argument in tjDecompress()"); + if(ps!=3 && ps!=4) _throw("This compressor can only take 24-bit or 32-bit RGB input"); + if(!j->initd) _throw("Instance has not been initialized for decompression"); + + if(pitch==0) pitch=width*ps; + + if(setjmp(j->jerr.jb)) + { // this will execute if LIBJPEG has an error + if(row_pointer) free(row_pointer); + return -1; + } + + j->jsms.bytes_in_buffer = size; + j->jsms.next_input_byte = srcbuf; + + jpeg_read_header(&j->dinfo, TRUE); + + if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL) + _throw("Memory allocation failed in tjInitDecompress()"); + for(i=0; idinfo.out_color_space = JCS_EXT_RGB; + if(ps==3 && (flags&TJ_BGR)) + j->dinfo.out_color_space = JCS_EXT_BGR; + else if(ps==4 && !(flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST)) + j->dinfo.out_color_space = JCS_EXT_RGBX; + else if(ps==4 && (flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST)) + j->dinfo.out_color_space = JCS_EXT_BGRX; + else if(ps==4 && (flags&TJ_BGR) && (flags&TJ_ALPHAFIRST)) + j->dinfo.out_color_space = JCS_EXT_XBGR; + else if(ps==4 && !(flags&TJ_BGR) && (flags&TJ_ALPHAFIRST)) + j->dinfo.out_color_space = JCS_EXT_XRGB; + #else + #error "TurboJPEG requires JPEG colorspace extensions" + #endif + + jpeg_start_decompress(&j->dinfo); + while(j->dinfo.output_scanlinedinfo.output_height) + { + jpeg_read_scanlines(&j->dinfo, &row_pointer[j->dinfo.output_scanline], + j->dinfo.output_height-j->dinfo.output_scanline); + } + jpeg_finish_decompress(&j->dinfo); + + if(row_pointer) free(row_pointer); + return 0; +} + + +// General + +DLLEXPORT char* DLLCALL tjGetErrorStr(void) +{ + return lasterror; +} + +DLLEXPORT int DLLCALL tjDestroy(tjhandle h) +{ + checkhandle(h); + if(setjmp(j->jerr.jb)) return -1; + if(j->initc) jpeg_destroy_compress(&j->cinfo); + if(j->initd) jpeg_destroy_decompress(&j->dinfo); + free(j); + return 0; +} From c689a22bb0bb33ad292cdaf280f7b4f72d3ec56a Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Fri, 3 Apr 2009 14:47:50 +0000 Subject: [PATCH 036/985] Check if C++ compiler is present. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 8c23a501..02454588 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,7 @@ AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) # Checks for programs. AC_PROG_CPP AC_PROG_CC +AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_LN_S From af9ce6951a20b47034829fbc1b1639eb3ff57e2f Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Fri, 3 Apr 2009 14:54:40 +0000 Subject: [PATCH 037/985] Don't install test programs, build them only. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 93120789..5adc1309 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,7 @@ endif TSTHDRS = turbojpeg.h rrutil.h rrtimer.h -bin_PROGRAMS = jpgtest jpegut +noinst_PROGRAMS = jpgtest jpegut jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.c turbojpegl.c From 9cc9035c67a2639fdbb0c693ad66f181b75d20b4 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 4 Apr 2009 15:22:14 +0000 Subject: [PATCH 038/985] Oops. jcolsamp.inc needs to be included from j[c|d]clr[mmx|ss2].asm so that it receives the effect of the redefined RGB_* macros --- simd/jcclrmmx.asm | 2 ++ simd/jccolmmx.asm | 1 - simd/jdclrss2.asm | 2 ++ simd/jdcolss2.asm | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/simd/jcclrmmx.asm b/simd/jcclrmmx.asm index 9cbae72e..34c4224f 100644 --- a/simd/jcclrmmx.asm +++ b/simd/jcclrmmx.asm @@ -16,6 +16,8 @@ ; ; [TAB8] +%include "jcolsamp.inc" + ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm index 8352fc35..5e7f3be9 100644 --- a/simd/jccolmmx.asm +++ b/simd/jccolmmx.asm @@ -18,7 +18,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm index b3ef195b..06a9adee 100644 --- a/simd/jdclrss2.asm +++ b/simd/jdclrss2.asm @@ -16,6 +16,8 @@ ; ; [TAB8] +%include "jcolsamp.inc" + ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm index b13c9444..7ae985d6 100644 --- a/simd/jdcolss2.asm +++ b/simd/jdcolss2.asm @@ -18,7 +18,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- From d8d563f60aa1a1c856a82e71036e487f3eff6ee6 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 4 Apr 2009 15:25:45 +0000 Subject: [PATCH 039/985] Oops. jcolsamp.inc should be included from j[c|d]clr[mmx|ss2].asm so it received the effect of the redefined RGB_* macros --- simd/jcclrss2.asm | 2 ++ simd/jccolss2.asm | 1 - simd/jdclrmmx.asm | 2 ++ simd/jdcolmmx.asm | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/simd/jcclrss2.asm b/simd/jcclrss2.asm index 10b11f9f..d6f868c5 100644 --- a/simd/jcclrss2.asm +++ b/simd/jcclrss2.asm @@ -13,6 +13,8 @@ ; ; [TAB8] +%include "jcolsamp.inc" + ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index 2d7bb576..8d1f7340 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -15,7 +15,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- diff --git a/simd/jdclrmmx.asm b/simd/jdclrmmx.asm index 506500eb..09f72ca3 100644 --- a/simd/jdclrmmx.asm +++ b/simd/jdclrmmx.asm @@ -16,6 +16,8 @@ ; ; [TAB8] +%include "jcolsamp.inc" + ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm index f34387b7..58775e85 100644 --- a/simd/jdcolmmx.asm +++ b/simd/jdcolmmx.asm @@ -18,7 +18,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- From adce982c7292abd8d4c46f75ece7f1526b863856 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 5 Apr 2009 21:47:40 +0000 Subject: [PATCH 040/985] Remove unnecessary code --- jccolor.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/jccolor.c b/jccolor.c index f20ed9de..8d3feb8d 100644 --- a/jccolor.c +++ b/jccolor.c @@ -371,12 +371,6 @@ jinit_color_converter (j_compress_ptr cinfo) break; case JCS_RGB: -#if RGB_PIXELSIZE != 3 - if (cinfo->input_components != RGB_PIXELSIZE) - ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); - break; -#endif /* else share code with YCbCr */ - case JCS_EXT_RGB: case JCS_EXT_RGBX: case JCS_EXT_BGR: From b0716b6875f028b0ba0342b5931c8af6dd3a60de Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 5 Apr 2009 21:51:25 +0000 Subject: [PATCH 041/985] Add colorspace extensions to merged upsampling routines --- jdmaster.c | 20 +- jsimd.c | 74 +++++- simd/jdmermmx.asm | 517 ++++++-------------------------------- simd/jdmerss2.asm | 615 ++++++---------------------------------------- simd/jdmrgmmx.asm | 463 ++++++++++++++++++++++++++++++++++ simd/jdmrgss2.asm | 561 ++++++++++++++++++++++++++++++++++++++++++ simd/jsimd.h | 96 ++++++++ 7 files changed, 1353 insertions(+), 993 deletions(-) create mode 100644 simd/jdmrgmmx.asm create mode 100644 simd/jdmrgss2.asm diff --git a/jdmaster.c b/jdmaster.c index 2802c5b7..38db792f 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -49,8 +49,14 @@ use_merged_upsample (j_decompress_ptr cinfo) return FALSE; /* jdmerge.c only supports YCC=>RGB color conversion */ if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || - cinfo->out_color_space != JCS_RGB || - cinfo->out_color_components != RGB_PIXELSIZE) + (cinfo->out_color_space != JCS_RGB && + cinfo->out_color_space != JCS_EXT_RGB && + cinfo->out_color_space != JCS_EXT_RGBX && + cinfo->out_color_space != JCS_EXT_BGR && + cinfo->out_color_space != JCS_EXT_BGRX && + cinfo->out_color_space != JCS_EXT_XBGR && + cinfo->out_color_space != JCS_EXT_XRGB) || + cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]) return FALSE; /* and it only handles 2h1v or 2h2v sampling ratios */ if (cinfo->comp_info[0].h_samp_factor != 2 || @@ -175,10 +181,14 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) cinfo->out_color_components = 1; break; case JCS_RGB: -#if RGB_PIXELSIZE != 3 - cinfo->out_color_components = RGB_PIXELSIZE; + case JCS_EXT_RGB: + case JCS_EXT_RGBX: + case JCS_EXT_BGR: + case JCS_EXT_BGRX: + case JCS_EXT_XBGR: + case JCS_EXT_XRGB: + cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space]; break; -#endif /* else share code with YCbCr */ case JCS_YCbCr: cinfo->out_color_components = 3; break; diff --git a/jsimd.c b/jsimd.c index 2c49a6bd..861309ab 100644 --- a/jsimd.c +++ b/jsimd.c @@ -461,12 +461,45 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JSAMPARRAY output_buf) { #ifdef WITH_SIMD + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2; + mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx; + break; + default: + sse2fct=jsimd_h2v2_merged_upsample_sse2; + mmxfct=jsimd_h2v2_merged_upsample_mmx; + break; + } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) - jsimd_h2v2_merged_upsample_sse2(cinfo->output_width, input_buf, + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) - jsimd_h2v2_merged_upsample_mmx(cinfo->output_width, input_buf, + mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); #endif } @@ -478,12 +511,45 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JSAMPARRAY output_buf) { #ifdef WITH_SIMD + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2; + mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx; + break; + default: + sse2fct=jsimd_h2v1_merged_upsample_sse2; + mmxfct=jsimd_h2v1_merged_upsample_mmx; + break; + } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) - jsimd_h2v1_merged_upsample_sse2(cinfo->output_width, input_buf, + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) - jsimd_h2v1_merged_upsample_mmx(cinfo->output_width, input_buf, + mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); #endif } diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm index 8ebe243d..fd587fbc 100644 --- a/simd/jdmermmx.asm +++ b/simd/jdmermmx.asm @@ -2,6 +2,7 @@ ; jdmermmx.asm - merged upsampling/color conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -17,7 +18,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- @@ -48,445 +48,76 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. -; -; GLOBAL(void) -; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width, -; JSAMPIMAGE input_buf, -; JDIMENSION in_row_group_ctr, -; JSAMPARRAY output_buf); -; - -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 3 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - - align 16 - global EXTN(jsimd_h2v1_merged_upsample_mmx) - -EXTN(jsimd_h2v1_merged_upsample_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [output_width(eax)] ; col - test ecx,ecx - jz near .return - - push ecx - - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [in_row_group_ctr(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(eax)] - mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 - mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 - mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - - pop ecx ; col - - alignx 16,7 -.columnloop: - movpic eax, POINTER [gotptr] ; load GOT address (eax) - - movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) - movq mm7, MMWORD [edx] ; mm7=Cr(01234567) - - pxor mm1,mm1 ; mm1=(all 0's) - pcmpeqw mm3,mm3 - psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} - - movq mm4,mm6 - punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH - punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL - movq mm0,mm7 - punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH - punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL - - paddw mm6,mm3 - paddw mm4,mm3 - paddw mm7,mm3 - paddw mm0,mm3 - - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb - - movq mm5,mm6 ; mm5=CbH - movq mm2,mm4 ; mm2=CbL - paddw mm6,mm6 ; mm6=2*CbH - paddw mm4,mm4 ; mm4=2*CbL - movq mm1,mm7 ; mm1=CrH - movq mm3,mm0 ; mm3=CrL - paddw mm7,mm7 ; mm7=2*CrH - paddw mm0,mm0 ; mm0=2*CrL - - pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) - pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) - pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) - pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) - - paddw mm6,[GOTOFF(eax,PW_ONE)] - paddw mm4,[GOTOFF(eax,PW_ONE)] - psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) - psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) - paddw mm7,[GOTOFF(eax,PW_ONE)] - paddw mm0,[GOTOFF(eax,PW_ONE)] - psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) - psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) - - paddw mm6,mm5 - paddw mm4,mm2 - paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H - paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L - paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H - paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L - - movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H - movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H - - movq mm6,mm5 - movq mm7,mm2 - punpcklwd mm5,mm1 - punpckhwd mm6,mm1 - pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd mm2,mm3 - punpckhwd mm7,mm3 - pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] - - paddd mm5,[GOTOFF(eax,PD_ONEHALF)] - paddd mm6,[GOTOFF(eax,PD_ONEHALF)] - psrad mm5,SCALEBITS - psrad mm6,SCALEBITS - paddd mm2,[GOTOFF(eax,PD_ONEHALF)] - paddd mm7,[GOTOFF(eax,PD_ONEHALF)] - psrad mm2,SCALEBITS - psrad mm7,SCALEBITS - - packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) - packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) - psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H - psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L - - movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H - - mov al,2 ; Yctr - jmp short .Yloop_1st - alignx 16,7 - -.Yloop_2nd: - movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H - movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H - movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H - alignx 16,7 - -.Yloop_1st: - movq mm7, MMWORD [esi] ; mm7=Y(01234567) - - pcmpeqw mm6,mm6 - psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} - pand mm6,mm7 ; mm6=Y(0246)=YE - psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO - - movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) - movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) - movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) - - paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) - paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) - packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) - packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) - - paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) - paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) - packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) - packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) - - paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) - paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) - packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) - packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) - -%if RGB_PIXELSIZE == 3 ; --------------- - - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) - - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) - punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) - - movq mmG,mmA - movq mmH,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) - punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) - - psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) - psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) - - movq mmC,mmD - movq mmB,mmD - punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) - punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) - - psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) - - movq mmF,mmE - punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) - punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) - - punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) - punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) - punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) - - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 - - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - - sub ecx, byte SIZEOF_MMWORD - jz short .endcolumn - - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - add esi, byte SIZEOF_MMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd - - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st16: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_MMWORD - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq mmA,mmC - sub ecx, byte 2*SIZEOF_MMWORD - add edi, byte 2*SIZEOF_MMWORD - jmp short .column_st4 -.column_st8: - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmE - sub ecx, byte SIZEOF_MMWORD - add edi, byte SIZEOF_MMWORD -.column_st4: - movd eax,mmA - cmp ecx, byte SIZEOF_DWORD - jb short .column_st2 - mov DWORD [edi+0*SIZEOF_DWORD], eax - psrlq mmA,DWORD_BIT - movd eax,mmA - sub ecx, byte SIZEOF_DWORD - add edi, byte SIZEOF_DWORD -.column_st2: - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi+0*SIZEOF_WORD], ax - shr eax,WORD_BIT - sub ecx, byte SIZEOF_WORD - add edi, byte SIZEOF_WORD -.column_st1: - cmp ecx, byte SIZEOF_BYTE - jb short .endcolumn - mov BYTE [edi+0*SIZEOF_BYTE], al - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -%ifdef RGBX_FILLER_0XFF - pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) -%else - pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) -%endif - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) - - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) - punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) - punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) - - movq mmC,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) - punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) - movq mmG,mmB - punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) - punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) - - movq mmD,mmA - punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) - punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) - movq mmH,mmC - punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) - punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) - - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 - - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - movq MMWORD [edi+3*SIZEOF_MMWORD], mmH - - sub ecx, byte SIZEOF_MMWORD - jz short .endcolumn - - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - add esi, byte SIZEOF_MMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd - - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st16: - cmp ecx, byte SIZEOF_MMWORD/2 - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq mmA,mmC - movq mmD,mmH - sub ecx, byte SIZEOF_MMWORD/2 - add edi, byte 2*SIZEOF_MMWORD -.column_st8: - cmp ecx, byte SIZEOF_MMWORD/4 - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmD - sub ecx, byte SIZEOF_MMWORD/4 - add edi, byte 1*SIZEOF_MMWORD -.column_st4: - cmp ecx, byte SIZEOF_MMWORD/8 - jb short .endcolumn - movd DWORD [edi+0*SIZEOF_DWORD], mmA - -%endif ; RGB_PIXELSIZE ; --------------- - -.endcolumn: - emms ; empty MMX state - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret - -; -------------------------------------------------------------------------- -; -; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. -; -; GLOBAL(void) -; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width, -; JSAMPIMAGE input_buf, -; JDIMENSION in_row_group_ctr, -; JSAMPARRAY output_buf); -; - -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - - align 16 - global EXTN(jsimd_h2v2_merged_upsample_mmx) - -EXTN(jsimd_h2v2_merged_upsample_mmx): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - mov eax, JDIMENSION [output_width(ebp)] - - mov edi, JSAMPIMAGE [input_buf(ebp)] - mov ecx, JDIMENSION [in_row_group_ctr(ebp)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(ebp)] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - - push edx ; inptr2 - push ebx ; inptr1 - push esi ; inptr00 - mov ebx,esp - - push edi ; output_buf (outptr0) - push ecx ; in_row_group_ctr - push ebx ; input_buf - push eax ; output_width - - call near EXTN(jsimd_h2v1_merged_upsample_mmx) - - add esi, byte SIZEOF_JSAMPROW ; inptr01 - add edi, byte SIZEOF_JSAMPROW ; outptr1 - mov POINTER [ebx+0*SIZEOF_POINTER], esi - mov POINTER [ebx-1*SIZEOF_POINTER], edi - - call near EXTN(jsimd_h2v1_merged_upsample_mmx) - - add esp, byte 7*SIZEOF_DWORD - - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret - +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgb_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgb_merged_upsample_mmx +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgbx_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgbx_merged_upsample_mmx +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgr_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgr_merged_upsample_mmx +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgrx_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgrx_merged_upsample_mmx +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxbgr_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxbgr_merged_upsample_mmx +%include "jdmrgmmx.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxrgb_merged_upsample_mmx +%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxrgb_merged_upsample_mmx +%include "jdmrgmmx.asm" diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm index 8a7c68f0..2294e0d3 100644 --- a/simd/jdmerss2.asm +++ b/simd/jdmerss2.asm @@ -2,6 +2,7 @@ ; jdmerss2.asm - merged upsampling/color conversion (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -17,7 +18,6 @@ ; [TAB8] %include "jsimdext.inc" -%include "jcolsamp.inc" ; -------------------------------------------------------------------------- @@ -48,543 +48,76 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 -; -; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. -; -; GLOBAL(void) -; jsimd_h2v1_merged_upsample_sse2 (JDIMENSION output_width, -; JSAMPIMAGE input_buf, -; JDIMENSION in_row_group_ctr, -; JSAMPARRAY output_buf); -; - -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 3 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - - align 16 - global EXTN(jsimd_h2v1_merged_upsample_sse2) - -EXTN(jsimd_h2v1_merged_upsample_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address - - mov ecx, JDIMENSION [output_width(eax)] ; col - test ecx,ecx - jz near .return - - push ecx - - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [in_row_group_ctr(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(eax)] - mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 - mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 - mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - - pop ecx ; col - - alignx 16,7 -.columnloop: - movpic eax, POINTER [gotptr] ; load GOT address (eax) - - movdqa xmm6, XMMWORD [ebx] ; xmm6=Cb(0123456789ABCDEF) - movdqa xmm7, XMMWORD [edx] ; xmm7=Cr(0123456789ABCDEF) - - pxor xmm1,xmm1 ; xmm1=(all 0's) - pcmpeqw xmm3,xmm3 - psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} - - movdqa xmm4,xmm6 - punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH - punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL - movdqa xmm0,xmm7 - punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH - punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL - - paddw xmm6,xmm3 - paddw xmm4,xmm3 - paddw xmm7,xmm3 - paddw xmm0,xmm3 - - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb - - movdqa xmm5,xmm6 ; xmm5=CbH - movdqa xmm2,xmm4 ; xmm2=CbL - paddw xmm6,xmm6 ; xmm6=2*CbH - paddw xmm4,xmm4 ; xmm4=2*CbL - movdqa xmm1,xmm7 ; xmm1=CrH - movdqa xmm3,xmm0 ; xmm3=CrL - paddw xmm7,xmm7 ; xmm7=2*CrH - paddw xmm0,xmm0 ; xmm0=2*CrL - - pmulhw xmm6,[GOTOFF(eax,PW_MF0228)] ; xmm6=(2*CbH * -FIX(0.22800)) - pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbL * -FIX(0.22800)) - pmulhw xmm7,[GOTOFF(eax,PW_F0402)] ; xmm7=(2*CrH * FIX(0.40200)) - pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrL * FIX(0.40200)) - - paddw xmm6,[GOTOFF(eax,PW_ONE)] - paddw xmm4,[GOTOFF(eax,PW_ONE)] - psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) - psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) - paddw xmm7,[GOTOFF(eax,PW_ONE)] - paddw xmm0,[GOTOFF(eax,PW_ONE)] - psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) - psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) - - paddw xmm6,xmm5 - paddw xmm4,xmm2 - paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H - paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L - paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H - paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L - - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H - - movdqa xmm6,xmm5 - movdqa xmm7,xmm2 - punpcklwd xmm5,xmm1 - punpckhwd xmm6,xmm1 - pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm6,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd xmm2,xmm3 - punpckhwd xmm7,xmm3 - pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm7,[GOTOFF(eax,PW_MF0344_F0285)] - - paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm6,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm5,SCALEBITS - psrad xmm6,SCALEBITS - paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm7,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm2,SCALEBITS - psrad xmm7,SCALEBITS - - packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) - packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) - psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H - psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L - - movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H - - mov al,2 ; Yctr - jmp short .Yloop_1st - alignx 16,7 - -.Yloop_2nd: - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H - movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H - alignx 16,7 - -.Yloop_1st: - movdqa xmm7, XMMWORD [esi] ; xmm7=Y(0123456789ABCDEF) - - pcmpeqw xmm6,xmm6 - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE - psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO - - movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) - movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) - movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) - - paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) - paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - - paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) - paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - - paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) - paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) - -%if RGB_PIXELSIZE == 3 ; --------------- - - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 - - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - jmp short .out0 -.out1: ; --(unaligned)----------------- - pcmpeqb xmmH,xmmH ; xmmH=(all 1's) - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF - add edi, byte SIZEOF_XMMWORD ; outptr -.out0: - sub ecx, byte SIZEOF_XMMWORD - jz near .endcolumn - - add esi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd - - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st32: - pcmpeqb xmmH,xmmH ; xmmH=(all 1's) - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub ecx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 -.column_st16: - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st15 - maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD -.column_st15: - mov eax,ecx - xor ecx, byte 0x0F - shl ecx, 2 - movd xmmB,ecx - psrlq xmmH,4 - pcmpeqb xmmE,xmmE - psrlq xmmH,xmmB - psrlq xmmE,xmmB - punpcklbw xmmE,xmmH - ; ---------------- - mov ecx,edi - and ecx, byte SIZEOF_XMMWORD-1 - jz short .adj0 - add eax,ecx - cmp eax, byte SIZEOF_XMMWORD - ja short .adj0 - and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary - shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx - movdqa xmmG,xmmA - movdqa xmmC,xmmE - pslldq xmmA, SIZEOF_XMMWORD/2 - pslldq xmmE, SIZEOF_XMMWORD/2 - movd xmmD,ecx - sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT - jb short .adj1 - movd xmmF,ecx - psllq xmmA,xmmF - psllq xmmE,xmmF - jmp short .adj0 -.adj1: neg ecx - movd xmmF,ecx - psrlq xmmA,xmmF - psrlq xmmE,xmmF - psllq xmmG,xmmD - psllq xmmC,xmmD - por xmmA,xmmG - por xmmE,xmmC -.adj0: ; ---------------- - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - -%else ; RGB_PIXELSIZE == 4 ; ----------- - -%ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) -%else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) -%endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 - - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - jmp short .out0 -.out1: ; --(unaligned)----------------- - pcmpeqb xmmE,xmmE ; xmmE=(all 1's) - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH - add edi, byte SIZEOF_XMMWORD ; outptr -.out0: - sub ecx, byte SIZEOF_XMMWORD - jz near .endcolumn - - add esi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd - - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 - -.column_st32: - pcmpeqb xmmE,xmmE ; xmmE=(all 1's) - cmp ecx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub ecx, byte SIZEOF_XMMWORD/2 -.column_st16: - cmp ecx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD/4 -.column_st15: - cmp ecx, byte SIZEOF_XMMWORD/16 - jb short .endcolumn - mov eax,ecx - xor ecx, byte 0x03 - inc ecx - shl ecx, 4 - movd xmmF,ecx - psrlq xmmE,xmmF - punpcklbw xmmE,xmmE - ; ---------------- - mov ecx,edi - and ecx, byte SIZEOF_XMMWORD-1 - jz short .adj0 - lea eax, [ecx+eax*4] ; RGB_PIXELSIZE - cmp eax, byte SIZEOF_XMMWORD - ja short .adj0 - and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary - shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx - movdqa xmmB,xmmA - movdqa xmmG,xmmE - pslldq xmmA, SIZEOF_XMMWORD/2 - pslldq xmmE, SIZEOF_XMMWORD/2 - movd xmmC,ecx - sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT - jb short .adj1 - movd xmmH,ecx - psllq xmmA,xmmH - psllq xmmE,xmmH - jmp short .adj0 -.adj1: neg ecx - movd xmmH,ecx - psrlq xmmA,xmmH - psrlq xmmE,xmmH - psllq xmmB,xmmC - psllq xmmG,xmmC - por xmmA,xmmB - por xmmE,xmmG -.adj0: ; ---------------- - maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA - -%endif ; RGB_PIXELSIZE ; --------------- - -.endcolumn: - sfence ; flush the write buffer - -.return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret - -; -------------------------------------------------------------------------- -; -; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. -; -; GLOBAL(void) -; jsimd_h2v2_merged_upsample_sse2 (JDIMENSION output_width, -; JSAMPIMAGE input_buf, -; JDIMENSION in_row_group_ctr, -; JSAMPARRAY output_buf); -; - -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - - align 16 - global EXTN(jsimd_h2v2_merged_upsample_sse2) - -EXTN(jsimd_h2v2_merged_upsample_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi - - mov eax, POINTER [output_width(ebp)] - - mov edi, JSAMPIMAGE [input_buf(ebp)] - mov ecx, JDIMENSION [in_row_group_ctr(ebp)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(ebp)] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - - push edx ; inptr2 - push ebx ; inptr1 - push esi ; inptr00 - mov ebx,esp - - push edi ; output_buf (outptr0) - push ecx ; in_row_group_ctr - push ebx ; input_buf - push eax ; output_width - - call near EXTN(jsimd_h2v1_merged_upsample_sse2) - - add esi, byte SIZEOF_JSAMPROW ; inptr01 - add edi, byte SIZEOF_JSAMPROW ; outptr1 - mov POINTER [ebx+0*SIZEOF_POINTER], esi - mov POINTER [ebx-1*SIZEOF_POINTER], edi - - call near EXTN(jsimd_h2v1_merged_upsample_sse2) - - add esp, byte 7*SIZEOF_DWORD - - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret - +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 +%include "jdmrgss2.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 +%include "jdmrgss2.asm" diff --git a/simd/jdmrgmmx.asm b/simd/jdmrgmmx.asm new file mode 100644 index 00000000..08b0985d --- /dev/null +++ b/simd/jdmrgmmx.asm @@ -0,0 +1,463 @@ +; +; jdmrgmmx.asm - merged upsampling/color conversion (MMX) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v1_merged_upsample_mmx) + +EXTN(jsimd_h2v1_merged_upsample_mmx): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + + pop ecx ; col + + alignx 16,7 +.columnloop: + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) + movq mm7, MMWORD [edx] ; mm7=Cr(01234567) + + pxor mm1,mm1 ; mm1=(all 0's) + pcmpeqw mm3,mm3 + psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} + + movq mm4,mm6 + punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH + punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL + movq mm0,mm7 + punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH + punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL + + paddw mm6,mm3 + paddw mm4,mm3 + paddw mm7,mm3 + paddw mm0,mm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movq mm5,mm6 ; mm5=CbH + movq mm2,mm4 ; mm2=CbL + paddw mm6,mm6 ; mm6=2*CbH + paddw mm4,mm4 ; mm4=2*CbL + movq mm1,mm7 ; mm1=CrH + movq mm3,mm0 ; mm3=CrL + paddw mm7,mm7 ; mm7=2*CrH + paddw mm0,mm0 ; mm0=2*CrL + + pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) + pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) + + paddw mm6,[GOTOFF(eax,PW_ONE)] + paddw mm4,[GOTOFF(eax,PW_ONE)] + psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) + psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) + paddw mm7,[GOTOFF(eax,PW_ONE)] + paddw mm0,[GOTOFF(eax,PW_ONE)] + psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) + psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) + + paddw mm6,mm5 + paddw mm4,mm2 + paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H + paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L + paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H + paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L + + movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H + movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H + + movq mm6,mm5 + movq mm7,mm2 + punpcklwd mm5,mm1 + punpckhwd mm6,mm1 + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm2,mm3 + punpckhwd mm7,mm3 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + paddd mm6,[GOTOFF(eax,PD_ONEHALF)] + psrad mm5,SCALEBITS + psrad mm6,SCALEBITS + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm7,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm7,SCALEBITS + + packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + + movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H + + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 + +.Yloop_2nd: + movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H + movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H + movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H + alignx 16,7 + +.Yloop_1st: + movq mm7, MMWORD [esi] ; mm7=Y(01234567) + + pcmpeqw mm6,mm6 + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + pand mm6,mm7 ; mm6=Y(0246)=YE + psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO + + movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) + movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) + movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) + + paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + + paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + + paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) + paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + + sub ecx, byte SIZEOF_MMWORD + jz short .endcolumn + + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st16: + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 +.column_st8: + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD +.column_st4: + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD +.column_st2: + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD +.column_st1: + cmp ecx, byte SIZEOF_BYTE + jb short .endcolumn + mov BYTE [edi+0*SIZEOF_BYTE], al + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%else + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) +%endif + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 + + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + + sub ecx, byte SIZEOF_MMWORD + jz short .endcolumn + + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st16: + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD +.column_st8: + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD +.column_st4: + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .endcolumn + movd DWORD [edi+0*SIZEOF_DWORD], mmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + emms ; empty MMX state + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + + align 16 + global EXTN(jsimd_h2v2_merged_upsample_mmx) + +EXTN(jsimd_h2v2_merged_upsample_mmx): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov eax, JDIMENSION [output_width(ebp)] + + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp + + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width + + call near EXTN(jsimd_h2v1_merged_upsample_mmx) + + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi + + call near EXTN(jsimd_h2v1_merged_upsample_mmx) + + add esp, byte 7*SIZEOF_DWORD + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jdmrgss2.asm b/simd/jdmrgss2.asm new file mode 100644 index 00000000..5018a236 --- /dev/null +++ b/simd/jdmrgss2.asm @@ -0,0 +1,561 @@ +; +; jdmrgss2.asm - merged upsampling/color conversion (SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 32 +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr + + align 16 + global EXTN(jsimd_h2v1_merged_upsample_sse2) + +EXTN(jsimd_h2v1_merged_upsample_sse2): + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address + + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return + + push ecx + + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + + pop ecx ; col + + alignx 16,7 +.columnloop: + movpic eax, POINTER [gotptr] ; load GOT address (eax) + + movdqa xmm6, XMMWORD [ebx] ; xmm6=Cb(0123456789ABCDEF) + movdqa xmm7, XMMWORD [edx] ; xmm7=Cr(0123456789ABCDEF) + + pxor xmm1,xmm1 ; xmm1=(all 0's) + pcmpeqw xmm3,xmm3 + psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} + + movdqa xmm4,xmm6 + punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH + punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL + movdqa xmm0,xmm7 + punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH + punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL + + paddw xmm6,xmm3 + paddw xmm4,xmm3 + paddw xmm7,xmm3 + paddw xmm0,xmm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm5,xmm6 ; xmm5=CbH + movdqa xmm2,xmm4 ; xmm2=CbL + paddw xmm6,xmm6 ; xmm6=2*CbH + paddw xmm4,xmm4 ; xmm4=2*CbL + movdqa xmm1,xmm7 ; xmm1=CrH + movdqa xmm3,xmm0 ; xmm3=CrL + paddw xmm7,xmm7 ; xmm7=2*CrH + paddw xmm0,xmm0 ; xmm0=2*CrL + + pmulhw xmm6,[GOTOFF(eax,PW_MF0228)] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[GOTOFF(eax,PW_F0402)] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrL * FIX(0.40200)) + + paddw xmm6,[GOTOFF(eax,PW_ONE)] + paddw xmm4,[GOTOFF(eax,PW_ONE)] + psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) + psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) + paddw xmm7,[GOTOFF(eax,PW_ONE)] + paddw xmm0,[GOTOFF(eax,PW_ONE)] + psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) + psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) + + paddw xmm6,xmm5 + paddw xmm4,xmm2 + paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H + paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L + paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H + paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L + + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H + + movdqa xmm6,xmm5 + movdqa xmm7,xmm2 + punpcklwd xmm5,xmm1 + punpckhwd xmm6,xmm1 + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm2,xmm3 + punpckhwd xmm7,xmm3 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm7,[GOTOFF(eax,PW_MF0344_F0285)] + + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm6,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm5,SCALEBITS + psrad xmm6,SCALEBITS + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm7,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm7,SCALEBITS + + packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + + movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H + + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 + +.Yloop_2nd: + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H + alignx 16,7 + +.Yloop_1st: + movdqa xmm7, XMMWORD [esi] ; xmm7=Y(0123456789ABCDEF) + + pcmpeqw xmm6,xmm6 + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE + psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO + + movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) + movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) + movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) + + paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) + paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) + paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) + paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [edi], xmmF + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD +.column_st15: + mov eax,ecx + xor ecx, byte 0x0F + shl ecx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add eax,ecx + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg ecx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [edi], xmmC + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [edi], xmmH + add edi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [edi], xmmD + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp ecx, byte SIZEOF_XMMWORD/16 + jb short .endcolumn + mov eax,ecx + xor ecx, byte 0x03 + inc ecx + shl ecx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov ecx,edi + and ecx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea eax, [ecx+eax*4] ; RGB_PIXELSIZE + cmp eax, byte SIZEOF_XMMWORD + ja short .adj0 + and edi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl ecx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub ecx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg ecx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + sfence ; flush the write buffer + +.return: + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf + + align 16 + global EXTN(jsimd_h2v2_merged_upsample_sse2) + +EXTN(jsimd_h2v2_merged_upsample_sse2): + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi + + mov eax, POINTER [output_width(ebp)] + + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp + + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width + + call near EXTN(jsimd_h2v1_merged_upsample_sse2) + + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi + + call near EXTN(jsimd_h2v1_merged_upsample_sse2) + + add esp, byte 7*SIZEOF_DWORD + + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret + diff --git a/simd/jsimd.h b/simd/jsimd.h index a5b432ff..c21cf29b 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -59,7 +59,19 @@ #define jsimd_h2v2_fancy_upsample_mmx jSFUpH2V2M #define jsimd_h2v1_fancy_upsample_mmx jSFUpH2V1M #define jsimd_h2v2_merged_upsample_mmx jSMUpH2V2M +#define jsimd_h2v2_extrgb_merged_upsample_mmx jSMUpH2V2EXTRGBM +#define jsimd_h2v2_extrgbx_merged_upsample_mmx jSMUpH2V2EXTRGBXM +#define jsimd_h2v2_extbgr_merged_upsample_mmx jSMUpH2V2EXTBGRM +#define jsimd_h2v2_extbgrx_merged_upsample_mmx jSMUpH2V2EXTBGRXM +#define jsimd_h2v2_extxbgr_merged_upsample_mmx jSMUpH2V2EXTXBGRM +#define jsimd_h2v2_extxrgb_merged_upsample_mmx jSMUpH2V2EXTXRGBM #define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M +#define jsimd_h2v1_extrgb_merged_upsample_mmx jSMUpH2V1EXTRGBM +#define jsimd_h2v1_extrgbx_merged_upsample_mmx jSMUpH2V1EXTRGBXM +#define jsimd_h2v1_extbgr_merged_upsample_mmx jSMUpH2V1EXTBGRM +#define jsimd_h2v1_extbgrx_merged_upsample_mmx jSMUpH2V1EXTBGRXM +#define jsimd_h2v1_extxbgr_merged_upsample_mmx jSMUpH2V1EXTXBGRM +#define jsimd_h2v1_extxrgb_merged_upsample_mmx jSMUpH2V1EXTXRGBM #define jsimd_h2v2_upsample_sse2 jSUpH2V2S2 #define jsimd_h2v1_upsample_sse2 jSUpH2V1S2 #define jconst_fancy_upsample_sse2 jSCFUpS2 @@ -67,7 +79,19 @@ #define jsimd_h2v1_fancy_upsample_sse2 jSFUpH2V1S2 #define jconst_merged_upsample_sse2 jSCMUpS2 #define jsimd_h2v2_merged_upsample_sse2 jSMUpH2V2S2 +#define jsimd_h2v2_extrgb_merged_upsample_sse2 jSMUpH2V2EXTRGBS2 +#define jsimd_h2v2_extrgbx_merged_upsample_sse2 jSMUpH2V2EXTRGBXS2 +#define jsimd_h2v2_extbgr_merged_upsample_sse2 jSMUpH2V2EXTBGRS2 +#define jsimd_h2v2_extbgrx_merged_upsample_sse2 jSMUpH2V2EXTBGRXS2 +#define jsimd_h2v2_extxbgr_merged_upsample_sse2 jSMUpH2V2EXTXBGRS2 +#define jsimd_h2v2_extxrgb_merged_upsample_sse2 jSMUpH2V2EXTXRGBS2 #define jsimd_h2v1_merged_upsample_sse2 jSMUpH2V1S2 +#define jsimd_h2v1_extrgb_merged_upsample_sse2 jSMUpH2V1EXTRGBS2 +#define jsimd_h2v1_extrgbx_merged_upsample_sse2 jSMUpH2V1EXTRGBXS2 +#define jsimd_h2v1_extbgr_merged_upsample_sse2 jSMUpH2V1EXTBGRS2 +#define jsimd_h2v1_extbgrx_merged_upsample_sse2 jSMUpH2V1EXTBGRXS2 +#define jsimd_h2v1_extxbgr_merged_upsample_sse2 jSMUpH2V1EXTXBGRS2 +#define jsimd_h2v1_extxrgb_merged_upsample_sse2 jSMUpH2V1EXTXRGBS2 #define jsimd_convsamp_mmx jSConvM #define jsimd_convsamp_sse2 jSConvS2 #define jsimd_convsamp_float_3dnow jSConvF3D @@ -264,9 +288,45 @@ EXTERN(void) jsimd_h2v1_fancy_upsample_mmx EXTERN(void) jsimd_h2v2_merged_upsample_mmx JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); EXTERN(void) jsimd_h2v1_merged_upsample_mmx JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmx + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); EXTERN(void) jsimd_h2v2_upsample_sse2 JPP((int max_v_samp_factor, JDIMENSION output_width, @@ -287,9 +347,45 @@ extern const int jconst_merged_upsample_sse2[]; EXTERN(void) jsimd_h2v2_merged_upsample_sse2 JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); EXTERN(void) jsimd_h2v1_merged_upsample_sse2 JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_sse2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); /* SIMD Sample Conversion */ EXTERN(void) jsimd_convsamp_mmx JPP((JSAMPARRAY sample_data, From cf75c6f1be62a46da2bebada83a750f83205cda5 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 5 Apr 2009 21:53:20 +0000 Subject: [PATCH 042/985] Test fast upsampling "4:1:1 = 4:2:0" --- jpegut.c | 4 ++-- jpgtest.cxx | 19 ++++++++++++++----- turbojpeg.h | 8 +++++--- turbojpegl.c | 2 ++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/jpegut.c b/jpegut.c index 777cd3dd..3b02fba3 100644 --- a/jpegut.c +++ b/jpegut.c @@ -21,8 +21,8 @@ #define _catch(f) {if((f)==-1) {printf("TJPEG: %s\n", tjGetErrorStr()); goto finally;}} -const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:1:1", "GRAY"}; -const char *_subnames[NUMSUBOPT]={"444", "422", "411", "GRAY"}; +const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"}; +const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"}; int pixels[9][3]= { diff --git a/jpgtest.cxx b/jpgtest.cxx index d0baea53..d6c4cb34 100644 --- a/jpgtest.cxx +++ b/jpgtest.cxx @@ -23,7 +23,7 @@ #define _catch(f) {if((f)==-1) {printf("Error in %s:\n%s\n", #f, tjGetErrorStr()); goto bailout;}} -int forcemmx=0, forcesse=0, forcesse2=0, forcesse3=0; +int forcemmx=0, forcesse=0, forcesse2=0, forcesse3=0, fastupsample=0; const int _ps[BMPPIXELFORMATS]={3, 4, 3, 4, 4, 4}; const int _flags[BMPPIXELFORMATS]={0, 0, TJ_BGR, TJ_BGR, TJ_BGR|TJ_ALPHAFIRST, TJ_ALPHAFIRST}; @@ -31,8 +31,8 @@ const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1}; const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2}; const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3}; const char *_pfname[]={"RGB", "RGBA", "BGR", "BGRA", "ABGR", "ARGB"}; -const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:1:1", "GRAY"}; -const char *_subnames[NUMSUBOPT]={"444", "422", "411", "GRAY"}; +const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"}; +const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"}; void printsigfig(double val, int figs) { @@ -62,7 +62,8 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu, int jpgbufsize=0, i, j, tilesizex, tilesizey, numtilesx, numtilesy, ITER; unsigned long *comptilesize=NULL; int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0) - |(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0); + |(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0) + |(fastupsample?TJ_FASTUPSAMPLE:0); int ps=_ps[pf]; int pitch=w*ps; @@ -294,6 +295,9 @@ int main(int argc, char *argv[]) printf(" Force MMX, SSE, or SSE2 code paths in Intel codec\n\n"); printf(" [-rgb | -bgr | -rgba | -bgra | -abgr | -argb]\n"); printf(" Test the specified color conversion path in the codec (default: BGR)\n\n"); + printf(" [-fastupsample]\n"); + printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n\n"); + printf(" YUV decoding in libjpeg decompressor\n"); printf(" [-quiet]\n"); printf(" Output in tabular rather than verbose format\n\n"); printf(" NOTE: If the quality is specified as a range, i.e. 90-100, a separate\n"); @@ -335,6 +339,11 @@ int main(int argc, char *argv[]) printf("Using MMX code in Intel compressor\n"); forcemmx=1; } + if(!stricmp(argv[i], "-fastupsample")) + { + printf("Using fast upsampling code\n"); + fastupsample=1; + } if(!stricmp(argv[i], "-rgb")) pf=BMP_RGB; if(!stricmp(argv[i], "-rgba")) pf=BMP_RGBA; if(!stricmp(argv[i], "-bgr")) pf=BMP_BGR; @@ -369,7 +378,7 @@ int main(int argc, char *argv[]) dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet); if(quiet) printf("\n"); for(i=hiqual; i>=qual; i--) - dotest(bmpbuf, w, h, pf, bu, TJ_411, i, argv[1], dotile, useppm, quiet); + dotest(bmpbuf, w, h, pf, bu, TJ_420, i, argv[1], dotile, useppm, quiet); if(quiet) printf("\n"); for(i=hiqual; i>=qual; i--) dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet); diff --git a/turbojpeg.h b/turbojpeg.h index 90f12789..808e2f30 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -1,5 +1,6 @@ /* Copyright (C)2004 Landmark Graphics Corporation * Copyright (C)2005, 2006 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander * * This library is free software and may be redistributed and/or modified under * the terms of the wxWindows Library License, Version 3.1 or (at your option) @@ -23,7 +24,7 @@ /* Subsampling */ #define NUMSUBOPT 4 -enum {TJ_444=0, TJ_422, TJ_411, TJ_GRAYSCALE}; +enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE}; /* Flags */ #define TJ_BGR 1 @@ -33,6 +34,7 @@ enum {TJ_444=0, TJ_422, TJ_411, TJ_GRAYSCALE}; #define TJ_FORCESSE2 32 /* Force IPP to use SSE2 code (useful if auto-detect is not working properly) */ #define TJ_ALPHAFIRST 64 /* BGR buffer is ABGR and RGB buffer is ARGB */ #define TJ_FORCESSE3 128 /* Force IPP to use SSE3 code (useful if auto-detect is not working properly) */ +#define TJ_FASTUPSAMPLE 256 /* Use fast, inaccurate 4:2:2 and 4:2:0 YUV upsampling routines in libjpeg decompressor */ typedef void* tjhandle; @@ -86,14 +88,14 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); the appropriate size for this buffer based on the image width and height. [OUTPUT] size = pointer to unsigned long which receives the size (in bytes) of the compressed image - [INPUT] jpegsubsamp = Specifies either 4:1:1, 4:2:2, or 4:4:4 subsampling. + [INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, or 4:4:4 subsampling. When the image is converted from the RGB to YCbCr colorspace as part of the JPEG compression process, every other Cb and Cr (chrominance) pixel can be discarded to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) - TJ_411: 4:1:1 subsampling. Discards every other Cb, Cr pixel in both + TJ_420: 4:2:0 subsampling. Discards every other Cb, Cr pixel in both horizontal and vertical directions. TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in the horizontal direction. diff --git a/turbojpegl.c b/turbojpegl.c index 3f03aed9..82acf23d 100644 --- a/turbojpegl.c +++ b/turbojpegl.c @@ -1,5 +1,6 @@ /* Copyright (C)2004 Landmark Graphics Corporation * Copyright (C)2005 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander * * This library is free software and may be redistributed and/or modified under * the terms of the wxWindows Library License, Version 3.1 or (at your option) @@ -320,6 +321,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h, #else #error "TurboJPEG requires JPEG colorspace extensions" #endif + if(flags&TJ_FASTUPSAMPLE) j->dinfo.do_fancy_upsampling=FALSE; jpeg_start_decompress(&j->dinfo); while(j->dinfo.output_scanlinedinfo.output_height) From 5cac289deb507a2073dd8eda434e7b9c0c34983d Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 25 Jun 2009 20:33:51 +0000 Subject: [PATCH 043/985] Fix dependencies for merged upsampling code --- simd/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simd/Makefile.am b/simd/Makefile.am index 22828047..78516f01 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -23,6 +23,8 @@ jccolmmx.lo: jcclrmmx.asm jccolss2.lo: jcclrss2.asm jdcolmmx.lo: jdclrmmx.asm jdcolss2.lo: jdclrss2.asm +jdmermmx.lo: jdmrgmmx.asm +jdmerss2.lo: jdmrgss2.asm .asm.lo: $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ From 9b74d3f22415bf99d7c8b86213539414a9985ee2 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 25 Jun 2009 20:38:31 +0000 Subject: [PATCH 044/985] 64-bit SIMD acceleration --- acinclude.m4 | 11 +- configure.ac | 8 + jsimd.c | 150 ++++++++ simd/Makefile.am | 19 + simd/jcclrss2-64.asm | 484 +++++++++++++++++++++++++ simd/jccolss2-64.asm | 117 ++++++ simd/jcqnts2f-64.asm | 152 ++++++++ simd/jcqnts2i-64.asm | 181 ++++++++++ simd/jcsamss2-64.asm | 324 +++++++++++++++++ simd/jdclrss2-64.asm | 483 +++++++++++++++++++++++++ simd/jdcolss2-64.asm | 117 ++++++ simd/jdmerss2-64.asm | 123 +++++++ simd/jdmrgss2-64.asm | 565 +++++++++++++++++++++++++++++ simd/jdsamss2-64.asm | 664 ++++++++++++++++++++++++++++++++++ simd/jfss2fst-64.asm | 388 ++++++++++++++++++++ simd/jfss2int-64.asm | 618 +++++++++++++++++++++++++++++++ simd/jfsseflt-64.asm | 354 ++++++++++++++++++ simd/jiss2flt-64.asm | 479 ++++++++++++++++++++++++ simd/jiss2fst-64.asm | 488 +++++++++++++++++++++++++ simd/jiss2int-64.asm | 844 +++++++++++++++++++++++++++++++++++++++++++ simd/jiss2red-64.asm | 571 +++++++++++++++++++++++++++++ simd/jsimdcpu-64.asm | 95 +++++ simd/jsimdext.inc | 39 +- simd/nasm_lt.sh | 2 +- 24 files changed, 7272 insertions(+), 4 deletions(-) create mode 100644 simd/jcclrss2-64.asm create mode 100644 simd/jccolss2-64.asm create mode 100644 simd/jcqnts2f-64.asm create mode 100644 simd/jcqnts2i-64.asm create mode 100644 simd/jcsamss2-64.asm create mode 100644 simd/jdclrss2-64.asm create mode 100644 simd/jdcolss2-64.asm create mode 100644 simd/jdmerss2-64.asm create mode 100644 simd/jdmrgss2-64.asm create mode 100644 simd/jdsamss2-64.asm create mode 100644 simd/jfss2fst-64.asm create mode 100644 simd/jfss2int-64.asm create mode 100644 simd/jfsseflt-64.asm create mode 100644 simd/jiss2flt-64.asm create mode 100644 simd/jiss2fst-64.asm create mode 100644 simd/jiss2int-64.asm create mode 100644 simd/jiss2red-64.asm create mode 100644 simd/jsimdcpu-64.asm diff --git a/acinclude.m4 b/acinclude.m4 index 9150799b..f7d7b690 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -24,7 +24,14 @@ case "$host_os" in objfmt='a.out' ;; linux*) - objfmt='ELF' + case "$host_cpu" in + x86_64) + objfmt='ELF64' + ;; + *) + objfmt='ELF' + ;; + esac ;; freebsd* | netbsd* | openbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then @@ -58,6 +65,7 @@ case "$objfmt" in a.out) NAFLAGS='-faout -DAOUT';; BSD-a.out) NAFLAGS='-faoutb -DAOUT';; ELF) NAFLAGS='-felf -DELF';; + ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';; RDF) NAFLAGS='-frdf -DRDF';; Mach-O) NAFLAGS='-fmacho -DMACHO';; esac @@ -68,7 +76,6 @@ AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works]) cat > conftest.asm <in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extrgb_ycc_convert_mmx; + #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_extrgbx_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extrgbx_ycc_convert_mmx; + #endif break; case JCS_EXT_BGR: sse2fct=jsimd_extbgr_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extbgr_ycc_convert_mmx; + #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_extbgrx_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extbgrx_ycc_convert_mmx; + #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_extxbgr_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extxbgr_ycc_convert_mmx; + #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_extxrgb_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_extxrgb_ycc_convert_mmx; + #endif break; default: sse2fct=jsimd_rgb_ycc_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_rgb_ycc_convert_mmx; + #endif break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); + #endif #endif } @@ -158,45 +178,63 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { #ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + #endif switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_ycc_extrgb_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extrgb_convert_mmx; + #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_ycc_extrgbx_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extrgbx_convert_mmx; + #endif break; case JCS_EXT_BGR: sse2fct=jsimd_ycc_extbgr_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extbgr_convert_mmx; + #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_ycc_extbgrx_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extbgrx_convert_mmx; + #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_ycc_extxbgr_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extxbgr_convert_mmx; + #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_ycc_extxrgb_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_extxrgb_convert_mmx; + #endif break; default: sse2fct=jsimd_ycc_rgb_convert_sse2; + #ifndef __x86_64__ mmxfct=jsimd_ycc_rgb_convert_mmx; + #endif break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); + #endif #endif } @@ -213,8 +251,10 @@ jsimd_can_h2v2_downsample (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -232,8 +272,10 @@ jsimd_can_h2v1_downsample (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -247,10 +289,12 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); + #endif #endif } @@ -263,10 +307,12 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); + #endif #endif } @@ -283,8 +329,10 @@ jsimd_can_h2v2_upsample (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -302,8 +350,10 @@ jsimd_can_h2v1_upsample (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -318,9 +368,11 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, if (simd_support & JSIMD_SSE2) jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); + #endif #endif } @@ -334,9 +386,11 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, if (simd_support & JSIMD_SSE2) jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); + #endif #endif } @@ -354,8 +408,10 @@ jsimd_can_h2v2_fancy_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -374,8 +430,10 @@ jsimd_can_h2v1_fancy_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -391,9 +449,11 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); + #endif #endif } @@ -408,9 +468,11 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); + #endif #endif } @@ -428,8 +490,10 @@ jsimd_can_h2v2_merged_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -448,8 +512,10 @@ jsimd_can_h2v1_merged_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -462,45 +528,63 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, { #ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + #endif switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx; + #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx; + #endif break; case JCS_EXT_BGR: sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx; + #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx; + #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx; + #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx; + #endif break; default: sse2fct=jsimd_h2v2_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v2_merged_upsample_mmx; + #endif break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + #endif #endif } @@ -512,45 +596,63 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, { #ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + #endif switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx; + #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx; + #endif break; case JCS_EXT_BGR: sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx; + #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx; + #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx; + #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx; + #endif break; default: sse2fct=jsimd_h2v1_merged_upsample_sse2; + #ifndef __x86_64__ mmxfct=jsimd_h2v1_merged_upsample_mmx; + #endif break; } if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); + #endif #endif } @@ -571,8 +673,10 @@ jsimd_can_convsamp (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -596,8 +700,10 @@ jsimd_can_convsamp_float (void) return 1; if (simd_support & JSIMD_SSE) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; + #endif return 0; } @@ -609,8 +715,10 @@ jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, #ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_convsamp_sse2(sample_data, start_col, workspace); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_convsamp_mmx(sample_data, start_col, workspace); + #endif #endif } @@ -621,10 +729,12 @@ jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, #ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_convsamp_float_sse2(sample_data, start_col, workspace); + #ifndef __x86_64__ else if (simd_support & JSIMD_SSE) jsimd_convsamp_float_sse(sample_data, start_col, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_convsamp_float_3dnow(sample_data, start_col, workspace); + #endif #endif } @@ -641,8 +751,10 @@ jsimd_can_fdct_islow (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -660,8 +772,10 @@ jsimd_can_fdct_ifast (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -679,8 +793,10 @@ jsimd_can_fdct_float (void) if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; + #endif return 0; } @@ -691,8 +807,10 @@ jsimd_fdct_islow (DCTELEM * data) #ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) jsimd_fdct_islow_sse2(data); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_fdct_islow_mmx(data); + #endif #endif } @@ -702,8 +820,10 @@ jsimd_fdct_ifast (DCTELEM * data) #ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) jsimd_fdct_ifast_sse2(data); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_fdct_ifast_mmx(data); + #endif #endif } @@ -713,8 +833,10 @@ jsimd_fdct_float (FAST_FLOAT * data) #ifdef WITH_SIMD if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) jsimd_fdct_float_sse(data); + #ifndef __x86_64__ else if (simd_support & JSIMD_3DNOW) jsimd_fdct_float_3dnow(data); + #endif #endif } @@ -733,8 +855,10 @@ jsimd_can_quantize (void) if (simd_support & JSIMD_SSE2) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -756,8 +880,10 @@ jsimd_can_quantize_float (void) return 1; if (simd_support & JSIMD_SSE) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; + #endif return 0; } @@ -769,8 +895,10 @@ jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, #ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_quantize_sse2(coef_block, divisors, workspace); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_quantize_mmx(coef_block, divisors, workspace); + #endif #endif } @@ -781,10 +909,12 @@ jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, #ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_quantize_float_sse2(coef_block, divisors, workspace); + #ifndef __x86_64__ else if (simd_support & JSIMD_SSE) jsimd_quantize_float_sse(coef_block, divisors, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_quantize_float_3dnow(coef_block, divisors, workspace); + #endif #endif } @@ -807,8 +937,10 @@ jsimd_can_idct_2x2 (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -832,8 +964,10 @@ jsimd_can_idct_4x4 (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -846,8 +980,10 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, #if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); + #endif #endif } @@ -859,8 +995,10 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, #if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); + #endif #endif } @@ -883,8 +1021,10 @@ jsimd_can_idct_islow (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -910,8 +1050,10 @@ jsimd_can_idct_ifast (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) return 1; + #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; + #endif return 0; } @@ -936,10 +1078,12 @@ jsimd_can_idct_float (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) return 1; + #ifndef __x86_64__ if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) return 1; if (simd_support & JSIMD_3DNOW) return 1; + #endif return 0; } @@ -952,8 +1096,10 @@ jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, #if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); + #endif #endif } @@ -965,8 +1111,10 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, #if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); + #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); + #endif #endif } @@ -979,12 +1127,14 @@ jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf, output_col); + #ifndef __x86_64__ else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_3DNOW) jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf, output_col); + #endif #endif } diff --git a/simd/Makefile.am b/simd/Makefile.am index 78516f01..da7d6842 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -4,6 +4,23 @@ BUILT_SOURCES = jsimdcfg.inc EXTRA_DIST = nasm_lt.sh +if WITH_SIMD64 + +libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ + jsimdext.inc jcolsamp.inc jdct.inc \ + jsimdcpu-64.asm jfsseflt-64.asm \ + jccolss2-64.asm jdcolss2-64.asm \ + jcsamss2-64.asm jdsamss2-64.asm jdmerss2-64.asm \ + jcqnts2i-64.asm jfss2fst-64.asm jfss2int-64.asm \ + jiss2red-64.asm jiss2int-64.asm jiss2fst-64.asm \ + jcqnts2f-64.asm jiss2flt-64.asm + +jccolss2-64.lo: jcclrss2-64.asm +jdcolss2-64.lo: jdclrss2-64.asm +jdmerss2-64.lo: jdmrgss2-64.asm + +else + libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ jsimdext.inc jcolsamp.inc jdct.inc \ jsimdcpu.asm \ @@ -26,6 +43,8 @@ jdcolss2.lo: jdclrss2.asm jdmermmx.lo: jdmrgmmx.asm jdmerss2.lo: jdmrgss2.asm +endif + .asm.lo: $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm new file mode 100644 index 00000000..9900edd8 --- /dev/null +++ b/simd/jcclrss2-64.asm @@ -0,0 +1,484 @@ +; +; jcclrss2.asm - colorspace conversion (64-bit SSE2) +; +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; Copyright (C) 2009, D. R. Commander. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_rgb_ycc_convert_sse2 (JDIMENSION img_width, +; JSAMPARRAY input_buf, JSAMPIMAGE output_buf, +; JDIMENSION output_row, int num_rows); +; + +; r10 = JDIMENSION img_width +; r11 = JSAMPARRAY input_buf +; r12 = JSAMPIMAGE output_buf +; r13 = JDIMENSION output_row +; r14 = int num_rows + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 + + align 16 + + global EXTN(jsimd_rgb_ycc_convert_sse2) + +EXTN(jsimd_rgb_ycc_convert_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + push rbx + collect_args + + mov rcx, r10 + test rcx,rcx + jz near .return + + push rcx + + mov rsi, r12 + mov rcx, r13 + mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rsi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rsi+2*SIZEOF_JSAMPARRAY] + lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] + lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] + lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] + + pop rcx + + mov rsi, r11 + mov rax, r14 + test rax,rax + jle near .return +.rowloop: + push rdx + push rbx + push rdi + push rsi + push rcx ; col + + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr0 + mov rbx, JSAMPROW [rbx] ; outptr1 + mov rdx, JSAMPROW [rdx] ; outptr2 + + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + +%if RGB_PIXELSIZE == 3 ; --------------- + +.column_ld1: + push rax + push rdx + lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub rcx, byte SIZEOF_BYTE + movzx rax, BYTE [rsi+rcx] +.column_ld2: + test cl, SIZEOF_WORD + jz short .column_ld4 + sub rcx, byte SIZEOF_WORD + movzx rdx, WORD [rsi+rcx] + shl rax, WORD_BIT + or rax,rdx +.column_ld4: + movd xmmA,eax + pop rdx + pop rax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub rcx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [rsi+rcx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF +.column_ld8: + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub rcx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [rsi+rcx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB +.column_ld16: + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + mov rcx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv +.column_ld32: + test cl, 2*SIZEOF_XMMWORD + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + + pxor xmmH,xmmH + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +.column_ld1: + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub rcx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] +.column_ld2: + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub rcx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE +.column_ld4: + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub rcx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] +.column_ld8: + test cl, SIZEOF_XMMWORD/2 + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + +.columnloop: + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] + +.rgb_ycc_cnv: + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + + pxor xmmF,xmmF + + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + +%endif ; RGB_PIXELSIZE ; --------------- + + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + movdqa xmm7,xmm1 + movdqa xmm4,xmm6 + pmaddwd xmm1,[PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor xmm1,xmm1 + pxor xmm6,xmm6 + punpcklwd xmm1,xmm5 ; xmm1=BOL + punpckhwd xmm6,xmm5 ; xmm6=BOH + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm6,1 ; xmm6=BOH*FIX(0.500) + + movdqa xmm5,[PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm1 + paddd xmm4,xmm6 + paddd xmm7,xmm5 + paddd xmm4,xmm5 + psrld xmm7,SCALEBITS ; xmm7=CbOL + psrld xmm4,SCALEBITS ; xmm4=CbOH + packssdw xmm7,xmm4 ; xmm7=CbO + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + movdqa xmm5,xmm0 + movdqa xmm4,xmm6 + pmaddwd xmm0,[PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor xmm0,xmm0 + pxor xmm6,xmm6 + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + psrld xmm6,1 ; xmm6=BEH*FIX(0.500) + + movdqa xmm1,[PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm5,xmm0 + paddd xmm4,xmm6 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrld xmm5,SCALEBITS ; xmm5=CbEL + psrld xmm4,SCALEBITS ; xmm4=CbEH + packssdw xmm5,xmm4 ; xmm5=CbE + + psllw xmm7,BYTE_BIT + por xmm5,xmm7 ; xmm5=Cb + movdqa XMMWORD [ebx], xmm5 ; Save Cb + + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + movdqa xmm7,xmm0 + movdqa xmm5,xmm4 + pmaddwd xmm0,[PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + + movdqa xmm3,[PD_ONEHALF] ; xmm3=[PD_ONEHALF] + + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO + + pxor xmm3,xmm3 + pxor xmm4,xmm4 + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH + psrld xmm3,1 ; xmm3=ROL*FIX(0.500) + psrld xmm4,1 ; xmm4=ROH*FIX(0.500) + + movdqa xmm1,[PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + + paddd xmm7,xmm3 + paddd xmm5,xmm4 + paddd xmm7,xmm1 + paddd xmm5,xmm1 + psrld xmm7,SCALEBITS ; xmm7=CrOL + psrld xmm5,SCALEBITS ; xmm5=CrOH + packssdw xmm7,xmm5 ; xmm7=CrO + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pmaddwd xmm6,[PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + + movdqa xmm2,[PD_ONEHALF] ; xmm2=[PD_ONEHALF] + + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE + + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [rdi], xmm6 ; Save Y + + pxor xmm2,xmm2 + pxor xmm4,xmm4 + punpcklwd xmm2,xmm3 ; xmm2=REL + punpckhwd xmm4,xmm3 ; xmm4=REH + psrld xmm2,1 ; xmm2=REL*FIX(0.500) + psrld xmm4,1 ; xmm4=REH*FIX(0.500) + + movdqa xmm0,[PD_ONEHALFM1_CJ] ; xmm0=[PD_ONEHALFM1_CJ] + + paddd xmm1,xmm2 + paddd xmm5,xmm4 + paddd xmm1,xmm0 + paddd xmm5,xmm0 + psrld xmm1,SCALEBITS ; xmm1=CrEL + psrld xmm5,SCALEBITS ; xmm5=CrEH + packssdw xmm1,xmm5 ; xmm1=CrE + + psllw xmm7,BYTE_BIT + por xmm1,xmm7 ; xmm1=Cr + movdqa XMMWORD [rdx], xmm1 ; Save Cr + + sub rcx, byte SIZEOF_XMMWORD + add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add rdi, byte SIZEOF_XMMWORD ; outptr0 + add rbx, byte SIZEOF_XMMWORD ; outptr1 + add rdx, byte SIZEOF_XMMWORD ; outptr2 + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx,rcx + jnz near .column_ld1 + + pop rcx ; col + pop rsi + pop rdi + pop rbx + pop rdx + + add rsi, byte SIZEOF_JSAMPROW ; input_buf + add rdi, byte SIZEOF_JSAMPROW + add rbx, byte SIZEOF_JSAMPROW + add rdx, byte SIZEOF_JSAMPROW + dec rax ; num_rows + jg near .rowloop + +.return: + uncollect_args + pop rbx + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + diff --git a/simd/jccolss2-64.asm b/simd/jccolss2-64.asm new file mode 100644 index 00000000..a419d1bc --- /dev/null +++ b/simd/jccolss2-64.asm @@ -0,0 +1,117 @@ +; +; jccolss2.asm - colorspace conversion (64-bit SSE2) +; +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; Copyright (C) 2009, D. R. Commander. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_rgb_ycc_convert_sse2) + +EXTN(jconst_rgb_ycc_convert_sse2): + +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) + + alignz 16 + +; -------------------------------------------------------------------------- +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 +%include "jcclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 +%include "jcclrss2-64.asm" diff --git a/simd/jcqnts2f-64.asm b/simd/jcqnts2f-64.asm new file mode 100644 index 00000000..51d63076 --- /dev/null +++ b/simd/jcqnts2f-64.asm @@ -0,0 +1,152 @@ +; +; jcqnts2f.asm - sample data conversion and quantization (64-bit SSE & SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_float_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col, +; FAST_FLOAT * workspace); +; + +; r10 = JSAMPARRAY sample_data +; r11 = JDIMENSION start_col +; r12 = FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_convsamp_float_sse2) + +EXTN(jsimd_convsamp_float_sse2): + push rbp + mov rbp,rsp + push rbx + collect_args + + pcmpeqw xmm7,xmm7 + psllw xmm7,7 + packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) + + mov rsi, r10 + mov rax, r11 + mov rdi, r12 + mov rcx, DCTSIZE/2 +.convloop: + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] + movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] + + psubb xmm0,xmm7 ; xmm0=(01234567) + psubb xmm1,xmm7 ; xmm1=(89ABCDEF) + + punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) + punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) + + punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) + punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) + punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) + punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) + + psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) + psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) + cvtdq2ps xmm2,xmm2 ; xmm2=(0123) + cvtdq2ps xmm0,xmm0 ; xmm0=(4567) + psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) + psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) + cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) + cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) + + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 + + add rsi, byte 2*SIZEOF_JSAMPROW + add rdi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec rcx + jnz short .convloop + + uncollect_args + pop rbx + pop rbp + ret + + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; GLOBAL(void) +; jsimd_quantize_float_sse2 (JCOEFPTR coef_block, FAST_FLOAT * divisors, +; FAST_FLOAT * workspace); +; + +; r10 = JCOEFPTR coef_block +; r11 = FAST_FLOAT * divisors +; r12 = FAST_FLOAT * workspace + + align 16 + global EXTN(jsimd_quantize_float_sse2) + +EXTN(jsimd_quantize_float_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2/16 +.quantloop: + movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,rsi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,rsi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] + + cvtps2dq xmm0,xmm0 + cvtps2dq xmm1,xmm1 + cvtps2dq xmm2,xmm2 + cvtps2dq xmm3,xmm3 + + packssdw xmm0,xmm1 + packssdw xmm2,xmm3 + + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_JCOEF)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_JCOEF)], xmm2 + + add rsi, byte 16*SIZEOF_FAST_FLOAT + add rdx, byte 16*SIZEOF_FAST_FLOAT + add rdi, byte 16*SIZEOF_JCOEF + dec rax + jnz short .quantloop + + uncollect_args + pop rbp + ret diff --git a/simd/jcqnts2i-64.asm b/simd/jcqnts2i-64.asm new file mode 100644 index 00000000..d5615901 --- /dev/null +++ b/simd/jcqnts2i-64.asm @@ -0,0 +1,181 @@ +; +; jcqnts2i.asm - sample data conversion and quantization (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Load data into workspace, applying unsigned->signed conversion +; +; GLOBAL(void) +; jsimd_convsamp_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col, +; DCTELEM * workspace); +; + +; r10 = JSAMPARRAY sample_data +; r11 = JDIMENSION start_col +; r12 = DCTELEM * workspace + + align 16 + global EXTN(jsimd_convsamp_sse2) + +EXTN(jsimd_convsamp_sse2): + push rbp + mov rbp,rsp + push rbx + collect_args + + pxor xmm6,xmm6 ; xmm6=(all 0's) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + + mov rsi, r10 + mov rax, r11 + mov rdi, r12 + mov rcx, DCTSIZE/4 +.convloop: + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm0=(01234567) + movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) + + mov rbx, JSAMPROW [rsi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + + movq xmm2, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) + movq xmm3, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) + + punpcklbw xmm0,xmm6 ; xmm0=(01234567) + punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) + paddw xmm0,xmm7 + paddw xmm1,xmm7 + punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) + punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) + paddw xmm2,xmm7 + paddw xmm3,xmm7 + + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 + + add rsi, byte 4*SIZEOF_JSAMPROW + add rdi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec rcx + jnz short .convloop + + uncollect_args + pop rbx + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Quantize/descale the coefficients, and store into coef_block +; +; This implementation is based on an algorithm described in +; "How to optimize for the Pentium family of microprocessors" +; (http://www.agner.org/assem/). +; +; GLOBAL(void) +; jsimd_quantize_sse2 (JCOEFPTR coef_block, DCTELEM * divisors, +; DCTELEM * workspace); +; + +%define RECIPROCAL(m,n,b) XMMBLOCK(DCTSIZE*0+(m),(n),(b),SIZEOF_DCTELEM) +%define CORRECTION(m,n,b) XMMBLOCK(DCTSIZE*1+(m),(n),(b),SIZEOF_DCTELEM) +%define SCALE(m,n,b) XMMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) + +; r10 = JCOEFPTR coef_block +; r11 = DCTELEM * divisors +; r12 = DCTELEM * workspace + + align 16 + global EXTN(jsimd_quantize_sse2) + +EXTN(jsimd_quantize_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2/32 +.quantloop: + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + psraw xmm4,(WORD_BIT-1) + psraw xmm5,(WORD_BIT-1) + psraw xmm6,(WORD_BIT-1) + psraw xmm7,(WORD_BIT-1) + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; + psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; + psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; + psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; + + paddw xmm0, XMMWORD [CORRECTION(0,0,rdx)] ; correction + roundfactor + paddw xmm1, XMMWORD [CORRECTION(1,0,rdx)] + paddw xmm2, XMMWORD [CORRECTION(2,0,rdx)] + paddw xmm3, XMMWORD [CORRECTION(3,0,rdx)] + pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,rdx)] ; reciprocal + pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,rdx)] + pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,rdx)] + pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,rdx)] + pmulhuw xmm0, XMMWORD [SCALE(0,0,rdx)] ; scale + pmulhuw xmm1, XMMWORD [SCALE(1,0,rdx)] + pmulhuw xmm2, XMMWORD [SCALE(2,0,rdx)] + pmulhuw xmm3, XMMWORD [SCALE(3,0,rdx)] + + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 + psubw xmm1,xmm5 + psubw xmm2,xmm6 + psubw xmm3,xmm7 + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 + + add rsi, byte 32*SIZEOF_DCTELEM + add rdx, byte 32*SIZEOF_DCTELEM + add rdi, byte 32*SIZEOF_JCOEF + dec rax + jnz near .quantloop + + uncollect_args + pop rbp + ret diff --git a/simd/jcsamss2-64.asm b/simd/jcsamss2-64.asm new file mode 100644 index 00000000..cf7a776b --- /dev/null +++ b/simd/jcsamss2-64.asm @@ -0,0 +1,324 @@ +; +; jcsamss2.asm - downsampling (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Downsample pixel values of a single component. +; This version handles the common case of 2:1 horizontal and 1:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v1_downsample_sse2 (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +; r10 = JDIMENSION image_width +; r11 = int max_v_samp_factor +; r12 = JDIMENSION v_samp_factor +; r13 = JDIMENSION width_blocks +; r14 = JSAMPARRAY input_data +; r15 = JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v1_downsample_sse2) + +EXTN(jsimd_h2v1_downsample_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rcx, r13 + shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) + jz near .return + + mov rdx, r10 + + ; -- expand_right_edge + + push rcx + shl rcx,1 ; output_cols * 2 + sub rcx,rdx + jle short .expand_end + + mov rax, r11 + test rax,rax + jle short .expand_end + + cld + mov rsi, r14 ; input_data +.expandloop: + push rax + push rcx + + mov rdi, JSAMPROW [rsi] + add rdi,rdx + mov al, JSAMPLE [rdi-1] + + rep stosb + + pop rcx + pop rax + + add rsi, byte SIZEOF_JSAMPROW + dec rax + jg short .expandloop + +.expand_end: + pop rcx ; output_cols + + ; -- h2v1_downsample + + mov rax, r12 ; rowctr + test eax,eax + jle near .return + + mov rdx, 0x00010000 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + + mov rsi, r14 ; input_data + mov rdi, r15 ; output_data +.rowloop: + push rcx + push rdi + push rsi + + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr + + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop + +.columnloop_r8: + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + pxor xmm1,xmm1 + mov rcx, SIZEOF_XMMWORD + jmp short .downsample + +.columnloop: + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+1*SIZEOF_XMMWORD] + +.downsample: + movdqa xmm2,xmm0 + movdqa xmm3,xmm1 + + pand xmm0,xmm6 + psrlw xmm2,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm3,BYTE_BIT + + paddw xmm0,xmm2 + paddw xmm1,xmm3 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + psrlw xmm0,1 + psrlw xmm1,1 + + packuswb xmm0,xmm1 + + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + + sub rcx, byte SIZEOF_XMMWORD ; outcol + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rdi, byte 1*SIZEOF_XMMWORD ; outptr + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop + test rcx,rcx + jnz short .columnloop_r8 + + pop rsi + pop rdi + pop rcx + + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rax ; rowctr + jg near .rowloop + +.return: + uncollect_args + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Downsample pixel values of a single component. +; This version handles the standard case of 2:1 horizontal and 2:1 vertical, +; without smoothing. +; +; GLOBAL(void) +; jsimd_h2v2_downsample_sse2 (JDIMENSION image_width, int max_v_samp_factor, +; JDIMENSION v_samp_factor, JDIMENSION width_blocks, +; JSAMPARRAY input_data, JSAMPARRAY output_data); +; + +; r10 = JDIMENSION image_width +; r11 = int max_v_samp_factor +; r12 = JDIMENSION v_samp_factor +; r13 = JDIMENSION width_blocks +; r14 = JSAMPARRAY input_data +; r15 = JSAMPARRAY output_data + + align 16 + global EXTN(jsimd_h2v2_downsample_sse2) + +EXTN(jsimd_h2v2_downsample_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rcx, r13 + shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) + jz near .return + + mov rdx, r10 + + ; -- expand_right_edge + + push rcx + shl rcx,1 ; output_cols * 2 + sub rcx,rdx + jle short .expand_end + + mov rax, r11 + test rax,rax + jle short .expand_end + + cld + mov rsi, r14 ; input_data +.expandloop: + push rax + push rcx + + mov rdi, JSAMPROW [rsi] + add rdi,rdx + mov al, JSAMPLE [rdi-1] + + rep stosb + + pop rcx + pop rax + + add rsi, byte SIZEOF_JSAMPROW + dec rax + jg short .expandloop + +.expand_end: + pop rcx ; output_cols + + ; -- h2v2_downsample + + mov rax, r12 ; rowctr + test rax,rax + jle near .return + + mov rdx, 0x00020001 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + + mov rsi, r14 ; input_data + mov rdi, r15 ; output_data +.rowloop: + push rcx + push rdi + push rsi + + mov rdx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 + mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1 + mov rdi, JSAMPROW [rdi] ; outptr + + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop + +.columnloop_r8: + movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + pxor xmm2,xmm2 + pxor xmm3,xmm3 + mov rcx, SIZEOF_XMMWORD + jmp short .downsample + +.columnloop: + movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [rdx+1*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [rsi+1*SIZEOF_XMMWORD] + +.downsample: + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + pand xmm0,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm0,xmm4 + paddw xmm1,xmm5 + + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + pand xmm2,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm3,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm2,xmm4 + paddw xmm3,xmm5 + + paddw xmm0,xmm1 + paddw xmm2,xmm3 + paddw xmm0,xmm7 + paddw xmm2,xmm7 + psrlw xmm0,2 + psrlw xmm2,2 + + packuswb xmm0,xmm2 + + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + + sub rcx, byte SIZEOF_XMMWORD ; outcol + add rdx, byte 2*SIZEOF_XMMWORD ; inptr0 + add rsi, byte 2*SIZEOF_XMMWORD ; inptr1 + add rdi, byte 1*SIZEOF_XMMWORD ; outptr + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx,rcx + jnz near .columnloop_r8 + + pop rsi + pop rdi + pop rcx + + add rsi, byte 2*SIZEOF_JSAMPROW ; input_data + add rdi, byte 1*SIZEOF_JSAMPROW ; output_data + dec rax ; rowctr + jg near .rowloop + +.return: + uncollect_args + pop rbp + ret diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm new file mode 100644 index 00000000..0808ecaa --- /dev/null +++ b/simd/jdclrss2-64.asm @@ -0,0 +1,483 @@ +; +; jdclrss2.asm - colorspace conversion (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Convert some rows of samples to the output colorspace. +; +; GLOBAL(void) +; jsimd_ycc_rgb_convert_sse2 (JDIMENSION out_width, +; JSAMPIMAGE input_buf, JDIMENSION input_row, +; JSAMPARRAY output_buf, int num_rows) +; + +; r10 = JDIMENSION out_width +; r11 = JSAMPIMAGE input_buf +; r12 = JDIMENSION input_row +; r13 = JSAMPARRAY output_buf +; r14 = int num_rows + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_ycc_rgb_convert_sse2) + +EXTN(jsimd_ycc_rgb_convert_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + push rbx + collect_args + + mov rcx, r10 ; num_cols + test rcx,rcx + jz near .return + + push rcx + + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] + lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] + lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] + + pop rcx + + mov rdi, r13 + mov rax, r14 + test rax,rax + jle near .return +.rowloop: + push rax + push rdi + push rdx + push rbx + push rsi + push rcx ; col + + mov rsi, JSAMPROW [rsi] ; inptr0 + mov rbx, JSAMPROW [rbx] ; inptr1 + mov rdx, JSAMPROW [rdx] ; inptr2 + mov rdi, JSAMPROW [rdi] ; outptr +.columnloop: + + movdqa xmm5, XMMWORD [rbx] ; xmm5=Cb(0123456789ABCDEF) + movdqa xmm1, XMMWORD [rdx] ; xmm1=Cr(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + pcmpeqw xmm7,xmm7 + psrlw xmm4,BYTE_BIT + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} + + pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE + psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO + pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE + psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO + + paddw xmm4,xmm7 + paddw xmm5,xmm7 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm2,xmm4 ; xmm2=CbE + movdqa xmm3,xmm5 ; xmm3=CbO + paddw xmm4,xmm4 ; xmm4=2*CbE + paddw xmm5,xmm5 ; xmm5=2*CbO + movdqa xmm6,xmm0 ; xmm6=CrE + movdqa xmm7,xmm1 ; xmm7=CrO + paddw xmm0,xmm0 ; xmm0=2*CrE + paddw xmm1,xmm1 ; xmm1=2*CrO + + pmulhw xmm4,[PW_MF0228] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[PW_MF0228] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[PW_F0402] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[PW_F0402] ; xmm1=(2*CrO * FIX(0.40200)) + + paddw xmm4,[PW_ONE] + paddw xmm5,[PW_ONE] + psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) + psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) + paddw xmm0,[PW_ONE] + paddw xmm1,[PW_ONE] + psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) + psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) + + paddw xmm4,xmm2 + paddw xmm5,xmm3 + paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E + paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O + paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E + paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O + + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + punpcklwd xmm2,xmm6 + punpckhwd xmm4,xmm6 + pmaddwd xmm2,[PW_MF0344_F0285] + pmaddwd xmm4,[PW_MF0344_F0285] + punpcklwd xmm3,xmm7 + punpckhwd xmm5,xmm7 + pmaddwd xmm3,[PW_MF0344_F0285] + pmaddwd xmm5,[PW_MF0344_F0285] + + paddd xmm2,[PD_ONEHALF] + paddd xmm4,[PD_ONEHALF] + psrad xmm2,SCALEBITS + psrad xmm4,SCALEBITS + paddd xmm3,[PD_ONEHALF] + paddd xmm5,[PD_ONEHALF] + psrad xmm3,SCALEBITS + psrad xmm5,SCALEBITS + + packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + + movdqa xmm5, XMMWORD [rsi] ; xmm5=Y(0123456789ABCDEF) + + pcmpeqw xmm4,xmm4 + psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} + pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE + psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO + + paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) + paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) + paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) + paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [rdi], xmmF + add rdi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub rcx, byte SIZEOF_XMMWORD + jz near .nextrow + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub rcx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD +.column_st15: + mov rax,rcx + xor rcx, byte 0x0F + shl rcx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov rcx,rdi + and rcx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add rax,rcx + cmp rax, byte SIZEOF_XMMWORD + ja short .adj0 + and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,rcx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg ecx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [rdi], xmmC + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [rdi], xmmH + add rdi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub rcx, byte SIZEOF_XMMWORD + jz near .nextrow + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp rcx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub rcx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp rcx, byte SIZEOF_XMMWORD/16 + jb near .nextrow + mov rax,rcx + xor rcx, byte 0x03 + inc rcx + shl rcx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov rcx,rdi + and rcx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea rax, [rcx+rax*4] ; RGB_PIXELSIZE + cmp rax, byte SIZEOF_XMMWORD + ja short .adj0 + and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg rcx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.nextrow: + pop rcx + pop rsi + pop rbx + pop rdx + pop rdi + pop rax + + add rsi, byte SIZEOF_JSAMPROW + add rbx, byte SIZEOF_JSAMPROW + add rdx, byte SIZEOF_JSAMPROW + add rdi, byte SIZEOF_JSAMPROW ; output_buf + dec rax ; num_rows + jg near .rowloop + + sfence ; flush the write buffer + +.return: + uncollect_args + pop rbx + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jdcolss2-64.asm b/simd/jdcolss2-64.asm new file mode 100644 index 00000000..5e8a322c --- /dev/null +++ b/simd/jdcolss2-64.asm @@ -0,0 +1,117 @@ +; +; jdcolss2.asm - colorspace conversion (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_ycc_rgb_convert_sse2) + +EXTN(jconst_ycc_rgb_convert_sse2): + +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 +%include "jdclrss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 +%include "jdclrss2-64.asm" diff --git a/simd/jdmerss2-64.asm b/simd/jdmerss2-64.asm new file mode 100644 index 00000000..2f9c5c1f --- /dev/null +++ b/simd/jdmerss2-64.asm @@ -0,0 +1,123 @@ +; +; jdmerss2.asm - merged upsampling/color conversion (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + +%define SCALEBITS 16 + +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_merged_upsample_sse2) + +EXTN(jconst_merged_upsample_sse2): + +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 3 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 2 +%define RGB_GREEN 1 +%define RGB_BLUE 0 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 3 +%define RGB_GREEN 2 +%define RGB_BLUE 1 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 +%include "jdmrgss2-64.asm" + +%undef RGB_RED +%undef RGB_GREEN +%undef RGB_BLUE +%undef RGB_PIXELSIZE +%define RGB_RED 1 +%define RGB_GREEN 2 +%define RGB_BLUE 3 +%define RGB_PIXELSIZE 4 +%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 +%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 +%include "jdmrgss2-64.asm" diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm new file mode 100644 index 00000000..6474f43b --- /dev/null +++ b/simd/jdmrgss2-64.asm @@ -0,0 +1,565 @@ +; +; jdmrgss2.asm - merged upsampling/color conversion (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jcolsamp.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v1_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +; r10 = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12 = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 + + align 16 + global EXTN(jsimd_h2v1_merged_upsample_sse2) + +EXTN(jsimd_h2v1_merged_upsample_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + push rbx + collect_args + + mov rcx, r10 ; col + test rcx,rcx + jz near .return + + push rcx + + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + mov rdi, r13 + mov rsi, JSAMPROW [rsi+rcx*SIZEOF_JSAMPROW] ; inptr0 + mov rbx, JSAMPROW [rbx+rcx*SIZEOF_JSAMPROW] ; inptr1 + mov rdx, JSAMPROW [rdx+rcx*SIZEOF_JSAMPROW] ; inptr2 + mov rdi, JSAMPROW [rdi] ; outptr + + pop rcx ; col + +.columnloop: + + movdqa xmm6, XMMWORD [rbx] ; xmm6=Cb(0123456789ABCDEF) + movdqa xmm7, XMMWORD [rdx] ; xmm7=Cr(0123456789ABCDEF) + + pxor xmm1,xmm1 ; xmm1=(all 0's) + pcmpeqw xmm3,xmm3 + psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} + + movdqa xmm4,xmm6 + punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH + punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL + movdqa xmm0,xmm7 + punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH + punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL + + paddw xmm6,xmm3 + paddw xmm4,xmm3 + paddw xmm7,xmm3 + paddw xmm0,xmm3 + + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb + + movdqa xmm5,xmm6 ; xmm5=CbH + movdqa xmm2,xmm4 ; xmm2=CbL + paddw xmm6,xmm6 ; xmm6=2*CbH + paddw xmm4,xmm4 ; xmm4=2*CbL + movdqa xmm1,xmm7 ; xmm1=CrH + movdqa xmm3,xmm0 ; xmm3=CrL + paddw xmm7,xmm7 ; xmm7=2*CrH + paddw xmm0,xmm0 ; xmm0=2*CrL + + pmulhw xmm6,[PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[PW_F0402] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[PW_F0402] ; xmm0=(2*CrL * FIX(0.40200)) + + paddw xmm6,[PW_ONE] + paddw xmm4,[PW_ONE] + psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) + psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) + paddw xmm7,[PW_ONE] + paddw xmm0,[PW_ONE] + psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) + psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) + + paddw xmm6,xmm5 + paddw xmm4,xmm2 + paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H + paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L + paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H + paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L + + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H + + movdqa xmm6,xmm5 + movdqa xmm7,xmm2 + punpcklwd xmm5,xmm1 + punpckhwd xmm6,xmm1 + pmaddwd xmm5,[PW_MF0344_F0285] + pmaddwd xmm6,[PW_MF0344_F0285] + punpcklwd xmm2,xmm3 + punpckhwd xmm7,xmm3 + pmaddwd xmm2,[PW_MF0344_F0285] + pmaddwd xmm7,[PW_MF0344_F0285] + + paddd xmm5,[PD_ONEHALF] + paddd xmm6,[PD_ONEHALF] + psrad xmm5,SCALEBITS + psrad xmm6,SCALEBITS + paddd xmm2,[PD_ONEHALF] + paddd xmm7,[PD_ONEHALF] + psrad xmm2,SCALEBITS + psrad xmm7,SCALEBITS + + packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + + movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H + + mov al,2 ; Yctr + jmp short .Yloop_1st + +.Yloop_2nd: + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H + +.Yloop_1st: + movdqa xmm7, XMMWORD [rsi] ; xmm7=Y(0123456789ABCDEF) + + pcmpeqw xmm6,xmm6 + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE + psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO + + movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) + movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) + movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) + + paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) + paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + + paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) + paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + + paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) + paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + +%if RGB_PIXELSIZE == 3 ; --------------- + + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmF,xmmH ; movntdqu XMMWORD [rdi], xmmF + add rdi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + pcmpeqb xmmH,xmmH ; xmmH=(all 1's) + lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmH ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub rcx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + maskmovdqu xmmA,xmmH ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD +.column_st15: + mov rax,rcx + xor rcx, byte 0x0F + shl rcx, 2 + movd xmmB,ecx + psrlq xmmH,4 + pcmpeqb xmmE,xmmE + psrlq xmmH,xmmB + psrlq xmmE,xmmB + punpcklbw xmmE,xmmH + ; ---------------- + mov rcx,rdi + and rcx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + add rax,rcx + cmp rax, byte SIZEOF_XMMWORD + ja short .adj0 + and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmG,xmmA + movdqa xmmC,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmD,ecx + sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmF,ecx + psllq xmmA,xmmF + psllq xmmE,xmmF + jmp short .adj0 +.adj1: neg rcx + movd xmmF,ecx + psrlq xmmA,xmmF + psrlq xmmE,xmmF + psllq xmmG,xmmD + psllq xmmC,xmmD + por xmmA,xmmG + por xmmE,xmmC +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%else ; RGB_PIXELSIZE == 4 ; ----------- + +%ifdef RGBX_FILLER_0XFF + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%else + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) +%endif + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 + + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + jmp short .out0 +.out1: ; --(unaligned)----------------- + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmC,xmmE ; movntdqu XMMWORD [rdi], xmmC + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmH,xmmE ; movntdqu XMMWORD [rdi], xmmH + add rdi, byte SIZEOF_XMMWORD ; outptr +.out0: + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn + + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd + + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + +.column_st32: + pcmpeqb xmmE,xmmE ; xmmE=(all 1's) + cmp rcx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + maskmovdqu xmmD,xmmE ; movntdqu XMMWORD [rdi], xmmD + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub rcx, byte SIZEOF_XMMWORD/2 +.column_st16: + cmp rcx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD/4 +.column_st15: + cmp rcx, byte SIZEOF_XMMWORD/16 + jb near .endcolumn + mov rax,rcx + xor rcx, byte 0x03 + inc rcx + shl rcx, 4 + movd xmmF,ecx + psrlq xmmE,xmmF + punpcklbw xmmE,xmmE + ; ---------------- + mov rcx,rdi + and rcx, byte SIZEOF_XMMWORD-1 + jz short .adj0 + lea rax, [rcx+rax*4] ; RGB_PIXELSIZE + cmp rax, byte SIZEOF_XMMWORD + ja short .adj0 + and rdi, byte (-SIZEOF_XMMWORD) ; align to 16-byte boundary + shl rcx, 3 ; pslldq xmmA,ecx & pslldq xmmE,ecx + movdqa xmmB,xmmA + movdqa xmmG,xmmE + pslldq xmmA, SIZEOF_XMMWORD/2 + pslldq xmmE, SIZEOF_XMMWORD/2 + movd xmmC,ecx + sub rcx, byte (SIZEOF_XMMWORD/2)*BYTE_BIT + jb short .adj1 + movd xmmH,ecx + psllq xmmA,xmmH + psllq xmmE,xmmH + jmp short .adj0 +.adj1: neg rcx + movd xmmH,ecx + psrlq xmmA,xmmH + psrlq xmmE,xmmH + psllq xmmB,xmmC + psllq xmmG,xmmC + por xmmA,xmmB + por xmmE,xmmG +.adj0: ; ---------------- + maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA + +%endif ; RGB_PIXELSIZE ; --------------- + +.endcolumn: + sfence ; flush the write buffer + +.return: + uncollect_args + pop rbx + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. +; +; GLOBAL(void) +; jsimd_h2v2_merged_upsample_sse2 (JDIMENSION output_width, +; JSAMPIMAGE input_buf, +; JDIMENSION in_row_group_ctr, +; JSAMPARRAY output_buf); +; + +; r10 = JDIMENSION output_width +; r11 = JSAMPIMAGE input_buf +; r12 = JDIMENSION in_row_group_ctr +; r13 = JSAMPARRAY output_buf + + align 16 + global EXTN(jsimd_h2v2_merged_upsample_sse2) + +EXTN(jsimd_h2v2_merged_upsample_sse2): + push rbp + mov rbp,rsp + push rbx + collect_args + + mov rax, r10 + + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + mov rdi, r13 + lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] + + push rdx ; inptr2 + push rbx ; inptr1 + push rsi ; inptr00 + mov rbx,rsp + + push rdi + push rcx + push rax + + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + + call EXTN(jsimd_h2v1_merged_upsample_sse2) + + pop rax + pop rcx + pop rdi + pop rsi + pop rbx + pop rdx + + add rdi, byte SIZEOF_JSAMPROW ; outptr1 + add rsi, byte SIZEOF_JSAMPROW ; inptr01 + + push rdx ; inptr2 + push rbx ; inptr1 + push rsi ; inptr00 + mov rbx,rsp + + push rdi + push rcx + push rax + + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + + call EXTN(jsimd_h2v1_merged_upsample_sse2) + + pop rax + pop rcx + pop rdi + pop rsi + pop rbx + pop rdx + + uncollect_args + pop rbx + pop rbp + ret diff --git a/simd/jdsamss2-64.asm b/simd/jdsamss2-64.asm new file mode 100644 index 00000000..1f7b1f59 --- /dev/null +++ b/simd/jdsamss2-64.asm @@ -0,0 +1,664 @@ +; +; jdsamss2.asm - upsampling (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fancy_upsample_sse2) + +EXTN(jconst_fancy_upsample_sse2): + +PW_ONE times 8 dw 1 +PW_TWO times 8 dw 2 +PW_THREE times 8 dw 3 +PW_SEVEN times 8 dw 7 +PW_EIGHT times 8 dw 8 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. +; +; The upsampling algorithm is linear interpolation between pixel centers, +; also known as a "triangle filter". This is a good compromise between +; speed and visual quality. The centers of the output pixels are 1/4 and 3/4 +; of the way between input pixel centers. +; +; GLOBAL(void) +; jsimd_h2v1_fancy_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +; r10 = int max_v_samp_factor +; r11 = JDIMENSION downsampled_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_sse2) + +EXTN(jsimd_h2v1_fancy_upsample_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rax, r11 ; colctr + test rax,rax + jz near .return + + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rax ; colctr + push rdi + push rsi + + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr + + test rax, SIZEOF_XMMWORD-1 + jz short .skip + mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample +.skip: + pxor xmm0,xmm0 ; xmm0=(all 0's) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-1) + pand xmm7, XMMWORD [rsi+0*SIZEOF_XMMWORD] + + add rax, byte SIZEOF_XMMWORD-1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop + +.columnloop_last: + pcmpeqb xmm6,xmm6 + pslldq xmm6,(SIZEOF_XMMWORD-1) + pand xmm6, XMMWORD [rsi+0*SIZEOF_XMMWORD] + jmp short .upsample + +.columnloop: + movdqa xmm6, XMMWORD [rsi+1*SIZEOF_XMMWORD] + pslldq xmm6,(SIZEOF_XMMWORD-1) + +.upsample: + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm2,xmm1 + movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) + pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) + psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) + + por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) + por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) + + movdqa xmm7,xmm1 + psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) + + movdqa xmm4,xmm1 + punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm2 + punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) + punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) + movdqa xmm6,xmm3 + punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) + punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) + + pmullw xmm1,[PW_THREE] + pmullw xmm4,[PW_THREE] + paddw xmm2,[PW_ONE] + paddw xmm5,[PW_ONE] + paddw xmm3,[PW_TWO] + paddw xmm6,[PW_TWO] + + paddw xmm2,xmm1 + paddw xmm5,xmm4 + psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) + paddw xmm3,xmm1 + paddw xmm6,xmm4 + psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) + psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) + + psllw xmm3,BYTE_BIT + psllw xmm6,BYTE_BIT + por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) + por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm5 + + sub rax, byte SIZEOF_XMMWORD + add rsi, byte 1*SIZEOF_XMMWORD ; inptr + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last + + pop rsi + pop rdi + pop rax + + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg near .rowloop + +.return: + uncollect_args + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. +; Again a triangle filter; see comments for h2v1 case, above. +; +; GLOBAL(void) +; jsimd_h2v2_fancy_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION downsampled_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +; r10 = int max_v_samp_factor +; r11 = JDIMENSION downsampled_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY * output_data_ptr + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 4 + + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_sse2) + +EXTN(jsimd_h2v2_fancy_upsample_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + push rbx + collect_args + + mov rax, r11 ; colctr + test rax,rax + jz near .return + + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rax ; colctr + push rcx + push rdi + push rsi + + mov rcx, JSAMPROW [rsi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 + mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 + mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 + + test rax, SIZEOF_XMMWORD-1 + jz short .skip + push rdx + mov dl, JSAMPLE [rcx+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rcx+rax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rbx+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rbx+rax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop rdx +.skip: + ; -- process the first column block + + movdqa xmm0, XMMWORD [rbx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] + movdqa xmm1, XMMWORD [rcx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] + movdqa xmm2, XMMWORD [rsi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] + + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0,[PW_THREE] + pmullw xmm4,[PW_THREE] + + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-2) + + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + + movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm6 + + pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) + pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) + + movdqa XMMWORD [wk(0)], xmm1 + movdqa XMMWORD [wk(1)], xmm2 + + add rax, byte SIZEOF_XMMWORD-1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop + +.columnloop_last: + ; -- process the last column block + + pcmpeqb xmm1,xmm1 + pslldq xmm1,(SIZEOF_XMMWORD-2) + movdqa xmm2,xmm1 + + pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] + pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] + + movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) + + jmp near .upsample + +.columnloop: + ; -- process the next column block + + movdqa xmm0, XMMWORD [rbx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] + movdqa xmm1, XMMWORD [rcx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] + + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + + pmullw xmm0,[PW_THREE] + pmullw xmm4,[PW_THREE] + + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + + movdqa XMMWORD [rdx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [rdx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm6 + + pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) + pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) + + movdqa XMMWORD [wk(2)], xmm1 + movdqa XMMWORD [wk(3)], xmm2 + +.upsample: + ; -- process the upper row + + movdqa xmm7, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [rdx+1*SIZEOF_XMMWORD] + + movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) + movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) + psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) + pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) + movdqa xmm5,xmm7 + movdqa xmm6,xmm3 + psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) + pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) + + por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) + por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) + + movdqa xmm1,xmm7 + movdqa xmm2,xmm3 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) + movdqa xmm4,xmm3 + psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(0)], xmm4 + + pmullw xmm7,[PW_THREE] + pmullw xmm3,[PW_THREE] + paddw xmm1,[PW_EIGHT] + paddw xmm5,[PW_EIGHT] + paddw xmm0,[PW_SEVEN] + paddw xmm2,[PW_SEVEN] + + paddw xmm1,xmm7 + paddw xmm5,xmm3 + psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) + paddw xmm0,xmm7 + paddw xmm2,xmm3 + psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) + psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) + + psllw xmm0,BYTE_BIT + psllw xmm2,BYTE_BIT + por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) + por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 + + ; -- process the lower row + + movdqa xmm6, XMMWORD [rdi+0*SIZEOF_XMMWORD] + movdqa xmm4, XMMWORD [rdi+1*SIZEOF_XMMWORD] + + movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) + movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) + psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) + pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) + movdqa xmm0,xmm6 + movdqa xmm2,xmm4 + psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) + pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) + + por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) + por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) + + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) + movdqa xmm3,xmm4 + psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) + + por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) + + movdqa XMMWORD [wk(1)], xmm3 + + pmullw xmm6,[PW_THREE] + pmullw xmm4,[PW_THREE] + paddw xmm1,[PW_EIGHT] + paddw xmm0,[PW_EIGHT] + paddw xmm7,[PW_SEVEN] + paddw xmm5,[PW_SEVEN] + + paddw xmm1,xmm6 + paddw xmm0,xmm4 + psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) + psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) + paddw xmm7,xmm6 + paddw xmm5,xmm4 + psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) + psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) + + psllw xmm7,BYTE_BIT + psllw xmm5,BYTE_BIT + por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) + por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) + + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm0 + + sub rax, byte SIZEOF_XMMWORD + add rcx, byte 1*SIZEOF_XMMWORD ; inptr1(above) + add rbx, byte 1*SIZEOF_XMMWORD ; inptr0 + add rsi, byte 1*SIZEOF_XMMWORD ; inptr1(below) + add rdx, byte 2*SIZEOF_XMMWORD ; outptr0 + add rdi, byte 2*SIZEOF_XMMWORD ; outptr1 + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test rax,rax + jnz near .columnloop_last + + pop rsi + pop rdi + pop rcx + pop rax + + add rsi, byte 1*SIZEOF_JSAMPROW ; input_data + add rdi, byte 2*SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop + +.return: + uncollect_args + pop rbx + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 1:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v1_upsample_sse2 (int max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +; r10 = int max_v_samp_factor +; r11 = JDIMENSION output_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v1_upsample_sse2) + +EXTN(jsimd_h2v1_upsample_sse2): + push rbp + mov rbp,rsp + collect_args + + mov rdx, r11 + add rdx, byte (2*SIZEOF_XMMWORD)-1 + and rdx, byte -(2*SIZEOF_XMMWORD) + jz near .return + + mov rcx, r10 ; rowctr + test rcx,rcx + jz short .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rdi + push rsi + + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr + mov rax,rdx ; colctr +.columnloop: + + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 + + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 + + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] + + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 + + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 + + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rdi, byte 4*SIZEOF_XMMWORD ; outptr + jmp short .columnloop + +.nextrow: + pop rsi + pop rdi + + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg short .rowloop + +.return: + uncollect_args + pop rbp + ret + +; -------------------------------------------------------------------------- +; +; Fast processing for the common case of 2:1 horizontal and 2:1 vertical. +; It's still a box filter. +; +; GLOBAL(void) +; jsimd_h2v2_upsample_sse2 (nt max_v_samp_factor, +; JDIMENSION output_width, +; JSAMPARRAY input_data, +; JSAMPARRAY * output_data_ptr); +; + +; r10 = int max_v_samp_factor +; r11 = JDIMENSION output_width +; r12 = JSAMPARRAY input_data +; r13 = JSAMPARRAY * output_data_ptr + + align 16 + global EXTN(jsimd_h2v2_upsample_sse2) + +EXTN(jsimd_h2v2_upsample_sse2): + push rbp + mov rbp,rsp + push rbx + collect_args + + mov rdx, r11 + add rdx, byte (2*SIZEOF_XMMWORD)-1 + and rdx, byte -(2*SIZEOF_XMMWORD) + jz near .return + + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return + + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data +.rowloop: + push rdi + push rsi + + mov rsi, JSAMPROW [rsi] ; inptr + mov rbx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 + mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 + mov rax,rdx ; colctr +.columnloop: + + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 + + movdqa XMMWORD [rbx+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rbx+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 + + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] + + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 + + movdqa XMMWORD [rbx+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rbx+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 + + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow + + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rbx, byte 4*SIZEOF_XMMWORD ; outptr0 + add rdi, byte 4*SIZEOF_XMMWORD ; outptr1 + jmp short .columnloop + +.nextrow: + pop rsi + pop rdi + + add rsi, byte 1*SIZEOF_JSAMPROW ; input_data + add rdi, byte 2*SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop + +.return: + uncollect_args + pop rbx + pop rbp + ret diff --git a/simd/jfss2fst-64.asm b/simd/jfss2fst-64.asm new file mode 100644 index 00000000..93031565 --- /dev/null +++ b/simd/jfss2fst-64.asm @@ -0,0 +1,388 @@ +; +; jfss2fst.asm - fast integer FDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the forward DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jfdctfst.c; see the jfdctfst.c +; for more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. + +%if CONST_BITS == 8 +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_fdct_ifast_sse2) + +EXTN(jconst_fdct_ifast_sse2): + +PW_F0707 times 8 dw F_0_707 << CONST_SHIFT +PW_F0382 times 8 dw F_0_382 << CONST_SHIFT +PW_F0541 times 8 dw F_0_541 << CONST_SHIFT +PW_F1306 times 8 dw F_1_306 << CONST_SHIFT + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_ifast_sse2 (DCTELEM * data) +; + +; r10 = DCTELEM * data + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_ifast_sse2) + +EXTN(jsimd_fdct_ifast_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + psubw xmm3,xmm1 ; xmm3=tmp13 + psubw xmm6,xmm7 ; xmm6=tmp12 + paddw xmm4,xmm1 ; xmm4=tmp10 + paddw xmm0,xmm7 ; xmm0=tmp11 + + paddw xmm6,xmm3 + psllw xmm6,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm6,[PW_F0707] ; xmm6=z1 + + movdqa xmm1,xmm4 + movdqa xmm7,xmm3 + psubw xmm4,xmm0 ; xmm4=data4 + psubw xmm3,xmm6 ; xmm3=data6 + paddw xmm1,xmm0 ; xmm1=data0 + paddw xmm7,xmm6 ; xmm7=data2 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 + + ; -- Odd part + + paddw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm5,xmm0 ; xmm5=tmp11 + paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 + + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[PW_F0707] ; xmm5=z3 + + movdqa xmm4,xmm2 ; xmm4=tmp10 + psubw xmm2,xmm0 + pmulhw xmm2,[PW_F0382] ; xmm2=z5 + pmulhw xmm4,[PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm2 ; xmm4=z2 + paddw xmm0,xmm2 ; xmm0=z4 + + movdqa xmm3,xmm6 + psubw xmm6,xmm5 ; xmm6=z13 + paddw xmm3,xmm5 ; xmm3=z11 + + movdqa xmm2,xmm6 + movdqa xmm5,xmm3 + psubw xmm6,xmm4 ; xmm6=data3 + psubw xmm3,xmm0 ; xmm3=data7 + paddw xmm2,xmm4 ; xmm2=data5 + paddw xmm5,xmm0 ; xmm5=data1 + + ; ---- Pass 2: process columns. + + ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) + ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) + + movdqa xmm4,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) + punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 + + ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) + ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm7,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) + punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) + punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) + + movdqa xmm2,xmm5 ; transpose coefficients(phase 2) + punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) + punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) + movdqa xmm3,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) + punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) + + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) + + movdqa xmm2,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) + punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) + movdqa xmm7,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) + punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) + + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm0,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm5,xmm6 + movdqa xmm3,xmm1 + psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 + psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 + paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 + paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 + + movdqa xmm6,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm1,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm7,xmm6 + movdqa xmm0,xmm2 + paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 + paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 + psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 + psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm1,xmm5 + psubw xmm3,xmm6 ; xmm3=tmp13 + psubw xmm5,xmm2 ; xmm5=tmp12 + paddw xmm4,xmm6 ; xmm4=tmp10 + paddw xmm1,xmm2 ; xmm1=tmp11 + + paddw xmm5,xmm3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[PW_F0707] ; xmm5=z1 + + movdqa xmm6,xmm4 + movdqa xmm2,xmm3 + psubw xmm4,xmm1 ; xmm4=data4 + psubw xmm3,xmm5 ; xmm3=data6 + paddw xmm6,xmm1 ; xmm6=data0 + paddw xmm2,xmm5 ; xmm2=data2 + + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 + + ; -- Odd part + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + paddw xmm7,xmm0 ; xmm7=tmp10 + paddw xmm0,xmm1 ; xmm0=tmp11 + paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 + + psllw xmm7,PRE_MULTIPLY_SCALE_BITS + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm0,[PW_F0707] ; xmm0=z3 + + movdqa xmm4,xmm7 ; xmm4=tmp10 + psubw xmm7,xmm1 + pmulhw xmm7,[PW_F0382] ; xmm7=z5 + pmulhw xmm4,[PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm7 ; xmm4=z2 + paddw xmm1,xmm7 ; xmm1=z4 + + movdqa xmm3,xmm5 + psubw xmm5,xmm0 ; xmm5=z13 + paddw xmm3,xmm0 ; xmm3=z11 + + movdqa xmm6,xmm5 + movdqa xmm2,xmm3 + psubw xmm5,xmm4 ; xmm5=data3 + psubw xmm3,xmm1 ; xmm3=data7 + paddw xmm6,xmm4 ; xmm6=data5 + paddw xmm2,xmm1 ; xmm2=data1 + + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jfss2int-64.asm b/simd/jfss2int-64.asm new file mode 100644 index 00000000..f7879214 --- /dev/null +++ b/simd/jfss2int-64.asm @@ -0,0 +1,618 @@ +; +; jfss2int.asm - accurate integer FDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; forward DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jfdctint.c; see the jfdctint.c for +; more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_islow_sse2) + +EXTN(jconst_fdct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_islow_sse2 (DCTELEM * data) +; + +; r10 = DCTELEM * data + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 + + align 16 + global EXTN(jsimd_fdct_islow_sse2) + +EXTN(jsimd_fdct_islow_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + paddw xmm3,xmm1 ; xmm3=tmp10 + paddw xmm6,xmm7 ; xmm6=tmp11 + psubw xmm4,xmm1 ; xmm4=tmp13 + psubw xmm0,xmm7 ; xmm0=tmp12 + + movdqa xmm1,xmm3 + paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 + psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 + + psllw xmm3,PASS1_BITS ; xmm3=data0 + psllw xmm1,PASS1_BITS ; xmm1=data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm7,xmm4 ; xmm4=tmp13 + movdqa xmm6,xmm4 + punpcklwd xmm7,xmm0 ; xmm0=tmp12 + punpckhwd xmm6,xmm0 + movdqa xmm4,xmm7 + movdqa xmm0,xmm6 + pmaddwd xmm7,[PW_F130_F054] ; xmm7=data2L + pmaddwd xmm6,[PW_F130_F054] ; xmm6=data2H + pmaddwd xmm4,[PW_F054_MF130] ; xmm4=data6L + pmaddwd xmm0,[PW_F054_MF130] ; xmm0=data6H + + paddd xmm7,[PD_DESCALE_P1] + paddd xmm6,[PD_DESCALE_P1] + psrad xmm7,DESCALE_P1 + psrad xmm6,DESCALE_P1 + paddd xmm4,[PD_DESCALE_P1] + paddd xmm0,[PD_DESCALE_P1] + psrad xmm4,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm7,xmm6 ; xmm7=data2 + packssdw xmm4,xmm0 ; xmm4=data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 + + ; -- Odd part + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 + + movdqa xmm6,xmm2 ; xmm2=tmp4 + movdqa xmm0,xmm5 ; xmm5=tmp5 + paddw xmm6,xmm3 ; xmm6=z3 + paddw xmm0,xmm1 ; xmm0=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm7,xmm6 + movdqa xmm4,xmm6 + punpcklwd xmm7,xmm0 + punpckhwd xmm4,xmm0 + movdqa xmm6,xmm7 + movdqa xmm0,xmm4 + pmaddwd xmm7,[PW_MF078_F117] ; xmm7=z3L + pmaddwd xmm4,[PW_MF078_F117] ; xmm4=z3H + pmaddwd xmm6,[PW_F117_F078] ; xmm6=z4L + pmaddwd xmm0,[PW_F117_F078] ; xmm0=z4H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm7,xmm2 + movdqa xmm4,xmm2 + punpcklwd xmm7,xmm1 + punpckhwd xmm4,xmm1 + movdqa xmm2,xmm7 + movdqa xmm1,xmm4 + pmaddwd xmm7,[PW_MF060_MF089] ; xmm7=tmp4L + pmaddwd xmm4,[PW_MF060_MF089] ; xmm4=tmp4H + pmaddwd xmm2,[PW_MF089_F060] ; xmm2=tmp7L + pmaddwd xmm1,[PW_MF089_F060] ; xmm1=tmp7H + + paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H + paddd xmm2,xmm6 ; xmm2=data1L + paddd xmm1,xmm0 ; xmm1=data1H + + paddd xmm7,[PD_DESCALE_P1] + paddd xmm4,[PD_DESCALE_P1] + psrad xmm7,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm2,[PD_DESCALE_P1] + paddd xmm1,[PD_DESCALE_P1] + psrad xmm2,DESCALE_P1 + psrad xmm1,DESCALE_P1 + + packssdw xmm7,xmm4 ; xmm7=data7 + packssdw xmm2,xmm1 ; xmm2=data1 + + movdqa xmm4,xmm5 + movdqa xmm1,xmm5 + punpcklwd xmm4,xmm3 + punpckhwd xmm1,xmm3 + movdqa xmm5,xmm4 + movdqa xmm3,xmm1 + pmaddwd xmm4,[PW_MF050_MF256] ; xmm4=tmp5L + pmaddwd xmm1,[PW_MF050_MF256] ; xmm1=tmp5H + pmaddwd xmm5,[PW_MF256_F050] ; xmm5=tmp6L + pmaddwd xmm3,[PW_MF256_F050] ; xmm3=tmp6H + + paddd xmm4,xmm6 ; xmm4=data5L + paddd xmm1,xmm0 ; xmm1=data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H + + paddd xmm4,[PD_DESCALE_P1] + paddd xmm1,[PD_DESCALE_P1] + psrad xmm4,DESCALE_P1 + psrad xmm1,DESCALE_P1 + paddd xmm5,[PD_DESCALE_P1] + paddd xmm3,[PD_DESCALE_P1] + psrad xmm5,DESCALE_P1 + psrad xmm3,DESCALE_P1 + + packssdw xmm4,xmm1 ; xmm4=data5 + packssdw xmm5,xmm3 ; xmm5=data3 + + ; ---- Pass 2: process columns. + + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 + + ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) + ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) + + movdqa xmm1,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) + punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) + movdqa xmm3,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) + punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) + + movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 + + ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) + ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm0,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) + + movdqa xmm4,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) + punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) + punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) + punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) + punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) + + movdqa xmm5,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm2,xmm5 + movdqa xmm7,xmm6 + psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 + psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 + paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 + paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movdqa xmm5,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm0,xmm5 + movdqa xmm3,xmm4 + paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 + paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 + psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 + psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm1,xmm7 + movdqa xmm6,xmm2 + paddw xmm7,xmm5 ; xmm7=tmp10 + paddw xmm2,xmm4 ; xmm2=tmp11 + psubw xmm1,xmm5 ; xmm1=tmp13 + psubw xmm6,xmm4 ; xmm6=tmp12 + + movdqa xmm5,xmm7 + paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 + psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 + + paddw xmm7,[PW_DESCALE_P2X] + paddw xmm5,[PW_DESCALE_P2X] + psraw xmm7,PASS1_BITS ; xmm7=data0 + psraw xmm5,PASS1_BITS ; xmm5=data4 + + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm5 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm4,xmm1 ; xmm1=tmp13 + movdqa xmm2,xmm1 + punpcklwd xmm4,xmm6 ; xmm6=tmp12 + punpckhwd xmm2,xmm6 + movdqa xmm1,xmm4 + movdqa xmm6,xmm2 + pmaddwd xmm4,[PW_F130_F054] ; xmm4=data2L + pmaddwd xmm2,[PW_F130_F054] ; xmm2=data2H + pmaddwd xmm1,[PW_F054_MF130] ; xmm1=data6L + pmaddwd xmm6,[PW_F054_MF130] ; xmm6=data6H + + paddd xmm4,[PD_DESCALE_P2] + paddd xmm2,[PD_DESCALE_P2] + psrad xmm4,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm1,[PD_DESCALE_P2] + paddd xmm6,[PD_DESCALE_P2] + psrad xmm1,DESCALE_P2 + psrad xmm6,DESCALE_P2 + + packssdw xmm4,xmm2 ; xmm4=data2 + packssdw xmm1,xmm6 ; xmm1=data6 + + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm1 + + ; -- Odd part + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + movdqa xmm2,xmm0 ; xmm0=tmp4 + movdqa xmm6,xmm3 ; xmm3=tmp5 + paddw xmm2,xmm7 ; xmm2=z3 + paddw xmm6,xmm5 ; xmm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm4,xmm2 + movdqa xmm1,xmm2 + punpcklwd xmm4,xmm6 + punpckhwd xmm1,xmm6 + movdqa xmm2,xmm4 + movdqa xmm6,xmm1 + pmaddwd xmm4,[PW_MF078_F117] ; xmm4=z3L + pmaddwd xmm1,[PW_MF078_F117] ; xmm1=z3H + pmaddwd xmm2,[PW_F117_F078] ; xmm2=z4L + pmaddwd xmm6,[PW_F117_F078] ; xmm6=z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm4,xmm0 + movdqa xmm1,xmm0 + punpcklwd xmm4,xmm5 + punpckhwd xmm1,xmm5 + movdqa xmm0,xmm4 + movdqa xmm5,xmm1 + pmaddwd xmm4,[PW_MF060_MF089] ; xmm4=tmp4L + pmaddwd xmm1,[PW_MF060_MF089] ; xmm1=tmp4H + pmaddwd xmm0,[PW_MF089_F060] ; xmm0=tmp7L + pmaddwd xmm5,[PW_MF089_F060] ; xmm5=tmp7H + + paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H + paddd xmm0,xmm2 ; xmm0=data1L + paddd xmm5,xmm6 ; xmm5=data1H + + paddd xmm4,[PD_DESCALE_P2] + paddd xmm1,[PD_DESCALE_P2] + psrad xmm4,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm0,[PD_DESCALE_P2] + paddd xmm5,[PD_DESCALE_P2] + psrad xmm0,DESCALE_P2 + psrad xmm5,DESCALE_P2 + + packssdw xmm4,xmm1 ; xmm4=data7 + packssdw xmm0,xmm5 ; xmm0=data1 + + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1,xmm3 + movdqa xmm5,xmm3 + punpcklwd xmm1,xmm7 + punpckhwd xmm5,xmm7 + movdqa xmm3,xmm1 + movdqa xmm7,xmm5 + pmaddwd xmm1,[PW_MF050_MF256] ; xmm1=tmp5L + pmaddwd xmm5,[PW_MF050_MF256] ; xmm5=tmp5H + pmaddwd xmm3,[PW_MF256_F050] ; xmm3=tmp6L + pmaddwd xmm7,[PW_MF256_F050] ; xmm7=tmp6H + + paddd xmm1,xmm2 ; xmm1=data5L + paddd xmm5,xmm6 ; xmm5=data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H + + paddd xmm1,[PD_DESCALE_P2] + paddd xmm5,[PD_DESCALE_P2] + psrad xmm1,DESCALE_P2 + psrad xmm5,DESCALE_P2 + paddd xmm3,[PD_DESCALE_P2] + paddd xmm7,[PD_DESCALE_P2] + psrad xmm3,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm1,xmm5 ; xmm1=data5 + packssdw xmm3,xmm7 ; xmm3=data3 + + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jfsseflt-64.asm b/simd/jfsseflt-64.asm new file mode 100644 index 00000000..d8f72468 --- /dev/null +++ b/simd/jfsseflt-64.asm @@ -0,0 +1,354 @@ +; +; jfsseflt.asm - floating-point FDCT (64-bit SSE) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the forward DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jfdctflt.c; see the jfdctflt.c for more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 +%endmacro + +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_fdct_float_sse) + +EXTN(jconst_fdct_float_sse): + +PD_0_382 times 4 dd 0.382683432365089771728460 +PD_0_707 times 4 dd 0.707106781186547524400844 +PD_0_541 times 4 dd 0.541196100146196984399723 +PD_1_306 times 4 dd 1.306562964876376527856643 + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform the forward DCT on one block of samples. +; +; GLOBAL(void) +; jsimd_fdct_float_sse (FAST_FLOAT * data) +; + +; r10 = FAST_FLOAT * data + +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_fdct_float_sse) + +EXTN(jsimd_fdct_float_sse): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE/4 +.rowloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)] + + ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) + ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) + + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) + unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) + unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) + + movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] + + ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) + ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) + + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) + unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) + + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 + + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 + + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 + + addps xmm0,xmm5 + mulps xmm0,[PD_0_707] ; xmm0=z1 + + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 + + movaps XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + + mulps xmm3,[PD_0_707] ; xmm3=z3 + + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[PD_0_382] ; xmm2=z5 + mulps xmm1,[PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 + + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 + + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 + + movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + + add rdx, 4*DCTSIZE*SIZEOF_FAST_FLOAT + dec rcx + jnz near .rowloop + + ; ---- Pass 2: process columns. + + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE/4 +.columnloop: + + movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)] + + ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) + ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) + + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) + unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) + unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) + + movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)] + + ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) + ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) + + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) + + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) + unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) + unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) + + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 + + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 + + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 + + addps xmm0,xmm5 + mulps xmm0,[PD_0_707] ; xmm0=z1 + + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 + + movaps XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + + ; -- Odd part + + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + + mulps xmm3,[PD_0_707] ; xmm3=z3 + + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[PD_0_382] ; xmm2=z5 + mulps xmm1,[PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 + + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 + + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 + + movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + + add rdx, byte 4*SIZEOF_FAST_FLOAT + dec rcx + jnz near .columnloop + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jiss2flt-64.asm b/simd/jiss2flt-64.asm new file mode 100644 index 00000000..572909d2 --- /dev/null +++ b/simd/jiss2flt-64.asm @@ -0,0 +1,479 @@ +; +; jiss2flt.asm - floating-point IDCT (64-bit SSE & SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a floating-point implementation of the inverse DCT +; (Discrete Cosine Transform). The following code is based directly on +; the IJG's original jidctflt.c; see the jidctflt.c for more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 +%endmacro + +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE +%endmacro + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_float_sse2) + +EXTN(jconst_idct_float_sse2): + +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_float_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +; r10 = void * dct_table +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13 = JDIMENSION output_col + +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] + + align 16 + global EXTN(jsimd_idct_float_sse2) + +EXTN(jsimd_idct_float_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],eax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [workspace] + push rbx + collect_args + + ; ---- Pass 1: process columns from input, store into work array. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + lea rdi, [workspace] ; FAST_FLOAT * wsptr + mov rcx, DCTSIZE/4 ; ctr +.columnloop: +%ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movq xmm1, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + movq xmm4, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movq xmm6, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + movq xmm7, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm2 + por xmm3,xmm4 + por xmm5,xmm6 + por xmm1,xmm3 + por xmm5,xmm7 + por xmm1,xmm5 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT + + ; -- AC terms all zero + + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 + + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn +%endif +.columnDCT: + + ; -- Even part + + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) + + punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) + punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) + cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) + cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) + + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[PD_1_414] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movq xmm2, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + + punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) + punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) + cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) + cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) + + punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) + punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) + psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) + cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) + cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) + + mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[PD_1_414] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[PD_1_847] ; xmm0=z5 + mulps xmm3,[PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[PD_1_082] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 + + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 + +.nextcolumn: + add rsi, byte 4*SIZEOF_JCOEF ; coef_block + add rdx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add rdi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec rcx ; ctr + jnz near .columnloop + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov rax, [original_rbp] + lea rsi, [workspace] ; FAST_FLOAT * wsptr + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + mov rcx, DCTSIZE/4 ; ctr +.rowloop: + + ; -- Even part + + movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 + + mulps xmm1,[PD_1_414] + subps xmm1,xmm5 ; xmm1=tmp12 + + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 + + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 + + ; -- Odd part + + movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_FAST_FLOAT)] + + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 + + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 + + mulps xmm2,[PD_1_414] ; xmm2=tmp11 + + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[PD_1_847] ; xmm0=z5 + mulps xmm3,[PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[PD_1_082] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 + + ; -- Final output stage + + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 + + movaps xmm1,[PD_RNDINT_MAGIC] ; xmm1=[PD_RNDINT_MAGIC] + pcmpeqd xmm3,xmm3 + psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} + + addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) + addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) + addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) + addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) + + pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) + pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) + por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) + por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) + + movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 + movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 + + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm7,xmm1 + movaps xmm5,xmm3 + addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) + addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) + subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) + subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) + + movaps xmm2,[PD_RNDINT_MAGIC] ; xmm2=[PD_RNDINT_MAGIC] + pcmpeqd xmm4,xmm4 + psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} + + addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) + addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) + addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) + addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) + + pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) + pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) + por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) + por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) + + movdqa xmm2,[PB_CENTERJSAMP] ; xmm2=[PB_CENTERJSAMP] + + packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) + packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) + paddb xmm6,xmm2 + paddb xmm1,xmm2 + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 3) + punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + + pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rbx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm7 + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rbx, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm3 + + add rsi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add rdi, byte 4*SIZEOF_JSAMPROW + dec rcx ; ctr + jnz near .rowloop + + uncollect_args + pop rbx + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jiss2fst-64.asm b/simd/jiss2fst-64.asm new file mode 100644 index 00000000..97dfa761 --- /dev/null +++ b/simd/jiss2fst-64.asm @@ -0,0 +1,488 @@ +; +; jiss2fst.asm - fast integer IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/projecpt/showfiles.php?group_id=6208 +; +; This file contains a fast, not so accurate integer implementation of +; the inverse DCT (Discrete Cosine Transform). The following code is +; based directly on the IJG's original jidctfst.c; see the jidctfst.c +; for more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 + +%if IFAST_SCALE_BITS != PASS1_BITS +%error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." +%endif + +%if CONST_BITS == 8 +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + +; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) +; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) + +%define PRE_MULTIPLY_SCALE_BITS 2 +%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) + + alignz 16 + global EXTN(jconst_idct_ifast_sse2) + +EXTN(jconst_idct_ifast_sse2): + +PW_F1414 times 8 dw F_1_414 << CONST_SHIFT +PW_F1847 times 8 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 8 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_ifast_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +; r10 = jpeg_component_info * compptr +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13 = JDIMENSION output_col + +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_idct_ifast_sse2) + +EXTN(jsimd_idct_ifast_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],eax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) + + pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) + pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) + pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) + pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) + pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) + pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) + pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) + pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 + jmp near .column_end +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + psubw xmm0,xmm2 ; xmm0=tmp11 + psubw xmm1,xmm3 + paddw xmm4,xmm2 ; xmm4=tmp10 + paddw xmm5,xmm3 ; xmm5=tmp13 + + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[PW_F1414] + psubw xmm1,xmm5 ; xmm1=tmp12 + + movdqa xmm6,xmm4 + movdqa xmm7,xmm0 + psubw xmm4,xmm5 ; xmm4=tmp3 + psubw xmm0,xmm1 ; xmm0=tmp2 + paddw xmm6,xmm5 ; xmm6=tmp0 + paddw xmm7,xmm1 ; xmm7=tmp1 + + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 + + ; -- Odd part + + movdqa xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + + movdqa xmm4,xmm2 + movdqa xmm0,xmm5 + psubw xmm2,xmm1 ; xmm2=z12 + psubw xmm5,xmm3 ; xmm5=z10 + paddw xmm4,xmm1 ; xmm4=z11 + paddw xmm0,xmm3 ; xmm0=z13 + + movdqa xmm1,xmm5 ; xmm1=z10(unscaled) + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + + movdqa xmm3,xmm4 + psubw xmm4,xmm0 + paddw xmm3,xmm0 ; xmm3=tmp7 + + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm4,[PW_F1414] ; xmm4=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm0,xmm5 + paddw xmm5,xmm2 + pmulhw xmm5,[PW_F1847] ; xmm5=z5 + pmulhw xmm0,[PW_MF1613] + pmulhw xmm2,[PW_F1082] + psubw xmm0,xmm1 + psubw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm0,xmm5 ; xmm0=tmp12 + + ; -- Final output stage + + psubw xmm0,xmm3 ; xmm0=tmp6 + movdqa xmm1,xmm6 + movdqa xmm5,xmm7 + paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) + paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) + psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) + psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) + psubw xmm4,xmm0 ; xmm4=tmp5 + + movdqa xmm3,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) + punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) + movdqa xmm0,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) + + paddw xmm2,xmm4 ; xmm2=tmp4 + movdqa xmm5,xmm7 + movdqa xmm0,xmm1 + paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) + paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) + psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) + psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm2,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) + + movdqa xmm0,xmm3 ; transpose coefficients(phase 2) + punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) + punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) + punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) + + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) + + movdqa xmm3,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) + punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) + movdqa xmm0,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) + movdqa xmm7,xmm5 ; transpose coefficients(phase 3) + punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 + + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) + movdqa xmm7,xmm3 ; transpose coefficients(phase 3) + punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + + ; -- Even part + + ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 + + movdqa xmm2,xmm6 + movdqa xmm0,xmm5 + psubw xmm6,xmm1 ; xmm6=tmp11 + psubw xmm5,xmm3 + paddw xmm2,xmm1 ; xmm2=tmp10 + paddw xmm0,xmm3 ; xmm0=tmp13 + + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[PW_F1414] + psubw xmm5,xmm0 ; xmm5=tmp12 + + movdqa xmm1,xmm2 + movdqa xmm3,xmm6 + psubw xmm2,xmm0 ; xmm2=tmp3 + psubw xmm6,xmm5 ; xmm6=tmp2 + paddw xmm1,xmm0 ; xmm1=tmp0 + paddw xmm3,xmm5 ; xmm3=tmp1 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 + + ; -- Odd part + + ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 + + movdqa xmm2,xmm0 + movdqa xmm6,xmm4 + psubw xmm0,xmm7 ; xmm0=z12 + psubw xmm4,xmm5 ; xmm4=z10 + paddw xmm2,xmm7 ; xmm2=z11 + paddw xmm6,xmm5 ; xmm6=z13 + + movdqa xmm7,xmm4 ; xmm7=z10(unscaled) + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + + movdqa xmm5,xmm2 + psubw xmm2,xmm6 + paddw xmm5,xmm6 ; xmm5=tmp7 + + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm2,[PW_F1414] ; xmm2=tmp11 + + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; + + movdqa xmm6,xmm4 + paddw xmm4,xmm0 + pmulhw xmm4,[PW_F1847] ; xmm4=z5 + pmulhw xmm6,[PW_MF1613] + pmulhw xmm0,[PW_F1082] + psubw xmm6,xmm7 + psubw xmm0,xmm4 ; xmm0=tmp10 + paddw xmm6,xmm4 ; xmm6=tmp12 + + ; -- Final output stage + + psubw xmm6,xmm5 ; xmm6=tmp6 + movdqa xmm7,xmm1 + movdqa xmm4,xmm3 + paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) + paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) + psraw xmm1,(PASS1_BITS+3) ; descale + psraw xmm3,(PASS1_BITS+3) ; descale + psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) + psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) + psraw xmm7,(PASS1_BITS+3) ; descale + psraw xmm4,(PASS1_BITS+3) ; descale + psubw xmm2,xmm6 ; xmm2=tmp5 + + packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 + + paddw xmm0,xmm2 ; xmm0=tmp4 + movdqa xmm4,xmm5 + movdqa xmm7,xmm6 + paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) + paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) + psraw xmm5,(PASS1_BITS+3) ; descale + psraw xmm6,(PASS1_BITS+3) ; descale + psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) + psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) + psraw xmm4,(PASS1_BITS+3) ; descale + psraw xmm7,(PASS1_BITS+3) ; descale + + movdqa xmm2,[PB_CENTERJSAMP] ; xmm2=[PB_CENTERJSAMP] + + packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm1,xmm2 + paddb xmm3,xmm2 + paddb xmm5,xmm2 + paddb xmm7,xmm2 + + movdqa xmm0,xmm1 ; transpose coefficients(phase 1) + punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + movdqa xmm4,xmm1 ; transpose coefficients(phase 2) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm2,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + movdqa xmm3,xmm1 ; transpose coefficients(phase 3) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm7 + + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 + mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + ret diff --git a/simd/jiss2int-64.asm b/simd/jiss2int-64.asm new file mode 100644 index 00000000..cfeb42d8 --- /dev/null +++ b/simd/jiss2int-64.asm @@ -0,0 +1,844 @@ +; +; jiss2int.asm - accurate integer IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains a slow-but-accurate integer implementation of the +; inverse DCT (Discrete Cosine Transform). The following code is based +; directly on the IJG's original jidctint.c; see the jidctint.c for +; more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) + +%if CONST_BITS == 13 +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_islow_sse2) + +EXTN(jconst_idct_islow_sse2): + +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform dequantization and inverse DCT on one block of coefficients. +; +; GLOBAL(void) +; jsimd_idct_islow_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +; r10 = jpeg_component_info * compptr +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13 = JDIMENSION output_col + +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 12 + + align 16 + global EXTN(jsimd_idct_islow_sse2) + +EXTN(jsimd_idct_islow_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_ISLOW_SSE2 + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm5, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm5,PASS1_BITS + + movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) + punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) + + pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) + pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) + pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) + pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) + pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) + pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) + pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) + pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) + + movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + jmp near .column_end +%endif +.columnDCT: + + ; -- Even part + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm4,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm4,xmm3 ; xmm3=in6=z3 + punpckhwd xmm5,xmm3 + movdqa xmm1,xmm4 + movdqa xmm3,xmm5 + pmaddwd xmm4,[PW_F130_F054] ; xmm4=tmp3L + pmaddwd xmm5,[PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm3,[PW_F054_MF130] ; xmm3=tmp2H + + movdqa xmm6,xmm0 + paddw xmm0,xmm2 ; xmm0=in0+in4 + psubw xmm6,xmm2 ; xmm6=in0-in4 + + pxor xmm7,xmm7 + pxor xmm2,xmm2 + punpcklwd xmm7,xmm0 ; xmm7=tmp0L + punpckhwd xmm2,xmm0 ; xmm2=tmp0H + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS + + movdqa xmm0,xmm7 + paddd xmm7,xmm4 ; xmm7=tmp10L + psubd xmm0,xmm4 ; xmm0=tmp13L + movdqa xmm4,xmm2 + paddd xmm2,xmm5 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp13H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H + + pxor xmm5,xmm5 + pxor xmm7,xmm7 + punpcklwd xmm5,xmm6 ; xmm5=tmp1L + punpckhwd xmm7,xmm6 ; xmm7=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + + movdqa xmm2,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm2,xmm1 ; xmm2=tmp12L + movdqa xmm0,xmm7 + paddd xmm7,xmm3 ; xmm7=tmp11H + psubd xmm0,xmm3 ; xmm0=tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H + + ; -- Odd part + + movdqa xmm4, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm6, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm6, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm1, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm5,xmm6 + movdqa xmm7,xmm4 + paddw xmm5,xmm3 ; xmm5=z3 + paddw xmm7,xmm1 ; xmm7=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm2,xmm5 + movdqa xmm0,xmm5 + punpcklwd xmm2,xmm7 + punpckhwd xmm0,xmm7 + movdqa xmm5,xmm2 + movdqa xmm7,xmm0 + pmaddwd xmm2,[PW_MF078_F117] ; xmm2=z3L + pmaddwd xmm0,[PW_MF078_F117] ; xmm0=z3H + pmaddwd xmm5,[PW_F117_F078] ; xmm5=z4L + pmaddwd xmm7,[PW_F117_F078] ; xmm7=z4H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm2,xmm3 + movdqa xmm0,xmm3 + punpcklwd xmm2,xmm4 + punpckhwd xmm0,xmm4 + movdqa xmm3,xmm2 + movdqa xmm4,xmm0 + pmaddwd xmm2,[PW_MF060_MF089] ; xmm2=tmp0L + pmaddwd xmm0,[PW_MF060_MF089] ; xmm0=tmp0H + pmaddwd xmm3,[PW_MF089_F060] ; xmm3=tmp3L + pmaddwd xmm4,[PW_MF089_F060] ; xmm4=tmp3H + + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L + paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H + paddd xmm3,xmm5 ; xmm3=tmp3L + paddd xmm4,xmm7 ; xmm4=tmp3H + + movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H + + movdqa xmm2,xmm1 + movdqa xmm0,xmm1 + punpcklwd xmm2,xmm6 + punpckhwd xmm0,xmm6 + movdqa xmm1,xmm2 + movdqa xmm6,xmm0 + pmaddwd xmm2,[PW_MF050_MF256] ; xmm2=tmp1L + pmaddwd xmm0,[PW_MF050_MF256] ; xmm0=tmp1H + pmaddwd xmm1,[PW_MF256_F050] ; xmm1=tmp2L + pmaddwd xmm6,[PW_MF256_F050] ; xmm6=tmp2H + + paddd xmm2,xmm5 ; xmm2=tmp1L + paddd xmm0,xmm7 ; xmm0=tmp1H + paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H + + movdqa xmm2,xmm5 + movdqa xmm0,xmm7 + paddd xmm5,xmm3 ; xmm5=data0L + paddd xmm7,xmm4 ; xmm7=data0H + psubd xmm2,xmm3 ; xmm2=data7L + psubd xmm0,xmm4 ; xmm0=data7H + + movdqa xmm3,[PD_DESCALE_P1] ; xmm3=[PD_DESCALE_P1] + + paddd xmm5,xmm3 + paddd xmm7,xmm3 + psrad xmm5,DESCALE_P1 + psrad xmm7,DESCALE_P1 + paddd xmm2,xmm3 + paddd xmm0,xmm3 + psrad xmm2,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) + packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) + + movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L + movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H + + movdqa xmm7,xmm4 + movdqa xmm0,xmm3 + paddd xmm4,xmm1 ; xmm4=data1L + paddd xmm3,xmm6 ; xmm3=data1H + psubd xmm7,xmm1 ; xmm7=data6L + psubd xmm0,xmm6 ; xmm0=data6H + + movdqa xmm1,[PD_DESCALE_P1] ; xmm1=[PD_DESCALE_P1] + + paddd xmm4,xmm1 + paddd xmm3,xmm1 + psrad xmm4,DESCALE_P1 + psrad xmm3,DESCALE_P1 + paddd xmm7,xmm1 + paddd xmm0,xmm1 + psrad xmm7,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) + + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) + punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) + + movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L + movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H + movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L + movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) + + movdqa xmm5,xmm3 + movdqa xmm6,xmm0 + paddd xmm3,xmm4 ; xmm3=data2L + paddd xmm0,xmm2 ; xmm0=data2H + psubd xmm5,xmm4 ; xmm5=data5L + psubd xmm6,xmm2 ; xmm6=data5H + + movdqa xmm7,[PD_DESCALE_P1] ; xmm7=[PD_DESCALE_P1] + + paddd xmm3,xmm7 + paddd xmm0,xmm7 + psrad xmm3,DESCALE_P1 + psrad xmm0,DESCALE_P1 + paddd xmm5,xmm7 + paddd xmm6,xmm7 + psrad xmm5,DESCALE_P1 + psrad xmm6,DESCALE_P1 + + packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) + packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) + + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L + movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H + movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L + movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H + + movdqa xmm0,xmm1 + movdqa xmm6,xmm4 + paddd xmm1,xmm2 ; xmm1=data3L + paddd xmm4,xmm7 ; xmm4=data3H + psubd xmm0,xmm2 ; xmm0=data4L + psubd xmm6,xmm7 ; xmm6=data4H + + movdqa xmm2,[PD_DESCALE_P1] ; xmm2=[PD_DESCALE_P1] + + paddd xmm1,xmm2 + paddd xmm4,xmm2 + psrad xmm1,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm0,xmm2 + paddd xmm6,xmm2 + psrad xmm0,DESCALE_P1 + psrad xmm6,DESCALE_P1 + + packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) + packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) + movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) + + movdqa xmm4,xmm3 ; transpose coefficients(phase 1) + punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) + punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) + + movdqa xmm1,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) + punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) + punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) + movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) + + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) + + movdqa xmm2,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) + punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) + punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) + + movdqa xmm3,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) + + movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 + + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) + movdqa xmm4,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows from work array, store into output array. + + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + + ; -- Even part + + ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 + + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + + movdqa xmm6,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm6,xmm2 ; xmm2=in6=z3 + punpckhwd xmm5,xmm2 + movdqa xmm1,xmm6 + movdqa xmm2,xmm5 + pmaddwd xmm6,[PW_F130_F054] ; xmm6=tmp3L + pmaddwd xmm5,[PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm2,[PW_F054_MF130] ; xmm2=tmp2H + + movdqa xmm3,xmm7 + paddw xmm7,xmm0 ; xmm7=in0+in4 + psubw xmm3,xmm0 ; xmm3=in0-in4 + + pxor xmm4,xmm4 + pxor xmm0,xmm0 + punpcklwd xmm4,xmm7 ; xmm4=tmp0L + punpckhwd xmm0,xmm7 ; xmm0=tmp0H + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS + + movdqa xmm7,xmm4 + paddd xmm4,xmm6 ; xmm4=tmp10L + psubd xmm7,xmm6 ; xmm7=tmp13L + movdqa xmm6,xmm0 + paddd xmm0,xmm5 ; xmm0=tmp10H + psubd xmm6,xmm5 ; xmm6=tmp13H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H + + pxor xmm5,xmm5 + pxor xmm4,xmm4 + punpcklwd xmm5,xmm3 ; xmm5=tmp1L + punpckhwd xmm4,xmm3 ; xmm4=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + + movdqa xmm0,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm0,xmm1 ; xmm0=tmp12L + movdqa xmm7,xmm4 + paddd xmm4,xmm2 ; xmm4=tmp11H + psubd xmm7,xmm2 ; xmm7=tmp12H + + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H + + ; -- Odd part + + movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 + movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 + movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 + movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 + + movdqa xmm5,xmm6 + movdqa xmm4,xmm3 + paddw xmm5,xmm1 ; xmm5=z3 + paddw xmm4,xmm2 ; xmm4=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm0,xmm5 + movdqa xmm7,xmm5 + punpcklwd xmm0,xmm4 + punpckhwd xmm7,xmm4 + movdqa xmm5,xmm0 + movdqa xmm4,xmm7 + pmaddwd xmm0,[PW_MF078_F117] ; xmm0=z3L + pmaddwd xmm7,[PW_MF078_F117] ; xmm7=z3H + pmaddwd xmm5,[PW_F117_F078] ; xmm5=z4L + pmaddwd xmm4,[PW_F117_F078] ; xmm4=z4H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H + + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; + + movdqa xmm0,xmm1 + movdqa xmm7,xmm1 + punpcklwd xmm0,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm1,xmm0 + movdqa xmm3,xmm7 + pmaddwd xmm0,[PW_MF060_MF089] ; xmm0=tmp0L + pmaddwd xmm7,[PW_MF060_MF089] ; xmm7=tmp0H + pmaddwd xmm1,[PW_MF089_F060] ; xmm1=tmp3L + pmaddwd xmm3,[PW_MF089_F060] ; xmm3=tmp3H + + paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L + paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H + paddd xmm1,xmm5 ; xmm1=tmp3L + paddd xmm3,xmm4 ; xmm3=tmp3H + + movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H + + movdqa xmm0,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm0,xmm6 + punpckhwd xmm7,xmm6 + movdqa xmm2,xmm0 + movdqa xmm6,xmm7 + pmaddwd xmm0,[PW_MF050_MF256] ; xmm0=tmp1L + pmaddwd xmm7,[PW_MF050_MF256] ; xmm7=tmp1H + pmaddwd xmm2,[PW_MF256_F050] ; xmm2=tmp2L + pmaddwd xmm6,[PW_MF256_F050] ; xmm6=tmp2H + + paddd xmm0,xmm5 ; xmm0=tmp1L + paddd xmm7,xmm4 ; xmm7=tmp1H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H + + ; -- Final output stage + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H + + movdqa xmm0,xmm5 + movdqa xmm7,xmm4 + paddd xmm5,xmm1 ; xmm5=data0L + paddd xmm4,xmm3 ; xmm4=data0H + psubd xmm0,xmm1 ; xmm0=data7L + psubd xmm7,xmm3 ; xmm7=data7H + + movdqa xmm1,[PD_DESCALE_P2] ; xmm1=[PD_DESCALE_P2] + + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrad xmm5,DESCALE_P2 + psrad xmm4,DESCALE_P2 + paddd xmm0,xmm1 + paddd xmm7,xmm1 + psrad xmm0,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) + packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) + + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L + movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H + + movdqa xmm4,xmm3 + movdqa xmm7,xmm1 + paddd xmm3,xmm2 ; xmm3=data1L + paddd xmm1,xmm6 ; xmm1=data1H + psubd xmm4,xmm2 ; xmm4=data6L + psubd xmm7,xmm6 ; xmm7=data6H + + movdqa xmm2,[PD_DESCALE_P2] ; xmm2=[PD_DESCALE_P2] + + paddd xmm3,xmm2 + paddd xmm1,xmm2 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm4,xmm2 + paddd xmm7,xmm2 + psrad xmm4,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) + packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) + + packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H + movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L + movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H + + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + movdqa xmm4,xmm6 + movdqa xmm0,xmm2 + paddd xmm6,xmm1 ; xmm6=data2L + paddd xmm2,xmm7 ; xmm2=data2H + psubd xmm4,xmm1 ; xmm4=data5L + psubd xmm0,xmm7 ; xmm0=data5H + + movdqa xmm5,[PD_DESCALE_P2] ; xmm5=[PD_DESCALE_P2] + + paddd xmm6,xmm5 + paddd xmm2,xmm5 + psrad xmm6,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm4,xmm5 + paddd xmm0,xmm5 + psrad xmm4,DESCALE_P2 + psrad xmm0,DESCALE_P2 + + packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) + packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) + + movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L + movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H + movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L + movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H + + movdqa xmm2,xmm3 + movdqa xmm0,xmm1 + paddd xmm3,xmm7 ; xmm3=data3L + paddd xmm1,xmm5 ; xmm1=data3H + psubd xmm2,xmm7 ; xmm2=data4L + psubd xmm0,xmm5 ; xmm0=data4H + + movdqa xmm7,[PD_DESCALE_P2] ; xmm7=[PD_DESCALE_P2] + + paddd xmm3,xmm7 + paddd xmm1,xmm7 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm2,xmm7 + paddd xmm0,xmm7 + psrad xmm2,DESCALE_P2 + psrad xmm0,DESCALE_P2 + + movdqa xmm5,[PB_CENTERJSAMP] ; xmm5=[PB_CENTERJSAMP] + + packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) + packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + + packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + + paddb xmm7,xmm5 + paddb xmm1,xmm5 + paddb xmm6,xmm5 + paddb xmm3,xmm5 + + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + + movdqa xmm4,xmm7 ; transpose coefficients(phase 2) + punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm3,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + + pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm7 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm1 + mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 + mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm5 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret diff --git a/simd/jiss2red-64.asm b/simd/jiss2red-64.asm new file mode 100644 index 00000000..381180c7 --- /dev/null +++ b/simd/jiss2red-64.asm @@ -0,0 +1,571 @@ +; +; jiss2red.asm - reduced-size IDCT (64-bit SSE2) +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; This file contains inverse-DCT routines that produce reduced-size +; output: either 4x4 or 2x2 pixels from an 8x8 DCT block. +; The following code is based directly on the IJG's original jidctred.c; +; see the jidctred.c for more details. +; +; [TAB8] + +%include "jsimdext.inc" +%include "jdct.inc" + +; -------------------------------------------------------------------------- + +%define CONST_BITS 13 +%define PASS1_BITS 2 + +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) + +%if CONST_BITS == 13 +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) +%else +; NASM cannot do compile-time arithmetic on floating-point constants. +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +%endif + +; -------------------------------------------------------------------------- + SECTION SEG_CONST + + alignz 16 + global EXTN(jconst_idct_red_sse2) + +EXTN(jconst_idct_red_sse2): + +PW_F184_MF076 times 4 dw F_1_847,-F_0_765 +PW_F256_F089 times 4 dw F_2_562, F_0_899 +PW_F106_MF217 times 4 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 4 dw F_1_451,-F_0_211 +PW_F362_MF127 times 4 dw F_3_624,-F_1_272 +PW_F085_MF072 times 4 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE + + alignz 16 + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 4x4 output block. +; +; GLOBAL(void) +; jsimd_idct_4x4_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +; r10 = void * dct_table +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13 = JDIMENSION output_col + +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + + align 16 + global EXTN(jsimd_idct_4x4_sse2) + +EXTN(jsimd_idct_4x4_sse2): + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],eax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + +%ifndef NO_ZERO_COLUMN_TEST_4X4_SSE2 + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz short .columnDCT + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm0,xmm1 + packsswb xmm0,xmm0 + packsswb xmm0,xmm0 + movd eax,xmm0 + test rax,rax + jnz short .columnDCT + + ; -- AC terms all zero + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + psllw xmm0,PASS1_BITS + + movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) + + pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) + pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) + pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) + pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) + + jmp near .column_end +%endif +.columnDCT: + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + movdqa xmm4,xmm0 + movdqa xmm5,xmm0 + punpcklwd xmm4,xmm1 + punpckhwd xmm5,xmm1 + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + pmaddwd xmm4,[PW_F256_F089] ; xmm4=(tmp2L) + pmaddwd xmm5,[PW_F256_F089] ; xmm5=(tmp2H) + pmaddwd xmm0,[PW_F106_MF217] ; xmm0=(tmp0L) + pmaddwd xmm1,[PW_F106_MF217] ; xmm1=(tmp0H) + + movdqa xmm6,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm6,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + pmaddwd xmm6,[PW_MF060_MF050] ; xmm6=(tmp2L) + pmaddwd xmm7,[PW_MF060_MF050] ; xmm7=(tmp2H) + pmaddwd xmm2,[PW_F145_MF021] ; xmm2=(tmp0L) + pmaddwd xmm3,[PW_F145_MF021] ; xmm3=(tmp0H) + + paddd xmm6,xmm4 ; xmm6=tmp2L + paddd xmm7,xmm5 ; xmm7=tmp2H + paddd xmm2,xmm0 ; xmm2=tmp0L + paddd xmm3,xmm1 ; xmm3=tmp0H + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H + + ; -- Even part + + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm5, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movdqa xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm5, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm0, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + pxor xmm1,xmm1 + pxor xmm2,xmm2 + punpcklwd xmm1,xmm4 ; xmm1=tmp0L + punpckhwd xmm2,xmm4 ; xmm2=tmp0H + psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 + psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 + + movdqa xmm3,xmm5 ; xmm5=in2=z2 + punpcklwd xmm5,xmm0 ; xmm0=in6=z3 + punpckhwd xmm3,xmm0 + pmaddwd xmm5,[PW_F184_MF076] ; xmm5=tmp2L + pmaddwd xmm3,[PW_F184_MF076] ; xmm3=tmp2H + + movdqa xmm4,xmm1 + movdqa xmm0,xmm2 + paddd xmm1,xmm5 ; xmm1=tmp10L + paddd xmm2,xmm3 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp12L + psubd xmm0,xmm3 ; xmm0=tmp12H + + ; -- Final output stage + + movdqa xmm5,xmm1 + movdqa xmm3,xmm2 + paddd xmm1,xmm6 ; xmm1=data0L + paddd xmm2,xmm7 ; xmm2=data0H + psubd xmm5,xmm6 ; xmm5=data3L + psubd xmm3,xmm7 ; xmm3=data3H + + movdqa xmm6,[PD_DESCALE_P1_4] ; xmm6=[PD_DESCALE_P1_4] + + paddd xmm1,xmm6 + paddd xmm2,xmm6 + psrad xmm1,DESCALE_P1_4 + psrad xmm2,DESCALE_P1_4 + paddd xmm5,xmm6 + paddd xmm3,xmm6 + psrad xmm5,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 + + packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) + packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H + + movdqa xmm2,xmm4 + movdqa xmm3,xmm0 + paddd xmm4,xmm7 ; xmm4=data1L + paddd xmm0,xmm6 ; xmm0=data1H + psubd xmm2,xmm7 ; xmm2=data2L + psubd xmm3,xmm6 ; xmm3=data2H + + movdqa xmm7,[PD_DESCALE_P1_4] ; xmm7=[PD_DESCALE_P1_4] + + paddd xmm4,xmm7 + paddd xmm0,xmm7 + psrad xmm4,DESCALE_P1_4 + psrad xmm0,DESCALE_P1_4 + paddd xmm2,xmm7 + paddd xmm3,xmm7 + psrad xmm2,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 + + packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) + + movdqa xmm6,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm7,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) + + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) + punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) + movdqa xmm3,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) + punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) +.column_end: + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows, store into output array. + + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + + ; -- Even part + + pxor xmm4,xmm4 + punpcklwd xmm4,xmm1 ; xmm4=tmp0 + psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 + + ; -- Odd part + + punpckhwd xmm1,xmm0 + punpckhwd xmm6,xmm3 + movdqa xmm5,xmm1 + movdqa xmm2,xmm6 + pmaddwd xmm1,[PW_F256_F089] ; xmm1=(tmp2) + pmaddwd xmm6,[PW_MF060_MF050] ; xmm6=(tmp2) + pmaddwd xmm5,[PW_F106_MF217] ; xmm5=(tmp0) + pmaddwd xmm2,[PW_F145_MF021] ; xmm2=(tmp0) + + paddd xmm6,xmm1 ; xmm6=tmp2 + paddd xmm2,xmm5 ; xmm2=tmp0 + + ; -- Even part + + punpcklwd xmm0,xmm3 + pmaddwd xmm0,[PW_F184_MF076] ; xmm0=tmp2 + + movdqa xmm7,xmm4 + paddd xmm4,xmm0 ; xmm4=tmp10 + psubd xmm7,xmm0 ; xmm7=tmp12 + + ; -- Final output stage + + movdqa xmm1,[PD_DESCALE_P2_4] ; xmm1=[PD_DESCALE_P2_4] + + movdqa xmm5,xmm4 + movdqa xmm3,xmm7 + paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) + paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) + psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) + psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + + paddd xmm4,xmm1 + paddd xmm7,xmm1 + psrad xmm4,DESCALE_P2_4 + psrad xmm7,DESCALE_P2_4 + paddd xmm5,xmm1 + paddd xmm3,xmm1 + psrad xmm5,DESCALE_P2_4 + psrad xmm3,DESCALE_P2_4 + + packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) + packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) + + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) + punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) + + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) + punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) + + packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) + paddb xmm4,[PB_CENTERJSAMP] + + pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) + pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) + pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) + + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 + mov rdx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 + movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + + +; -------------------------------------------------------------------------- +; +; Perform dequantization and inverse DCT on one block of coefficients, +; producing a reduced-size 2x2 output block. +; +; GLOBAL(void) +; jsimd_idct_2x2_sse2 (void * dct_table, JCOEFPTR coef_block, +; JSAMPARRAY output_buf, JDIMENSION output_col) +; + +; r10 = void * dct_table +; r11 = JCOEFPTR coef_block +; r12 = JSAMPARRAY output_buf +; r13 = JDIMENSION output_col + + align 16 + global EXTN(jsimd_idct_2x2_sse2) + +EXTN(jsimd_idct_2x2_sse2): + push rbp + mov rbp,rsp + push rbx + collect_args + + ; ---- Pass 1: process columns from input. + + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | + + ; -- Odd part + + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) + ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) + + pcmpeqd xmm7,xmm7 + pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} + + movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) + movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) + punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) + punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) + pmaddwd xmm4,[PW_F362_MF127] + pmaddwd xmm5,[PW_F085_MF072] + + psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) + pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) + psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) + pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) + por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) + por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) + pmaddwd xmm0,[PW_F362_MF127] + pmaddwd xmm2,[PW_F085_MF072] + + paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] + paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] + + ; -- Even part + + movdqa xmm6, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + + ; xmm6=(00 01 ** 03 ** 05 ** 07) + + movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) + pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) + pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) + psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] + psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] + + ; -- Final output stage + + movdqa xmm3,xmm6 + movdqa xmm5,xmm1 + paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) + paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) + psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) + psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) + + movdqa xmm2,[PD_DESCALE_P1_2] ; xmm2=[PD_DESCALE_P1_2] + + punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) + + movdqa xmm7,xmm1 + punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) + punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) + + paddd xmm6,xmm2 + psrad xmm6,DESCALE_P1_2 + + paddd xmm1,xmm2 + paddd xmm7,xmm2 + psrad xmm1,DESCALE_P1_2 + psrad xmm7,DESCALE_P1_2 + + ; -- Prefetch the next coefficient block + + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + + ; ---- Pass 2: process rows, store into output array. + + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | + + ; -- Odd part + + packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) + packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) + pmaddwd xmm1,[PW_F362_MF127] + pmaddwd xmm7,[PW_F085_MF072] + + paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] + + ; -- Even part + + pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] + + ; -- Final output stage + + movdqa xmm4,xmm6 + paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) + psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) + + punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) + + paddd xmm6,[PD_DESCALE_P2_2] + psrad xmm6,DESCALE_P2_2 + + packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) + packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) + paddb xmm6,[PB_CENTERJSAMP] + + pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) + pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) + + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov WORD [rdx+rax*SIZEOF_JSAMPLE], bx + mov WORD [rsi+rax*SIZEOF_JSAMPLE], cx + + uncollect_args + pop rbx + pop rbp + ret diff --git a/simd/jsimdcpu-64.asm b/simd/jsimdcpu-64.asm new file mode 100644 index 00000000..6eaf629c --- /dev/null +++ b/simd/jsimdcpu-64.asm @@ -0,0 +1,95 @@ +; +; jsimdcpu.asm - SIMD instruction support check +; +; Copyright 2009 Pierre Ossman for Cendio AB +; Copyright 2009 D. R. Commander +; +; Based on +; x86 SIMD extension for IJG JPEG library +; Copyright (C) 1999-2006, MIYASAKA Masaru. +; For conditions of distribution and use, see copyright notice in jsimdext.inc +; +; This file should be assembled with NASM (Netwide Assembler), +; can *not* be assembled with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). +; NASM is available from http://nasm.sourceforge.net/ or +; http://sourceforge.net/project/showfiles.php?group_id=6208 +; +; [TAB8] + +%include "jsimdext.inc" + +; -------------------------------------------------------------------------- + SECTION SEG_TEXT + BITS 64 +; +; Check if the CPU supports SIMD instructions +; +; GLOBAL(unsigned int) +; jpeg_simd_cpu_support (void) +; + + align 16 + global EXTN(jpeg_simd_cpu_support) + +EXTN(jpeg_simd_cpu_support): + push rbx + + xor rdi,rdi ; simd support flag + + pushfq + pop rax + mov rdx,rax + xor rax, 1<<21 ; flip ID bit in EFLAGS + push rax + popfq + pushfq + pop rax + xor rax,rdx + jz short .return ; CPUID is not supported + + ; Check for MMX instruction support + xor rax,rax + cpuid + test rax,rax + jz short .return + + xor rax,rax + inc rax + cpuid + mov rax,rdx ; rax = Standard feature flags + + test rax, 1<<23 ; bit23:MMX + jz short .no_mmx + or rdi, byte JSIMD_MMX +.no_mmx: + test rax, 1<<25 ; bit25:SSE + jz short .no_sse + or rdi, byte JSIMD_SSE +.no_sse: + test rax, 1<<26 ; bit26:SSE2 + jz short .no_sse2 + or rdi, byte JSIMD_SSE2 +.no_sse2: + + ; Check for 3DNow! instruction support + mov eax, 0x80000000 + cpuid + cmp eax, 0x80000000 + jbe short .return + + mov rax, 0x80000001 + cpuid + mov rax,rdx ; eax = Extended feature flags + + test eax, 1<<31 ; bit31:3DNow!(vendor independent) + jz short .no_3dnow + or edi, byte JSIMD_3DNOW +.no_3dnow: + +.return: + mov rax,rdi + + pop rbx + ret + diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index d82b970e..878f0456 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -48,15 +48,20 @@ %define SEG_TEXT .text align=16 public use32 class=CODE %define SEG_CONST .data align=16 public use32 class=DATA -%elifdef ELF ; ----(nasm -felf -DELF ...)------------ +%elifdef ELF ; ----(nasm -felf[64] -DELF ...)------------ ; * Linux ; * *BSD family Unix using elf format ; * Unix System V, including Solaris x86, UnixWare and SCO Unix ; -- segment definition -- ; +%ifdef __x86_64__ +%define SEG_TEXT .text progbits align=16 +%define SEG_CONST .rodata progbits align=16 +%else %define SEG_TEXT .text progbits alloc exec nowrite align=16 %define SEG_CONST .rodata progbits alloc noexec nowrite align=16 +%endif ; To make the code position-independent, append -DPIC to the commandline ; @@ -103,9 +108,15 @@ ; -------------------------------------------------------------------------- ; Common types ; +%ifdef __x86_64__ +%define POINTER qword ; general pointer type +%define SIZEOF_POINTER SIZEOF_QWORD ; sizeof(POINTER) +%define POINTER_BIT QWORD_BIT ; sizeof(POINTER)*BYTE_BIT +%else %define POINTER dword ; general pointer type %define SIZEOF_POINTER SIZEOF_DWORD ; sizeof(POINTER) %define POINTER_BIT DWORD_BIT ; sizeof(POINTER)*BYTE_BIT +%endif %define INT dword ; signed integer type %define SIZEOF_INT SIZEOF_DWORD ; sizeof(INT) @@ -268,6 +279,32 @@ const_base: align %1, db 0 ; filling zeros %endmacro +%ifdef __x86_64__ +%imacro collect_args 0 + push r10 + push r11 + push r12 + push r13 + push r14 + push r15 + mov r10, rdi + mov r11, rsi + mov r12, rdx + mov r13, rcx + mov r14, r8 + mov r15, r9 +%endmacro + +%imacro uncollect_args 0 + pop r15 + pop r14 + pop r13 + pop r12 + pop r11 + pop r10 +%endmacro + +%endif ; -------------------------------------------------------------------------- ; Defines picked up from the C headers diff --git a/simd/nasm_lt.sh b/simd/nasm_lt.sh index ef5a591e..68893b70 100755 --- a/simd/nasm_lt.sh +++ b/simd/nasm_lt.sh @@ -11,7 +11,7 @@ while [ $# -gt 0 ]; do pic=yes fi ;; - -f|-fbin|-faout|-faoutb|-fcoff|-felf|-fas86| \ + -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \ -fobj|-fwin32|-frdf|-fieee|-fmacho) # it's a file format specifier for nasm. command="$command $1" From 88617301e9da8a00b4f2ffe009e90647e0c17582 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 26 Jun 2009 14:09:47 +0000 Subject: [PATCH 045/985] Improve the messages for the SIMD configuration test now that we support more than one arch. --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 3bcdf430..7d6f04e2 100644 --- a/configure.ac +++ b/configure.ac @@ -87,16 +87,16 @@ AC_ARG_WITH([simd], AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) if test "x${with_simd}" != "xno"; then # Check if we're on a supported CPU - AC_MSG_CHECKING([if host cpu type is i386 or compatible]) + AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) case "$host_cpu" in x86_64) - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes (x86_64)]) AC_PROG_NASM AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) AC_DEFINE([WITH_SIMD64], [1], [Use x86-64 accelerated SIMD routines.]) ;; i*86 | x86 | ia32) - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes (i386)]) AC_PROG_NASM AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) SIMDDIR=simd From c8eee1dffe9c033c3acb0ab13a7fc216a45b4f99 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 26 Jun 2009 14:10:33 +0000 Subject: [PATCH 046/985] Remove unused variable. --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7d6f04e2..a97a4e99 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,6 @@ if test "x${with_simd}" != "xno"; then AC_MSG_RESULT([yes (i386)]) AC_PROG_NASM AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) - SIMDDIR=simd ;; *) AC_MSG_RESULT([no ("$host_cpu")]) From 6212076d91c3fd3aeafd4b7540013b2a410a487e Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 29 Jun 2009 11:20:42 +0000 Subject: [PATCH 047/985] Clean up SIMD glue code The SIMD glue code has gotten a bit #ifdef heavy so clean it up by having one file for each possible SIMD arch. This also allows a simplification of the x86_64 code as SSE/SSE2 is always known to exist on that arch. --- Makefile.am | 7 +- configure.ac | 13 +- jsimd_none.c | 299 +++++++++++++++ simd/Makefile.am | 14 +- jsimd.c => simd/jsimd_i386.c | 246 ++----------- simd/jsimd_x86_64.c | 680 +++++++++++++++++++++++++++++++++++ simd/jsimdcpu-64.asm | 95 ----- 7 files changed, 1033 insertions(+), 321 deletions(-) create mode 100644 jsimd_none.c rename jsimd.c => simd/jsimd_i386.c (87%) create mode 100644 simd/jsimd_x86_64.c delete mode 100644 simd/jsimdcpu-64.asm diff --git a/Makefile.am b/Makefile.am index 57081f7e..0e7ae4d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,14 +10,17 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jddctmgr.c jdhuff.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 jmemnobs.c \ - jsimd.c + jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c if WITH_SIMD SUBDIRS = simd libjpeg_la_LIBADD = simd/libsimd.la +else + +libjpeg_la_SOURCES += jsimd_none.c + endif TSTHDRS = turbojpeg.h rrutil.h rrtimer.h diff --git a/configure.ac b/configure.ac index a97a4e99..0b371329 100644 --- a/configure.ac +++ b/configure.ac @@ -92,22 +92,27 @@ if test "x${with_simd}" != "xno"; then x86_64) AC_MSG_RESULT([yes (x86_64)]) AC_PROG_NASM - AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) - AC_DEFINE([WITH_SIMD64], [1], [Use x86-64 accelerated SIMD routines.]) + simd_arch=x86_64 ;; i*86 | x86 | ia32) AC_MSG_RESULT([yes (i386)]) AC_PROG_NASM - AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + simd_arch=i386 ;; *) AC_MSG_RESULT([no ("$host_cpu")]) with_simd=no ;; esac + + if test "x${with_simd}" != "xno"; then + AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + fi fi -AM_CONDITIONAL([WITH_SIMD64], [test "x$with_simd64" != "xno"]) + AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) +AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) +AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our diff --git a/jsimd_none.c b/jsimd_none.c new file mode 100644 index 00000000..89608025 --- /dev/null +++ b/jsimd_none.c @@ -0,0 +1,299 @@ +/* + * jsimd_none.c + * + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright 2009 D. R. Commander + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + * This file contains stubs for when there is no SIMD support available. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jsimd.h" +#include "jdct.h" +#include "jsimddct.h" + +GLOBAL(int) +jsimd_can_rgb_ycc (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_ycc_rgb (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_rgb_ycc_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ +} + +GLOBAL(void) +jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_downsample (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_downsample (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ +} + +GLOBAL(void) +jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_upsample (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_upsample (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_h2v2_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(void) +jsimd_h2v1_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_fancy_upsample (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_fancy_upsample (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(void) +jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ +} + +GLOBAL(int) +jsimd_can_h2v2_merged_upsample (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_h2v1_merged_upsample (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ +} + +GLOBAL(void) +jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ +} + +GLOBAL(int) +jsimd_can_convsamp (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_convsamp_float (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM * workspace) +{ +} + +GLOBAL(void) +jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT * workspace) +{ +} + +GLOBAL(int) +jsimd_can_fdct_islow (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_ifast (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_fdct_float (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_fdct_islow (DCTELEM * data) +{ +} + +GLOBAL(void) +jsimd_fdct_ifast (DCTELEM * data) +{ +} + +GLOBAL(void) +jsimd_fdct_float (FAST_FLOAT * data) +{ +} + +GLOBAL(int) +jsimd_can_quantize (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_quantize_float (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace) +{ +} + +GLOBAL(void) +jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, + FAST_FLOAT * workspace) +{ +} + +GLOBAL(int) +jsimd_can_idct_2x2 (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_idct_4x4 (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(int) +jsimd_can_idct_islow (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_idct_ifast (void) +{ + return 0; +} + +GLOBAL(int) +jsimd_can_idct_float (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + +GLOBAL(void) +jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ +} + diff --git a/simd/Makefile.am b/simd/Makefile.am index da7d6842..8e7469fa 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -4,11 +4,12 @@ BUILT_SOURCES = jsimdcfg.inc EXTRA_DIST = nasm_lt.sh -if WITH_SIMD64 +if SIMD_X86_64 -libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ +libsimd_la_SOURCES = jsimd_x86_64.c \ + jsimd.h jsimdcfg.inc.h \ jsimdext.inc jcolsamp.inc jdct.inc \ - jsimdcpu-64.asm jfsseflt-64.asm \ + jfsseflt-64.asm \ jccolss2-64.asm jdcolss2-64.asm \ jcsamss2-64.asm jdsamss2-64.asm jdmerss2-64.asm \ jcqnts2i-64.asm jfss2fst-64.asm jfss2int-64.asm \ @@ -19,9 +20,12 @@ jccolss2-64.lo: jcclrss2-64.asm jdcolss2-64.lo: jdclrss2-64.asm jdmerss2-64.lo: jdmrgss2-64.asm -else +endif -libsimd_la_SOURCES = jsimd.h jsimdcfg.inc.h \ +if SIMD_I386 + +libsimd_la_SOURCES = jsimd_i386.c \ + jsimd.h jsimdcfg.inc.h \ jsimdext.inc jcolsamp.inc jdct.inc \ jsimdcpu.asm \ jccolmmx.asm jdcolmmx.asm \ diff --git a/jsimd.c b/simd/jsimd_i386.c similarity index 87% rename from jsimd.c rename to simd/jsimd_i386.c index 20e83fc5..751fe2de 100644 --- a/jsimd.c +++ b/simd/jsimd_i386.c @@ -1,5 +1,5 @@ /* - * jsimd.c + * jsimd_i386.c * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2009 D. R. Commander @@ -8,26 +8,23 @@ * Copyright (C) 1999-2006, MIYASAKA Masaru. * * This file contains the interface between the "normal" portions - * of the library and the SIMD implementations. + * of the library and the SIMD implementations when running on a + * 32-bit x86 architecture. */ #define JPEG_INTERNALS -#include "jinclude.h" -#include "jpeglib.h" -#include "jsimd.h" -#include "jdct.h" -#include "jsimddct.h" +#include "../jinclude.h" +#include "../jpeglib.h" +#include "../jsimd.h" +#include "../jdct.h" +#include "../jsimddct.h" #include "simd/jsimd.h" /* * In the PIC cases, we have no guarantee that constants will keep * their alignment. This macro allows us to verify it at runtime. */ -#ifdef WITH_SIMD #define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0) -#else -#define IS_ALIGNED(ptr, order) (0) -#endif #define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ @@ -41,23 +38,26 @@ static unsigned int simd_support = ~0; LOCAL(void) init_simd (void) { -#ifdef WITH_SIMD char *env = NULL; -#endif + if (simd_support != ~0) return; -#ifdef WITH_SIMD simd_support = jpeg_simd_cpu_support(); - #ifndef __x86_64__ - if((env=getenv("JSIMD_FORCEMMX"))!=NULL && !strcmp(env, "1")) - simd_support = JSIMD_MMX; - else if((env=getenv("JSIMD_FORCESSE2"))!=NULL && !strcmp(env, "1")) - simd_support = JSIMD_SSE2; - #endif -#else - simd_support = JSIMD_NONE; -#endif + + /* Force different settings through environment variables */ + env = getenv("JSIMD_FORCEMMX"); + if ((env != NULL) && (strcmp(env, "1") == 0)) + simd_support &= JSIMD_MMX; + env = getenv("JSIMD_FORCE3DNOW"); + if ((env != NULL) && (strcmp(env, "1") == 0)) + simd_support &= JSIMD_3DNOW; + env = getenv("JSIMD_FORCESSE"); + if ((env != NULL) && (strcmp(env, "1") == 0)) + simd_support &= JSIMD_SSE; + env = getenv("JSIMD_FORCESSE2"); + if ((env != NULL) && (strcmp(env, "1") == 0)) + simd_support &= JSIMD_SSE2; } GLOBAL(int) @@ -109,66 +109,48 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows) { -#ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - #endif + switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extrgb_ycc_convert_mmx; - #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_extrgbx_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extrgbx_ycc_convert_mmx; - #endif break; case JCS_EXT_BGR: sse2fct=jsimd_extbgr_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extbgr_ycc_convert_mmx; - #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_extbgrx_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extbgrx_ycc_convert_mmx; - #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_extxbgr_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extxbgr_ycc_convert_mmx; - #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_extxrgb_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_extxrgb_ycc_convert_mmx; - #endif break; default: sse2fct=jsimd_rgb_ycc_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_rgb_ycc_convert_mmx; - #endif break; } + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); - #endif -#endif } GLOBAL(void) @@ -176,66 +158,48 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { -#ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - #endif + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_ycc_extrgb_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extrgb_convert_mmx; - #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_ycc_extrgbx_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extrgbx_convert_mmx; - #endif break; case JCS_EXT_BGR: sse2fct=jsimd_ycc_extbgr_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extbgr_convert_mmx; - #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_ycc_extbgrx_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extbgrx_convert_mmx; - #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_ycc_extxbgr_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extxbgr_convert_mmx; - #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_ycc_extxrgb_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_extxrgb_convert_mmx; - #endif break; default: sse2fct=jsimd_ycc_rgb_convert_sse2; - #ifndef __x86_64__ mmxfct=jsimd_ycc_rgb_convert_mmx; - #endif break; } + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); - #endif -#endif } GLOBAL(int) @@ -251,10 +215,8 @@ jsimd_can_h2v2_downsample (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -272,10 +234,8 @@ jsimd_can_h2v1_downsample (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -284,36 +244,28 @@ GLOBAL(void) jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); - #endif -#endif } GLOBAL(void) jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); - #endif -#endif } GLOBAL(int) @@ -329,10 +281,8 @@ jsimd_can_h2v2_upsample (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -350,10 +300,8 @@ jsimd_can_h2v1_upsample (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -364,16 +312,12 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); - #endif -#endif } GLOBAL(void) @@ -382,16 +326,12 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); - #endif -#endif } GLOBAL(int) @@ -408,10 +348,8 @@ jsimd_can_h2v2_fancy_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -430,10 +368,8 @@ jsimd_can_h2v1_fancy_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -444,17 +380,13 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { -#ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); - #endif -#endif } GLOBAL(void) @@ -463,17 +395,13 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { -#ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, compptr->downsampled_width, input_data, output_data_ptr); - #endif -#endif } GLOBAL(int) @@ -490,10 +418,8 @@ jsimd_can_h2v2_merged_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -512,10 +438,8 @@ jsimd_can_h2v1_merged_upsample (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -526,66 +450,48 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { -#ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - #endif + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx; - #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extrgbx_merged_upsample_mmx; - #endif break; case JCS_EXT_BGR: sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extbgr_merged_upsample_mmx; - #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extbgrx_merged_upsample_mmx; - #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extxbgr_merged_upsample_mmx; - #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_extxrgb_merged_upsample_mmx; - #endif break; default: sse2fct=jsimd_h2v2_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v2_merged_upsample_mmx; - #endif break; } + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); - #endif -#endif } GLOBAL(void) @@ -594,66 +500,48 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { -#ifdef WITH_SIMD void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - #ifndef __x86_64__ void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - #endif + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx; - #endif break; case JCS_EXT_RGBX: sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extrgbx_merged_upsample_mmx; - #endif break; case JCS_EXT_BGR: sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extbgr_merged_upsample_mmx; - #endif break; case JCS_EXT_BGRX: sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extbgrx_merged_upsample_mmx; - #endif break; case JCS_EXT_XBGR: sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extxbgr_merged_upsample_mmx; - #endif break; case JCS_EXT_XRGB: sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_extxrgb_merged_upsample_mmx; - #endif break; default: sse2fct=jsimd_h2v1_merged_upsample_sse2; - #ifndef __x86_64__ mmxfct=jsimd_h2v1_merged_upsample_mmx; - #endif break; } + if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); - #endif -#endif } GLOBAL(int) @@ -673,10 +561,8 @@ jsimd_can_convsamp (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -700,10 +586,8 @@ jsimd_can_convsamp_float (void) return 1; if (simd_support & JSIMD_SSE) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; - #endif return 0; } @@ -712,30 +596,22 @@ GLOBAL(void) jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_convsamp_sse2(sample_data, start_col, workspace); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_convsamp_mmx(sample_data, start_col, workspace); - #endif -#endif } GLOBAL(void) jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_convsamp_float_sse2(sample_data, start_col, workspace); - #ifndef __x86_64__ else if (simd_support & JSIMD_SSE) jsimd_convsamp_float_sse(sample_data, start_col, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_convsamp_float_3dnow(sample_data, start_col, workspace); - #endif -#endif } GLOBAL(int) @@ -751,10 +627,8 @@ jsimd_can_fdct_islow (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -772,10 +646,8 @@ jsimd_can_fdct_ifast (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -793,10 +665,8 @@ jsimd_can_fdct_float (void) if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; - #endif return 0; } @@ -804,40 +674,28 @@ jsimd_can_fdct_float (void) GLOBAL(void) jsimd_fdct_islow (DCTELEM * data) { -#ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) jsimd_fdct_islow_sse2(data); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_fdct_islow_mmx(data); - #endif -#endif } GLOBAL(void) jsimd_fdct_ifast (DCTELEM * data) { -#ifdef WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) jsimd_fdct_ifast_sse2(data); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_fdct_ifast_mmx(data); - #endif -#endif } GLOBAL(void) jsimd_fdct_float (FAST_FLOAT * data) { -#ifdef WITH_SIMD if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_fdct_float_sse)) jsimd_fdct_float_sse(data); - #ifndef __x86_64__ else if (simd_support & JSIMD_3DNOW) jsimd_fdct_float_3dnow(data); - #endif -#endif } GLOBAL(int) @@ -855,10 +713,8 @@ jsimd_can_quantize (void) if (simd_support & JSIMD_SSE2) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -880,10 +736,8 @@ jsimd_can_quantize_float (void) return 1; if (simd_support & JSIMD_SSE) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_3DNOW) return 1; - #endif return 0; } @@ -892,30 +746,22 @@ GLOBAL(void) jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_quantize_sse2(coef_block, divisors, workspace); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_quantize_mmx(coef_block, divisors, workspace); - #endif -#endif } GLOBAL(void) jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { -#ifdef WITH_SIMD if (simd_support & JSIMD_SSE2) jsimd_quantize_float_sse2(coef_block, divisors, workspace); - #ifndef __x86_64__ else if (simd_support & JSIMD_SSE) jsimd_quantize_float_sse(coef_block, divisors, workspace); else if (simd_support & JSIMD_3DNOW) jsimd_quantize_float_3dnow(coef_block, divisors, workspace); - #endif -#endif } GLOBAL(int) @@ -937,10 +783,8 @@ jsimd_can_idct_2x2 (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -964,10 +808,8 @@ jsimd_can_idct_4x4 (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -977,14 +819,10 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { -#if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); - #endif -#endif } GLOBAL(void) @@ -992,14 +830,10 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { -#if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); - #endif -#endif } GLOBAL(int) @@ -1021,10 +855,8 @@ jsimd_can_idct_islow (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -1050,10 +882,8 @@ jsimd_can_idct_ifast (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) return 1; - #ifndef __x86_64__ if (simd_support & JSIMD_MMX) return 1; - #endif return 0; } @@ -1078,12 +908,10 @@ jsimd_can_idct_float (void) if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) return 1; - #ifndef __x86_64__ if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) return 1; if (simd_support & JSIMD_3DNOW) return 1; - #endif return 0; } @@ -1093,14 +921,10 @@ jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { -#if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); - #endif -#endif } GLOBAL(void) @@ -1108,14 +932,10 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { -#if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); - #ifndef __x86_64__ else if (simd_support & JSIMD_MMX) jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); - #endif -#endif } GLOBAL(void) @@ -1123,18 +943,14 @@ jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { -#if WITH_SIMD if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf, output_col); - #ifndef __x86_64__ else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf, output_col); else if (simd_support & JSIMD_3DNOW) jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf, output_col); - #endif -#endif } diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c new file mode 100644 index 00000000..4c1ef7d1 --- /dev/null +++ b/simd/jsimd_x86_64.c @@ -0,0 +1,680 @@ +/* + * jsimd_x86_64.c + * + * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright 2009 D. R. Commander + * + * Based on the x86 SIMD extension for IJG JPEG library, + * Copyright (C) 1999-2006, MIYASAKA Masaru. + * + * This file contains the interface between the "normal" portions + * of the library and the SIMD implementations when running on a + * x86_64 architecture. + */ + +#define JPEG_INTERNALS +#include "../jinclude.h" +#include "../jpeglib.h" +#include "../jsimd.h" +#include "../jdct.h" +#include "../jsimddct.h" +#include "simd/jsimd.h" + +/* + * In the PIC cases, we have no guarantee that constants will keep + * their alignment. This macro allows us to verify it at runtime. + */ +#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0) + +#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ + +GLOBAL(int) +jsimd_can_rgb_ycc (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if (!IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_ycc_rgb (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) + return 0; + + if (!IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_rgb_ycc_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); + + switch(cinfo->in_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_extrgb_ycc_convert_sse2; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_extrgbx_ycc_convert_sse2; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_extbgr_ycc_convert_sse2; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_extbgrx_ycc_convert_sse2; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_extxbgr_ycc_convert_sse2; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_extxrgb_ycc_convert_sse2; + break; + default: + sse2fct=jsimd_rgb_ycc_convert_sse2; + break; + } + + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); +} + +GLOBAL(void) +jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); + + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_ycc_extrgb_convert_sse2; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_ycc_extrgbx_convert_sse2; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_ycc_extbgr_convert_sse2; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_ycc_extbgrx_convert_sse2; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_ycc_extxbgr_convert_sse2; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_ycc_extxrgb_convert_sse2; + break; + default: + sse2fct=jsimd_ycc_rgb_convert_sse2; + break; + } + + sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); +} + +GLOBAL(int) +jsimd_can_h2v2_downsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_h2v1_downsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + jsimd_h2v2_downsample_sse2(cinfo->image_width, + cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, + input_data, output_data); +} + +GLOBAL(void) +jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + jsimd_h2v1_downsample_sse2(cinfo->image_width, + cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, + input_data, output_data); +} + +GLOBAL(int) +jsimd_can_h2v2_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_h2v1_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_h2v2_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ + jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, + cinfo->output_width, + input_data, output_data_ptr); +} + +GLOBAL(void) +jsimd_h2v1_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ + jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, + cinfo->output_width, + input_data, output_data_ptr); +} + +GLOBAL(int) +jsimd_can_h2v2_fancy_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_h2v1_fancy_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ + jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, + input_data, output_data_ptr); +} + +GLOBAL(void) +jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr) +{ + jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, + compptr->downsampled_width, + input_data, output_data_ptr); +} + +GLOBAL(int) +jsimd_can_h2v2_merged_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_h2v1_merged_upsample (void) +{ + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_h2v2_extrgbx_merged_upsample_sse2; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_h2v2_extbgr_merged_upsample_sse2; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_h2v2_extbgrx_merged_upsample_sse2; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_h2v2_extxbgr_merged_upsample_sse2; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_h2v2_extxrgb_merged_upsample_sse2; + break; + default: + sse2fct=jsimd_h2v2_merged_upsample_sse2; + break; + } + + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); +} + +GLOBAL(void) +jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); + + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; + break; + case JCS_EXT_RGBX: + sse2fct=jsimd_h2v1_extrgbx_merged_upsample_sse2; + break; + case JCS_EXT_BGR: + sse2fct=jsimd_h2v1_extbgr_merged_upsample_sse2; + break; + case JCS_EXT_BGRX: + sse2fct=jsimd_h2v1_extbgrx_merged_upsample_sse2; + break; + case JCS_EXT_XBGR: + sse2fct=jsimd_h2v1_extxbgr_merged_upsample_sse2; + break; + case JCS_EXT_XRGB: + sse2fct=jsimd_h2v1_extxrgb_merged_upsample_sse2; + break; + default: + sse2fct=jsimd_h2v1_merged_upsample_sse2; + break; + } + + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); +} + +GLOBAL(int) +jsimd_can_convsamp (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_convsamp_float (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM * workspace) +{ + jsimd_convsamp_sse2(sample_data, start_col, workspace); +} + +GLOBAL(void) +jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, + FAST_FLOAT * workspace) +{ + jsimd_convsamp_float_sse2(sample_data, start_col, workspace); +} + +GLOBAL(int) +jsimd_can_fdct_islow (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_fdct_islow_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_fdct_ifast (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_fdct_ifast_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_fdct_float (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_fdct_float_sse)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_fdct_islow (DCTELEM * data) +{ + jsimd_fdct_islow_sse2(data); +} + +GLOBAL(void) +jsimd_fdct_ifast (DCTELEM * data) +{ + jsimd_fdct_ifast_sse2(data); +} + +GLOBAL(void) +jsimd_fdct_float (FAST_FLOAT * data) +{ + jsimd_fdct_float_sse(data); +} + +GLOBAL(int) +jsimd_can_quantize (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(DCTELEM) != 2) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_quantize_float (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace) +{ + jsimd_quantize_sse2(coef_block, divisors, workspace); +} + +GLOBAL(void) +jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, + FAST_FLOAT * workspace) +{ + jsimd_quantize_float_sse2(coef_block, divisors, workspace); +} + +GLOBAL(int) +jsimd_can_idct_2x2 (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_idct_4x4 (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_idct_red_sse2)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(void) +jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(int) +jsimd_can_idct_islow (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_idct_islow_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_idct_ifast (void) +{ + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(IFAST_MULT_TYPE) != 2) + return 0; + if (IFAST_SCALE_BITS != 2) + return 0; + + if (!IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) + return 0; + + return 1; +} + +GLOBAL(int) +jsimd_can_idct_float (void) +{ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(FAST_FLOAT) != 4) + return 0; + if (sizeof(FLOAT_MULT_TYPE) != 4) + return 0; + + if (!IS_ALIGNED_SSE(jconst_idct_float_sse2)) + return 0; + + return 1; +} + +GLOBAL(void) +jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(void) +jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); +} + +GLOBAL(void) +jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) +{ + jsimd_idct_float_sse2(compptr->dct_table, coef_block, + output_buf, output_col); +} + diff --git a/simd/jsimdcpu-64.asm b/simd/jsimdcpu-64.asm deleted file mode 100644 index 6eaf629c..00000000 --- a/simd/jsimdcpu-64.asm +++ /dev/null @@ -1,95 +0,0 @@ -; -; jsimdcpu.asm - SIMD instruction support check -; -; Copyright 2009 Pierre Ossman for Cendio AB -; Copyright 2009 D. R. Commander -; -; Based on -; x86 SIMD extension for IJG JPEG library -; Copyright (C) 1999-2006, MIYASAKA Masaru. -; For conditions of distribution and use, see copyright notice in jsimdext.inc -; -; This file should be assembled with NASM (Netwide Assembler), -; can *not* be assembled with Microsoft's MASM or any compatible -; assembler (including Borland's Turbo Assembler). -; NASM is available from http://nasm.sourceforge.net/ or -; http://sourceforge.net/project/showfiles.php?group_id=6208 -; -; [TAB8] - -%include "jsimdext.inc" - -; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 -; -; Check if the CPU supports SIMD instructions -; -; GLOBAL(unsigned int) -; jpeg_simd_cpu_support (void) -; - - align 16 - global EXTN(jpeg_simd_cpu_support) - -EXTN(jpeg_simd_cpu_support): - push rbx - - xor rdi,rdi ; simd support flag - - pushfq - pop rax - mov rdx,rax - xor rax, 1<<21 ; flip ID bit in EFLAGS - push rax - popfq - pushfq - pop rax - xor rax,rdx - jz short .return ; CPUID is not supported - - ; Check for MMX instruction support - xor rax,rax - cpuid - test rax,rax - jz short .return - - xor rax,rax - inc rax - cpuid - mov rax,rdx ; rax = Standard feature flags - - test rax, 1<<23 ; bit23:MMX - jz short .no_mmx - or rdi, byte JSIMD_MMX -.no_mmx: - test rax, 1<<25 ; bit25:SSE - jz short .no_sse - or rdi, byte JSIMD_SSE -.no_sse: - test rax, 1<<26 ; bit26:SSE2 - jz short .no_sse2 - or rdi, byte JSIMD_SSE2 -.no_sse2: - - ; Check for 3DNow! instruction support - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000000 - jbe short .return - - mov rax, 0x80000001 - cpuid - mov rax,rdx ; eax = Extended feature flags - - test eax, 1<<31 ; bit31:3DNow!(vendor independent) - jz short .no_3dnow - or edi, byte JSIMD_3DNOW -.no_3dnow: - -.return: - mov rax,rdi - - pop rbx - ret - From 769c80420bad98b4f84f13632d6bb5a98e698b50 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 29 Jun 2009 12:58:48 +0000 Subject: [PATCH 048/985] Make x86_64 SIMD code PIC friendly Use RIP relative addressing as that works in both PIC and non-PIC mode. --- simd/jcclrss2-64.asm | 44 ++++++++-------- simd/jdclrss2-64.asm | 32 ++++++------ simd/jdmrgss2-64.asm | 32 ++++++------ simd/jdsamss2-64.asm | 44 ++++++++-------- simd/jfss2fst-64.asm | 20 ++++---- simd/jfss2int-64.asm | 116 +++++++++++++++++++++---------------------- simd/jfsseflt-64.asm | 20 ++++---- simd/jiss2flt-64.asm | 26 +++++----- simd/jiss2fst-64.asm | 22 ++++---- simd/jiss2int-64.asm | 82 +++++++++++++++--------------- simd/jiss2red-64.asm | 56 ++++++++++----------- 11 files changed, 247 insertions(+), 247 deletions(-) diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm index 9900edd8..ca7e24af 100644 --- a/simd/jcclrss2-64.asm +++ b/simd/jcclrss2-64.asm @@ -302,10 +302,10 @@ EXTN(jsimd_rgb_ycc_convert_sse2): punpckhwd xmm6,xmm3 movdqa xmm7,xmm1 movdqa xmm4,xmm6 - pmaddwd xmm1,[PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd xmm7,[PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd xmm4,[PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[rel PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) @@ -317,7 +317,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm1,1 ; xmm1=BOL*FIX(0.500) psrld xmm6,1 ; xmm6=BOH*FIX(0.500) - movdqa xmm5,[PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] + movdqa xmm5,[rel PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] paddd xmm7,xmm1 paddd xmm4,xmm6 @@ -334,10 +334,10 @@ EXTN(jsimd_rgb_ycc_convert_sse2): punpckhwd xmm6,xmm2 movdqa xmm5,xmm0 movdqa xmm4,xmm6 - pmaddwd xmm0,[PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd xmm5,[PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd xmm4,[PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[rel PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) @@ -349,7 +349,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm0,1 ; xmm0=BEL*FIX(0.500) psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - movdqa xmm1,[PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] paddd xmm5,xmm0 paddd xmm4,xmm6 @@ -372,12 +372,12 @@ EXTN(jsimd_rgb_ycc_convert_sse2): punpckhwd xmm4,xmm3 movdqa xmm7,xmm0 movdqa xmm5,xmm4 - pmaddwd xmm0,[PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd xmm7,[PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd xmm5,[PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[rel PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - movdqa xmm3,[PD_ONEHALF] ; xmm3=[PD_ONEHALF] + movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] paddd xmm0, XMMWORD [wk(4)] paddd xmm4, XMMWORD [wk(5)] @@ -394,7 +394,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm3,1 ; xmm3=ROL*FIX(0.500) psrld xmm4,1 ; xmm4=ROH*FIX(0.500) - movdqa xmm1,[PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] paddd xmm7,xmm3 paddd xmm5,xmm4 @@ -411,12 +411,12 @@ EXTN(jsimd_rgb_ycc_convert_sse2): punpckhwd xmm4,xmm2 movdqa xmm1,xmm6 movdqa xmm5,xmm4 - pmaddwd xmm6,[PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd xmm1,[PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd xmm5,[PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[rel PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - movdqa xmm2,[PD_ONEHALF] ; xmm2=[PD_ONEHALF] + movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] paddd xmm6, XMMWORD [wk(6)] paddd xmm4, XMMWORD [wk(7)] @@ -437,7 +437,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm2,1 ; xmm2=REL*FIX(0.500) psrld xmm4,1 ; xmm4=REH*FIX(0.500) - movdqa xmm0,[PD_ONEHALFM1_CJ] ; xmm0=[PD_ONEHALFM1_CJ] + movdqa xmm0,[rel PD_ONEHALFM1_CJ] ; xmm0=[PD_ONEHALFM1_CJ] paddd xmm1,xmm2 paddd xmm5,xmm4 diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm index 0808ecaa..c3c1b07c 100644 --- a/simd/jdclrss2-64.asm +++ b/simd/jdclrss2-64.asm @@ -127,17 +127,17 @@ EXTN(jsimd_ycc_rgb_convert_sse2): paddw xmm0,xmm0 ; xmm0=2*CrE paddw xmm1,xmm1 ; xmm1=2*CrO - pmulhw xmm4,[PW_MF0228] ; xmm4=(2*CbE * -FIX(0.22800)) - pmulhw xmm5,[PW_MF0228] ; xmm5=(2*CbO * -FIX(0.22800)) - pmulhw xmm0,[PW_F0402] ; xmm0=(2*CrE * FIX(0.40200)) - pmulhw xmm1,[PW_F0402] ; xmm1=(2*CrO * FIX(0.40200)) + pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[rel PW_MF0228] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[rel PW_F0402] ; xmm1=(2*CrO * FIX(0.40200)) - paddw xmm4,[PW_ONE] - paddw xmm5,[PW_ONE] + paddw xmm4,[rel PW_ONE] + paddw xmm5,[rel PW_ONE] psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) - paddw xmm0,[PW_ONE] - paddw xmm1,[PW_ONE] + paddw xmm0,[rel PW_ONE] + paddw xmm1,[rel PW_ONE] psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) @@ -155,19 +155,19 @@ EXTN(jsimd_ycc_rgb_convert_sse2): movdqa xmm5,xmm3 punpcklwd xmm2,xmm6 punpckhwd xmm4,xmm6 - pmaddwd xmm2,[PW_MF0344_F0285] - pmaddwd xmm4,[PW_MF0344_F0285] + pmaddwd xmm2,[rel PW_MF0344_F0285] + pmaddwd xmm4,[rel PW_MF0344_F0285] punpcklwd xmm3,xmm7 punpckhwd xmm5,xmm7 - pmaddwd xmm3,[PW_MF0344_F0285] - pmaddwd xmm5,[PW_MF0344_F0285] + pmaddwd xmm3,[rel PW_MF0344_F0285] + pmaddwd xmm5,[rel PW_MF0344_F0285] - paddd xmm2,[PD_ONEHALF] - paddd xmm4,[PD_ONEHALF] + paddd xmm2,[rel PD_ONEHALF] + paddd xmm4,[rel PD_ONEHALF] psrad xmm2,SCALEBITS psrad xmm4,SCALEBITS - paddd xmm3,[PD_ONEHALF] - paddd xmm5,[PD_ONEHALF] + paddd xmm3,[rel PD_ONEHALF] + paddd xmm5,[rel PD_ONEHALF] psrad xmm3,SCALEBITS psrad xmm5,SCALEBITS diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm index 6474f43b..6329f950 100644 --- a/simd/jdmrgss2-64.asm +++ b/simd/jdmrgss2-64.asm @@ -113,17 +113,17 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): paddw xmm7,xmm7 ; xmm7=2*CrH paddw xmm0,xmm0 ; xmm0=2*CrL - pmulhw xmm6,[PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800)) - pmulhw xmm4,[PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800)) - pmulhw xmm7,[PW_F0402] ; xmm7=(2*CrH * FIX(0.40200)) - pmulhw xmm0,[PW_F0402] ; xmm0=(2*CrL * FIX(0.40200)) + pmulhw xmm6,[rel PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[rel PW_F0402] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrL * FIX(0.40200)) - paddw xmm6,[PW_ONE] - paddw xmm4,[PW_ONE] + paddw xmm6,[rel PW_ONE] + paddw xmm4,[rel PW_ONE] psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) - paddw xmm7,[PW_ONE] - paddw xmm0,[PW_ONE] + paddw xmm7,[rel PW_ONE] + paddw xmm0,[rel PW_ONE] psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) @@ -141,19 +141,19 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): movdqa xmm7,xmm2 punpcklwd xmm5,xmm1 punpckhwd xmm6,xmm1 - pmaddwd xmm5,[PW_MF0344_F0285] - pmaddwd xmm6,[PW_MF0344_F0285] + pmaddwd xmm5,[rel PW_MF0344_F0285] + pmaddwd xmm6,[rel PW_MF0344_F0285] punpcklwd xmm2,xmm3 punpckhwd xmm7,xmm3 - pmaddwd xmm2,[PW_MF0344_F0285] - pmaddwd xmm7,[PW_MF0344_F0285] + pmaddwd xmm2,[rel PW_MF0344_F0285] + pmaddwd xmm7,[rel PW_MF0344_F0285] - paddd xmm5,[PD_ONEHALF] - paddd xmm6,[PD_ONEHALF] + paddd xmm5,[rel PD_ONEHALF] + paddd xmm6,[rel PD_ONEHALF] psrad xmm5,SCALEBITS psrad xmm6,SCALEBITS - paddd xmm2,[PD_ONEHALF] - paddd xmm7,[PD_ONEHALF] + paddd xmm2,[rel PD_ONEHALF] + paddd xmm7,[rel PD_ONEHALF] psrad xmm2,SCALEBITS psrad xmm7,SCALEBITS diff --git a/simd/jdsamss2-64.asm b/simd/jdsamss2-64.asm index 1f7b1f59..7df283e8 100644 --- a/simd/jdsamss2-64.asm +++ b/simd/jdsamss2-64.asm @@ -133,12 +133,12 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2): punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) - pmullw xmm1,[PW_THREE] - pmullw xmm4,[PW_THREE] - paddw xmm2,[PW_ONE] - paddw xmm5,[PW_ONE] - paddw xmm3,[PW_TWO] - paddw xmm6,[PW_TWO] + pmullw xmm1,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] + paddw xmm2,[rel PW_ONE] + paddw xmm5,[rel PW_ONE] + paddw xmm3,[rel PW_TWO] + paddw xmm6,[rel PW_TWO] paddw xmm2,xmm1 paddw xmm5,xmm4 @@ -264,8 +264,8 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[PW_THREE] - pmullw xmm4,[PW_THREE] + pmullw xmm0,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] pcmpeqb xmm7,xmm7 psrldq xmm7,(SIZEOF_XMMWORD-2) @@ -324,8 +324,8 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[PW_THREE] - pmullw xmm4,[PW_THREE] + pmullw xmm0,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) @@ -373,12 +373,12 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): movdqa XMMWORD [wk(0)], xmm4 - pmullw xmm7,[PW_THREE] - pmullw xmm3,[PW_THREE] - paddw xmm1,[PW_EIGHT] - paddw xmm5,[PW_EIGHT] - paddw xmm0,[PW_SEVEN] - paddw xmm2,[PW_SEVEN] + pmullw xmm7,[rel PW_THREE] + pmullw xmm3,[rel PW_THREE] + paddw xmm1,[rel PW_EIGHT] + paddw xmm5,[rel PW_EIGHT] + paddw xmm0,[rel PW_SEVEN] + paddw xmm2,[rel PW_SEVEN] paddw xmm1,xmm7 paddw xmm5,xmm3 @@ -426,12 +426,12 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): movdqa XMMWORD [wk(1)], xmm3 - pmullw xmm6,[PW_THREE] - pmullw xmm4,[PW_THREE] - paddw xmm1,[PW_EIGHT] - paddw xmm0,[PW_EIGHT] - paddw xmm7,[PW_SEVEN] - paddw xmm5,[PW_SEVEN] + pmullw xmm6,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] + paddw xmm1,[rel PW_EIGHT] + paddw xmm0,[rel PW_EIGHT] + paddw xmm7,[rel PW_SEVEN] + paddw xmm5,[rel PW_SEVEN] paddw xmm1,xmm6 paddw xmm0,xmm4 diff --git a/simd/jfss2fst-64.asm b/simd/jfss2fst-64.asm index 93031565..b6a06bc1 100644 --- a/simd/jfss2fst-64.asm +++ b/simd/jfss2fst-64.asm @@ -192,7 +192,7 @@ EXTN(jsimd_fdct_ifast_sse2): paddw xmm6,xmm3 psllw xmm6,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm6,[PW_F0707] ; xmm6=z1 + pmulhw xmm6,[rel PW_F0707] ; xmm6=z1 movdqa xmm1,xmm4 movdqa xmm7,xmm3 @@ -216,13 +216,13 @@ EXTN(jsimd_fdct_ifast_sse2): psllw xmm0,PRE_MULTIPLY_SCALE_BITS psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[PW_F0707] ; xmm5=z3 + pmulhw xmm5,[rel PW_F0707] ; xmm5=z3 movdqa xmm4,xmm2 ; xmm4=tmp10 psubw xmm2,xmm0 - pmulhw xmm2,[PW_F0382] ; xmm2=z5 - pmulhw xmm4,[PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm0,[PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + pmulhw xmm2,[rel PW_F0382] ; xmm2=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[rel PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) paddw xmm4,xmm2 ; xmm4=z2 paddw xmm0,xmm2 ; xmm0=z4 @@ -328,7 +328,7 @@ EXTN(jsimd_fdct_ifast_sse2): paddw xmm5,xmm3 psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[PW_F0707] ; xmm5=z1 + pmulhw xmm5,[rel PW_F0707] ; xmm5=z1 movdqa xmm6,xmm4 movdqa xmm2,xmm3 @@ -355,13 +355,13 @@ EXTN(jsimd_fdct_ifast_sse2): psllw xmm1,PRE_MULTIPLY_SCALE_BITS psllw xmm0,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm0,[PW_F0707] ; xmm0=z3 + pmulhw xmm0,[rel PW_F0707] ; xmm0=z3 movdqa xmm4,xmm7 ; xmm4=tmp10 psubw xmm7,xmm1 - pmulhw xmm7,[PW_F0382] ; xmm7=z5 - pmulhw xmm4,[PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm1,[PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + pmulhw xmm7,[rel PW_F0382] ; xmm7=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[rel PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) paddw xmm4,xmm7 ; xmm4=z2 paddw xmm1,xmm7 ; xmm1=z4 diff --git a/simd/jfss2int-64.asm b/simd/jfss2int-64.asm index f7879214..5fc4ac85 100644 --- a/simd/jfss2int-64.asm +++ b/simd/jfss2int-64.asm @@ -236,17 +236,17 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm6,xmm0 movdqa xmm4,xmm7 movdqa xmm0,xmm6 - pmaddwd xmm7,[PW_F130_F054] ; xmm7=data2L - pmaddwd xmm6,[PW_F130_F054] ; xmm6=data2H - pmaddwd xmm4,[PW_F054_MF130] ; xmm4=data6L - pmaddwd xmm0,[PW_F054_MF130] ; xmm0=data6H + pmaddwd xmm7,[rel PW_F130_F054] ; xmm7=data2L + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=data2H + pmaddwd xmm4,[rel PW_F054_MF130] ; xmm4=data6L + pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=data6H - paddd xmm7,[PD_DESCALE_P1] - paddd xmm6,[PD_DESCALE_P1] + paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm6,[rel PD_DESCALE_P1] psrad xmm7,DESCALE_P1 psrad xmm6,DESCALE_P1 - paddd xmm4,[PD_DESCALE_P1] - paddd xmm0,[PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm0,[rel PD_DESCALE_P1] psrad xmm4,DESCALE_P1 psrad xmm0,DESCALE_P1 @@ -281,10 +281,10 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm4,xmm0 movdqa xmm6,xmm7 movdqa xmm0,xmm4 - pmaddwd xmm7,[PW_MF078_F117] ; xmm7=z3L - pmaddwd xmm4,[PW_MF078_F117] ; xmm4=z3H - pmaddwd xmm6,[PW_F117_F078] ; xmm6=z4L - pmaddwd xmm0,[PW_F117_F078] ; xmm0=z4H + pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3H + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L + pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H @@ -311,22 +311,22 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm4,xmm1 movdqa xmm2,xmm7 movdqa xmm1,xmm4 - pmaddwd xmm7,[PW_MF060_MF089] ; xmm7=tmp4L - pmaddwd xmm4,[PW_MF060_MF089] ; xmm4=tmp4H - pmaddwd xmm2,[PW_MF089_F060] ; xmm2=tmp7L - pmaddwd xmm1,[PW_MF089_F060] ; xmm1=tmp7H + pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp4L + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4H + pmaddwd xmm2,[rel PW_MF089_F060] ; xmm2=tmp7L + pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H paddd xmm2,xmm6 ; xmm2=data1L paddd xmm1,xmm0 ; xmm1=data1H - paddd xmm7,[PD_DESCALE_P1] - paddd xmm4,[PD_DESCALE_P1] + paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] psrad xmm7,DESCALE_P1 psrad xmm4,DESCALE_P1 - paddd xmm2,[PD_DESCALE_P1] - paddd xmm1,[PD_DESCALE_P1] + paddd xmm2,[rel PD_DESCALE_P1] + paddd xmm1,[rel PD_DESCALE_P1] psrad xmm2,DESCALE_P1 psrad xmm1,DESCALE_P1 @@ -339,22 +339,22 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm1,xmm3 movdqa xmm5,xmm4 movdqa xmm3,xmm1 - pmaddwd xmm4,[PW_MF050_MF256] ; xmm4=tmp5L - pmaddwd xmm1,[PW_MF050_MF256] ; xmm1=tmp5H - pmaddwd xmm5,[PW_MF256_F050] ; xmm5=tmp6L - pmaddwd xmm3,[PW_MF256_F050] ; xmm3=tmp6H + pmaddwd xmm4,[rel PW_MF050_MF256] ; xmm4=tmp5L + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H + pmaddwd xmm5,[rel PW_MF256_F050] ; xmm5=tmp6L + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H paddd xmm4,xmm6 ; xmm4=data5L paddd xmm1,xmm0 ; xmm1=data5H paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H - paddd xmm4,[PD_DESCALE_P1] - paddd xmm1,[PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm1,[rel PD_DESCALE_P1] psrad xmm4,DESCALE_P1 psrad xmm1,DESCALE_P1 - paddd xmm5,[PD_DESCALE_P1] - paddd xmm3,[PD_DESCALE_P1] + paddd xmm5,[rel PD_DESCALE_P1] + paddd xmm3,[rel PD_DESCALE_P1] psrad xmm5,DESCALE_P1 psrad xmm3,DESCALE_P1 @@ -457,8 +457,8 @@ EXTN(jsimd_fdct_islow_sse2): paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 - paddw xmm7,[PW_DESCALE_P2X] - paddw xmm5,[PW_DESCALE_P2X] + paddw xmm7,[rel PW_DESCALE_P2X] + paddw xmm5,[rel PW_DESCALE_P2X] psraw xmm7,PASS1_BITS ; xmm7=data0 psraw xmm5,PASS1_BITS ; xmm5=data4 @@ -480,17 +480,17 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm2,xmm6 movdqa xmm1,xmm4 movdqa xmm6,xmm2 - pmaddwd xmm4,[PW_F130_F054] ; xmm4=data2L - pmaddwd xmm2,[PW_F130_F054] ; xmm2=data2H - pmaddwd xmm1,[PW_F054_MF130] ; xmm1=data6L - pmaddwd xmm6,[PW_F054_MF130] ; xmm6=data6H + pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=data2L + pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=data2H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=data6L + pmaddwd xmm6,[rel PW_F054_MF130] ; xmm6=data6H - paddd xmm4,[PD_DESCALE_P2] - paddd xmm2,[PD_DESCALE_P2] + paddd xmm4,[rel PD_DESCALE_P2] + paddd xmm2,[rel PD_DESCALE_P2] psrad xmm4,DESCALE_P2 psrad xmm2,DESCALE_P2 - paddd xmm1,[PD_DESCALE_P2] - paddd xmm6,[PD_DESCALE_P2] + paddd xmm1,[rel PD_DESCALE_P2] + paddd xmm6,[rel PD_DESCALE_P2] psrad xmm1,DESCALE_P2 psrad xmm6,DESCALE_P2 @@ -525,10 +525,10 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm1,xmm6 movdqa xmm2,xmm4 movdqa xmm6,xmm1 - pmaddwd xmm4,[PW_MF078_F117] ; xmm4=z3L - pmaddwd xmm1,[PW_MF078_F117] ; xmm1=z3H - pmaddwd xmm2,[PW_F117_F078] ; xmm2=z4L - pmaddwd xmm6,[PW_F117_F078] ; xmm6=z4H + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3L + pmaddwd xmm1,[rel PW_MF078_F117] ; xmm1=z3H + pmaddwd xmm2,[rel PW_F117_F078] ; xmm2=z4L + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4H movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H @@ -555,22 +555,22 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm1,xmm5 movdqa xmm0,xmm4 movdqa xmm5,xmm1 - pmaddwd xmm4,[PW_MF060_MF089] ; xmm4=tmp4L - pmaddwd xmm1,[PW_MF060_MF089] ; xmm1=tmp4H - pmaddwd xmm0,[PW_MF089_F060] ; xmm0=tmp7L - pmaddwd xmm5,[PW_MF089_F060] ; xmm5=tmp7H + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4L + pmaddwd xmm1,[rel PW_MF060_MF089] ; xmm1=tmp4H + pmaddwd xmm0,[rel PW_MF089_F060] ; xmm0=tmp7L + pmaddwd xmm5,[rel PW_MF089_F060] ; xmm5=tmp7H paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H paddd xmm0,xmm2 ; xmm0=data1L paddd xmm5,xmm6 ; xmm5=data1H - paddd xmm4,[PD_DESCALE_P2] - paddd xmm1,[PD_DESCALE_P2] + paddd xmm4,[rel PD_DESCALE_P2] + paddd xmm1,[rel PD_DESCALE_P2] psrad xmm4,DESCALE_P2 psrad xmm1,DESCALE_P2 - paddd xmm0,[PD_DESCALE_P2] - paddd xmm5,[PD_DESCALE_P2] + paddd xmm0,[rel PD_DESCALE_P2] + paddd xmm5,[rel PD_DESCALE_P2] psrad xmm0,DESCALE_P2 psrad xmm5,DESCALE_P2 @@ -586,22 +586,22 @@ EXTN(jsimd_fdct_islow_sse2): punpckhwd xmm5,xmm7 movdqa xmm3,xmm1 movdqa xmm7,xmm5 - pmaddwd xmm1,[PW_MF050_MF256] ; xmm1=tmp5L - pmaddwd xmm5,[PW_MF050_MF256] ; xmm5=tmp5H - pmaddwd xmm3,[PW_MF256_F050] ; xmm3=tmp6L - pmaddwd xmm7,[PW_MF256_F050] ; xmm7=tmp6H + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5L + pmaddwd xmm5,[rel PW_MF050_MF256] ; xmm5=tmp5H + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6L + pmaddwd xmm7,[rel PW_MF256_F050] ; xmm7=tmp6H paddd xmm1,xmm2 ; xmm1=data5L paddd xmm5,xmm6 ; xmm5=data5H paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H - paddd xmm1,[PD_DESCALE_P2] - paddd xmm5,[PD_DESCALE_P2] + paddd xmm1,[rel PD_DESCALE_P2] + paddd xmm5,[rel PD_DESCALE_P2] psrad xmm1,DESCALE_P2 psrad xmm5,DESCALE_P2 - paddd xmm3,[PD_DESCALE_P2] - paddd xmm7,[PD_DESCALE_P2] + paddd xmm3,[rel PD_DESCALE_P2] + paddd xmm7,[rel PD_DESCALE_P2] psrad xmm3,DESCALE_P2 psrad xmm7,DESCALE_P2 diff --git a/simd/jfsseflt-64.asm b/simd/jfsseflt-64.asm index d8f72468..859ff54f 100644 --- a/simd/jfsseflt-64.asm +++ b/simd/jfsseflt-64.asm @@ -159,7 +159,7 @@ EXTN(jsimd_fdct_float_sse): addps xmm6,xmm4 ; xmm6=tmp11 addps xmm0,xmm5 - mulps xmm0,[PD_0_707] ; xmm0=z1 + mulps xmm0,[rel PD_0_707] ; xmm0=z1 movaps xmm7,xmm1 movaps xmm4,xmm5 @@ -182,13 +182,13 @@ EXTN(jsimd_fdct_float_sse): addps xmm3,xmm6 ; xmm3=tmp11 addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[PD_0_707] ; xmm3=z3 + mulps xmm3,[rel PD_0_707] ; xmm3=z3 movaps xmm1,xmm2 ; xmm1=tmp10 subps xmm2,xmm6 - mulps xmm2,[PD_0_382] ; xmm2=z5 - mulps xmm1,[PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + mulps xmm2,[rel PD_0_382] ; xmm2=z5 + mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) addps xmm1,xmm2 ; xmm1=z2 addps xmm6,xmm2 ; xmm6=z4 @@ -294,7 +294,7 @@ EXTN(jsimd_fdct_float_sse): addps xmm6,xmm4 ; xmm6=tmp11 addps xmm0,xmm5 - mulps xmm0,[PD_0_707] ; xmm0=z1 + mulps xmm0,[rel PD_0_707] ; xmm0=z1 movaps xmm7,xmm1 movaps xmm4,xmm5 @@ -317,13 +317,13 @@ EXTN(jsimd_fdct_float_sse): addps xmm3,xmm6 ; xmm3=tmp11 addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[PD_0_707] ; xmm3=z3 + mulps xmm3,[rel PD_0_707] ; xmm3=z3 movaps xmm1,xmm2 ; xmm1=tmp10 subps xmm2,xmm6 - mulps xmm2,[PD_0_382] ; xmm2=z5 - mulps xmm1,[PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + mulps xmm2,[rel PD_0_382] ; xmm2=z5 + mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) addps xmm1,xmm2 ; xmm1=z2 addps xmm6,xmm2 ; xmm6=z4 diff --git a/simd/jiss2flt-64.asm b/simd/jiss2flt-64.asm index 572909d2..a3d4a549 100644 --- a/simd/jiss2flt-64.asm +++ b/simd/jiss2flt-64.asm @@ -181,7 +181,7 @@ EXTN(jsimd_idct_float_sse2): addps xmm4,xmm2 ; xmm4=tmp10 addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[PD_1_414] + mulps xmm1,[rel PD_1_414] subps xmm1,xmm5 ; xmm1=tmp12 movaps xmm6,xmm4 @@ -231,13 +231,13 @@ EXTN(jsimd_idct_float_sse2): subps xmm2,xmm5 addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[PD_1_414] ; xmm2=tmp11 + mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 movaps xmm3,xmm0 addps xmm0,xmm4 - mulps xmm0,[PD_1_847] ; xmm0=z5 - mulps xmm3,[PD_M2_613] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[PD_1_082] ; xmm4=(z12 * 1.082392200) + mulps xmm0,[rel PD_1_847] ; xmm0=z5 + mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) addps xmm3,xmm0 ; xmm3=tmp12 subps xmm4,xmm0 ; xmm4=tmp10 @@ -344,7 +344,7 @@ EXTN(jsimd_idct_float_sse2): addps xmm4,xmm2 ; xmm4=tmp10 addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[PD_1_414] + mulps xmm1,[rel PD_1_414] subps xmm1,xmm5 ; xmm1=tmp12 movaps xmm6,xmm4 @@ -375,13 +375,13 @@ EXTN(jsimd_idct_float_sse2): subps xmm2,xmm5 addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[PD_1_414] ; xmm2=tmp11 + mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 movaps xmm3,xmm0 addps xmm0,xmm4 - mulps xmm0,[PD_1_847] ; xmm0=z5 - mulps xmm3,[PD_M2_613] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[PD_1_082] ; xmm4=(z12 * 1.082392200) + mulps xmm0,[rel PD_1_847] ; xmm0=z5 + mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) addps xmm3,xmm0 ; xmm3=tmp12 subps xmm4,xmm0 ; xmm4=tmp10 @@ -396,7 +396,7 @@ EXTN(jsimd_idct_float_sse2): subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,[PD_RNDINT_MAGIC] ; xmm1=[PD_RNDINT_MAGIC] + movaps xmm1,[rel PD_RNDINT_MAGIC] ; xmm1=[rel PD_RNDINT_MAGIC] pcmpeqd xmm3,xmm3 psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} @@ -423,7 +423,7 @@ EXTN(jsimd_idct_float_sse2): subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) - movaps xmm2,[PD_RNDINT_MAGIC] ; xmm2=[PD_RNDINT_MAGIC] + movaps xmm2,[rel PD_RNDINT_MAGIC] ; xmm2=[rel PD_RNDINT_MAGIC] pcmpeqd xmm4,xmm4 psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} @@ -439,7 +439,7 @@ EXTN(jsimd_idct_float_sse2): por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) - movdqa xmm2,[PB_CENTERJSAMP] ; xmm2=[PB_CENTERJSAMP] + movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) diff --git a/simd/jiss2fst-64.asm b/simd/jiss2fst-64.asm index 97dfa761..ab6af50c 100644 --- a/simd/jiss2fst-64.asm +++ b/simd/jiss2fst-64.asm @@ -172,7 +172,7 @@ EXTN(jsimd_idct_ifast_sse2): paddw xmm5,xmm3 ; xmm5=tmp13 psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm1,[PW_F1414] + pmulhw xmm1,[rel PW_F1414] psubw xmm1,xmm5 ; xmm1=tmp12 movdqa xmm6,xmm4 @@ -212,7 +212,7 @@ EXTN(jsimd_idct_ifast_sse2): paddw xmm3,xmm0 ; xmm3=tmp7 psllw xmm4,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm4,[PW_F1414] ; xmm4=tmp11 + pmulhw xmm4,[rel PW_F1414] ; xmm4=tmp11 ; To avoid overflow... ; @@ -225,9 +225,9 @@ EXTN(jsimd_idct_ifast_sse2): movdqa xmm0,xmm5 paddw xmm5,xmm2 - pmulhw xmm5,[PW_F1847] ; xmm5=z5 - pmulhw xmm0,[PW_MF1613] - pmulhw xmm2,[PW_F1082] + pmulhw xmm5,[rel PW_F1847] ; xmm5=z5 + pmulhw xmm0,[rel PW_MF1613] + pmulhw xmm2,[rel PW_F1082] psubw xmm0,xmm1 psubw xmm2,xmm5 ; xmm2=tmp10 paddw xmm0,xmm5 ; xmm0=tmp12 @@ -337,7 +337,7 @@ EXTN(jsimd_idct_ifast_sse2): paddw xmm0,xmm3 ; xmm0=tmp13 psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[PW_F1414] + pmulhw xmm5,[rel PW_F1414] psubw xmm5,xmm0 ; xmm5=tmp12 movdqa xmm1,xmm2 @@ -373,7 +373,7 @@ EXTN(jsimd_idct_ifast_sse2): paddw xmm5,xmm6 ; xmm5=tmp7 psllw xmm2,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm2,[PW_F1414] ; xmm2=tmp11 + pmulhw xmm2,[rel PW_F1414] ; xmm2=tmp11 ; To avoid overflow... ; @@ -386,9 +386,9 @@ EXTN(jsimd_idct_ifast_sse2): movdqa xmm6,xmm4 paddw xmm4,xmm0 - pmulhw xmm4,[PW_F1847] ; xmm4=z5 - pmulhw xmm6,[PW_MF1613] - pmulhw xmm0,[PW_F1082] + pmulhw xmm4,[rel PW_F1847] ; xmm4=z5 + pmulhw xmm6,[rel PW_MF1613] + pmulhw xmm0,[rel PW_F1082] psubw xmm6,xmm7 psubw xmm0,xmm4 ; xmm0=tmp10 paddw xmm6,xmm4 ; xmm6=tmp12 @@ -426,7 +426,7 @@ EXTN(jsimd_idct_ifast_sse2): psraw xmm4,(PASS1_BITS+3) ; descale psraw xmm7,(PASS1_BITS+3) ; descale - movdqa xmm2,[PB_CENTERJSAMP] ; xmm2=[PB_CENTERJSAMP] + movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) diff --git a/simd/jiss2int-64.asm b/simd/jiss2int-64.asm index cfeb42d8..97317af7 100644 --- a/simd/jiss2int-64.asm +++ b/simd/jiss2int-64.asm @@ -196,10 +196,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm5,xmm3 movdqa xmm1,xmm4 movdqa xmm3,xmm5 - pmaddwd xmm4,[PW_F130_F054] ; xmm4=tmp3L - pmaddwd xmm5,[PW_F130_F054] ; xmm5=tmp3H - pmaddwd xmm1,[PW_F054_MF130] ; xmm1=tmp2L - pmaddwd xmm3,[PW_F054_MF130] ; xmm3=tmp2H + pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=tmp3L + pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm3,[rel PW_F054_MF130] ; xmm3=tmp2H movdqa xmm6,xmm0 paddw xmm0,xmm2 ; xmm0=in0+in4 @@ -274,10 +274,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm0,xmm7 movdqa xmm5,xmm2 movdqa xmm7,xmm0 - pmaddwd xmm2,[PW_MF078_F117] ; xmm2=z3L - pmaddwd xmm0,[PW_MF078_F117] ; xmm0=z3H - pmaddwd xmm5,[PW_F117_F078] ; xmm5=z4L - pmaddwd xmm7,[PW_F117_F078] ; xmm7=z4H + pmaddwd xmm2,[rel PW_MF078_F117] ; xmm2=z3L + pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3H + pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L + pmaddwd xmm7,[rel PW_F117_F078] ; xmm7=z4H movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H @@ -304,10 +304,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm0,xmm4 movdqa xmm3,xmm2 movdqa xmm4,xmm0 - pmaddwd xmm2,[PW_MF060_MF089] ; xmm2=tmp0L - pmaddwd xmm0,[PW_MF060_MF089] ; xmm0=tmp0H - pmaddwd xmm3,[PW_MF089_F060] ; xmm3=tmp3L - pmaddwd xmm4,[PW_MF089_F060] ; xmm4=tmp3H + pmaddwd xmm2,[rel PW_MF060_MF089] ; xmm2=tmp0L + pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0H + pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3L + pmaddwd xmm4,[rel PW_MF089_F060] ; xmm4=tmp3H paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H @@ -323,10 +323,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm0,xmm6 movdqa xmm1,xmm2 movdqa xmm6,xmm0 - pmaddwd xmm2,[PW_MF050_MF256] ; xmm2=tmp1L - pmaddwd xmm0,[PW_MF050_MF256] ; xmm0=tmp1H - pmaddwd xmm1,[PW_MF256_F050] ; xmm1=tmp2L - pmaddwd xmm6,[PW_MF256_F050] ; xmm6=tmp2H + pmaddwd xmm2,[rel PW_MF050_MF256] ; xmm2=tmp1L + pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1H + pmaddwd xmm1,[rel PW_MF256_F050] ; xmm1=tmp2L + pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H paddd xmm2,xmm5 ; xmm2=tmp1L paddd xmm0,xmm7 ; xmm0=tmp1H @@ -348,7 +348,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm2,xmm3 ; xmm2=data7L psubd xmm0,xmm4 ; xmm0=data7H - movdqa xmm3,[PD_DESCALE_P1] ; xmm3=[PD_DESCALE_P1] + movdqa xmm3,[rel PD_DESCALE_P1] ; xmm3=[rel PD_DESCALE_P1] paddd xmm5,xmm3 paddd xmm7,xmm3 @@ -372,7 +372,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm7,xmm1 ; xmm7=data6L psubd xmm0,xmm6 ; xmm0=data6H - movdqa xmm1,[PD_DESCALE_P1] ; xmm1=[PD_DESCALE_P1] + movdqa xmm1,[rel PD_DESCALE_P1] ; xmm1=[rel PD_DESCALE_P1] paddd xmm4,xmm1 paddd xmm3,xmm1 @@ -410,7 +410,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm5,xmm4 ; xmm5=data5L psubd xmm6,xmm2 ; xmm6=data5H - movdqa xmm7,[PD_DESCALE_P1] ; xmm7=[PD_DESCALE_P1] + movdqa xmm7,[rel PD_DESCALE_P1] ; xmm7=[rel PD_DESCALE_P1] paddd xmm3,xmm7 paddd xmm0,xmm7 @@ -436,7 +436,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm0,xmm2 ; xmm0=data4L psubd xmm6,xmm7 ; xmm6=data4H - movdqa xmm2,[PD_DESCALE_P1] ; xmm2=[PD_DESCALE_P1] + movdqa xmm2,[rel PD_DESCALE_P1] ; xmm2=[rel PD_DESCALE_P1] paddd xmm1,xmm2 paddd xmm4,xmm2 @@ -536,10 +536,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm5,xmm2 movdqa xmm1,xmm6 movdqa xmm2,xmm5 - pmaddwd xmm6,[PW_F130_F054] ; xmm6=tmp3L - pmaddwd xmm5,[PW_F130_F054] ; xmm5=tmp3H - pmaddwd xmm1,[PW_F054_MF130] ; xmm1=tmp2L - pmaddwd xmm2,[PW_F054_MF130] ; xmm2=tmp2H + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=tmp3L + pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm2,[rel PW_F054_MF130] ; xmm2=tmp2H movdqa xmm3,xmm7 paddw xmm7,xmm0 ; xmm7=in0+in4 @@ -610,10 +610,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm7,xmm4 movdqa xmm5,xmm0 movdqa xmm4,xmm7 - pmaddwd xmm0,[PW_MF078_F117] ; xmm0=z3L - pmaddwd xmm7,[PW_MF078_F117] ; xmm7=z3H - pmaddwd xmm5,[PW_F117_F078] ; xmm5=z4L - pmaddwd xmm4,[PW_F117_F078] ; xmm4=z4H + pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3L + pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3H + pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L + pmaddwd xmm4,[rel PW_F117_F078] ; xmm4=z4H movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H @@ -640,10 +640,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm7,xmm3 movdqa xmm1,xmm0 movdqa xmm3,xmm7 - pmaddwd xmm0,[PW_MF060_MF089] ; xmm0=tmp0L - pmaddwd xmm7,[PW_MF060_MF089] ; xmm7=tmp0H - pmaddwd xmm1,[PW_MF089_F060] ; xmm1=tmp3L - pmaddwd xmm3,[PW_MF089_F060] ; xmm3=tmp3H + pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0L + pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp0H + pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp3L + pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3H paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H @@ -659,10 +659,10 @@ EXTN(jsimd_idct_islow_sse2): punpckhwd xmm7,xmm6 movdqa xmm2,xmm0 movdqa xmm6,xmm7 - pmaddwd xmm0,[PW_MF050_MF256] ; xmm0=tmp1L - pmaddwd xmm7,[PW_MF050_MF256] ; xmm7=tmp1H - pmaddwd xmm2,[PW_MF256_F050] ; xmm2=tmp2L - pmaddwd xmm6,[PW_MF256_F050] ; xmm6=tmp2H + pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1L + pmaddwd xmm7,[rel PW_MF050_MF256] ; xmm7=tmp1H + pmaddwd xmm2,[rel PW_MF256_F050] ; xmm2=tmp2L + pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H paddd xmm0,xmm5 ; xmm0=tmp1L paddd xmm7,xmm4 ; xmm7=tmp1H @@ -684,7 +684,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm0,xmm1 ; xmm0=data7L psubd xmm7,xmm3 ; xmm7=data7H - movdqa xmm1,[PD_DESCALE_P2] ; xmm1=[PD_DESCALE_P2] + movdqa xmm1,[rel PD_DESCALE_P2] ; xmm1=[rel PD_DESCALE_P2] paddd xmm5,xmm1 paddd xmm4,xmm1 @@ -708,7 +708,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm4,xmm2 ; xmm4=data6L psubd xmm7,xmm6 ; xmm7=data6H - movdqa xmm2,[PD_DESCALE_P2] ; xmm2=[PD_DESCALE_P2] + movdqa xmm2,[rel PD_DESCALE_P2] ; xmm2=[rel PD_DESCALE_P2] paddd xmm3,xmm2 paddd xmm1,xmm2 @@ -740,7 +740,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm4,xmm1 ; xmm4=data5L psubd xmm0,xmm7 ; xmm0=data5H - movdqa xmm5,[PD_DESCALE_P2] ; xmm5=[PD_DESCALE_P2] + movdqa xmm5,[rel PD_DESCALE_P2] ; xmm5=[rel PD_DESCALE_P2] paddd xmm6,xmm5 paddd xmm2,xmm5 @@ -766,7 +766,7 @@ EXTN(jsimd_idct_islow_sse2): psubd xmm2,xmm7 ; xmm2=data4L psubd xmm0,xmm5 ; xmm0=data4H - movdqa xmm7,[PD_DESCALE_P2] ; xmm7=[PD_DESCALE_P2] + movdqa xmm7,[rel PD_DESCALE_P2] ; xmm7=[rel PD_DESCALE_P2] paddd xmm3,xmm7 paddd xmm1,xmm7 @@ -777,7 +777,7 @@ EXTN(jsimd_idct_islow_sse2): psrad xmm2,DESCALE_P2 psrad xmm0,DESCALE_P2 - movdqa xmm5,[PB_CENTERJSAMP] ; xmm5=[PB_CENTERJSAMP] + movdqa xmm5,[rel PB_CENTERJSAMP] ; xmm5=[rel PB_CENTERJSAMP] packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) diff --git a/simd/jiss2red-64.asm b/simd/jiss2red-64.asm index 381180c7..dcf745bd 100644 --- a/simd/jiss2red-64.asm +++ b/simd/jiss2red-64.asm @@ -186,10 +186,10 @@ EXTN(jsimd_idct_4x4_sse2): punpckhwd xmm5,xmm1 movdqa xmm0,xmm4 movdqa xmm1,xmm5 - pmaddwd xmm4,[PW_F256_F089] ; xmm4=(tmp2L) - pmaddwd xmm5,[PW_F256_F089] ; xmm5=(tmp2H) - pmaddwd xmm0,[PW_F106_MF217] ; xmm0=(tmp0L) - pmaddwd xmm1,[PW_F106_MF217] ; xmm1=(tmp0H) + pmaddwd xmm4,[rel PW_F256_F089] ; xmm4=(tmp2L) + pmaddwd xmm5,[rel PW_F256_F089] ; xmm5=(tmp2H) + pmaddwd xmm0,[rel PW_F106_MF217] ; xmm0=(tmp0L) + pmaddwd xmm1,[rel PW_F106_MF217] ; xmm1=(tmp0H) movdqa xmm6,xmm2 movdqa xmm7,xmm2 @@ -197,10 +197,10 @@ EXTN(jsimd_idct_4x4_sse2): punpckhwd xmm7,xmm3 movdqa xmm2,xmm6 movdqa xmm3,xmm7 - pmaddwd xmm6,[PW_MF060_MF050] ; xmm6=(tmp2L) - pmaddwd xmm7,[PW_MF060_MF050] ; xmm7=(tmp2H) - pmaddwd xmm2,[PW_F145_MF021] ; xmm2=(tmp0L) - pmaddwd xmm3,[PW_F145_MF021] ; xmm3=(tmp0H) + pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2L) + pmaddwd xmm7,[rel PW_MF060_MF050] ; xmm7=(tmp2H) + pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0L) + pmaddwd xmm3,[rel PW_F145_MF021] ; xmm3=(tmp0H) paddd xmm6,xmm4 ; xmm6=tmp2L paddd xmm7,xmm5 ; xmm7=tmp2H @@ -229,8 +229,8 @@ EXTN(jsimd_idct_4x4_sse2): movdqa xmm3,xmm5 ; xmm5=in2=z2 punpcklwd xmm5,xmm0 ; xmm0=in6=z3 punpckhwd xmm3,xmm0 - pmaddwd xmm5,[PW_F184_MF076] ; xmm5=tmp2L - pmaddwd xmm3,[PW_F184_MF076] ; xmm3=tmp2H + pmaddwd xmm5,[rel PW_F184_MF076] ; xmm5=tmp2L + pmaddwd xmm3,[rel PW_F184_MF076] ; xmm3=tmp2H movdqa xmm4,xmm1 movdqa xmm0,xmm2 @@ -248,7 +248,7 @@ EXTN(jsimd_idct_4x4_sse2): psubd xmm5,xmm6 ; xmm5=data3L psubd xmm3,xmm7 ; xmm3=data3H - movdqa xmm6,[PD_DESCALE_P1_4] ; xmm6=[PD_DESCALE_P1_4] + movdqa xmm6,[rel PD_DESCALE_P1_4] ; xmm6=[rel PD_DESCALE_P1_4] paddd xmm1,xmm6 paddd xmm2,xmm6 @@ -272,7 +272,7 @@ EXTN(jsimd_idct_4x4_sse2): psubd xmm2,xmm7 ; xmm2=data2L psubd xmm3,xmm6 ; xmm3=data2H - movdqa xmm7,[PD_DESCALE_P1_4] ; xmm7=[PD_DESCALE_P1_4] + movdqa xmm7,[rel PD_DESCALE_P1_4] ; xmm7=[rel PD_DESCALE_P1_4] paddd xmm4,xmm7 paddd xmm0,xmm7 @@ -326,10 +326,10 @@ EXTN(jsimd_idct_4x4_sse2): punpckhwd xmm6,xmm3 movdqa xmm5,xmm1 movdqa xmm2,xmm6 - pmaddwd xmm1,[PW_F256_F089] ; xmm1=(tmp2) - pmaddwd xmm6,[PW_MF060_MF050] ; xmm6=(tmp2) - pmaddwd xmm5,[PW_F106_MF217] ; xmm5=(tmp0) - pmaddwd xmm2,[PW_F145_MF021] ; xmm2=(tmp0) + pmaddwd xmm1,[rel PW_F256_F089] ; xmm1=(tmp2) + pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2) + pmaddwd xmm5,[rel PW_F106_MF217] ; xmm5=(tmp0) + pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0) paddd xmm6,xmm1 ; xmm6=tmp2 paddd xmm2,xmm5 ; xmm2=tmp0 @@ -337,7 +337,7 @@ EXTN(jsimd_idct_4x4_sse2): ; -- Even part punpcklwd xmm0,xmm3 - pmaddwd xmm0,[PW_F184_MF076] ; xmm0=tmp2 + pmaddwd xmm0,[rel PW_F184_MF076] ; xmm0=tmp2 movdqa xmm7,xmm4 paddd xmm4,xmm0 ; xmm4=tmp10 @@ -345,7 +345,7 @@ EXTN(jsimd_idct_4x4_sse2): ; -- Final output stage - movdqa xmm1,[PD_DESCALE_P2_4] ; xmm1=[PD_DESCALE_P2_4] + movdqa xmm1,[rel PD_DESCALE_P2_4] ; xmm1=[rel PD_DESCALE_P2_4] movdqa xmm5,xmm4 movdqa xmm3,xmm7 @@ -375,7 +375,7 @@ EXTN(jsimd_idct_4x4_sse2): punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) - paddb xmm4,[PB_CENTERJSAMP] + paddb xmm4,[rel PB_CENTERJSAMP] pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) @@ -457,8 +457,8 @@ EXTN(jsimd_idct_2x2_sse2): movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) - pmaddwd xmm4,[PW_F362_MF127] - pmaddwd xmm5,[PW_F085_MF072] + pmaddwd xmm4,[rel PW_F362_MF127] + pmaddwd xmm5,[rel PW_F085_MF072] psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) @@ -466,8 +466,8 @@ EXTN(jsimd_idct_2x2_sse2): pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) - pmaddwd xmm0,[PW_F362_MF127] - pmaddwd xmm2,[PW_F085_MF072] + pmaddwd xmm0,[rel PW_F362_MF127] + pmaddwd xmm2,[rel PW_F085_MF072] paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] @@ -494,7 +494,7 @@ EXTN(jsimd_idct_2x2_sse2): psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) - movdqa xmm2,[PD_DESCALE_P1_2] ; xmm2=[PD_DESCALE_P1_2] + movdqa xmm2,[rel PD_DESCALE_P1_2] ; xmm2=[rel PD_DESCALE_P1_2] punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) @@ -533,8 +533,8 @@ EXTN(jsimd_idct_2x2_sse2): packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) - pmaddwd xmm1,[PW_F362_MF127] - pmaddwd xmm7,[PW_F085_MF072] + pmaddwd xmm1,[rel PW_F362_MF127] + pmaddwd xmm7,[rel PW_F085_MF072] paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] @@ -550,12 +550,12 @@ EXTN(jsimd_idct_2x2_sse2): punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) - paddd xmm6,[PD_DESCALE_P2_2] + paddd xmm6,[rel PD_DESCALE_P2_2] psrad xmm6,DESCALE_P2_2 packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) - paddb xmm6,[PB_CENTERJSAMP] + paddb xmm6,[rel PB_CENTERJSAMP] pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) From 7a9b1adb5fc75be1aa83c6e96db08575bf3c3b51 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 10 Jul 2009 12:47:13 +0000 Subject: [PATCH 049/985] Make sure the indirectly used assembly files get packaged. --- simd/Makefile.am | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simd/Makefile.am b/simd/Makefile.am index 8e7469fa..92a095ea 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -20,6 +20,8 @@ jccolss2-64.lo: jcclrss2-64.asm jdcolss2-64.lo: jdclrss2-64.asm jdmerss2-64.lo: jdmrgss2-64.asm +EXTRA_DIST += jcclrss2-64.asm jdclrss2-64.asm jdmrgss2-64.asm + endif if SIMD_I386 @@ -47,6 +49,11 @@ jdcolss2.lo: jdclrss2.asm jdmermmx.lo: jdmrgmmx.asm jdmerss2.lo: jdmrgss2.asm +EXTRA_DIST += \ + jcclrmmx.asm jcclrss2.asm \ + jdclrmmx.asm jdclrss2.asm \ + jdmrgmmx.asm jdmrgss2.asm + endif .asm.lo: From daa07a8ac31cef35940e0613aba1dfe8d2e687b3 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 10 Jul 2009 12:56:00 +0000 Subject: [PATCH 050/985] Make sure bmp.h gets distributed. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0e7ae4d6..ffba1ee9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,11 +27,11 @@ TSTHDRS = turbojpeg.h rrutil.h rrtimer.h noinst_PROGRAMS = jpgtest jpegut cjpeg djpeg -jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.c turbojpegl.c +jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c turbojpegl.c jpgtest_LDADD = $(top_srcdir)/libjpeg.la -jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.c turbojpegl.c +jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c turbojpegl.c jpegut_LDADD = $(top_srcdir)/libjpeg.la From 1bd552079dccafacb20dd549ae13d946f1ae0084 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 10 Jul 2009 12:59:14 +0000 Subject: [PATCH 051/985] Make our Makefile.am a bit easier to convert to a standalone one by indicating which headers are the public ones. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index ffba1ee9..26fe44c5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ noinst_LTLIBRARIES = libjpeg.la +noinst_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h turbojpeg.h From 2691a245399d3d1f03b9e4c0675691721484c98c Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 30 Jul 2009 08:35:06 +0000 Subject: [PATCH 052/985] Improve compression performance by 15-20% --- jchuff.c | 122 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 21 deletions(-) diff --git a/jchuff.c b/jchuff.c index 13afab22..e9abb42c 100644 --- a/jchuff.c +++ b/jchuff.c @@ -33,15 +33,11 @@ #include "jinclude.h" #include "jpeglib.h" #include "jchuff.h" /* Declarations shared with jcphuff.c */ - +#include static unsigned char jpeg_first_bit_table[65536]; int jpeg_first_bit_table_init=0; -#define CALC_FIRST_BIT(nbits, t) \ - nbits = jpeg_first_bit_table[t&255]; \ - if (t > 255) nbits = jpeg_first_bit_table[t>>8] + 8; - #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif @@ -53,7 +49,7 @@ int jpeg_first_bit_table_init=0; */ typedef struct { - INT32 put_buffer; /* current bit-accumulation buffer */ + long put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; @@ -185,6 +181,7 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) } /* Initialize bit buffer to empty */ + entropy->saved.put_buffer = 0; entropy->saved.put_bits = 0; @@ -336,28 +333,85 @@ dump_buffer (working_state * state) /***************************************************************/ +#define EMIT_BYTE() { \ + if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ + *buffer++ = 0; \ + } + +/***************************************************************/ + #define DUMP_BITS_(code, size) { \ put_bits += size; \ put_buffer = (put_buffer << size) | code; \ if (put_bits > 7) \ while(put_bits > 7) \ - if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ - *buffer++ = 0; \ + EMIT_BYTE() \ } /***************************************************************/ +#define CHECKBUF15() { \ + if (put_bits > 15) { \ + EMIT_BYTE() \ + EMIT_BYTE() \ + } \ +} + +#define CHECKBUF15() { \ + if (put_bits > 15) { \ + EMIT_BYTE() \ + EMIT_BYTE() \ + } \ +} + +#define CHECKBUF47() { \ + if (put_bits > 47) { \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + } \ +} + +#define CHECKBUF55() { \ + if (put_bits > 55) { \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + EMIT_BYTE() \ + } \ +} + +/***************************************************************/ + +#define DUMP_BITS_NOCHECK(code, size) { \ + put_bits += size; \ + put_buffer = (put_buffer << size) | code; \ + } + +#if __WORDSIZE==64 + +#define DUMP_BITS(code, size) { \ + CHECKBUF55() \ + put_bits += size; \ + put_buffer = (put_buffer << size) | code; \ + } + +#else + #define DUMP_BITS(code, size) { \ put_bits += size; \ put_buffer = (put_buffer << size) | code; \ - if (put_bits > 15) { \ - if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ - *buffer++ = 0; \ - if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ - *buffer++ = 0; \ - } \ + CHECKBUF15() \ } +#endif + /***************************************************************/ #define DUMP_SINGLE_VALUE(ht, codevalue) { \ @@ -369,14 +423,40 @@ dump_buffer (working_state * state) /***************************************************************/ +#define DUMP_VALUE_SLOW(ht, codevalue, t, nbits) { \ + size = ht->ehufsi[codevalue]; \ + code = ht->ehufco[codevalue]; \ + t &= ~(-1 << nbits); \ + DUMP_BITS_NOCHECK(code, size) \ + CHECKBUF15() \ + DUMP_BITS_NOCHECK(t, nbits) \ + CHECKBUF15() \ + } + +#if __WORDSIZE==64 + #define DUMP_VALUE(ht, codevalue, t, nbits) { \ size = ht->ehufsi[codevalue]; \ code = ht->ehufco[codevalue]; \ t &= ~(-1 << nbits); \ - DUMP_BITS(code, size) \ - DUMP_BITS(t, nbits) \ + CHECKBUF47() \ + DUMP_BITS_NOCHECK(code, size) \ + DUMP_BITS_NOCHECK(t, nbits) \ } +#else + +#define DUMP_VALUE(ht, codevalue, t, nbits) { \ + size = ht->ehufsi[codevalue]; \ + code = ht->ehufco[codevalue]; \ + t &= ~(-1 << nbits); \ + DUMP_BITS_NOCHECK(code, size) \ + DUMP_BITS_NOCHECK(t, nbits) \ + CHECKBUF15() \ + } + +#endif + /***************************************************************/ #define BUFSIZE (DCTSIZE2 * 2) @@ -416,7 +496,7 @@ LOCAL(boolean) flush_bits (working_state * state) { unsigned char _buffer[BUFSIZE], *buffer; - int put_buffer, put_bits; + long put_buffer; int put_bits; int bytes, bytestocopy, localbuf = 0; put_buffer = state->cur.put_buffer; @@ -442,7 +522,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, int nbits; int r, sflag, size, code; unsigned char _buffer[BUFSIZE], *buffer; - int put_buffer, put_bits; + long put_buffer; int put_bits; int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; int bytes, bytestocopy, localbuf = 0; @@ -457,8 +537,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, sflag = temp >> 31; temp -= ((temp + temp) & sflag); temp2 += sflag; - CALC_FIRST_BIT(nbits, temp) - DUMP_VALUE(dctbl, nbits, temp2, nbits) + nbits = jpeg_first_bit_table[temp]; + DUMP_VALUE_SLOW(dctbl, nbits, temp2, nbits) /* Encode the AC coefficients per section F.1.2.2 */ @@ -472,8 +552,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, sflag = temp >> 31; \ temp = (temp ^ sflag) - sflag; \ temp2 += sflag; \ - nbits = jpeg_first_bit_table[temp]; \ for(; r > 15; r -= 16) DUMP_BITS(code_0xf0, size_0xf0) \ + nbits = jpeg_first_bit_table[temp]; \ sflag = (r << 4) + nbits; \ DUMP_VALUE(actbl, sflag, temp2, nbits) \ r = 0; \ From 8311c51c078f4ce4a109480a71ab653fed8da397 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 6 Aug 2009 07:51:26 +0000 Subject: [PATCH 053/985] Oops. Clean up a couple of remaining 32-bit memory accesses --- simd/jcclrss2-64.asm | 2 +- simd/jdsamss2-64.asm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm index ca7e24af..f2cd8f4e 100644 --- a/simd/jcclrss2-64.asm +++ b/simd/jcclrss2-64.asm @@ -361,7 +361,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psllw xmm7,BYTE_BIT por xmm5,xmm7 ; xmm5=Cb - movdqa XMMWORD [ebx], xmm5 ; Save Cb + movdqa XMMWORD [rbx], xmm5 ; Save Cb movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE diff --git a/simd/jdsamss2-64.asm b/simd/jdsamss2-64.asm index 7df283e8..143a97a2 100644 --- a/simd/jdsamss2-64.asm +++ b/simd/jdsamss2-64.asm @@ -298,8 +298,8 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): pslldq xmm1,(SIZEOF_XMMWORD-2) movdqa xmm2,xmm1 - pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] - pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] + pand xmm1, XMMWORD [rdx+1*SIZEOF_XMMWORD] + pand xmm2, XMMWORD [rdi+1*SIZEOF_XMMWORD] movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) From a1a5989d850776b3381b9139b4ff1ea99544b77c Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 6 Aug 2009 08:32:00 +0000 Subject: [PATCH 054/985] Update copyrights to indicate files modified with colorspace extensions --- jcparam.c | 1 + jdcolor.c | 1 + jdmaster.c | 1 + jdmerge.c | 1 + jpeglib.h | 1 + jquant1.c | 1 + jquant2.c | 1 + 7 files changed, 7 insertions(+) diff --git a/jcparam.c b/jcparam.c index 2954f635..a1d49d93 100644 --- a/jcparam.c +++ b/jcparam.c @@ -2,6 +2,7 @@ * jcparam.c * * Copyright (C) 1991-1998, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jdcolor.c b/jdcolor.c index e1dd3ff5..8e638c99 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -3,6 +3,7 @@ * * Copyright (C) 1991-1997, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jdmaster.c b/jdmaster.c index 38db792f..8314b67d 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -2,6 +2,7 @@ * jdmaster.c * * Copyright (C) 1991-1997, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jdmerge.c b/jdmerge.c index 7b1a079f..edf061a7 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -3,6 +3,7 @@ * * Copyright (C) 1994-1996, Thomas G. Lane. * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jpeglib.h b/jpeglib.h index b28ff8df..31f0dd66 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -2,6 +2,7 @@ * jpeglib.h * * Copyright (C) 1991-1998, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jquant1.c b/jquant1.c index eac65a37..362bb1eb 100644 --- a/jquant1.c +++ b/jquant1.c @@ -2,6 +2,7 @@ * jquant1.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jquant2.c b/jquant2.c index 9ce3ff36..da964f7d 100644 --- a/jquant2.c +++ b/jquant2.c @@ -2,6 +2,7 @@ * jquant2.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Copyright (C) 2009, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * From 389975d9eed17dec2209d3e3f444b5df553771fb Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 6 Aug 2009 08:58:48 +0000 Subject: [PATCH 055/985] Unfortunately, the previous enhancements made an invalid assumption about the code sizes, which caused "DCT out of range" errors in the decoder. Was able to fix 64-bit without losing any performance, but unfortunately had to revert 32-bit back to its previous behavior for now. --- jchuff.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/jchuff.c b/jchuff.c index e9abb42c..daf0736e 100644 --- a/jchuff.c +++ b/jchuff.c @@ -334,7 +334,7 @@ dump_buffer (working_state * state) /***************************************************************/ #define EMIT_BYTE() { \ - if (0xFF == (*buffer++ = put_buffer >> (put_bits -= 8))) \ + if (0xFF == (*buffer++ = (unsigned char)(put_buffer >> (put_bits -= 8)))) \ *buffer++ = 0; \ } @@ -357,13 +357,6 @@ dump_buffer (working_state * state) } \ } -#define CHECKBUF15() { \ - if (put_bits > 15) { \ - EMIT_BYTE() \ - EMIT_BYTE() \ - } \ -} - #define CHECKBUF47() { \ if (put_bits > 47) { \ EMIT_BYTE() \ @@ -375,11 +368,8 @@ dump_buffer (working_state * state) } \ } -#define CHECKBUF55() { \ - if (put_bits > 55) { \ - EMIT_BYTE() \ - EMIT_BYTE() \ - EMIT_BYTE() \ +#define CHECKBUF31() { \ + if (put_bits > 31) { \ EMIT_BYTE() \ EMIT_BYTE() \ EMIT_BYTE() \ @@ -397,7 +387,7 @@ dump_buffer (working_state * state) #if __WORDSIZE==64 #define DUMP_BITS(code, size) { \ - CHECKBUF55() \ + CHECKBUF47() \ put_bits += size; \ put_buffer = (put_buffer << size) | code; \ } @@ -433,13 +423,15 @@ dump_buffer (working_state * state) CHECKBUF15() \ } +int _max=0; + #if __WORDSIZE==64 #define DUMP_VALUE(ht, codevalue, t, nbits) { \ size = ht->ehufsi[codevalue]; \ code = ht->ehufco[codevalue]; \ t &= ~(-1 << nbits); \ - CHECKBUF47() \ + CHECKBUF31() \ DUMP_BITS_NOCHECK(code, size) \ DUMP_BITS_NOCHECK(t, nbits) \ } @@ -451,6 +443,7 @@ dump_buffer (working_state * state) code = ht->ehufco[codevalue]; \ t &= ~(-1 << nbits); \ DUMP_BITS_NOCHECK(code, size) \ + CHECKBUF15() \ DUMP_BITS_NOCHECK(t, nbits) \ CHECKBUF15() \ } @@ -552,8 +545,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, sflag = temp >> 31; \ temp = (temp ^ sflag) - sflag; \ temp2 += sflag; \ - for(; r > 15; r -= 16) DUMP_BITS(code_0xf0, size_0xf0) \ nbits = jpeg_first_bit_table[temp]; \ + for(; r > 15; r -= 16) DUMP_BITS(code_0xf0, size_0xf0) \ sflag = (r << 4) + nbits; \ DUMP_VALUE(actbl, sflag, temp2, nbits) \ r = 0; \ From 0cae220381dde1e2bb12bb89c2acdde7a6a340f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Wed, 19 Aug 2009 13:53:48 +0000 Subject: [PATCH 056/985] Windows build fixes: * Use jsimd_i386.c instead of the attic jsimd.c * Corrected include of jsimd.h in jsimd_i386.c. --- jpeg.dsp | 2 +- simd/jsimd_i386.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jpeg.dsp b/jpeg.dsp index 37566e51..72512612 100644 --- a/jpeg.dsp +++ b/jpeg.dsp @@ -265,7 +265,7 @@ SOURCE=.\jquant2.c # End Source File # Begin Source File -SOURCE=.\jsimd.c +SOURCE=.\simd\jsimd_i386.c # End Source File # Begin Source File diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c index 751fe2de..f5aec18b 100644 --- a/simd/jsimd_i386.c +++ b/simd/jsimd_i386.c @@ -18,7 +18,7 @@ #include "../jsimd.h" #include "../jdct.h" #include "../jsimddct.h" -#include "simd/jsimd.h" +#include "jsimd.h" /* * In the PIC cases, we have no guarantee that constants will keep From cb9c102ddb19510461d492ae3d3e4fa3720422d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Wed, 19 Aug 2009 14:20:46 +0000 Subject: [PATCH 057/985] Corrected last patch: Use jsimd_none.c instead of jsimd_i386.c on VC/Windows at this point. --- jpeg.dsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpeg.dsp b/jpeg.dsp index 72512612..5f97af75 100644 --- a/jpeg.dsp +++ b/jpeg.dsp @@ -265,7 +265,7 @@ SOURCE=.\jquant2.c # End Source File # Begin Source File -SOURCE=.\simd\jsimd_i386.c +SOURCE=.\jsimd_none.c # End Source File # Begin Source File From 164cb4004b1d8ea1f1650b2a7f3bdae1e4ddd6c3 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 3 Sep 2009 01:35:12 +0000 Subject: [PATCH 058/985] Update (C) notice and fix line feed in usage instructions --- jpgtest.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jpgtest.cxx b/jpgtest.cxx index d6c4cb34..da0ef93f 100644 --- a/jpgtest.cxx +++ b/jpgtest.cxx @@ -1,5 +1,6 @@ /* Copyright (C)2004 Landmark Graphics Corporation * Copyright (C)2005, 2006 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander * * This library is free software and may be redistributed and/or modified under * the terms of the wxWindows Library License, Version 3.1 or (at your option) @@ -296,8 +297,8 @@ int main(int argc, char *argv[]) printf(" [-rgb | -bgr | -rgba | -bgra | -abgr | -argb]\n"); printf(" Test the specified color conversion path in the codec (default: BGR)\n\n"); printf(" [-fastupsample]\n"); - printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n\n"); - printf(" YUV decoding in libjpeg decompressor\n"); + printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n"); + printf(" YUV decoding in libjpeg decompressor\n\n"); printf(" [-quiet]\n"); printf(" Output in tabular rather than verbose format\n\n"); printf(" NOTE: If the quality is specified as a range, i.e. 90-100, a separate\n"); From f585c78fe64a7b36dea8f934072db069ad2c3395 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Mon, 14 Sep 2009 13:07:14 +0000 Subject: [PATCH 059/985] Merge unified_buildsys branch to trunk (r3892 - r3898) --- simd/Makefile.am | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/simd/Makefile.am b/simd/Makefile.am index 92a095ea..0f1d125d 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -2,7 +2,9 @@ noinst_LTLIBRARIES = libsimd.la BUILT_SOURCES = jsimdcfg.inc -EXTRA_DIST = nasm_lt.sh +EXTRA_DIST = nasm_lt.sh jcclrmmx.asm jcclrss2.asm jdclrmmx.asm jdclrss2.asm \ + jdmrgmmx.asm jdmrgss2.asm jcclrss2-64.asm jdclrss2-64.asm \ + jdmrgss2-64.asm if SIMD_X86_64 @@ -19,9 +21,6 @@ libsimd_la_SOURCES = jsimd_x86_64.c \ jccolss2-64.lo: jcclrss2-64.asm jdcolss2-64.lo: jdclrss2-64.asm jdmerss2-64.lo: jdmrgss2-64.asm - -EXTRA_DIST += jcclrss2-64.asm jdclrss2-64.asm jdmrgss2-64.asm - endif if SIMD_I386 @@ -48,12 +47,6 @@ jdcolmmx.lo: jdclrmmx.asm jdcolss2.lo: jdclrss2.asm jdmermmx.lo: jdmrgmmx.asm jdmerss2.lo: jdmrgss2.asm - -EXTRA_DIST += \ - jcclrmmx.asm jcclrss2.asm \ - jdclrmmx.asm jdclrss2.asm \ - jdmrgmmx.asm jdmrgss2.asm - endif .asm.lo: From 95de778c46b3557c8d94ae4c3c08cfb384cb827a Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 24 Sep 2009 06:18:25 +0000 Subject: [PATCH 060/985] Significantly improve grayscale performance --- jccolor.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++------ jdcolor.c | 13 +++++--- 2 files changed, 95 insertions(+), 14 deletions(-) diff --git a/jccolor.c b/jccolor.c index 8d3feb8d..2e2bfd2a 100644 --- a/jccolor.c +++ b/jccolor.c @@ -81,6 +81,74 @@ typedef my_color_converter * my_cconvert_ptr; #define TABLE_SIZE (8*(MAXJSAMPLE+1)) +#if BITS_IN_JSAMPLE == 8 + +const unsigned char red_lut[256] = { + 0 , 0 , 1 , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , + 5 , 5 , 5 , 6 , 6 , 6 , 7 , 7 , 7 , 7 , 8 , 8 , 8 , 9 , 9 , 9 , + 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, + 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, + 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, + 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, + 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, + 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38, + 38, 39, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, + 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, + 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, + 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, + 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, + 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, + 67, 67, 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, + 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76 +}; + +const unsigned char green_lut[256] = { + 0 , 1 , 1 , 2 , 2 , 3 , 4 , 4 , 5 , 5 , 6 , 6 , + 7 , 8 , 8 , 9 , 9 , 10 , 11 , 11 , 12 , 12 , 13 , 14 , + 14 , 15 , 15 , 16 , 16 , 17 , 18 , 18 , 19 , 19 , 20 , 21 , + 21 , 22 , 22 , 23 , 23 , 24 , 25 , 25 , 26 , 26 , 27 , 28 , + 28 , 29 , 29 , 30 , 31 , 31 , 32 , 32 , 33 , 33 , 34 , 35 , + 35 , 36 , 36 , 37 , 38 , 38 , 39 , 39 , 40 , 41 , 41 , 42 , + 42 , 43 , 43 , 44 , 45 , 45 , 46 , 46 , 47 , 48 , 48 , 49 , + 49 , 50 , 50 , 51 , 52 , 52 , 53 , 53 , 54 , 55 , 55 , 56 , + 56 , 57 , 58 , 58 , 59 , 59 , 60 , 60 , 61 , 62 , 62 , 63 , + 63 , 64 , 65 , 65 , 66 , 66 , 67 , 68 , 68 , 69 , 69 , 70 , + 70 , 71 , 72 , 72 , 73 , 73 , 74 , 75 , 75 , 76 , 76 , 77 , + 77 , 78 , 79 , 79 , 80 , 80 , 81 , 82 , 82 , 83 , 83 , 84 , + 85 , 85 , 86 , 86 , 87 , 87 , 88 , 89 , 89 , 90 , 90 , 91 , + 92 , 92 , 93 , 93 , 94 , 95 , 95 , 96 , 96 , 97 , 97 , 98 , + 99 , 99 , 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, + 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112, + 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119, + 120, 120, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126, + 127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133, + 34, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, + 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, + 148, 149, 149, 150 +}; + +const unsigned char blue_lut[256] = { + 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 2 , + 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , + 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , + 5 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 7 , 7 , 7 , 7 , 7 , 7 , + 7 , 7 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 9 , 9 , 9 , 9 , 9 , + 9 , 9 , 9 , 9 , 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, + 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, + 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, + 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29 +}; + +#endif + + /* * Initialize for RGB->YCC colorspace conversion. */ @@ -191,26 +259,36 @@ rgb_gray_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; + #if BITS_IN_JSAMPLE != 8 register INT32 * ctab = cconvert->rgb_ycc_tab; + #endif register JSAMPROW inptr; register JSAMPROW outptr; + JSAMPLE *maxoutptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; + int rindex = rgb_red[cinfo->in_color_space]; + int gindex = rgb_green[cinfo->in_color_space]; + int bindex = rgb_blue[cinfo->in_color_space]; + int rgbstride = rgb_pixelsize[cinfo->in_color_space]; while (--num_rows >= 0) { inptr = *input_buf++; outptr = output_buf[0][output_row]; + maxoutptr = &outptr[num_cols]; output_row++; - for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[rgb_red[cinfo->in_color_space]]); - g = GETJSAMPLE(inptr[rgb_green[cinfo->in_color_space]]); - b = GETJSAMPLE(inptr[rgb_blue[cinfo->in_color_space]]); - inptr += rgb_pixelsize[cinfo->in_color_space]; + for (; outptr < maxoutptr; outptr++, inptr += rgbstride) { /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + #if BITS_IN_JSAMPLE == 8 + *outptr = red_lut[inptr[rindex]] + green_lut[inptr[gindex]] + + blue_lut[inptr[bindex]]; + #else + *outptr = (JSAMPLE) + ((ctab[GETJSAMPLE(inptr[rindex])+R_Y_OFF] + + ctab[GETJSAMPLE(inptr[gindex])+G_Y_OFF] + + ctab[GETJSAMPLE(inptr[bindex])+B_Y_OFF]) + >> SCALEBITS); + #endif } } } diff --git a/jdcolor.c b/jdcolor.c index 8e638c99..e02ea4f9 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -222,18 +222,21 @@ gray_rgb_convert (j_decompress_ptr cinfo, JSAMPARRAY output_buf, int num_rows) { register JSAMPROW inptr, outptr; + JSAMPLE *maxinptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; + int rindex = rgb_red[cinfo->out_color_space]; + int gindex = rgb_green[cinfo->out_color_space]; + int bindex = rgb_blue[cinfo->out_color_space]; + int rgbstride = rgb_pixelsize[cinfo->out_color_space]; while (--num_rows >= 0) { inptr = input_buf[0][input_row++]; + maxinptr = &inptr[num_cols]; outptr = *output_buf++; - for (col = 0; col < num_cols; col++) { + for (; inptr < maxinptr; inptr++, outptr += rgbstride) { /* We can dispense with GETJSAMPLE() here */ - outptr[rgb_red[cinfo->out_color_space]] = - outptr[rgb_green[cinfo->out_color_space]] = - outptr[rgb_blue[cinfo->out_color_space]] = inptr[col]; - outptr += rgb_pixelsize[cinfo->out_color_space]; + outptr[rindex] = outptr[gindex] = outptr[bindex] = *inptr; } } } From 5b3da6d4e3e7037cda3881e39d06cd5220896a84 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 28 Sep 2009 00:33:02 +0000 Subject: [PATCH 061/985] Greatly improve performance of Huffman decoding --- jdhuff.c | 347 ++++++++++++++++++++++++++++++++++++++++--------------- jdhuff.h | 21 ++-- 2 files changed, 269 insertions(+), 99 deletions(-) diff --git a/jdhuff.c b/jdhuff.c index b5ba39f7..18a0c7ef 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -14,6 +14,21 @@ * storage only upon successful completion of an MCU. */ +/* Modifications: + * Copyright (C)2007 Sun Microsystems, Inc. + * Copyright (C)2009 D. R. Commander + * + * This library is free software and may be redistributed and/or modified under + * the terms of the wxWindows Library License, Version 3.1 or (at your option) + * any later version. The full license is in the LICENSE.txt file included + * with this distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * wxWindows Library License for more details. + */ + #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" @@ -234,7 +249,8 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, * with that code. */ - MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits)); + for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++) + dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD; p = 0; for (l = 1; l <= HUFF_LOOKAHEAD; l++) { @@ -243,8 +259,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* Generate left-justified code followed by all possible bit sequences */ lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { - dtbl->look_nbits[lookbits] = l; - dtbl->look_sym[lookbits] = htbl->huffval[p]; + dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p]; lookbits++; } } @@ -438,9 +453,10 @@ jpeg_huff_decode (bitread_working_state * state, * On some machines, a shift and add will be faster than a table lookup. */ +#define AVOID_TABLES #ifdef AVOID_TABLES -#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) +#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((-1)<<(s)) + 1))) #else @@ -498,6 +514,236 @@ process_restart (j_decompress_ptr cinfo) } +LOCAL(boolean) +decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + BITREAD_STATE_VARS; + int blkn; + savable_state state; + /* Outer loop handles each block in the MCU */ + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(state, entropy->saved); + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + JBLOCKROW block = MCU_data[blkn]; + d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; + d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; + register int s, k, r; + + /* Decode a single block's worth of coefficients */ + + /* Section F.2.2.1: decode the DC coefficient difference */ + HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); + if (s) { + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + } + + if (entropy->dc_needed[blkn]) { + /* Convert DC difference to actual value, update last_dc_val */ + int ci = cinfo->MCU_membership[blkn]; + s += state.last_dc_val[ci]; + state.last_dc_val[ci] = s; + /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ + (*block)[0] = (JCOEF) s; + } + + if (entropy->ac_needed[blkn]) { + + /* Section F.2.2.2: decode the AC coefficients */ + /* Since zeroes are skipped, output area must be cleared beforehand */ + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE(s, br_state, actbl, return FALSE, label2); + + r = s >> 4; + s &= 15; + + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + /* Output coefficient in natural (dezigzagged) order. + * Note: the extra entries in jpeg_natural_order[] will save us + * if k >= DCTSIZE2, which could happen if the data is corrupted. + */ + (*block)[jpeg_natural_order[k]] = (JCOEF) s; + } else { + if (r != 15) + break; + k += 15; + } + } + + } else { + + /* Section F.2.2.2: decode the AC coefficients */ + /* In this path we just discard the values */ + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE(s, br_state, actbl, return FALSE, label3); + + r = s >> 4; + s &= 15; + + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + DROP_BITS(s); + } else { + if (r != 15) + break; + k += 15; + } + } + } + } + + /* Completed MCU, so update state */ + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(entropy->saved, state); + return TRUE; +} + + +/***************************************************************/ + +#define ADD_BYTE { \ + int val0 = *(buffer++); \ + int val1 = *(buffer); \ + \ + bits_left += 8; \ + get_buffer = (get_buffer << 8) | (val0); \ + if (val0 == 0xFF) { \ + buffer++; \ + if (val1 != 0) { \ + buffer -= 2; \ + get_buffer &= ~0xFF; \ + } \ + } \ +} + +/***************************************************************/ + +#if __WORDSIZE == 64 + +#define ENSURE_SHORT \ + if (bits_left < 16) { \ + ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE \ + } + +#else + +#define ENSURE_SHORT if (bits_left < 16) { ADD_BYTE ADD_BYTE } + +#endif + +/***************************************************************/ + +#define HUFF_DECODE_FAST(symbol, size, htbl) { \ + ENSURE_SHORT \ + symbol = PEEK_BITS(HUFF_LOOKAHEAD); \ + symbol = htbl->lookup[symbol]; \ + size = symbol >> 8; \ + bits_left -= size; \ + symbol = symbol & ((1 << HUFF_LOOKAHEAD) - 1); \ + if (size == HUFF_LOOKAHEAD + 1) { \ + symbol = (get_buffer >> bits_left) & ((1 << (size)) - 1); \ + while (symbol > htbl->maxcode[size]) { \ + symbol <<= 1; \ + symbol |= GET_BITS(1); \ + size++; \ + } \ + symbol = htbl->pub->huffval[ (int) (symbol + htbl->valoffset[size]) ]; \ + } \ +} + +/***************************************************************/ + +LOCAL(boolean) +decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + BITREAD_STATE_VARS; + JOCTET *buffer; + int blkn; + savable_state state; + /* Outer loop handles each block in the MCU */ + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + buffer = (JOCTET *) br_state.next_input_byte; + ASSIGN_STATE(state, entropy->saved); + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + JBLOCKROW block = MCU_data[blkn]; + d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; + d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; + register int s, k, r, l; + + HUFF_DECODE_FAST(s, l, dctbl); + if (s) { + ENSURE_SHORT + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + } + + if (entropy->dc_needed[blkn]) { + int ci = cinfo->MCU_membership[blkn]; + s += state.last_dc_val[ci]; + state.last_dc_val[ci] = s; + (*block)[0] = (JCOEF) s; + } + + if (entropy->ac_needed[blkn]) { + + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE_FAST(s, l, actbl); + r = s >> 4; + s &= 15; + + if (s) { + k += r; + ENSURE_SHORT + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + (*block)[jpeg_natural_order[k]] = (JCOEF) s; + } else { + if (r != 15) break; + k += 15; + } + } + + } else { + + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE_FAST(s, l, actbl); + r = s >> 4; + s &= 15; + + if (s) { + k += r; + ENSURE_SHORT + DROP_BITS(s); + } else { + if (r != 15) break; + k += 15; + } + } + } + } + + br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte); + br_state.next_input_byte = buffer; + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(entropy->saved, state); + return TRUE; +} + + /* * Decode and return one MCU's worth of Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, @@ -513,13 +759,12 @@ process_restart (j_decompress_ptr cinfo) * this module, since we'll just re-assign them on the next call.) */ +#define BUFSIZE (DCTSIZE2 * 2) + METHODDEF(boolean) decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) { huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; - int blkn; - BITREAD_STATE_VARS; - savable_state state; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { @@ -533,91 +778,13 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) */ if (! entropy->pub.insufficient_data) { - /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(state, entropy->saved); - - /* Outer loop handles each block in the MCU */ - - for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { - JBLOCKROW block = MCU_data[blkn]; - d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; - d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; - register int s, k, r; - - /* Decode a single block's worth of coefficients */ - - /* Section F.2.2.1: decode the DC coefficient difference */ - HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); - if (s) { - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - } - - if (entropy->dc_needed[blkn]) { - /* Convert DC difference to actual value, update last_dc_val */ - int ci = cinfo->MCU_membership[blkn]; - s += state.last_dc_val[ci]; - state.last_dc_val[ci] = s; - /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ - (*block)[0] = (JCOEF) s; - } - - if (entropy->ac_needed[blkn]) { - - /* Section F.2.2.2: decode the AC coefficients */ - /* Since zeroes are skipped, output area must be cleared beforehand */ - for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE(s, br_state, actbl, return FALSE, label2); - - r = s >> 4; - s &= 15; - - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - /* Output coefficient in natural (dezigzagged) order. - * Note: the extra entries in jpeg_natural_order[] will save us - * if k >= DCTSIZE2, which could happen if the data is corrupted. - */ - (*block)[jpeg_natural_order[k]] = (JCOEF) s; - } else { - if (r != 15) - break; - k += 15; - } - } - - } else { - - /* Section F.2.2.2: decode the AC coefficients */ - /* In this path we just discard the values */ - for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE(s, br_state, actbl, return FALSE, label3); - - r = s >> 4; - s &= 15; - - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - DROP_BITS(s); - } else { - if (r != 15) - break; - k += 15; - } - } - - } + if (cinfo->src->bytes_in_buffer >= BUFSIZE) { + if (!decode_mcu_fast(cinfo, MCU_data)) return FALSE; + } + else { + if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE; } - /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(entropy->saved, state); } /* Account for restart interval (no-op if not using restarts) */ diff --git a/jdhuff.h b/jdhuff.h index ae19b6ca..8e50bbfb 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -36,13 +36,17 @@ typedef struct { /* Link to public Huffman table (needed only in jpeg_huff_decode) */ JHUFF_TBL *pub; - /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of + /* Lookahead table: indexed by the next HUFF_LOOKAHEAD bits of * the input data stream. If the next Huffman code is no more * than HUFF_LOOKAHEAD bits long, we can obtain its length and - * the corresponding symbol directly from these tables. + * the corresponding symbol directly from this tables. + * + * The lower 8 bits of each table entry contain the number of + * bits in the corresponding Huffman code, or HUFF_LOOKAHEAD + 1 + * if too long. The next 8 bits of each entry contain the + * symbol. */ - int look_nbits[1< 32 bits on your machine, and shifting/masking longs is * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE @@ -183,11 +187,10 @@ EXTERN(boolean) jpeg_fill_bit_buffer } \ } \ look = PEEK_BITS(HUFF_LOOKAHEAD); \ - if ((nb = htbl->look_nbits[look]) != 0) { \ + if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \ DROP_BITS(nb); \ - result = htbl->look_sym[look]; \ + result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \ } else { \ - nb = HUFF_LOOKAHEAD+1; \ slowlabel: \ if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ { failaction; } \ From 4d289a491204e59f7cbb49c211aa2650ac337126 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 28 Sep 2009 08:19:40 +0000 Subject: [PATCH 062/985] Not all platforms define __WORDSIZE --- jdhuff.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jdhuff.h b/jdhuff.h index 8e50bbfb..a7c8188f 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -73,8 +73,17 @@ EXTERN(void) jpeg_make_d_derived_tbl * necessary. */ -typedef long bit_buf_type; /* type of bit-extraction buffer */ -#define BIT_BUF_SIZE __WORDSIZE /* size of buffer in bits */ +#if __WORDSIZE == 64 + +typedef long bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 64 /* size of buffer in bits */ + +#else + +typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 32 /* size of buffer in bits */ + +#endif /* If long is > 32 bits on your machine, and shifting/masking longs is * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE From 9a6243c91339220f0769235170c5951febde056c Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 1 Oct 2009 22:26:14 +0000 Subject: [PATCH 063/985] Some systems (notably OS X Leopard) have fls() already, so rename ours to avoid conflict --- jcdctmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jcdctmgr.c b/jcdctmgr.c index 67f82280..156957ab 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -73,7 +73,7 @@ typedef my_fdct_controller * my_fdct_ptr; * Find the highest bit in an integer through binary search. */ LOCAL(int) -fls (UINT16 val) +flss (UINT16 val) { int bit; @@ -167,7 +167,7 @@ compute_reciprocal (UINT16 divisor, DCTELEM * dtbl) UDCTELEM c; int b, r; - b = fls(divisor) - 1; + b = flss(divisor) - 1; r = sizeof(DCTELEM) * 8 + b; fq = ((UDCTELEM2)1 << r) / divisor; From b2c532f62d335a4725720df736f5dcd9f4c02c28 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 8 Oct 2009 09:04:56 +0000 Subject: [PATCH 064/985] Work around alignment issue with OS X linker which was causing problems on Leopard and Snow Leopard --- simd/jcclrmmx.asm | 3 +++ simd/jcclrss2-64.asm | 3 +++ simd/jcclrss2.asm | 3 +++ simd/jcqnt3dn.asm | 3 +++ simd/jcqntmmx.asm | 3 +++ simd/jcqnts2f-64.asm | 4 ++++ simd/jcqnts2f.asm | 3 +++ simd/jcqnts2i-64.asm | 4 ++++ simd/jcqnts2i.asm | 3 +++ simd/jcqntsse.asm | 3 +++ simd/jcsammmx.asm | 3 +++ simd/jcsamss2-64.asm | 4 ++++ simd/jcsamss2.asm | 3 +++ simd/jdclrmmx.asm | 3 +++ simd/jdclrss2-64.asm | 4 ++++ simd/jdclrss2.asm | 3 +++ simd/jdmrgmmx.asm | 3 +++ simd/jdmrgss2-64.asm | 4 ++++ simd/jdmrgss2.asm | 3 +++ simd/jdsammmx.asm | 3 +++ simd/jdsamss2-64.asm | 4 ++++ simd/jdsamss2.asm | 3 +++ simd/jf3dnflt.asm | 3 +++ simd/jfmmxfst.asm | 3 +++ simd/jfmmxint.asm | 3 +++ simd/jfss2fst-64.asm | 4 ++++ simd/jfss2fst.asm | 3 +++ simd/jfss2int-64.asm | 4 ++++ simd/jfss2int.asm | 3 +++ simd/jfsseflt-64.asm | 4 ++++ simd/jfsseflt.asm | 3 +++ simd/ji3dnflt.asm | 3 +++ simd/jimmxfst.asm | 3 +++ simd/jimmxint.asm | 3 +++ simd/jimmxred.asm | 3 +++ simd/jiss2flt-64.asm | 4 ++++ simd/jiss2flt.asm | 3 +++ simd/jiss2fst-64.asm | 4 ++++ simd/jiss2fst.asm | 3 +++ simd/jiss2int-64.asm | 4 ++++ simd/jiss2int.asm | 3 +++ simd/jiss2red-64.asm | 4 ++++ simd/jiss2red.asm | 3 +++ simd/jisseflt.asm | 3 +++ simd/jsimdcpu.asm | 3 +++ 45 files changed, 148 insertions(+) diff --git a/simd/jcclrmmx.asm b/simd/jcclrmmx.asm index 34c4224f..b6b89121 100644 --- a/simd/jcclrmmx.asm +++ b/simd/jcclrmmx.asm @@ -474,3 +474,6 @@ EXTN(jsimd_rgb_ycc_convert_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm index f2cd8f4e..31c5be62 100644 --- a/simd/jcclrss2-64.asm +++ b/simd/jcclrss2-64.asm @@ -482,3 +482,6 @@ EXTN(jsimd_rgb_ycc_convert_sse2): pop rbp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcclrss2.asm b/simd/jcclrss2.asm index d6f868c5..8def718c 100644 --- a/simd/jcclrss2.asm +++ b/simd/jcclrss2.asm @@ -500,3 +500,6 @@ EXTN(jsimd_rgb_ycc_convert_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqnt3dn.asm b/simd/jcqnt3dn.asm index 194b7f9b..182c8695 100644 --- a/simd/jcqnt3dn.asm +++ b/simd/jcqnt3dn.asm @@ -228,3 +228,6 @@ EXTN(jsimd_quantize_float_3dnow): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqntmmx.asm b/simd/jcqntmmx.asm index fa54902a..08b08b79 100644 --- a/simd/jcqntmmx.asm +++ b/simd/jcqntmmx.asm @@ -269,3 +269,6 @@ EXTN(jsimd_quantize_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqnts2f-64.asm b/simd/jcqnts2f-64.asm index 51d63076..e09387ca 100644 --- a/simd/jcqnts2f-64.asm +++ b/simd/jcqnts2f-64.asm @@ -150,3 +150,7 @@ EXTN(jsimd_quantize_float_sse2): uncollect_args pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqnts2f.asm b/simd/jcqnts2f.asm index 19c1d017..d80ae5dc 100644 --- a/simd/jcqnts2f.asm +++ b/simd/jcqnts2f.asm @@ -166,3 +166,6 @@ EXTN(jsimd_quantize_float_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqnts2i-64.asm b/simd/jcqnts2i-64.asm index d5615901..4568dfc3 100644 --- a/simd/jcqnts2i-64.asm +++ b/simd/jcqnts2i-64.asm @@ -179,3 +179,7 @@ EXTN(jsimd_quantize_sse2): uncollect_args pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqnts2i.asm b/simd/jcqnts2i.asm index 404ae957..0864d6ed 100644 --- a/simd/jcqnts2i.asm +++ b/simd/jcqnts2i.asm @@ -195,3 +195,6 @@ EXTN(jsimd_quantize_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcqntsse.asm b/simd/jcqntsse.asm index 0f412d7e..3065eca8 100644 --- a/simd/jcqntsse.asm +++ b/simd/jcqntsse.asm @@ -206,3 +206,6 @@ EXTN(jsimd_quantize_float_sse): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcsammmx.asm b/simd/jcsammmx.asm index 982a6e0d..c7126a0d 100644 --- a/simd/jcsammmx.asm +++ b/simd/jcsammmx.asm @@ -319,3 +319,6 @@ EXTN(jsimd_h2v2_downsample_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcsamss2-64.asm b/simd/jcsamss2-64.asm index cf7a776b..29c3f4f9 100644 --- a/simd/jcsamss2-64.asm +++ b/simd/jcsamss2-64.asm @@ -322,3 +322,7 @@ EXTN(jsimd_h2v2_downsample_sse2): uncollect_args pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jcsamss2.asm b/simd/jcsamss2.asm index 98e97da4..818e911d 100644 --- a/simd/jcsamss2.asm +++ b/simd/jcsamss2.asm @@ -346,3 +346,6 @@ EXTN(jsimd_h2v2_downsample_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdclrmmx.asm b/simd/jdclrmmx.asm index 09f72ca3..79772e0c 100644 --- a/simd/jdclrmmx.asm +++ b/simd/jdclrmmx.asm @@ -402,3 +402,6 @@ EXTN(jsimd_ycc_rgb_convert_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm index c3c1b07c..ea9d2ac5 100644 --- a/simd/jdclrss2-64.asm +++ b/simd/jdclrss2-64.asm @@ -481,3 +481,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm index 06a9adee..865fa824 100644 --- a/simd/jdclrss2.asm +++ b/simd/jdclrss2.asm @@ -500,3 +500,6 @@ EXTN(jsimd_ycc_rgb_convert_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdmrgmmx.asm b/simd/jdmrgmmx.asm index 08b0985d..f5fa9363 100644 --- a/simd/jdmrgmmx.asm +++ b/simd/jdmrgmmx.asm @@ -461,3 +461,6 @@ EXTN(jsimd_h2v2_merged_upsample_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm index 6329f950..3e54c7ae 100644 --- a/simd/jdmrgss2-64.asm +++ b/simd/jdmrgss2-64.asm @@ -563,3 +563,7 @@ EXTN(jsimd_h2v2_merged_upsample_sse2): pop rbx pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdmrgss2.asm b/simd/jdmrgss2.asm index 5018a236..99b7eb9f 100644 --- a/simd/jdmrgss2.asm +++ b/simd/jdmrgss2.asm @@ -559,3 +559,6 @@ EXTN(jsimd_h2v2_merged_upsample_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdsammmx.asm b/simd/jdsammmx.asm index e05d540e..c09e5b96 100644 --- a/simd/jdsammmx.asm +++ b/simd/jdsammmx.asm @@ -732,3 +732,6 @@ EXTN(jsimd_h2v2_upsample_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdsamss2-64.asm b/simd/jdsamss2-64.asm index 143a97a2..85214912 100644 --- a/simd/jdsamss2-64.asm +++ b/simd/jdsamss2-64.asm @@ -662,3 +662,7 @@ EXTN(jsimd_h2v2_upsample_sse2): pop rbx pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jdsamss2.asm b/simd/jdsamss2.asm index 7d787f1c..b5c863b4 100644 --- a/simd/jdsamss2.asm +++ b/simd/jdsamss2.asm @@ -724,3 +724,6 @@ EXTN(jsimd_h2v2_upsample_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jf3dnflt.asm b/simd/jf3dnflt.asm index ed7e6a0b..542672dc 100644 --- a/simd/jf3dnflt.asm +++ b/simd/jf3dnflt.asm @@ -315,3 +315,6 @@ EXTN(jsimd_fdct_float_3dnow): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfmmxfst.asm b/simd/jfmmxfst.asm index 3511457d..0647242a 100644 --- a/simd/jfmmxfst.asm +++ b/simd/jfmmxfst.asm @@ -392,3 +392,6 @@ EXTN(jsimd_fdct_ifast_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfmmxint.asm b/simd/jfmmxint.asm index e018e6bf..a7e73f73 100644 --- a/simd/jfmmxint.asm +++ b/simd/jfmmxint.asm @@ -617,3 +617,6 @@ EXTN(jsimd_fdct_islow_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfss2fst-64.asm b/simd/jfss2fst-64.asm index b6a06bc1..c99acc2f 100644 --- a/simd/jfss2fst-64.asm +++ b/simd/jfss2fst-64.asm @@ -386,3 +386,7 @@ EXTN(jsimd_fdct_ifast_sse2): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfss2fst.asm b/simd/jfss2fst.asm index f0ad9621..73fc9e51 100644 --- a/simd/jfss2fst.asm +++ b/simd/jfss2fst.asm @@ -399,3 +399,6 @@ EXTN(jsimd_fdct_ifast_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfss2int-64.asm b/simd/jfss2int-64.asm index 5fc4ac85..b8ec4b54 100644 --- a/simd/jfss2int-64.asm +++ b/simd/jfss2int-64.asm @@ -616,3 +616,7 @@ EXTN(jsimd_fdct_islow_sse2): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfss2int.asm b/simd/jfss2int.asm index 5338db32..5e3f2aaa 100644 --- a/simd/jfss2int.asm +++ b/simd/jfss2int.asm @@ -629,3 +629,6 @@ EXTN(jsimd_fdct_islow_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfsseflt-64.asm b/simd/jfsseflt-64.asm index 859ff54f..0f3e21a6 100644 --- a/simd/jfsseflt-64.asm +++ b/simd/jfsseflt-64.asm @@ -352,3 +352,7 @@ EXTN(jsimd_fdct_float_sse): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jfsseflt.asm b/simd/jfsseflt.asm index 9b8d04ce..bc54cccd 100644 --- a/simd/jfsseflt.asm +++ b/simd/jfsseflt.asm @@ -365,3 +365,6 @@ EXTN(jsimd_fdct_float_sse): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/ji3dnflt.asm b/simd/ji3dnflt.asm index 6c9abca7..dc2076f4 100644 --- a/simd/ji3dnflt.asm +++ b/simd/ji3dnflt.asm @@ -447,3 +447,6 @@ EXTN(jsimd_idct_float_3dnow): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jimmxfst.asm b/simd/jimmxfst.asm index e5802ace..3b055727 100644 --- a/simd/jimmxfst.asm +++ b/simd/jimmxfst.asm @@ -495,3 +495,6 @@ EXTN(jsimd_idct_ifast_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jimmxint.asm b/simd/jimmxint.asm index 563f41c5..7b52fae3 100644 --- a/simd/jimmxint.asm +++ b/simd/jimmxint.asm @@ -847,3 +847,6 @@ EXTN(jsimd_idct_islow_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jimmxred.asm b/simd/jimmxred.asm index 4ee34a0a..a2b7103d 100644 --- a/simd/jimmxred.asm +++ b/simd/jimmxred.asm @@ -701,3 +701,6 @@ EXTN(jsimd_idct_2x2_mmx): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2flt-64.asm b/simd/jiss2flt-64.asm index a3d4a549..0e8522db 100644 --- a/simd/jiss2flt-64.asm +++ b/simd/jiss2flt-64.asm @@ -477,3 +477,7 @@ EXTN(jsimd_idct_float_sse2): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2flt.asm b/simd/jiss2flt.asm index fc9e21a2..17bc3633 100644 --- a/simd/jiss2flt.asm +++ b/simd/jiss2flt.asm @@ -493,3 +493,6 @@ EXTN(jsimd_idct_float_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2fst-64.asm b/simd/jiss2fst-64.asm index ab6af50c..8b664a67 100644 --- a/simd/jiss2fst-64.asm +++ b/simd/jiss2fst-64.asm @@ -486,3 +486,7 @@ EXTN(jsimd_idct_ifast_sse2): pop rbp ret ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2fst.asm b/simd/jiss2fst.asm index fda073f5..b53664d7 100644 --- a/simd/jiss2fst.asm +++ b/simd/jiss2fst.asm @@ -497,3 +497,6 @@ EXTN(jsimd_idct_ifast_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2int-64.asm b/simd/jiss2int-64.asm index 97317af7..82da0a71 100644 --- a/simd/jiss2int-64.asm +++ b/simd/jiss2int-64.asm @@ -842,3 +842,7 @@ EXTN(jsimd_idct_islow_sse2): pop rsp ; rsp <- original rbp pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2int.asm b/simd/jiss2int.asm index d568dada..adf39fb3 100644 --- a/simd/jiss2int.asm +++ b/simd/jiss2int.asm @@ -854,3 +854,6 @@ EXTN(jsimd_idct_islow_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2red-64.asm b/simd/jiss2red-64.asm index dcf745bd..85ba9415 100644 --- a/simd/jiss2red-64.asm +++ b/simd/jiss2red-64.asm @@ -569,3 +569,7 @@ EXTN(jsimd_idct_2x2_sse2): pop rbx pop rbp ret + +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jiss2red.asm b/simd/jiss2red.asm index 10046e9a..238c61d0 100644 --- a/simd/jiss2red.asm +++ b/simd/jiss2red.asm @@ -589,3 +589,6 @@ EXTN(jsimd_idct_2x2_sse2): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jisseflt.asm b/simd/jisseflt.asm index db9d1a39..d6147c12 100644 --- a/simd/jisseflt.asm +++ b/simd/jisseflt.asm @@ -567,3 +567,6 @@ EXTN(jsimd_idct_float_sse): pop ebp ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index 31f2a6ac..bdbcc231 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -100,3 +100,6 @@ EXTN(jpeg_simd_cpu_support): pop ebx ret +; For some reason, the OS X linker does not honor the request to align the +; segment unless we do this. + align 16 From 1fee9f05fb4d71a8c16e631b9449912698745fb3 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 8 Oct 2009 09:41:39 +0000 Subject: [PATCH 065/985] Enable 64-bit build on Snow Leopard --- acinclude.m4 | 10 +++++++++- simd/jsimd_x86_64.c | 2 +- simd/nasm_lt.sh | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f7d7b690..9b8d3125 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -44,7 +44,14 @@ case "$host_os" in objfmt='ELF' ;; darwin* | rhapsody* | nextstep* | openstep* | macos*) - objfmt='Mach-O' + case "$host_cpu" in + x86_64) + objfmt='Mach-O64' + ;; + *) + objfmt='Mach-O' + ;; + esac ;; *) objfmt='ELF ?' @@ -68,6 +75,7 @@ case "$objfmt" in ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';; RDF) NAFLAGS='-frdf -DRDF';; Mach-O) NAFLAGS='-fmacho -DMACHO';; + Mach-O64) NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';; esac AC_MSG_RESULT([$NAFLAGS]) AC_SUBST([NAFLAGS]) diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c index 4c1ef7d1..0da564c4 100644 --- a/simd/jsimd_x86_64.c +++ b/simd/jsimd_x86_64.c @@ -24,7 +24,7 @@ * In the PIC cases, we have no guarantee that constants will keep * their alignment. This macro allows us to verify it at runtime. */ -#define IS_ALIGNED(ptr, order) (((unsigned)ptr & ((1 << order) - 1)) == 0) +#define IS_ALIGNED(ptr, order) (((unsigned long)ptr & ((1 << order) - 1)) == 0) #define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */ diff --git a/simd/nasm_lt.sh b/simd/nasm_lt.sh index 68893b70..b112862a 100755 --- a/simd/nasm_lt.sh +++ b/simd/nasm_lt.sh @@ -12,7 +12,7 @@ while [ $# -gt 0 ]; do fi ;; -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \ - -fobj|-fwin32|-frdf|-fieee|-fmacho) + -fobj|-fwin32|-frdf|-fieee|-fmacho|-fmacho64) # it's a file format specifier for nasm. command="$command $1" ;; From 63c18bbe6cab5424b14470430ea3f40e3be8c1e0 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Wed, 27 Jan 2010 10:10:23 +0000 Subject: [PATCH 066/985] [Bugfix] Mark stack as non-executable in NASM code. --- simd/jsimdext.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 878f0456..46953603 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -53,6 +53,9 @@ ; * *BSD family Unix using elf format ; * Unix System V, including Solaris x86, UnixWare and SCO Unix +; mark stack as non-executable +section .note.GNU-stack noalloc noexec nowrite progbits + ; -- segment definition -- ; %ifdef __x86_64__ From 49933cde4764c3a24b4f26b5b045bc43b1a813a8 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 28 Jan 2010 05:34:53 +0000 Subject: [PATCH 067/985] Allow building libjpeg.so if --enable-shared is passed to configure (but disable shared library build by default) --- Makefile.am | 9 +++++++++ configure.ac | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Makefile.am b/Makefile.am index 26fe44c5..bafa3d49 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,13 @@ +if WITH_SHARED + +lib_LTLIBRARIES = libjpeg.la + +else + noinst_LTLIBRARIES = libjpeg.la + +endif + noinst_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ diff --git a/configure.ac b/configure.ac index 0b371329..6ef2b89e 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,8 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) # Don't use undefined types AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) +AC_DISABLE_SHARED + # Checks for programs. AC_PROG_CPP AC_PROG_CC @@ -113,6 +115,7 @@ fi AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) +AM_CONDITIONAL([WITH_SHARED], [test "x$enable_shared" != "xno"]) # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our From 7d3a698e525e4ffb8db676a85a782770e9608684 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 28 Jan 2010 22:18:41 +0000 Subject: [PATCH 068/985] Use the correct version to name the shared library, and if the shared library build is enabled, allow the headers to be installed --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index bafa3d49..53e6a434 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,15 +1,16 @@ if WITH_SHARED lib_LTLIBRARIES = libjpeg.la +libjpeg_la_LDFLAGS = -version-number 62:0:0 -no-undefined +include_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h else noinst_LTLIBRARIES = libjpeg.la +noinst_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h endif -noinst_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h - HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h turbojpeg.h From 4f2536e18722e540ae38dc43356085039b5fa6a9 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 28 Jan 2010 23:57:53 +0000 Subject: [PATCH 069/985] Enable 64-bit libjpeg/SIMD build on Solaris --- acinclude.m4 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 9b8d3125..e8d7d084 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -41,7 +41,14 @@ case "$host_os" in fi ;; solaris* | sunos* | sysv* | sco*) - objfmt='ELF' + case "$host_cpu" in + x86_64) + objfmt='ELF64' + ;; + *) + objfmt='ELF' + ;; + esac ;; darwin* | rhapsody* | nextstep* | openstep* | macos*) case "$host_cpu" in From 05e874048bc1574217e930fa328f9d9166d06baa Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 29 Jan 2010 07:14:57 +0000 Subject: [PATCH 070/985] Fix build problems on Solaris 10 --- simd/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/Makefile.am b/simd/Makefile.am index 0f1d125d..0ccc9380 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -53,5 +53,5 @@ endif $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ jsimdcfg.inc: jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) $< | grep ^[\;%] | sed 's%_cpp_protection_%%' > $@ + $(CPP) jsimdcfg.inc.h | $(GREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ From c61c02e031d90991e0c3185c671b0bbc69c91e72 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 5 Feb 2010 09:19:13 +0000 Subject: [PATCH 071/985] Oops. Use EGREP instead of GREP, because GREP is not available in earlier versions of autotools --- simd/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/Makefile.am b/simd/Makefile.am index 0ccc9380..1df61431 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -53,5 +53,5 @@ endif $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ jsimdcfg.inc: jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) jsimdcfg.inc.h | $(GREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ + $(CPP) jsimdcfg.inc.h | $(EGREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ From 2e069ba879a3c40de86f3275bb14bc7accc8b262 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 11 Feb 2010 06:39:32 +0000 Subject: [PATCH 072/985] Build shared libraries by default; Include libturbojpeg in distribution --- Makefile.am | 29 ++++++++++++----------------- configure.ac | 3 --- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index 53e6a434..fa45db7b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,18 +1,9 @@ -if WITH_SHARED - -lib_LTLIBRARIES = libjpeg.la +lib_LTLIBRARIES = libjpeg.la libturbojpeg.la libjpeg_la_LDFLAGS = -version-number 62:0:0 -no-undefined -include_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h - -else - -noinst_LTLIBRARIES = libjpeg.la -noinst_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h - -endif +include_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h turbojpeg.h HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ - jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h turbojpeg.h + jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ @@ -23,28 +14,32 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \ jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c +libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h + if WITH_SIMD SUBDIRS = simd libjpeg_la_LIBADD = simd/libsimd.la +libturbojpeg_la_LIBADD = simd/libsimd.la else libjpeg_la_SOURCES += jsimd_none.c +libturbojpeg_la_SOURCES += jsimd_none.c endif -TSTHDRS = turbojpeg.h rrutil.h rrtimer.h +TSTHDRS = rrutil.h rrtimer.h noinst_PROGRAMS = jpgtest jpegut cjpeg djpeg -jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c turbojpegl.c +jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c -jpgtest_LDADD = $(top_srcdir)/libjpeg.la +jpgtest_LDADD = $(top_srcdir)/libturbojpeg.la -jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c turbojpegl.c +jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c -jpegut_LDADD = $(top_srcdir)/libjpeg.la +jpegut_LDADD = $(top_srcdir)/libturbojpeg.la cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \ rdppm.c rdswitch.c rdtarga.c diff --git a/configure.ac b/configure.ac index 6ef2b89e..0b371329 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,6 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) # Don't use undefined types AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) -AC_DISABLE_SHARED - # Checks for programs. AC_PROG_CPP AC_PROG_CC @@ -115,7 +113,6 @@ fi AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) -AM_CONDITIONAL([WITH_SHARED], [test "x$enable_shared" != "xno"]) # jconfig.h is the file we use, but we have another before that to # fool autoheader. the reason is that we include this header in our From 4c1c7f5a528590a56c7fc5627b1953adf1963b86 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 11 Feb 2010 06:57:57 +0000 Subject: [PATCH 073/985] Make SIMD build compulsory (otherwise, what's the point?) --- Makefile.am | 9 --------- configure.ac | 46 ++++++++++++++++++---------------------------- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/Makefile.am b/Makefile.am index fa45db7b..8545a1af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,19 +16,10 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h -if WITH_SIMD - SUBDIRS = simd libjpeg_la_LIBADD = simd/libsimd.la libturbojpeg_la_LIBADD = simd/libsimd.la -else - -libjpeg_la_SOURCES += jsimd_none.c -libturbojpeg_la_SOURCES += jsimd_none.c - -endif - TSTHDRS = rrutil.h rrtimer.h noinst_PROGRAMS = jpgtest jpegut cjpeg djpeg diff --git a/configure.ac b/configure.ac index 0b371329..b54b8f3c 100644 --- a/configure.ac +++ b/configure.ac @@ -82,35 +82,25 @@ case "$host_os" in esac AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"]) -# SIMD is optional -AC_ARG_WITH([simd], - AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) -if test "x${with_simd}" != "xno"; then - # Check if we're on a supported CPU - AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) - case "$host_cpu" in - x86_64) - AC_MSG_RESULT([yes (x86_64)]) - AC_PROG_NASM - simd_arch=x86_64 - ;; - i*86 | x86 | ia32) - AC_MSG_RESULT([yes (i386)]) - AC_PROG_NASM - simd_arch=i386 - ;; - *) - AC_MSG_RESULT([no ("$host_cpu")]) - with_simd=no - ;; - esac +# Check if we're on a supported CPU +AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) +case "$host_cpu" in + x86_64) + AC_MSG_RESULT([yes (x86_64)]) + AC_PROG_NASM + simd_arch=x86_64 + ;; + i*86 | x86 | ia32) + AC_MSG_RESULT([yes (i386)]) + AC_PROG_NASM + simd_arch=i386 + ;; + *) + AC_MSG_RESULT([no ("$host_cpu")]) + AC_MSG_ERROR([CPU is not supported]) + ;; +esac - if test "x${with_simd}" != "xno"; then - AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) - fi -fi - -AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) From 3ca410784c0d8c50440f5c0d2585b78f4e296f8a Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 04:28:29 +0000 Subject: [PATCH 074/985] Oops. Still need to #define WITH_SIMD --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index b54b8f3c..a969262c 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,8 @@ case "$host_cpu" in ;; esac +AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) From 444950fec8a0974ae0af103d5b7b5deba972b962 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 04:34:41 +0000 Subject: [PATCH 075/985] Do not build libturbojpeg as a versioned library --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 8545a1af..dbe29e0d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ lib_LTLIBRARIES = libjpeg.la libturbojpeg.la libjpeg_la_LDFLAGS = -version-number 62:0:0 -no-undefined +libturbojpeg_la_LDFLAGS = -avoid-version -no-undefined include_HEADERS = jconfig.h jerror.h jmorecfg.h jpeglib.h turbojpeg.h HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ From f222c7547c1a9c6fb3ad00373588a700f8724429 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 05:37:07 +0000 Subject: [PATCH 076/985] Restore --without-simd option for testing purposes --- Makefile.am | 8 ++++++++ configure.ac | 46 +++++++++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index dbe29e0d..81c6d6b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,18 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h +if WITH_SIMD + SUBDIRS = simd libjpeg_la_LIBADD = simd/libsimd.la libturbojpeg_la_LIBADD = simd/libsimd.la +else + +libjpeg_la_SOURCES += jsimd_none.c + +endif + TSTHDRS = rrutil.h rrtimer.h noinst_PROGRAMS = jpgtest jpegut cjpeg djpeg diff --git a/configure.ac b/configure.ac index a969262c..cd324451 100644 --- a/configure.ac +++ b/configure.ac @@ -82,27 +82,35 @@ case "$host_os" in esac AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"]) -# Check if we're on a supported CPU -AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) -case "$host_cpu" in - x86_64) - AC_MSG_RESULT([yes (x86_64)]) - AC_PROG_NASM - simd_arch=x86_64 - ;; - i*86 | x86 | ia32) - AC_MSG_RESULT([yes (i386)]) - AC_PROG_NASM - simd_arch=i386 - ;; - *) - AC_MSG_RESULT([no ("$host_cpu")]) - AC_MSG_ERROR([CPU is not supported]) - ;; -esac +# SIMD is optional +AC_ARG_WITH([simd], + AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.])) +if test "x${with_simd}" != "xno"; then + # Check if we're on a supported CPU + AC_MSG_CHECKING([if we have SIMD optimisations for cpu type]) + case "$host_cpu" in + x86_64) + AC_MSG_RESULT([yes (x86_64)]) + AC_PROG_NASM + simd_arch=x86_64 + ;; + i*86 | x86 | ia32) + AC_MSG_RESULT([yes (i386)]) + AC_PROG_NASM + simd_arch=i386 + ;; + *) + AC_MSG_RESULT([no ("$host_cpu")]) + AC_MSG_ERROR([CPU is not supported]) + ;; + esac -AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + if test "x${with_simd}" != "xno"; then + AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.]) + fi +fi +AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"]) AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) From 392b89a5a556481fbd64bb72be263d44d2b08727 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 06:27:34 +0000 Subject: [PATCH 077/985] Clean up test detritus --- Makefile.am | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 43b5f98a..ffa4d178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,8 +69,7 @@ wrjpgcom_SOURCES = wrjpgcom.c wrjpgcom_LDADD = $(top_srcdir)/libjpeg.la -test: cjpeg djpeg jpegtran - $(RM) testout* +test: testclean cjpeg djpeg jpegtran $(top_srcdir)/jpegut $(top_srcdir)/djpeg -dct int -ppm -outfile testout.ppm $(top_srcdir)/testorig.jpg $(top_srcdir)/djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(top_srcdir)/testorig.jpg @@ -84,3 +83,18 @@ test: cjpeg djpeg jpegtran cmp $(top_srcdir)/testimg.ppm testoutp.ppm cmp $(top_srcdir)/testimgp.jpg testoutp.jpg cmp $(top_srcdir)/testorig.jpg testoutt.jpg + +testclean: + $(RM) testout* + $(RM) *_GRAYQ[0-9]*.bmp + $(RM) *_GRAYQ[0-9]*.ppm + $(RM) *_GRAYQ[0-9]*.jpg + $(RM) *_420Q[0-9]*.bmp + $(RM) *_420Q[0-9]*.ppm + $(RM) *_420Q[0-9]*.jpg + $(RM) *_422Q[0-9]*.bmp + $(RM) *_422Q[0-9]*.ppm + $(RM) *_422Q[0-9]*.jpg + $(RM) *_444Q[0-9]*.bmp + $(RM) *_444Q[0-9]*.ppm + $(RM) *_444Q[0-9]*.jpg From c65c17f5ea0657a604758a43ca5420cb7f446a82 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 09:37:20 +0000 Subject: [PATCH 078/985] Visual C++ build --- win/Makefile | 216 +++++++++++++++++++++++++++++++++++++++++++++++ win/Makerules | 39 +++++++++ win/jpeg.def | 103 ++++++++++++++++++++++ win/jsimdcfg.inc | 69 +++++++++++++++ 4 files changed, 427 insertions(+) create mode 100755 win/Makefile create mode 100755 win/Makerules create mode 100755 win/jpeg.def create mode 100755 win/jsimdcfg.inc diff --git a/win/Makefile b/win/Makefile new file mode 100755 index 00000000..ebcc43df --- /dev/null +++ b/win/Makefile @@ -0,0 +1,216 @@ +vpath %.c simd +vpath %.asm simd + +include win/Makerules + +TARGETS = jpeg62.dll \ + jpeg.lib \ + jpeg-static.lib \ + cjpeg.exe \ + djpeg.exe \ + jpegtran.exe \ + rdjpgcom.exe \ + wrjpgcom.exe \ + turbojpeg.dll \ + turbojpeg.lib \ + turbojpeg-static.lib \ + jpgtest.exe \ + jpegut.exe + +LOBJS = jcapimin.obj \ + jcapistd.obj \ + jccoefct.obj \ + jccolor.obj \ + jcdctmgr.obj \ + jchuff.obj \ + jcinit.obj \ + jcmainct.obj \ + jcmarker.obj \ + jcmaster.obj \ + jcomapi.obj \ + jcparam.obj \ + jcphuff.obj \ + jcprepct.obj \ + jcsample.obj \ + jctrans.obj \ + jdapimin.obj \ + jdapistd.obj \ + jdatadst.obj \ + jdatasrc.obj \ + jdcoefct.obj \ + jdcolor.obj \ + jddctmgr.obj \ + jdhuff.obj \ + jdinput.obj \ + jdmainct.obj \ + jdmarker.obj \ + jdmaster.obj \ + jdmerge.obj \ + jdphuff.obj \ + jdpostct.obj \ + jdsample.obj \ + jdtrans.obj \ + jerror.obj \ + jfdctflt.obj \ + jfdctfst.obj \ + jfdctint.obj \ + jidctflt.obj \ + jidctfst.obj \ + jidctint.obj \ + jidctred.obj \ + jquant1.obj \ + jquant2.obj \ + jutils.obj \ + jmemmgr.obj \ + jmemnobs.obj + +ifeq ($(WITH_SIMD), yes) + + SIMD_OBJS = jsimd_i386.obj \ + jsimdcpu.obj \ + jccolmmx.obj \ + jdcolmmx.obj \ + jcsammmx.obj \ + jdsammmx.obj \ + jdmermmx.obj \ + jcqntmmx.obj \ + jfmmxfst.obj \ + jfmmxint.obj \ + jimmxred.obj \ + jimmxint.obj \ + jimmxfst.obj \ + jcqnt3dn.obj \ + jf3dnflt.obj \ + ji3dnflt.obj \ + jcqntsse.obj \ + jfsseflt.obj \ + jisseflt.obj \ + jccolss2.obj \ + jdcolss2.obj \ + jcsamss2.obj \ + jdsamss2.obj \ + jdmerss2.obj \ + jcqnts2i.obj \ + jfss2fst.obj \ + jfss2int.obj \ + jiss2red.obj \ + jiss2int.obj \ + jiss2fst.obj \ + jcqnts2f.obj \ + jiss2flt.obj + + LOBJS := $(LOBJS) $(SIMD_OBJS) + +else + + LOBJS := $(LOBJS) jsimd_none.obj + +endif + +OBJS := $(LOBJS) \ + cdjpeg.obj \ + cjpeg.obj \ + djpeg.obj \ + jpegtran.obj \ + rdbmp.obj \ + rdcolmap.obj \ + rdgif.obj \ + rdjpgcom.obj \ + rdppm.obj \ + rdtarga.obj \ + rdswitch.obj \ + rdtarga.obj \ + transupp.obj \ + wrbmp.obj \ + wrgif.obj \ + wrppm.obj \ + wrtarga.obj \ + wrjpgcom.obj \ + turbojpegl.obj \ + jpgtest.obj \ + jpegut.obj \ + bmp.obj + +all: $(TARGETS) + +clean: + -$(RM) $(TARGETS) $(OBJS) + +HDRS := $(wildcard *.h) +$(OBJS): $(HDRS) + +ifeq ($(WITH_SIMD), yes) + SIMD_HDRS := $(wildcard simd/*.inc) + $(SIMD_OBJS): $(SIMD_HDRS) +endif + + + +jpeg-static.lib: $(LOBJS) + $(AR) -out:$@ $^ + +jpeg62.dll jpeg.lib: $(LOBJS) win/jpeg.def + $(LINK) $(LDFLAGS) -dll -out:jpeg62.dll -implib:jpeg.lib -def:win/jpeg.def \ + $(LOBJS) + +cjpeg.exe: cdjpeg.obj cjpeg.obj rdbmp.obj rdgif.obj rdppm.obj rdswitch.obj \ + rdtarga.obj jpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + +djpeg.exe: cdjpeg.obj djpeg.obj rdcolmap.obj rdswitch.obj wrbmp.obj wrgif.obj \ + wrppm.obj wrtarga.obj jpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + +jpegtran.exe: cdjpeg.obj jpegtran.obj rdswitch.obj transupp.obj jpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + +rdjpgcom.exe: rdjpgcom.obj jpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + +wrjpgcom.exe: wrjpgcom.obj jpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + + +turbojpeg-static.lib: turbojpegl.obj $(LOBJS) + $(AR) -out:$@ $^ + +turbojpeg.dll turbojpeg.lib: turbojpegl.obj $(LOBJS) + $(LINK) $(LDFLAGS) -dll -out:turbojpeg.dll -implib:turbojpeg.lib $^ + + +jpgtest.exe: jpgtest.obj bmp.obj turbojpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + +jpegut.exe: jpegut.obj turbojpeg.lib + $(LINK) $(LDFLAGS) -out:$@ $^ + + +test: testclean cjpeg.exe djpeg.exe jpegtran.exe + jpegut + djpeg -dct int -ppm -outfile testout.ppm testorig.jpg + djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg + cjpeg -dct int -outfile testout.jpg testimg.ppm + djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg + cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm + jpegtran -outfile testoutt.jpg testprog.jpg + cmp testimg.ppm testout.ppm + cmp testimg.bmp testout.bmp + cmp testimg.jpg testout.jpg + cmp testimg.ppm testoutp.ppm + cmp testimgp.jpg testoutp.jpg + cmp testorig.jpg testoutt.jpg + +testclean: + $(RM) testout* + $(RM) *_GRAYQ[0-9]*.bmp + $(RM) *_GRAYQ[0-9]*.ppm + $(RM) *_GRAYQ[0-9]*.jpg + $(RM) *_420Q[0-9]*.bmp + $(RM) *_420Q[0-9]*.ppm + $(RM) *_420Q[0-9]*.jpg + $(RM) *_422Q[0-9]*.bmp + $(RM) *_422Q[0-9]*.ppm + $(RM) *_422Q[0-9]*.jpg + $(RM) *_444Q[0-9]*.bmp + $(RM) *_444Q[0-9]*.ppm + $(RM) *_444Q[0-9]*.jpg diff --git a/win/Makerules b/win/Makerules new file mode 100755 index 00000000..f4e18cdf --- /dev/null +++ b/win/Makerules @@ -0,0 +1,39 @@ +CC = "cl" -nologo +CXX = "cl" -EHsc -nologo +AR = "link" -lib -nologo +LINK = "link" -nologo +ifeq ($(DEBUG), yes) + LINK = "link" -nologo -debug +endif +ifeq ($(NASM),) +NASM = nasm +endif + +CFLAGS = -W3 -wd4996 -Iwin -I. -DDLLDEFINE +CDEFINES = -DWIN32 -D_CRT_SECURE_NO_DEPRECATE +NAFLAGS = -fwin32 -DWIN32 -Iwin/ +ifeq ($(DEBUG), yes) + CFLAGS := $(CFLAGS) -Od -MTd -Zi + NAFLAGS := $(NAFLAGS) -g +else + CFLAGS := $(CFLAGS) -O2 -MT +endif + +WITH_SIMD = yes + +ifeq ($(WITH_SIMD), yes) + CFLAGS := $(CFLAGS) -DWITH_SIMD +endif + + +%.obj: %.c + $(CC) $(CFLAGS) -c $< -Fo$@ + +%.obj: %.cxx + $(CXX) $(CXXFLAGS) -c $< -Fo$@ + +%.obj: %.asm + $(NASM) $(NAFLAGS) -Isimd/ -o $@ $< + +%.lib: %.obj + $(AR) -out:$@ $< diff --git a/win/jpeg.def b/win/jpeg.def new file mode 100755 index 00000000..01d329fa --- /dev/null +++ b/win/jpeg.def @@ -0,0 +1,103 @@ +; h:\mingw\3.3.1\bin\dlltool.exe --output-def=jpeg.def jcapimin.o jcapistd.o jctrans.o jcparam.o jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o jcsample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o jfdctint.o jdapimin.o jdapistd.o jdtrans.o jdatasrc.o jdmaster.o jdinput.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o jcomapi.o jutils.o jerror.o jmemmgr.o jmemnobs.o jpeg-dllversion.o jpeg-dll-res.o +EXPORTS + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_output_dimensions @ 38 ; + jpeg_consume_input @ 39 ; + jpeg_copy_critical_parameters @ 40 ; + jpeg_default_colorspace @ 41 ; + jpeg_destroy @ 42 ; + jpeg_destroy_compress @ 43 ; + jpeg_destroy_decompress @ 44 ; + jpeg_fdct_float @ 45 ; + jpeg_fdct_ifast @ 46 ; + jpeg_fdct_islow @ 47 ; + jpeg_fill_bit_buffer @ 48 ; + jpeg_finish_compress @ 49 ; + jpeg_finish_decompress @ 50 ; + jpeg_finish_output @ 51 ; + jpeg_free_large @ 52 ; + jpeg_free_small @ 53 ; + jpeg_gen_optimal_table @ 54 ; + jpeg_get_large @ 55 ; + jpeg_get_small @ 56 ; + jpeg_has_multiple_scans @ 57 ; + jpeg_huff_decode @ 58 ; + jpeg_idct_1x1 @ 59 ; + jpeg_idct_2x2 @ 60 ; + jpeg_idct_4x4 @ 61 ; + jpeg_idct_float @ 62 ; + jpeg_idct_ifast @ 63 ; + jpeg_idct_islow @ 64 ; + jpeg_input_complete @ 65 ; + jpeg_make_c_derived_tbl @ 66 ; + jpeg_make_d_derived_tbl @ 67 ; + jpeg_mem_available @ 68 ; + jpeg_mem_init @ 69 ; + jpeg_mem_term @ 70 ; + jpeg_new_colormap @ 71 ; + jpeg_open_backing_store @ 72 ; + jpeg_quality_scaling @ 73 ; + jpeg_read_coefficients @ 74 ; + jpeg_read_header @ 75 ; + jpeg_read_raw_data @ 76 ; + jpeg_read_scanlines @ 77 ; + jpeg_resync_to_restart @ 78 ; + jpeg_save_markers @ 79 ; + jpeg_set_colorspace @ 80 ; + jpeg_set_defaults @ 81 ; + jpeg_set_linear_quality @ 82 ; + jpeg_set_marker_processor @ 83 ; + jpeg_set_quality @ 84 ; + jpeg_simple_progression @ 85 ; + jpeg_start_compress @ 86 ; + jpeg_start_decompress @ 87 ; + jpeg_start_output @ 88 ; + jpeg_std_error @ 89 ; + jpeg_stdio_dest @ 90 ; + jpeg_stdio_src @ 91 ; + jpeg_suppress_tables @ 92 ; + jpeg_write_coefficients @ 93 ; + jpeg_write_m_byte @ 94 ; + jpeg_write_m_header @ 95 ; + jpeg_write_marker @ 96 ; + jpeg_write_raw_data @ 97 ; + jpeg_write_scanlines @ 98 ; + jpeg_write_tables @ 99 ; + jround_up @ 100 ; + jzero_far @ 101 ; diff --git a/win/jsimdcfg.inc b/win/jsimdcfg.inc new file mode 100755 index 00000000..68e22e86 --- /dev/null +++ b/win/jsimdcfg.inc @@ -0,0 +1,69 @@ +; +; Automatically generated include file from jsimdcfg.inc.h +; +; +; -- jpeglib.h +; +%define DCTSIZE 8 +%define DCTSIZE2 64 +; +; -- jmorecfg.h +; +%define RGB_RED 0 +%define RGB_GREEN 1 +%define RGB_BLUE 2 +%define RGB_PIXELSIZE 3 +; Representation of a single sample (pixel element value). +; On this SIMD implementation, this must be 'unsigned char'. +; +%define JSAMPLE byte ; unsigned char +%define SIZEOF_JSAMPLE SIZEOF_BYTE ; sizeof(JSAMPLE) +%define CENTERJSAMPLE 128 +; Representation of a DCT frequency coefficient. +; On this SIMD implementation, this must be 'short'. +; +%define JCOEF word ; short +%define SIZEOF_JCOEF SIZEOF_WORD ; sizeof(JCOEF) +; Datatype used for image dimensions. +; On this SIMD implementation, this must be 'unsigned int'. +; +%define JDIMENSION dword ; unsigned int +%define SIZEOF_JDIMENSION SIZEOF_DWORD ; sizeof(JDIMENSION) +%define JSAMPROW POINTER ; JSAMPLE * (jpeglib.h) +%define JSAMPARRAY POINTER ; JSAMPROW * (jpeglib.h) +%define JSAMPIMAGE POINTER ; JSAMPARRAY * (jpeglib.h) +%define JCOEFPTR POINTER ; JCOEF * (jpeglib.h) +%define SIZEOF_JSAMPROW SIZEOF_POINTER ; sizeof(JSAMPROW) +%define SIZEOF_JSAMPARRAY SIZEOF_POINTER ; sizeof(JSAMPARRAY) +%define SIZEOF_JSAMPIMAGE SIZEOF_POINTER ; sizeof(JSAMPIMAGE) +%define SIZEOF_JCOEFPTR SIZEOF_POINTER ; sizeof(JCOEFPTR) +; +; -- jdct.h +; +; A forward DCT routine is given a pointer to a work area of type DCTELEM[]; +; the DCT is to be performed in-place in that buffer. +; To maximize parallelism, Type DCTELEM is changed to short (originally, int). +; +%define DCTELEM word ; short +%define SIZEOF_DCTELEM SIZEOF_WORD ; sizeof(DCTELEM) +%define float FP32 ; float +%define SIZEOF_FAST_FLOAT SIZEOF_FP32 ; sizeof(float) +; To maximize parallelism, Type short is changed to short. +; +%define ISLOW_MULT_TYPE word ; must be short +%define SIZEOF_ISLOW_MULT_TYPE SIZEOF_WORD ; sizeof(ISLOW_MULT_TYPE) +%define IFAST_MULT_TYPE word ; must be short +%define SIZEOF_IFAST_MULT_TYPE SIZEOF_WORD ; sizeof(IFAST_MULT_TYPE) +%define IFAST_SCALE_BITS 2 ; fractional bits in scale factors +%define FLOAT_MULT_TYPE FP32 ; must be float +%define SIZEOF_FLOAT_MULT_TYPE SIZEOF_FP32 ; sizeof(FLOAT_MULT_TYPE) +; +; -- jsimd.h +; +%define JSIMD_NONE 0x00 +%define JSIMD_MMX 0x01 +%define JSIMD_3DNOW 0x02 +%define JSIMD_SSE 0x04 +%define JSIMD_SSE2 0x08 +; Short forms of external names for systems with brain-damaged linkers. +; From ea1c8a33604a13bf45572f1ce05a23d108ed1634 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 22:22:01 +0000 Subject: [PATCH 079/985] MinGW uses autoconf 2.56 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cd324451..2b6a87ed 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ([2.57]) +AC_PREREQ([2.56]) AC_INIT([libjpeg], [6.b]) AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) From 4240858f53189a9b0c42980791588d3d64c13322 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 22:52:37 +0000 Subject: [PATCH 080/985] Build instructions --- README-turbo.txt | 248 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100755 README-turbo.txt diff --git a/README-turbo.txt b/README-turbo.txt new file mode 100755 index 00000000..85356f1c --- /dev/null +++ b/README-turbo.txt @@ -0,0 +1,248 @@ +******************************************************************************* +** Background +******************************************************************************* + +libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors +which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG +compression and decompression. libjpeg-turbo is generally 2-3x as fast +as the unmodified version of libjpeg, all else being equal. + +libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but +the TigerVNC and VirtualGL projects made numerous enhancements to the codec, +including improved support for Mac OS X, 64-bit support, support for 32-bit +and big endian pixel formats, accelerated Huffman encoding/decoding, and +various bug fixes. The goal was to produce a fully open source codec that +could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL +and TurboVNC. libjpeg-turbo generally performs in the range of 80-110% of +TurboJPEG/IPP. It is faster in some areas but slower in others. + +It was decided to split libjpeg-turbo into a separate SDK so that other +projects could take advantage of this technology. The shared libraries +built from the libjpeg-turbo source can be used as drop-in replacements for +libjpeg on most systems. + + +******************************************************************************* +** Building on Unix Platforms, Cygwin, and MinGW +******************************************************************************* + +================== +Build Requirements +================== + +-- autoconf 2.56 or later + * If using MinGW, this can be obtained by installing the MSYS DTK + +-- automake 1.7 or later + * If using MinGW, this can be obtained by installing the MSYS DTK + +-- libtool 1.4 or later + * If using MinGW, this can be obtained by installing the MSYS DTK + +-- NASM + * 0.98 or later is required for a 32-bit build + * NASM 2.05 or later is required for a 64-bit build + * NASM 2.07 or later is required for a 64-bit build on OS/X (10.6 "Snow + Leopard" or later.) This can be obtained from MacPorts + (http://www.macports.org/). + + The NASM 2.05 RPMs do not work on older Linux systems, such as Enterprise + Linux 4. On such systems, you can easily build and install NASM 2.05 + from the source RPM by executing the following as root: + + ARCH=`uname -m` + wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-1.src.rpm + rpmbuild --rebuild nasm-2.05.01-1.src.rpm + rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-2.05.01-1.$ARCH.rpm + +-- GCC v4 or later recommended for best performance + +====================== +Building libjpeg-turbo +====================== + +The following procedure will build libjpeg-turbo on Linux, 32-bit OS X, and +Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below +for 64-bit build instructions.) + + cd libjpeg-turbo + autoreconf -fiv + sh ./configure CFLAGS='-O3' CXXFLAGS='-O3' + make + +NOTE: Running autoreconf is only necessary if building libjpeg-turbo from the +SVN repository. + +This will generate the following files under .libs/ + + libjpeg.a + Static link library for libjpeg-turbo + + libjpeg.so.62.0.0 (Linux, Solaris) + libjpeg.62.dylib (OS X) + libjpeg-0.dll (MinGW) + cygjpeg-62.dll (Cygwin) + Shared library for libjpeg-turbo + + libjpeg.so (Linux, Solaris) + libjpeg.dylib (OS X) + libjpeg.dll.a (Cygwin, MinGW) + Development stub for libjpeg-turbo shared library + + libturbojpeg.a + Static link library for TurboJPEG/OSS + + libturbojpeg.so (Linux, Solaris) + libturbojpeg.dylib (OS X) + Shared library and development stub for TurboJPEG/OSS + + libturbojpeg.dll (MinGW) + cygturbojpeg.dll (Cygwin) + Shared library for TurboJPEG/OSS + + libturbojpeg.dll.a (Cygwin, MinGW) + Development stub for TurboJPEG/OSS shared library + +======================== +Installing libjpeg-turbo +======================== + +If you intend to install these libraries and the associated header files, then +replace 'make' in the instructions above with + + make install prefix={base dir} libdir={library directory} + +For example, + + make install prefix=/usr libdir=/usr/lib64 + +will overwrite the system version of libjpeg on a 64-bit RedHat-based Linux +machine, causing any 64-bit applications that use libjpeg to be instantly +accelerated. BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG BEFORE OVERWRITING +IT. + +The same can be done for 32-bit applications by building libjpeg-turbo as a +32-bit library (see below) and installing with a libdir of /usr/lib. On +Debian-based systems, 64-bit libraries are stored in /usr/lib and 32-bit +libraries in /usr/lib32. On Solaris, 64-bit libraries are stored in +/usr/lib/amd64 and 32-bit libraries in /usr/lib. + +Mac applications typically bundle their own copies of libjpeg.62.dylib, so it +is not possible to globally replace libjpeg on OS X systems. However, libjpeg +can be replaced on an application-by-application basis, for those applications +which use a shared library version of it. This would generally involve copying +libjpeg.62.dylib into the appropriate place in the application's Contents and +using install_name_tool to repoint the dylib to the new directory. This +requires an advanced knowledge of OS X and is not recommended for most users. + +============= +Build Recipes +============= + +32-bit Library Build on 64-bit Linux +------------------------------------ + +Same instructions as above, but add + + --host i686-pc-linux-gnu + +to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m32'. + + +64-bit Library Build on 64-bit OS/X +----------------------------------- + +Same instructions as above, but add + + --host x86_64-apple-darwin10.0.0 NASM=/opt/local/bin/nasm + +to the configure command line. NASM 2.07 from MacPorts must be installed. + + +32-bit Library Build on 64-bit OS/X +----------------------------------- + +Same instructions as above, but add + + LDFLAGS='-m32' + +to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m32'. + + +64-bit Library Build on 64-bit Solaris +-------------------------------------- + +Same instructions as above, but add + + --host x86_64-pc-solaris LDFLAGS='-m64' + +to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m64'. + + +******************************************************************************* +** Windows (Visual C++) +******************************************************************************* + +================== +Build Requirements +================== + +-- GNU Make v3.7 or later + * Can be found in MSYS (http://www.mingw.org/download.shtml) or + Cygwin (http://www.cygwin.com/) + +-- Microsoft Visual C++ 2003 or later + * Tested with Microsoft Visual C++ 2008 Express Edition (free download): + + http://msdn.microsoft.com/vstudio/express/visualc/ + + * Add the compiler binary directories (for instance, + c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN; + c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE) + to the system or user PATH environment variable prior to building + libjpeg-turbo. + * Add the compiler include directory (for instance, + c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE) + to the system or user INCLUDE environment variable prior to building + libjpeg-turbo. + * Add the compiler library directory (for instance, + c:\Program Files\Microsoft Visual Studio 9.0\VC\LIB) + to the system or user LIB environment variable prior to building + libjpeg-turbo. + +-- Microsoft Windows SDK + * This is included with Microsoft Visual C++ 2008 Express Edition, but users + of prior editions of Visual C++ can download the SDK from: + + http://msdn2.microsoft.com/en-us/windowsserver/bb980924.aspx + + * Add the SDK binary directory (for instance, + c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin) + to the system or user PATH environment variable prior to building + libjpeg-turbo. + * Add the SDK include directory (for instance, + c:\Program Files\Microsoft SDKs\Windows\v6.0A\include) + to the system or user INCLUDE environment variable prior to building + libjpeg-turbo. + * Add the SDK library directory (for instance, + c:\Program Files\Microsoft SDKs\Windows\v6.0A\lib) + to the system or user LIB environment variable prior to building + libjpeg-turbo. + +-- NASM (http://www.nasm.us/) 0.98 or later + +====================== +Building libjpeg-turbo +====================== + + cd libjpeg-turbo + make -f win/Makefile + +This will generate the following files: + + jpeg-static.lib Static link library for libjpeg-turbo + jpeg62.dll Shared library for libjpeg-turbo + jpeg.lib Development stub for libjpeg-turbo shared library + turbojpeg-static.lib Static link library for TurboJPEG/OSS + turbojpeg.dll Shared library for TurboJPEG/OSS + turbojpeg.lib Development stub for TurboJPEG/OSS shared library From 36db4985d5ab7f818da8a3d5f19a6089c4eba98f Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 12 Feb 2010 23:24:21 +0000 Subject: [PATCH 081/985] Instructions for cross compiling MinGW libs on Cygwin --- README-turbo.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README-turbo.txt b/README-turbo.txt index 85356f1c..798d6439 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -80,7 +80,7 @@ This will generate the following files under .libs/ libjpeg.so.62.0.0 (Linux, Solaris) libjpeg.62.dylib (OS X) - libjpeg-0.dll (MinGW) + libjpeg-62.dll (MinGW) cygjpeg-62.dll (Cygwin) Shared library for libjpeg-turbo @@ -179,6 +179,17 @@ Same instructions as above, but add to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m64'. +MinGW Build on Cygwin +--------------------- + +Same instructions as above, but add + + --host mingw32 + +to the configure command line. This will produce libraries which do not +depend on cygwin1.dll or other Cygwin DLL's. + + ******************************************************************************* ** Windows (Visual C++) ******************************************************************************* From 64462a35788388f718b5a12c47c23813204ff292 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 13 Feb 2010 22:55:05 +0000 Subject: [PATCH 082/985] Enable (i.e. fix) VPATH and out-of-tree builds --- Makefile.am | 28 ++++++++++++++-------------- simd/Makefile.am | 8 +++++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index ffa4d178..9c435ad8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,16 +35,16 @@ noinst_PROGRAMS = jpgtest jpegut cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c -jpgtest_LDADD = $(top_srcdir)/libturbojpeg.la +jpgtest_LDADD = libturbojpeg.la jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c -jpegut_LDADD = $(top_srcdir)/libturbojpeg.la +jpegut_LDADD = libturbojpeg.la cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \ rdppm.c rdswitch.c rdtarga.c -cjpeg_LDADD = $(top_srcdir)/libjpeg.la +cjpeg_LDADD = libjpeg.la cjpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ -DTARGA_SUPPORTED @@ -52,31 +52,31 @@ cjpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \ wrbmp.c wrgif.c wrppm.c wrtarga.c -djpeg_LDADD = $(top_srcdir)/libjpeg.la +djpeg_LDADD = libjpeg.la djpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ -DTARGA_SUPPORTED jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c -jpegtran_LDADD = $(top_srcdir)/libjpeg.la +jpegtran_LDADD = libjpeg.la rdjpgcom_SOURCES = wrjpgcom.c -rdjpgcom_LDADD = $(top_srcdir)/libjpeg.la +rdjpgcom_LDADD = libjpeg.la wrjpgcom_SOURCES = wrjpgcom.c -wrjpgcom_LDADD = $(top_srcdir)/libjpeg.la +wrjpgcom_LDADD = libjpeg.la test: testclean cjpeg djpeg jpegtran - $(top_srcdir)/jpegut - $(top_srcdir)/djpeg -dct int -ppm -outfile testout.ppm $(top_srcdir)/testorig.jpg - $(top_srcdir)/djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(top_srcdir)/testorig.jpg - $(top_srcdir)/cjpeg -dct int -outfile testout.jpg $(top_srcdir)/testimg.ppm - $(top_srcdir)/djpeg -dct int -ppm -outfile testoutp.ppm $(top_srcdir)/testprog.jpg - $(top_srcdir)/cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(top_srcdir)/testimg.ppm - $(top_srcdir)/jpegtran -outfile testoutt.jpg $(top_srcdir)/testprog.jpg + ./jpegut + ./djpeg -dct int -ppm -outfile testout.ppm $(srcdir)/testorig.jpg + ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testorig.jpg + ./cjpeg -dct int -outfile testout.jpg $(srcdir)/testimg.ppm + ./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg + ./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm + ./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg cmp $(top_srcdir)/testimg.ppm testout.ppm cmp $(top_srcdir)/testimg.bmp testout.bmp cmp $(top_srcdir)/testimg.jpg testout.jpg diff --git a/simd/Makefile.am b/simd/Makefile.am index 1df61431..36f24781 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -49,9 +49,11 @@ jdmermmx.lo: jdmrgmmx.asm jdmerss2.lo: jdmrgss2.asm endif +AM_CPPFLAGS = -I$(top_srcdir) + .asm.lo: - $(LIBTOOL) --mode=compile --tag NASM ./nasm_lt.sh $(NASM) $(NAFLAGS) $< -o $@ + $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) $< -o $@ -jsimdcfg.inc: jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) jsimdcfg.inc.h | $(EGREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ +jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h + $(CPP) -I$(builddir) -I$(top_builddir) $(srcdir)/jsimdcfg.inc.h | $(EGREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ From 825d07f5d5f265a08315a55617846228deed6e51 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 13 Feb 2010 23:06:03 +0000 Subject: [PATCH 083/985] License info + updated performance claims --- LGPL.txt | 504 +++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.txt | 53 +++++ README-turbo.txt | 15 +- 3 files changed, 570 insertions(+), 2 deletions(-) create mode 100644 LGPL.txt create mode 100644 LICENSE.txt diff --git a/LGPL.txt b/LGPL.txt new file mode 100644 index 00000000..b1e3f5a2 --- /dev/null +++ b/LGPL.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..fa803b15 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,53 @@ + wxWindows Library Licence, Version 3.1 + ====================================== + + Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al + + Everyone is permitted to copy and distribute verbatim copies + of this licence document, but changing it is not allowed. + + WXWINDOWS LIBRARY LICENCE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public Licence as published by + the Free Software Foundation; either version 2 of the Licence, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + General Public Licence for more details. + + You should have received a copy of the GNU Library General Public Licence + along with this software, usually in a file named COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA. + + EXCEPTION NOTICE + + 1. As a special exception, the copyright holders of this library give + permission for additional uses of the text contained in this release of + the library as licenced under the wxWindows Library Licence, applying + either version 3.1 of the Licence, or (at your option) any later version of + the Licence as published by the copyright holders of version + 3.1 of the Licence document. + + 2. The exception is that you may use, copy, link, modify and distribute + under your own terms, binary object code versions of works based + on the Library. + + 3. If you copy code from files distributed under the terms of the GNU + General Public Licence or the GNU Library General Public Licence into a + copy of this library, as this licence permits, the exception does not + apply to the code that you add in this way. To avoid misleading anyone as + to the status of such modified files, you must delete this exception + notice from such code and/or adjust the licensing conditions notice + accordingly. + + 4. If you write modifications of your own for this library, it is your + choice whether to permit this exception to apply to your modifications. + If you do not wish that, you must delete the exception notice from such + code and/or adjust the licensing conditions notice accordingly. + + diff --git a/README-turbo.txt b/README-turbo.txt index 798d6439..b2b3471b 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -4,7 +4,7 @@ libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG -compression and decompression. libjpeg-turbo is generally 2-3x as fast +compression and decompression. libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal. libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but @@ -13,7 +13,7 @@ including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats, accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL -and TurboVNC. libjpeg-turbo generally performs in the range of 80-110% of +and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others. It was decided to split libjpeg-turbo into a separate SDK so that other @@ -22,6 +22,17 @@ built from the libjpeg-turbo source can be used as drop-in replacements for libjpeg on most systems. +******************************************************************************* +** License +******************************************************************************* + +Some of the optimizations to the Huffman encoder/decoder were borrowed from +VirtualGL, and thus libjpeg-turbo, as a whole, falls under the wxWindows +Library Licence, Version 3.1. A copy of this license can be found in this +directory under LICENSE.txt. The rest of the source code, apart from these +modifications, falls under a less restrictive license (see README.) + + ******************************************************************************* ** Building on Unix Platforms, Cygwin, and MinGW ******************************************************************************* From 5838d99dfe2c77eb93bdd84a90ed57d52ecbfbb9 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 14 Feb 2010 02:15:52 +0000 Subject: [PATCH 084/985] builddir isn't always defined --- simd/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/Makefile.am b/simd/Makefile.am index 36f24781..e57c4772 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -55,5 +55,5 @@ AM_CPPFLAGS = -I$(top_srcdir) $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) $< -o $@ jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h - $(CPP) -I$(builddir) -I$(top_builddir) $(srcdir)/jsimdcfg.inc.h | $(EGREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ + $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) ^[\;%] | sed 's%_cpp_protection_%%' > $@ From 55e8d83a104887874d2d6389fa26dd079bed24be Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 14 Feb 2010 07:39:07 +0000 Subject: [PATCH 085/985] Set CFLAGS=CXXFLAGS=-O3 if using GCC and the flags are not already set --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 2b6a87ed..b8a985f9 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,8 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) AC_DEFINE([INCOMPLETE_TYPES_BROKEN], 1, [Define if you want use complete types]) # Checks for programs. +SAVED_CFLAGS=${CFLAGS} +SAVED_CXXFLAGS=${CXXFLAGS} AC_PROG_CPP AC_PROG_CC AC_PROG_CXX @@ -19,6 +21,15 @@ AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_LN_S +if test "x${GCC}" = "xyes"; then + if test "x${SAVED_CFLAGS}" = "x"; then + CFLAGS=-O3 + fi + if test "x${SAVED_CXXFLAGS}" = "x"; then + CXXFLAGS=-O3 + fi +fi + # Checks for libraries. # Checks for header files. From db1a243631b13a8160e965eb89a1f9d23a4c001b Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 14 Feb 2010 08:02:55 +0000 Subject: [PATCH 086/985] Reflect the fact that CFLAGS=CXXFLAGS=-O3 by default --- README-turbo.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README-turbo.txt b/README-turbo.txt index b2b3471b..e5725a19 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -78,7 +78,7 @@ for 64-bit build instructions.) cd libjpeg-turbo autoreconf -fiv - sh ./configure CFLAGS='-O3' CXXFLAGS='-O3' + sh ./configure make NOTE: Running autoreconf is only necessary if building libjpeg-turbo from the @@ -155,9 +155,9 @@ Build Recipes Same instructions as above, but add - --host i686-pc-linux-gnu + --host i686-pc-linux-gnu CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' -to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m32'. +to the configure command line. 64-bit Library Build on 64-bit OS/X @@ -175,9 +175,9 @@ to the configure command line. NASM 2.07 from MacPorts must be installed. Same instructions as above, but add - LDFLAGS='-m32' + CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32 -to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m32'. +to the configure command line. 64-bit Library Build on 64-bit Solaris @@ -185,9 +185,9 @@ to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m32'. Same instructions as above, but add - --host x86_64-pc-solaris LDFLAGS='-m64' + --host x86_64-pc-solaris CFLAGS='-O3 -m64' CXXFLAGS='-O3 -m64' LDFLAGS=-m64 -to the configure command line and replace CFLAGS and CXXFLAGS with '-O3 -m64'. +to the configure command line. MinGW Build on Cygwin From 7a9a82bf06b19664acdf93dba7b3f8bff9ddca93 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lane" Date: Mon, 7 Oct 1991 00:00:00 +0100 Subject: [PATCH 087/985] The Independent JPEG Group's JPEG software v1 --- README | 391 +++++++++++++++ ansi2knr.c | 477 ++++++++++++++++++ architecture | 1106 ++++++++++++++++++++++++++++++++++++++++ codingrules | 99 ++++ egetopt.c | 276 ++++++++++ jbsmooth.c | 120 +++++ jcarith.c | 42 ++ jccolor.c | 203 ++++++++ jcdeflts.c | 364 ++++++++++++++ jcexpand.c | 75 +++ jchuff.c | 689 +++++++++++++++++++++++++ jcmain.c | 272 ++++++++++ jcmaster.c | 127 +++++ jcmcu.c | 212 ++++++++ jconfig.h | 320 ++++++++++++ jcpipe.c | 715 ++++++++++++++++++++++++++ jcsample.c | 135 +++++ jdarith.c | 42 ++ jdcolor.c | 194 +++++++ jdhuff.c | 318 ++++++++++++ jdmain.c | 289 +++++++++++ jdmaster.c | 180 +++++++ jdmcu.c | 146 ++++++ jdpipe.c | 1309 ++++++++++++++++++++++++++++++++++++++++++++++++ jdsample.c | 133 +++++ jerror.c | 67 +++ jfwddct.c | 179 +++++++ jinclude.h | 73 +++ jpegdata.h | 812 ++++++++++++++++++++++++++++++ jquant1.c | 387 ++++++++++++++ jquant2.c | 122 +++++ jrdgif.c | 620 +++++++++++++++++++++++ jrdjfif.c | 733 +++++++++++++++++++++++++++ jrdppm.c | 124 +++++ jrevdct.c | 171 +++++++ jutils.c | 106 ++++ jvirtmem.c | 548 ++++++++++++++++++++ jwrgif.c | 497 ++++++++++++++++++ jwrjfif.c | 468 +++++++++++++++++ jwrppm.c | 167 ++++++ makcjpeg.cf | 5 + makcjpeg.lnk | 21 + makdjpeg.cf | 6 + makdjpeg.lnk | 22 + makefile.amiga | 143 ++++++ makefile.mc5 | 115 +++++ makefile.mc6 | 79 +++ makefile.pwc | 100 ++++ makefile.unix | 152 ++++++ makljpeg.cf | 5 + testimg.jpg | Bin 0 -> 3583 bytes testimg.ppm | 9 + testorig.jpg | Bin 0 -> 2899 bytes 53 files changed, 13965 insertions(+) create mode 100644 README create mode 100644 ansi2knr.c create mode 100644 architecture create mode 100644 codingrules create mode 100644 egetopt.c create mode 100644 jbsmooth.c create mode 100644 jcarith.c create mode 100644 jccolor.c create mode 100644 jcdeflts.c create mode 100644 jcexpand.c create mode 100644 jchuff.c create mode 100644 jcmain.c create mode 100644 jcmaster.c create mode 100644 jcmcu.c create mode 100644 jconfig.h create mode 100644 jcpipe.c create mode 100644 jcsample.c create mode 100644 jdarith.c create mode 100644 jdcolor.c create mode 100644 jdhuff.c create mode 100644 jdmain.c create mode 100644 jdmaster.c create mode 100644 jdmcu.c create mode 100644 jdpipe.c create mode 100644 jdsample.c create mode 100644 jerror.c create mode 100644 jfwddct.c create mode 100644 jinclude.h create mode 100644 jpegdata.h create mode 100644 jquant1.c create mode 100644 jquant2.c create mode 100644 jrdgif.c create mode 100644 jrdjfif.c create mode 100644 jrdppm.c create mode 100644 jrevdct.c create mode 100644 jutils.c create mode 100644 jvirtmem.c create mode 100644 jwrgif.c create mode 100644 jwrjfif.c create mode 100644 jwrppm.c create mode 100644 makcjpeg.cf create mode 100644 makcjpeg.lnk create mode 100644 makdjpeg.cf create mode 100644 makdjpeg.lnk create mode 100644 makefile.amiga create mode 100644 makefile.mc5 create mode 100644 makefile.mc6 create mode 100644 makefile.pwc create mode 100644 makefile.unix create mode 100644 makljpeg.cf create mode 100644 testimg.jpg create mode 100644 testimg.ppm create mode 100644 testorig.jpg diff --git a/README b/README new file mode 100644 index 00000000..9a2a1bba --- /dev/null +++ b/README @@ -0,0 +1,391 @@ +The Independent JPEG Group's JPEG software +========================================== + +README for release of 7-Oct-91 +=============================== + +This distribution contains the first public release of the Independent JPEG +Group's free JPEG software. You are welcome to redistribute this software and +to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. + +This software is still undergoing revision. Updated versions may be obtained +by anonymous FTP to uunet.uu.net; look under directory /graphics/jpeg. This +particular version will be archived as jpegsrc.v1.tar.Z. If you don't have +access to Internet FTP, UUNET's archives are also available via UUCP; contact +postmaster@uunet.uu.net for information on retrieving files that way. + +Please report any problems with this software to jpeg-info@uunet.uu.net. + +If you intend to become a serious user of this software, please contact +jpeg-info@uunet to be added to our electronic mailing list. Then you'll be +notified of updates and have a chance to participate in discussions, etc. + +This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, and other +members of the independent JPEG group. + + +DISCLAIMER +========== + +THIS SOFTWARE IS NOT COMPLETE NOR FULLY DEBUGGED. It is not guaranteed to be +useful for anything, nor to be compatible with subsequent releases, nor to be +an accurate implementation of the JPEG standard. (See LEGAL ISSUES for even +more disclaimers.) + + +WHAT'S HERE +=========== + +This distribution contains software to implement JPEG image compression and +decompression. JPEG is a standardized compression method for full-color and +gray-scale images. JPEG is intended for "real-world" scenes; cartoons and +other non-realistic images are not its strong suit. JPEG is lossy, meaning +that the output image is not necessarily identical to the input image. Hence +you should not use JPEG if you have to have identical output bits. However, +on typical images of real-world scenes, very good compression levels can be +obtained with hardly any visible change, and amazingly high compression levels +can be obtained if you can tolerate a low-quality image. For more details, +see the references, or just experiment with various compression settings. + +The software implements JPEG baseline and extended-sequential compression +processes. Provision is made for supporting all variants of these processes, +although some uncommon parameter settings aren't implemented yet. For legal +reasons, we are not distributing code for the arithmetic-coding process; see +LEGAL ISSUES. At present we have made no provision for supporting the +progressive or lossless processes defined in the standard. + +The present software is still largely in the prototype stage. It does not +support all possible variants of the JPEG standard, and some functions have +rather slow and/or crude implementations. However, it is useful already. + +The emphasis in designing this software has been on achieving portability and +flexibility, while also making it fast enough to be useful. We have not yet +undertaken serious performance measurement or tuning; we intend to do so in +the future. + + +This software can be used on several levels: + +* As canned software for JPEG compression and decompression. Just edit the + Makefile and configuration files as needed (see SETUP), compile and go. + Members of the independent JPEG group will improve the out-of-the-box + functionality as time goes on. + +* As the basis for other JPEG programs. For example, you could incorporate + the decompressor into a general image viewing package by replacing the + output module with write-to-screen functions. For an implementation on + specific hardware, you might want to replace some of the inner loops with + assembly code. For a non-command-line-driven system, you might want a + different user interface. (Members of the group will be producing Macintosh + and Amiga versions with appropriate user interfaces, for example.) + +* As a toolkit for experimentation with JPEG and JPEG-like algorithms. Most + of the individual decisions you might want to mess with are packaged up into + separate modules. For example, the details of color-space conversion and + subsampling techniques are each localized in one compressor and one + decompressor module. You'd probably also want to extend the user interface + to give you more detailed control over the JPEG compression parameters. + +In particular, we welcome the use of this software as the basis for commercial +products; no royalty is required. + + +SETUP +===== + +The installation process is not very automatic; you will need at least some +familiarity with C programming and program build procedures for your system. +(Volunteers to work on improving this situation are welcome. Also, we will +probably start distributing pre-built binaries for popular systems at some +point.) + +First, select a makefile and copy it to "Makefile". "makefile.unix" +is appropriate for most Unix and Unix-like systems. Special makefiles are +included for various PC compilers. If you don't see a makefile for your +system, we recommend starting from makefile.unix. + +Look over the Makefile and adjust options as needed. In particular, you'll +need to change the CC= and CFLAGS= definitions if you don't have gcc +(makefile.unix only). If you have a function-prototype-less compiler, be sure +to uncomment the .c.o rule and say "make ansi2knr". This will cause the +source files to be preprocessed to change our ANSI-style function definitions +to old-style definitions. (Thanks to Peter Deutsch of Aladdin Enterprises for +ansi2knr.) + +Also look over jconfig.h and adjust #defines as necessary. If you have an +ANSI-compliant C compiler (gcc for instance), no changes should be necessary +except perhaps for RIGHT_SHIFT_IS_UNSIGNED and TWO_FILE_COMMANDLINE. For +older compilers other mods may be needed, depending on what ANSI features are +supported. If you prefer, you can usually leave jconfig.h unmodified and add +-D switches to the Makefile's CFLAGS= definition. + +Then say "make". + +If you have trouble with missing system include files or inclusion of the +wrong ones, you can fix it in jinclude.h. In particular, if you are using +gcc on a machine with non-ANSI system include files, you are likely to find +that jinclude.h tries to include the wrong files (because gcc defines +__STDC__). There's no good automatic solution to this, so you'll just have +to hand-edit jinclude.h. + +As a quick test of functionality we've included three sample files: + testorig.jpg same as blkint.jpg from JPEG validation floppy. + testimg.ppm output of djpeg testorig.jpg + testimg.jpg output of cjpeg testimg.ppm +The two .jpg files aren't identical due to different parameter choices (and +wouldn't be anyway, since JPEG is lossy). However, if you can generate +duplicates of testimg.ppm and testimg.jpg then you probably have a working +port. "make test" will perform the necessary comparisons (by generating +testout.ppm and testout.jpg and comparing these to testimg.*). NOTE: this +is far from an exhaustive test of the JPEG software; some modules, such as +color quantization and GIF I/O, are not exercised at all. It's just a quick +test to give you some confidence that you haven't missed something major. + +If you need to make a smaller version of the JPEG software, some optional +functions can be removed at compile time. See the xxx_SUPPORTED #defines +in jconfig.h. (Not a lot is actually removed right now, but as more optional +stuff gets added, this mechanism will start to make a difference.) + +If you want to incorporate the JPEG code as subroutines in a larger program, +we recommend that you make libjpeg.a. Then use the .h files and libjpeg.a as +your interface to the JPEG functions. Your surrounding program will have to +provide functionality similar to what's in jcmain.c or jdmain.c, and you may +want to replace jerror.c and possibly other modules depending on your needs. +See the "architecture" file for more info. If it seems to you that the system +structure doesn't accommodate what you want to do, please contact the authors. + +Special notes for Macintosh Think C users: If you have version 5.0 you should +be able to just turn on __STDC__ through the compiler switch that enables +that. With version 4.0 you must manually edit jconfig.h to define PROTO, +HAVE_UNSIGNED_CHAR, HAVE_UNSIGNED_SHORT, and const. (It seems to be safe to +just define __STDC__ to take care of the first three.) When setting up +project files, use the COBJECTS and DOBJECTS lists in makefile.unix as a guide +to which files need to be included, and add the ANSI and Unix C libraries in a +separate segment. You may need to divide the JPEG files into more than one +segment; you can do this pretty much as you please. + + +USAGE +===== + +The user interface is pretty minimal at this point. We haven't bothered to +generate manual-page files since the switches badly need redesign. At the +moment, things work like this: + +There are two programs, cjpeg to compress an image file into JPEG format, +and djpeg to decompress. + +On Unix systems, you say: + cjpeg [switches] [imagefile] >jpegfile + djpeg [switches] [jpegfile] >imagefile +The programs read the specified input file, or standard input if none is +named. They always write to standard output (with trace/error messages to +standard error). These conventions are handy for piping images between +programs. + +On PC, Macintosh, and Amiga systems, you say: + cjpeg [switches] imagefile jpegfile + djpeg [switches] jpegfile imagefile +i.e., both input and output files are named on the command line. This style +is a little more foolproof, and it loses no functionality if you don't have +pipes. You can get this style on Unix too, if you prefer, by defining +TWO_FILE_COMMANDLINE in jconfig.h or in the Makefile. You MUST use this style +on any system that doesn't cope well with binary data fed through +stdin/stdout. + +Currently supported image file formats include raw-format PPM, raw-format PGM +(for monochrome images), and GIF. cjpeg recognizes the input image format +automatically, but you have to tell djpeg which format to generate. + +The only JPEG file format currently supported is a raw JPEG data stream. +Unless modified, the programs use the JFIF conventions for variables left +unspecified by the JPEG standard. (In particular, cjpeg generates a JFIF APP0 +marker.) Support for the JPEG-in-TIFF format will probably be added at some +future date. + +The command line switches for cjpeg are: + + -I Generate noninterleaved JPEG file (not yet supported). + + -Q quality Scale quantization tables to adjust quality. + Quality is 0 (worst) to 100 (best); default is 75. + (See below for more info.) + + -a Use arithmetic coding rather than Huffman coding. + (Not currently supported, see LEGAL ISSUES.) + + -o Perform optimization of entropy encoding parameters. + Without this, default Huffman or arithmetic + parameters are used. -o makes the JPEG file a tad + smaller, but compression uses much more memory. + Image quality is unaffected by -o. + + -d Enable debug printout. More -d's give more printout. + +Typically you'd use -Q settings of 50 or 75 or so. -Q 100 will generate a +quantization table of all 1's, meaning no quantization loss; then any +differences between input and output images are due to subsampling or to +roundoff error in the DCT or colorspace-conversion steps. -Q values below 50 +may be useful for making real small, low-quality images. Try -Q 2 (or so) for +some amusing Cubist effects. (Note that -Q values below about 25 generate +2-byte quantization tables, which are not decodable by pure baseline JPEG +decoders. cjpeg emits a warning message when you give such a -Q value.) + +The command line switches for djpeg are: + + -G Select GIF output format (implies -q, with default + of 256 colors). + + -b Perform cross-block smoothing. This is quite + memory-intensive and only seems to improve the image + at very low quality settings (-Q 10 to 20 or so). + + -g Force gray-scale output even if input is color. + + -q N Quantize to N colors. + + -D Use Floyd-Steinberg dithering in color quantization. + + -2 Use two-pass color quantization (not yet supported). + + -d Enable debug printout. More -d's give more printout. + +Color quantization currently uses a rather shoddy algorithm (although it's not +so horrible when dithered). Because of this, the GIF output mode is not +recommended in the current release, except for gray-scale output. You can get +better results by applying ppmquant to the unquantized (PPM) output of djpeg, +then converting to GIF with ppmtogif. We expect to provide a considerably +better quantization algorithm in a future release. + +Note that djpeg *can* read noninterleaved JPEG files even though cjpeg can't +yet generate them. For most applications this is a nonissue, since hardly +anybody seems to be using noninterleaved format. + +On a non-virtual-memory machine, you may run out of memory if you use -I or -o +in cjpeg, or -q ... -2 in djpeg, or try to read an interlaced GIF file. This +will be addressed eventually by replacing jvirtmem.c with something that uses +temporary files for large images (see TO DO). + + +REFERENCES +========== + +The best and most readily available introduction to the JPEG compression +algorithm is Wallace's article in the April '91 CACM: + Wallace, Gregory K. "The JPEG Still Picture Compression Standard", + Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. +(Adjacent articles in that issue discuss MPEG motion picture compression, +applications of JPEG, and related topics.) We highly recommend reading that +article before looking at any of the JPEG software. + +For more detail about the JPEG standard you pretty much have to go to the +draft standard, which is not nearly as intelligible as Wallace's article. +The current version is ISO/IEC Committee Draft CD 10918-1 dated 1991-03-15. +The standard is not presently available electronically; you must order a paper +copy through ISO. + +The JPEG standard does not specify all details of an interchangeable file +format. For the omitted details we follow the "JFIF" conventions, revision +1.01. A copy of the JFIF spec is available from: + Literature Department + C-Cube Microsystems, Inc. + 399A West Trimble Road + San Jose, CA 95131 + (408) 944-6300 +Requests can also be e-mailed to info@c3.pla.ca.us (this address good after +10/10/91). The same source can supply copies of the draft JPEG-in-TIFF specs. + +If you want to understand this implementation, start by reading the +"architecture" documentation file. Please read "codingrules" if you want to +contribute any code. + + +SUPPORTING SOFTWARE +=================== + +You will probably want Jef Poskanzer's PBMPLUS image software; this provides +many useful operations on PPM-format image files. In particular, it can +convert PPM images to and from a wide range of other formats. You can FTP +this free software from export.lcs.mit.edu (contrib/pbmplus*.tar.Z) or +ftp.ee.lbl.gov (pbmplus*.tar.Z). + +If you are using X Windows you might want to use the xv or xloadimage viewers +to save yourself the trouble of converting PPM to some other format. +Both of these can be found in the contrib directory at export.lcs.mit.edu. + + +LEGAL ISSUES +============ + +The authors make NO WARRANTY or representation, either express or implied, +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, Thomas G. Lane. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +Permission is NOT granted for the use of any author's name or author's company +name in advertising or publicity relating to this software or products derived +from it. This software may be referred to only as "the Independent JPEG +Group's software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. + + +ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, +sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. +ansi2knr.c is NOT covered by the above copyright and conditions, but instead +by the usual distribution terms of the Free Software Foundation; principally, +that you must include source code if you redistribute it. (See the file +ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part +of any product generated from the JPEG code, this does not limit you more than +the foregoing paragraphs do. + + +It appears that the arithmetic coding option of the JPEG spec is covered by +patents held by IBM, and possibly also patents of AT&T and Mitsubishi. Hence +arithmetic coding cannot legally be used without obtaining one or more +licenses. For this reason, support for arithmetic coding has been removed +from the free JPEG software. (Since arithmetic coding provides only a +marginal gain over the unpatented Huffman mode, it is unlikely that very many +people will choose to use it. If you do obtain such a license, contact +jpeg-info@uunet.uu.net for a copy of our arithmetic coding modules.) So far +as we are aware, there are no patent restrictions on the remaining code. + + +TO DO +===== + +Many of the modules need fleshing out to provide more complete +implementations, or to provide faster paths for common cases. The greatest +needs are for (a) decent color quantization, and (b) a memory manager +implementation that can work in limited memory by swapping "big" images to +temporary files. I (Tom Lane) am going to work on color quantization next. +Volunteers to write a PC memory manager, or to work on any other modules, are +welcome. + +We'd appreciate it if people would compile and check out the code on as wide a +variety of systems as possible, and report any portability problems +encountered (with solutions, if possible). Checks of file compatibility with +other JPEG implementations would also be of interest. Finally, we would +appreciate code profiles showing where the most time is spent, especially on +unusual systems. + +Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. diff --git a/ansi2knr.c b/ansi2knr.c new file mode 100644 index 00000000..77d3d819 --- /dev/null +++ b/ansi2knr.c @@ -0,0 +1,477 @@ +/* + * Received from Peter Deutsch (ghost@aladdin.com) + * Fri, 26 Apr 91 10:10:10 PDT + */ + +/* Copyright (C) 1989, 1991 Aladdin Enterprises. All rights reserved. + Distributed by Free Software Foundation, Inc. + +This file is part of Ghostscript. + +Ghostscript is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY. No author or distributor accepts responsibility +to anyone for the consequences of using it or for whether it serves any +particular purpose or works at all, unless he says so in writing. Refer +to the Ghostscript General Public License for full details. + +Everyone is granted permission to copy, modify and redistribute +Ghostscript, but only under the conditions described in the Ghostscript +General Public License. A copy of this license is supposed to have been +given to you along with Ghostscript so you can know your rights and +responsibilities. It should be in a file named COPYING. Among other +things, the copyright notice and this notice must be preserved on all +copies. */ + +/* +---------- Here is the GhostScript file COPYING, referred to above ---------- +----- These terms do NOT apply to the JPEG software itself; see README ------ + + GHOSTSCRIPT GENERAL PUBLIC LICENSE + (Clarified 11 Feb 1988) + + Copyright (C) 1988 Richard M. Stallman + Everyone is permitted to copy and distribute verbatim copies of this + license, but changing it is not allowed. You can also use this wording + to make the terms for other programs. + + The license agreements of most software companies keep you at the +mercy of those companies. By contrast, our general public license is +intended to give everyone the right to share Ghostscript. To make sure +that you get the rights we want you to have, we need to make +restrictions that forbid anyone to deny you these rights or to ask you +to surrender the rights. Hence this license agreement. + + Specifically, we want to make sure that you have the right to give +away copies of Ghostscript, that you receive source code or else can get +it if you want it, that you can change Ghostscript or use pieces of it +in new free programs, and that you know you can do these things. + + To make sure that everyone has such rights, we have to forbid you to +deprive anyone else of these rights. For example, if you distribute +copies of Ghostscript, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + Also, for our own protection, we must make certain that everyone finds +out that there is no warranty for Ghostscript. If Ghostscript is +modified by someone else and passed on, we want its recipients to know +that what they have is not what we distributed, so that any problems +introduced by others will not reflect on our reputation. + + Therefore we (Richard M. Stallman and the Free Software Foundation, +Inc.) make the following terms which say what you must do to be allowed +to distribute or change Ghostscript. + + + COPYING POLICIES + + 1. You may copy and distribute verbatim copies of Ghostscript source +code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy a valid copyright and license +notice "Copyright (C) 1989 Aladdin Enterprises. All rights reserved. +Distributed by Free Software Foundation, Inc." (or with whatever year is +appropriate); keep intact the notices on all files that refer to this +License Agreement and to the absence of any warranty; and give any other +recipients of the Ghostscript program a copy of this License Agreement +along with the program. You may charge a distribution fee for the +physical act of transferring a copy. + + 2. You may modify your copy or copies of Ghostscript or any portion of +it, and copy and distribute such modifications under the terms of +Paragraph 1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating + that you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, + that in whole or in part contains or is a derivative of Ghostscript + or any part thereof, to be licensed at no charge to all third + parties on terms identical to those contained in this License + Agreement (except that you may choose to grant more extensive + warranty protection to some or all third parties, at your option). + + c) You may charge a distribution fee for the physical act of + transferring a copy, and you may at your option offer warranty + protection in exchange for a fee. + +Mere aggregation of another unrelated program with this program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other program under the scope of these terms. + + 3. You may copy and distribute Ghostscript (or a portion or derivative +of it, under Paragraph 2) in object code or executable form under the +terms of Paragraphs 1 and 2 above provided that you also do one of the +following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal + shipping charge) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +For an executable file, complete source code means all the source code for +all modules it contains; but, as a special exception, it need not include +source code for modules which are standard libraries that accompany the +operating system on which the executable file runs. + + 4. You may not copy, sublicense, distribute or transfer Ghostscript +except as expressly provided under this License Agreement. Any attempt +otherwise to copy, sublicense, distribute or transfer Ghostscript is +void and your rights to use the program under this License agreement +shall be automatically terminated. However, parties who have received +computer software programs from you with this License Agreement will not +have their licenses terminated so long as such parties remain in full +compliance. + + 5. If you wish to incorporate parts of Ghostscript into other free +programs whose distribution conditions are different, write to the Free +Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not +yet worked out a simple rule that can be stated here, but we will often +permit this. We will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the +sharing and reuse of software. + +Your comments and suggestions about our licensing policies and our +software are welcome! Please contact the Free Software Foundation, +Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296. + + NO WARRANTY + + BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY +NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT +WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD +M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES +PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH +YOU. SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. +STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN +ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE +GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING +ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE +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 ------------------------------ +*/ + + +/* ansi2knr.c */ +/* Convert ANSI function declarations to K&R syntax */ +#include +#include + +#ifdef BSD +# include +# define strchr index +#else +# ifdef VMS + extern char *strcat(), *strchr(), *strcpy(), *strupr(); + extern int strcmp(), strlen(), strncmp(); +# else +# include +# endif +#endif + +#ifdef MSDOS +# include +#else +# ifdef VMS + extern char *malloc(); + extern void free(); +# else +# ifdef BSD + extern char *malloc(); +# else +# include +# endif +# endif +#endif + +/* 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 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. + * 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. + */ + +/* Scanning macros */ +#define isidchar(ch) (isalnum(ch) || (ch) == '_') +#define isidfirstchar(ch) (isalpha(ch) || (ch) == '_') + +main(argc, argv) + int argc; + char *argv[]; +{ FILE *in, *out; +#define bufsize 500 /* arbitrary size */ + char buf[bufsize]; + char *line; + switch ( argc ) + { + default: + printf("Usage: ansi2knr input_file [output_file]\n"); + exit(0); + case 2: + out = stdout; break; + case 3: + out = fopen(argv[2], "w"); + if ( out == NULL ) + { fprintf(stderr, "Cannot open %s\n", argv[2]); + exit(1); + } + } + in = fopen(argv[1], "r"); + if ( in == NULL ) + { fprintf(stderr, "Cannot open %s\n", argv[1]); + exit(1); + } + fprintf(out, "#line 1 \"%s\"\n", argv[1]); + line = buf; + while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) + { switch ( test1(buf) ) + { + case 1: /* a function */ + convert1(buf, out); + break; + case -1: /* maybe the start of a function */ + line = buf + strlen(buf); + continue; + default: /* not a function */ + fputs(buf, out); + break; + } + line = buf; + } + if ( line != buf ) fputs(buf, out); + fclose(out); + fclose(in); + return 0; +} + +/* Skip over space and comments, in either direction. */ +char * +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; + p += dir; p += dir; + while ( !(*p == '*' && p[dir] == '/') ) + { if ( *p == 0 ) return p; /* multi-line comment?? */ + p += dir; + } + p += dir; p += dir; + } + return p; +} + +/* + * Write blanks over part of a string. + */ +void +writeblanks(start, end) + char *start; + char *end; +{ char *p; + for ( p = start; p < end; p++ ) *p = ' '; +} + +/* + * Test whether the string in buf is a function definition. + * The string may contain and/or end with a newline. + * Return as follows: + * 0 - definitely not a function definition; + * 1 - definitely a function definition; + * -1 - may be the beginning of a function definition, + * append another line and look again. + */ +test1(buf) + char *buf; +{ register char *p = buf; + char *bend; + char *endfn; + int contin; + if ( !isidfirstchar(*p) ) + return 0; /* no name at left margin */ + bend = skipspace(buf + strlen(buf) - 1, -1); + switch ( *bend ) + { + case ')': contin = 1; break; + case '(': + case ',': contin = -1; break; + default: return 0; /* not a function */ + } + while ( isidchar(*p) ) p++; + endfn = p; + p = skipspace(p, 1); + if ( *p++ != '(' ) + return 0; /* not a function */ + p = skipspace(p, 1); + if ( *p == ')' ) + 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). */ + { static char *words[] = + { "asm", "auto", "case", "char", "const", "double", + "extern", "float", "for", "if", "int", "long", + "register", "return", "short", "signed", "sizeof", + "static", "switch", "typedef", "unsigned", + "void", "volatile", "while", 0 + }; + 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 */ + key++; + } + } + return contin; +} + +convert1(buf, out) + char *buf; + FILE *out; +{ char *endfn = strchr(buf, '(') + 1; + register char *p; + char **breaks; + unsigned num_breaks = 2; /* for testing */ + char **btop; + char **bp; + char **ap; +top: p = endfn; + breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); + if ( breaks == 0 ) + { /* Couldn't allocate break table, give up */ + fprintf(stderr, "Unable to allocate break table!\n"); + fputs(buf, out); + return -1; + } + btop = breaks + num_breaks * 2 - 2; + bp = breaks; + /* Parse the argument list */ + do + { int level = 0; + char *end = NULL; + if ( bp >= btop ) + { /* Filled up break table. */ + /* Allocate a bigger one and start over. */ + free((char *)breaks); + num_breaks <<= 1; + goto top; + } + *bp++ = p; + /* Find the end of the argument */ + 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: ; + } + } + p--; /* back up over terminator */ + /* Find the name being declared. */ + /* This is complicated because of procedure and */ + /* array modifiers. */ + for ( ; ; ) + { p = skipspace(p - 1, -1); + switch ( *p ) + { + 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: ; + } + } + if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) + { /* We found the name being declared */ + while ( !isidfirstchar(*p) ) + p = skipspace(p, 1) + 1; + goto found; + } + break; + default: goto found; + } + } +found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) + { p++; + if ( bp == breaks + 1 ) /* sole argument */ + writeblanks(breaks[0], p); + else + writeblanks(bp[-1] - 1, p); + bp--; + } + else + { while ( isidchar(*p) ) p--; + *bp++ = p+1; + } + p = end; + } + while ( *p++ == ',' ); + *bp = p; + /* Make a special check for 'void' arglist */ + if ( bp == breaks+2 ) + { p = skipspace(breaks[0], 1); + if ( !strncmp(p, "void", 4) ) + { p = skipspace(p+4, 1); + if ( p == breaks[2] - 1 ) + { bp = breaks; /* yup, pretend arglist is empty */ + writeblanks(breaks[0], p + 1); + } + } + } + /* Put out the function name */ + 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); + free((char *)breaks); + return 0; +} diff --git a/architecture b/architecture new file mode 100644 index 00000000..78587cd7 --- /dev/null +++ b/architecture @@ -0,0 +1,1106 @@ + + JPEG SYSTEM ARCHITECTURE 3-OCT-91 + + +This file provides an overview of the "architecture" of the portable JPEG +software; that is, the functions of the various modules in the system and the +interfaces between modules. For more precise details about any data structure +or calling convention, see the header files. + +Important note: when I say "module" I don't mean "a C function", which is what +some people seem to think the term means. A separate C source file is closer +to the mark. Also, it is frequently the case that several different modules +present a common interface to callers; the term "object" or "method" refers to +this common interface (see "Poor man's object-oriented programming", below). + +JPEG-specific terminology follows the JPEG R9 draft: + A "component" means a color channel, e.g., Red or Luminance. + A "sample" is a pixel component value (i.e., one number in the image data). + A "coefficient" is a frequency coefficient (a DCT transform output number). + The term "block" refers to an 8x8 group of samples or coefficients. + "MCU" (minimum coded unit) is the same as "MDU" of the R8 draft; i.e., an + interleaved set of blocks of size determined by the sampling factors, + or a single block in a noninterleaved scan. + + +*** System requirements *** + +We must support compression and decompression of both Huffman and +arithmetic-coded JPEG files. Any set of compression parameters allowed by the +JPEG spec should be readable for decompression. (We can be more restrictive +about what formats we can generate.) (Note: for legal reasons no arithmetic +coding implementation is currently included in the publicly available sources. +However, the architecture still supports it.) + +We need to be able to handle both raw JPEG files (more specifically, the JFIF +format) and JPEG-in-TIFF (C-cubed's format, and perhaps Kodak's). Even if we +don't implement TIFF ourselves, other people will want to use our code for +that. This means that generation and scanning of the file header has to be +separated out. + +Perhaps we should be prepared to support the JPEG lossless mode (also referred +to in the spec as spatial DPCM coding). A lot of people seem to believe they +need this... whether they really do is debatable, but the customer is always +right. On the other hand, there will not be much sharable code between the +lossless and lossy modes! At best, a lossless program could be derived from +parts of the lossy version. For now we will only worry about the lossy mode. + +I see no real value in supporting the JPEG progressive modes (note that +spectral selection and successive approximation are two different progressive +modes). These are only of interest when painting the decompressed image in +real-time, which nobody is going to do with a pure software implementation. + +There is some value in supporting the hierarchical mode, which allows for +successive frames of higher resolution. This could be of use for including +"thumbnail" representations. Also, Storm's JPEG++ files probably use the +hierarchical mode (I haven't looked). However, this appears to add a lot more +complexity than it is worth. + +A variety of uncompressed image file formats and user interfaces must be +supported. These aspects therefore have to be kept separate from the rest of +the system. A particularly important issue is whether color quantization of +the output is needed (i.e., whether a colormap is used). We should be able to +support both adaptive quantization (which requires two or more passes over the +image) and nonadaptive (quantization to a prespecified colormap, which can be +done in one pass). + +Memory usage is an important concern, since we will port this code to 80x86 +and other limited-memory machines. For large intermediate structures, we +should be able to use either virtual memory or temporary files. + +It should be possible to build programs that handle compression only, +decompression only, or both, without much duplicate or unused code in any +version. (In particular, a decompression-only version should have no extra +baggage.) + + +*** Compression overview *** + +The *logical* steps needed in (non-lossless) JPEG compression are: + +1. Conversion from incoming image format to a standardized internal form + (either RGB or greyscale). + +2. Color space conversion (e.g., RGB to YCbCr). This is a null step for + greyscale (unless we support mapping color inputs to greyscale, which + would most easily be done here). Gamma adjustment may also be needed here. + +3. Subsampling (reduction of number of samples in some color components). + This step operates independently on each color component. + +4. MCU extraction (creation of a single sequence of 8x8 sample blocks). + This step and the following ones are performed once for each scan + in the output JPEG file, i.e., once if making an interleaved file and more + than once for a noninterleaved file. + Note: both this step and the previous one must deal with edge conditions + for pictures that aren't a multiple of the MCU dimensions. Alternately, + we could expand the picture to a multiple of an MCU before doing these + two steps. (The latter seems better and has been adopted below.) + +5. DCT transformation of each 8x8 block. + +6. Quantization scaling and zigzag reordering of the elements in each 8x8 + block. + +7. Huffman or arithmetic encoding of the transformed block sequence. + +8. Output of the JPEG file with whatever headers/markers are wanted. + +Of course, the actual implementation will combine some of these logical steps +for efficiency. The trick is to keep these logical functions as separate as +possible without losing too much performance. + +In addition to these logical pipeline steps, we need various modules that +aren't part of the data pipeline. These are: + +A. Overall control (sequencing of other steps & management of data passing). + +B. User interface; this will determine the input and output files, and supply + values for some compression parameters. Note that this module is highly + platform-dependent. + +C. Compression parameter selection: some parameters should be chosen + automatically rather than requiring the user to find a good value. + The prototype only does this for the back-end (Huffman or arithmetic) + parameters, but further in the future, more might be done. A + straightforward approach to selection is to try several values; this + requires being able to repeatedly apply some portion of the pipeline and + inspect the results (without actually outputting them). Probably only + entropy encoding parameters can reasonably be done this way; optimizing + earlier steps would require too much data to be reprocessed (not to mention + the problem of interactions between parameters for different steps). + What other facilities do we need to support automatic parameter selection? + +D. A memory management module to deal with small-memory machines. This must + create the illusion of virtual memory for certain large data structures + (e.g., the subsampled image or the transformed coefficients). + The interface to this must be defined to minimize the overhead incurred, + especially on virtual-memory machines where the module won't do much. + +In many cases we can arrange things so that a data stream is produced in +segments by one module and consumed by another without the need to hold it all +in (virtual) memory. This is obviously not possible for any data that must be +scanned more than once, so it won't work everywhere. + +The major variable at this level of detail is whether the JPEG file is to be +interleaved or not; that affects the order of processing so fundamentally that +the central control module must know about it. Some of the other modules may +need to know it too. It would simplify life if we didn't need to support +noninterleaved images, but that is not reasonable. + +Many of these steps operate independently on each color component; the +knowledge of how many components there are, and how they are interleaved, +ought to be confined to the central control module. (Color space conversion +and MCU extraction probably have to know it too.) + + +*** Decompression overview *** + +Decompression is roughly the inverse process from compression, but there are +some additional steps needed to produce a good output image. + +The *logical* steps needed in (non-lossless) JPEG decompression are: + +1. Scanning of the JPEG file, decoding of headers/markers etc. + +2. Huffman or arithmetic decoding of the coefficient sequence. + +3. Quantization descaling and zigzag reordering of the elements in each 8x8 + block. + +4. MCU disassembly (conversion of a possibly interleaved sequence of 8x8 + blocks back to separate components in pixel map order). + +5. (Optional) Cross-block smoothing per JPEG section 13.10 or a similar + algorithm. (Steps 5-8 operate independently on each component.) + +6. Inverse DCT transformation of each 8x8 block. + +7. De-subsampling. At this point a pixel image of the original dimensions + has been recreated. + +8. Post-subsampling smoothing. This can be combined with de-subsampling, + by using a convolution-like calculation to generate each output pixel + directly from one or more input pixels. + +9. Cropping to the original pixel dimensions (throwing away duplicated + pixels at the edges). It is most convenient to do this now, as the + preceding steps are simplified by not having to worry about odd picture + sizes. + +10. Color space reconversion (e.g., YCbCr to RGB). This is a null step for + greyscale. (Note that if we support mapping color JPEG to greyscale, + it could be done as part of this step.) Gamma adjustment may also be + needed here. + +11. Color quantization (only if a colormapped output format is requested). + NOTE: it might be better to do this on the internal color space instead of + RGB? If so, it would need to be performed one step earlier. + +12. Writing of the desired image format. + +As before, some of these will be combined into single steps. When dealing +with a noninterleaved JPEG file, steps 2-9 will be performed once for each +scan; the resulting data will need to be buffered up so that step 10 can +process all the color components together. + +The same auxiliary modules are needed as before, except for compression +parameter selection. Note that rerunning a pipeline stage should never be +needed during decompression. This may allow a simpler control module. The +user interface might also be simpler since it need not supply any compression +parameters. + +As before, not all of these steps require the whole image to be stored. +Actually, two-pass color quantization is the only step that logically requires +this; everything else could be done a few raster lines at a time (at least for +interleaved images). We might want to make color quantization be a separate +program because of this fact. + +Again, many of the steps should be able to work on one color component in +ignorance of the other components. + + +*** Implications of noninterleaved formats *** + +Much of the work can be done in a single pass if an interleaved JPEG file +format is used. With a noninterleaved JPEG file, separating or recombining +the components will force use of virtual memory (on a small-memory machine, +we probably would want one temp file per color component). + +If any of the image formats we read or write are noninterleaved, the opposite +condition might apply: processing a noninterleaved JPEG file would be more +efficient. Offhand, though, I can't think of any popular image formats that +work that way; besides the win would only come if the same color space were +used in JPEG and non-JPEG files. It's not worth the complexity to make the +system design accommodate that case efficiently. + +An argument against interleaving is that it makes the decompressor need more +memory for cross-block smoothing (since the minimum processable chunk of the +image gets bigger). With images more than 1000 pixels across, 80x86 machines +are likely to have difficulty in handling this feature. + +Another argument against interleaving is that the noninterleaved format allows +a wider range of sampling factors, since the limit of ten blocks per MCU no +longer applies. We could get around this by blithely ignoring the spec's +limit of ten blocks, but that seems like a bad idea (especially since it makes +the above problem worse). + +The upshot is that we need to support both interleaved and noninterleaved JPEG +formats, since for any given machine and picture size one may be much more +efficient than the other. However, the non-JPEG format we convert to or from +will be assumed to be an interleaved format (i.e., it produces or stores all +the components of a pixel together). + +I do not think it is necessary for the compressor to be able to output +partially-interleaved formats (multiple scans, some of which interleave a +subset of the components). However, the decompressor must be able to read +such files to conform to the spec. + + +*** Data formats *** + +Pipeline steps that work on pixel sample values will use the following data +structure: + + typedef something JSAMPLE; a pixel component value, 0..MAXJSAMPLE + typedef JSAMPLE *JSAMPROW; ptr to a row of samples + typedef JSAMPROW *JSAMPARRAY; ptr to a list of rows + typedef JSAMPARRAY *JSAMPIMAGE; ptr to a list of color-component arrays + +The basic element type JSAMPLE will be one of unsigned char, (signed) char, or +unsigned short. Unsigned short will be used if samples wider than 8 bits are +to be supported (this is a compile-time option). Otherwise, unsigned char is +used if possible. If the compiler only supports signed chars, then it is +necessary to mask off the value when reading. Thus, all reads of sample +values should be coded as "GETJSAMPLE(value)", where the macro will be defined +as "((value)&0xFF)" on signed-char machines and "(value)" elsewhere. + +With these conventions, JSAMPLE values can be assumed to be >= 0. This should +simplify correct rounding during subsampling, etc. The JPEG draft's +specification that sample values run from -128..127 will be accommodated by +subtracting 128 just as the sample value is copied into the source array for +the DCT step (this will be an array of signed shorts or longs). Similarly, +during decompression the output of the IDCT step will be immediately shifted +back to 0..255. (NB: different values are required when 12-bit samples are in +use. The code should be written in terms of MAXJSAMPLE and CENTERJSAMPLE, +which will be #defined as 255 and 128 respectively in an 8-bit implementation, +and as 4095 and 2048 in a 12-bit implementation.) + +On compilers that don't support "unsigned short", signed short can be used for +a 12-bit implementation. To support lossless coding (which allows up to +16-bit data precision) masking with 0xFFFF in GETJSAMPLE might be necessary. +(But if "int" is 16 bits then using "unsigned int" is the best solution.) + +Notice that we use a pointer per row, rather than a two-dimensional JSAMPLE +array. This choice costs only a small amount of memory and has several +benefits: + +* Code using the data structure doesn't need to know the allocated width of +the rows. This will simplify edge expansion/compression, since we can work +in an array that's wider than the logical picture width. + +* The rows forming a component array may be allocated at different times +without extra copying. This will simplify working a few scanlines at a time, +especially in smoothing steps that need access to the previous and next rows. + +* Indexing doesn't require multiplication; this is a performance win on many +machines. + +Note that each color component is stored in a separate array; we don't use the +traditional structure in which the components of a pixel are stored together. +This simplifies coding of steps that work on each component independently, +because they don't need to know how many components there are. Furthermore, +we can read or write each component to a temp file independently, which is +helpful when dealing with noninterleaved JPEG files. + +A specific sample value will be accessed by code such as + GETJSAMPLE(image[colorcomponent][row][col]) +where col is measured from the image left edge, but row is measured from the +first sample row currently in memory. Either of the first two indexings can +be precomputed by copying the relevant pointer. + + +Pipeline steps that work on frequency-coefficient values will use the +following data structure: + + typedef short JCOEF; a 16-bit signed integer + typedef JCOEF JBLOCK[64]; an 8x8 block of coefficients + typedef JBLOCK *JBLOCKROW; ptr to one horizontal row of 8x8 blocks + typedef JBLOCKROW *JBLOCKARRAY; ptr to a list of such rows + typedef JBLOCKARRAY *JBLOCKIMAGE; ptr to a list of color component arrays + +The underlying type is always a 16-bit signed integer (this is "short" on all +machines of interest, but let's use the typedef name anyway). These are +grouped into 8x8 blocks (we should 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 pipeline. + +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 +samples, and for the same reasons. + +On machines where malloc() can't handle a request bigger than 64Kb, this data +structure limits us to rows of less than 512 JBLOCKs, which would be a picture +width of 4000 pixels. This seems an acceptable restriction. + + +On 80x86 machines, the bottom-level pointer types (JSAMPROW and JBLOCKROW) +must be declared as "far" pointers, but the upper levels can be "near" +(implying that the pointer lists are allocated in the DS segment). +To simplify sharing code, we'll have a #define symbol FAR, which expands to +the "far" keyword when compiling on 80x86 machines and to nothing elsewhere. + + +The data arrays used as input and output of the DCT transform subroutine will +be declared using a separate typedef; they could be arrays of "short", "int" +or "long" independently of the above choices. This would depend on what is +needed to make the compiler generate correct and efficient multiply/add code +in the DCT inner loops. No significant speed or memory penalty will be paid +to have a different representation than is used in the main image storage +arrays, since some additional value-by-value processing is done at the time of +creation or extraction of the DCT data anyway (e.g., add/subtract 128). + + +*** Poor man's object-oriented programming *** + +It should be pretty clear by now that we have a lot of quasi-independent +steps, many of which have several possible behaviors. To avoid cluttering the +code with lots of switch statements, we'll use a simple form of object-style +programming to separate out the different possibilities. + +For example, Huffman and arithmetic coding will be implemented as two separate +modules that present the same external interface; at runtime, the calling code +will access the proper module indirectly through an "object". + +We can get the limited features we need while staying within portable C. The +basic tool is a function pointer. An "object" is just a struct containing one +or more function pointer fields, each of which corresponds to a method name in +real object-oriented languages. During initialization we fill in the function +pointers with references to whichever module we have determined we need to use +in this run. Then invocation of the module is done by indirecting through a +function pointer; on most architectures this is no more expensive (and +possibly cheaper) than a switch, which would be the only other way of making +the required run-time choice. The really significant benefit, of course, is +keeping the source code clean and well structured. + +For example, the interface for entropy decoding (Huffman or arithmetic +decoding) might look like this: + + struct function_ptr_struct { + ... + /* Entropy decoding methods */ + void (*prepare_for_scan) (); + void (*get_next_mcu) (); + ... + }; + + typedef struct function_ptr_struct * function_ptrs; + +The struct pointer is what will actually be passed around. A call site might +look like this: + + some_function (function_ptrs fptrs) + { + ... + (*fptrs->get_next_mcu) (...); + ... + } + +(It might be worth inventing some specialized macros to hide the rather ugly +syntax for method definition and call.) Note that the caller doesn't know how +many different get_next_mcu procedures there are, what their real names are, +nor how to choose which one to call. + +An important benefit of this scheme is that it is easy to provide multiple +versions of any method, each tuned to a particular case. While a lot of +precalculation might be done to select an optimal implementation of a method, +the cost per invocation is constant. For example, the MCU extraction step +might have a "generic" method, plus one or more "hardwired" methods for the +most popular sampling factors; the hardwired methods would be faster because +they'd use straight-line code instead of for-loops. The cost to determine +which method to use is paid only once, at startup, and the selection criteria +are hidden from the callers of the method. + +This plan differs a little bit from usual object-oriented structures, in that +only one instance of each object class will exist during execution. The +reason for having the class structure is that on different runs we may create +different instances (choose to execute different modules). + +To minimize the number of object pointers that have to be passed around, it +will be easiest to have just a few big structs containing all the method +pointers. We'll actually use two such structs, one for "globally" defined +methods (applicable to the whole file or to all components of the current +scan) and one for methods applicable to a single component. There'll be one +copy of the second kind of struct for each component of the current scan. +This is necessary so that preselection of an optimal method can be done based +on component-specific information (like sampling ratios...) + +Because of this choice, it's best not to think of an "object" as a specific +data structure. Rather, an "object" is just a group of related methods. +There would typically be one or more C modules (source files) providing +concrete implementations of those methods. You can think of the term +"method" as denoting the common interface presented by some set of functions, +and "object" as denoting a group of common method interfaces, or the total +shared interface behavior of a group of modules. + + +*** Data chunk sizes *** + +To make the cost of this object-oriented style really minimal, we should make +sure that each method call does a fair amount of computation. To do that we +should pass large chunks of data around; for example, the colorspace +conversion method should process much more than one pixel per call. + +For many steps, the most natural unit of data seems to be an "MCU row". +This consists of one complete horizontal strip of the image, as high as an +MCU. In a noninterleaved scan, an MCU row is always eight samples high (when +looking at samples) or one 8x8 block high (when looking at coefficients). In +an interleaved scan, an MCU row consists of all the data for one horizontal +row of MCUs; this may be from one to four blocks high (eight to thirty-two +samples) depending on the sampling factors. The height and width of an MCU +row may be different in each component. (Note that the height and width of an +MCU row changes at the subsampling and de-subsampling steps. An unsubsampled +image has the same size in each component. The preceding statements apply to +the subsampled dimensions.) + +For example, consider a 1024-pixel-wide image using (2h:2v)(1h:1v)(1h:1v) +subsampling. In the noninterleaved case, an MCU row of Y would contain 8x1024 +samples or the same number of frequency coefficients, so it would occupy +8K bytes (samples) or 16K bytes (coefficients). An MCU row of Cb or Cr would +contain 8x512 samples and occupy half as much space. In the interleaved case, +an MCU row would contain 16x1024 Y samples, 8x512 Cb and 8x512 Cr samples, so +a total of 24K (samples) or 48K (coefficients) would be needed. This is a +reasonable amount of data to expect to retain in memory at one time. (Bear in +mind that we'll usually need to have several MCU rows resident in memory at +once, at the inputs and outputs to various pipeline steps.) + +The worst case is probably (2h:4v)(1h:1v)(1h:1v) interleaving (this uses 10 +blocks per MCU, which is the maximum allowed by the spec). An MCU will then +contain 32 sample rows worth of Y, so it would occupy 40K or 80K bytes for a +1024-pixel-wide image. The most memory-intensive step is probably cross-block +smoothing, for which we'd need 3 MCU rows of coefficients as input and another +one as output; that would be 320K of working storage. Anything much larger +would not fit in an 80x86 machine. (To decompress wider pictures on an 80x86, +we'll have to skip cross-block smoothing or else use temporary files.) + +This unit is thus a reasonable-sized chunk for passing through the pipeline. +Of course, its major advantage is that it is a natural chunk size for the MCU +assembly and disassembly steps to work with. + +For the entropy (Huffman or arithmetic) encoding/decoding steps, the most +convenient chunk is a single MCU: one 8x8 block if not interleaved, three to +ten such blocks if interleaved. The advantage of this is that when handling +interleaved data, the blocks have the same sequence of component membership on +each call. (For example, Y,Y,Y,Y,Cb,Cr when using (2h:2v)(1h:1v)(1h:1v) +subsampling.) The code needs to know component membership so that it can +apply the right set of compression coefficients to each block. A prebuilt +array describing this membership can be used during each call. This chunk +size also makes it easy to handle restart intervals: just count off one MCU +per call and reinitialize when the count reaches zero (restart intervals are +specified in numbers of MCU). + +For similar reasons, one MCU is also the best chunk size for the frequency +coefficient quantization and dequantization steps. + +For subsampling and desubsampling, the best chunk size is to have each call +transform Vk sample rows from or to Vmax sample rows (Vk = this component's +vertical sampling factor, Vmax = largest vertical sampling factor). There are +eight such chunks in each MCU row. Using a whole MCU row as the chunk size +would reduce function call overhead a fraction, but would imply more buffering +to provide context for cross-pixel smoothing. + + +*** Compression object structure *** + +I propose the following set of objects for the compressor. Here an "object" +is the common interface for one or more modules having comparable functions. + +Most of these objects can be justified as information-hiding modules. +I've indicated what information is private to each object/module. + +Note that in all cases, the caller of a method is expected to have allocated +any storage needed for it to return its result. (Typically this storage can +be re-used in successive calls, so malloc'ing and free'ing once per call is +not reasonable.) Also, much of the context required (compression parameters, +image size, etc) will be passed around in large common data structures, which +aren't described here; see the header files. Notice that any object that +might need to allocate working storage receives an "init" and a "term" call; +"term" should be careful to free all allocated storage so that the JPEG system +can be used multiple times during a program run. (For the same reason, +depending on static initialization of variables is a no-no.) + +1. Input file conversion to standardized form. This provides these methods: + input_init: read the file header, report image size & component count. + get_input_row: read one pixel row, return it in our standard format. + input_term: finish up at the end. + In implementations that support multiple input formats, input_init could + set up an appropriate get_input_row method depending on the format it + finds. Note that in most applications, the selection and opening of the + input file will be under the control of the user interface module; and + indeed the user interface may have already read the input header, so that + all that input_init may have to do is return previously saved values. The + behind-the-scenes interaction between this object and the user interface is + not specified by this architecture. + (Hides format of input image and mechanism used to read it. This code is + likely to vary considerably from one implementation to another. Note that + the color space and number of color components of the source are not hidden; + but they are used only by the next object.) + +2. Gamma and color space conversion. This provides three methods: + colorin_init: initialization. + get_sample_rows: read, convert, and return a specified number of pixel + rows (not more than remain in the picture). + colorin_term: finish up at the end. + The most efficient approach seems to be for this object to call + get_input_row directly, rather than being passed the input data; that way, + any intermediate storage required can be local to this object. + (get_sample_rows might tell get_input_row to read directly into its own + output area and then convert in place; or it may do something different. + For example, conversion in place wouldn't work if it is changing the number + of color components.) The output of this step is in the standardized + sample array format shown previously. + (Hides all knowledge of color space semantics and conversion. Remaining + modules only need to know the number of JPEG components.) + +3. Edge expansion: needs only a single method. + edge_expand: Given an NxM sample array, expand to a desired size (a + multiple of the MCU dimensions) by duplicating the last + row or column. Repeat for each component. + Expansion will occur in place, so the caller must have pre-allocated enough + storage. (I'm assuming that it is easier and faster to do this expansion + than it is to worry about boundary conditions in the next two steps. + Notice that vertical expansion will occur only once, at the bottom of the + picture, so only horizontal expansion by a few pixels is speed-critical.) + (This doesn't really hide any information, so maybe it could be a simple + subroutine instead of a method. Depends on whether we want to be able to + use alternative, optimized methods.) + +4. Subsampling: this will be applied to one component at a time. + subsample_init: initialize (precalculate convolution factors, for + example). This will be called once per scan. + subsample: Given a sample array, reduce it to a smaller number of + samples using specified sampling factors. + subsample_term: clean up at the end of a scan. + If the current component has vertical sampling factor Vk and the largest + sampling factor is Vmax, then the input is always Vmax sample rows (whose + width is a multiple of Hmax) and the output is always Vk sample rows. + Vmax additional rows above and below the nominal input rows are also passed + for use by partial-pixel-averaging sampling methods. (Is this necessary?) + At the top and bottom of the image, these extra rows are copies of the + first or last actual input row. + (This hides whether and how cross-pixel averaging occurs.) + +5. MCU extraction (creation of a single sequence of 8x8 sample blocks). + extract_init: initialize as needed. This will be called once per scan. + extract_MCUs: convert a sample array to a sequence of MCUs. + extract_term: clean up at the end of a scan. + Given one or more MCU rows worth of image data, extract sample blocks in the + appropriate order; pass these off to subsequent steps one MCU at a time. + The input must be a multiple of the MCU dimensions. It will probably be + most convenient for the DCT transform, frequency quantization, and zigzag + reordering of each block to be done as simple subroutines of this step. + Once a transformed MCU has been completed, it'll be passed off to a + method call, which will be passed as a parameter to extract_MCUs. + That routine might either encode and output the MCU immediately, or buffer + it up for later output if we want to do global optimization of the entropy + encoding coefficients. Note: when outputting a noninterleaved file this + object will be called separately for each component. Direct output could + be done for the first component, but the others would have to be buffered. + (Again, an object mainly on the grounds that multiple instantiations might + be useful.) + +6. DCT transformation of each 8x8 block. This probably doesn't have to be a + full-fledged method, but just a plain subroutine that will be called by MCU + extraction. One 8x8 block will be processed per call. + +7. Quantization scaling and zigzag reordering of the elements in each 8x8 + block. (This can probably be a plain subroutine called once per block by + MCU extraction; hard to see a need for multiple instantiations here.) + +8. Entropy encoding (Huffman or arithmetic). + entropy_encoder_init: prepare for one scan. + entropy_encode: accepts an MCU's worth of quantized coefficients, + encodes and outputs them. + entropy_encoder_term: finish up at end of a scan (dump any buffered + bytes, for example). + The data output by this module will be sent to the entropy_output method + provided by the pipeline controller. (It will probably be worth using + buffering to pass multiple bytes per call of the output method.) The + output method could be just write_jpeg_data, but might also be a dummy + routine that counts output bytes (for use during cut-and-try coefficient + optimization). + (This hides which entropy encoding method is in use.) + +9. JPEG file header construction. This will provide these methods: + write_file_header: output the initial header. + write_scan_header: output scan header (called once per component + if noninterleaved mode). + write_jpeg_data: the actual data output method for the preceding step. + write_scan_trailer: finish up after one scan. + write_file_trailer: finish up at end of file. + Note that compressed data is passed to the write_jpeg_data method, in case + a simple fwrite isn't appropriate for some reason. + (This hides which variant JPEG file format is being written. Also, the + actual mechanism for writing the file is private to this object and the + user interface.) + +10. Pipeline control. This object will provide the "main loop" that invokes + all the pipeline objects. Note that we will need several different main + loops depending on the situation (interleaved output or not, global + optimization of encoding parameters or not, etc). This object will do + most of the memory allocation, since it will provide the working buffers + that are the inputs and outputs of the pipeline steps. + (An object mostly to support multiple instantiations; however, overall + memory management and sequencing of operations are known only here.) + +11. Overall control. This module will provide at least two routines: + jpeg_compress: the main entry point to the compressor. + per_scan_method_selection: called by pipeline controllers for + secondary method selection passes. + jpeg_compress is invoked from the user interface after the UI has selected + the input and output files and obtained values for all compression + parameters that aren't dynamically determined. jpeg_compress performs + basic initialization (e.g., calculating the size of MCUs), does the + "global" method selection pass, and finally calls the selected pipeline + control object. (Per-scan method selections will be invoked by the + pipeline controller.) + Note that jpeg_compress can't be a method since it is invoked prior to + method selection. + +12. User interface; this is the architecture's term for "the rest of the + application program", i.e., that which invokes the JPEG compressor. In a + standalone JPEG compression program the UI need be little more than a C + main() routine and argument parsing code; but we can expect that the JPEG + compressor may be incorporated into complex graphics applications, wherein + the UI is much more complex. Much of the UI will need to be written + afresh for each non-Unix-like platform the compressor is ported to. + The UI is expected to supply input and output files and values for all + non-automatically-chosen compression parameters. (Hence defaults are + determined by the UI; we should probably provide helpful routines to fill + in recommended defaults.) The UI must also supply error handling + routines and some mechanism for trace messages. + (This module hides the user interface provided --- command line, + interactive, etc. Except for error/message handling, the UI calls the + portable JPEG code, not the other way around.) + +13. (Optional) Compression parameter selection control. + entropy_optimize: given an array of MCUs ready to be fed to entropy + encoding, find optimal encoding parameters. + The actual optimization algorithm ought to be separated out as an object, + even though a special pipeline control method will be needed. (The + pipeline controller only has to understand that the output of extract_MCUs + must be built up as a virtual array rather than fed directly to entropy + encoding and output. This pipeline behavior may also be useful for future + implementation of hierarchical modes, etc.) + To minimize the amount of control logic in the optimization module, the + pipeline control doesn't actually hand over big-array pointers, but rather + an "iterator": a function which knows how to scan the stored image. + (This hides the details of the parameter optimization algorithm.) + + The present design doesn't allow for multiple passes at earlier points + in the pipeline, but allowing that would only require providing some + new pipeline control methods; nothing else need change. + +14. A memory management object. This will provide methods to allocate "small" + things and "big" things. Small things have to fit in memory and you get + back direct pointers (this could be handled by direct calls to malloc, but + it's cleaner not to assume malloc is the right routine). "Big" things + mean buffered images for multiple passes, noninterleaved output, etc. + In this case the memory management object will give you room for a few MCU + rows and you have to ask for access to the next few; dumping and reloading + in a temporary file will go on behind the scenes. (All big objects are + image arrays containing either samples or coefficients, and will be + scanned top-to-bottom some number of times, so we can apply this access + model easily.) On a platform with virtual memory, the memory manager can + treat small and big things alike: just malloc up enough virtual memory for + the whole image, and let the operating system worry about swapping the + image to disk. + + Most of the actual calls on the memory manager will be made from pipeline + control objects; changing any data item from "small" to "big" status would + require a new pipeline control object, since it will contain the logic to + ask for a new chunk of a big thing. Thus, one way in which pipeline + controllers will vary is in which structures they treat as big. + + The memory manager will need to be told roughly how much space is going to + be requested overall, so that it can figure out how big a buffer is safe + to allocate for a "big" object. (If it happens that you are dealing with + a small image, you'd like to decide to keep it all in memory!) The most + flexible way of doing this is to divide allocation of "big" objects into + two steps. First, there will be one or more "request" calls that indicate + the desired object sizes; then an "instantiate" call causes the memory + manager to actually construct the objects. The instantiation must occur + before the contents of any big object can be accessed. + + For 80x86 CPUs, we would like the code to be compilable under small or + medium model, meaning that pointers are 16 bits unless explicitly declared + FAR. Hence space allocated by the "small" allocator must fit into the + 64Kb default data segment, along with stack space and global/static data. + For normal JPEG operations we seem to need only about 32Kb of such space, + so we are within the target (and have a reasonable slop for the needs of + a surrounding application program). However, some color quantization + algorithms need 64Kb or more of all-in-memory space in order to create + color histograms. For this purpose, we will also support "medium" size + things. These are semantically the same as "small" things but are + referenced through FAR pointers. + + The following methods will be needed: + alloc_small: allocate an object of given size; use for any random + data that's not an image array. + free_small: release same. + alloc_medium: like alloc_small, but returns a FAR pointer. + free_medium: release same. + alloc_small_sarray: construct an all-in-memory image sample array. + free_small_sarray: release same. + alloc_small_barray, + free_small_barray: ditto for block (coefficient) arrays. + request_big_sarray: request a virtual image sample array. The size + of the in-memory buffer will be determined by the + memory manager, but it will always be a multiple + of the passed-in MCU height. + request_big_barray: ditto for block (coefficient) arrays. + alloc_big_arrays: instantiate all the big arrays previously requested. + This call will also pass some info about future + memory demands, so that the memory manager can + figure out how much space to leave unallocated. + access_big_sarray: obtain access to a specified portion of a virtual + image sample array. + access_big_barray: ditto for block (coefficient) arrays. + free_big_sarray: release a virtual sample array. + free_big_barray: ditto for block (coefficient) arrays. + + alloc_big_arrays will be called by the pipeline controller, which does + most of the memory allocation anyway. The only reason for having separate + request calls is to allow some of the other modules to get big arrays. + The pipeline controller is required to give an upper bound on total future + small-array requests, so that this space can be discounted. (A fairly + conservative estimate will be adequate.) Future small-object requests + aren't counted; the memory manager has to use a slop factor for those. + 10K or so seems to be sufficient. (In an 80x86, small objects aren't an + issue anyway, since they don't compete for far-heap space. "Medium"-size + objects will have to be counted separately.) + + The distinction between sample and coefficient array routines is annoying, + but it has to be maintained for machines in which "char *" is represented + differently from "int *"... on byte-addressable machines some of these + methods could point to the same code. + + The array routines will operate on only 2-D arrays (one component at a + time), since different components may require different-size arrays. + + (This object hides the knowledge of whether virtual memory is available, + as well as the actual interface to OS and library support routines.) + +Note that any given implementation will presumably contain only one +instantiation of input file header reading, overall control, user interface, +and memory management. Thus these could be called as simple subroutines, +without bothering with an object indirection. This is essential for overall +control (which has to initialize the object structure); I'm undecided whether +to impose objectness on the other three. + + +*** Decompression object structure *** + +I propose the following set of objects for decompression. The general +comments at the top of the compression object section also apply here. + +1. JPEG file scanning. This will provide these methods: + read_file_header: read the file header, determine which variant + JPEG format is in use, read everything through SOF. + read_scan_header: read scan header (up through SOS). This is called + after read_file_header and again after each scan; + it returns TRUE if it finds SOS, FALSE if EOI. + read_jpeg_data: fetch data for entropy decoder. + read_scan_trailer: finish up after one scan, prepare for another call + of read_scan_header (may be a no-op). + read_file_trailer: finish up at end of file (probably a no-op). + The entropy decoder must deal with restart markers, but all other JPEG + marker types will be handled in this object; useful data from the markers + will be extracted into data structures available to subsequent routines. + Note that on exit from read_file_header, only the SOF-marker data should be + assumed valid (image size, component IDs, sampling factors); other data + such as Huffman tables may not appear until after the SOF. The overall + image size and colorspace can be determined after read_file_header, but not + whether or how the data is interleaved. (This hides which variant JPEG + file format is being read. In particular, for JPEG-in-TIFF the read_header + routines might not be scanning standard JPEG markers at all; they could + extract the data from TIFF tags. The user interface will already have + opened the input file and possibly read part of the header before + read_file_header is called.) + + NOTE: for JFIF/raw-JPEG file format, the read_jpeg_data routine is actually + supplied by the user interface; the jrdjfif module uses read_jpeg_data + internally to scan the input stream. This makes it possible for the user + interface module to single-handedly implement special applications like + reading from a non-stdio source. For JPEG-in-TIFF format, the need for + random access will make it impossible for this to work; hence the TIFF + header module will probably override the UI read_jpeg_data routine. + Non-stdio input from a TIFF file will require extensive surgery to the TIFF + header module, if indeed it is practical at all. + +2. Entropy (Huffman or arithmetic) decoding of the coefficient sequence. + entropy_decoder_init: prepare for one scan. + entropy_decode: decodes and returns an MCU's worth of quantized + coefficients per call. + entropy_decoder_term: finish up after a scan (may be a no-op). + This will read raw data by calling the read_jpeg_data method (I don't see + any reason to provide a further level of indirection). + (This hides which entropy encoding method is in use.) + +3. Quantization descaling and zigzag reordering of the elements in each 8x8 + block. (This can probably be a plain subroutine called once per block; + hard to see a need for multiple instantiations here.) + +4. MCU disassembly (conversion of a possibly interleaved sequence of 8x8 + blocks back to separate components in pixel map order). + disassemble_init: initialize. This will be called once per scan. + disassemble_MCU: Given an MCU's worth of dequantized blocks, + distribute them into the proper locations in a + coefficient image array. + disassemble_term: clean up at the end of a scan. + Probably this should be called once per MCU row and should call the + preceding two objects repeatedly to obtain the row's data. The output is + always a multiple of an MCU's dimensions. + (An object on the grounds that multiple instantiations might be useful.) + +5. Cross-block smoothing per JPEG section 13.10 or a similar algorithm. + smooth_coefficients: Given three block rows' worth of a single + component, emit a smoothed equivalent of the + middle row. The "above" and "below" pointers + may be NULL if at top/bottom of image. + The pipeline controller will do the necessary buffering to provide the + above/below context. Smoothing will be optional since a good deal of + extra memory is needed to buffer the additional block rows. + (This object hides the details of the smoothing algorithm.) + +6. Inverse DCT transformation of each 8x8 block. (This can be a plain + subroutine processing one block per call.) + +7. De-subsampling and smoothing: this will be applied to one component at a + time. Note that cross-pixel smoothing, which was a separate step in the + prototype code, will now be performed simultaneously with expansion. + unsubsample_init: initialize (precalculate convolution factors, for + example). This will be called once per scan. + unsubsample: Given a sample array, enlarge it by specified sampling + factors. + unsubsample_term: clean up at the end of a scan. + If the current component has vertical sampling factor Vk and the largest + sampling factor is Vmax, then the input is always Vk sample rows (whose + width is a multiple of Hk) and the output is always Vmax sample rows. + Vk additional rows above and below the nominal input rows are also passed + for use in cross-pixel smoothing. At the top and bottom of the image, + these extra rows are copies of the first or last actual input row. + (This hides whether and how cross-pixel smoothing occurs.) + +8. Cropping to the original pixel dimensions (throwing away duplicated + pixels at the edges). This won't be a separate object, just an + adjustment of the nominal image size in the pipeline controller. + +9. Color space reconversion and gamma adjustment. + colorout_init: initialization. This will be passed the component + data from read_file_header, and will determine the + number of output components. + color_convert: convert a specified number of pixel rows. Input and + output are image arrays of same size but possibly + different numbers of components. + colorout_term: cleanup (probably a no-op except for memory dealloc). + In practice will always be given an MCU row's worth of pixel rows, except + at the bottom where a smaller number of rows may be left over. Note that + this object works on all the components at once. + (Hides all knowledge of color space semantics and conversion. Remaining + modules only need to know the number of JPEG and output components.) + +10. Color quantization (used only if a colormapped output format is requested). + We use two different strategies depending on whether one-pass (on-the-fly) + or two-pass quantization is requested. Note that the two-pass interface + is actually designed to let the quantizer make any number of passes. + color_quant_init: initialization, allocate working memory. In 1-pass + quantization, should call put_color_map. + color_quantize: convert a specified number of pixel rows. Input + and output are image arrays of same size, but input + is N coefficients and output is only one. (Used only + in 1-pass quantization.) + color_quant_prescan: prescan a specified number of pixel rows in + 2-pass quantization. + color_quant_doit: perform multi-pass color quantization. Input is a + "big" sample image, output is via put_color_map and + put_pixel_rows. (Used only in 2-pass quantization.) + color_quant_term: cleanup (probably a no-op except for memory dealloc). + For one-pass quantization the image is simply processed by color_quantize, + a few rows at a time. For two-pass quantization, the pipeline controller + accumulates the output of color_convert into a "big" sample image. The + color_quant_prescan method is invoked during this process so that the + quantizer can accumulate statistics. At the end of the image, + color_quant_doit is called; it must rescan the "big" image and pass + converted data to the output module. Additional scans of the image could + be made before the output pass is done (in fact, prescan could be a no-op). + As with entropy parameter optimization, the pipeline controller actually + passes an iterator function rather than direct access to the big image. + NOTE: it might be better to do this on the internal color space instead of + RGB? If so, it would need to be performed one step earlier. + (Hides color quantization algorithm.) + +11. Writing of the desired image format. + output_init: produce the file header given data from read_file_header. + put_color_map: output colormap, if any (called by color quantizer). + put_pixel_rows: output image data in desired format. + output_term: finish up at the end. + Note that whether colormapping is needed will be determined by the user + interface object prior to method selection. In implementations that + support multiple output formats, the actual output format will also be + determined by the user interface. + (Hides format of output image and mechanism used to write it. Note that + several other objects know the color model used by the output format. The + actual mechanism for writing the file is private to this object and the + user interface.) + +12. Pipeline control. This object will provide the "main loop" that invokes + all the pipeline objects. Note that we will need several different main + loops depending on the situation (interleaved input or not, whether to + apply cross-block smoothing or not, etc). We may want to divvy up the + pipeline controllers into two levels, one that retains control over the + whole file and one that is invoked per scan. + This object will do most of the memory allocation, since it will provide + the working buffers that are the inputs and outputs of the pipeline steps. + (An object mostly to support multiple instantiations; however, overall + memory management and sequencing of operations are known only here.) + +13. Overall control. This module will provide at least two routines: + jpeg_decompress: the main entry point to the decompressor. + per_scan_method_selection: called by pipeline controllers for + secondary method selection passes. + jpeg_decompress is invoked from the user interface after the UI has + selected the input and output files and obtained values for all + user-specified options (e.g., output file format, whether to do block + smoothing). jpeg_decompress calls read_file_header, performs basic + initialization (e.g., calculating the size of MCUs), does the "global" + method selection pass, and finally calls the selected pipeline control + object. (Per-scan method selections will be invoked by the pipeline + controller.) + Note that jpeg_decompress can't be a method since it is invoked prior to + method selection. + +14. User interface; this is the architecture's term for "the rest of the + application program", i.e., that which invokes the JPEG decompressor. + The UI is expected to supply input and output files and values for all + operational parameters. The UI must also supply error handling routines. + At the moment I can't think of any nonfatal errors the JPEG code is likely + to report, so a single report-this-error-and-exit method should be + sufficient. + (This module hides the user interface provided --- command line, + interactive, etc. Except for error handling, the UI calls the portable + JPEG code, not the other way around.) + +15. A memory management object. This will be identical to the memory + management for compression (and will be the same code, in combined + programs). See above for details. + + +*** Initial method selection *** + +The main ugliness in this design is the portion of startup that will select +which of several instantiations should be used for each of the objects. (For +example, Huffman or arithmetic for entropy encoding; one of several pipeline +controllers depending on interleaving, the size of the image, etc.) It's not +really desirable to have a single chunk of code that knows the names of all +the possible instantiations and the conditions under which to select each one. + +The best approach seems to be to provide a selector function for each object +(group of related method calls). This function knows about each possible +instantiation of its object and how to choose the right one; but it doesn't +know about any other objects. + +Note that there will be several rounds of method selection: at initial startup, +after overall compression parameters are determined (after the file header is +read, if decompressing), and one in preparation for each scan (this occurs +more than once if the file is noninterleaved). Each object method will need +to be clearly identified as to which round sets it up. + + +*** Implications of DNL marker *** + +Some JPEG files may use a DNL marker to postpone definition of the image +height (this would be useful for a fax-like scanner's output, for instance). +In these files the SOF marker claims the image height is 0, and you only +find out the true image height at the end of the first scan. + +We could handle these files as follows: +1. Upon seeing zero image height, replace it by 65535 (the maximum allowed). +2. When the DNL is found, update the image height in the global image + descriptor. +This implies that pipeline control objects must avoid making copies of the +image height, and must re-test for termination after each MCU row. This is +no big deal. + +In situations where image-size data structures are allocated, this approach +will result in very inefficient use of virtual memory or +much-larger-than-necessary temporary files. This seems acceptable for +something that probably won't be a mainstream usage. People might have to +forgo use of memory-hogging options (such as two-pass color quantization or +noninterleaved JPEG files) if they want efficient conversion of such files. +(One could improve efficiency by demanding a user-supplied upper bound for the +height, less than 65536; in most cases it could be much less.) + +Alternately, we could insist that DNL-using files be preprocessed by a +separate program that reads ahead to the DNL, then goes back and fixes the SOF +marker. This is a much simpler solution and is probably far more efficient. +Even if one wants piped input, buffering the first scan of the JPEG file +needs a lot smaller temp file than is implied by the maximum-height method. +For this approach we'd simply treat DNL as a no-op in the decompressor (at +most, check that it matches the SOF image height). + +We will not worry about making the compressor capable of outputting DNL. Note +that something similar to the first scheme above could be applied if anyone +ever wants to make that work. + + +*** Notes for MS-DOS implementors *** + +The standalone cjpeg and djpeg applications can be compiled in "small" memory +model, at least at the moment; as the code grows we may be forced to switch to +"medium" model. (Small = both code and data pointers are near by default; +medium = far code pointers, near data pointers.) Medium model will slow down +calls through method pointers, but I don't think this will amount to any +significant speed penalty. + +When integrating the JPEG code into a larger application, it's a good idea to +stay with a small-data-space model if possible. An 8K stack is much more than +sufficient for the JPEG code, and its static data requirements are less than +1K. When executed, it will typically malloc about 10K worth of near heap +space (and lots of far heap, but that doesn't count in this calculation). +This figure will vary depending on image size and other factors, but figuring +20K should be more than sufficient. Thus you have about 35K available for +other modules' static data and near heap requirements before you need to go to +a larger memory model. The C library's static data will account for several K +of this, but that still leaves a good deal for your needs. (If you are tight +on space, you could reduce JPEG_BUF_SIZE from 4K to 1K to save 3K of near heap +space.) + +As the code is improved, we will endeavor to hold the near data requirements +to the range given above. This does imply that certain data structures will +be allocated as FAR although they would fit in near space if we assumed the +JPEG code is stand-alone. (The LZW tables in jrdgif/jwrgif are examples.) +To make an optimal implementation, you might want to move these structures +back to near heap if you know there is sufficient space. + + +*** Potential optimizations *** + +For colormapped input formats it might be worthwhile to merge the input file +reading and the colorspace conversion steps; in other words, do the colorspace +conversion by hacking up the colormap before inputting the image body, rather +than doing the conversion on each pixel independently. Not clear if this is +worth the uglification involved. In the above design for the compressor, only +the colorspace conversion step ever sees the output of get_input_row, so this +sort of thing could be done via private agreement between those two modules. + +Level shift from 0..255 to -128..127 may be done either during colorspace +conversion, or at the moment of converting an 8x8 sample block into the format +used by the DCT step (which will be signed short or long int). This could be +selectable by a compile-time flag, so that the intermediate steps can work on +either signed or unsigned chars as samples, whichever is most easily handled +by the platform. However, making sure that rounding is done right will be a +lot easier if we can assume positive values. At the moment I think that +benefit is worth the overhead of "& 0xFF" when reading out sample values on +signed-char-only machines. diff --git a/codingrules b/codingrules new file mode 100644 index 00000000..fd6f7003 --- /dev/null +++ b/codingrules @@ -0,0 +1,99 @@ + + JPEG SYSTEM CODING RULES 27-SEP-91 + +Since numerous people will be contributing code and bug fixes, it's important +to establish a common coding style. The goal of using similar coding styles +is much more important than the details of just what that style is. + +I suggest we follow the recommendations of "Recommended C Style and Coding +Standards" revision 6.1 (Cannon et al. as modified by Spencer, Keppel and +Brader). I have placed a copy of this document in the jpeg FTP archive (see +jpeg/doc/cstyle.ms.tbl.Z, or cstyle.txt.Z for those without nroff/tbl). + +Unless someone has a real strong objection, let's do block comments thusly: + +/* + * Block comments in this style. + */ + +and indent statements in K&R style, e.g., + + if (test) { + then-part; + } else { + else-part; + } + +I suggest that multi-word names be written in the style multi_word_name +rather than multiWordName, but I am open to argument on this. + + +I would like to use function prototypes everywhere, and rely on automatic +source code transformation to feed non-ANSI C compilers. The best tool +I have so far found for this is 'ansi2knr.c', which is part of Ghostscript. +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: + +static int * +function_name (int a, char *b) +{ + code... +} + +ansi2knr won't help with method declarations (function pointers in structs). +I suggest we use a macro to declare method pointers, something like this: + +#ifdef PROTO +#define METHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define METHOD(type,methodname,arglist) type (*methodname) () +#endif + +which is used like this: + +struct function_pointers { + METHOD(void, init_entropy_encoder, (functptrs fptrs, jparms *jp)); + METHOD(void, term_entropy_encoder, (void)); +}; + +Note the set of parentheses surrounding the parameter list. + +A similar solution is used for external function declarations (see the PP +macro in jpegdata.h). + +If the code is to work on non-ANSI compilers, you cannot rely on a prototype +declaration to coerce actual parameters into the right types. Therefore, use +explicit casts on actual parameters whenever the actual parameter type is not +identical to the formal parameter. Beware of implicit conversions to "int". + +It seems there are some non-ANSI compilers in which the sizeof() operator +is defined to return int, while size_t is defined as long. Needless to say, +this is brain-damaged. Always use the SIZEOF() macro in place of sizeof(), +so that the result is guaranteed to be of type size_t. + + +We can expect that the JPEG compressor and decompressor will be incorporated +into larger programs. Therefore, the following rules are important: + +1. Avoid direct use of any file I/O, "malloc", error report printouts, etc; +pass these through the common routines provided. + +2. Assume that the JPEG code may be invoked more than once per program run; +therefore, do not rely on static initialization of variables, and be careful +to release all allocated storage at the end of processing. + +3. Minimize global namespace pollution. Functions should be declared static +wherever possible. (Note that our method-based calling conventions help this +a lot: in many modules only the method-selector function will ever need to be +called directly, so only that function need be externally visible.) All +global function names should begin with "j", and should be unique in the first +six characters for portability reasons. +Don't use global variables at all; anything that must be used in another +module should be put into parameters (there'll be some large structs passed +around for this purpose). + +4. Source file names should also begin with "j"; remember to keep them to +eight characters (plus ".c" or ".h", etc) to make life easy for MS-DOSers. +Do not put code for both compression and decompression into the same source +file. diff --git a/egetopt.c b/egetopt.c new file mode 100644 index 00000000..8183d358 --- /dev/null +++ b/egetopt.c @@ -0,0 +1,276 @@ +/* + * egetopt.c -- Extended 'getopt'. + * + * A while back, a public-domain version of getopt() was posted to the + * net. A bit later, a gentleman by the name of Keith Bostic made some + * enhancements and reposted it. + * + * In recent weeks (i.e., early-to-mid 1988) there's been some + * heated discussion in comp.lang.c about the merits and drawbacks + * of getopt(), especially with regard to its handling of '?'. + * + * In light of this, I have taken Mr. Bostic's public-domain getopt() + * and have made some changes that I hope will be considered to be + * improvements. I call this routine 'egetopt' ("Extended getopt"). + * The default behavior of this routine is the same as that of getopt(), + * but it has some optional features that make it more useful. These + * options are controlled by the settings of some global variables. + * By not setting any of these extra global variables, you will have + * the same functionality as getopt(), which should satisfy those + * purists who believe getopt() is perfect and can never be improved. + * If, on the other hand, you are someone who isn't satisfied with the + * status quo, egetopt() may very well give you the added capabilities + * you want. + * + * Look at the enclosed README file for a description of egetopt()'s + * new features. + * + * The code was originally posted to the net as getopt.c by ... + * + * Keith Bostic + * ARPA: keith@seismo + * UUCP: seismo!keith + * + * Current version: added enhancements and comments, reformatted code. + * + * Lloyd Zusman + * Master Byte Software + * Los Gatos, California + * Internet: ljz@fx.com + * UUCP: ...!ames!fxgrp!ljz + * + * May, 1988 + */ + +/* + * If you want, include stdio.h or something where EOF and NULL are defined. + * However, egetopt() is written so as not to need stdio.h, which should + * make it significantly smaller on some systems. + */ + +#ifndef EOF +# define EOF (-1) +#endif /* ! EOF */ + +#ifndef NULL +# define NULL (char *)0 +#endif /* ! NULL */ + +/* + * None of these constants are referenced in the executable portion of + * the code ... their sole purpose is to initialize global variables. + */ +#define BADCH (int)'?' +#define NEEDSEP (int)':' +#define MAYBESEP (int)'\0' +#define ERRFD 2 +#define EMSG "" +#define START "-" + +/* + * Here are all the pertinent global variables. + */ +int opterr = 1; /* if true, output error message */ +int optind = 1; /* index into parent argv vector */ +int optopt; /* character checked for validity */ +int optbad = BADCH; /* character returned on error */ +int optchar = 0; /* character that begins returned option */ +int optneed = NEEDSEP; /* flag for mandatory argument */ +int optmaybe = MAYBESEP;/* flag for optional argument */ +int opterrfd = ERRFD; /* file descriptor for error text */ +char *optarg; /* argument associated with option */ +char *optstart = START; /* list of characters that start options */ + + +/* + * Macros. + */ + +/* + * Conditionally print out an error message and return (depends on the + * setting of 'opterr' and 'opterrfd'). Note that this version of + * TELL() doesn't require the existence of stdio.h. + */ +#define TELL(S) { \ + if (opterr && opterrfd >= 0) { \ + char option = optopt; \ + write(opterrfd, *nargv, strlen(*nargv)); \ + write(opterrfd, (S), strlen(S)); \ + write(opterrfd, &option, 1); \ + write(opterrfd, "\n", 1); \ + } \ + return (optbad); \ +} + +/* + * This works similarly to index() and strchr(). I include it so that you + * don't need to be concerned as to which one your system has. + */ +static char * +_sindex(string, ch) +char *string; +int ch; +{ + if (string != NULL) { + for (; *string != '\0'; ++string) { + if (*string == (char)ch) { + return (string); + } + } + } + + return (NULL); +} + +/* + * Here it is: + */ +int +egetopt(nargc, nargv, ostr) +int nargc; +char **nargv; +char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + register char *oli; /* option letter list index */ + register char *osi = NULL; /* option start list index */ + + if (nargv == (char **)NULL) { + return (EOF); + } + + if (nargc <= optind || nargv[optind] == NULL) { + return (EOF); + } + + if (place == NULL) { + place = EMSG; + } + + /* + * Update scanning pointer. + */ + if (*place == '\0') { + place = nargv[optind]; + if (place == NULL) { + return (EOF); + } + osi = _sindex(optstart, *place); + if (osi != NULL) { + optchar = (int)*osi; + } + if (optind >= nargc || osi == NULL || *++place == '\0') { + return (EOF); + } + + /* + * Two adjacent, identical flag characters were found. + * This takes care of "--", for example. + */ + if (*place == place[-1]) { + ++optind; + return (EOF); + } + } + + /* + * If the option is a separator or the option isn't in the list, + * we've got an error. + */ + optopt = (int)*place++; + oli = _sindex(ostr, optopt); + if (optopt == optneed || optopt == optmaybe || oli == NULL) { + /* + * If we're at the end of the current argument, bump the + * argument index. + */ + if (*place == '\0') { + ++optind; + } + TELL(": illegal option -- "); /* byebye */ + } + + /* + * If there is no argument indicator, then we don't even try to + * return an argument. + */ + ++oli; + if (*oli == '\0' || (*oli != optneed && *oli != optmaybe)) { + /* + * If we're at the end of the current argument, bump the + * argument index. + */ + if (*place == '\0') { + ++optind; + } + optarg = NULL; + } + /* + * If we're here, there's an argument indicator. It's handled + * differently depending on whether it's a mandatory or an + * optional argument. + */ + else { + /* + * If there's no white space, use the rest of the + * string as the argument. In this case, it doesn't + * matter if the argument is mandatory or optional. + */ + if (*place != '\0') { + optarg = place; + } + /* + * If we're here, there's whitespace after the option. + * + * Is it a mandatory argument? If so, return the + * next command-line argument if there is one. + */ + else if (*oli == optneed) { + /* + * If we're at the end of the argument list, there + * isn't an argument and hence we have an error. + * Otherwise, make 'optarg' point to the argument. + */ + if (nargc <= ++optind) { + place = EMSG; + TELL(": option requires an argument -- "); + } + else { + optarg = nargv[optind]; + } + } + /* + * If we're here it must have been an optional argument. + */ + else { + if (nargc <= ++optind) { + place = EMSG; + optarg = NULL; + } + else { + optarg = nargv[optind]; + if (optarg == NULL) { + place = EMSG; + } + /* + * If the next item begins with a flag + * character, we treat it like a new + * argument. This is accomplished by + * decrementing 'optind' and returning + * a null argument. + */ + else if (_sindex(optstart, *optarg) != NULL) { + --optind; + optarg = NULL; + } + } + } + place = EMSG; + ++optind; + } + + /* + * Return option letter. + */ + return (optopt); +} diff --git a/jbsmooth.c b/jbsmooth.c new file mode 100644 index 00000000..ad2138df --- /dev/null +++ b/jbsmooth.c @@ -0,0 +1,120 @@ +/* + * jbsmooth.c + * + * Copyright (C) 1991, 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. + * + * This file contains cross-block smoothing routines. + * These routines are invoked via the smooth_coefficients method. + */ + +#include "jinclude.h" + +#ifdef BLOCK_SMOOTHING_SUPPORTED + + +/* + * Cross-block coefficient smoothing. + */ + +METHODDEF void +smooth_coefficients (decompress_info_ptr cinfo, + jpeg_component_info *compptr, + JBLOCKROW above, + JBLOCKROW currow, + JBLOCKROW below, + JBLOCKROW output) +{ + QUANT_TBL_PTR Qptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; + long blocks_in_row = compptr->subsampled_width / DCTSIZE; + long col; + + /* First, copy the block row as-is. + * This takes care of the first & last blocks in the row, the top/bottom + * special cases, and the higher-order coefficients in each block. + */ + jcopy_block_row(currow, output, blocks_in_row); + + /* Now apply the smoothing calculation, but not to any blocks on the + * edges of the image. + */ + + if (above != NULL && below != NULL) { + for (col = 1; col < blocks_in_row-1; col++) { + + /* See section 13.10 of JPEG-8-R8, or K.8 of JPEG-9-R6. + * + * As I understand it, this produces approximations + * for the low frequency AC components, based on the + * DC values of the block and its eight neighboring blocks. + * (Thus it can't be used for blocks on the image edges.) + */ + + /* The layout of these variables corresponds to + * the text in 13.10 + */ + + JCOEF DC1, DC2, DC3; + JCOEF DC4, DC5, DC6; + JCOEF DC7, DC8, DC9; + + long AC01, AC02; + long AC10, AC11; + long AC20; + + DC1 = above [col-1][0]; + DC2 = above [col ][0]; + DC3 = above [col+1][0]; + DC4 = currow[col-1][0]; + DC5 = currow[col ][0]; + DC6 = currow[col+1][0]; + DC7 = below [col-1][0]; + DC8 = below [col ][0]; + DC9 = below [col+1][0]; + +#define DIVIDE_256(x) x = ( (x) < 0 ? -((128-(x))/256) : ((x)+128)/256 ) + + AC01 = (36 * (DC4 - DC6)); + DIVIDE_256(AC01); + AC10 = (36 * (DC2 - DC8)); + DIVIDE_256(AC10); + AC20 = (9 * (DC2 + DC8 - 2*DC5)); + DIVIDE_256(AC20); + AC11 = (5 * ((DC1 - DC3) - (DC7 - DC9))); + DIVIDE_256(AC11); + AC02 = (9 * (DC4 + DC6 - 2*DC5)); + DIVIDE_256(AC02); + + /* I think that this checks to see if the quantisation + * on the transmitting side would have produced this + * answer. If so, then we use our (hopefully better) + * estimate. + */ + +#define ABS(x) ((x) < 0 ? -(x) : (x)) + +#define COND_ASSIGN(_ac,_n,_z) if ((ABS(output[col][_n] - (_ac))<<1) <= Qptr[_z]) output[col][_n] = (_ac) + + COND_ASSIGN(AC01, 1, 1); + COND_ASSIGN(AC02, 2, 5); + COND_ASSIGN(AC10, 8, 2); + COND_ASSIGN(AC11, 9, 4); + COND_ASSIGN(AC20, 16, 3); + } + } +} + + +/* + * The method selection routine for cross-block smoothing. + */ + +GLOBAL void +jselbsmooth (decompress_info_ptr cinfo) +{ + /* just one implementation for now */ + cinfo->methods->smooth_coefficients = smooth_coefficients; +} + +#endif /* BLOCK_SMOOTHING_SUPPORTED */ diff --git a/jcarith.c b/jcarith.c new file mode 100644 index 00000000..1949459c --- /dev/null +++ b/jcarith.c @@ -0,0 +1,42 @@ +/* + * jcarith.c + * + * Copyright (C) 1991, 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. + * + * This file contains arithmetic entropy encoding routines. + * These routines are invoked via the methods entropy_encode, + * entropy_encoder_init/term, and entropy_optimize. + */ + +#include "jinclude.h" + +#ifdef ARITH_CODING_SUPPORTED + + +/* + * The arithmetic coding option of the JPEG standard specifies Q-coding, + * which is covered by patents held by IBM (and possibly AT&T and Mitsubishi). + * At this time it does not appear to be legal for the Independent JPEG + * Group to distribute software that implements arithmetic coding. + * We have therefore removed arithmetic coding support from the + * distributed source code. + * + * We're not happy about it either. + */ + + +/* + * The method selection routine for arithmetic entropy encoding. + */ + +GLOBAL void +jselcarithmetic (compress_info_ptr cinfo) +{ + if (cinfo->arith_code) { + ERREXIT(cinfo->emethods, "Sorry, there are legal restrictions on arithmetic coding"); + } +} + +#endif /* ARITH_CODING_SUPPORTED */ diff --git a/jccolor.c b/jccolor.c new file mode 100644 index 00000000..7fd198c9 --- /dev/null +++ b/jccolor.c @@ -0,0 +1,203 @@ +/* + * jccolor.c + * + * Copyright (C) 1991, 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. + * + * This file contains input colorspace conversion routines. + * These routines are invoked via the methods get_sample_rows + * and colorin_init/term. + */ + +#include "jinclude.h" + + +static JSAMPARRAY pixel_row; /* Workspace for a pixel row in input format */ + + +/* + * Initialize for colorspace conversion. + */ + +METHODDEF void +colorin_init (compress_info_ptr cinfo) +{ + /* Allocate a workspace for the result of get_input_row. */ + pixel_row = (*cinfo->emethods->alloc_small_sarray) + (cinfo->image_width, (long) cinfo->input_components); +} + + +/* + * Fetch some rows of pixels from get_input_row and convert to the + * JPEG colorspace. + * This version handles RGB -> YCbCr conversion. + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + */ + +METHODDEF void +get_rgb_ycc_rows (compress_info_ptr cinfo, + int rows_to_read, JSAMPIMAGE image_data) +{ + register INT32 r, g, b; + register JSAMPROW inptr0, inptr1, inptr2; + register JSAMPROW outptr0, outptr1, outptr2; + register long col; + long width = cinfo->image_width; + int row; + + for (row = 0; row < rows_to_read; row++) { + /* Read one row from the source file */ + (*cinfo->methods->get_input_row) (cinfo, pixel_row); + /* Convert colorspace */ + inptr0 = pixel_row[0]; + inptr1 = pixel_row[1]; + inptr2 = pixel_row[2]; + outptr0 = image_data[0][row]; + outptr1 = image_data[1][row]; + outptr2 = image_data[2][row]; + for (col = width; col > 0; col--) { + r = GETJSAMPLE(*inptr0++); + g = GETJSAMPLE(*inptr1++); + b = GETJSAMPLE(*inptr2++); + /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations + * must be too; do not need an explicit range-limiting operation. + */ + /* Y */ + *outptr0++ = ( 306*r + 601*g + 117*b + (INT32) 512) >> 10; + /* Cb */ + *outptr1++ = ((-173)*r - 339*g + 512*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10; + /* Cr */ + *outptr2++ = ( 512*r - 429*g - 83*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10; + } + } +} + + +/* + * Fetch some rows of pixels from get_input_row and convert to the + * JPEG colorspace. + * This version handles grayscale (no conversion). + */ + +METHODDEF void +get_grayscale_rows (compress_info_ptr cinfo, + int rows_to_read, JSAMPIMAGE image_data) +{ + int row; + + for (row = 0; row < rows_to_read; row++) { + /* Read one row from the source file */ + (*cinfo->methods->get_input_row) (cinfo, pixel_row); + /* Convert colorspace (gamma mapping needed here) */ + jcopy_sample_rows(pixel_row, 0, image_data[0], row, + 1, cinfo->image_width); + } +} + + +/* + * Fetch some rows of pixels from get_input_row and convert to the + * JPEG colorspace. + * This version handles multi-component colorspaces without conversion. + */ + +METHODDEF void +get_noconvert_rows (compress_info_ptr cinfo, + int rows_to_read, JSAMPIMAGE image_data) +{ + int row, ci; + + for (row = 0; row < rows_to_read; row++) { + /* Read one row from the source file */ + (*cinfo->methods->get_input_row) (cinfo, pixel_row); + /* Convert colorspace (gamma mapping needed here) */ + for (ci = 0; ci < cinfo->input_components; ci++) { + jcopy_sample_rows(pixel_row, ci, image_data[ci], row, + 1, cinfo->image_width); + } + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +colorin_term (compress_info_ptr cinfo) +{ + /* Release the workspace. */ + (*cinfo->emethods->free_small_sarray) + (pixel_row, (long) cinfo->input_components); +} + + +/* + * The method selection routine for input colorspace conversion. + */ + +GLOBAL void +jselccolor (compress_info_ptr cinfo) +{ + /* Make sure input_components agrees with in_color_space */ + switch (cinfo->in_color_space) { + case CS_GRAYSCALE: + if (cinfo->input_components != 1) + ERREXIT(cinfo->emethods, "Bogus input colorspace"); + break; + + case CS_RGB: + if (cinfo->input_components != 3) + ERREXIT(cinfo->emethods, "Bogus input colorspace"); + break; + + case CS_CMYK: + if (cinfo->input_components != 4) + ERREXIT(cinfo->emethods, "Bogus input colorspace"); + break; + + default: + ERREXIT(cinfo->emethods, "Unsupported input colorspace"); + break; + } + + /* Check num_components, set conversion method based on requested space */ + switch (cinfo->jpeg_color_space) { + case CS_GRAYSCALE: + if (cinfo->num_components != 1) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + if (cinfo->in_color_space == CS_GRAYSCALE) + cinfo->methods->get_sample_rows = get_grayscale_rows; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + case CS_YCbCr: + if (cinfo->num_components != 3) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + if (cinfo->in_color_space == CS_RGB) + cinfo->methods->get_sample_rows = get_rgb_ycc_rows; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + case CS_CMYK: + if (cinfo->num_components != 4) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + if (cinfo->in_color_space == CS_CMYK) + cinfo->methods->get_sample_rows = get_noconvert_rows; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + default: + ERREXIT(cinfo->emethods, "Unsupported JPEG colorspace"); + break; + } + + cinfo->methods->colorin_init = colorin_init; + cinfo->methods->colorin_term = colorin_term; +} diff --git a/jcdeflts.c b/jcdeflts.c new file mode 100644 index 00000000..cd1624ad --- /dev/null +++ b/jcdeflts.c @@ -0,0 +1,364 @@ +/* + * jcdeflts.c + * + * Copyright (C) 1991, 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. + * + * This file contains optional default-setting code for the JPEG compressor. + */ + +#include "jinclude.h" + + +LOCAL void +add_huff_table (compress_info_ptr cinfo, + HUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) +/* Define a Huffman table */ +{ + if (*htblptr == NULL) + *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + + memcpy((void *) (*htblptr)->bits, (void *) bits, + SIZEOF((*htblptr)->bits)); + memcpy((void *) (*htblptr)->huffval, (void *) val, + SIZEOF((*htblptr)->huffval)); + + /* Initialize sent_table FALSE so table will be written to JPEG file. + * In an application where we are writing non-interchange JPEG files, + * it might be desirable to save space by leaving default Huffman tables + * out of the file. To do that, just initialize sent_table = TRUE... + */ + + (*htblptr)->sent_table = FALSE; +} + + +LOCAL void +std_huff_tables (compress_info_ptr cinfo) +/* Set up the standard Huffman tables (cf. JPEG-8-R8 section 13.3) */ +{ + static const UINT8 dc_luminance_bits[17] = + { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; + static const UINT8 dc_luminance_val[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + static const UINT8 dc_chrominance_bits[17] = + { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; + static const UINT8 dc_chrominance_val[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + static const UINT8 ac_luminance_bits[17] = + { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; + static const UINT8 ac_luminance_val[] = + { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa }; + + static const UINT8 ac_chrominance_bits[17] = + { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + static const UINT8 ac_chrominance_val[] = + { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa }; + + add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], + dc_luminance_bits, dc_luminance_val); + add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], + ac_luminance_bits, ac_luminance_val); + add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1], + dc_chrominance_bits, dc_chrominance_val); + add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1], + ac_chrominance_bits, ac_chrominance_val); +} + + +/* This is the sample quantization table given in JPEG-8-R8 sec 13.1, + * but expressed in zigzag order (as are all of our quant. tables). + * The spec says that the values given produce "good" quality, and + * when divided by 2, "very good" quality. (These two settings are + * selected by quality=50 and quality=75 in j_set_quality, below.) + */ + + +static const QUANT_VAL 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 +}; + +static const QUANT_VAL 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, + 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 +}; + + +LOCAL void +add_quant_table (compress_info_ptr cinfo, int which_tbl, + const QUANT_VAL *basic_table, int scale_factor, + boolean force_baseline) +/* Define a quantization table equal to the basic_table times */ +/* a scale factor (given as a percentage) */ +{ + QUANT_TBL_PTR * qtblptr = & cinfo->quant_tbl_ptrs[which_tbl]; + int i; + long temp; + + if (*qtblptr == NULL) + *qtblptr = (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); + + for (i = 0; i < DCTSIZE2; i++) { + temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; + /* limit the values to the valid range */ + if (temp <= 0L) temp = 1L; +#ifdef EIGHT_BIT_SAMPLES + if (temp > 32767L) temp = 32767L; /* QUANT_VALs are 'short' */ +#else + if (temp > 65535L) temp = 65535L; /* QUANT_VALs are 'UINT16' */ +#endif + if (force_baseline && temp > 255L) + temp = 255L; /* limit to baseline range if requested */ + (*qtblptr)[i] = (QUANT_VAL) temp; + } +} + + +GLOBAL void +j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline) +/* Set or change the 'quality' (quantization) setting. */ +/* The 'quality' factor should be 0 (terrible) to 100 (very good). */ +/* Quality 50 corresponds to the JPEG basic tables given above; */ +/* quality 100 results in no quantization scaling at all. */ +/* If force_baseline is TRUE, quantization table entries are limited */ +/* to 0..255 for JPEG baseline compatibility; this is only an issue */ +/* for quality settings below 24. */ +{ + /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */ + if (quality <= 0) quality = 1; + if (quality > 100) quality = 100; + + /* Convert quality rating to a percentage scaling of the basic tables. + * 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 add_quant_table + * to make all the table entries 1 (hence, no quantization loss). + * Qualities 1..50 are converted to scaling percentage 5000/Q. + */ + if (quality < 50) + quality = 5000 / quality; + else + quality = 200 - quality*2; + + /* Set up two quantization tables using the specified quality scaling */ + add_quant_table(cinfo, 0, std_luminance_quant_tbl, quality, force_baseline); + add_quant_table(cinfo, 1, std_chrominance_quant_tbl, quality, force_baseline); +} + + + +/* Default parameter setup for compression. + * + * User interfaces that don't choose to use this routine must do their + * own setup of all these parameters. Alternately, you can call this + * to establish defaults and then alter parameters selectively. + * + * See above for the meaning of the 'quality' parameter. Typically, + * the application's default quality setting will be passed to this + * routine. A later call on j_set_quality() can be used to change to + * a user-specified quality setting. + * + * This sets up for a color image; to output a grayscale image, + * do this first and call j_monochrome_default() afterwards. + * (The latter can be called within c_ui_method_selection, so the + * choice can depend on the input file header.) + * Note that if you want a JPEG colorspace other than GRAYSCALE or YCbCr, + * you should also change the component ID codes, and you should NOT emit + * a JFIF header (set write_JFIF_header = FALSE). + * + * CAUTION: if you want to compress multiple images per run, it's safest + * to call j_default_compression before *each* call to jpeg_compress (and + * j_free_defaults afterwards). If this isn't practical, you'll have to + * be careful to reset any individual parameters that may change during + * the compression run. The main thing you need to worry about as this + * is written is that the sent_table boolean in each Huffman table must + * be reset to FALSE before each compression; otherwise, Huffman tables + * won't get emitted for the second and subsequent images. + */ + +GLOBAL void +j_default_compression (compress_info_ptr cinfo, int quality) +/* NB: the external methods must already be set up. */ +{ + short i; + jpeg_component_info * compptr; + + /* Initialize pointers as needed to mark stuff unallocated. */ + cinfo->comp_info = NULL; + for (i = 0; i < NUM_QUANT_TBLS; i++) + cinfo->quant_tbl_ptrs[i] = NULL; + for (i = 0; i < NUM_HUFF_TBLS; i++) { + cinfo->dc_huff_tbl_ptrs[i] = NULL; + cinfo->ac_huff_tbl_ptrs[i] = NULL; + } + + cinfo->data_precision = 8; /* default; can be overridden by input_init */ + cinfo->density_unit = 0; /* Pixel size is unknown by default */ + cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ + cinfo->Y_density = 1; + + cinfo->input_gamma = 1.0; /* no gamma correction by default */ + + /* Prepare three color components; first is luminance which is also usable */ + /* for grayscale. The others are assumed to be UV or similar chrominance. */ + cinfo->write_JFIF_header = TRUE; + cinfo->jpeg_color_space = CS_YCbCr; + cinfo->num_components = 3; + cinfo->comp_info = (*cinfo->emethods->alloc_small) + (4 * SIZEOF(jpeg_component_info)); + /* Note: we allocate a 4-entry comp_info array so that user interface can + * easily change over to CMYK color space if desired. + */ + + compptr = &cinfo->comp_info[0]; + compptr->component_index = 0; + compptr->component_id = 1; /* JFIF specifies IDs 1,2,3 */ + compptr->h_samp_factor = 2; /* default to 2x2 subsamples of chrominance */ + compptr->v_samp_factor = 2; + compptr->quant_tbl_no = 0; /* use tables 0 for luminance */ + compptr->dc_tbl_no = 0; + compptr->ac_tbl_no = 0; + + compptr = &cinfo->comp_info[1]; + compptr->component_index = 1; + compptr->component_id = 2; + compptr->h_samp_factor = 1; + compptr->v_samp_factor = 1; + compptr->quant_tbl_no = 1; /* use tables 1 for chrominance */ + compptr->dc_tbl_no = 1; + compptr->ac_tbl_no = 1; + + compptr = &cinfo->comp_info[2]; + compptr->component_index = 2; + compptr->component_id = 3; + compptr->h_samp_factor = 1; + compptr->v_samp_factor = 1; + compptr->quant_tbl_no = 1; /* use tables 1 for chrominance */ + compptr->dc_tbl_no = 1; + compptr->ac_tbl_no = 1; + + /* Set up two quantization tables using the specified quality scaling */ + /* Baseline compatibility is forced (a nonissue for reasonable defaults) */ + j_set_quality(cinfo, quality, TRUE); + + /* Set up two Huffman tables in case user interface wants Huffman coding */ + std_huff_tables(cinfo); + + /* Initialize default arithmetic coding conditioning */ + for (i = 0; i < NUM_ARITH_TBLS; i++) { + cinfo->arith_dc_L[i] = 0; + cinfo->arith_dc_U[i] = 1; + cinfo->arith_ac_K[i] = 5; + } + + /* Use Huffman coding, not arithmetic coding, by default */ + cinfo->arith_code = FALSE; + + /* Color images are interleaved by default */ + cinfo->interleave = TRUE; + + /* By default, don't do extra passes to optimize entropy coding */ + cinfo->optimize_coding = FALSE; + + /* By default, use the simpler non-cosited sampling alignment */ + cinfo->CCIR601_sampling = FALSE; + + /* No restart markers */ + cinfo->restart_interval = 0; +} + + + +GLOBAL void +j_monochrome_default (compress_info_ptr cinfo) +/* Change the j_default_compression() values to emit a monochrome JPEG file. */ +{ + jpeg_component_info * compptr; + + cinfo->jpeg_color_space = CS_GRAYSCALE; + cinfo->num_components = 1; + /* Set single component to 1x1 subsampling */ + compptr = &cinfo->comp_info[0]; + compptr->h_samp_factor = 1; + compptr->v_samp_factor = 1; +} + + + +/* This routine releases storage allocated by j_default_compression. + * Note that freeing the method pointer structs and the compress_info_struct + * itself are the responsibility of the user interface. + */ + +GLOBAL void +j_free_defaults (compress_info_ptr cinfo) +{ + short i; + +#define FREE(ptr) if ((ptr) != NULL) \ + (*cinfo->emethods->free_small) ((void *) ptr) + + FREE(cinfo->comp_info); + for (i = 0; i < NUM_QUANT_TBLS; i++) + FREE(cinfo->quant_tbl_ptrs[i]); + for (i = 0; i < NUM_HUFF_TBLS; i++) { + FREE(cinfo->dc_huff_tbl_ptrs[i]); + FREE(cinfo->ac_huff_tbl_ptrs[i]); + } +} diff --git a/jcexpand.c b/jcexpand.c new file mode 100644 index 00000000..94878bd9 --- /dev/null +++ b/jcexpand.c @@ -0,0 +1,75 @@ +/* + * jcexpand.c + * + * Copyright (C) 1991, 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. + * + * This file contains image edge-expansion routines. + * These routines are invoked via the edge_expand method. + */ + +#include "jinclude.h" + + +/* + * Expand an image so that it is a multiple of the MCU dimensions. + * This is to be accomplished by duplicating the rightmost column + * and/or bottommost row of pixels. The image has not yet been + * subsampled, so all components have the same dimensions. + */ + +METHODDEF void +edge_expand (compress_info_ptr cinfo, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPIMAGE image_data) +{ + /* Expand horizontally */ + if (input_cols < output_cols) { + register JSAMPROW ptr; + register JSAMPLE pixval; + register long count; + register int row; + short ci; + long numcols = output_cols - input_cols; + + for (ci = 0; ci < cinfo->num_components; ci++) { + for (row = 0; row < input_rows; row++) { + ptr = image_data[ci][row] + (input_cols-1); + pixval = GETJSAMPLE(*ptr++); + for (count = numcols; count > 0; count--) + *ptr++ = pixval; + } + } + } + + /* Expand vertically */ + /* This happens only once at the bottom of the image, */ + /* so it needn't be super-efficient */ + if (input_rows < output_rows) { + register int row; + short ci; + JSAMPARRAY this_component; + + for (ci = 0; ci < cinfo->num_components; ci++) { + this_component = image_data[ci]; + for (row = input_rows; row < output_rows; row++) { + jcopy_sample_rows(this_component, input_rows-1, this_component, row, + 1, output_cols); + } + } + } +} + + +/* + * The method selection routine for edge expansion. + */ + +GLOBAL void +jselexpand (compress_info_ptr cinfo) +{ + /* just one implementation for now */ + cinfo->methods->edge_expand = edge_expand; +} diff --git a/jchuff.c b/jchuff.c new file mode 100644 index 00000000..531bc75e --- /dev/null +++ b/jchuff.c @@ -0,0 +1,689 @@ +/* + * jchuff.c + * + * Copyright (C) 1991, 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. + * + * This file contains Huffman entropy encoding routines. + * These routines are invoked via the methods entropy_encode, + * entropy_encoder_init/term, and entropy_optimize. + */ + +#include "jinclude.h" + + +/* Static variables to avoid passing 'round extra parameters */ + +static compress_info_ptr cinfo; + +static INT32 huff_put_buffer; /* current bit-accumulation buffer */ +static int huff_put_bits; /* # of bits now in it */ + +static char * output_buffer; /* output buffer */ +static int bytes_in_buffer; + + + +LOCAL void +fix_huff_tbl (HUFF_TBL * htbl) +/* Compute derived values for a Huffman table */ +{ + int p, i, l, lastp, si; + char huffsize[257]; + UINT16 huffcode[257]; + UINT16 code; + + /* Figure 7.3.5.4.2.1: make table of Huffman code length for each symbol */ + /* Note that this is in code-length order. */ + + p = 0; + for (l = 1; l <= 16; l++) { + for (i = 1; i <= htbl->bits[l]; i++) + huffsize[p++] = l; + } + huffsize[p] = 0; + lastp = p; + + /* Figure 7.3.5.4.2.2: generate the codes themselves */ + /* Note that this is in code-length order. */ + + code = 0; + si = huffsize[0]; + p = 0; + while (huffsize[p]) { + while (huffsize[p] == si) { + huffcode[p++] = code; + code++; + } + code <<= 1; + si++; + } + + /* Figure 7.3.5.4.2.3: generate encoding tables */ + /* These are code and size indexed by symbol value */ + + for (p = 0; p < lastp; p++) { + htbl->ehufco[htbl->huffval[p]] = huffcode[p]; + htbl->ehufsi[htbl->huffval[p]] = huffsize[p]; + } + + /* Figure 13.4.2.3.1: generate decoding tables */ + + p = 0; + for (l = 1; l <= 16; l++) { + if (htbl->bits[l]) { + htbl->valptr[l] = p; /* huffval[] index of 1st sym of code len l */ + htbl->mincode[l] = huffcode[p]; /* minimum code of length l */ + p += htbl->bits[l]; + htbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ + } else { + htbl->maxcode[l] = -1; + } + } +} + + +/* Outputting bytes to the file */ + +LOCAL void +flush_bytes (void) +{ + if (bytes_in_buffer) + (*cinfo->methods->entropy_output) (cinfo, output_buffer, bytes_in_buffer); + bytes_in_buffer = 0; +} + + +#define emit_byte(val) ((bytes_in_buffer >= JPEG_BUF_SIZE ? \ + (flush_bytes(), 0) : 0), \ + output_buffer[bytes_in_buffer] = (val), \ + bytes_in_buffer++) + + + +/* Outputting bits to the file */ + +/* Only the right 24 bits of huff_put_buffer are used; the valid bits are + * left-justified in this part. At most 16 bits can be passed to emit_bits + * in one call, and we never retain more than 7 bits in huff_put_buffer + * between calls, so 24 bits are sufficient. + */ + +LOCAL void +emit_bits (UINT16 code, int size) +{ + /* This routine is heavily used, so it's worth coding tightly. */ + register INT32 put_buffer = code; + register int put_bits = huff_put_bits; + + put_buffer &= (((INT32) 1) << size) - 1; /* Mask off any excess bits in code */ + + put_bits += size; /* new number of bits in buffer */ + + put_buffer <<= 24 - put_bits; /* align incoming bits */ + + put_buffer |= huff_put_buffer; /* and merge with old buffer contents */ + + while (put_bits >= 8) { + int c = (int) ((put_buffer >> 16) & 0xFF); + + emit_byte(c); + if (c == 0xFF) { /* need to stuff a zero byte? */ + emit_byte(0); + } + put_buffer <<= 8; + put_bits -= 8; + } + + huff_put_buffer = put_buffer; /* Update global variables */ + huff_put_bits = put_bits; +} + + +LOCAL void +flush_bits (void) +{ + emit_bits((UINT16) 0x7F, 7); /* fill any partial byte with ones */ + huff_put_buffer = 0; /* and reset bit-buffer to empty */ + huff_put_bits = 0; +} + + + +/* Encode a single block's worth of coefficients */ +/* Note that the DC coefficient has already been converted to a difference */ + +LOCAL void +encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) +{ + register INT32 temp; + register int nbits; + register int k, r, i; + + /* Encode the DC coefficient difference per section 7.3.5.1 */ + + /* Find the number of bits needed for the magnitude of the coefficient */ + temp = block[0]; + if (temp < 0) temp = -temp; + + nbits = 0; + while (temp) { + nbits++; + temp >>= 1; + } + + /* Emit the Huffman-coded symbol for the number of bits */ + emit_bits(dctbl->ehufco[nbits], dctbl->ehufsi[nbits]); + + /* If positive, emit nbits low order bits; */ + /* if negative, emit nbits low order bits of value-1 */ + if ((temp = block[0]) < 0) + temp--; + + emit_bits((UINT16) temp, nbits); + + /* Encode the AC coefficients per section 7.3.5.2 */ + + r = 0; /* r = run length of zeros */ + + for (k = 1; k < DCTSIZE2; k++) { + if ((temp = block[k]) == 0) { + r++; + } else { + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + emit_bits(actbl->ehufco[0xF0], actbl->ehufsi[0xF0]); + r -= 16; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + if (temp < 0) temp = -temp; + + nbits = 1; /* there must be at least one 1 bit */ + while (temp >>= 1) + nbits++; + + /* Emit Huffman symbol for run length / number of bits */ + i = (r << 4) + nbits; + emit_bits(actbl->ehufco[i], actbl->ehufsi[i]); + + /* If positive, emit nbits low order bits; */ + /* if negative, emit nbits low order bits of value-1 */ + if ((temp = block[k]) < 0) + temp--; + + emit_bits((UINT16) temp, nbits); + + r = 0; + } + } + + /* If the last coef(s) were zero, emit an end-of-block code */ + if (r > 0) + emit_bits(actbl->ehufco[0], actbl->ehufsi[0]); +} + + + +/* + * Initialize for a Huffman-compressed scan. + * This is invoked after writing the SOS marker. + * The pipeline controller must establish the entropy_output method pointer + * before calling this routine. + */ + +METHODDEF void +huff_init (compress_info_ptr xinfo) +{ + short ci; + jpeg_component_info * compptr; + + /* Initialize static variables */ + cinfo = xinfo; + huff_put_buffer = 0; + huff_put_bits = 0; + + /* Initialize the output buffer */ + output_buffer = (char *) (*cinfo->emethods->alloc_small) + ((size_t) JPEG_BUF_SIZE); + bytes_in_buffer = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Make sure requested tables are present */ + if (cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no] == NULL || + cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no] == NULL) + ERREXIT(cinfo->emethods, "Use of undefined Huffman table"); + /* Compute derived values for Huffman tables */ + /* We may do this more than once for same table, but it's not a big deal */ + fix_huff_tbl(cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no]); + fix_huff_tbl(cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]); + /* Initialize DC predictions to 0 */ + cinfo->last_dc_val[ci] = 0; + } + + /* Initialize restart stuff */ + cinfo->restarts_to_go = cinfo->restart_interval; + cinfo->next_restart_num = 0; +} + + +/* + * Emit a restart marker & resynchronize predictions. + */ + +LOCAL void +emit_restart (compress_info_ptr cinfo) +{ + short ci; + + flush_bits(); + + emit_byte(0xFF); + emit_byte(RST0 + cinfo->next_restart_num); + + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + cinfo->last_dc_val[ci] = 0; + + /* Update restart state */ + cinfo->restarts_to_go = cinfo->restart_interval; + cinfo->next_restart_num++; + cinfo->next_restart_num &= 7; +} + + +/* + * Encode and output one MCU's worth of Huffman-compressed coefficients. + */ + +METHODDEF void +huff_encode (compress_info_ptr cinfo, JBLOCK *MCU_data) +{ + short blkn, ci; + jpeg_component_info * compptr; + JCOEF temp; + + /* Account for restart interval, emit restart marker if needed */ + if (cinfo->restart_interval) { + if (cinfo->restarts_to_go == 0) + emit_restart(cinfo); + cinfo->restarts_to_go--; + } + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + /* Convert DC value to difference, update last_dc_val */ + temp = MCU_data[blkn][0]; + MCU_data[blkn][0] -= cinfo->last_dc_val[ci]; + cinfo->last_dc_val[ci] = temp; + encode_one_block(MCU_data[blkn], + cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no], + cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]); + } +} + + +/* + * Finish up at the end of a Huffman-compressed scan. + */ + +METHODDEF void +huff_term (compress_info_ptr cinfo) +{ + /* Flush out the last data */ + flush_bits(); + flush_bytes(); + /* Release the I/O buffer */ + (*cinfo->emethods->free_small) ((void *) output_buffer); +} + + + + +/* + * Huffman coding optimization. + * + * This actually is optimization, in the sense that we find the best possible + * Huffman table(s) for the given data. We first scan the supplied data and + * count the number of uses of each symbol that is to be Huffman-coded. + * (This process must agree with the code above.) Then we build an + * optimal Huffman coding tree for the observed counts. + */ + +#ifdef ENTROPY_OPT_SUPPORTED + + +/* These are static so htest_one_block can find 'em */ +static long * dc_count_ptrs[NUM_HUFF_TBLS]; +static long * ac_count_ptrs[NUM_HUFF_TBLS]; + + +LOCAL void +gen_huff_coding (compress_info_ptr cinfo, HUFF_TBL *htbl, long freq[]) +/* Generate the optimal coding for the given counts */ +{ +#define MAX_CLEN 32 /* assumed maximum initial code length */ + UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ + short codesize[257]; /* codesize[k] = code length of symbol k */ + short others[257]; /* next symbol in current branch of tree */ + int c1, c2; + int p, i, j; + long v; + + /* This algorithm is explained in section 13.2 of JPEG-8-R8 */ + + MEMZERO((void *) bits, SIZEOF(bits)); + MEMZERO((void *) codesize, SIZEOF(codesize)); + for (i = 0; i < 257; i++) + others[i] = -1; /* init links to empty */ + + freq[256] = 1; /* make sure there is a nonzero count */ + /* including the pseudo-symbol 256 in the Huffman procedure guarantees + * that no real symbol is given code-value of all ones, because 256 + * will be placed in the largest codeword category. + */ + + /* Huffman's basic algorithm to assign optimal code lengths to symbols */ + + for (;;) { + /* Find the smallest nonzero frequency, set c1 = its symbol */ + /* In case of ties, take the larger symbol number */ + c1 = -1; + v = 1000000000L; + for (i = 0; i <= 256; i++) { + if (freq[i] && freq[i] <= v) { + v = freq[i]; + c1 = i; + } + } + + /* Find the next smallest nonzero frequency, set c2 = its symbol */ + /* In case of ties, take the larger symbol number */ + c2 = -1; + v = 1000000000L; + for (i = 0; i <= 256; i++) { + if (freq[i] && freq[i] <= v && i != c1) { + v = freq[i]; + c2 = i; + } + } + + /* Done if we've merged everything into one frequency */ + if (c2 < 0) + break; + + /* Else merge the two counts/trees */ + freq[c1] += freq[c2]; + freq[c2] = 0; + + /* Increment the codesize of everything in c1's tree branch */ + codesize[c1]++; + while (others[c1] >= 0) { + c1 = others[c1]; + codesize[c1]++; + } + + others[c1] = c2; /* chain c2 onto c1's tree branch */ + + /* Increment the codesize of everything in c2's tree branch */ + codesize[c2]++; + while (others[c2] >= 0) { + c2 = others[c2]; + codesize[c2]++; + } + } + + /* Now count the number of symbols of each code length */ + for (i = 0; i <= 256; i++) { + if (codesize[i]) { + /* The JPEG standard seems to think that this can't happen, */ + /* but I'm paranoid... */ + if (codesize[i] > MAX_CLEN) + ERREXIT(cinfo->emethods, "Huffman code size table overflow"); + + bits[codesize[i]]++; + } + } + + /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure + * Huffman procedure assigned any such lengths, we must adjust the coding. + * Here is what the JPEG spec says about how this next bit works: + * Since symbols are paired for the longest Huffman code, the symbols are + * removed from this length category two at a time. The prefix for the pair + * (which is one bit shorter) is allocated to one of the pair; then, + * skipping the BITS entry for that prefix length, a code word from the next + * shortest nonzero BITS entry is converted into a prefix for two code words + * one bit longer. + */ + + for (i = MAX_CLEN; i > 16; i--) { + while (bits[i] > 0) { + j = i - 2; /* find length of new prefix to be used */ + while (bits[j] == 0) + j--; + + bits[i] -= 2; /* remove two symbols */ + bits[i-1]++; /* one goes in this length */ + bits[j+1] += 2; /* two new symbols in this length */ + bits[j]--; /* symbol of this length is now a prefix */ + } + } + + /* Remove the count for the pseudo-symbol 256 from the largest codelength */ + while (bits[i] == 0) /* find largest codelength still in use */ + i--; + bits[i]--; + + /* Return final symbol counts (only for lengths 0..16) */ + memcpy((void *) htbl->bits, (void *) bits, SIZEOF(htbl->bits)); + + /* Return a list of the symbols sorted by code length */ + /* It's not real clear to me why we don't need to consider the codelength + * changes made above, but the JPEG spec seems to think this works. + */ + p = 0; + for (i = 1; i <= MAX_CLEN; i++) { + for (j = 0; j <= 255; j++) { + if (codesize[j] == i) { + htbl->huffval[p] = j; + p++; + } + } + } +} + + +/* Process a single block's worth of coefficients */ +/* Note that the DC coefficient has already been converted to a difference */ + +LOCAL void +htest_one_block (JBLOCK block, JCOEF block0, + long dc_counts[], long ac_counts[]) +{ + register INT32 temp; + register int nbits; + register int k, r; + + /* Encode the DC coefficient difference per section 7.3.5.1 */ + + /* Find the number of bits needed for the magnitude of the coefficient */ + temp = block0; + if (temp < 0) temp = -temp; + + for (nbits = 0; temp; nbits++) + temp >>= 1; + + /* Count the Huffman symbol for the number of bits */ + dc_counts[nbits]++; + + /* Encode the AC coefficients per section 7.3.5.2 */ + + r = 0; /* r = run length of zeros */ + + for (k = 1; k < DCTSIZE2; k++) { + if ((temp = block[k]) == 0) { + r++; + } else { + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + ac_counts[0xF0]++; + r -= 16; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + if (temp < 0) temp = -temp; + + for (nbits = 0; temp; nbits++) + temp >>= 1; + + /* Count Huffman symbol for run length / number of bits */ + ac_counts[(r << 4) + nbits]++; + + r = 0; + } + } + + /* If the last coef(s) were zero, emit an end-of-block code */ + if (r > 0) + ac_counts[0]++; +} + + + +/* + * Trial-encode one MCU's worth of Huffman-compressed coefficients. + */ + +LOCAL void +htest_encode (compress_info_ptr cinfo, JBLOCK *MCU_data) +{ + short blkn, ci; + jpeg_component_info * compptr; + + /* Take care of restart intervals if needed */ + if (cinfo->restart_interval) { + if (cinfo->restarts_to_go == 0) { + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + cinfo->last_dc_val[ci] = 0; + /* Update restart state */ + cinfo->restarts_to_go = cinfo->restart_interval; + } + cinfo->restarts_to_go--; + } + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + /* NB: unlike the real entropy encoder, we may not change the input data */ + htest_one_block(MCU_data[blkn], + (JCOEF) (MCU_data[blkn][0] - cinfo->last_dc_val[ci]), + dc_count_ptrs[compptr->dc_tbl_no], + ac_count_ptrs[compptr->ac_tbl_no]); + cinfo->last_dc_val[ci] = MCU_data[blkn][0]; + } +} + + + +/* + * Find the best coding parameters for a Huffman-coded scan. + * When called, the scan data has already been converted to a sequence of + * MCU groups of quantized coefficients, which are stored in a "big" array. + * The source_method knows how to iterate through that array. + * On return, the MCU data is unmodified, but the Huffman tables referenced + * by the scan components may have been altered. + */ + +METHODDEF void +huff_optimize (compress_info_ptr cinfo, MCU_output_caller_ptr source_method) +/* Optimize Huffman-coding parameters (Huffman symbol table) */ +{ + int i, tbl; + HUFF_TBL **htblptr; + + /* Allocate and zero the count tables */ + /* Note that gen_huff_coding expects 257 entries in each table! */ + + for (i = 0; i < NUM_HUFF_TBLS; i++) { + dc_count_ptrs[i] = NULL; + ac_count_ptrs[i] = NULL; + } + + for (i = 0; i < cinfo->comps_in_scan; i++) { + /* Create DC table */ + tbl = cinfo->cur_comp_info[i]->dc_tbl_no; + if (dc_count_ptrs[tbl] == NULL) { + dc_count_ptrs[tbl] = (long *) (*cinfo->emethods->alloc_small) + (257 * SIZEOF(long)); + MEMZERO((void *) dc_count_ptrs[tbl], 257 * SIZEOF(long)); + } + /* Create AC table */ + tbl = cinfo->cur_comp_info[i]->ac_tbl_no; + if (ac_count_ptrs[tbl] == NULL) { + ac_count_ptrs[tbl] = (long *) (*cinfo->emethods->alloc_small) + (257 * SIZEOF(long)); + MEMZERO((void *) ac_count_ptrs[tbl], 257 * SIZEOF(long)); + } + } + + /* Initialize DC predictions to 0 */ + for (i = 0; i < cinfo->comps_in_scan; i++) { + cinfo->last_dc_val[i] = 0; + } + /* Initialize restart stuff */ + cinfo->restarts_to_go = cinfo->restart_interval; + + /* Scan the MCU data, count symbol uses */ + (*source_method) (cinfo, htest_encode); + + /* Now generate optimal Huffman tables */ + for (tbl = 0; tbl < NUM_HUFF_TBLS; tbl++) { + if (dc_count_ptrs[tbl] != NULL) { + htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; + if (*htblptr == NULL) + *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + /* Set sent_table FALSE so updated table will be written to JPEG file. */ + (*htblptr)->sent_table = FALSE; + /* Compute the optimal Huffman encoding */ + gen_huff_coding(cinfo, *htblptr, dc_count_ptrs[tbl]); + /* Release the count table */ + (*cinfo->emethods->free_small) ((void *) dc_count_ptrs[tbl]); + } + if (ac_count_ptrs[tbl] != NULL) { + htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; + if (*htblptr == NULL) + *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + /* Set sent_table FALSE so updated table will be written to JPEG file. */ + (*htblptr)->sent_table = FALSE; + /* Compute the optimal Huffman encoding */ + gen_huff_coding(cinfo, *htblptr, ac_count_ptrs[tbl]); + /* Release the count table */ + (*cinfo->emethods->free_small) ((void *) ac_count_ptrs[tbl]); + } + } +} + + +#endif /* ENTROPY_OPT_SUPPORTED */ + + +/* + * The method selection routine for Huffman entropy encoding. + */ + +GLOBAL void +jselchuffman (compress_info_ptr cinfo) +{ + if (! cinfo->arith_code) { + cinfo->methods->entropy_encoder_init = huff_init; + cinfo->methods->entropy_encode = huff_encode; + cinfo->methods->entropy_encoder_term = huff_term; +#ifdef ENTROPY_OPT_SUPPORTED + cinfo->methods->entropy_optimize = huff_optimize; +#endif + } +} diff --git a/jcmain.c b/jcmain.c new file mode 100644 index 00000000..f71d5adf --- /dev/null +++ b/jcmain.c @@ -0,0 +1,272 @@ +/* + * jcmain.c + * + * Copyright (C) 1991, 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. + * + * This file contains a trivial test user interface for the JPEG compressor. + * It should work on any system with Unix- or MS-DOS-style command lines. + * + * Two different command line styles are permitted, depending on the + * compile-time switch TWO_FILE_COMMANDLINE: + * cjpeg [options] inputfile outputfile + * cjpeg [options] [inputfile] + * In the second style, output is always to standard output, which you'd + * normally redirect to a file or pipe to some other program. Input is + * either from a named file or from standard input (typically redirected). + * The second style is convenient on Unix but is unhelpful on systems that + * don't support pipes. Also, you MUST use the first style if your system + * doesn't do binary I/O to stdin/stdout. + */ + +#include "jinclude.h" +#ifdef __STDC__ +#include /* to declare exit() */ +#endif + +#ifdef THINK_C +#include /* command-line reader for Macintosh */ +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif + + +/* + * If your system has getopt(3), you can use your library version by + * defining HAVE_GETOPT. By default, we use the PD 'egetopt'. + */ + +#ifdef HAVE_GETOPT +extern int getopt PP((int argc, char **argv, char *optstring)); +extern char * optarg; +extern int optind; +#else +#include "egetopt.c" +#define getopt(argc,argv,opt) egetopt(argc,argv,opt) +#endif + + +/* + * This routine determines what format the input file is, + * and selects the appropriate input-reading module. + * + * To determine which family of input formats the file belongs to, + * we look only at the first byte of the file, since C does not + * guarantee that more than one character can be pushed back with ungetc. + * This is sufficient for the currently envisioned set of input formats. + * + * If you need to look at more than one character to select an input module, + * you can either + * 1) assume you can fseek() the input file (may fail for piped input); + * 2) assume you can push back more than one character (works in + * some C implementations, but unportable); + * or 3) don't put back the data, and modify the various input_init + * methods to assume they start reading after the start of file. + */ + +LOCAL void +select_file_type (compress_info_ptr cinfo) +{ + int c; + + if ((c = getc(cinfo->input_file)) == EOF) + ERREXIT(cinfo->emethods, "Empty input file"); + + switch (c) { +#ifdef GIF_SUPPORTED + case 'G': + jselrgif(cinfo); + break; +#endif +#ifdef PPM_SUPPORTED + case 'P': + jselrppm(cinfo); + break; +#endif + default: + ERREXIT(cinfo->emethods, "Unsupported input file format"); + break; + } + + if (ungetc(c, cinfo->input_file) == EOF) + ERREXIT(cinfo->emethods, "ungetc failed"); +} + + +/* + * This routine gets control after the input file header has been read. + * It must determine what output JPEG file format is to be written, + * and make any other compression parameter changes that are desirable. + */ + +METHODDEF void +c_ui_method_selection (compress_info_ptr cinfo) +{ + /* If the input is gray scale, generate a monochrome JPEG file. */ + if (cinfo->in_color_space == CS_GRAYSCALE) + j_monochrome_default(cinfo); + /* For now, always select JFIF output format. */ +#ifdef JFIF_SUPPORTED + jselwjfif(cinfo); +#else + You shoulda defined JFIF_SUPPORTED. /* deliberate syntax error */ +#endif +} + + +LOCAL void +usage (char * progname) +/* complain about bad command line */ +{ + fprintf(stderr, "usage: %s ", progname); + fprintf(stderr, "[-I] [-Q quality 0..100] [-a] [-o] [-d]"); +#ifdef TWO_FILE_COMMANDLINE + fprintf(stderr, " inputfile outputfile\n"); +#else + fprintf(stderr, " [inputfile]\n"); +#endif + exit(2); +} + + +/* + * The main program. + */ + +GLOBAL void +main (int argc, char **argv) +{ + struct compress_info_struct cinfo; + struct compress_methods_struct c_methods; + struct external_methods_struct e_methods; + int c; + + /* On Mac, fetch a command line. */ +#ifdef THINK_C + argc = ccommand(&argv); +#endif + + /* Initialize the system-dependent method pointers. */ + cinfo.methods = &c_methods; + cinfo.emethods = &e_methods; + jselerror(&e_methods); /* error/trace message routines */ + jselvirtmem(&e_methods); /* memory allocation routines */ + c_methods.c_ui_method_selection = c_ui_method_selection; + + /* Set up default input and output file references. */ + /* (These may be overridden below.) */ + cinfo.input_file = stdin; + cinfo.output_file = stdout; + + /* Set up default parameters. */ + e_methods.trace_level = 0; + j_default_compression(&cinfo, 75); /* default quality level */ + + /* Scan parameters */ + + while ((c = getopt(argc, argv, "IQ:aod")) != EOF) + switch (c) { + case 'I': /* Create noninterleaved file. */ +#ifdef MULTISCAN_FILES_SUPPORTED + cinfo.interleave = FALSE; +#else + fprintf(stderr, "%s: sorry, multiple-scan support was not compiled\n", + argv[0]); + exit(2); +#endif + break; + case 'Q': /* Quality factor. */ + { int val; + if (optarg == NULL) + usage(argv[0]); + if (sscanf(optarg, "%d", &val) != 1) + usage(argv[0]); + /* Note: for now, we leave force_baseline FALSE. + * In a production user interface, probably should make it TRUE + * unless overridden by a separate switch. + */ + j_set_quality(&cinfo, val, FALSE); + } + break; + case 'a': /* Use arithmetic coding. */ +#ifdef ARITH_CODING_SUPPORTED + cinfo.arith_code = TRUE; +#else + fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", + argv[0]); + exit(2); +#endif + break; + case 'o': /* Enable entropy parm optimization. */ +#ifdef ENTROPY_OPT_SUPPORTED + cinfo.optimize_coding = TRUE; +#else + fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", + argv[0]); + exit(2); +#endif + break; + case 'd': /* Debugging. */ + e_methods.trace_level++; + break; + case '?': + default: + usage(argv[0]); + break; + } + + /* Select the input and output files */ + +#ifdef TWO_FILE_COMMANDLINE + + if (optind != argc-2) { + fprintf(stderr, "%s: must name one input and one output file\n", argv[0]); + usage(argv[0]); + } + if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); + exit(2); + } + if ((cinfo.output_file = fopen(argv[optind+1], WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind+1]); + exit(2); + } + +#else /* not TWO_FILE_COMMANDLINE -- use Unix style */ + + if (optind < argc-1) { + fprintf(stderr, "%s: only one input file\n", argv[0]); + usage(argv[0]); + } + if (optind < argc) { + if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); + exit(2); + } + } + +#endif /* TWO_FILE_COMMANDLINE */ + + /* Figure out the input file format, and set up to read it. */ + select_file_type(&cinfo); + + /* Do it to it! */ + jpeg_compress(&cinfo); + + /* Release memory. */ + j_free_defaults(&cinfo); +#ifdef MEM_STATS + if (e_methods.trace_level > 0) + j_mem_stats(); +#endif + + /* All done. */ + exit(0); +} diff --git a/jcmaster.c b/jcmaster.c new file mode 100644 index 00000000..b15217a0 --- /dev/null +++ b/jcmaster.c @@ -0,0 +1,127 @@ +/* + * jcmaster.c + * + * Copyright (C) 1991, 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. + * + * This file contains the main control for the JPEG compressor. + * The system-dependent (user interface) code should call jpeg_compress() + * after doing appropriate setup of the compress_info_struct parameter. + */ + +#include "jinclude.h" + + +METHODDEF void +c_per_scan_method_selection (compress_info_ptr cinfo) +/* Central point for per-scan method selection */ +{ + /* Edge expansion */ + jselexpand(cinfo); + /* Subsampling of pixels */ + jselsubsample(cinfo); + /* MCU extraction */ + jselcmcu(cinfo); +} + + +LOCAL void +c_initial_method_selection (compress_info_ptr cinfo) +/* Central point for initial method selection */ +{ + /* Input image reading method selection is already done. */ + /* So is output file header formatting (both are done by user interface). */ + + /* Gamma and color space conversion */ + jselccolor(cinfo); + /* Entropy encoding: either Huffman or arithmetic coding. */ +#ifdef ARITH_CODING_SUPPORTED + jselcarithmetic(cinfo); +#else + cinfo->arith_code = FALSE; /* force Huffman mode */ +#endif + jselchuffman(cinfo); + /* Pipeline control */ + jselcpipeline(cinfo); + /* Overall control (that's me!) */ + cinfo->methods->c_per_scan_method_selection = c_per_scan_method_selection; +} + + +LOCAL void +initial_setup (compress_info_ptr cinfo) +/* Do computations that are needed before initial method selection */ +{ + short ci; + jpeg_component_info *compptr; + + /* Compute maximum sampling factors; check factor validity */ + cinfo->max_h_samp_factor = 1; + cinfo->max_v_samp_factor = 1; + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = &cinfo->comp_info[ci]; + if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + ERREXIT(cinfo->emethods, "Bogus sampling factors"); + cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, + compptr->h_samp_factor); + cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, + compptr->v_samp_factor); + + } + + /* Compute logical subsampled dimensions of components */ + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = &cinfo->comp_info[ci]; + compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor + + cinfo->max_h_samp_factor - 1) + / cinfo->max_h_samp_factor; + compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor + + cinfo->max_v_samp_factor - 1) + / cinfo->max_v_samp_factor; + } +} + + +/* + * This is the main entry point to the JPEG compressor. + */ + + +GLOBAL void +jpeg_compress (compress_info_ptr cinfo) +{ + /* Read the input file header: determine image size & component count. + * NOTE: the user interface must have initialized the input_init method + * pointer (eg, by calling jselrppm) before calling me. + * The other file reading methods (get_input_row etc.) were probably + * set at the same time, but could be set up by input_init itself, + * or by c_ui_method_selection. + */ + (*cinfo->methods->input_init) (cinfo); + + /* Give UI a chance to adjust compression parameters and select */ + /* output file format based on results of input_init. */ + (*cinfo->methods->c_ui_method_selection) (cinfo); + + /* Now select methods for compression steps. */ + initial_setup(cinfo); + c_initial_method_selection(cinfo); + + /* Initialize the output file & other modules as needed */ + /* (entropy_encoder is inited by pipeline controller) */ + + (*cinfo->methods->colorin_init) (cinfo); + (*cinfo->methods->write_file_header) (cinfo); + + /* And let the pipeline controller do the rest. */ + (*cinfo->methods->c_pipeline_controller) (cinfo); + + /* Finish output file, release working storage, etc */ + (*cinfo->methods->write_file_trailer) (cinfo); + (*cinfo->methods->colorin_term) (cinfo); + (*cinfo->methods->input_term) (cinfo); + + /* My, that was easy, wasn't it? */ +} diff --git a/jcmcu.c b/jcmcu.c new file mode 100644 index 00000000..1400eab7 --- /dev/null +++ b/jcmcu.c @@ -0,0 +1,212 @@ +/* + * jcmcu.c + * + * Copyright (C) 1991, 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. + * + * This file contains MCU extraction routines and quantization scaling. + * These routines are invoked via the extract_MCUs and + * extract_init/term methods. + */ + +#include "jinclude.h" + + +/* + * If this file is compiled with -DDCT_ERR_STATS, it will reverse-DCT each + * block and sum the total errors across the whole picture. This provides + * a convenient method of using real picture data to test the roundoff error + * of a DCT algorithm. DCT_ERR_STATS should *not* be defined for a production + * compression program, since compression is much slower with it defined. + * Also note that jrevdct.o must be linked into the compressor when this + * switch is defined. + */ + +#ifdef DCT_ERR_STATS +static int dcterrorsum; /* these hold the error statistics */ +static int dcterrormax; +static int dctcoefcount; /* This will probably overflow on a 16-bit-int machine */ +#endif + + +/* ZAG[i] is the natural-order position of the i'th element of zigzag order. */ + +static const short ZAG[DCTSIZE2] = { + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63 +}; + + +LOCAL void +extract_block (JSAMPARRAY input_data, int start_row, long start_col, + JBLOCK output_data, QUANT_TBL_PTR quanttbl) +/* Extract one 8x8 block from the specified location in the sample array; */ +/* perform forward DCT, quantization scaling, and zigzag reordering on it. */ +{ + /* This routine is heavily used, so it's worth coding it tightly. */ + DCTBLOCK block; +#ifdef DCT_ERR_STATS + DCTBLOCK svblock; /* saves input data for comparison */ +#endif + + { register JSAMPROW elemptr; + register DCTELEM *localblkptr = block; +#if DCTSIZE != 8 + register short elemc; +#endif + register short elemr; + + for (elemr = DCTSIZE; elemr > 0; elemr--) { + elemptr = input_data[start_row++] + start_col; +#if DCTSIZE == 8 /* unroll the inner loop */ + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; +#else + for (elemc = DCTSIZE; elemc > 0; elemc--) { + *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + } +#endif + } + } + +#ifdef DCT_ERR_STATS + memcpy((void *) svblock, (void *) block, SIZEOF(DCTBLOCK)); +#endif + + j_fwd_dct(block); + + { register JCOEF temp; + register short i; + + for (i = 0; i < DCTSIZE2; i++) { + temp = (JCOEF) block[ZAG[i]]; + /* divide by *quanttbl, ensuring proper rounding */ + if (temp < 0) { + temp = -temp; + temp += *quanttbl>>1; + temp /= *quanttbl; + temp = -temp; + } else { + temp += *quanttbl>>1; + temp /= *quanttbl; + } + *output_data++ = temp; + quanttbl++; + } + } + +#ifdef DCT_ERR_STATS + j_rev_dct(block); + + { register int diff; + register short i; + + for (i = 0; i < DCTSIZE2; i++) { + diff = block[i] - svblock[i]; + if (diff < 0) diff = -diff; + dcterrorsum += diff; + if (dcterrormax < diff) dcterrormax = diff; + } + dctcoefcount += DCTSIZE2; + } +#endif +} + + +/* + * Extract samples in MCU order, process & hand off to output_method. + * The input is always exactly N MCU rows worth of data. + */ + +METHODDEF void +extract_MCUs (compress_info_ptr cinfo, + JSAMPIMAGE image_data, + int num_mcu_rows, + MCU_output_method_ptr output_method) +{ + JBLOCK MCU_data[MAX_BLOCKS_IN_MCU]; + int mcurow; + long mcuindex; + short blkn, ci, xpos, ypos; + jpeg_component_info * compptr; + QUANT_TBL_PTR quant_ptr; + + for (mcurow = 0; mcurow < num_mcu_rows; mcurow++) { + for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) { + /* Extract data from the image array, DCT it, and quantize it */ + blkn = 0; + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; + for (ypos = 0; ypos < compptr->MCU_height; ypos++) { + for (xpos = 0; xpos < compptr->MCU_width; xpos++) { + extract_block(image_data[ci], + (mcurow * compptr->MCU_height + ypos)*DCTSIZE, + (mcuindex * compptr->MCU_width + xpos)*DCTSIZE, + MCU_data[blkn], quant_ptr); + blkn++; + } + } + } + /* Send the MCU whereever the pipeline controller wants it to go */ + (*output_method) (cinfo, MCU_data); + } + } +} + + +/* + * Initialize for processing a scan. + */ + +METHODDEF void +extract_init (compress_info_ptr cinfo) +{ + /* no work for now */ +#ifdef DCT_ERR_STATS + dcterrorsum = dcterrormax = dctcoefcount = 0; +#endif +} + + +/* + * Clean up after a scan. + */ + +METHODDEF void +extract_term (compress_info_ptr cinfo) +{ + /* no work for now */ +#ifdef DCT_ERR_STATS + TRACEMS3(cinfo->emethods, 0, "DCT roundoff errors = %d/%d, max = %d", + dcterrorsum, dctcoefcount, dcterrormax); +#endif +} + + + +/* + * The method selection routine for MCU extraction. + */ + +GLOBAL void +jselcmcu (compress_info_ptr cinfo) +{ + /* just one implementation for now */ + cinfo->methods->extract_init = extract_init; + cinfo->methods->extract_MCUs = extract_MCUs; + cinfo->methods->extract_term = extract_term; +} diff --git a/jconfig.h b/jconfig.h new file mode 100644 index 00000000..3b22acb7 --- /dev/null +++ b/jconfig.h @@ -0,0 +1,320 @@ +/* + * jconfig.h + * + * Copyright (C) 1991, 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. + * + * This file contains preprocessor declarations that help customize + * the JPEG software for a particular application, machine, or compiler. + * Edit these declarations as needed (or add -D flags to the Makefile). + */ + + +/* + * These symbols indicate the properties of your machine or compiler. + * The conditional definitions given may do the right thing already, + * but you'd best look them over closely, especially if your compiler + * does not handle full ANSI C. An ANSI-compliant C compiler should + * provide all the necessary features; __STDC__ is supposed to be + * predefined by such compilers. + */ + +/* Does your compiler support function prototypes? */ +/* (If not, you also need to use ansi2knr, see README) */ + +#ifdef __STDC__ /* ANSI C compilers always have prototypes */ +#define PROTO +#else +#ifdef __cplusplus /* So do C++ compilers */ +#define PROTO +#endif +#endif + +/* Does your compiler support the declaration "unsigned char" ? */ +/* How about "unsigned short" ? */ + +#ifdef __STDC__ /* ANSI C compilers must support both */ +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +#endif + +/* Define this if an ordinary "char" type is unsigned. + * If you're not sure, leaving it undefined will work at some cost in speed. + * If you defined HAVE_UNSIGNED_CHAR then it doesn't matter very much. + */ + +/* #define CHAR_IS_UNSIGNED */ + +/* Define this if your compiler implements ">>" on signed values as a logical + * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift, + * which is the normal and rational definition. + * The DCT and IDCT routines will compute wrong values if you get this wrong! + */ + +/* #define RIGHT_SHIFT_IS_UNSIGNED */ + +/* Define "void" as "char" if your compiler doesn't know about type void. + * NOTE: be sure to define void such that "void *" represents the most general + * pointer type, e.g., that returned by malloc(). + */ + +/* #define void char */ + +/* Define const as empty if your compiler doesn't know the "const" keyword. */ +/* (Even if it does, defining const as empty won't break anything.) */ + +#ifndef __STDC__ /* ANSI C and C++ compilers should know it. */ +#ifndef __cplusplus +#define const +#endif +#endif + +/* For 80x86 machines, you need to define NEED_FAR_POINTERS, + * unless you are using a large-data memory model or 80386 flat-memory mode. + * On less brain-damaged CPUs this symbol must not be defined. + * (Defining this symbol causes large data structures to be referenced through + * "far" pointers and to be allocated with a special version of malloc.) + */ + +#ifdef MSDOS /* Microsoft C and compatibles */ +#define NEED_FAR_POINTERS +#else +#ifdef __TURBOC__ /* Turbo C doesn't define MSDOS */ +#define NEED_FAR_POINTERS +#endif +#endif + + +/* The next couple of symbols only affect the system-dependent user interface + * modules (jcmain.c, jdmain.c). You can ignore these if you are supplying + * your own user interface code. + */ + +/* Define this if you want to name both input and output files on the command + * line, rather than using stdout and optionally stdin. You MUST do this if + * your system can't cope with binary I/O to stdin/stdout. See comments at + * head of jcmain.c or jdmain.c. + */ + +#ifdef MSDOS /* two-file style is needed for PCs */ +#define TWO_FILE_COMMANDLINE +#else +#ifdef __TURBOC__ /* Turbo C doesn't define MSDOS */ +#define TWO_FILE_COMMANDLINE +#endif +#endif +#ifdef THINK_C /* needed for Macintosh too */ +#define TWO_FILE_COMMANDLINE +#endif + +/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb"). + * This is necessary on systems that distinguish text files from binary files, + * and is harmless on most systems that don't. If you have one of the rare + * systems that complains about the "b" spec, define this symbol. + */ + +/* #define DONT_USE_B_MODE */ + + +/* If you're getting bored, that's the end of the symbols you HAVE to + * worry about. Go fix the makefile and compile. + */ + + +/* If your compiler supports inline functions, define INLINE as + * the inline keyword; otherwise define it as empty. + */ + +#ifdef __GNUC__ /* GNU C has inline... */ +#define INLINE inline +#else /* ...but I don't think anyone else does. */ +#define INLINE +#endif + +/* On a few systems, type boolean and/or macros FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * In that case you need only comment out these definitions. + */ + +typedef int boolean; +#define FALSE 0 /* values of boolean */ +#define TRUE 1 + +/* This defines the size of the I/O buffers for entropy compression + * and decompression; you could reduce it if memory is tight. + */ + +#define JPEG_BUF_SIZE 4096 /* bytes */ + + + +/* These symbols determine the JPEG functionality supported. */ + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * program file. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ +#undef ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing during decoding? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#undef QUANT_2PASS_SUPPORTED /* 2-pass color quantization? (not yet impl.) */ +/* these defines indicate which JPEG file formats are allowed */ +#define JFIF_SUPPORTED /* JFIF or "raw JPEG" files */ +#undef JTIFF_SUPPORTED /* JPEG-in-TIFF (not yet implemented) */ +/* these defines indicate which image (non-JPEG) file formats are allowed */ +#define PPM_SUPPORTED /* PPM/PGM image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#undef TIFF_SUPPORTED /* TIFF image file format (not yet impl.) */ + +/* more capability options later, no doubt */ + + +/* + * Define exactly one of these three symbols to indicate whether you want + * 8-bit, 12-bit, or 16-bit sample (pixel component) values. 8-bit is the + * default and is nearly always the right thing to use. You can use 12-bit if + * you need to support image formats with more than 8 bits of resolution in a + * color value. 16-bit should only be used for the lossless JPEG mode (not + * currently supported). Note that 12- and 16-bit values take up twice as + * much memory as 8-bit! + */ + +#define EIGHT_BIT_SAMPLES +#undef TWELVE_BIT_SAMPLES +#undef SIXTEEN_BIT_SAMPLES + + + +/* + * The remaining definitions don't need to be hand-edited in most cases. + * You may need to change these if you have a machine with unusual data + * types; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* First define the representation of a single pixel element value. */ + +#ifdef EIGHT_BIT_SAMPLES +/* JSAMPLE should be the smallest type that will hold the values 0..255. + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. + * If you have only signed chars, and you are more worried about speed than + * memory usage, it might be a win to make JSAMPLE be short. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) (value) + +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED + +typedef char JSAMPLE; +#define GETJSAMPLE(value) (value) + +#else /* not CHAR_IS_UNSIGNED */ + +typedef char JSAMPLE; +#define GETJSAMPLE(value) ((value) & 0xFF) + +#endif /* CHAR_IS_UNSIGNED */ +#endif /* HAVE_UNSIGNED_CHAR */ + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* EIGHT_BIT_SAMPLES */ + + +#ifdef TWELVE_BIT_SAMPLES +/* JSAMPLE should be the smallest type that will hold the values 0..4095. */ +/* On nearly all machines "short" will do nicely. */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) (value) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* TWELVE_BIT_SAMPLES */ + + +#ifdef SIXTEEN_BIT_SAMPLES +/* JSAMPLE should be the smallest type that will hold the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT + +typedef unsigned short JSAMPLE; +#define GETJSAMPLE(value) (value) + +#else /* not HAVE_UNSIGNED_SHORT */ + +/* If int is 32 bits this'll be horrendously inefficient storage-wise. + * But since we don't actually support 16-bit samples (ie lossless coding) yet, + * I'm not going to worry about making a smarter definition ... + */ +typedef unsigned int JSAMPLE; +#define GETJSAMPLE(value) (value) + +#endif /* HAVE_UNSIGNED_SHORT */ + +#define MAXJSAMPLE 65535 +#define CENTERJSAMPLE 32768 + +#endif /* SIXTEEN_BIT_SAMPLES */ + + +/* Here we define the representation of a DCT frequency coefficient. + * This should be a signed 16-bit value; "short" is usually right. + * It's important that this be exactly 16 bits, no more and no less; + * more will cost you a BIG hit of memory, less will give wrong answers. + */ + +typedef short JCOEF; + + +/* The remaining typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char UINT8; +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED +typedef char UINT8; +#else /* not CHAR_IS_UNSIGNED */ +typedef short UINT8; +#endif /* CHAR_IS_UNSIGNED */ +#endif /* HAVE_UNSIGNED_CHAR */ + +/* UINT16 must hold at least the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT +typedef unsigned short UINT16; +#else /* not HAVE_UNSIGNED_SHORT */ +typedef unsigned int UINT16; +#endif /* HAVE_UNSIGNED_SHORT */ + +/* INT16 must hold at least the values -32768..32767. */ + +typedef short INT16; + +/* INT32 must hold signed 32-bit values; if your machine happens */ +/* to have 64-bit longs, you might want to change this. */ + +typedef long INT32; diff --git a/jcpipe.c b/jcpipe.c new file mode 100644 index 00000000..f58e7dbf --- /dev/null +++ b/jcpipe.c @@ -0,0 +1,715 @@ +/* + * jcpipe.c + * + * Copyright (C) 1991, 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. + * + * This file contains compression pipeline controllers. + * These routines are invoked via the c_pipeline_controller method. + * + * There are four basic pipeline controllers, one for each combination of: + * single-scan JPEG file (single component or fully interleaved) + * vs. multiple-scan JPEG file (noninterleaved or partially interleaved). + * + * optimization of entropy encoding parameters + * vs. usage of default encoding parameters. + * + * Note that these conditions determine the needs for "big" arrays: + * multiple scans imply a big array for splitting the color components; + * entropy encoding optimization needs a big array for the MCU data. + * + * All but the simplest controller (single-scan, no optimization) can be + * compiled out through configuration options, if you need to make a minimal + * implementation. + */ + +#include "jinclude.h" + + +/* + * About the data structures: + * + * The processing chunk size for subsampling is referred to in this file as + * a "row group": a row group is defined as Vk (v_samp_factor) sample rows of + * any component after subsampling, or Vmax (max_v_samp_factor) unsubsampled + * rows. In an interleaved scan each MCU row contains exactly DCTSIZE row + * groups of each component in the scan. In a noninterleaved scan an MCU row + * is one row of blocks, which might not be an integral number of row groups; + * for convenience we use a buffer of the same size as in interleaved scans, + * and process Vk MCU rows in each burst of subsampling. + * To provide context for the subsampling step, we have to retain the last + * two row groups of the previous MCU row while reading in the next MCU row + * (or set of Vk MCU rows). To do this without copying data about, we create + * a rather strange data structure. Exactly DCTSIZE+2 row groups of samples + * are allocated, but we create two different sets of pointers to this array. + * The second set swaps the last two pairs of row groups. By working + * alternately with the two sets of pointers, we can access the data in the + * desired order. + */ + + + +/* + * Utility routines: common code for pipeline controllers + */ + +LOCAL void +interleaved_scan_setup (compress_info_ptr cinfo) +/* Compute all derived info for an interleaved (multi-component) scan */ +/* On entry, cinfo->comps_in_scan and cinfo->cur_comp_info[] are set up */ +{ + short ci, mcublks; + jpeg_component_info *compptr; + + if (cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); + + cinfo->MCUs_per_row = (cinfo->image_width + + cinfo->max_h_samp_factor*DCTSIZE - 1) + / (cinfo->max_h_samp_factor*DCTSIZE); + + cinfo->MCU_rows_in_scan = (cinfo->image_height + + cinfo->max_v_samp_factor*DCTSIZE - 1) + / (cinfo->max_v_samp_factor*DCTSIZE); + + cinfo->blocks_in_MCU = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* for interleaved scan, sampling factors give # of blocks per component */ + compptr->MCU_width = compptr->h_samp_factor; + compptr->MCU_height = compptr->v_samp_factor; + compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; + /* compute physical dimensions of component */ + compptr->subsampled_width = jround_up(compptr->true_comp_width, + (long) (compptr->MCU_width*DCTSIZE)); + compptr->subsampled_height = jround_up(compptr->true_comp_height, + (long) (compptr->MCU_height*DCTSIZE)); + /* Sanity check */ + if (compptr->subsampled_width != + (cinfo->MCUs_per_row * (compptr->MCU_width*DCTSIZE))) + ERREXIT(cinfo->emethods, "I'm confused about the image width"); + /* Prepare array describing MCU composition */ + mcublks = compptr->MCU_blocks; + if (cinfo->blocks_in_MCU + mcublks > MAX_BLOCKS_IN_MCU) + ERREXIT(cinfo->emethods, "Sampling factors too large for interleaved scan"); + while (mcublks-- > 0) { + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + } + } + + (*cinfo->methods->c_per_scan_method_selection) (cinfo); +} + + +LOCAL void +noninterleaved_scan_setup (compress_info_ptr cinfo) +/* Compute all derived info for a noninterleaved (single-component) scan */ +/* On entry, cinfo->comps_in_scan = 1 and cinfo->cur_comp_info[0] is set up */ +{ + jpeg_component_info *compptr = cinfo->cur_comp_info[0]; + + /* for noninterleaved scan, always one block per MCU */ + compptr->MCU_width = 1; + compptr->MCU_height = 1; + compptr->MCU_blocks = 1; + /* compute physical dimensions of component */ + compptr->subsampled_width = jround_up(compptr->true_comp_width, + (long) DCTSIZE); + compptr->subsampled_height = jround_up(compptr->true_comp_height, + (long) DCTSIZE); + + cinfo->MCUs_per_row = compptr->subsampled_width / DCTSIZE; + cinfo->MCU_rows_in_scan = compptr->subsampled_height / DCTSIZE; + + /* Prepare array describing MCU composition */ + cinfo->blocks_in_MCU = 1; + cinfo->MCU_membership[0] = 0; + + (*cinfo->methods->c_per_scan_method_selection) (cinfo); +} + + + +LOCAL void +alloc_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2], + long fullsize_width) +/* Create a pre-subsampling data buffer having the desired structure */ +/* (see comments at head of file) */ +{ + short ci, vs, i; + + vs = cinfo->max_v_samp_factor; /* row group height */ + + /* Get top-level space for array pointers */ + fullsize_data[0] = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + fullsize_data[1] = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + + for (ci = 0; ci < cinfo->num_components; ci++) { + /* Allocate the real storage */ + fullsize_data[0][ci] = (*cinfo->emethods->alloc_small_sarray) + (fullsize_width, + (long) (vs * (DCTSIZE+2))); + /* Create space for the scrambled-order pointers */ + fullsize_data[1][ci] = (JSAMPARRAY) (*cinfo->emethods->alloc_small) + (vs * (DCTSIZE+2) * SIZEOF(JSAMPROW)); + /* Duplicate the first DCTSIZE-2 row groups */ + for (i = 0; i < vs * (DCTSIZE-2); i++) { + fullsize_data[1][ci][i] = fullsize_data[0][ci][i]; + } + /* Copy the last four row groups in swapped order */ + for (i = 0; i < vs * 2; i++) { + fullsize_data[1][ci][vs*DCTSIZE + i] = fullsize_data[0][ci][vs*(DCTSIZE-2) + i]; + fullsize_data[1][ci][vs*(DCTSIZE-2) + i] = fullsize_data[0][ci][vs*DCTSIZE + i]; + } + } +} + + +LOCAL void +free_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2]) +/* Release a sampling buffer created by alloc_sampling_buffer */ +{ + short ci, vs; + + vs = cinfo->max_v_samp_factor; /* row group height */ + + for (ci = 0; ci < cinfo->num_components; ci++) { + /* Free the real storage */ + (*cinfo->emethods->free_small_sarray) + (fullsize_data[0][ci], (long) (vs * (DCTSIZE+2))); + /* Free the scrambled-order pointers */ + (*cinfo->emethods->free_small) ((void *) fullsize_data[1][ci]); + } + + /* Free the top-level space */ + (*cinfo->emethods->free_small) ((void *) fullsize_data[0]); + (*cinfo->emethods->free_small) ((void *) fullsize_data[1]); +} + + +LOCAL void +subsample (compress_info_ptr cinfo, + JSAMPIMAGE fullsize_data, JSAMPIMAGE subsampled_data, + long fullsize_width, + short above, short current, short below, short out) +/* Do subsampling of a single row group (of each component). */ +/* above, current, below are indexes of row groups in fullsize_data; */ +/* out is the index of the target row group in subsampled_data. */ +/* Special case: above, below can be -1 to indicate top, bottom of image. */ +{ + jpeg_component_info *compptr; + JSAMPARRAY above_ptr, below_ptr; + JSAMPROW dummy[MAX_SAMP_FACTOR]; /* for subsample expansion at top/bottom */ + short ci, vs, i; + + vs = cinfo->max_v_samp_factor; /* row group height */ + + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = & cinfo->comp_info[ci]; + + if (above >= 0) + above_ptr = fullsize_data[ci] + above * vs; + else { + /* Top of image: make a dummy above-context with copies of 1st row */ + /* We assume current=0 in this case */ + for (i = 0; i < vs; i++) + dummy[i] = fullsize_data[ci][0]; + above_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */ + } + + if (below >= 0) + below_ptr = fullsize_data[ci] + below * vs; + else { + /* Bot of image: make a dummy below-context with copies of last row */ + for (i = 0; i < vs; i++) + dummy[i] = fullsize_data[ci][(current+1)*vs-1]; + below_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */ + } + + (*cinfo->methods->subsample[ci]) + (cinfo, (int) ci, + fullsize_width, (int) vs, + compptr->subsampled_width, (int) compptr->v_samp_factor, + above_ptr, + fullsize_data[ci] + current * vs, + below_ptr, + subsampled_data[ci] + out * compptr->v_samp_factor); + } +} + + +/* These vars are initialized by the pipeline controller for use by + * MCU_output_catcher. + * To avoid a lot of row-pointer overhead, we cram as many MCUs into each + * row of whole_scan_MCUs as we can get without exceeding 64KB per row. + */ + +#define MAX_WHOLE_ROW_BLOCKS (65500 / SIZEOF(JBLOCK)) /* max blocks/row */ + +static big_barray_ptr whole_scan_MCUs; /* Big array for saving the MCUs */ +static int MCUs_in_big_row; /* # of MCUs in each row of whole_scan_MCUs */ +static long next_whole_row; /* next row to access in whole_scan_MCUs */ +static int next_MCU_index; /* next MCU in current row */ + + +METHODDEF void +MCU_output_catcher (compress_info_ptr cinfo, JBLOCK *MCU_data) +/* Output method for siphoning off extract_MCUs output into a big array */ +{ + static JBLOCKARRAY rowptr; + + if (next_MCU_index >= MCUs_in_big_row) { + rowptr = (*cinfo->emethods->access_big_barray) (whole_scan_MCUs, + next_whole_row, TRUE); + next_whole_row++; + next_MCU_index = 0; + } + + /* + * note that on 80x86, the cast applied to MCU_data implies + * near to far pointer conversion. + */ + jcopy_block_row((JBLOCKROW) MCU_data, + rowptr[0] + next_MCU_index * cinfo->blocks_in_MCU, + (long) cinfo->blocks_in_MCU); + next_MCU_index++; +} + + +METHODDEF void +dump_scan_MCUs (compress_info_ptr cinfo, MCU_output_method_ptr output_method) +/* Dump the MCUs saved in whole_scan_MCUs to the output method. */ +/* The method may be either the entropy encoder or some routine supplied */ +/* by the entropy optimizer. */ +{ + /* On an 80x86 machine, the entropy encoder expects the passed data block + * to be in NEAR memory (for performance reasons), so we have to copy it + * back from the big array to a local array. On less brain-damaged CPUs + * we needn't do that. + */ +#ifdef NEED_FAR_POINTERS + JBLOCK MCU_data[MAX_BLOCKS_IN_MCU]; +#endif + long mcurow, mcuindex, next_row; + int next_index; + JBLOCKARRAY rowptr = NULL; /* init only to suppress compiler complaint */ + + next_row = 0; + next_index = MCUs_in_big_row; + + for (mcurow = 0; mcurow < cinfo->MCU_rows_in_scan; mcurow++) { + for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) { + if (next_index >= MCUs_in_big_row) { + rowptr = (*cinfo->emethods->access_big_barray) (whole_scan_MCUs, + next_row, FALSE); + next_row++; + next_index = 0; + } +#ifdef NEED_FAR_POINTERS + jcopy_block_row(rowptr[0] + next_index * cinfo->blocks_in_MCU, + (JBLOCKROW) MCU_data, /* note cast */ + (long) cinfo->blocks_in_MCU); + (*output_method) (cinfo, MCU_data); +#else + (*output_method) (cinfo, rowptr[0] + next_index * cinfo->blocks_in_MCU); +#endif + next_index++; + } + } +} + + + +/* + * Compression pipeline controller used for single-scan files + * with no optimization of entropy parameters. + */ + +METHODDEF void +single_ccontroller (compress_info_ptr cinfo) +{ + int rows_in_mem; /* # of sample rows in full-size buffers */ + long fullsize_width; /* # of samples per row in full-size buffers */ + long cur_pixel_row; /* counts # of pixel rows processed */ + long mcu_rows_output; /* # of MCU rows actually emitted */ + int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ + /* Work buffer for pre-subsampling data (see comments at head of file) */ + JSAMPIMAGE fullsize_data[2]; + /* Work buffer for subsampled data */ + JSAMPIMAGE subsampled_data; + int rows_this_time; + short ci, whichss, i; + + /* Prepare for single scan containing all components */ + if (cinfo->num_components > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); + cinfo->comps_in_scan = cinfo->num_components; + for (ci = 0; ci < cinfo->num_components; ci++) { + cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; + } + if (cinfo->comps_in_scan == 1) { + noninterleaved_scan_setup(cinfo); + /* Vk block rows constitute the same number of MCU rows */ + mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; + } else { + interleaved_scan_setup(cinfo); + /* in an interleaved scan, one MCU row contains Vk block rows */ + mcu_rows_per_loop = 1; + } + + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + + /* Allocate working memory: */ + /* fullsize_data is sample data before subsampling */ + alloc_sampling_buffer(cinfo, fullsize_data, fullsize_width); + /* subsampled_data is sample data after subsampling */ + subsampled_data = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + for (ci = 0; ci < cinfo->num_components; ci++) { + subsampled_data[ci] = (*cinfo->emethods->alloc_small_sarray) + (cinfo->comp_info[ci].subsampled_width, + (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); + } + + /* Tell the memory manager to instantiate big arrays. + * We don't need any big arrays in this controller, + * but some other module (like the input file reader) may need one. + */ + (*cinfo->emethods->alloc_big_arrays) + ((long) 0, /* no more small sarrays */ + (long) 0, /* no more small barrays */ + (long) 0); /* no more "medium" objects */ + + /* Initialize output file & do per-scan object init */ + + (*cinfo->methods->write_scan_header) (cinfo); + cinfo->methods->entropy_output = cinfo->methods->write_jpeg_data; + (*cinfo->methods->entropy_encoder_init) (cinfo); + (*cinfo->methods->subsample_init) (cinfo); + (*cinfo->methods->extract_init) (cinfo); + + /* Loop over input image: rows_in_mem pixel rows are processed per loop */ + + mcu_rows_output = 0; + whichss = 1; /* arrange to start with fullsize_data[0] */ + + for (cur_pixel_row = 0; cur_pixel_row < cinfo->image_height; + cur_pixel_row += rows_in_mem) { + whichss ^= 1; /* switch to other fullsize_data buffer */ + + /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ + /* Then we have exactly DCTSIZE row groups for subsampling. */ + rows_this_time = MIN(rows_in_mem, cinfo->image_height - cur_pixel_row); + + (*cinfo->methods->get_sample_rows) (cinfo, rows_this_time, + fullsize_data[whichss]); + (*cinfo->methods->edge_expand) (cinfo, + cinfo->image_width, rows_this_time, + fullsize_width, rows_in_mem, + fullsize_data[whichss]); + + /* Subsample the data (all components) */ + /* First time through is a special case */ + + if (cur_pixel_row) { + /* Subsample last row group of previous set */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, + (short) (DCTSIZE-1)); + /* and dump the previous set's subsampled data */ + (*cinfo->methods->extract_MCUs) (cinfo, subsampled_data, + mcu_rows_per_loop, + cinfo->methods->entropy_encode); + mcu_rows_output += mcu_rows_per_loop; + /* Subsample first row group of this set */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (DCTSIZE+1), (short) 0, (short) 1, + (short) 0); + } else { + /* Subsample first row group with dummy above-context */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (-1), (short) 0, (short) 1, + (short) 0); + } + /* Subsample second through next-to-last row groups of this set */ + for (i = 1; i <= DCTSIZE-2; i++) { + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (i-1), (short) i, (short) (i+1), + (short) i); + } + } /* end of outer loop */ + + /* Subsample the last row group with dummy below-context */ + /* Note whichss points to last buffer side used */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), + (short) (DCTSIZE-1)); + /* Dump the remaining data (may be less than full height if uninterleaved) */ + (*cinfo->methods->extract_MCUs) (cinfo, subsampled_data, + (int) (cinfo->MCU_rows_in_scan - mcu_rows_output), + cinfo->methods->entropy_encode); + + /* Finish output file */ + (*cinfo->methods->extract_term) (cinfo); + (*cinfo->methods->subsample_term) (cinfo); + (*cinfo->methods->entropy_encoder_term) (cinfo); + (*cinfo->methods->write_scan_trailer) (cinfo); + + /* Release working memory */ + free_sampling_buffer(cinfo, fullsize_data); + for (ci = 0; ci < cinfo->num_components; ci++) { + (*cinfo->emethods->free_small_sarray) + (subsampled_data[ci], + (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); + } + (*cinfo->emethods->free_small) ((void *) subsampled_data); +} + + +/* + * Compression pipeline controller used for single-scan files + * with optimization of entropy parameters. + */ + +#ifdef ENTROPY_OPT_SUPPORTED + +METHODDEF void +single_eopt_ccontroller (compress_info_ptr cinfo) +{ + int rows_in_mem; /* # of sample rows in full-size buffers */ + long fullsize_width; /* # of samples per row in full-size buffers */ + long cur_pixel_row; /* counts # of pixel rows processed */ + long mcu_rows_output; /* # of MCU rows actually emitted */ + int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ + /* Work buffer for pre-subsampling data (see comments at head of file) */ + JSAMPIMAGE fullsize_data[2]; + /* Work buffer for subsampled data */ + JSAMPIMAGE subsampled_data; + int rows_this_time; + int blocks_in_big_row; + short ci, whichss, i; + + /* Prepare for single scan containing all components */ + if (cinfo->num_components > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); + cinfo->comps_in_scan = cinfo->num_components; + for (ci = 0; ci < cinfo->num_components; ci++) { + cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; + } + if (cinfo->comps_in_scan == 1) { + noninterleaved_scan_setup(cinfo); + /* Vk block rows constitute the same number of MCU rows */ + mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; + } else { + interleaved_scan_setup(cinfo); + /* in an interleaved scan, one MCU row contains Vk block rows */ + mcu_rows_per_loop = 1; + } + + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + + /* Allocate working memory: */ + /* fullsize_data is sample data before subsampling */ + alloc_sampling_buffer(cinfo, fullsize_data, fullsize_width); + /* subsampled_data is sample data after subsampling */ + subsampled_data = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + for (ci = 0; ci < cinfo->num_components; ci++) { + subsampled_data[ci] = (*cinfo->emethods->alloc_small_sarray) + (cinfo->comp_info[ci].subsampled_width, + (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); + } + + /* Figure # of MCUs to be packed in a row of whole_scan_MCUs */ + MCUs_in_big_row = MAX_WHOLE_ROW_BLOCKS / cinfo->blocks_in_MCU; + blocks_in_big_row = MCUs_in_big_row * cinfo->blocks_in_MCU; + + /* Request a big array: whole_scan_MCUs saves the MCU data for the scan */ + whole_scan_MCUs = (*cinfo->emethods->request_big_barray) + ((long) blocks_in_big_row, + (long) (cinfo->MCUs_per_row * cinfo->MCU_rows_in_scan + + MCUs_in_big_row-1) / MCUs_in_big_row, + 1L); /* unit height is 1 row */ + + next_whole_row = 0; /* init output ptr for MCU_output_catcher */ + next_MCU_index = MCUs_in_big_row; /* forces access on first call! */ + + /* Tell the memory manager to instantiate big arrays */ + (*cinfo->emethods->alloc_big_arrays) + ((long) 0, /* no more small sarrays */ + (long) 0, /* no more small barrays */ + (long) 0); /* no more "medium" objects */ + + /* Do per-scan object init */ + + (*cinfo->methods->subsample_init) (cinfo); + (*cinfo->methods->extract_init) (cinfo); + + /* Loop over input image: rows_in_mem pixel rows are processed per loop */ + /* MCU data goes into whole_scan_MCUs, not to the entropy encoder */ + + mcu_rows_output = 0; + whichss = 1; /* arrange to start with fullsize_data[0] */ + + for (cur_pixel_row = 0; cur_pixel_row < cinfo->image_height; + cur_pixel_row += rows_in_mem) { + whichss ^= 1; /* switch to other fullsize_data buffer */ + + /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ + /* Then we have exactly DCTSIZE row groups for subsampling. */ + rows_this_time = MIN(rows_in_mem, cinfo->image_height - cur_pixel_row); + + (*cinfo->methods->get_sample_rows) (cinfo, rows_this_time, + fullsize_data[whichss]); + (*cinfo->methods->edge_expand) (cinfo, + cinfo->image_width, rows_this_time, + fullsize_width, rows_in_mem, + fullsize_data[whichss]); + + /* Subsample the data (all components) */ + /* First time through is a special case */ + + if (cur_pixel_row) { + /* Subsample last row group of previous set */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, + (short) (DCTSIZE-1)); + /* and dump the previous set's subsampled data */ + (*cinfo->methods->extract_MCUs) (cinfo, subsampled_data, + mcu_rows_per_loop, + MCU_output_catcher); + mcu_rows_output += mcu_rows_per_loop; + /* Subsample first row group of this set */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (DCTSIZE+1), (short) 0, (short) 1, + (short) 0); + } else { + /* Subsample first row group with dummy above-context */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (-1), (short) 0, (short) 1, + (short) 0); + } + /* Subsample second through next-to-last row groups of this set */ + for (i = 1; i <= DCTSIZE-2; i++) { + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (i-1), (short) i, (short) (i+1), + (short) i); + } + } /* end of outer loop */ + + /* Subsample the last row group with dummy below-context */ + /* Note whichss points to last buffer side used */ + subsample(cinfo, fullsize_data[whichss], subsampled_data, fullsize_width, + (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), + (short) (DCTSIZE-1)); + /* Dump the remaining data (may be less than full height if uninterleaved) */ + (*cinfo->methods->extract_MCUs) (cinfo, subsampled_data, + (int) (cinfo->MCU_rows_in_scan - mcu_rows_output), + MCU_output_catcher); + + /* Clean up after that stuff, then find the optimal entropy parameters */ + + (*cinfo->methods->extract_term) (cinfo); + (*cinfo->methods->subsample_term) (cinfo); + + (*cinfo->methods->entropy_optimize) (cinfo, dump_scan_MCUs); + + /* Emit scan to output file */ + /* Note: we can't do write_scan_header until entropy parameters are set! */ + + (*cinfo->methods->write_scan_header) (cinfo); + cinfo->methods->entropy_output = cinfo->methods->write_jpeg_data; + (*cinfo->methods->entropy_encoder_init) (cinfo); + dump_scan_MCUs(cinfo, cinfo->methods->entropy_encode); + (*cinfo->methods->entropy_encoder_term) (cinfo); + (*cinfo->methods->write_scan_trailer) (cinfo); + + /* Release working memory */ + free_sampling_buffer(cinfo, fullsize_data); + for (ci = 0; ci < cinfo->num_components; ci++) { + (*cinfo->emethods->free_small_sarray) + (subsampled_data[ci], + (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); + } + (*cinfo->emethods->free_small) ((void *) subsampled_data); + (*cinfo->emethods->free_big_barray) (whole_scan_MCUs); +} + +#endif /* ENTROPY_OPT_SUPPORTED */ + + +/* + * Compression pipeline controller used for multiple-scan files + * with no optimization of entropy parameters. + */ + +#ifdef MULTISCAN_FILES_SUPPORTED + +METHODDEF void +multi_ccontroller (compress_info_ptr cinfo) +{ + ERREXIT(cinfo->emethods, "Not implemented yet"); +} + +#endif /* MULTISCAN_FILES_SUPPORTED */ + + +/* + * Compression pipeline controller used for multiple-scan files + * with optimization of entropy parameters. + */ + +#ifdef MULTISCAN_FILES_SUPPORTED +#ifdef ENTROPY_OPT_SUPPORTED + +METHODDEF void +multi_eopt_ccontroller (compress_info_ptr cinfo) +{ + ERREXIT(cinfo->emethods, "Not implemented yet"); +} + +#endif /* ENTROPY_OPT_SUPPORTED */ +#endif /* MULTISCAN_FILES_SUPPORTED */ + + +/* + * The method selection routine for compression pipeline controllers. + */ + +GLOBAL void +jselcpipeline (compress_info_ptr cinfo) +{ + if (cinfo->interleave || cinfo->num_components == 1) { + /* single scan needed */ +#ifdef ENTROPY_OPT_SUPPORTED + if (cinfo->optimize_coding) + cinfo->methods->c_pipeline_controller = single_eopt_ccontroller; + else +#endif + cinfo->methods->c_pipeline_controller = single_ccontroller; + } else { + /* multiple scans needed */ +#ifdef MULTISCAN_FILES_SUPPORTED +#ifdef ENTROPY_OPT_SUPPORTED + if (cinfo->optimize_coding) + cinfo->methods->c_pipeline_controller = multi_eopt_ccontroller; + else +#endif + cinfo->methods->c_pipeline_controller = multi_ccontroller; +#else + ERREXIT(cinfo->emethods, "Multiple-scan support was not compiled"); +#endif + } +} diff --git a/jcsample.c b/jcsample.c new file mode 100644 index 00000000..d23e23a0 --- /dev/null +++ b/jcsample.c @@ -0,0 +1,135 @@ +/* + * jcsample.c + * + * Copyright (C) 1991, 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. + * + * This file contains subsampling routines. + * These routines are invoked via the subsample and + * subsample_init/term methods. + */ + +#include "jinclude.h" + + +/* + * Initialize for subsampling a scan. + */ + +METHODDEF void +subsample_init (compress_info_ptr cinfo) +{ + /* no work for now */ +} + + +/* + * Subsample pixel values of a single component. + * This version only handles integral sampling ratios. + */ + +METHODDEF void +subsample (compress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) +{ + jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; + int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; + long outcol; + JSAMPROW inptr, outptr; + INT32 outvalue; + + /* TEMP FOR DEBUGGING PIPELINE CONTROLLER */ + if (output_rows != compptr->v_samp_factor || + input_rows != cinfo->max_v_samp_factor || + (output_cols % compptr->h_samp_factor) != 0 || + (input_cols % cinfo->max_h_samp_factor) != 0 || + input_cols*compptr->h_samp_factor != output_cols*cinfo->max_h_samp_factor) + ERREXIT(cinfo->emethods, "Bogus subsample parameters"); + + h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; + v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; + numpix = h_expand * v_expand; + numpix2 = numpix/2; + + inrow = 0; + for (outrow = 0; outrow < output_rows; outrow++) { + outptr = output_data[outrow]; + for (outcol = 0; outcol < output_cols; outcol++) { + outvalue = 0; + for (v = 0; v < v_expand; v++) { + inptr = input_data[inrow+v] + (outcol*h_expand); + for (h = 0; h < h_expand; h++) { + outvalue += GETJSAMPLE(*inptr++); + } + } + *outptr++ = (outvalue + numpix2) / numpix; + } + inrow += v_expand; + } +} + + +/* + * Subsample pixel values of a single component. + * This version handles the special case of a full-size component. + */ + +METHODDEF void +fullsize_subsample (compress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) +{ + if (input_cols != output_cols || input_rows != output_rows) /* DEBUG */ + ERREXIT(cinfo->emethods, "Pipeline controller messed up"); + + jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols); +} + + +/* + * Clean up after a scan. + */ + +METHODDEF void +subsample_term (compress_info_ptr cinfo) +{ + /* no work for now */ +} + + + +/* + * The method selection routine for subsampling. + * Note that we must select a routine for each component. + */ + +GLOBAL void +jselsubsample (compress_info_ptr cinfo) +{ + short ci; + jpeg_component_info * compptr; + + if (cinfo->CCIR601_sampling) + ERREXIT(cinfo->emethods, "CCIR601 subsampling not implemented yet"); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) + cinfo->methods->subsample[ci] = fullsize_subsample; + else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) + cinfo->methods->subsample[ci] = subsample; + else + ERREXIT(cinfo->emethods, "Fractional subsampling not implemented yet"); + } + + cinfo->methods->subsample_init = subsample_init; + cinfo->methods->subsample_term = subsample_term; +} diff --git a/jdarith.c b/jdarith.c new file mode 100644 index 00000000..0f19be8d --- /dev/null +++ b/jdarith.c @@ -0,0 +1,42 @@ +/* + * jdarith.c + * + * Copyright (C) 1991, 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. + * + * This file contains arithmetic entropy decoding routines. + * These routines are invoked via the methods entropy_decode + * and entropy_decoder_init/term. + */ + +#include "jinclude.h" + +#ifdef ARITH_CODING_SUPPORTED + + +/* + * The arithmetic coding option of the JPEG standard specifies Q-coding, + * which is covered by patents held by IBM (and possibly AT&T and Mitsubishi). + * At this time it does not appear to be legal for the Independent JPEG + * Group to distribute software that implements arithmetic coding. + * We have therefore removed arithmetic coding support from the + * distributed source code. + * + * We're not happy about it either. + */ + + +/* + * The method selection routine for arithmetic entropy decoding. + */ + +GLOBAL void +jseldarithmetic (decompress_info_ptr cinfo) +{ + if (cinfo->arith_code) { + ERREXIT(cinfo->emethods, "Sorry, there are legal restrictions on arithmetic coding"); + } +} + +#endif /* ARITH_CODING_SUPPORTED */ diff --git a/jdcolor.c b/jdcolor.c new file mode 100644 index 00000000..a39ebff2 --- /dev/null +++ b/jdcolor.c @@ -0,0 +1,194 @@ +/* + * jdcolor.c + * + * Copyright (C) 1991, 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. + * + * This file contains output colorspace conversion routines. + * These routines are invoked via the methods color_convert + * and colorout_init/term. + */ + +#include "jinclude.h" + + +/* + * Initialize for colorspace conversion. + */ + +METHODDEF void +colorout_init (decompress_info_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * Convert some rows of samples to the output colorspace. + * This version handles YCbCr -> RGB conversion. + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + */ + +METHODDEF void +ycc_rgb_convert (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPIMAGE output_data) +{ + register INT32 y, u, v, x; + register JSAMPROW inptr0, inptr1, inptr2; + register JSAMPROW outptr0, outptr1, outptr2; + register long col; + register long width = cinfo->image_width; + register int row; + + for (row = 0; row < num_rows; row++) { + inptr0 = input_data[0][row]; + inptr1 = input_data[1][row]; + inptr2 = input_data[2][row]; + outptr0 = output_data[0][row]; + outptr1 = output_data[1][row]; + outptr2 = output_data[2][row]; + for (col = width; col > 0; col--) { + y = GETJSAMPLE(*inptr0++); + u = (int) GETJSAMPLE(*inptr1++) - CENTERJSAMPLE; + v = (int) GETJSAMPLE(*inptr2++) - CENTERJSAMPLE; + /* Note: if the inputs were computed directly from RGB values, + * range-limiting would be unnecessary here; but due to possible + * noise in the DCT/IDCT phase, we do need to apply range limits. + */ + y *= 1024; /* in case compiler can't spot common subexpression */ + x = y + 1436*v + 512; /* red */ + if (x < 0) x = 0; + if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; + *outptr0++ = x >> 10; + x = y - 352*u - 731*v + 512; /* green */ + if (x < 0) x = 0; + if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; + *outptr1++ = x >> 10; + x = y + 1815*u + 512; /* blue */ + if (x < 0) x = 0; + if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; + *outptr2++ = x >> 10; + } + } +} + + +/* + * Color conversion for no colorspace change: just copy the data. + */ + +METHODDEF void +null_convert (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPIMAGE output_data) +{ + short ci; + + for (ci = 0; ci < cinfo->num_components; ci++) { + jcopy_sample_rows(input_data[ci], 0, output_data[ci], 0, + num_rows, cinfo->image_width); + } +} + + +/* + * Color conversion for grayscale: just copy the data. + * This also works for YCbCr/YIQ -> grayscale conversion, in which + * we just copy the Y (luminance) component and ignore chrominance. + */ + +METHODDEF void +grayscale_convert (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPIMAGE output_data) +{ + jcopy_sample_rows(input_data[0], 0, output_data[0], 0, + num_rows, cinfo->image_width); +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +colorout_term (decompress_info_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * The method selection routine for output colorspace conversion. + */ + +GLOBAL void +jseldcolor (decompress_info_ptr cinfo) +{ + /* Make sure num_components agrees with jpeg_color_space */ + switch (cinfo->jpeg_color_space) { + case CS_GRAYSCALE: + if (cinfo->num_components != 1) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + break; + + case CS_RGB: + case CS_YIQ: + case CS_YCbCr: + if (cinfo->num_components != 3) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + break; + + case CS_CMYK: + if (cinfo->num_components != 4) + ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); + break; + + default: + ERREXIT(cinfo->emethods, "Unsupported JPEG colorspace"); + break; + } + + /* Set color_out_comps and conversion method based on requested space */ + switch (cinfo->out_color_space) { + case CS_GRAYSCALE: + cinfo->color_out_comps = 1; + if (cinfo->jpeg_color_space == CS_GRAYSCALE || + cinfo->jpeg_color_space == CS_YCbCr || + cinfo->jpeg_color_space == CS_YIQ) + cinfo->methods->color_convert = grayscale_convert; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + case CS_RGB: + cinfo->color_out_comps = 3; + if (cinfo->jpeg_color_space == CS_YCbCr) + cinfo->methods->color_convert = ycc_rgb_convert; + else if (cinfo->jpeg_color_space == CS_RGB) + cinfo->methods->color_convert = null_convert; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + case CS_CMYK: + cinfo->color_out_comps = 4; + if (cinfo->jpeg_color_space == CS_CMYK) + cinfo->methods->color_convert = null_convert; + else + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); + break; + + default: + ERREXIT(cinfo->emethods, "Unsupported output colorspace"); + break; + } + + if (cinfo->quantize_colors) + cinfo->final_out_comps = 1; /* single colormapped output component */ + else + cinfo->final_out_comps = cinfo->color_out_comps; + + cinfo->methods->colorout_init = colorout_init; + cinfo->methods->colorout_term = colorout_term; +} diff --git a/jdhuff.c b/jdhuff.c new file mode 100644 index 00000000..e9af688c --- /dev/null +++ b/jdhuff.c @@ -0,0 +1,318 @@ +/* + * jdhuff.c + * + * Copyright (C) 1991, 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. + * + * This file contains Huffman entropy decoding routines. + * These routines are invoked via the methods entropy_decode + * and entropy_decoder_init/term. + */ + +#include "jinclude.h" + + +/* Static variables to avoid passing 'round extra parameters */ + +static decompress_info_ptr dcinfo; + +static unsigned int get_buffer; /* current bit-extraction buffer */ +static int bits_left; /* # of unused bits in it */ + + +LOCAL void +fix_huff_tbl (HUFF_TBL * htbl) +/* Compute derived values for a Huffman table */ +{ + int p, i, l, lastp, si; + char huffsize[257]; + UINT16 huffcode[257]; + UINT16 code; + + /* Figure 7.3.5.4.2.1: make table of Huffman code length for each symbol */ + /* Note that this is in code-length order. */ + + p = 0; + for (l = 1; l <= 16; l++) { + for (i = 1; i <= htbl->bits[l]; i++) + huffsize[p++] = l; + } + huffsize[p] = 0; + lastp = p; + + /* Figure 7.3.5.4.2.2: generate the codes themselves */ + /* Note that this is in code-length order. */ + + code = 0; + si = huffsize[0]; + p = 0; + while (huffsize[p]) { + while (huffsize[p] == si) { + huffcode[p++] = code; + code++; + } + code <<= 1; + si++; + } + + /* Figure 7.3.5.4.2.3: generate encoding tables */ + /* These are code and size indexed by symbol value */ + + for (p = 0; p < lastp; p++) { + htbl->ehufco[htbl->huffval[p]] = huffcode[p]; + htbl->ehufsi[htbl->huffval[p]] = huffsize[p]; + } + + /* Figure 13.4.2.3.1: generate decoding tables */ + + p = 0; + for (l = 1; l <= 16; l++) { + if (htbl->bits[l]) { + htbl->valptr[l] = p; /* huffval[] index of 1st sym of code len l */ + htbl->mincode[l] = huffcode[p]; /* minimum code of length l */ + p += htbl->bits[l]; + htbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ + } else { + htbl->maxcode[l] = -1; + } + } +} + + +/* Extract the next N bits from the input stream (N <= 8) */ + +LOCAL int +get_bits (int nbits) +{ + int result; + + while (nbits > bits_left) { + int c = JGETC(dcinfo); + + get_buffer = (get_buffer << 8) + c; + bits_left += 8; + /* If it's 0xFF, check and discard stuffed zero byte */ + if (c == 0xff) { + c = JGETC(dcinfo); /* Byte stuffing */ + if (c != 0) + ERREXIT1(dcinfo->emethods, + "Unexpected marker 0x%02x in compressed data", c); + } + } + + bits_left -= nbits; + result = (get_buffer >> bits_left) & ((1 << nbits) - 1); + return result; +} + +/* Macro to make things go at some speed! */ + +#define get_bit() (bits_left ? \ + ((get_buffer >> (--bits_left)) & 1) : \ + get_bits(1)) + + +/* Figure 13.4.2.3.2: extract next coded symbol from input stream */ + +LOCAL int +huff_DECODE (HUFF_TBL * htbl) +{ + int l, p; + INT32 code; + + code = get_bit(); + l = 1; + while (code > htbl->maxcode[l]) { + code = (code << 1) + get_bit(); + l++; + } + + p = htbl->valptr[l] + (code - htbl->mincode[l]); + + return htbl->huffval[p]; +} + + +/* Figure 13.4.2.1.1: extend sign bit */ + +#define huff_EXTEND(x, s) ((x) < (1 << ((s)-1)) ? \ + (x) + (-1 << (s)) + 1 : \ + (x)) + + +/* Decode a single block's worth of coefficients */ +/* Note that only the difference is returned for the DC coefficient */ + +LOCAL void +decode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) +{ + int s, k, r, n; + + /* zero out the coefficient block */ + + MEMZERO((void *) block, SIZEOF(JBLOCK)); + + /* Section 13.4.2.1: decode the DC coefficient difference */ + + s = huff_DECODE(dctbl); + r = get_bits(s); + block[0] = huff_EXTEND(r, s); + + /* Section 13.4.2.2: decode the AC coefficients */ + + for (k = 1; k < DCTSIZE2; k++) { + r = huff_DECODE(actbl); + + s = r & 15; + n = r >> 4; + + if (s) { + k = k + n; + r = get_bits(s); + block[k] = huff_EXTEND(r, s); + } else { + if (n != 15) + break; + k += 15; + } + } +} + + +/* + * Initialize for a Huffman-compressed scan. + * This is invoked after reading the SOS marker. + */ + +METHODDEF void +huff_decoder_init (decompress_info_ptr cinfo) +{ + short ci; + jpeg_component_info * compptr; + + /* Initialize static variables */ + dcinfo = cinfo; + bits_left = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Make sure requested tables are present */ + if (cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no] == NULL || + cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no] == NULL) + ERREXIT(cinfo->emethods, "Use of undefined Huffman table"); + /* Compute derived values for Huffman tables */ + /* We may do this more than once for same table, but it's not a big deal */ + fix_huff_tbl(cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no]); + fix_huff_tbl(cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]); + /* Initialize DC predictions to 0 */ + cinfo->last_dc_val[ci] = 0; + } + + /* Initialize restart stuff */ + cinfo->restarts_to_go = cinfo->restart_interval; + cinfo->next_restart_num = 0; +} + + +/* + * Check for a restart marker & resynchronize decoder. + */ + +LOCAL void +process_restart (decompress_info_ptr cinfo) +{ + int c, nbytes; + short ci; + + /* Throw away any partial unread byte */ + bits_left = 0; + + /* Scan for next JPEG marker */ + nbytes = 0; + do { + do { /* skip any non-FF bytes */ + nbytes++; + c = JGETC(cinfo); + } while (c != 0xFF); + do { /* skip any duplicate FFs */ + nbytes++; + c = JGETC(cinfo); + } while (c == 0xFF); + } while (c == 0); /* repeat if it was a stuffed FF/00 */ + + if (c != (RST0 + cinfo->next_restart_num)) + ERREXIT2(cinfo->emethods, "Found 0x%02x marker instead of RST%d", + c, cinfo->next_restart_num); + + if (nbytes != 2) + TRACEMS2(cinfo->emethods, 1, "Skipped %d bytes before RST%d", + nbytes-2, cinfo->next_restart_num); + else + TRACEMS1(cinfo->emethods, 2, "RST%d", cinfo->next_restart_num); + + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + cinfo->last_dc_val[ci] = 0; + + /* Update restart state */ + cinfo->restarts_to_go = cinfo->restart_interval; + cinfo->next_restart_num++; + cinfo->next_restart_num &= 7; +} + + +/* + * Decode and return one MCU's worth of Huffman-compressed coefficients. + */ + +METHODDEF void +huff_decode (decompress_info_ptr cinfo, JBLOCK *MCU_data) +{ + short blkn, ci; + jpeg_component_info * compptr; + + /* Account for restart interval, process restart marker if needed */ + if (cinfo->restart_interval) { + if (cinfo->restarts_to_go == 0) + process_restart(cinfo); + cinfo->restarts_to_go--; + } + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + decode_one_block(MCU_data[blkn], + cinfo->dc_huff_tbl_ptrs[compptr->dc_tbl_no], + cinfo->ac_huff_tbl_ptrs[compptr->ac_tbl_no]); + /* Convert DC difference to actual value, update last_dc_val */ + MCU_data[blkn][0] += cinfo->last_dc_val[ci]; + cinfo->last_dc_val[ci] = MCU_data[blkn][0]; + } +} + + +/* + * Finish up at the end of a Huffman-compressed scan. + */ + +METHODDEF void +huff_decoder_term (decompress_info_ptr cinfo) +{ + /* No work needed */ +} + + +/* + * The method selection routine for Huffman entropy decoding. + */ + +GLOBAL void +jseldhuffman (decompress_info_ptr cinfo) +{ + if (! cinfo->arith_code) { + cinfo->methods->entropy_decoder_init = huff_decoder_init; + cinfo->methods->entropy_decode = huff_decode; + cinfo->methods->entropy_decoder_term = huff_decoder_term; + } +} diff --git a/jdmain.c b/jdmain.c new file mode 100644 index 00000000..109d124c --- /dev/null +++ b/jdmain.c @@ -0,0 +1,289 @@ +/* + * jdmain.c + * + * Copyright (C) 1991, 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. + * + * This file contains a trivial test user interface for the JPEG decompressor. + * It should work on any system with Unix- or MS-DOS-style command lines. + * + * Two different command line styles are permitted, depending on the + * compile-time switch TWO_FILE_COMMANDLINE: + * djpeg [options] inputfile outputfile + * djpeg [options] [inputfile] + * In the second style, output is always to standard output, which you'd + * normally redirect to a file or pipe to some other program. Input is + * either from a named file or from standard input (typically redirected). + * The second style is convenient on Unix but is unhelpful on systems that + * don't support pipes. Also, you MUST use the first style if your system + * doesn't do binary I/O to stdin/stdout. + */ + +#include "jinclude.h" +#ifdef __STDC__ +#include /* to declare exit() */ +#endif + +#ifdef THINK_C +#include /* command-line reader for Macintosh */ +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif + + +/* + * If your system has getopt(3), you can use your library version by + * defining HAVE_GETOPT. By default, we use the PD 'egetopt'. + */ + +#ifdef HAVE_GETOPT +extern int getopt PP((int argc, char **argv, char *optstring)); +extern char * optarg; +extern int optind; +#else +#include "egetopt.c" +#define getopt(argc,argv,opt) egetopt(argc,argv,opt) +#endif + + +typedef enum { /* defines known output image formats */ + FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ + FMT_GIF, /* GIF format */ + FMT_TIFF /* TIFF format */ +} IMAGE_FORMATS; + +static IMAGE_FORMATS requested_fmt; + + +/* + * This routine gets control after the input file header has been read. + * It must determine what output file format is to be written, + * and make any other decompression parameter changes that are desirable. + */ + +METHODDEF void +d_ui_method_selection (decompress_info_ptr cinfo) +{ + /* if grayscale or CMYK input, force similar output; */ + /* else leave the output colorspace as set by options. */ + if (cinfo->jpeg_color_space == CS_GRAYSCALE) + cinfo->out_color_space = CS_GRAYSCALE; + else if (cinfo->jpeg_color_space == CS_CMYK) + cinfo->out_color_space = CS_CMYK; + + /* select output file format */ + /* Note: jselwxxx routine may make additional parameter changes, + * such as forcing color quantization if it's a colormapped format. + */ + switch (requested_fmt) { +#ifdef GIF_SUPPORTED + case FMT_GIF: + jselwgif(cinfo); + break; +#endif +#ifdef PPM_SUPPORTED + case FMT_PPM: + jselwppm(cinfo); + break; +#endif + default: + ERREXIT(cinfo->emethods, "Unsupported output file format"); + break; + } +} + + +/* + * Reload the input buffer after it's been emptied, and return the next byte. + * See the JGETC macro for calling conditions. + * + * This routine would need to be replaced if reading JPEG data from something + * other than a stdio stream. + */ + +METHODDEF int +read_jpeg_data (decompress_info_ptr cinfo) +{ + cinfo->bytes_in_buffer = fread(cinfo->input_buffer + MIN_UNGET, + 1, JPEG_BUF_SIZE, + cinfo->input_file); + + cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; + + if (cinfo->bytes_in_buffer <= 0) + ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); + + return JGETC(cinfo); +} + + + +LOCAL void +usage (char * progname) +/* complain about bad command line */ +{ + fprintf(stderr, "usage: %s ", progname); + fprintf(stderr, "[-b] [-q colors] [-2] [-d] [-g] [-G]"); +#ifdef TWO_FILE_COMMANDLINE + fprintf(stderr, " inputfile outputfile\n"); +#else + fprintf(stderr, " [inputfile]\n"); +#endif + exit(2); +} + + +/* + * The main program. + */ + +GLOBAL void +main (int argc, char **argv) +{ + struct decompress_info_struct cinfo; + struct decompress_methods_struct dc_methods; + struct external_methods_struct e_methods; + int c; + + /* On Mac, fetch a command line. */ +#ifdef THINK_C + argc = ccommand(&argv); +#endif + + /* Initialize the system-dependent method pointers. */ + cinfo.methods = &dc_methods; + cinfo.emethods = &e_methods; + jselerror(&e_methods); /* error/trace message routines */ + jselvirtmem(&e_methods); /* memory allocation routines */ + dc_methods.d_ui_method_selection = d_ui_method_selection; + dc_methods.read_jpeg_data = read_jpeg_data; + + /* Allocate memory for input buffer. */ + cinfo.input_buffer = (char *) (*cinfo.emethods->alloc_small) + ((size_t) (JPEG_BUF_SIZE + MIN_UNGET)); + cinfo.bytes_in_buffer = 0; /* initialize buffer to empty */ + + /* Set up default input and output file references. */ + /* (These may be overridden below.) */ + cinfo.input_file = stdin; + cinfo.output_file = stdout; + + /* Set up default parameters. */ + e_methods.trace_level = 0; + cinfo.output_gamma = 1.0; + cinfo.quantize_colors = FALSE; + cinfo.two_pass_quantize = FALSE; + cinfo.use_dithering = FALSE; + cinfo.desired_number_of_colors = 256; + cinfo.do_block_smoothing = FALSE; + cinfo.do_pixel_smoothing = FALSE; + cinfo.out_color_space = CS_RGB; + cinfo.jpeg_color_space = CS_UNKNOWN; + /* setting any other value in jpeg_color_space overrides heuristics */ + /* in jrdjfif.c ... */ + /* You may wanta change the default output format; here's the place: */ +#ifdef PPM_SUPPORTED + requested_fmt = FMT_PPM; +#else + requested_fmt = FMT_GIF; +#endif + + /* Scan parameters */ + + while ((c = getopt(argc, argv, "bq:2DdgG")) != EOF) + switch (c) { + case 'b': /* Enable cross-block smoothing. */ + cinfo.do_block_smoothing = TRUE; + break; + case 'q': /* Do color quantization. */ + { int val; + if (optarg == NULL) + usage(argv[0]); + if (sscanf(optarg, "%d", &val) != 1) + usage(argv[0]); + cinfo.desired_number_of_colors = val; + } + cinfo.quantize_colors = TRUE; + break; + case '2': /* Use two-pass quantization. */ + cinfo.two_pass_quantize = TRUE; + break; + case 'D': /* Use dithering in color quantization. */ + cinfo.use_dithering = TRUE; + break; + case 'd': /* Debugging. */ + e_methods.trace_level++; + break; + case 'g': /* Force grayscale output. */ + cinfo.out_color_space = CS_GRAYSCALE; + break; + case 'G': /* GIF output format. */ + requested_fmt = FMT_GIF; + break; + case '?': + default: + usage(argv[0]); + break; + } + + /* Select the input and output files */ + +#ifdef TWO_FILE_COMMANDLINE + + if (optind != argc-2) { + fprintf(stderr, "%s: must name one input and one output file\n", argv[0]); + usage(argv[0]); + } + if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); + exit(2); + } + if ((cinfo.output_file = fopen(argv[optind+1], WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind+1]); + exit(2); + } + +#else /* not TWO_FILE_COMMANDLINE -- use Unix style */ + + if (optind < argc-1) { + fprintf(stderr, "%s: only one input file\n", argv[0]); + usage(argv[0]); + } + if (optind < argc) { + if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); + exit(2); + } + } + +#endif /* TWO_FILE_COMMANDLINE */ + + /* Set up to read a JFIF or baseline-JPEG file. */ + /* A smarter UI would inspect the first few bytes of the input file */ + /* to determine its type. */ +#ifdef JFIF_SUPPORTED + jselrjfif(&cinfo); +#else + You shoulda defined JFIF_SUPPORTED. /* deliberate syntax error */ +#endif + + /* Do it to it! */ + jpeg_decompress(&cinfo); + + /* Release memory. */ + (*cinfo.emethods->free_small) ((void *) cinfo.input_buffer); +#ifdef MEM_STATS + if (e_methods.trace_level > 0) + j_mem_stats(); +#endif + + /* All done. */ + exit(0); +} diff --git a/jdmaster.c b/jdmaster.c new file mode 100644 index 00000000..56938821 --- /dev/null +++ b/jdmaster.c @@ -0,0 +1,180 @@ +/* + * jdmaster.c + * + * Copyright (C) 1991, 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. + * + * This file contains the main control for the JPEG decompressor. + * The system-dependent (user interface) code should call jpeg_decompress() + * after doing appropriate setup of the decompress_info_struct parameter. + */ + +#include "jinclude.h" + + +METHODDEF void +d_per_scan_method_selection (decompress_info_ptr cinfo) +/* Central point for per-scan method selection */ +{ + /* MCU disassembly */ + jseldmcu(cinfo); + /* Un-subsampling of pixels */ + jselunsubsample(cinfo); +} + + +LOCAL void +d_initial_method_selection (decompress_info_ptr cinfo) +/* Central point for initial method selection (after reading file header) */ +{ + /* JPEG file scanning method selection is already done. */ + /* So is output file format selection (both are done by user interface). */ + + /* Entropy decoding: either Huffman or arithmetic coding. */ +#ifdef ARITH_CODING_SUPPORTED + jseldarithmetic(cinfo); +#else + if (cinfo->arith_code) { + ERREXIT(cinfo->emethods, "Arithmetic coding not supported"); + } +#endif + jseldhuffman(cinfo); + /* Cross-block smoothing */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + jselbsmooth(cinfo); +#else + cinfo->do_block_smoothing = FALSE; +#endif + /* Gamma and color space conversion */ + jseldcolor(cinfo); + + /* Color quantization */ +#ifdef QUANT_1PASS_SUPPORTED +#ifndef QUANT_2PASS_SUPPORTED + cinfo->two_pass_quantize = FALSE; /* only have 1-pass */ +#endif +#else /* not QUANT_1PASS_SUPPORTED */ +#ifdef QUANT_2PASS_SUPPORTED + cinfo->two_pass_quantize = TRUE; /* only have 2-pass */ +#else /* not QUANT_2PASS_SUPPORTED */ + if (cinfo->quantize_colors) { + ERREXIT(cinfo->emethods, "Color quantization was not compiled"); + } +#endif +#endif + +#ifdef QUANT_1PASS_SUPPORTED + jsel1quantize(cinfo); +#endif +#ifdef QUANT_2PASS_SUPPORTED + jsel2quantize(cinfo); +#endif + + /* Pipeline control */ + jseldpipeline(cinfo); + /* Overall control (that's me!) */ + cinfo->methods->d_per_scan_method_selection = d_per_scan_method_selection; +} + + +LOCAL void +initial_setup (decompress_info_ptr cinfo) +/* Do computations that are needed before initial method selection */ +{ + short ci; + jpeg_component_info *compptr; + + /* Compute maximum sampling factors; check factor validity */ + cinfo->max_h_samp_factor = 1; + cinfo->max_v_samp_factor = 1; + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = &cinfo->comp_info[ci]; + if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + ERREXIT(cinfo->emethods, "Bogus sampling factors"); + cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, + compptr->h_samp_factor); + cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, + compptr->v_samp_factor); + + } + + /* Compute logical subsampled dimensions of components */ + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = &cinfo->comp_info[ci]; + compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor + + cinfo->max_h_samp_factor - 1) + / cinfo->max_h_samp_factor; + compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor + + cinfo->max_v_samp_factor - 1) + / cinfo->max_v_samp_factor; + } +} + + +/* + * This is the main entry point to the JPEG decompressor. + */ + + +GLOBAL void +jpeg_decompress (decompress_info_ptr cinfo) +{ + short i; + + /* Initialize pointers as needed to mark stuff unallocated. */ + cinfo->comp_info = NULL; + for (i = 0; i < NUM_QUANT_TBLS; i++) + cinfo->quant_tbl_ptrs[i] = NULL; + for (i = 0; i < NUM_HUFF_TBLS; i++) { + cinfo->dc_huff_tbl_ptrs[i] = NULL; + cinfo->ac_huff_tbl_ptrs[i] = NULL; + } + + /* Read the JPEG file header markers; everything up through the first SOS + * marker is read now. NOTE: the user interface must have initialized the + * read_file_header method pointer (eg, by calling jselrjfif or jselrtiff). + * The other file reading methods (read_scan_header etc.) were probably + * set at the same time, but could be set up by read_file_header itself. + */ + (*cinfo->methods->read_file_header) (cinfo); + if (! ((*cinfo->methods->read_scan_header) (cinfo))) + ERREXIT(cinfo->emethods, "Empty JPEG file"); + + /* Give UI a chance to adjust decompression parameters and select */ + /* output file format based on info from file header. */ + (*cinfo->methods->d_ui_method_selection) (cinfo); + + /* Now select methods for decompression steps. */ + initial_setup(cinfo); + d_initial_method_selection(cinfo); + + /* Initialize the output file & other modules as needed */ + /* (color_quant and entropy_decoder are inited by pipeline controller) */ + + (*cinfo->methods->output_init) (cinfo); + (*cinfo->methods->colorout_init) (cinfo); + + /* And let the pipeline controller do the rest. */ + (*cinfo->methods->d_pipeline_controller) (cinfo); + + /* Finish output file, release working storage, etc */ + (*cinfo->methods->colorout_term) (cinfo); + (*cinfo->methods->output_term) (cinfo); + (*cinfo->methods->read_file_trailer) (cinfo); + + /* Release allocated storage for tables */ +#define FREE(ptr) if ((ptr) != NULL) \ + (*cinfo->emethods->free_small) ((void *) ptr) + + FREE(cinfo->comp_info); + for (i = 0; i < NUM_QUANT_TBLS; i++) + FREE(cinfo->quant_tbl_ptrs[i]); + for (i = 0; i < NUM_HUFF_TBLS; i++) { + FREE(cinfo->dc_huff_tbl_ptrs[i]); + FREE(cinfo->ac_huff_tbl_ptrs[i]); + } + + /* My, that was easy, wasn't it? */ +} diff --git a/jdmcu.c b/jdmcu.c new file mode 100644 index 00000000..0d991708 --- /dev/null +++ b/jdmcu.c @@ -0,0 +1,146 @@ +/* + * jdmcu.c + * + * Copyright (C) 1991, 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. + * + * This file contains MCU disassembly routines and quantization descaling. + * These routines are invoked via the disassemble_MCU and + * disassemble_init/term methods. + */ + +#include "jinclude.h" + + +/* + * Quantization descaling and zigzag reordering + */ + + +/* ZAG[i] is the natural-order position of the i'th element of zigzag order. */ + +static const short ZAG[DCTSIZE2] = { + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63 +}; + + +LOCAL void +qdescale_zig (JBLOCK input, JBLOCKROW outputptr, QUANT_TBL_PTR quanttbl) +{ + short i; + + for (i = 0; i < DCTSIZE2; i++) { + (*outputptr)[ZAG[i]] = (*input++) * (*quanttbl++); + } +} + + + +/* + * Fetch one MCU row from entropy_decode, build coefficient array. + * This version is used for noninterleaved (single-component) scans. + */ + +METHODDEF void +disassemble_noninterleaved_MCU (decompress_info_ptr cinfo, + JBLOCKIMAGE image_data) +{ + JBLOCK MCU_data[1]; + long mcuindex; + jpeg_component_info * compptr; + QUANT_TBL_PTR quant_ptr; + + /* this is pretty easy since there is one component and one block per MCU */ + compptr = cinfo->cur_comp_info[0]; + quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; + for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) { + /* Fetch the coefficient data */ + (*cinfo->methods->entropy_decode) (cinfo, MCU_data); + /* Descale, reorder, and distribute it into the image array */ + qdescale_zig(MCU_data[0], image_data[0][0] + mcuindex, quant_ptr); + } +} + + +/* + * Fetch one MCU row from entropy_decode, build coefficient array. + * This version is used for interleaved (multi-component) scans. + */ + +METHODDEF void +disassemble_interleaved_MCU (decompress_info_ptr cinfo, + JBLOCKIMAGE image_data) +{ + JBLOCK MCU_data[MAX_BLOCKS_IN_MCU]; + long mcuindex; + short blkn, ci, xpos, ypos; + jpeg_component_info * compptr; + QUANT_TBL_PTR quant_ptr; + JBLOCKROW image_ptr; + + for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) { + /* Fetch the coefficient data */ + (*cinfo->methods->entropy_decode) (cinfo, MCU_data); + /* Descale, reorder, and distribute it into the image array */ + blkn = 0; + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; + for (ypos = 0; ypos < compptr->MCU_height; ypos++) { + image_ptr = image_data[ci][ypos] + (mcuindex * compptr->MCU_width); + for (xpos = 0; xpos < compptr->MCU_width; xpos++) { + qdescale_zig(MCU_data[blkn], image_ptr, quant_ptr); + image_ptr++; + blkn++; + } + } + } + } +} + + +/* + * Initialize for processing a scan. + */ + +METHODDEF void +disassemble_init (decompress_info_ptr cinfo) +{ + /* no work for now */ +} + + +/* + * Clean up after a scan. + */ + +METHODDEF void +disassemble_term (decompress_info_ptr cinfo) +{ + /* no work for now */ +} + + + +/* + * The method selection routine for MCU disassembly. + */ + +GLOBAL void +jseldmcu (decompress_info_ptr cinfo) +{ + if (cinfo->comps_in_scan == 1) + cinfo->methods->disassemble_MCU = disassemble_noninterleaved_MCU; + else + cinfo->methods->disassemble_MCU = disassemble_interleaved_MCU; + cinfo->methods->disassemble_init = disassemble_init; + cinfo->methods->disassemble_term = disassemble_term; +} diff --git a/jdpipe.c b/jdpipe.c new file mode 100644 index 00000000..8e088749 --- /dev/null +++ b/jdpipe.c @@ -0,0 +1,1309 @@ +/* + * jdpipe.c + * + * Copyright (C) 1991, 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. + * + * This file contains decompression pipeline controllers. + * These routines are invoked via the d_pipeline_controller method. + * + * There are four basic pipeline controllers, one for each combination of: + * single-scan JPEG file (single component or fully interleaved) + * vs. multiple-scan JPEG file (noninterleaved or partially interleaved). + * + * 2-pass color quantization + * vs. no color quantization or 1-pass quantization. + * + * Note that these conditions determine the needs for "big" images: + * multiple scans imply a big image for recombining the color components; + * 2-pass color quantization needs a big image for saving the data for pass 2. + * + * All but the simplest controller (single-scan, no 2-pass quantization) can be + * compiled out through configuration options, if you need to make a minimal + * implementation. You should leave in multiple-scan support if at all + * possible, so that you can handle all legal JPEG files. + */ + +#include "jinclude.h" + + +/* + * About the data structures: + * + * The processing chunk size for unsubsampling is referred to in this file as + * a "row group": a row group is defined as Vk (v_samp_factor) sample rows of + * any component while subsampled, or Vmax (max_v_samp_factor) unsubsampled + * rows. In an interleaved scan each MCU row contains exactly DCTSIZE row + * groups of each component in the scan. In a noninterleaved scan an MCU row + * is one row of blocks, which might not be an integral number of row groups; + * therefore, we read in Vk MCU rows to obtain the same amount of data as we'd + * have in an interleaved scan. + * To provide context for the unsubsampling step, we have to retain the last + * two row groups of the previous MCU row while reading in the next MCU row + * (or set of Vk MCU rows). To do this without copying data about, we create + * a rather strange data structure. Exactly DCTSIZE+2 row groups of samples + * are allocated, but we create two different sets of pointers to this array. + * The second set swaps the last two pairs of row groups. By working + * alternately with the two sets of pointers, we can access the data in the + * desired order. + * + * Cross-block smoothing also needs context above and below the "current" row. + * Since this is an optional feature, I've implemented it in a way that is + * much simpler but requires more than the minimum amount of memory. We + * simply allocate three extra MCU rows worth of coefficient blocks and use + * them to "read ahead" one MCU row in the file. For a typical 1000-pixel-wide + * image with 2x2,1x1,1x1 sampling, each MCU row is about 50Kb; an 80x86 + * machine may be unable to apply cross-block smoothing to wider images. + */ + + +/* + * These variables are logically local to the pipeline controller, + * but we make them static so that scan_big_image can use them + * without having to pass them through the quantization routines. + * If you don't support 2-pass quantization, you could make them locals. + */ + +static int rows_in_mem; /* # of sample rows in full-size buffers */ +/* Full-size image array holding desubsampled, color-converted data. */ +static big_sarray_ptr *fullsize_cnvt_image; +static JSAMPIMAGE fullsize_cnvt_ptrs; /* workspace for access_big_sarray() results */ +/* Work buffer for color quantization output (full size, only 1 component). */ +static JSAMPARRAY quantize_out; + + +/* + * Utility routines: common code for pipeline controllers + */ + +LOCAL void +interleaved_scan_setup (decompress_info_ptr cinfo) +/* Compute all derived info for an interleaved (multi-component) scan */ +/* On entry, cinfo->comps_in_scan and cinfo->cur_comp_info[] are set up */ +{ + short ci, mcublks; + jpeg_component_info *compptr; + + if (cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo->emethods, "Too many components for interleaved scan"); + + cinfo->MCUs_per_row = (cinfo->image_width + + cinfo->max_h_samp_factor*DCTSIZE - 1) + / (cinfo->max_h_samp_factor*DCTSIZE); + + cinfo->MCU_rows_in_scan = (cinfo->image_height + + cinfo->max_v_samp_factor*DCTSIZE - 1) + / (cinfo->max_v_samp_factor*DCTSIZE); + + cinfo->blocks_in_MCU = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* for interleaved scan, sampling factors give # of blocks per component */ + compptr->MCU_width = compptr->h_samp_factor; + compptr->MCU_height = compptr->v_samp_factor; + compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; + /* compute physical dimensions of component */ + compptr->subsampled_width = jround_up(compptr->true_comp_width, + (long) (compptr->MCU_width*DCTSIZE)); + compptr->subsampled_height = jround_up(compptr->true_comp_height, + (long) (compptr->MCU_height*DCTSIZE)); + /* Sanity check */ + if (compptr->subsampled_width != + (cinfo->MCUs_per_row * (compptr->MCU_width*DCTSIZE))) + ERREXIT(cinfo->emethods, "I'm confused about the image width"); + /* Prepare array describing MCU composition */ + mcublks = compptr->MCU_blocks; + if (cinfo->blocks_in_MCU + mcublks > MAX_BLOCKS_IN_MCU) + ERREXIT(cinfo->emethods, "Sampling factors too large for interleaved scan"); + while (mcublks-- > 0) { + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + } + } + + (*cinfo->methods->d_per_scan_method_selection) (cinfo); +} + + +LOCAL void +noninterleaved_scan_setup (decompress_info_ptr cinfo) +/* Compute all derived info for a noninterleaved (single-component) scan */ +/* On entry, cinfo->comps_in_scan = 1 and cinfo->cur_comp_info[0] is set up */ +{ + jpeg_component_info *compptr = cinfo->cur_comp_info[0]; + + /* for noninterleaved scan, always one block per MCU */ + compptr->MCU_width = 1; + compptr->MCU_height = 1; + compptr->MCU_blocks = 1; + /* compute physical dimensions of component */ + compptr->subsampled_width = jround_up(compptr->true_comp_width, + (long) DCTSIZE); + compptr->subsampled_height = jround_up(compptr->true_comp_height, + (long) DCTSIZE); + + cinfo->MCUs_per_row = compptr->subsampled_width / DCTSIZE; + cinfo->MCU_rows_in_scan = compptr->subsampled_height / DCTSIZE; + + /* Prepare array describing MCU composition */ + cinfo->blocks_in_MCU = 1; + cinfo->MCU_membership[0] = 0; + + (*cinfo->methods->d_per_scan_method_selection) (cinfo); +} + + +LOCAL void +reverse_DCT (decompress_info_ptr cinfo, + JBLOCKIMAGE coeff_data, JSAMPIMAGE output_data, + int start_row) +/* Perform inverse DCT on each block in an MCU row's worth of data; */ +/* output the results into a sample array starting at row start_row. */ +/* NB: start_row can only be nonzero when dealing with a single-component */ +/* scan; otherwise we'd have to provide for different offsets for different */ +/* components, since the heights of interleaved MCU rows can vary. */ +{ + DCTBLOCK block; + JBLOCKROW browptr; + JSAMPARRAY srowptr; + long blocksperrow, bi; + short numrows, ri; + short ci; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + /* calc size of an MCU row in this component */ + blocksperrow = cinfo->cur_comp_info[ci]->subsampled_width / DCTSIZE; + numrows = cinfo->cur_comp_info[ci]->MCU_height; + /* iterate through all blocks in MCU row */ + for (ri = 0; ri < numrows; ri++) { + browptr = coeff_data[ci][ri]; + srowptr = output_data[ci] + (ri * DCTSIZE + start_row); + for (bi = 0; bi < blocksperrow; bi++) { + /* copy the data into a local DCTBLOCK. This allows for change of + * representation (if DCTELEM != JCOEF). On 80x86 machines it also + * brings the data back from FAR storage to NEAR storage. + */ + { register JCOEFPTR elemptr = browptr[bi]; + register DCTELEM *localblkptr = block; + register short elem = DCTSIZE2; + + while (--elem >= 0) + *localblkptr++ = (DCTELEM) *elemptr++; + } + + j_rev_dct(block); /* perform inverse DCT */ + + /* output the data into the sample array. + * Note change from signed to unsigned representation: + * DCT calculation works with values +-CENTERJSAMPLE, + * but sample arrays always hold 0..MAXJSAMPLE. + * Have to do explicit range-limiting because of quantization errors + * and so forth in the DCT/IDCT phase. + */ + { register JSAMPROW elemptr; + register DCTELEM *localblkptr = block; + register short elemr, elemc; + register DCTELEM temp; + + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = srowptr[elemr] + (bi * DCTSIZE); + for (elemc = 0; elemc < DCTSIZE; elemc++) { + temp = (*localblkptr++) + CENTERJSAMPLE; + if (temp < 0) temp = 0; + else if (temp > MAXJSAMPLE) temp = MAXJSAMPLE; + *elemptr++ = (JSAMPLE) temp; + } + } + } + } + } + } +} + + + +LOCAL JSAMPIMAGE +alloc_sampimage (decompress_info_ptr cinfo, + int num_comps, long num_rows, long num_cols) +/* Allocate an in-memory sample image (all components same size) */ +{ + JSAMPIMAGE image; + int ci; + + image = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (num_comps * SIZEOF(JSAMPARRAY)); + for (ci = 0; ci < num_comps; ci++) { + image[ci] = (*cinfo->emethods->alloc_small_sarray) (num_cols, num_rows); + } + return image; +} + + +LOCAL void +free_sampimage (decompress_info_ptr cinfo, JSAMPIMAGE image, + int num_comps, long num_rows) +/* Release a sample image created by alloc_sampimage */ +{ + int ci; + + for (ci = 0; ci < num_comps; ci++) { + (*cinfo->emethods->free_small_sarray) (image[ci], num_rows); + } + (*cinfo->emethods->free_small) ((void *) image); +} + + +LOCAL JBLOCKIMAGE +alloc_MCU_row (decompress_info_ptr cinfo) +/* Allocate one MCU row's worth of coefficient blocks */ +{ + JBLOCKIMAGE image; + int ci; + + image = (JBLOCKIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->comps_in_scan * SIZEOF(JBLOCKARRAY)); + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + image[ci] = (*cinfo->emethods->alloc_small_barray) + (cinfo->cur_comp_info[ci]->subsampled_width / DCTSIZE, + (long) cinfo->cur_comp_info[ci]->MCU_height); + } + return image; +} + + +LOCAL void +free_MCU_row (decompress_info_ptr cinfo, JBLOCKIMAGE image) +/* Release a coefficient block array created by alloc_MCU_row */ +{ + int ci; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + (*cinfo->emethods->free_small_barray) + (image[ci], (long) cinfo->cur_comp_info[ci]->MCU_height); + } + (*cinfo->emethods->free_small) ((void *) image); +} + + +LOCAL void +alloc_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) +/* Create a subsampled-data buffer having the desired structure */ +/* (see comments at head of file) */ +{ + short ci, vs, i; + + /* Get top-level space for array pointers */ + subsampled_data[0] = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->comps_in_scan * SIZEOF(JSAMPARRAY)); + subsampled_data[1] = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->comps_in_scan * SIZEOF(JSAMPARRAY)); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + vs = cinfo->cur_comp_info[ci]->v_samp_factor; /* row group height */ + /* Allocate the real storage */ + subsampled_data[0][ci] = (*cinfo->emethods->alloc_small_sarray) + (cinfo->cur_comp_info[ci]->subsampled_width, + (long) (vs * (DCTSIZE+2))); + /* Create space for the scrambled-order pointers */ + subsampled_data[1][ci] = (JSAMPARRAY) (*cinfo->emethods->alloc_small) + (vs * (DCTSIZE+2) * SIZEOF(JSAMPROW)); + /* Duplicate the first DCTSIZE-2 row groups */ + for (i = 0; i < vs * (DCTSIZE-2); i++) { + subsampled_data[1][ci][i] = subsampled_data[0][ci][i]; + } + /* Copy the last four row groups in swapped order */ + for (i = 0; i < vs * 2; i++) { + subsampled_data[1][ci][vs*DCTSIZE + i] = subsampled_data[0][ci][vs*(DCTSIZE-2) + i]; + subsampled_data[1][ci][vs*(DCTSIZE-2) + i] = subsampled_data[0][ci][vs*DCTSIZE + i]; + } + } +} + + +LOCAL void +free_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) +/* Release a sampling buffer created by alloc_sampling_buffer */ +{ + short ci, vs; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + vs = cinfo->cur_comp_info[ci]->v_samp_factor; /* row group height */ + /* Free the real storage */ + (*cinfo->emethods->free_small_sarray) + (subsampled_data[0][ci], (long) (vs * (DCTSIZE+2))); + /* Free the scrambled-order pointers */ + (*cinfo->emethods->free_small) ((void *) subsampled_data[1][ci]); + } + + /* Free the top-level space */ + (*cinfo->emethods->free_small) ((void *) subsampled_data[0]); + (*cinfo->emethods->free_small) ((void *) subsampled_data[1]); +} + + +LOCAL void +duplicate_row (JSAMPARRAY image_data, + long num_cols, int source_row, int num_rows) +/* Duplicate the source_row at source_row+1 .. source_row+num_rows */ +/* This happens only at the bottom of the image, */ +/* so it needn't be super-efficient */ +{ + register int row; + + for (row = 1; row <= num_rows; row++) { + jcopy_sample_rows(image_data, source_row, image_data, source_row + row, + 1, num_cols); + } +} + + +LOCAL void +expand (decompress_info_ptr cinfo, + JSAMPIMAGE subsampled_data, JSAMPIMAGE fullsize_data, + long fullsize_width, + short above, short current, short below, short out) +/* Do unsubsampling expansion of a single row group (of each component). */ +/* above, current, below are indexes of row groups in subsampled_data; */ +/* out is the index of the target row group in fullsize_data. */ +/* Special case: above, below can be -1 to indicate top, bottom of image. */ +{ + jpeg_component_info *compptr; + JSAMPARRAY above_ptr, below_ptr; + JSAMPROW dummy[MAX_SAMP_FACTOR]; /* for subsample expansion at top/bottom */ + short ci, vs, i; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + vs = compptr->v_samp_factor; /* row group height */ + + if (above >= 0) + above_ptr = subsampled_data[ci] + above * vs; + else { + /* Top of image: make a dummy above-context with copies of 1st row */ + /* We assume current=0 in this case */ + for (i = 0; i < vs; i++) + dummy[i] = subsampled_data[ci][0]; + above_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */ + } + + if (below >= 0) + below_ptr = subsampled_data[ci] + below * vs; + else { + /* Bot of image: make a dummy below-context with copies of last row */ + for (i = 0; i < vs; i++) + dummy[i] = subsampled_data[ci][(current+1)*vs-1]; + below_ptr = (JSAMPARRAY) dummy; /* possible near->far pointer conv */ + } + + (*cinfo->methods->unsubsample[ci]) + (cinfo, (int) ci, + compptr->subsampled_width, (int) vs, + fullsize_width, (int) cinfo->max_v_samp_factor, + above_ptr, + subsampled_data[ci] + current * vs, + below_ptr, + fullsize_data[ci] + out * cinfo->max_v_samp_factor); + } +} + + +LOCAL void +emit_1pass (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE fullsize_data, JSAMPIMAGE color_data) +/* Do color conversion and output of num_rows full-size rows. */ +/* This is not used for 2-pass color quantization. */ +{ + (*cinfo->methods->color_convert) (cinfo, num_rows, + fullsize_data, color_data); + + if (cinfo->quantize_colors) { + (*cinfo->methods->color_quantize) (cinfo, num_rows, + color_data, quantize_out); + + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, + &quantize_out); + } else { + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, + color_data); + } +} + + +/* + * Support routines for 2-pass color quantization. + */ + +#ifdef QUANT_2PASS_SUPPORTED + +LOCAL void +emit_2pass (decompress_info_ptr cinfo, long top_row, int num_rows, + JSAMPIMAGE fullsize_data) +/* Do color conversion and output data to the quantization buffer image. */ +/* This is used only with 2-pass color quantization. */ +{ + short ci; + + /* Realign the big buffers */ + for (ci = 0; ci < cinfo->num_components; ci++) { + fullsize_cnvt_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_cnvt_image[ci], top_row, TRUE); + } + + /* Do colorspace conversion */ + (*cinfo->methods->color_convert) (cinfo, num_rows, + fullsize_data, fullsize_cnvt_ptrs); + /* Let quantizer get first-pass peek at the data. */ + /* (Quantizer could change data if it wants to.) */ + (*cinfo->methods->color_quant_prescan) (cinfo, num_rows, fullsize_cnvt_ptrs); +} + + +METHODDEF void +scan_big_image (decompress_info_ptr cinfo, quantize_method_ptr quantize_method) +/* This is the "iterator" routine used by the quantizer. */ +{ + long pixel_rows_output; + short ci; + + for (pixel_rows_output = 0; pixel_rows_output < cinfo->image_height; + pixel_rows_output += rows_in_mem) { + /* Realign the big buffers */ + for (ci = 0; ci < cinfo->num_components; ci++) { + fullsize_cnvt_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_cnvt_image[ci], pixel_rows_output, FALSE); + } + /* Let the quantizer have its way with the data. + * Note that quantize_out is simply workspace for the quantizer; + * when it's ready to output, it must call put_pixel_rows itself. + */ + (*quantize_method) (cinfo, + (int) MIN(rows_in_mem, + cinfo->image_height - pixel_rows_output), + fullsize_cnvt_ptrs, quantize_out); + } +} + +#endif /* QUANT_2PASS_SUPPORTED */ + + +/* + * Support routines for cross-block smoothing. + */ + +#ifdef BLOCK_SMOOTHING_SUPPORTED + + +LOCAL void +smooth_mcu_row (decompress_info_ptr cinfo, + JBLOCKIMAGE above, JBLOCKIMAGE input, JBLOCKIMAGE below, + JBLOCKIMAGE output) +/* Apply cross-block smoothing to one MCU row's worth of coefficient blocks. */ +/* above,below are NULL if at top/bottom of image. */ +{ + jpeg_component_info *compptr; + short ci, ri, last; + JBLOCKROW prev; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + last = compptr->MCU_height - 1; + + if (above == NULL) + prev = NULL; + else + prev = above[ci][last]; + + for (ri = 0; ri < last; ri++) { + (*cinfo->methods->smooth_coefficients) (cinfo, compptr, + prev, input[ci][ri], input[ci][ri+1], + output[ci][ri]); + prev = input[ci][ri]; + } + + if (below == NULL) + (*cinfo->methods->smooth_coefficients) (cinfo, compptr, + prev, input[ci][last], (JBLOCKROW) NULL, + output[ci][last]); + else + (*cinfo->methods->smooth_coefficients) (cinfo, compptr, + prev, input[ci][last], below[ci][0], + output[ci][last]); + } +} + + +LOCAL void +get_smoothed_row (decompress_info_ptr cinfo, JBLOCKIMAGE coeff_data, + JBLOCKIMAGE bsmooth[3], int * whichb, long cur_mcu_row) +/* Get an MCU row of coefficients, applying cross-block smoothing. */ +/* The output row is placed in coeff_data. bsmooth and whichb hold */ +/* working state, and cur_row is needed to check for image top/bottom. */ +/* This routine just takes care of the buffering logic. */ +{ + int prev, cur, next; + + /* Special case for top of image: need to pre-fetch a row & init whichb */ + if (cur_mcu_row == 0) { + (*cinfo->methods->disassemble_MCU) (cinfo, bsmooth[0]); + if (cinfo->MCU_rows_in_scan > 1) { + (*cinfo->methods->disassemble_MCU) (cinfo, bsmooth[1]); + smooth_mcu_row(cinfo, (JBLOCKIMAGE) NULL, bsmooth[0], bsmooth[1], + coeff_data); + } else { + smooth_mcu_row(cinfo, (JBLOCKIMAGE) NULL, bsmooth[0], (JBLOCKIMAGE) NULL, + coeff_data); + } + *whichb = 1; /* points to next bsmooth[] element to use */ + return; + } + + cur = *whichb; /* set up references */ + prev = (cur == 0 ? 2 : cur - 1); + next = (cur == 2 ? 0 : cur + 1); + *whichb = next; /* advance whichb for next time */ + + /* Special case for bottom of image: don't read another row */ + if (cur_mcu_row >= cinfo->MCU_rows_in_scan - 1) { + smooth_mcu_row(cinfo, bsmooth[prev], bsmooth[cur], (JBLOCKIMAGE) NULL, + coeff_data); + return; + } + + /* Normal case: read ahead a new row, smooth the one I got before */ + (*cinfo->methods->disassemble_MCU) (cinfo, bsmooth[next]); + smooth_mcu_row(cinfo, bsmooth[prev], bsmooth[cur], bsmooth[next], + coeff_data); +} + + +#endif /* BLOCK_SMOOTHING_SUPPORTED */ + + + +/* + * Decompression pipeline controller used for single-scan files + * without 2-pass color quantization. + */ + +METHODDEF void +single_dcontroller (decompress_info_ptr cinfo) +{ + long fullsize_width; /* # of samples per row in full-size buffers */ + long cur_mcu_row; /* counts # of MCU rows processed */ + long pixel_rows_output; /* # of pixel rows actually emitted */ + int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ + /* Work buffer for dequantized coefficients (IDCT input) */ + JBLOCKIMAGE coeff_data; + /* Work buffer for cross-block smoothing input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + JBLOCKIMAGE bsmooth[3]; /* this is optional */ + int whichb; +#endif + /* Work buffer for subsampled image data (see comments at head of file) */ + JSAMPIMAGE subsampled_data[2]; + /* Work buffer for desubsampled data */ + JSAMPIMAGE fullsize_data; + /* Work buffer for color conversion output (full size) */ + JSAMPIMAGE color_data; + int whichss, ri; + short i; + + /* Initialize for 1-pass color quantization, if needed */ + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_init) (cinfo); + + /* Prepare for single scan containing all components */ + if (cinfo->comps_in_scan == 1) { + noninterleaved_scan_setup(cinfo); + /* Need to read Vk MCU rows to obtain Vk block rows */ + mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; + } else { + interleaved_scan_setup(cinfo); + /* in an interleaved scan, one MCU row provides Vk block rows */ + mcu_rows_per_loop = 1; + } + + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + + /* Allocate working memory: */ + /* coeff_data holds a single MCU row of coefficient blocks */ + coeff_data = alloc_MCU_row(cinfo); + /* if doing cross-block smoothing, need extra space for its input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + bsmooth[0] = alloc_MCU_row(cinfo); + bsmooth[1] = alloc_MCU_row(cinfo); + bsmooth[2] = alloc_MCU_row(cinfo); + } +#endif + /* subsampled_data is sample data before unsubsampling */ + alloc_sampling_buffer(cinfo, subsampled_data); + /* fullsize_data is sample data after unsubsampling */ + fullsize_data = alloc_sampimage(cinfo, (int) cinfo->num_components, + (long) rows_in_mem, fullsize_width); + /* color_data is the result of the colorspace conversion step */ + color_data = alloc_sampimage(cinfo, (int) cinfo->color_out_comps, + (long) rows_in_mem, fullsize_width); + /* if quantizing colors, also need a one-component output area for that. */ + if (cinfo->quantize_colors) + quantize_out = (*cinfo->emethods->alloc_small_sarray) + (fullsize_width, (long) rows_in_mem); + + /* Tell the memory manager to instantiate big arrays. + * We don't need any big arrays in this controller, + * but some other module (like the output file writer) may need one. + */ + (*cinfo->emethods->alloc_big_arrays) + ((long) 0, /* no more small sarrays */ + (long) 0, /* no more small barrays */ + (long) 0); /* no more "medium" objects */ + /* NB: quantizer must get any such objects at color_quant_init time */ + + /* Initialize to read scan data */ + + (*cinfo->methods->entropy_decoder_init) (cinfo); + (*cinfo->methods->unsubsample_init) (cinfo); + (*cinfo->methods->disassemble_init) (cinfo); + + /* Loop over scan's data: rows_in_mem pixel rows are processed per loop */ + + pixel_rows_output = 0; + whichss = 1; /* arrange to start with subsampled_data[0] */ + + for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; + cur_mcu_row += mcu_rows_per_loop) { + whichss ^= 1; /* switch to other subsample buffer */ + + /* Obtain v_samp_factor block rows of each component in the scan. */ + /* This is a single MCU row if interleaved, multiple MCU rows if not. */ + /* In the noninterleaved case there might be fewer than v_samp_factor */ + /* block rows remaining; if so, pad with copies of the last pixel row */ + /* so that unsubsampling doesn't have to treat it as a special case. */ + + for (ri = 0; ri < mcu_rows_per_loop; ri++) { + if (cur_mcu_row + ri < cinfo->MCU_rows_in_scan) { + /* OK to actually read an MCU row. */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) + get_smoothed_row(cinfo, coeff_data, + bsmooth, &whichb, cur_mcu_row + ri); + else +#endif + (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); + + reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], + ri * DCTSIZE); + } else { + /* Need to pad out with copies of the last subsampled row. */ + /* This can only happen if there is just one component. */ + duplicate_row(subsampled_data[whichss][0], + cinfo->cur_comp_info[0]->subsampled_width, + ri * DCTSIZE - 1, DCTSIZE); + } + } + + /* Unsubsample the data */ + /* First time through is a special case */ + + if (cur_mcu_row) { + /* Expand last row group of previous set */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, + (short) (DCTSIZE-1)); + /* and dump the previous set's expanded data */ + emit_1pass (cinfo, rows_in_mem, fullsize_data, color_data); + pixel_rows_output += rows_in_mem; + /* Expand first row group of this set */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (DCTSIZE+1), (short) 0, (short) 1, + (short) 0); + } else { + /* Expand first row group with dummy above-context */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (-1), (short) 0, (short) 1, + (short) 0); + } + /* Expand second through next-to-last row groups of this set */ + for (i = 1; i <= DCTSIZE-2; i++) { + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (i-1), (short) i, (short) (i+1), + (short) i); + } + } /* end of outer loop */ + + /* Expand the last row group with dummy below-context */ + /* Note whichss points to last buffer side used */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), + (short) (DCTSIZE-1)); + /* and dump the remaining data (may be less than full height) */ + emit_1pass (cinfo, (int) (cinfo->image_height - pixel_rows_output), + fullsize_data, color_data); + + /* Clean up after the scan */ + (*cinfo->methods->disassemble_term) (cinfo); + (*cinfo->methods->unsubsample_term) (cinfo); + (*cinfo->methods->entropy_decoder_term) (cinfo); + (*cinfo->methods->read_scan_trailer) (cinfo); + + /* Verify that we've seen the whole input file */ + if ((*cinfo->methods->read_scan_header) (cinfo)) + ERREXIT(cinfo->emethods, "Didn't expect more than one scan"); + + /* Release working memory */ + free_MCU_row(cinfo, coeff_data); +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + free_MCU_row(cinfo, bsmooth[0]); + free_MCU_row(cinfo, bsmooth[1]); + free_MCU_row(cinfo, bsmooth[2]); + } +#endif + free_sampling_buffer(cinfo, subsampled_data); + free_sampimage(cinfo, fullsize_data, (int) cinfo->num_components, + (long) rows_in_mem); + free_sampimage(cinfo, color_data, (int) cinfo->color_out_comps, + (long) rows_in_mem); + if (cinfo->quantize_colors) + (*cinfo->emethods->free_small_sarray) + (quantize_out, (long) rows_in_mem); + + /* Close up shop */ + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_term) (cinfo); +} + + +/* + * Decompression pipeline controller used for single-scan files + * with 2-pass color quantization. + */ + +#ifdef QUANT_2PASS_SUPPORTED + +METHODDEF void +single_2quant_dcontroller (decompress_info_ptr cinfo) +{ + long fullsize_width; /* # of samples per row in full-size buffers */ + long cur_mcu_row; /* counts # of MCU rows processed */ + long pixel_rows_output; /* # of pixel rows actually emitted */ + int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ + /* Work buffer for dequantized coefficients (IDCT input) */ + JBLOCKIMAGE coeff_data; + /* Work buffer for cross-block smoothing input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + JBLOCKIMAGE bsmooth[3]; /* this is optional */ + int whichb; +#endif + /* Work buffer for subsampled image data (see comments at head of file) */ + JSAMPIMAGE subsampled_data[2]; + /* Work buffer for desubsampled data */ + JSAMPIMAGE fullsize_data; + int whichss, ri; + short ci, i; + + /* Initialize for 2-pass color quantization */ + (*cinfo->methods->color_quant_init) (cinfo); + + /* Prepare for single scan containing all components */ + if (cinfo->comps_in_scan == 1) { + noninterleaved_scan_setup(cinfo); + /* Need to read Vk MCU rows to obtain Vk block rows */ + mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; + } else { + interleaved_scan_setup(cinfo); + /* in an interleaved scan, one MCU row provides Vk block rows */ + mcu_rows_per_loop = 1; + } + + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + + /* Allocate working memory: */ + /* coeff_data holds a single MCU row of coefficient blocks */ + coeff_data = alloc_MCU_row(cinfo); + /* if doing cross-block smoothing, need extra space for its input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + bsmooth[0] = alloc_MCU_row(cinfo); + bsmooth[1] = alloc_MCU_row(cinfo); + bsmooth[2] = alloc_MCU_row(cinfo); + } +#endif + /* subsampled_data is sample data before unsubsampling */ + alloc_sampling_buffer(cinfo, subsampled_data); + /* fullsize_data is sample data after unsubsampling */ + fullsize_data = alloc_sampimage(cinfo, (int) cinfo->num_components, + (long) rows_in_mem, fullsize_width); + /* Also need a one-component output area for color quantizer. */ + quantize_out = (*cinfo->emethods->alloc_small_sarray) + (fullsize_width, (long) rows_in_mem); + + /* Get a big image for quantizer input: desubsampled, color-converted data */ + fullsize_cnvt_image = (big_sarray_ptr *) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(big_sarray_ptr)); + for (ci = 0; ci < cinfo->num_components; ci++) { + fullsize_cnvt_image[ci] = (*cinfo->emethods->request_big_sarray) + (fullsize_width, + jround_up(cinfo->image_height, (long) rows_in_mem), + (long) rows_in_mem); + } + /* Also get an area for pointers to currently accessible chunks */ + fullsize_cnvt_ptrs = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + + /* Tell the memory manager to instantiate big arrays */ + (*cinfo->emethods->alloc_big_arrays) + ((long) 0, /* no more small sarrays */ + (long) 0, /* no more small barrays */ + (long) 0); /* no more "medium" objects */ + /* NB: quantizer must get any such objects at color_quant_init time */ + + /* Initialize to read scan data */ + + (*cinfo->methods->entropy_decoder_init) (cinfo); + (*cinfo->methods->unsubsample_init) (cinfo); + (*cinfo->methods->disassemble_init) (cinfo); + + /* Loop over scan's data: rows_in_mem pixel rows are processed per loop */ + + pixel_rows_output = 0; + whichss = 1; /* arrange to start with subsampled_data[0] */ + + for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; + cur_mcu_row += mcu_rows_per_loop) { + whichss ^= 1; /* switch to other subsample buffer */ + + /* Obtain v_samp_factor block rows of each component in the scan. */ + /* This is a single MCU row if interleaved, multiple MCU rows if not. */ + /* In the noninterleaved case there might be fewer than v_samp_factor */ + /* block rows remaining; if so, pad with copies of the last pixel row */ + /* so that unsubsampling doesn't have to treat it as a special case. */ + + for (ri = 0; ri < mcu_rows_per_loop; ri++) { + if (cur_mcu_row + ri < cinfo->MCU_rows_in_scan) { + /* OK to actually read an MCU row. */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) + get_smoothed_row(cinfo, coeff_data, + bsmooth, &whichb, cur_mcu_row + ri); + else +#endif + (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); + + reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], + ri * DCTSIZE); + } else { + /* Need to pad out with copies of the last subsampled row. */ + /* This can only happen if there is just one component. */ + duplicate_row(subsampled_data[whichss][0], + cinfo->cur_comp_info[0]->subsampled_width, + ri * DCTSIZE - 1, DCTSIZE); + } + } + + /* Unsubsample the data */ + /* First time through is a special case */ + + if (cur_mcu_row) { + /* Expand last row group of previous set */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, + (short) (DCTSIZE-1)); + /* and dump the previous set's expanded data */ + emit_2pass (cinfo, pixel_rows_output, rows_in_mem, fullsize_data); + pixel_rows_output += rows_in_mem; + /* Expand first row group of this set */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (DCTSIZE+1), (short) 0, (short) 1, + (short) 0); + } else { + /* Expand first row group with dummy above-context */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (-1), (short) 0, (short) 1, + (short) 0); + } + /* Expand second through next-to-last row groups of this set */ + for (i = 1; i <= DCTSIZE-2; i++) { + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (i-1), (short) i, (short) (i+1), + (short) i); + } + } /* end of outer loop */ + + /* Expand the last row group with dummy below-context */ + /* Note whichss points to last buffer side used */ + expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, + (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), + (short) (DCTSIZE-1)); + /* and dump the remaining data (may be less than full height) */ + emit_2pass (cinfo, pixel_rows_output, + (int) (cinfo->image_height - pixel_rows_output), + fullsize_data); + + /* Clean up after the scan */ + (*cinfo->methods->disassemble_term) (cinfo); + (*cinfo->methods->unsubsample_term) (cinfo); + (*cinfo->methods->entropy_decoder_term) (cinfo); + (*cinfo->methods->read_scan_trailer) (cinfo); + + /* Verify that we've seen the whole input file */ + if ((*cinfo->methods->read_scan_header) (cinfo)) + ERREXIT(cinfo->emethods, "Didn't expect more than one scan"); + + /* Now that we've collected the data, let the color quantizer do its thing */ + (*cinfo->methods->color_quant_doit) (cinfo, scan_big_image); + + /* Release working memory */ + free_MCU_row(cinfo, coeff_data); +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + free_MCU_row(cinfo, bsmooth[0]); + free_MCU_row(cinfo, bsmooth[1]); + free_MCU_row(cinfo, bsmooth[2]); + } +#endif + free_sampling_buffer(cinfo, subsampled_data); + free_sampimage(cinfo, fullsize_data, (int) cinfo->num_components, + (long) rows_in_mem); + (*cinfo->emethods->free_small_sarray) + (quantize_out, (long) rows_in_mem); + for (ci = 0; ci < cinfo->num_components; ci++) { + (*cinfo->emethods->free_big_sarray) (fullsize_cnvt_image[ci]); + } + (*cinfo->emethods->free_small) ((void *) fullsize_cnvt_image); + (*cinfo->emethods->free_small) ((void *) fullsize_cnvt_ptrs); + + /* Close up shop */ + (*cinfo->methods->color_quant_term) (cinfo); +} + +#endif /* QUANT_2PASS_SUPPORTED */ + + +/* + * Decompression pipeline controller used for multiple-scan files + * without 2-pass color quantization. + * + * The current implementation places the "big" buffer at the stage of + * desubsampled data. Buffering subsampled data instead would reduce the + * size of temp files (by about a factor of 2 in typical cases). However, + * the unsubsampling logic is dependent on the assumption that unsubsampling + * occurs during a scan, so it's much easier to do the enlargement as the + * JPEG file is read. This also simplifies life for the memory manager, + * which would otherwise have to deal with overlapping access_big_sarray() + * requests. + * + * At present it appears that most JPEG files will be single-scan, so + * it doesn't seem worthwhile to try to make this implementation smarter. + */ + +#ifdef MULTISCAN_FILES_SUPPORTED + +METHODDEF void +multi_dcontroller (decompress_info_ptr cinfo) +{ + long fullsize_width; /* # of samples per row in full-size buffers */ + long cur_mcu_row; /* counts # of MCU rows processed */ + long pixel_rows_output; /* # of pixel rows actually emitted */ + int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ + /* Work buffer for dequantized coefficients (IDCT input) */ + JBLOCKIMAGE coeff_data; + /* Work buffer for cross-block smoothing input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + JBLOCKIMAGE bsmooth[3]; /* this is optional */ + int whichb; +#endif + /* Work buffer for subsampled image data (see comments at head of file) */ + JSAMPIMAGE subsampled_data[2]; + /* Full-image buffer holding desubsampled, but not color-converted, data */ + big_sarray_ptr *fullsize_image; + JSAMPIMAGE fullsize_ptrs; /* workspace for access_big_sarray() results */ + /* Work buffer for color conversion output (full size) */ + JSAMPIMAGE color_data; + int whichss, ri; + short ci, i; + + /* Initialize for 1-pass color quantization, if needed */ + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_init) (cinfo); + + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + + /* Allocate all working memory that doesn't depend on scan info */ + /* color_data is the result of the colorspace conversion step */ + color_data = alloc_sampimage(cinfo, (int) cinfo->color_out_comps, + (long) rows_in_mem, fullsize_width); + /* if quantizing colors, also need a one-component output area for that. */ + if (cinfo->quantize_colors) + quantize_out = (*cinfo->emethods->alloc_small_sarray) + (fullsize_width, (long) rows_in_mem); + + /* Get a big image: fullsize_image is sample data after unsubsampling. */ + fullsize_image = (big_sarray_ptr *) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(big_sarray_ptr)); + for (ci = 0; ci < cinfo->num_components; ci++) { + fullsize_image[ci] = (*cinfo->emethods->request_big_sarray) + (fullsize_width, + jround_up(cinfo->image_height, (long) rows_in_mem), + (long) rows_in_mem); + } + /* Also get an area for pointers to currently accessible chunks */ + fullsize_ptrs = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(JSAMPARRAY)); + + /* Tell the memory manager to instantiate big arrays */ + (*cinfo->emethods->alloc_big_arrays) + /* extra sarray space is for subsampled-data buffers: */ + ((long) (fullsize_width /* max width in samples */ + * cinfo->max_v_samp_factor*(DCTSIZE+2) /* max height */ + * cinfo->num_components), /* max components per scan */ + /* extra barray space is for MCU-row buffers: */ + (long) ((fullsize_width / DCTSIZE) /* max width in blocks */ + * cinfo->max_v_samp_factor /* max height */ + * cinfo->num_components /* max components per scan */ + * (cinfo->do_block_smoothing ? 4 : 1)),/* how many of these we need */ + /* no extra "medium"-object space */ + /* NB: quantizer must get any such objects at color_quant_init time */ + (long) 0); + + + /* Loop over scans in file */ + + do { + + /* Prepare for this scan */ + if (cinfo->comps_in_scan == 1) { + noninterleaved_scan_setup(cinfo); + /* Need to read Vk MCU rows to obtain Vk block rows */ + mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; + } else { + interleaved_scan_setup(cinfo); + /* in an interleaved scan, one MCU row provides Vk block rows */ + mcu_rows_per_loop = 1; + } + + /* Allocate scan-local working memory */ + /* coeff_data holds a single MCU row of coefficient blocks */ + coeff_data = alloc_MCU_row(cinfo); + /* if doing cross-block smoothing, need extra space for its input */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + bsmooth[0] = alloc_MCU_row(cinfo); + bsmooth[1] = alloc_MCU_row(cinfo); + bsmooth[2] = alloc_MCU_row(cinfo); + } +#endif + /* subsampled_data is sample data before unsubsampling */ + alloc_sampling_buffer(cinfo, subsampled_data); + + /* line up the big buffers */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_image[cinfo->cur_comp_info[ci]->component_index], + (long) 0, TRUE); + } + + /* Initialize to read scan data */ + + (*cinfo->methods->entropy_decoder_init) (cinfo); + (*cinfo->methods->unsubsample_init) (cinfo); + (*cinfo->methods->disassemble_init) (cinfo); + + /* Loop over scan's data: rows_in_mem pixel rows are processed per loop */ + + pixel_rows_output = 0; + whichss = 1; /* arrange to start with subsampled_data[0] */ + + for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; + cur_mcu_row += mcu_rows_per_loop) { + whichss ^= 1; /* switch to other subsample buffer */ + + /* Obtain v_samp_factor block rows of each component in the scan. */ + /* This is a single MCU row if interleaved, multiple MCU rows if not. */ + /* In the noninterleaved case there might be fewer than v_samp_factor */ + /* block rows remaining; if so, pad with copies of the last pixel row */ + /* so that unsubsampling doesn't have to treat it as a special case. */ + + for (ri = 0; ri < mcu_rows_per_loop; ri++) { + if (cur_mcu_row + ri < cinfo->MCU_rows_in_scan) { + /* OK to actually read an MCU row. */ +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) + get_smoothed_row(cinfo, coeff_data, + bsmooth, &whichb, cur_mcu_row + ri); + else +#endif + (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); + + reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], + ri * DCTSIZE); + } else { + /* Need to pad out with copies of the last subsampled row. */ + /* This can only happen if there is just one component. */ + duplicate_row(subsampled_data[whichss][0], + cinfo->cur_comp_info[0]->subsampled_width, + ri * DCTSIZE - 1, DCTSIZE); + } + } + + /* Unsubsample the data */ + /* First time through is a special case */ + + if (cur_mcu_row) { + /* Expand last row group of previous set */ + expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, + (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, + (short) (DCTSIZE-1)); + /* Realign the big buffers */ + pixel_rows_output += rows_in_mem; + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_image[cinfo->cur_comp_info[ci]->component_index], + pixel_rows_output, TRUE); + } + /* Expand first row group of this set */ + expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, + (short) (DCTSIZE+1), (short) 0, (short) 1, + (short) 0); + } else { + /* Expand first row group with dummy above-context */ + expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, + (short) (-1), (short) 0, (short) 1, + (short) 0); + } + /* Expand second through next-to-last row groups of this set */ + for (i = 1; i <= DCTSIZE-2; i++) { + expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, + (short) (i-1), (short) i, (short) (i+1), + (short) i); + } + } /* end of outer loop */ + + /* Expand the last row group with dummy below-context */ + /* Note whichss points to last buffer side used */ + expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, + (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), + (short) (DCTSIZE-1)); + + /* Clean up after the scan */ + (*cinfo->methods->disassemble_term) (cinfo); + (*cinfo->methods->unsubsample_term) (cinfo); + (*cinfo->methods->entropy_decoder_term) (cinfo); + (*cinfo->methods->read_scan_trailer) (cinfo); + + /* Release scan-local working memory */ + free_MCU_row(cinfo, coeff_data); +#ifdef BLOCK_SMOOTHING_SUPPORTED + if (cinfo->do_block_smoothing) { + free_MCU_row(cinfo, bsmooth[0]); + free_MCU_row(cinfo, bsmooth[1]); + free_MCU_row(cinfo, bsmooth[2]); + } +#endif + free_sampling_buffer(cinfo, subsampled_data); + + /* Repeat if there is another scan */ + } while ((*cinfo->methods->read_scan_header) (cinfo)); + + /* Now that we've collected all the data, color convert & output it. */ + + for (pixel_rows_output = 0; pixel_rows_output < cinfo->image_height; + pixel_rows_output += rows_in_mem) { + + /* realign the big buffers */ + for (ci = 0; ci < cinfo->num_components; ci++) { + fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_image[ci], pixel_rows_output, FALSE); + } + + emit_1pass (cinfo, + (int) MIN(rows_in_mem, cinfo->image_height-pixel_rows_output), + fullsize_ptrs, color_data); + } + + /* Release working memory */ + free_sampimage(cinfo, color_data, (int) cinfo->color_out_comps, + (long) rows_in_mem); + if (cinfo->quantize_colors) + (*cinfo->emethods->free_small_sarray) + (quantize_out, (long) rows_in_mem); + for (ci = 0; ci < cinfo->num_components; ci++) { + (*cinfo->emethods->free_big_sarray) (fullsize_image[ci]); + } + (*cinfo->emethods->free_small) ((void *) fullsize_image); + (*cinfo->emethods->free_small) ((void *) fullsize_ptrs); + + /* Close up shop */ + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_term) (cinfo); +} + +#endif /* MULTISCAN_FILES_SUPPORTED */ + + +/* + * Decompression pipeline controller used for multiple-scan files + * with 2-pass color quantization. + */ + +#ifdef MULTISCAN_FILES_SUPPORTED +#ifdef QUANT_2PASS_SUPPORTED + +METHODDEF void +multi_2quant_dcontroller (decompress_info_ptr cinfo) +{ + ERREXIT(cinfo->emethods, "Not implemented yet"); +} + +#endif /* QUANT_2PASS_SUPPORTED */ +#endif /* MULTISCAN_FILES_SUPPORTED */ + + +/* + * The method selection routine for decompression pipeline controllers. + * Note that at this point we've already read the JPEG header and first SOS, + * so we can tell whether the input is one scan or not. + */ + +GLOBAL void +jseldpipeline (decompress_info_ptr cinfo) +{ + /* simplify subsequent tests on color quantization */ + if (! cinfo->quantize_colors) + cinfo->two_pass_quantize = FALSE; + + if (cinfo->comps_in_scan == cinfo->num_components) { + /* It's a single-scan file */ +#ifdef QUANT_2PASS_SUPPORTED + if (cinfo->two_pass_quantize) + cinfo->methods->d_pipeline_controller = single_2quant_dcontroller; + else +#endif + cinfo->methods->d_pipeline_controller = single_dcontroller; + } else { + /* It's a multiple-scan file */ +#ifdef MULTISCAN_FILES_SUPPORTED +#ifdef QUANT_2PASS_SUPPORTED + if (cinfo->two_pass_quantize) + cinfo->methods->d_pipeline_controller = multi_2quant_dcontroller; + else +#endif + cinfo->methods->d_pipeline_controller = multi_dcontroller; +#else + ERREXIT(cinfo->emethods, "Multiple-scan support was not compiled"); +#endif + } +} diff --git a/jdsample.c b/jdsample.c new file mode 100644 index 00000000..15dbf4f8 --- /dev/null +++ b/jdsample.c @@ -0,0 +1,133 @@ +/* + * jdsample.c + * + * Copyright (C) 1991, 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. + * + * This file contains un-subsampling routines. + * These routines are invoked via the unsubsample and + * unsubsample_init/term methods. + */ + +#include "jinclude.h" + + +/* + * Initialize for un-subsampling a scan. + */ + +METHODDEF void +unsubsample_init (decompress_info_ptr cinfo) +{ + /* no work for now */ +} + + +/* + * Un-subsample pixel values of a single component. + * This version only handles integral sampling ratios. + */ + +METHODDEF void +unsubsample (decompress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) +{ + jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; + short h_expand, v_expand, h, v; + int inrow, outrow; + long incol; + JSAMPROW inptr, outptr; + JSAMPLE invalue; + + /* TEMP FOR DEBUGGING PIPELINE CONTROLLER */ + if (input_rows != compptr->v_samp_factor || + output_rows != cinfo->max_v_samp_factor || + (input_cols % compptr->h_samp_factor) != 0 || + (output_cols % cinfo->max_h_samp_factor) != 0 || + output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor) + ERREXIT(cinfo->emethods, "Bogus unsubsample parameters"); + + h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; + v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; + + outrow = 0; + for (inrow = 0; inrow < input_rows; inrow++) { + for (v = 0; v < v_expand; v++) { + inptr = input_data[inrow]; + outptr = output_data[outrow++]; + for (incol = 0; incol < input_cols; incol++) { + invalue = GETJSAMPLE(*inptr++); + for (h = 0; h < h_expand; h++) { + *outptr++ = invalue; + } + } + } + } +} + + +/* + * Un-subsample pixel values of a single component. + * This version handles the special case of a full-size component. + */ + +METHODDEF void +fullsize_unsubsample (decompress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) +{ + if (input_cols != output_cols || input_rows != output_rows) /* DEBUG */ + ERREXIT(cinfo->emethods, "Pipeline controller messed up"); + + jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols); +} + + + +/* + * Clean up after a scan. + */ + +METHODDEF void +unsubsample_term (decompress_info_ptr cinfo) +{ + /* no work for now */ +} + + + +/* + * The method selection routine for unsubsampling. + * Note that we must select a routine for each component. + */ + +GLOBAL void +jselunsubsample (decompress_info_ptr cinfo) +{ + short ci; + jpeg_component_info * compptr; + + if (cinfo->CCIR601_sampling) + ERREXIT(cinfo->emethods, "CCIR601 subsampling not implemented yet"); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) + cinfo->methods->unsubsample[ci] = fullsize_unsubsample; + else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) + cinfo->methods->unsubsample[ci] = unsubsample; + else + ERREXIT(cinfo->emethods, "Fractional subsampling not implemented yet"); + } + + cinfo->methods->unsubsample_init = unsubsample_init; + cinfo->methods->unsubsample_term = unsubsample_term; +} diff --git a/jerror.c b/jerror.c new file mode 100644 index 00000000..591b1850 --- /dev/null +++ b/jerror.c @@ -0,0 +1,67 @@ +/* + * jerror.c + * + * Copyright (C) 1991, 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. + * + * This file contains simple error-reporting and trace-message routines. + * These are suitable for Unix-like systems and others where writing to + * stderr is the right thing to do. If the JPEG software is integrated + * into a larger application, you may well need to replace these. + * + * The error_exit() routine should not return to its caller. Within a + * larger application, you might want to have it do a longjmp() to return + * control to the outer user interface routine. This should work since + * the portable JPEG code doesn't use setjmp/longjmp. However, this won't + * release allocated memory or close temp files --- some bookkeeping would + * need to be added to the memory manager module to make that work. + * + * These routines are used by both the compression and decompression code. + */ + +#include "jinclude.h" +#ifdef __STDC__ +#include /* to declare exit() */ +#endif + + +static external_methods_ptr methods; /* saved for access to message_parm */ + + +METHODDEF void +trace_message (char *msgtext) +{ + fprintf(stderr, msgtext, + methods->message_parm[0], methods->message_parm[1], + methods->message_parm[2], methods->message_parm[3], + methods->message_parm[4], methods->message_parm[5], + methods->message_parm[6], methods->message_parm[7]); + fprintf(stderr, "\n"); +} + + +METHODDEF void +error_exit (char *msgtext) +{ + trace_message(msgtext); + exit(1); +} + + +/* + * The method selection routine for simple error handling. + * The system-dependent setup routine should call this routine + * to install the necessary method pointers in the supplied struct. + */ + +GLOBAL void +jselerror (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for msg parm access */ + + emethods->error_exit = error_exit; + emethods->trace_message = trace_message; + + emethods->trace_level = 0; /* default = no tracing */ +} diff --git a/jfwddct.c b/jfwddct.c new file mode 100644 index 00000000..58291ac9 --- /dev/null +++ b/jfwddct.c @@ -0,0 +1,179 @@ +/* + * jfwddct.c + * + * Copyright (C) 1991, 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. + * + * This file contains the basic DCT (Discrete Cosine Transform) + * transformation subroutine. + * + * This implementation is based on Appendix A.2 of the book + * "Discrete Cosine Transform---Algorithms, Advantages, Applications" + * by K.R. Rao and P. Yip (Academic Press, Inc, London, 1990). + * It uses scaled fixed-point arithmetic instead of floating point. + */ + +#include "jinclude.h" + + +/* The poop on this scaling stuff is as follows: + * + * Most of the numbers (after multiplication by the constants) are + * (logically) shifted left by LG2_DCT_SCALE. This is undone by UNFIXH + * before assignment to the output array. Note that we want an additional + * division by 2 on the output (required by the equations). + * + * If right shifts are unsigned, then there is a potential problem. + * However, shifting right by 16 and then assigning to a short + * (assuming short = 16 bits) will keep the sign right!! + * + * For other shifts, + * + * ((x + (1 << 30)) >> shft) - (1 << (30 - shft)) + * + * gives a nice right shift with sign (assuming no overflow). However, all the + * scaling is such that this isn't a problem. (Is this true?) + */ + + +#define ONE 1L /* remove L if long > 32 bits */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define LG2_DCT_SCALE 15 +#define RIGHT_SHIFT(_x,_shft) ((((_x) + (ONE << 30)) >> (_shft)) - (ONE << (30 - (_shft)))) +#else +#define LG2_DCT_SCALE 16 +#define RIGHT_SHIFT(_x,_shft) ((_x) >> (_shft)) +#endif + +#define DCT_SCALE (ONE << LG2_DCT_SCALE) + +#define LG2_OVERSCALE 2 +#define OVERSCALE (ONE << LG2_OVERSCALE) + +#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) +#define FIXO(x) ((INT32) ((x) * DCT_SCALE / OVERSCALE + 0.5)) +#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) +#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) +#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)), LG2_DCT_SCALE-LG2_OVERSCALE) +#define OVERSH(x) ((x) << LG2_OVERSCALE) + +#define SIN_1_4 FIX(0.7071067811856476) +#define COS_1_4 SIN_1_4 + +#define SIN_1_8 FIX(0.3826834323650898) +#define COS_1_8 FIX(0.9238795325112870) +#define SIN_3_8 COS_1_8 +#define COS_3_8 SIN_1_8 + +#define SIN_1_16 FIX(0.1950903220161282) +#define COS_1_16 FIX(0.9807852804032300) +#define SIN_7_16 COS_1_16 +#define COS_7_16 SIN_1_16 + +#define SIN_3_16 FIX(0.5555702330196022) +#define COS_3_16 FIX(0.8314696123025450) +#define SIN_5_16 COS_3_16 +#define COS_5_16 SIN_3_16 + +#define OSIN_1_4 FIXO(0.707106781185647) +#define OCOS_1_4 OSIN_1_4 + +#define OSIN_1_8 FIXO(0.3826834323650898) +#define OCOS_1_8 FIXO(0.9238795325112870) +#define OSIN_3_8 OCOS_1_8 +#define OCOS_3_8 OSIN_1_8 + +#define OSIN_1_16 FIXO(0.1950903220161282) +#define OCOS_1_16 FIXO(0.9807852804032300) +#define OSIN_7_16 OCOS_1_16 +#define OCOS_7_16 OSIN_1_16 + +#define OSIN_3_16 FIXO(0.5555702330196022) +#define OCOS_3_16 FIXO(0.8314696123025450) +#define OSIN_5_16 OCOS_3_16 +#define OCOS_5_16 OSIN_3_16 + + +INLINE +LOCAL void +fast_dct_8 (DCTELEM *in, int stride) +{ + /* tmp1x are new values of tmpx -- flashy register colourers + * should be able to do this lot very well + */ + INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17; + INT32 tmp25, tmp26; + INT32 in0, in1, in2, in3, in4, in5, in6, in7; + + in0 = in[ 0]; + in1 = in[stride ]; + in2 = in[stride*2]; + in3 = in[stride*3]; + in4 = in[stride*4]; + in5 = in[stride*5]; + in6 = in[stride*6]; + in7 = in[stride*7]; + + tmp0 = in7 + in0; + tmp1 = in6 + in1; + tmp2 = in5 + in2; + tmp3 = in4 + in3; + tmp4 = in3 - in4; + tmp5 = in2 - in5; + tmp6 = in1 - in6; + tmp7 = in0 - in7; + + tmp10 = tmp3 + tmp0 ; + tmp11 = tmp2 + tmp1 ; + tmp12 = tmp1 - tmp2 ; + tmp13 = tmp0 - tmp3 ; + + /* Now using tmp10, tmp11, tmp12, tmp13 */ + + in[ 0] = UNFIXH((tmp10 + tmp11) * SIN_1_4); + in[stride*4] = UNFIXH((tmp10 - tmp11) * COS_1_4); + + in[stride*2] = UNFIXH(tmp13*COS_1_8 + tmp12*SIN_1_8); + in[stride*6] = UNFIXH(tmp13*SIN_1_8 - tmp12*COS_1_8); + + tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); + tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); + + /* Now using tmp10, tmp11, tmp13, tmp14, tmp15, tmp16 */ + + tmp14 = OVERSH(tmp4) + tmp15; + tmp25 = OVERSH(tmp4) - tmp15; + tmp26 = OVERSH(tmp7) - tmp16; + tmp17 = OVERSH(tmp7) + tmp16; + + /* These are now overscaled by OVERSCALE */ + + /* tmp10, tmp11, tmp12, tmp13, tmp14, tmp25, tmp26, tmp17 */ + + in[stride ] = UNFIXH(tmp17*OCOS_1_16 + tmp14*OSIN_1_16); + in[stride*7] = UNFIXH(tmp17*OCOS_7_16 - tmp14*OSIN_7_16); + in[stride*5] = UNFIXH(tmp26*OCOS_5_16 + tmp25*OSIN_5_16); + in[stride*3] = UNFIXH(tmp26*OCOS_3_16 - tmp25*OSIN_3_16); +} + + +/* + * Perform the forward DCT on one block of samples. + * + * Note that this code is specialized to the case DCTSIZE = 8. + */ + +GLOBAL void +j_fwd_dct (DCTBLOCK data) +{ + int i; + + for (i = 0; i < DCTSIZE; i++) + fast_dct_8(data+i*DCTSIZE, 1); + + for (i = 0; i < DCTSIZE; i++) + fast_dct_8(data+i, DCTSIZE); +} diff --git a/jinclude.h b/jinclude.h new file mode 100644 index 00000000..ec7a7e8f --- /dev/null +++ b/jinclude.h @@ -0,0 +1,73 @@ +/* + * jinclude.h + * + * Copyright (C) 1991, 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. + * + * This is the central file that's #include'd by all the JPEG .c files. + * Its purpose is to provide a single place to fix any problems with + * including the wrong system include files. + * You can edit these declarations if you use a system with nonstandard + * system include files. + */ + + +/* + * is included to get the FILE typedef and NULL macro. + * Note that the core portable-JPEG files do not actually do any I/O + * using the stdio library; only the user interface, error handler, + * and file reading/writing modules invoke any stdio functions. + * (Well, we did cheat a bit in jvirtmem.c, but only if MEM_STATS is defined.) + */ + +#include + +/* + * We need the size_t typedef, which defines the parameter type of malloc(). + * In an ANSI-conforming implementation this is provided by , + * but on non-ANSI systems it's more likely to be in . + */ + +#ifndef __STDC__ /* shouldn't need this if __STDC__ */ +#include +#endif + +/* + * In ANSI C, and indeed any rational implementation, size_t is also the + * type returned by sizeof(). However, it seems there are some irrational + * implementations out there, in which sizeof() returns an int even though + * size_t is defined as long or unsigned long. To ensure consistent results + * we always use this SIZEOF() macro in place of using sizeof() directly. + */ + +#define SIZEOF(object) ((size_t) sizeof(object)) + +/* + * We need the memcpy() and strcmp() functions, plus memory zeroing. + * ANSI and System V implementations declare these in . + * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). + * NOTE: we assume the size parameters to these functions are of type size_t. + * Insert casts in these macros if not! + */ + +#ifdef __STDC__ +#include +#define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) +#else /* not STDC */ +#ifdef BSD +#include +#define MEMZERO(voidptr,size) bzero((voidptr), (size)) +#define memcpy(dest,src,size) bcopy((src), (dest), (size)) +#else /* not BSD, assume Sys V or compatible */ +#include +#define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) +#endif /* BSD */ +#endif /* STDC */ + + +/* Now include the portable JPEG definition files. */ + +#include "jconfig.h" + +#include "jpegdata.h" diff --git a/jpegdata.h b/jpegdata.h new file mode 100644 index 00000000..3e4d7533 --- /dev/null +++ b/jpegdata.h @@ -0,0 +1,812 @@ +/* + * jpegdata.h + * + * Copyright (C) 1991, 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. + * + * This file defines shared data structures for the various JPEG modules. + */ + + +/* + * You might need to change some of the following declarations if you are + * using the JPEG software within a surrounding application program + * or porting it to an unusual system. + */ + + +/* If the source or destination of image data is not to be stdio streams, + * these types may need work. You can replace them with some kind of + * pointer or indicator that is useful to you, or just ignore 'em. + * Note that the user interface and the various jrdxxx/jwrxxx modules + * will also need work for non-stdio input/output. + */ + +typedef FILE * JFILEREF; /* source or dest of JPEG-compressed data */ + +typedef FILE * IFILEREF; /* source or dest of non-JPEG image data */ + + +/* These defines are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions, + * as is shown below for use with C++. Another application would be to make + * all functions global for use with code profilers that require it. + * NOTE: the C++ test does the right thing if you are reading this include + * file in a C++ application to link to JPEG code that's been compiled with a + * regular C compiler. I'm not sure it works if you try to compile the JPEG + * code with C++. + */ + +#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 */ +#ifdef __cplusplus +#define EXTERN extern "C" /* a reference to a GLOBAL function */ +#else +#define EXTERN extern /* a reference to a GLOBAL function */ +#endif + + +/* Here is the pseudo-keyword for declaring pointers that must be "far" + * on 80x86 machines. Most of the specialized coding for 80x86 is handled + * by just saying "FAR *" where such a pointer is needed. In a few places + * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. + */ + +#ifdef NEED_FAR_POINTERS +#define FAR far +#else +#define FAR +#endif + + + +/* The remaining declarations are not system-dependent, we hope. */ + + +/* + * NOTE: if you have an ancient, strict-K&R C compiler, it may choke on the + * similarly-named fields in compress_info_struct and decompress_info_struct. + * If this happens, you can get around it by rearranging the two structs so + * that the similarly-named fields appear first and in the same order in + * each struct. Since such compilers are now pretty rare, we haven't done + * this in the portable code, preferring to maintain a logical ordering. + */ + + + +/* 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 PROTO +#define METHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define METHOD(type,methodname,arglist) type (*methodname) () +#endif + +/* Forward references to lists of method pointers */ +typedef struct external_methods_struct * external_methods_ptr; +typedef struct compress_methods_struct * compress_methods_ptr; +typedef struct decompress_methods_struct * decompress_methods_ptr; + + +/* Data structures for images containing either samples or coefficients. */ +/* Note that the topmost (leftmost) index is always color component. */ +/* On 80x86 machines, the image arrays are too big for near pointers, */ +/* but the pointer arrays can fit in near memory. */ + +typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + + +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ + + +/* The input and output data of the DCT transform subroutines are of + * the following type, which need not be the same as JCOEF. + * For example, on a machine with fast floating point, it might make sense + * to recode the DCT routines to use floating point; then DCTELEM would be + * 'float' or 'double'. + */ + +typedef JCOEF DCTELEM; +typedef DCTELEM DCTBLOCK[DCTSIZE2]; + + +/* Types for JPEG compression parameters and working tables. */ + + +typedef enum { /* defines known color spaces */ + CS_UNKNOWN, /* error/unspecified */ + CS_GRAYSCALE, /* monochrome (only 1 component) */ + CS_RGB, /* red/green/blue */ + CS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + CS_YIQ, /* Y/I/Q */ + CS_CMYK /* C/M/Y/K */ +} COLOR_SPACE; + + +typedef struct { /* Basic info about one component */ + /* These values are fixed over the whole image */ + /* For compression, they must be supplied by the user interface; */ + /* for decompression, they are read from the SOF marker. */ + short component_id; /* identifier for this component (0..255) */ + short component_index; /* its index in SOF or cinfo->comp_info[] */ + short h_samp_factor; /* horizontal sampling factor (1..4) */ + short v_samp_factor; /* vertical sampling factor (1..4) */ + short quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans */ + /* For compression, they must be supplied by the user interface; */ + /* for decompression, they are read from the SOS marker. */ + short dc_tbl_no; /* DC entropy table selector (0..3) */ + short ac_tbl_no; /* AC entropy table selector (0..3) */ + /* These values are computed during compression or decompression startup */ + long true_comp_width; /* component's image width in samples */ + long true_comp_height; /* component's image height in samples */ + /* the above are the logical dimensions of the subsampled image */ + /* These values are computed before starting a scan of the component */ + short MCU_width; /* number of blocks per MCU, horizontally */ + short MCU_height; /* number of blocks per MCU, vertically */ + short MCU_blocks; /* MCU_width * MCU_height */ + long subsampled_width; /* image width in samples, after expansion */ + long subsampled_height; /* image height in samples, after expansion */ + /* the above are the true_comp_xxx values rounded up to multiples of */ + /* the MCU dimensions; these are the working dimensions of the array */ + /* as it is passed through the DCT or IDCT step. NOTE: these values */ + /* differ depending on whether the component is interleaved or not!! */ +} jpeg_component_info; + + +/* DCT coefficient quantization tables. + * For 8-bit precision, 'INT16' should be good enough for quantization values; + * for more precision, we go for the full 16 bits. 'INT16' provides a useful + * speedup on many machines (multiplication & division of JCOEFs by + * quantization values is a significant chunk of the runtime). + * Note: the values in a QUANT_TBL are always given in zigzag order. + */ +#ifdef EIGHT_BIT_SAMPLES +typedef INT16 QUANT_VAL; /* element of a quantization table */ +#else +typedef UINT16 QUANT_VAL; /* element of a quantization table */ +#endif +typedef QUANT_VAL QUANT_TBL[DCTSIZE2]; /* A quantization table */ +typedef QUANT_VAL * QUANT_TBL_PTR; /* pointer to same */ + + +typedef struct { /* A Huffman coding table */ + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + */ + boolean sent_table; /* TRUE when table has been output */ + /* The remaining fields are computed from the above to allow more efficient + * coding and decoding. These fields should be considered private to the + * Huffman compression & decompression modules. + */ + UINT16 ehufco[256]; /* code for each symbol */ + char ehufsi[256]; /* length of code for each symbol */ + UINT16 mincode[17]; /* smallest code of length k */ + INT32 maxcode[17]; /* largest code of length k (-1 if none) */ + short valptr[17]; /* huffval[] index of 1st symbol of length k */ +} HUFF_TBL; + + +#define NUM_QUANT_TBLS 4 /* quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +#define MAX_BLOCKS_IN_MCU 10 /* JPEG limit on # of blocks in an MCU */ + + +/* Working data for compression */ + +struct compress_info_struct { +/* + * All of these fields shall be established by the user interface before + * calling jpeg_compress, or by the input_init or c_ui_method_selection + * methods. + * Most parameters can be set to reasonable defaults by j_default_compression. + * Note that the UI must supply the storage for the main methods struct, + * though it sets only a few of the methods there. + */ + compress_methods_ptr methods; /* Points to list of methods to use */ + + external_methods_ptr emethods; /* Points to list of methods to use */ + + IFILEREF input_file; /* tells input routines where to read image */ + JFILEREF output_file; /* tells output routines where to write JPEG */ + + long image_width; /* input image width */ + long image_height; /* input image height */ + short input_components; /* # of color components in input image */ + + short data_precision; /* bits of precision in image data */ + + COLOR_SPACE in_color_space; /* colorspace of input file */ + COLOR_SPACE jpeg_color_space; /* colorspace of JPEG file */ + + double input_gamma; /* image gamma of input file */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + /* These three values are not used by the JPEG code, only copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + + short num_components; /* # of color components in JPEG image */ + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + QUANT_TBL_PTR quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + HUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + HUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arithmetic-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arithmetic-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arithmetic-coding tables */ + + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean interleave; /* TRUE=interleaved output, FALSE=not */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + UINT16 restart_interval;/* MDUs per restart interval, or 0 for no restart */ + +/* + * These fields are computed during jpeg_compress startup + */ + short max_h_samp_factor; /* largest h_samp_factor */ + short max_v_samp_factor; /* largest v_samp_factor */ + +/* + * These fields are valid during any one scan + */ + short comps_in_scan; /* # of JPEG components output this time */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + long MCUs_per_row; /* # of MCUs across the image */ + long MCU_rows_in_scan; /* # of MCU rows in the image */ + + short blocks_in_MCU; /* # of DCT blocks per MCU */ + short MCU_membership[MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + /* these fields are private data for the entropy encoder */ + JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */ + JCOEF last_dc_diff[MAX_COMPS_IN_SCAN]; /* last DC diff for each comp */ + UINT16 restarts_to_go; /* MDUs left in this restart interval */ + short next_restart_num; /* # of next RSTn marker (0..7) */ +}; + +typedef struct compress_info_struct * compress_info_ptr; + + +/* Working data for decompression */ + +struct decompress_info_struct { +/* + * These fields shall be established by the user interface before + * calling jpeg_decompress. Note that the UI must supply the storage for + * the main methods struct, though it sets only a few of the methods there. + */ + decompress_methods_ptr methods; /* Points to list of methods to use */ + + external_methods_ptr emethods; /* Points to list of methods to use */ + + JFILEREF input_file; /* tells input routines where to read JPEG */ + IFILEREF output_file; /* tells output routines where to write image */ + + /* these can be set at d_ui_method_selection time: */ + + COLOR_SPACE out_color_space; /* colorspace of output */ + + double output_gamma; /* image gamma wanted in output */ + + boolean quantize_colors; /* T if output is a colormapped format */ + /* the following are ignored if not quantize_colors: */ + boolean two_pass_quantize; /* use two-pass color quantization? */ + boolean use_dithering; /* want color dithering? */ + int desired_number_of_colors; /* number of colors to use */ + + boolean do_block_smoothing; /* T = apply cross-block smoothing */ + boolean do_pixel_smoothing; /* T = apply post-subsampling smoothing */ + +/* + * These fields are used for efficient buffering of data between read_jpeg_data + * and the entropy decoding object. By using a shared buffer, we avoid copying + * data and eliminate the need for an "unget" operation at the end of a scan. + * The actual source of the data is known only to read_jpeg_data; see the + * JGETC macro, below. + * Note: the user interface is expected to allocate the input_buffer and + * initialize bytes_in_buffer to 0. Also, for JFIF/raw-JPEG input, the UI + * actually supplies the read_jpeg_data method. + */ + char * input_buffer; /* start of buffer (private to input code) */ + char * next_input_byte; /* => next byte to read from buffer */ + int bytes_in_buffer; /* # of bytes remaining in buffer */ + +/* + * These fields are set by read_file_header or read_scan_header + */ + long image_width; /* overall image width */ + long image_height; /* overall image height */ + + short data_precision; /* bits of precision in image data */ + + COLOR_SPACE jpeg_color_space; /* colorspace of JPEG file */ + + /* These three values are not used by the JPEG code, merely copied */ + /* from the JFIF APP0 marker (if any). */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + + short num_components; /* # of color components in JPEG image */ + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + QUANT_TBL_PTR quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + HUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + HUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + UINT16 restart_interval;/* MDUs per restart interval, or 0 for no restart */ + +/* + * These fields are computed during jpeg_decompress startup + */ + short max_h_samp_factor; /* largest h_samp_factor */ + short max_v_samp_factor; /* largest v_samp_factor */ + + short color_out_comps; /* # of color components output by color_convert */ + /* (need not match num_components) */ + short final_out_comps; /* # of color components in output image */ + /* (1 when quantizing colors, else same as color_out_comps) */ + +/* + * These fields are valid during any one scan + */ + short comps_in_scan; /* # of JPEG components input this time */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + long MCUs_per_row; /* # of MCUs across the image */ + long MCU_rows_in_scan; /* # of MCU rows in the image */ + + short blocks_in_MCU; /* # of DCT blocks per MCU */ + short MCU_membership[MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + /* these fields are private data for the entropy encoder */ + JCOEF last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each comp */ + JCOEF last_dc_diff[MAX_COMPS_IN_SCAN]; /* last DC diff for each comp */ + UINT16 restarts_to_go; /* MDUs left in this restart interval */ + short next_restart_num; /* # of next RSTn marker (0..7) */ +}; + +typedef struct decompress_info_struct * decompress_info_ptr; + + +/* Macros for reading data from the decompression input buffer */ + +#ifdef CHAR_IS_UNSIGNED +#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \ + (*(cinfo)->methods->read_jpeg_data) (cinfo) : \ + (int) *(cinfo)->next_input_byte++ ) +#else +#define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \ + (*(cinfo)->methods->read_jpeg_data) (cinfo) : \ + (int) (*(cinfo)->next_input_byte++) & 0xFF ) +#endif + +#define JUNGETC(ch,cinfo) ((cinfo)->bytes_in_buffer++, \ + *(--((cinfo)->next_input_byte)) = (ch)) + +#define MIN_UNGET 2 /* may always do at least 2 JUNGETCs */ + + +/* A virtual image has a control block whose contents are private to the + * memory manager module (and may differ between managers). The rest of the + * code only refers to virtual images by these pointer types. + */ + +typedef struct big_sarray_control * big_sarray_ptr; +typedef struct big_barray_control * big_barray_ptr; + + +/* Method types that need typedefs */ + +typedef METHOD(void, MCU_output_method_ptr, (compress_info_ptr cinfo, + JBLOCK *MCU_data)); +typedef METHOD(void, MCU_output_caller_ptr, (compress_info_ptr cinfo, + MCU_output_method_ptr output_method)); +typedef METHOD(void, subsample_ptr, (compress_info_ptr cinfo, + int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, + JSAMPARRAY input_data, + JSAMPARRAY below, + JSAMPARRAY output_data)); +typedef METHOD(void, unsubsample_ptr, (decompress_info_ptr cinfo, + int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, + JSAMPARRAY input_data, + JSAMPARRAY below, + JSAMPARRAY output_data)); +typedef METHOD(void, quantize_method_ptr, (decompress_info_ptr cinfo, + int num_rows, + JSAMPIMAGE input_data, + JSAMPARRAY output_workspace)); +typedef METHOD(void, quantize_caller_ptr, (decompress_info_ptr cinfo, + quantize_method_ptr quantize_method)); + + +/* These structs contain function pointers for the various JPEG methods. */ + +/* Routines to be provided by the surrounding application, rather than the + * portable JPEG code proper. These are the same for compression and + * decompression. + */ + +struct external_methods_struct { + /* User interface: error exit and trace message routines */ + /* NOTE: the string msgtext parameters will eventually be replaced */ + /* by an enumerated-type code so that non-English error messages */ + /* can be substituted easily. This will not be done until all the */ + /* code is in place, so that we know what messages are needed. */ + METHOD(void, error_exit, (char *msgtext)); + METHOD(void, trace_message, (char *msgtext)); + + /* Working data for error/trace facility */ + /* See macros below for the usage of these variables */ + int trace_level; /* level of detail of tracing messages */ + /* Use level 0 for unsuppressable messages (nonfatal errors) */ + /* Use levels 1, 2, 3 for successively more detailed trace options */ + + int message_parm[8]; /* store numeric parms for messages here */ + + /* Memory management */ + /* NB: alloc routines never return NULL. They exit to */ + /* error_exit if not successful. */ + METHOD(void *, alloc_small, (size_t sizeofobject)); + METHOD(void, free_small, (void *ptr)); +#ifdef NEED_FAR_POINTERS /* routines for getting far-heap space */ + METHOD(void FAR *, alloc_medium, (size_t sizeofobject)); + METHOD(void, free_medium, (void FAR *ptr)); +#else +#define alloc_medium alloc_small +#define free_medium free_small +#endif + METHOD(JSAMPARRAY, alloc_small_sarray, (long samplesperrow, + long numrows)); + METHOD(void, free_small_sarray, (JSAMPARRAY ptr, + long numrows)); + METHOD(JBLOCKARRAY, alloc_small_barray, (long blocksperrow, + long numrows)); + METHOD(void, free_small_barray, (JBLOCKARRAY ptr, + long numrows)); + METHOD(big_sarray_ptr, request_big_sarray, (long samplesperrow, + long numrows, + long unitheight)); + METHOD(big_barray_ptr, request_big_barray, (long blocksperrow, + long numrows, + long unitheight)); + METHOD(void, alloc_big_arrays, (long extra_small_samples, + long extra_small_blocks, + long extra_medium_space)); + METHOD(JSAMPARRAY, access_big_sarray, (big_sarray_ptr ptr, + long start_row, + boolean writable)); + METHOD(JBLOCKARRAY, access_big_barray, (big_barray_ptr ptr, + long start_row, + boolean writable)); + METHOD(void, free_big_sarray, (big_sarray_ptr ptr)); + METHOD(void, free_big_barray, (big_barray_ptr ptr)); +}; + +/* Macros to simplify using the error and trace message stuff */ +/* The first parameter is generally cinfo->emethods */ + +#define ERREXIT(emeth,msg) ((*(emeth)->error_exit) (msg)) +#define ERREXIT1(emeth,msg,p1) ((emeth)->message_parm[0] = (p1), \ + (*(emeth)->error_exit) (msg)) +#define ERREXIT2(emeth,msg,p1,p2) ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (*(emeth)->error_exit) (msg)) +#define ERREXIT3(emeth,msg,p1,p2,p3) ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (emeth)->message_parm[2] = (p3), \ + (*(emeth)->error_exit) (msg)) +#define ERREXIT4(emeth,msg,p1,p2,p3,p4) ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (emeth)->message_parm[2] = (p3), \ + (emeth)->message_parm[3] = (p4), \ + (*(emeth)->error_exit) (msg)) + +#define TRACEMS(emeth,lvl,msg) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((*(emeth)->trace_message) (msg), 0) : 0) +#define TRACEMS1(emeth,lvl,msg,p1) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((emeth)->message_parm[0] = (p1), \ + (*(emeth)->trace_message) (msg), 0) : 0) +#define TRACEMS2(emeth,lvl,msg,p1,p2) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (*(emeth)->trace_message) (msg), 0) : 0) +#define TRACEMS3(emeth,lvl,msg,p1,p2,p3) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (emeth)->message_parm[2] = (p3), \ + (*(emeth)->trace_message) (msg), 0) : 0) +#define TRACEMS4(emeth,lvl,msg,p1,p2,p3,p4) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (emeth)->message_parm[2] = (p3), \ + (emeth)->message_parm[3] = (p4), \ + (*(emeth)->trace_message) (msg), 0) : 0) +#define TRACEMS8(emeth,lvl,msg,p1,p2,p3,p4,p5,p6,p7,p8) \ + ( (emeth)->trace_level >= (lvl) ? \ + ((emeth)->message_parm[0] = (p1), \ + (emeth)->message_parm[1] = (p2), \ + (emeth)->message_parm[2] = (p3), \ + (emeth)->message_parm[3] = (p4), \ + (emeth)->message_parm[4] = (p5), \ + (emeth)->message_parm[5] = (p6), \ + (emeth)->message_parm[6] = (p7), \ + (emeth)->message_parm[7] = (p8), \ + (*(emeth)->trace_message) (msg), 0) : 0) + + +/* Methods used during JPEG compression. */ + +struct compress_methods_struct { + /* Hook for user interface to get control after input_init */ + METHOD(void, c_ui_method_selection, (compress_info_ptr cinfo)); + /* Input image reading & conversion to standard form */ + METHOD(void, input_init, (compress_info_ptr cinfo)); + METHOD(void, get_input_row, (compress_info_ptr cinfo, + JSAMPARRAY pixel_row)); + METHOD(void, input_term, (compress_info_ptr cinfo)); + /* Gamma and color space conversion */ + METHOD(void, colorin_init, (compress_info_ptr cinfo)); + METHOD(void, get_sample_rows, (compress_info_ptr cinfo, + int rows_to_read, + JSAMPIMAGE image_data)); + METHOD(void, colorin_term, (compress_info_ptr cinfo)); + /* Expand picture data at edges */ + METHOD(void, edge_expand, (compress_info_ptr cinfo, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPIMAGE image_data)); + /* Subsample pixel values of a single component */ + /* There can be a different subsample method for each component */ + METHOD(void, subsample_init, (compress_info_ptr cinfo)); + subsample_ptr subsample[MAX_COMPS_IN_SCAN]; + METHOD(void, subsample_term, (compress_info_ptr cinfo)); + /* Extract samples in MCU order, process & hand off to output_method */ + /* The input is always exactly N MCU rows worth of data */ + METHOD(void, extract_init, (compress_info_ptr cinfo)); + METHOD(void, extract_MCUs, (compress_info_ptr cinfo, + JSAMPIMAGE image_data, + int num_mcu_rows, + MCU_output_method_ptr output_method)); + METHOD(void, extract_term, (compress_info_ptr cinfo)); + /* Entropy encoding parameter optimization */ + METHOD(void, entropy_optimize, (compress_info_ptr cinfo, + MCU_output_caller_ptr source_method)); + /* Entropy encoding */ + METHOD(void, entropy_encoder_init, (compress_info_ptr cinfo)); + METHOD(void, entropy_encode, (compress_info_ptr cinfo, + JBLOCK *MCU_data)); + METHOD(void, entropy_encoder_term, (compress_info_ptr cinfo)); + /* JPEG file header construction */ + METHOD(void, write_file_header, (compress_info_ptr cinfo)); + METHOD(void, write_scan_header, (compress_info_ptr cinfo)); + METHOD(void, write_jpeg_data, (compress_info_ptr cinfo, + char *dataptr, + int datacount)); + METHOD(void, write_scan_trailer, (compress_info_ptr cinfo)); + METHOD(void, write_file_trailer, (compress_info_ptr cinfo)); + /* Pipeline control */ + METHOD(void, c_pipeline_controller, (compress_info_ptr cinfo)); + METHOD(void, entropy_output, (compress_info_ptr cinfo, + char *dataptr, + int datacount)); + /* Overall control */ + METHOD(void, c_per_scan_method_selection, (compress_info_ptr cinfo)); +}; + +/* Methods used during JPEG decompression. */ + +struct decompress_methods_struct { + /* Hook for user interface to get control after reading file header */ + METHOD(void, d_ui_method_selection, (decompress_info_ptr cinfo)); + /* JPEG file scanning */ + /* Note: user interface supplies read_jpeg_data for JFIF/raw-JPEG + * reading. For file formats that require random access (eg, TIFF) + * the JPEG file header module will override the UI read_jpeg_data. + */ + METHOD(void, read_file_header, (decompress_info_ptr cinfo)); + METHOD(boolean, read_scan_header, (decompress_info_ptr cinfo)); + METHOD(int, read_jpeg_data, (decompress_info_ptr cinfo)); + METHOD(void, read_scan_trailer, (decompress_info_ptr cinfo)); + METHOD(void, read_file_trailer, (decompress_info_ptr cinfo)); + /* Entropy decoding */ + METHOD(void, entropy_decoder_init, (decompress_info_ptr cinfo)); + METHOD(void, entropy_decode, (decompress_info_ptr cinfo, + JBLOCK *MCU_data)); + METHOD(void, entropy_decoder_term, (decompress_info_ptr cinfo)); + /* MCU disassembly: fetch MCUs from entropy_decode, build coef array */ + METHOD(void, disassemble_init, (decompress_info_ptr cinfo)); + METHOD(void, disassemble_MCU, (decompress_info_ptr cinfo, + JBLOCKIMAGE image_data)); + METHOD(void, disassemble_term, (decompress_info_ptr cinfo)); + /* Cross-block smoothing */ + METHOD(void, smooth_coefficients, (decompress_info_ptr cinfo, + jpeg_component_info *compptr, + JBLOCKROW above, + JBLOCKROW currow, + JBLOCKROW below, + JBLOCKROW output)); + /* Un-subsample pixel values of a single component */ + /* There can be a different unsubsample method for each component */ + METHOD(void, unsubsample_init, (decompress_info_ptr cinfo)); + unsubsample_ptr unsubsample[MAX_COMPS_IN_SCAN]; + METHOD(void, unsubsample_term, (decompress_info_ptr cinfo)); + /* Gamma and color space conversion */ + METHOD(void, colorout_init, (decompress_info_ptr cinfo)); + METHOD(void, color_convert, (decompress_info_ptr cinfo, + int num_rows, + JSAMPIMAGE input_data, + JSAMPIMAGE output_data)); + METHOD(void, colorout_term, (decompress_info_ptr cinfo)); + /* Color quantization */ + METHOD(void, color_quant_init, (decompress_info_ptr cinfo)); + METHOD(void, color_quantize, (decompress_info_ptr cinfo, + int num_rows, + JSAMPIMAGE input_data, + JSAMPARRAY output_data)); + METHOD(void, color_quant_prescan, (decompress_info_ptr cinfo, + int num_rows, + JSAMPIMAGE image_data)); + METHOD(void, color_quant_doit, (decompress_info_ptr cinfo, + quantize_caller_ptr source_method)); + METHOD(void, color_quant_term, (decompress_info_ptr cinfo)); + /* Output image writing */ + METHOD(void, output_init, (decompress_info_ptr cinfo)); + METHOD(void, put_color_map, (decompress_info_ptr cinfo, + int num_colors, JSAMPARRAY colormap)); + METHOD(void, put_pixel_rows, (decompress_info_ptr cinfo, + int num_rows, + JSAMPIMAGE pixel_data)); + METHOD(void, output_term, (decompress_info_ptr cinfo)); + /* Pipeline control */ + METHOD(void, d_pipeline_controller, (decompress_info_ptr cinfo)); + /* Overall control */ + METHOD(void, d_per_scan_method_selection, (decompress_info_ptr cinfo)); +}; + + +/* External declarations for routines that aren't called via method ptrs. */ +/* Note: use "j" as first char of names to minimize namespace pollution. */ +/* The PP macro hides prototype parameters from compilers that can't cope. */ + +#ifdef PROTO +#define PP(arglist) arglist +#else +#define PP(arglist) () +#endif + + +/* main entry for compression */ +EXTERN void jpeg_compress PP((compress_info_ptr cinfo)); +/* default parameter setup for compression */ +EXTERN void j_default_compression PP((compress_info_ptr cinfo, int quality)); +EXTERN void j_monochrome_default PP((compress_info_ptr cinfo)); +EXTERN void j_set_quality PP((compress_info_ptr cinfo, int quality, + boolean force_baseline)); +EXTERN void j_free_defaults PP((compress_info_ptr cinfo)); + +/* main entry for decompression */ +EXTERN void jpeg_decompress PP((decompress_info_ptr cinfo)); + +/* forward DCT */ +EXTERN void j_fwd_dct PP((DCTBLOCK data)); +/* inverse DCT */ +EXTERN void j_rev_dct PP((DCTBLOCK data)); + +/* utility routines in jutils.c */ +EXTERN long jround_up PP((long a, long b)); +EXTERN void jcopy_sample_rows PP((JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, long num_cols)); +EXTERN void jcopy_block_row PP((JBLOCKROW input_row, JBLOCKROW output_row, + long num_blocks)); +EXTERN void jzero_far PP((void FAR * target, size_t bytestozero)); + +/* method selection routines for compression modules */ +EXTERN void jselcpipeline PP((compress_info_ptr cinfo)); /* jcpipe.c */ +EXTERN void jselchuffman PP((compress_info_ptr cinfo)); /* jchuff.c */ +EXTERN void jselcarithmetic PP((compress_info_ptr cinfo)); /* jcarith.c */ +EXTERN void jselexpand PP((compress_info_ptr cinfo)); /* jcexpand.c */ +EXTERN void jselsubsample PP((compress_info_ptr cinfo)); /* jcsample.c */ +EXTERN void jselcmcu PP((compress_info_ptr cinfo)); /* jcmcu.c */ +EXTERN void jselccolor PP((compress_info_ptr cinfo)); /* jccolor.c */ +/* The user interface should call one of these to select input format: */ +EXTERN void jselrgif PP((compress_info_ptr cinfo)); /* jrdgif.c */ +EXTERN void jselrppm PP((compress_info_ptr cinfo)); /* jrdppm.c */ +/* and one of these to select output header format: */ +EXTERN void jselwjfif PP((compress_info_ptr cinfo)); /* jwrjfif.c */ + +/* method selection routines for decompression modules */ +EXTERN void jseldpipeline PP((decompress_info_ptr cinfo)); /* jdpipe.c */ +EXTERN void jseldhuffman PP((decompress_info_ptr cinfo)); /* jdhuff.c */ +EXTERN void jseldarithmetic PP((decompress_info_ptr cinfo)); /* jdarith.c */ +EXTERN void jseldmcu PP((decompress_info_ptr cinfo)); /* jdmcu.c */ +EXTERN void jselbsmooth PP((decompress_info_ptr cinfo)); /* jbsmooth.c */ +EXTERN void jselunsubsample PP((decompress_info_ptr cinfo)); /* jdsample.c */ +EXTERN void jseldcolor PP((decompress_info_ptr cinfo)); /* jdcolor.c */ +EXTERN void jsel1quantize PP((decompress_info_ptr cinfo)); /* jquant1.c */ +EXTERN void jsel2quantize PP((decompress_info_ptr cinfo)); /* jquant2.c */ +/* The user interface should call one of these to select input format: */ +EXTERN void jselrjfif PP((decompress_info_ptr cinfo)); /* jrdjfif.c */ +/* and one of these to select output image format: */ +EXTERN void jselwgif PP((decompress_info_ptr cinfo)); /* jwrgif.c */ +EXTERN void jselwppm PP((decompress_info_ptr cinfo)); /* jwrppm.c */ + +/* method selection routines for system-dependent modules */ +EXTERN void jselerror PP((external_methods_ptr emethods)); /* jerror.c */ +EXTERN void jselvirtmem PP((external_methods_ptr emethods)); /* jvirtmem.c */ + +/* debugging hook in jvirtmem.c */ +#ifdef MEM_STATS +EXTERN void j_mem_stats PP((void)); +#endif + +/* Miscellaneous useful macros */ + +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + + +#define RST0 0xD0 /* RST0 marker code */ diff --git a/jquant1.c b/jquant1.c new file mode 100644 index 00000000..49dfd971 --- /dev/null +++ b/jquant1.c @@ -0,0 +1,387 @@ +/* + * jquant1.c + * + * Copyright (C) 1991, 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. + * + * This file contains 1-pass color quantization (color mapping) routines. + * These routines are invoked via the methods color_quantize + * and color_quant_init/term. + */ + +#include "jinclude.h" + +#ifdef QUANT_1PASS_SUPPORTED + + +/* + * This implementation is a fairly dumb, quick-and-dirty quantizer; + * it's here mostly so that we can start working on colormapped output formats. + * + * We quantize to a color map that is selected in advance of seeing the image; + * the map depends only on the requested number of colors (at least 8). + * The map consists of all combinations of Ncolors[j] color values for each + * component j; we choose Ncolors[] based on the requested # of colors. + * We always use 0 and MAXJSAMPLE in each color (hence the minimum 8 colors). + * Any additional color values are equally spaced between these limits. + * + * The result almost always needs dithering to look decent. + */ + +#define MAX_COMPONENTS 4 /* max components I can handle */ + +static int total_colors; /* Number of distinct output colors */ +static int Ncolors[MAX_COMPONENTS]; /* # of values alloced to each component */ +/* total_colors is the product of the Ncolors[] values */ + +static JSAMPARRAY colormap; /* The actual color map */ +/* colormap[i][j] = value of i'th color component for output pixel value j */ + +static JSAMPARRAY colorindex; /* Precomputed mapping for speed */ +/* colorindex[i][j] = index of color closest to pixel value j in component i, + * premultiplied so that the correct mapped value for a pixel (r,g,b) is: + * colorindex[0][r] + colorindex[1][g] + colorindex[2][b] + */ + + +/* Declarations for Floyd-Steinberg dithering. + * Errors are accumulated into the arrays evenrowerrs[] and oddrowerrs[], + * each of which have #colors * (#columns + 2) entries (so that first/last + * pixels need not be special cases). These have resolutions of 1/16th of + * a pixel count. The error at a given pixel is propagated to its unprocessed + * neighbors using the standard F-S fractions, + * ... (here) 7/16 + * 3/16 5/16 1/16 + * We work left-to-right on even rows, right-to-left on odd rows. + * + * Note: on a wide image, we might not have enough room in a PC's near data + * segment to hold the error arrays; so they are allocated with alloc_medium. + */ + +#ifdef EIGHT_BIT_SAMPLES +typedef short FSERROR; /* 16 bits should be enough */ +#else +typedef INT32 FSERROR; /* may need more than 16 bits? */ +#endif + +typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ + +static FSERRPTR evenrowerrs, oddrowerrs; /* current-row and next-row errors */ +static boolean on_odd_row; /* flag to remember which row we are on */ + + +/* + * Initialize for one-pass color quantization. + */ + +METHODDEF void +color_quant_init (decompress_info_ptr cinfo) +{ + int max_colors = cinfo->desired_number_of_colors; + int i,j,k, ntc, nci, blksize, blkdist, ptr, val; + + if (cinfo->color_out_comps > MAX_COMPONENTS) + ERREXIT1(cinfo->emethods, "Cannot quantize more than %d color components", + MAX_COMPONENTS); + if (max_colors > (MAXJSAMPLE+1)) + ERREXIT1(cinfo->emethods, "Cannot request more than %d quantized colors", + MAXJSAMPLE+1); + + /* Initialize to 2 color values for each component */ + total_colors = 1; + for (i = 0; i < cinfo->color_out_comps; i++) { + Ncolors[i] = 2; + total_colors *= 2; + } + if (total_colors > max_colors) + ERREXIT1(cinfo->emethods, "Cannot quantize to fewer than %d colors", + total_colors); + + /* Increase the number of color values until requested limit is reached. */ + /* Note that for standard RGB color space, we will have at least as many */ + /* red values as green, and at least as many green values as blue. */ + i = 0; /* component index to increase next */ + /* test calculates ntc = new total_colors if Ncolors[i] is incremented */ + while ((ntc = (total_colors / Ncolors[i]) * (Ncolors[i]+1)) <= max_colors) { + Ncolors[i]++; /* OK, apply the increment */ + total_colors = ntc; + i++; /* advance to next component */ + if (i >= cinfo->color_out_comps) i = 0; + } + + /* Report selected color counts */ + if (cinfo->color_out_comps == 3) + TRACEMS4(cinfo->emethods, 1, "Quantizing to %d = %d*%d*%d colors", + total_colors, Ncolors[0], Ncolors[1], Ncolors[2]); + else + TRACEMS1(cinfo->emethods, 1, "Quantizing to %d colors", total_colors); + + /* Allocate and fill in the colormap and color index. */ + /* The colors are ordered in the map in standard row-major order, */ + /* i.e. rightmost (highest-indexed) color changes most rapidly. */ + + colormap = (*cinfo->emethods->alloc_small_sarray) + ((long) total_colors, (long) cinfo->color_out_comps); + colorindex = (*cinfo->emethods->alloc_small_sarray) + ((long) (MAXJSAMPLE+1), (long) cinfo->color_out_comps); + + /* blksize is number of adjacent repeated entries for a component */ + /* blkdist is distance between groups of identical entries for a component */ + blkdist = total_colors; + + for (i = 0; i < cinfo->color_out_comps; i++) { + /* fill in colormap entries for i'th color component */ + nci = Ncolors[i]; /* # of distinct values for this color */ + blksize = blkdist / nci; + for (j = 0; j < nci; j++) { + val = (j * MAXJSAMPLE + (nci-1)/2) / (nci-1); /* j'th value of color */ + for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { + /* fill in blksize entries beginning at ptr */ + for (k = 0; k < blksize; k++) + colormap[i][ptr+k] = val; + } + } + blkdist = blksize; /* blksize of this color is blkdist of next */ + + /* fill in colorindex entries for i'th color component */ + for (j = 0; j <= MAXJSAMPLE; j++) { + /* compute index of color closest to pixel value j */ + val = (j * (nci-1) + CENTERJSAMPLE) / MAXJSAMPLE; + /* premultiply so that no multiplication needed in main processing */ + val *= blksize; + colorindex[i][j] = val; + } + } + + /* Pass the colormap to the output module. Note that the output */ + /* module is allowed to save this pointer and use the map during */ + /* any put_pixel_rows call! */ + (*cinfo->methods->put_color_map) (cinfo, total_colors, colormap); + + /* Allocate Floyd-Steinberg workspace if necessary */ + if (cinfo->use_dithering) { + size_t arraysize = (cinfo->image_width + 2L) * cinfo->color_out_comps + * SIZEOF(FSERROR); + + evenrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + oddrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + /* we only need to zero the forward contribution for current row. */ + jzero_far((void FAR *) evenrowerrs, arraysize); + on_odd_row = FALSE; + } + +} + + +/* + * Map some rows of pixels to the output colormapped representation. + */ + +METHODDEF void +color_quantize (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPARRAY output_data) +/* General case, no dithering */ +{ + register int pixcode, ci; + register long col; + register int row; + register long widthm1 = cinfo->image_width - 1; + register int nc = cinfo->color_out_comps; + + for (row = 0; row < num_rows; row++) { + for (col = widthm1; col >= 0; col--) { + pixcode = 0; + for (ci = 0; ci < nc; ci++) { + pixcode += GETJSAMPLE(colorindex[ci] + [GETJSAMPLE(input_data[ci][row][col])]); + } + output_data[row][col] = pixcode; + } + } +} + + +METHODDEF void +color_quantize3 (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPARRAY output_data) +/* Fast path for color_out_comps==3, no dithering */ +{ + register int pixcode; + register JSAMPROW ptr0, ptr1, ptr2, ptrout; + register long col; + register int row; + register long width = cinfo->image_width; + + for (row = 0; row < num_rows; row++) { + ptr0 = input_data[0][row]; + ptr1 = input_data[1][row]; + ptr2 = input_data[2][row]; + ptrout = output_data[row]; + for (col = width; col > 0; col--) { + pixcode = GETJSAMPLE(colorindex[0][GETJSAMPLE(*ptr0++)]); + pixcode += GETJSAMPLE(colorindex[1][GETJSAMPLE(*ptr1++)]); + pixcode += GETJSAMPLE(colorindex[2][GETJSAMPLE(*ptr2++)]); + *ptrout++ = pixcode; + } + } +} + + +METHODDEF void +color_quantize_dither (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPARRAY output_data) +/* General case, with Floyd-Steinberg dithering */ +{ + register int pixcode, ci; + register FSERROR val; + register FSERRPTR thisrowerr, nextrowerr; + register long col; + register int row; + register long width = cinfo->image_width; + register int nc = cinfo->color_out_comps; + + for (row = 0; row < num_rows; row++) { + if (on_odd_row) { + /* work right to left in this row */ + thisrowerr = oddrowerrs + width*nc; + nextrowerr = evenrowerrs + width*nc; + for (ci = 0; ci < nc; ci++) /* need only initialize this one entry */ + nextrowerr[ci] = 0; + for (col = width - 1; col >= 0; col--) { + /* select the output pixel value */ + pixcode = 0; + for (ci = 0; ci < nc; ci++) { + /* compute pixel value + accumulated error */ + val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) + + thisrowerr[ci]; + if (val < 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; + } + thisrowerr[ci] = val; /* save for error propagation */ + pixcode += GETJSAMPLE(colorindex[ci][val]); + } + output_data[row][col] = pixcode; + /* propagate error to adjacent pixels */ + for (ci = 0; ci < nc; ci++) { + val = thisrowerr[ci] - GETJSAMPLE(colormap[ci][pixcode]); + thisrowerr[ci-nc] += val * 7; + nextrowerr[ci+nc] += val * 3; + nextrowerr[ci ] += val * 5; + nextrowerr[ci-nc] = val; /* not +=, since not initialized yet */ + } + thisrowerr -= nc; /* advance error ptrs to next pixel entry */ + nextrowerr -= nc; + } + on_odd_row = FALSE; + } else { + /* work left to right in this row */ + thisrowerr = evenrowerrs + nc; + nextrowerr = oddrowerrs + nc; + for (ci = 0; ci < nc; ci++) /* need only initialize this one entry */ + nextrowerr[ci] = 0; + for (col = 0; col < width; col++) { + /* select the output pixel value */ + pixcode = 0; + for (ci = 0; ci < nc; ci++) { + /* compute pixel value + accumulated error */ + val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) + + thisrowerr[ci]; + if (val < 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; + } + thisrowerr[ci] = val; /* save for error propagation */ + pixcode += GETJSAMPLE(colorindex[ci][val]); + } + output_data[row][col] = pixcode; + /* propagate error to adjacent pixels */ + for (ci = 0; ci < nc; ci++) { + val = thisrowerr[ci] - GETJSAMPLE(colormap[ci][pixcode]); + thisrowerr[ci+nc] += val * 7; + nextrowerr[ci-nc] += val * 3; + nextrowerr[ci ] += val * 5; + nextrowerr[ci+nc] = val; /* not +=, since not initialized yet */ + } + thisrowerr += nc; /* advance error ptrs to next pixel entry */ + nextrowerr += nc; + } + on_odd_row = TRUE; + } + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +color_quant_term (decompress_info_ptr cinfo) +{ + /* We can't free the colormap until now, since output module may use it! */ + (*cinfo->emethods->free_small_sarray) + (colormap, (long) cinfo->color_out_comps); + (*cinfo->emethods->free_small_sarray) + (colorindex, (long) cinfo->color_out_comps); + if (cinfo->use_dithering) { + (*cinfo->emethods->free_medium) ((void FAR *) evenrowerrs); + (*cinfo->emethods->free_medium) ((void FAR *) oddrowerrs); + } +} + + +/* + * Prescan some rows of pixels. + * Not used in one-pass case. + */ + +METHODDEF void +color_quant_prescan (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE image_data) +{ + ERREXIT(cinfo->emethods, "Should not get here!"); +} + + +/* + * Do two-pass quantization. + * Not used in one-pass case. + */ + +METHODDEF void +color_quant_doit (decompress_info_ptr cinfo, quantize_caller_ptr source_method) +{ + ERREXIT(cinfo->emethods, "Should not get here!"); +} + + +/* + * The method selection routine for 1-pass color quantization. + */ + +GLOBAL void +jsel1quantize (decompress_info_ptr cinfo) +{ + if (! cinfo->two_pass_quantize) { + cinfo->methods->color_quant_init = color_quant_init; + if (cinfo->use_dithering) { + cinfo->methods->color_quantize = color_quantize_dither; + } else { + if (cinfo->color_out_comps == 3) + cinfo->methods->color_quantize = color_quantize3; + else + cinfo->methods->color_quantize = color_quantize; + } + cinfo->methods->color_quant_prescan = color_quant_prescan; + cinfo->methods->color_quant_doit = color_quant_doit; + cinfo->methods->color_quant_term = color_quant_term; + } +} + +#endif /* QUANT_1PASS_SUPPORTED */ diff --git a/jquant2.c b/jquant2.c new file mode 100644 index 00000000..2569b206 --- /dev/null +++ b/jquant2.c @@ -0,0 +1,122 @@ +/* + * jquant2.c + * + * Copyright (C) 1991, 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. + * + * This file contains 2-pass color quantization (color mapping) routines. + * These routines are invoked via the methods color_quant_prescan, + * color_quant_doit, and color_quant_init/term. + */ + +#include "jinclude.h" + +#ifdef QUANT_2PASS_SUPPORTED + + +/* + * Initialize for two-pass color quantization. + */ + +METHODDEF void +color_quant_init (decompress_info_ptr cinfo) +{ + TRACEMS(cinfo->emethods, 1, "color_quant_init 2 pass"); +} + + +/* + * Prescan some rows of pixels. + * Note: this could change the data being written into the big image array, + * if there were any benefit to doing so. The doit routine is not allowed + * to modify the big image array, because the memory manager is not required + * to support multiple write passes on a big image. + */ + +METHODDEF void +color_quant_prescan (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE image_data) +{ + TRACEMS1(cinfo->emethods, 2, "color_quant_prescan %d rows", num_rows); +} + + +/* + * This routine makes the final pass over the image data. + * output_workspace is a one-component array of pixel dimensions at least + * as large as the input image strip; it can be used to hold the converted + * pixels' colormap indexes. + */ + +METHODDEF void +final_pass (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE image_data, JSAMPARRAY output_workspace) +{ + TRACEMS1(cinfo->emethods, 2, "final_pass %d rows", num_rows); + /* for debug purposes, just emit input data */ + /* NB: this only works for PPM output */ + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, image_data); +} + + +/* + * Perform two-pass quantization: rescan the image data and output the + * converted data via put_color_map and put_pixel_rows. + * The source_method is a routine that can scan the image data; it can + * be called as many times as desired. The processing routine called by + * source_method has the same interface as color_quantize does in the + * one-pass case, except it must call put_pixel_rows itself. (This allows + * me to use multiple passes in which earlier passes don't output anything.) + */ + +METHODDEF void +color_quant_doit (decompress_info_ptr cinfo, quantize_caller_ptr source_method) +{ + TRACEMS(cinfo->emethods, 1, "color_quant_doit 2 pass"); + (*source_method) (cinfo, final_pass); +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +color_quant_term (decompress_info_ptr cinfo) +{ + TRACEMS(cinfo->emethods, 1, "color_quant_term 2 pass"); +} + + +/* + * Map some rows of pixels to the output colormapped representation. + * Not used in two-pass case. + */ + +METHODDEF void +color_quantize (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE input_data, JSAMPARRAY output_data) +{ + ERREXIT(cinfo->emethods, "Should not get here!"); +} + + +/* + * The method selection routine for 2-pass color quantization. + */ + +GLOBAL void +jsel2quantize (decompress_info_ptr cinfo) +{ + if (cinfo->two_pass_quantize) { + /* just one alternative for the moment */ + cinfo->methods->color_quant_init = color_quant_init; + cinfo->methods->color_quant_prescan = color_quant_prescan; + cinfo->methods->color_quant_doit = color_quant_doit; + cinfo->methods->color_quant_term = color_quant_term; + cinfo->methods->color_quantize = color_quantize; + } +} + +#endif /* QUANT_2PASS_SUPPORTED */ diff --git a/jrdgif.c b/jrdgif.c new file mode 100644 index 00000000..e2d4b338 --- /dev/null +++ b/jrdgif.c @@ -0,0 +1,620 @@ +/* + * jrdgif.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to read input images in GIF format. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume input from + * an ordinary stdio stream. They further assume that reading begins + * at the start of the file; input_init may need work if the + * user interface has already read some data (e.g., to determine that + * the file is indeed GIF format). + * + * These routines are invoked via the methods get_input_row + * and input_init/term. + */ + +/* + * This code is loosely based on giftoppm from the PBMPLUS distribution + * of Feb. 1991. That file contains the following copyright notice: + * +-------------------------------------------------------------------+ + * | Copyright 1990, David Koblas. | + * | Permission to use, copy, modify, and distribute this software | + * | and its documentation for any purpose and without fee is hereby | + * | granted, provided that the above copyright notice appear in all | + * | copies and that both that copyright notice and this permission | + * | notice appear in supporting documentation. This software is | + * | provided "as is" without express or implied warranty. | + * +-------------------------------------------------------------------+ + * + * We are also required to state that + * "The Graphics Interchange Format(c) is the Copyright property of + * CompuServe Incorporated. GIF(sm) is a Service Mark property of + * CompuServe Incorporated." + */ + +#include "jinclude.h" + +#ifdef GIF_SUPPORTED + + +#define MAXCOLORMAPSIZE 256 /* max # of colors in a GIF colormap */ +#define NUMCOLORS 3 /* # of colors */ +#define CM_RED 0 /* color component numbers */ +#define CM_GREEN 1 +#define CM_BLUE 2 + +static JSAMPARRAY colormap; /* the colormap to use */ +/* colormap[i][j] = value of i'th color component for pixel value j */ + +#define MAX_LZW_BITS 12 /* maximum LZW code size */ +#define LZW_TABLE_SIZE (1< table of prefix symbols */ +static UINT8 FAR *symbol_tail; /* => table of suffix bytes */ +static UINT8 FAR *symbol_stack; /* stack for symbol expansions */ +static UINT8 FAR *sp; /* stack pointer */ + +/* Static state for interlaced image processing */ + +static boolean is_interlaced; /* TRUE if have interlaced image */ +static big_sarray_ptr interlaced_image; /* full image in interlaced order */ +static long cur_row_number; /* need to know actual row number */ +static long pass2_offset; /* # of pixel rows in pass 1 */ +static long pass3_offset; /* # of pixel rows in passes 1&2 */ +static long pass4_offset; /* # of pixel rows in passes 1,2,3 */ + + +/* Forward declarations */ +METHODDEF void load_interlaced_image PP((compress_info_ptr cinfo, JSAMPARRAY pixel_row)); +METHODDEF void get_interlaced_row PP((compress_info_ptr cinfo, JSAMPARRAY pixel_row)); + + + +LOCAL int +ReadByte (compress_info_ptr cinfo) +/* Read next byte from GIF file */ +{ + register FILE * infile = cinfo->input_file; + int c; + + if ((c = getc(infile)) == EOF) + ERREXIT(cinfo->emethods, "Premature EOF in GIF file"); + return c; +} + + +LOCAL int +GetDataBlock (compress_info_ptr cinfo, 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 */ +{ + int count; + + count = ReadByte(cinfo); + if (count > 0) { + if (! ReadOK(cinfo->input_file, buf, count)) + ERREXIT(cinfo->emethods, "Premature EOF in GIF file"); + } + return count; +} + + +LOCAL void +SkipDataBlocks (compress_info_ptr cinfo) +/* Skip a series of data blocks, until a block terminator is found */ +{ + char buf[256]; + + while (GetDataBlock(cinfo, buf) > 0) + /* skip */; +} + + +LOCAL void +ReInitLZW (void) +/* (Re)initialize LZW state; shared code for startup and Clear processing */ +{ + code_size = input_code_size+1; + limit_code = clear_code << 1; /* 2^code_size */ + max_code = clear_code + 2; /* first unused code value */ + sp = symbol_stack; /* init stack to empty */ +} + + +LOCAL void +InitLZWCode (void) +/* Initialize for a series of LZWReadByte (and hence GetCode) calls */ +{ + /* GetCode initialization */ + last_byte = 2; /* make safe to "recopy last two bytes" */ + last_bit = 0; /* nothing in the buffer */ + cur_bit = 0; /* force buffer load on first call */ + out_of_blocks = FALSE; + + /* LZWReadByte initialization */ + clear_code = 1 << input_code_size; /* compute special code values */ + end_code = clear_code + 1; /* note that these do not change */ + first_time = TRUE; + ReInitLZW(); +} + + +LOCAL int +GetCode (compress_info_ptr cinfo) +/* Fetch the next code_size bits from the GIF data */ +/* We assume code_size is less than 16 */ +{ + register INT32 accum; + int offs, ret, count; + + if ( (cur_bit+code_size) > last_bit) { + /* Time to reload the buffer */ + if (out_of_blocks) { + TRACEMS(cinfo->emethods, 1, "Ran out of GIF bits"); + return end_code; /* fake something useful */ + } + /* preserve last two bytes of what we have -- assume code_size <= 16 */ + code_buf[0] = code_buf[last_byte-2]; + code_buf[1] = code_buf[last_byte-1]; + /* Load more bytes; set flag if we reach the terminator block */ + if ((count = GetDataBlock(cinfo, &code_buf[2])) == 0) { + out_of_blocks = TRUE; + TRACEMS(cinfo->emethods, 1, "Ran out of GIF bits"); + return end_code; /* fake something useful */ + } + /* Reset counters */ + cur_bit = (cur_bit - last_bit) + 16; + last_byte = 2 + count; + last_bit = last_byte * 8; + } + + /* Form up next 24 bits in accum */ + offs = cur_bit >> 3; /* byte containing cur_bit */ +#ifdef CHAR_IS_UNSIGNED + accum = code_buf[offs+2]; + accum <<= 8; + accum |= code_buf[offs+1]; + accum <<= 8; + accum |= code_buf[offs]; +#else + accum = code_buf[offs+2] & 0xFF; + accum <<= 8; + accum |= code_buf[offs+1] & 0xFF; + accum <<= 8; + accum |= code_buf[offs] & 0xFF; +#endif + + /* Right-align cur_bit in accum, then mask off desired number of bits */ + accum >>= (cur_bit & 7); + ret = ((int) accum) & ((1 << code_size) - 1); + + cur_bit += code_size; + return ret; +} + + +LOCAL int +LZWReadByte (compress_info_ptr cinfo) +/* Read an LZW-compressed byte */ +{ + static int oldcode; /* previous LZW symbol */ + static int firstcode; /* first byte of oldcode's expansion */ + register int code; /* current working code */ + int incode; /* saves actual input code */ + + /* First time, just eat the expected Clear code(s) and return next code, */ + /* which is assumed to be a raw byte. */ + if (first_time) { + first_time = FALSE; + do { + code = GetCode(cinfo); + } while (code == clear_code); + firstcode = oldcode = code; /* make firstcode, oldcode valid! */ + return code; + } + + /* If any codes are stacked from a previously read symbol, return them */ + if (sp > symbol_stack) + return *(--sp); + + code = GetCode(cinfo); + + if (code == clear_code) { + /* Reinit static state, swallow any extra Clear codes, and return */ + ReInitLZW(); + do { + code = GetCode(cinfo); + } while (code == clear_code); + firstcode = oldcode = code; /* gotta reinit these too */ + return code; + } + + if (code == end_code) { + /* Skip the rest of the image, unless GetCode already read terminator */ + if (! out_of_blocks) + SkipDataBlocks(cinfo); + return -1; + } + + /* Normal raw byte or LZW symbol */ + incode = code; /* save for a moment */ + + if (code >= max_code) { /* special case for not-yet-defined symbol */ + *sp++ = firstcode; /* it will be defined as oldcode/firstcode */ + code = oldcode; + } + + /* If it's a symbol, expand it into the stack */ + while (code >= clear_code) { + *sp++ = symbol_tail[code]; /* tail of symbol: a simple byte value */ + code = symbol_head[code]; /* head of symbol: another LZW symbol */ + } + /* At this point code just represents a raw byte */ + firstcode = code; /* save for possible future use */ + + /* If there's room in table, */ + if ((code = max_code) < LZW_TABLE_SIZE) { + /* Define a new symbol = prev sym + head of this sym's expansion */ + symbol_head[code] = oldcode; + symbol_tail[code] = firstcode; + max_code++; + /* Is it time to increase code_size? */ + if ((max_code >= limit_code) && (code_size < MAX_LZW_BITS)) { + code_size++; + limit_code <<= 1; /* keep equal to 2^code_size */ + } + } + + oldcode = incode; /* save last input symbol for future use */ + return firstcode; /* return first byte of symbol's expansion */ +} + + +LOCAL void +ReadColorMap (compress_info_ptr cinfo, int cmaplen, JSAMPARRAY cmap) +/* Read a GIF colormap */ +{ + int i; + + for (i = 0; i < cmaplen; i++) { + cmap[CM_RED][i] = ReadByte(cinfo); + cmap[CM_GREEN][i] = ReadByte(cinfo); + cmap[CM_BLUE][i] = ReadByte(cinfo); + } +} + + +LOCAL void +DoExtension (compress_info_ptr cinfo) +/* Process an extension block */ +/* Currently we ignore 'em all */ +{ + int extlabel; + + /* Read extension label byte */ + extlabel = ReadByte(cinfo); + TRACEMS1(cinfo->emethods, 1, "Ignoring GIF extension block of type 0x%02x", + extlabel); + /* Skip the data block(s) associated with the extension */ + SkipDataBlocks(cinfo); +} + + +/* + * Read the file header; return image size and component count. + */ + +METHODDEF void +input_init (compress_info_ptr cinfo) +{ + char hdrbuf[10]; /* workspace for reading control blocks */ + UINT16 width, height; /* image dimensions */ + int colormaplen, aspectRatio; + int c; + + /* Allocate space to store the colormap */ + colormap = (*cinfo->emethods->alloc_small_sarray) + ((long) MAXCOLORMAPSIZE, (long) NUMCOLORS); + + /* Read and verify GIF Header */ + if (! ReadOK(cinfo->input_file, hdrbuf, 6)) + ERREXIT(cinfo->emethods, "Not a GIF file"); + if (strncmp(hdrbuf, "GIF", 3) != 0) + ERREXIT(cinfo->emethods, "Not a GIF file"); + /* Check for expected version numbers. + * If unknown version, give warning and try to process anyway; + * this is per recommendation in GIF89a standard. + */ + if ((strncmp(hdrbuf+3, "87a", 3) != 0) && + (strncmp(hdrbuf+3, "89a", 3) != 0)) + TRACEMS3(cinfo->emethods, 1, + "Warning: unexpected GIF version number '%c%c%c'", + hdrbuf[3], hdrbuf[4], hdrbuf[5]); + + /* Read and decipher Logical Screen Descriptor */ + if (! ReadOK(cinfo->input_file, hdrbuf, 7)) + ERREXIT(cinfo->emethods, "Premature EOF in GIF file"); + width = LM_to_uint(hdrbuf[0],hdrbuf[1]); + height = LM_to_uint(hdrbuf[2],hdrbuf[3]); + colormaplen = 2 << (hdrbuf[4] & 0x07); + /* we ignore the color resolution, sort flag, and background color index */ + aspectRatio = hdrbuf[6] & 0xFF; + if (aspectRatio != 0 && aspectRatio != 49) + TRACEMS(cinfo->emethods, 1, "Warning: nonsquare pixels in input"); + + /* Read global colormap if header indicates it is present */ + if (BitSet(hdrbuf[4], COLORMAPFLAG)) + ReadColorMap(cinfo, colormaplen, colormap); + + /* Scan until we reach start of desired image. + * We don't currently support skipping images, but could add it easily. + */ + for (;;) { + c = ReadByte(cinfo); + + if (c == ';') /* GIF terminator?? */ + ERREXIT(cinfo->emethods, "Too few images in GIF file"); + + if (c == '!') { /* Extension */ + DoExtension(cinfo); + continue; + } + + if (c != ',') { /* Not an image separator? */ + TRACEMS1(cinfo->emethods, 1, "Bogus input char 0x%02x, ignoring", c); + continue; + } + + /* Read and decipher Local Image Descriptor */ + if (! ReadOK(cinfo->input_file, hdrbuf, 9)) + ERREXIT(cinfo->emethods, "Premature EOF in GIF file"); + /* we ignore top/left position info, also sort flag */ + width = LM_to_uint(hdrbuf[4],hdrbuf[5]); + height = LM_to_uint(hdrbuf[6],hdrbuf[7]); + is_interlaced = BitSet(hdrbuf[8], INTERLACE); + colormaplen = 2 << (hdrbuf[8] & 0x07); + + /* Read local colormap if header indicates it is present */ + /* Note: if we wanted to support skipping images, */ + /* we'd need to skip rather than read colormap for ignored images */ + if (BitSet(hdrbuf[8], COLORMAPFLAG)) + ReadColorMap(cinfo, colormaplen, colormap); + + input_code_size = ReadByte(cinfo); /* get minimum-code-size byte */ + if (input_code_size < 2 || input_code_size >= MAX_LZW_BITS) + ERREXIT1(cinfo->emethods, "Bogus codesize %d", input_code_size); + + /* Reached desired image, so break out of loop */ + /* If we wanted to skip this image, */ + /* we'd call SkipDataBlocks and then continue the loop */ + break; + } + + /* Prepare to read selected image: first initialize LZW decompressor */ + symbol_head = (UINT16 FAR *) (*cinfo->emethods->alloc_medium) + (LZW_TABLE_SIZE * SIZEOF(UINT16)); + symbol_tail = (UINT8 FAR *) (*cinfo->emethods->alloc_medium) + (LZW_TABLE_SIZE * SIZEOF(UINT8)); + symbol_stack = (UINT8 FAR *) (*cinfo->emethods->alloc_medium) + (LZW_TABLE_SIZE * SIZEOF(UINT8)); + InitLZWCode(); + + /* + * If image is interlaced, we read it into a full-size sample array, + * decompressing as we go; then get_input_row selects rows from the + * sample array in the proper order. + */ + if (is_interlaced) { + /* We request the big array now, but can't access it until the pipeline + * controller causes all the big arrays to be allocated. Hence, the + * actual work of reading the image is postponed until the first call + * of get_input_row. + */ + interlaced_image = (*cinfo->emethods->request_big_sarray) + ((long) width, (long) height, (long) 1); + cinfo->methods->get_input_row = load_interlaced_image; + } + + /* Return info about the image. */ + cinfo->input_components = NUMCOLORS; + cinfo->in_color_space = CS_RGB; + cinfo->image_width = width; + cinfo->image_height = height; + cinfo->data_precision = 8; +} + + +/* + * Read one row of pixels. + * This version is used for noninterlaced GIF images: + * we read directly from the GIF file. + */ + +METHODDEF void +get_input_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + register int c; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + if ((c = LZWReadByte(cinfo)) < 0) + ERREXIT(cinfo->emethods, "Premature end of GIF image"); + *ptr0++ = colormap[CM_RED][c]; + *ptr1++ = colormap[CM_GREEN][c]; + *ptr2++ = colormap[CM_BLUE][c]; + } +} + + +/* + * Read one row of pixels. + * This version is used for the first call on get_input_row when + * reading an interlaced GIF file: we read the whole image into memory. + */ + +METHODDEF void +load_interlaced_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + JSAMPARRAY image_ptr; + register JSAMPROW sptr; + register long col; + register int c; + long row; + + /* Read the interlaced image into the big array we've created. */ + for (row = 0; row < cinfo->image_height; row++) { + image_ptr = (*cinfo->emethods->access_big_sarray) + (interlaced_image, row, TRUE); + sptr = image_ptr[0]; + for (col = cinfo->image_width; col > 0; col--) { + if ((c = LZWReadByte(cinfo)) < 0) + ERREXIT(cinfo->emethods, "Premature end of GIF image"); + *sptr++ = c; + } + } + + /* Replace method pointer so subsequent calls don't come here. */ + cinfo->methods->get_input_row = get_interlaced_row; + /* Initialize for get_interlaced_row, and perform first call on it. */ + cur_row_number = 0; + pass2_offset = (cinfo->image_height + 7L) / 8L; + pass3_offset = pass2_offset + (cinfo->image_height + 3L) / 8L; + pass4_offset = pass3_offset + (cinfo->image_height + 1L) / 4L; + + get_interlaced_row(cinfo, pixel_row); +} + + +/* + * Read one row of pixels. + * This version is used for interlaced GIF images: + * we read from the big in-memory image. + */ + +METHODDEF void +get_interlaced_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + JSAMPARRAY image_ptr; + register JSAMPROW sptr, ptr0, ptr1, ptr2; + register long col; + register int c; + long irow; + + /* Figure out which row of interlaced image is needed, and access it. */ + switch ((int) (cur_row_number & 7L)) { + case 0: /* first-pass row */ + irow = cur_row_number >> 3; + break; + case 4: /* second-pass row */ + irow = (cur_row_number >> 3) + pass2_offset; + break; + case 2: /* third-pass row */ + case 6: + irow = (cur_row_number >> 2) + pass3_offset; + break; + default: /* fourth-pass row */ + irow = (cur_row_number >> 1) + pass4_offset; + break; + } + image_ptr = (*cinfo->emethods->access_big_sarray) + (interlaced_image, irow, FALSE); + /* Scan the row, expand colormap, and output */ + sptr = image_ptr[0]; + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + c = GETJSAMPLE(*sptr++); + *ptr0++ = colormap[CM_RED][c]; + *ptr1++ = colormap[CM_GREEN][c]; + *ptr2++ = colormap[CM_BLUE][c]; + } + cur_row_number++; /* for next time */ +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +input_term (compress_info_ptr cinfo) +{ + if (is_interlaced) { + (*cinfo->emethods->free_big_sarray) (interlaced_image); + } + (*cinfo->emethods->free_small_sarray) + (colormap, (long) NUMCOLORS); + (*cinfo->emethods->free_medium) ((void FAR *) symbol_head); + (*cinfo->emethods->free_medium) ((void FAR *) symbol_tail); + (*cinfo->emethods->free_medium) ((void FAR *) symbol_stack); +} + + +/* + * The method selection routine for GIF format input. + * Note that this must be called by the user interface before calling + * jpeg_compress. If multiple input formats are supported, the + * user interface is responsible for discovering the file format and + * calling the appropriate method selection routine. + */ + +GLOBAL void +jselrgif (compress_info_ptr cinfo) +{ + cinfo->methods->input_init = input_init; + cinfo->methods->get_input_row = get_input_row; /* assume uninterlaced */ + cinfo->methods->input_term = input_term; +} + +#endif /* GIF_SUPPORTED */ diff --git a/jrdjfif.c b/jrdjfif.c new file mode 100644 index 00000000..5ff14baa --- /dev/null +++ b/jrdjfif.c @@ -0,0 +1,733 @@ +/* + * jrdjfif.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to decode standard JPEG file headers/markers. + * This will handle baseline and JFIF-convention JPEG files. + * + * This module relies on the JGETC macro and the read_jpeg_data method (which + * is provided by the user interface) to read from the JPEG data stream. + * Therefore, this module is NOT dependent on any particular assumption about + * the data source. This fact does not carry over to more complex JPEG file + * formats such as JPEG-in-TIFF; those format control modules may well need to + * assume stdio input. + * + * read_file_header assumes that reading begins at the JPEG SOI marker + * (although it will skip non-FF bytes looking for a JPEG marker). + * The user interface must position the data stream appropriately. + * + * These routines are invoked via the methods read_file_header, + * read_scan_header, read_jpeg_data, read_scan_trailer, and read_file_trailer. + */ + +#include "jinclude.h" + +#ifdef JFIF_SUPPORTED + + +typedef enum { /* JPEG marker codes */ + M_SOF0 = 0xc0, + M_SOF1 = 0xc1, + M_SOF2 = 0xc2, + M_SOF3 = 0xc3, + + M_SOF5 = 0xc5, + M_SOF6 = 0xc6, + M_SOF7 = 0xc7, + + M_JPG = 0xc8, + M_SOF9 = 0xc9, + M_SOF10 = 0xca, + M_SOF11 = 0xcb, + + M_SOF13 = 0xcd, + M_SOF14 = 0xce, + M_SOF15 = 0xcf, + + M_DHT = 0xc4, + + M_DAC = 0xcc, + + M_RST0 = 0xd0, + M_RST1 = 0xd1, + M_RST2 = 0xd2, + M_RST3 = 0xd3, + M_RST4 = 0xd4, + M_RST5 = 0xd5, + M_RST6 = 0xd6, + M_RST7 = 0xd7, + + M_SOI = 0xd8, + M_EOI = 0xd9, + M_SOS = 0xda, + M_DQT = 0xdb, + M_DNL = 0xdc, + M_DRI = 0xdd, + M_DHP = 0xde, + M_EXP = 0xdf, + + M_APP0 = 0xe0, + M_APP15 = 0xef, + + M_JPG0 = 0xf0, + M_JPG13 = 0xfd, + M_COM = 0xfe, + + M_TEM = 0x01, + + M_ERROR = 0x100 +} JPEG_MARKER; + + +/* + * Reload the input buffer after it's been emptied, and return the next byte. + * This is exported for direct use by the entropy decoder. + * See the JGETC macro for calling conditions. + * + * For this header control module, read_jpeg_data is supplied by the + * user interface. However, header formats that require random access + * to the input file would need to supply their own code. This code is + * left here to indicate what is required. + */ + +#if 0 /* not needed in this module */ + +METHODDEF int +read_jpeg_data (decompress_info_ptr cinfo) +{ + cinfo->bytes_in_buffer = fread(cinfo->input_buffer + MIN_UNGET, + 1, JPEG_BUF_SIZE, + cinfo->input_file); + + cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; + + if (cinfo->bytes_in_buffer <= 0) + ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); + + return JGETC(cinfo); +} + +#endif + + +/* + * Routines to parse JPEG markers & save away the useful info. + */ + + +LOCAL INT32 +get_2bytes (decompress_info_ptr cinfo) +/* Get a 2-byte unsigned integer (e.g., a marker parameter length field) */ +{ + INT32 a; + + a = JGETC(cinfo); + return (a << 8) + JGETC(cinfo); +} + + +LOCAL void +skip_variable (decompress_info_ptr cinfo, int code) +/* Skip over an unknown or uninteresting variable-length marker */ +{ + INT32 length; + + length = get_2bytes(cinfo); + + TRACEMS2(cinfo->emethods, 1, + "Skipping marker 0x%02x, length %d", code, length); + + for (length -= 2; length > 0; length--) + (void) JGETC(cinfo); +} + + +LOCAL void +get_dht (decompress_info_ptr cinfo) +/* Process a DHT marker */ +{ + INT32 length; + UINT8 bits[17]; + UINT8 huffval[256]; + int i, index, count; + HUFF_TBL **htblptr; + + length = get_2bytes(cinfo)-2; + + while (length > 0) { + index = JGETC(cinfo); + + TRACEMS1(cinfo->emethods, 1, "Define Huffman Table 0x%02x", index); + + bits[0] = 0; + count = 0; + for (i = 1; i <= 16; i++) { + bits[i] = JGETC(cinfo); + count += bits[i]; + } + + TRACEMS8(cinfo->emethods, 2, " %3d %3d %3d %3d %3d %3d %3d %3d", + bits[1], bits[2], bits[3], bits[4], + bits[5], bits[6], bits[7], bits[8]); + TRACEMS8(cinfo->emethods, 2, " %3d %3d %3d %3d %3d %3d %3d %3d", + bits[9], bits[10], bits[11], bits[12], + bits[13], bits[14], bits[15], bits[16]); + + if (count > 256) + ERREXIT(cinfo->emethods, "Bogus DHT counts"); + + for (i = 0; i < count; i++) + huffval[i] = JGETC(cinfo); + + length -= 1 + 16 + count; + + if (index & 0x10) { /* AC table definition */ + index -= 0x10; + htblptr = &cinfo->ac_huff_tbl_ptrs[index]; + } else { /* DC table definition */ + htblptr = &cinfo->dc_huff_tbl_ptrs[index]; + } + + if (index < 0 || index >= NUM_HUFF_TBLS) + ERREXIT1(cinfo->emethods, "Bogus DHT index %d", index); + + if (*htblptr == NULL) + *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + + memcpy((void *) (*htblptr)->bits, (void *) bits, + SIZEOF((*htblptr)->bits)); + memcpy((void *) (*htblptr)->huffval, (void *) huffval, + SIZEOF((*htblptr)->huffval)); + } +} + + +LOCAL void +get_dac (decompress_info_ptr cinfo) +/* Process a DAC marker */ +{ + INT32 length; + int index, val; + + length = get_2bytes(cinfo)-2; + + while (length > 0) { + index = JGETC(cinfo); + val = JGETC(cinfo); + + TRACEMS2(cinfo->emethods, 1, + "Define Arithmetic Table 0x%02x: 0x%02x", index, val); + + if (index < 0 || index >= (2*NUM_ARITH_TBLS)) + ERREXIT1(cinfo->emethods, "Bogus DAC index %d", index); + + if (index >= NUM_ARITH_TBLS) { /* define AC table */ + cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = val; + } else { /* define DC table */ + cinfo->arith_dc_L[index] = val & 0x0F; + cinfo->arith_dc_U[index] = val >> 4; + if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) + ERREXIT1(cinfo->emethods, "Bogus DAC value 0x%x", val); + } + + length -= 2; + } +} + + +LOCAL void +get_dqt (decompress_info_ptr cinfo) +/* Process a DQT marker */ +{ + INT32 length; + int n, i, prec; + UINT16 tmp; + QUANT_TBL_PTR quant_ptr; + + length = get_2bytes(cinfo) - 2; + + while (length > 0) { + n = JGETC(cinfo); + prec = n >> 4; + n &= 0x0F; + + TRACEMS2(cinfo->emethods, 1, + "Define Quantization Table %d precision %d", n, prec); + + if (n >= NUM_QUANT_TBLS) + ERREXIT1(cinfo->emethods, "Bogus table number %d", n); + + if (cinfo->quant_tbl_ptrs[n] == NULL) + cinfo->quant_tbl_ptrs[n] = (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); + quant_ptr = cinfo->quant_tbl_ptrs[n]; + + for (i = 0; i < DCTSIZE2; i++) { + tmp = JGETC(cinfo); + if (prec) + tmp = (tmp<<8) + JGETC(cinfo); + quant_ptr[i] = tmp; + } + + for (i = 0; i < DCTSIZE2; i += 8) { + TRACEMS8(cinfo->emethods, 2, " %4d %4d %4d %4d %4d %4d %4d %4d", + quant_ptr[i ], quant_ptr[i+1], quant_ptr[i+2], quant_ptr[i+3], + quant_ptr[i+4], quant_ptr[i+5], quant_ptr[i+6], quant_ptr[i+7]); + } + + length -= DCTSIZE2+1; + if (prec) length -= DCTSIZE2; + } +} + + +LOCAL void +get_dri (decompress_info_ptr cinfo) +/* Process a DRI marker */ +{ + if (get_2bytes(cinfo) != 4) + ERREXIT(cinfo->emethods, "Bogus length in DRI"); + + cinfo->restart_interval = get_2bytes(cinfo); + + TRACEMS1(cinfo->emethods, 1, + "Define Restart Interval %d", cinfo->restart_interval); +} + + +LOCAL void +get_app0 (decompress_info_ptr cinfo) +/* Process an APP0 marker */ +{ +#define JFIF_LEN 14 + INT32 length; + UINT8 b[JFIF_LEN]; + int buffp; + + length = get_2bytes(cinfo) - 2; + + /* See if a JFIF APP0 marker is present */ + + if (length >= JFIF_LEN) { + for (buffp = 0; buffp < JFIF_LEN; buffp++) + b[buffp] = JGETC(cinfo); + length -= JFIF_LEN; + + if (b[0]=='J' && b[1]=='F' && b[2]=='I' && b[3]=='F' && b[4]==0) { + /* Found JFIF APP0 marker: check version */ + /* Major version must be 1 */ + if (b[5] != 1) + ERREXIT2(cinfo->emethods, "Unsupported JFIF revision number %d.%02d", + b[5], b[6]); + /* Minor version should be 0 or 1, but try to process anyway if newer */ + if (b[6] != 0 && b[6] != 1) + TRACEMS2(cinfo->emethods, 0, "Warning: unknown JFIF revision number %d.%02d", + b[5], b[6]); + /* Save info */ + cinfo->density_unit = b[7]; + cinfo->X_density = (b[8] << 8) + b[9]; + cinfo->Y_density = (b[10] << 8) + b[11]; + /* Assume colorspace is YCbCr, unless UI has overridden me */ + if (cinfo->jpeg_color_space == CS_UNKNOWN) + cinfo->jpeg_color_space = CS_YCbCr; + TRACEMS3(cinfo->emethods, 1, "JFIF APP0 marker, density %dx%d %d", + cinfo->X_density, cinfo->Y_density, cinfo->density_unit); + } else { + TRACEMS(cinfo->emethods, 1, "Unknown APP0 marker (not JFIF)"); + } + } else { + TRACEMS1(cinfo->emethods, 1, + "Short APP0 marker, length %d", (int) length); + } + + while (length-- > 0) /* skip any remaining data */ + (void) JGETC(cinfo); +} + + +LOCAL void +get_sof (decompress_info_ptr cinfo, int code) +/* Process a SOFn marker */ +{ + INT32 length; + short ci; + int c; + jpeg_component_info * compptr; + + length = get_2bytes(cinfo); + + cinfo->data_precision = JGETC(cinfo); + cinfo->image_height = get_2bytes(cinfo); + cinfo->image_width = get_2bytes(cinfo); + cinfo->num_components = JGETC(cinfo); + + TRACEMS4(cinfo->emethods, 1, + "Start Of Frame 0x%02x: width=%d, height=%d, components=%d", + code, cinfo->image_width, cinfo->image_height, + cinfo->num_components); + + /* We don't support files in which the image height is initially specified */ + /* as 0 and is later redefined by DNL. As long as we have to check that, */ + /* might as well have a general sanity check. */ + if (cinfo->image_height <= 0 || cinfo->image_width <= 0 + || cinfo->num_components <= 0) + ERREXIT(cinfo->emethods, "Empty JPEG image (DNL not supported)"); + +#ifdef EIGHT_BIT_SAMPLES + if (cinfo->data_precision != 8) + ERREXIT(cinfo->emethods, "Unsupported JPEG data precision"); +#endif +#ifdef TWELVE_BIT_SAMPLES + if (cinfo->data_precision != 12) /* this needs more thought?? */ + ERREXIT(cinfo->emethods, "Unsupported JPEG data precision"); +#endif +#ifdef SIXTEEN_BIT_SAMPLES + if (cinfo->data_precision != 16) /* this needs more thought?? */ + ERREXIT(cinfo->emethods, "Unsupported JPEG data precision"); +#endif + + if (length != (cinfo->num_components * 3 + 8)) + ERREXIT(cinfo->emethods, "Bogus SOF length"); + + cinfo->comp_info = (*cinfo->emethods->alloc_small) + (cinfo->num_components * SIZEOF(jpeg_component_info)); + + for (ci = 0; ci < cinfo->num_components; ci++) { + compptr = &cinfo->comp_info[ci]; + compptr->component_index = ci; + compptr->component_id = JGETC(cinfo); + c = JGETC(cinfo); + compptr->h_samp_factor = (c >> 4) & 15; + compptr->v_samp_factor = (c ) & 15; + compptr->quant_tbl_no = JGETC(cinfo); + + TRACEMS4(cinfo->emethods, 1, " Component %d: %dhx%dv q=%d", + compptr->component_id, compptr->h_samp_factor, + compptr->v_samp_factor, compptr->quant_tbl_no); + } +} + + +LOCAL void +get_sos (decompress_info_ptr cinfo) +/* Process a SOS marker */ +{ + INT32 length; + int i, ci, n, c, cc; + jpeg_component_info * compptr; + + length = get_2bytes(cinfo); + + n = JGETC(cinfo); /* Number of components */ + cinfo->comps_in_scan = n; + length -= 3; + + if (length != (n * 2 + 3) || n < 1 || n > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo->emethods, "Bogus SOS length"); + + TRACEMS1(cinfo->emethods, 1, "Start Of Scan: %d components", n); + + for (i = 0; i < n; i++) { + cc = JGETC(cinfo); + c = JGETC(cinfo); + length -= 2; + + for (ci = 0; ci < cinfo->num_components; ci++) + if (cc == cinfo->comp_info[ci].component_id) + break; + + if (ci >= cinfo->num_components) + ERREXIT(cinfo->emethods, "Invalid component number in SOS"); + + compptr = &cinfo->comp_info[ci]; + cinfo->cur_comp_info[i] = compptr; + compptr->dc_tbl_no = (c >> 4) & 15; + compptr->ac_tbl_no = (c ) & 15; + + TRACEMS3(cinfo->emethods, 1, " c%d: [dc=%d ac=%d]", cc, + compptr->dc_tbl_no, compptr->ac_tbl_no); + } + + while (length > 0) { + (void) JGETC(cinfo); + length--; + } +} + + +LOCAL void +get_soi (decompress_info_ptr cinfo) +/* Process an SOI marker */ +{ + int i; + + TRACEMS(cinfo->emethods, 1, "Start of Image"); + + /* Reset all parameters that are defined to be reset by SOI */ + + for (i = 0; i < NUM_ARITH_TBLS; i++) { + cinfo->arith_dc_L[i] = 0; + cinfo->arith_dc_U[i] = 1; + cinfo->arith_ac_K[i] = 5; + } + cinfo->restart_interval = 0; + + cinfo->density_unit = 0; /* set default JFIF APP0 values */ + cinfo->X_density = 1; + cinfo->Y_density = 1; + + cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling */ +} + + +LOCAL int +next_marker (decompress_info_ptr cinfo) +/* Find the next JPEG marker */ +/* Note that the output might not be a valid marker code, */ +/* but it will never be 0 or FF */ +{ + int c, nbytes; + + nbytes = 0; + do { + do { /* skip any non-FF bytes */ + nbytes++; + c = JGETC(cinfo); + } while (c != 0xFF); + do { /* skip any duplicate FFs */ + nbytes++; + c = JGETC(cinfo); + } while (c == 0xFF); + } while (c == 0); /* repeat if it was a stuffed FF/00 */ + + if (nbytes != 2) + TRACEMS2(cinfo->emethods, 1, "Skipped %d bytes before marker 0x%02x", + nbytes-2, c); + + return c; +} + + +LOCAL JPEG_MARKER +process_tables (decompress_info_ptr cinfo) +/* Scan and process JPEG markers that can appear in any order */ +/* Return when an SOI, EOI, SOFn, or SOS is found */ +{ + int c; + + while (TRUE) { + c = next_marker(cinfo); + + switch (c) { + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_JPG: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + case M_SOI: + case M_EOI: + case M_SOS: + return c; + + case M_DHT: + get_dht(cinfo); + break; + + case M_DAC: + get_dac(cinfo); + break; + + case M_DQT: + get_dqt(cinfo); + break; + + case M_DRI: + get_dri(cinfo); + break; + + case M_APP0: + get_app0(cinfo); + break; + + case M_RST0: /* these are all parameterless */ + case M_RST1: + case M_RST2: + case M_RST3: + case M_RST4: + case M_RST5: + case M_RST6: + case M_RST7: + case M_TEM: + TRACEMS1(cinfo->emethods, 1, "Unexpected marker 0x%02x", c); + break; + + default: /* must be DNL, DHP, EXP, APPn, JPGn, COM, or RESn */ + skip_variable(cinfo, c); + break; + } + } +} + + + +/* + * Initialize and read the file header (everything through the SOF marker). + */ + +METHODDEF void +read_file_header (decompress_info_ptr cinfo) +{ + int c; + + /* Expect an SOI marker first */ + if (next_marker(cinfo) == M_SOI) + get_soi(cinfo); + else + ERREXIT(cinfo->emethods, "File does not start with JPEG SOI marker"); + + /* Process markers until SOF */ + c = process_tables(cinfo); + + switch (c) { + case M_SOF0: + case M_SOF1: + get_sof(cinfo, c); + cinfo->arith_code = FALSE; + break; + + case M_SOF9: + get_sof(cinfo, c); + cinfo->arith_code = TRUE; + break; + + default: + ERREXIT1(cinfo->emethods, "Unsupported SOF marker type 0x%02x", c); + break; + } + + /* Figure out what colorspace we have */ + /* (too bad the JPEG committee didn't provide a real way to specify this) */ + + switch (cinfo->num_components) { + case 1: + cinfo->jpeg_color_space = CS_GRAYSCALE; + break; + + case 3: + /* if we saw a JFIF marker, leave it set to YCbCr; */ + /* also leave it alone if UI has provided a value */ + if (cinfo->jpeg_color_space == CS_UNKNOWN) { + short cid0 = cinfo->comp_info[0].component_id; + short cid1 = cinfo->comp_info[1].component_id; + short cid2 = cinfo->comp_info[2].component_id; + + if (cid0 == 1 && cid1 == 2 && cid2 == 3) + cinfo->jpeg_color_space = CS_YCbCr; /* assume it's JFIF w/out marker */ + else if (cid0 == 1 && cid1 == 4 && cid2 == 5) + cinfo->jpeg_color_space = CS_YIQ; /* prototype's YIQ matrix */ + else { + TRACEMS3(cinfo->emethods, 0, + "Unrecognized component IDs %d %d %d, assuming YCbCr", + cid0, cid1, cid2); + cinfo->jpeg_color_space = CS_YCbCr; + } + } + break; + + case 4: + cinfo->jpeg_color_space = CS_CMYK; + break; + + default: + cinfo->jpeg_color_space = CS_UNKNOWN; + break; + } +} + + +/* + * Read the start of a scan (everything through the SOS marker). + * Return TRUE if find SOS, FALSE if find EOI. + */ + +METHODDEF boolean +read_scan_header (decompress_info_ptr cinfo) +{ + int c; + + /* Process markers until SOS or EOI */ + c = process_tables(cinfo); + + switch (c) { + case M_SOS: + get_sos(cinfo); + return TRUE; + + case M_EOI: + TRACEMS(cinfo->emethods, 1, "End Of Image"); + return FALSE; + + default: + ERREXIT1(cinfo->emethods, "Unexpected marker 0x%02x", c); + break; + } + return FALSE; /* keeps lint happy */ +} + + +/* + * Finish up after a compressed scan (series of read_jpeg_data calls); + * prepare for another read_scan_header call. + */ + +METHODDEF void +read_scan_trailer (decompress_info_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +read_file_trailer (decompress_info_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * The method selection routine for standard JPEG header reading. + * Note that this must be called by the user interface before calling + * jpeg_decompress. When a non-JFIF file is to be decompressed (TIFF, + * perhaps), the user interface must discover the file type and call + * the appropriate method selection routine. + */ + +GLOBAL void +jselrjfif (decompress_info_ptr cinfo) +{ + cinfo->methods->read_file_header = read_file_header; + cinfo->methods->read_scan_header = read_scan_header; + /* For JFIF/raw-JPEG format, the user interface supplies read_jpeg_data. */ +#if 0 + cinfo->methods->read_jpeg_data = read_jpeg_data; +#endif + cinfo->methods->read_scan_trailer = read_scan_trailer; + cinfo->methods->read_file_trailer = read_file_trailer; +} + +#endif /* JFIF_SUPPORTED */ diff --git a/jrdppm.c b/jrdppm.c new file mode 100644 index 00000000..15e2393f --- /dev/null +++ b/jrdppm.c @@ -0,0 +1,124 @@ +/* + * jrdppm.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to read input images in PPM format. + * The PBMPLUS library is required (well, it will be in the real version). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume input from + * an ordinary stdio stream. They further assume that reading begins + * at the start of the file; input_init may need work if the + * user interface has already read some data (e.g., to determine that + * the file is indeed PPM format). + * + * These routines are invoked via the methods get_input_row + * and input_init/term. + */ + +#include "jinclude.h" + +#ifdef PPM_SUPPORTED + + +/* + * Read the file header; return image size and component count. + */ + +METHODDEF void +input_init (compress_info_ptr cinfo) +{ + int c, w, h, prec; + + if (getc(cinfo->input_file) != 'P') + ERREXIT(cinfo->emethods, "Not a PPM file"); + + c = getc(cinfo->input_file); + switch (c) { + case '5': /* it's a PGM file */ + cinfo->input_components = 1; + cinfo->in_color_space = CS_GRAYSCALE; + break; + + case '6': /* it's a PPM file */ + cinfo->input_components = 3; + cinfo->in_color_space = CS_RGB; + break; + + default: + ERREXIT(cinfo->emethods, "Not a PPM file"); + break; + } + + if (fscanf(cinfo->input_file, " %d %d %d", &w, &h, &prec) != 3) + ERREXIT(cinfo->emethods, "Not a PPM file"); + + if (getc(cinfo->input_file) != '\n' || w <= 0 || h <= 0 || prec != 255) + ERREXIT(cinfo->emethods, "Not a PPM file"); + + cinfo->image_width = w; + cinfo->image_height = h; + cinfo->data_precision = 8; +} + + +/* + * Read one row of pixels. + */ + +METHODDEF void +get_input_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + if (cinfo->input_components == 1) { + ptr0 = pixel_row[0]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = getc(infile); + } + } else { + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = getc(infile); + *ptr1++ = getc(infile); + *ptr2++ = getc(infile); + } + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +input_term (compress_info_ptr cinfo) +{ + /* no work required */ +} + + +/* + * The method selection routine for PPM format input. + * Note that this must be called by the user interface before calling + * jpeg_compress. If multiple input formats are supported, the + * user interface is responsible for discovering the file format and + * calling the appropriate method selection routine. + */ + +GLOBAL void +jselrppm (compress_info_ptr cinfo) +{ + cinfo->methods->input_init = input_init; + cinfo->methods->get_input_row = get_input_row; + cinfo->methods->input_term = input_term; +} + +#endif /* PPM_SUPPORTED */ diff --git a/jrevdct.c b/jrevdct.c new file mode 100644 index 00000000..bafbf551 --- /dev/null +++ b/jrevdct.c @@ -0,0 +1,171 @@ +/* + * jrevdct.c + * + * Copyright (C) 1991, 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. + * + * This file contains the basic inverse-DCT transformation subroutine. + * + * This implementation is based on Appendix A.2 of the book + * "Discrete Cosine Transform---Algorithms, Advantages, Applications" + * by K.R. Rao and P. Yip (Academic Press, Inc, London, 1990). + * It uses scaled fixed-point arithmetic instead of floating point. + */ + +#include "jinclude.h" + + +/* The poop on this scaling stuff is as follows: + * + * Most of the numbers (after multiplication by the constants) are + * (logically) shifted left by LG2_DCT_SCALE. This is undone by UNFIXH + * before assignment to the output array. Note that we want an additional + * division by 2 on the output (required by the equations). + * + * If right shifts are unsigned, then there is a potential problem. + * However, shifting right by 16 and then assigning to a short + * (assuming short = 16 bits) will keep the sign right!! + * + * For other shifts, + * + * ((x + (1 << 30)) >> shft) - (1 << (30 - shft)) + * + * gives a nice right shift with sign (assuming no overflow). However, all the + * scaling is such that this isn't a problem. (Is this true?) + */ + + +#define ONE 1L /* remove L if long > 32 bits */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define LG2_DCT_SCALE 15 +#define RIGHT_SHIFT(_x,_shft) ((((_x) + (ONE << 30)) >> (_shft)) - (ONE << (30 - (_shft)))) +#else +#define LG2_DCT_SCALE 16 +#define RIGHT_SHIFT(_x,_shft) ((_x) >> (_shft)) +#endif + +#define DCT_SCALE (ONE << LG2_DCT_SCALE) + +#define LG2_OVERSCALE 2 +#define OVERSCALE (ONE << LG2_OVERSCALE) + +#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) +#define FIXO(x) ((INT32) ((x) * DCT_SCALE / OVERSCALE + 0.5)) +#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) +#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) +#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)), LG2_DCT_SCALE-LG2_OVERSCALE) +#define OVERSH(x) ((x) << LG2_OVERSCALE) + +#define SIN_1_4 FIX(0.7071067811856476) +#define COS_1_4 SIN_1_4 + +#define SIN_1_8 FIX(0.3826834323650898) +#define COS_1_8 FIX(0.9238795325112870) +#define SIN_3_8 COS_1_8 +#define COS_3_8 SIN_1_8 + +#define SIN_1_16 FIX(0.1950903220161282) +#define COS_1_16 FIX(0.9807852804032300) +#define SIN_7_16 COS_1_16 +#define COS_7_16 SIN_1_16 + +#define SIN_3_16 FIX(0.5555702330196022) +#define COS_3_16 FIX(0.8314696123025450) +#define SIN_5_16 COS_3_16 +#define COS_5_16 SIN_3_16 + +#define OSIN_1_4 FIXO(0.707106781185647) +#define OCOS_1_4 OSIN_1_4 + +#define OSIN_1_8 FIXO(0.3826834323650898) +#define OCOS_1_8 FIXO(0.9238795325112870) +#define OSIN_3_8 OCOS_1_8 +#define OCOS_3_8 OSIN_1_8 + +#define OSIN_1_16 FIXO(0.1950903220161282) +#define OCOS_1_16 FIXO(0.9807852804032300) +#define OSIN_7_16 OCOS_1_16 +#define OCOS_7_16 OSIN_1_16 + +#define OSIN_3_16 FIXO(0.5555702330196022) +#define OCOS_3_16 FIXO(0.8314696123025450) +#define OSIN_5_16 OCOS_3_16 +#define OCOS_5_16 OSIN_3_16 + + +INLINE +LOCAL void +fast_idct_8 (DCTELEM *in, int stride) +{ + /* tmp1x are new values of tmpx -- flashy register colourers + * should be able to do this lot very well + */ + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 tmp20, tmp21, tmp22, tmp23; + INT32 tmp30, tmp31; + INT32 tmp40, tmp41, tmp42, tmp43; + INT32 tmp50, tmp51, tmp52, tmp53; + INT32 in0, in1, in2, in3, in4, in5, in6, in7; + + in0 = in[ 0]; + in1 = in[stride ]; + in2 = in[stride*2]; + in3 = in[stride*3]; + in4 = in[stride*4]; + in5 = in[stride*5]; + in6 = in[stride*6]; + in7 = in[stride*7]; + + tmp10 = (in0 + in4) * COS_1_4; + tmp11 = (in0 - in4) * COS_1_4; + tmp12 = in2 * SIN_1_8 - in6 * COS_1_8; + tmp13 = in6 * SIN_1_8 + in2 * COS_1_8; + + tmp20 = tmp10 + tmp13; + tmp21 = tmp11 + tmp12; + tmp22 = tmp11 - tmp12; + tmp23 = tmp10 - tmp13; + + tmp30 = UNFIXO((in3 + in5) * COS_1_4); + tmp31 = UNFIXO((in3 - in5) * COS_1_4); + + tmp40 = OVERSH(in1) + tmp30; + tmp41 = OVERSH(in7) + tmp31; + tmp42 = OVERSH(in1) - tmp30; + tmp43 = OVERSH(in7) - tmp31; + + tmp50 = tmp40 * OCOS_1_16 + tmp41 * OSIN_1_16; + tmp51 = tmp40 * OSIN_1_16 - tmp41 * OCOS_1_16; + tmp52 = tmp42 * OCOS_5_16 + tmp43 * OSIN_5_16; + tmp53 = tmp42 * OSIN_5_16 - tmp43 * OCOS_5_16; + + in[ 0] = UNFIXH(tmp20 + tmp50); + in[stride ] = UNFIXH(tmp21 + tmp53); + in[stride*2] = UNFIXH(tmp22 + tmp52); + in[stride*3] = UNFIXH(tmp23 + tmp51); + in[stride*4] = UNFIXH(tmp23 - tmp51); + in[stride*5] = UNFIXH(tmp22 - tmp52); + in[stride*6] = UNFIXH(tmp21 - tmp53); + in[stride*7] = UNFIXH(tmp20 - tmp50); +} + + +/* + * Perform the inverse DCT on one block of coefficients. + * + * Note that this code is specialized to the case DCTSIZE = 8. + */ + +GLOBAL void +j_rev_dct (DCTBLOCK data) +{ + int i; + + for (i = 0; i < DCTSIZE; i++) + fast_idct_8(data+i*DCTSIZE, 1); + + for (i = 0; i < DCTSIZE; i++) + fast_idct_8(data+i, DCTSIZE); +} diff --git a/jutils.c b/jutils.c new file mode 100644 index 00000000..aebcaa95 --- /dev/null +++ b/jutils.c @@ -0,0 +1,106 @@ +/* + * jutils.c + * + * Copyright (C) 1991, 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. + * + * This file contains miscellaneous utility routines needed for both + * compression and decompression. + * Note we prefix all global names with "j" to minimize conflicts with + * a surrounding application. + */ + +#include "jinclude.h" + + +GLOBAL long +jround_up (long a, long b) +/* Compute a rounded up to next multiple of b; a >= 0, b > 0 */ +{ + a += b-1; + return a - (a % b); +} + + +GLOBAL void +jcopy_sample_rows (JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, long num_cols) +/* Copy some rows of samples from one place to another. + * num_rows rows are copied from input_array[source_row++] + * to output_array[dest_row++]; these areas should not overlap. + * The source and destination arrays must be at least as wide as num_cols. + */ +{ + /* On normal machines we can use memcpy(). This won't work on 80x86 because + * the sample arrays are FAR and we're assuming a small-pointer memory model. + */ + register JSAMPROW inptr, outptr; +#ifdef NEED_FAR_POINTERS + register long count; +#else + register size_t count = num_cols * SIZEOF(JSAMPLE); +#endif + register int row; + + input_array += source_row; + output_array += dest_row; + + for (row = num_rows; row > 0; row--) { + inptr = *input_array++; + outptr = *output_array++; +#ifdef NEED_FAR_POINTERS + for (count = num_cols; count > 0; count--) + *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ +#else + memcpy((void *) outptr, (void *) inptr, count); +#endif + } +} + + +GLOBAL void +jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, long num_blocks) +/* Copy a row of coefficient blocks from one place to another. */ +{ + /* On normal machines we can use memcpy(). This won't work on 80x86 because + * the block arrays are FAR and we're assuming a small-pointer memory model. + */ +#ifdef NEED_FAR_POINTERS + register JCOEFPTR inptr, outptr; + register int i; + register long count; + + for (count = num_blocks; count > 0; count--) { + inptr = *input_row++; + outptr = *output_row++; + for (i = DCTSIZE2; i > 0; i--) + *outptr++ = *inptr++; + } +#else + memcpy((void *) output_row, (void *) input_row, + (size_t) (num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)))); +#endif +} + + +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_medium data. */ +{ + /* On normal machines we can use MEMZERO(). This won't work on 80x86 + * because we're assuming a small-pointer memory model. + */ +#ifdef NEED_FAR_POINTERS + register char FAR * ptr = (char FAR *) target; + register size_t count; + + for (count = bytestozero; count > 0; count--) { + *ptr++ = 0; + } +#else + MEMZERO((void *) target, bytestozero); +#endif +} diff --git a/jvirtmem.c b/jvirtmem.c new file mode 100644 index 00000000..4a0627ca --- /dev/null +++ b/jvirtmem.c @@ -0,0 +1,548 @@ +/* + * jvirtmem.c + * + * Copyright (C) 1991, 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. + * + * This file provides the system-dependent memory allocation routines + * for the case where we can rely on virtual memory to handle large arrays. + * + * This includes some MS-DOS code just for trial purposes; "big" arrays will + * have to be handled with temp files on MS-DOS, so a real implementation of + * a DOS memory manager will probably be a separate file. (See additional + * comments about big arrays, below.) + * + * NB: allocation routines never return NULL. + * They should exit to error_exit if unsuccessful. + */ + +#include "jinclude.h" + +#ifdef __STDC__ +#include /* to declare malloc(), free() */ +#else +extern void * malloc PP((size_t size)); +extern void free PP((void *ptr)); +#endif + + +/* Insert system-specific definitions of far_malloc, far_free here. */ + +#ifndef NEED_FAR_POINTERS /* Generic for non-braindamaged CPUs */ + +#define far_malloc(x) malloc(x) +#define far_free(x) free(x) + +#else /* NEED_FAR_POINTERS */ + +#ifdef __TURBOC__ +/* These definitions work for Turbo C */ +#include /* need farmalloc(), farfree() */ +#define far_malloc(x) farmalloc(x) +#define far_free(x) farfree(x) +#else +#ifdef MSDOS +/* These definitions work for Microsoft C and compatible compilers */ +#include /* need _fmalloc(), _ffree() */ +#define far_malloc(x) _fmalloc(x) +#define far_free(x) _ffree(x) +#endif +#endif + +#endif /* NEED_FAR_POINTERS */ + + +/* + * Some important notes: + * The array alloc/dealloc routines are not merely a convenience; + * on 80x86 machines the bottom-level pointers in an array are FAR + * and thus may not be allocatable by alloc_small. + * + * Also, it's not a good idea to try to merge the sarray and barray + * routines, even though they are textually almost the same, because + * samples are usually stored as bytes while coefficients are shorts. + * Thus, in machines where byte pointers have a different representation + * from word pointers, the resulting machine code could not be the same. + */ + + +static external_methods_ptr methods; /* saved for access to error_exit */ + + +#ifdef MEM_STATS /* optional extra stuff for statistics */ + +#define MALLOC_OVERHEAD (SIZEOF(char *)) /* assumed overhead per request */ +#define MALLOC_FAR_OVERHEAD (SIZEOF(char FAR *)) /* for "far" storage */ + +static long total_num_small = 0; /* total # of small objects alloced */ +static long total_bytes_small = 0; /* total bytes requested */ +static long cur_num_small = 0; /* # currently alloced */ +static long max_num_small = 0; /* max simultaneously alloced */ + +#ifdef NEED_FAR_POINTERS +static long total_num_medium = 0; /* total # of medium objects alloced */ +static long total_bytes_medium = 0; /* total bytes requested */ +static long cur_num_medium = 0; /* # currently alloced */ +static long max_num_medium = 0; /* max simultaneously alloced */ +#endif + +static long total_num_sarray = 0; /* total # of sarray objects alloced */ +static long total_bytes_sarray = 0; /* total bytes requested */ +static long cur_num_sarray = 0; /* # currently alloced */ +static long max_num_sarray = 0; /* max simultaneously alloced */ + +static long total_num_barray = 0; /* total # of barray objects alloced */ +static long total_bytes_barray = 0; /* total bytes requested */ +static long cur_num_barray = 0; /* # currently alloced */ +static long max_num_barray = 0; /* max simultaneously alloced */ + + +GLOBAL void +j_mem_stats (void) +{ + /* since this is only a debugging stub, we can cheat a little on the + * trace message mechanism... helps 'cuz trace can't handle longs. + */ + fprintf(stderr, "total_num_small = %ld\n", total_num_small); + fprintf(stderr, "total_bytes_small = %ld\n", total_bytes_small); + if (cur_num_small) + fprintf(stderr, "CUR_NUM_SMALL = %ld\n", cur_num_small); + fprintf(stderr, "max_num_small = %ld\n", max_num_small); + +#ifdef NEED_FAR_POINTERS + fprintf(stderr, "total_num_medium = %ld\n", total_num_medium); + fprintf(stderr, "total_bytes_medium = %ld\n", total_bytes_medium); + if (cur_num_medium) + fprintf(stderr, "CUR_NUM_MEDIUM = %ld\n", cur_num_medium); + fprintf(stderr, "max_num_medium = %ld\n", max_num_medium); +#endif + + fprintf(stderr, "total_num_sarray = %ld\n", total_num_sarray); + fprintf(stderr, "total_bytes_sarray = %ld\n", total_bytes_sarray); + if (cur_num_sarray) + fprintf(stderr, "CUR_NUM_SARRAY = %ld\n", cur_num_sarray); + fprintf(stderr, "max_num_sarray = %ld\n", max_num_sarray); + + fprintf(stderr, "total_num_barray = %ld\n", total_num_barray); + fprintf(stderr, "total_bytes_barray = %ld\n", total_bytes_barray); + if (cur_num_barray) + fprintf(stderr, "CUR_NUM_BARRAY = %ld\n", cur_num_barray); + fprintf(stderr, "max_num_barray = %ld\n", max_num_barray); +} + +#endif /* MEM_STATS */ + + +LOCAL void +out_of_memory (int which) +/* Report an out-of-memory error and stop execution */ +/* If we compiled MEM_STATS support, report alloc requests before dying */ +{ +#ifdef MEM_STATS + j_mem_stats(); +#endif + ERREXIT1(methods, "Insufficient memory (case %d)", which); +} + + + +METHODDEF void * +alloc_small (size_t sizeofobject) +/* Allocate a "small" (all-in-memory) object */ +{ + void * result; + +#ifdef MEM_STATS + total_num_small++; + total_bytes_small += sizeofobject + MALLOC_OVERHEAD; + cur_num_small++; + if (cur_num_small > max_num_small) max_num_small = cur_num_small; +#endif + + result = malloc(sizeofobject); + if (result == NULL) + out_of_memory(1); + return result; +} + + +METHODDEF void +free_small (void *ptr) +/* Free a "small" (all-in-memory) object */ +{ + free(ptr); + +#ifdef MEM_STATS + cur_num_small--; +#endif +} + + +#ifdef NEED_FAR_POINTERS + +METHODDEF void FAR * +alloc_medium (size_t sizeofobject) +/* Allocate a "medium" (all in memory, but in far heap) object */ +{ + void FAR * result; + +#ifdef MEM_STATS + total_num_medium++; + total_bytes_medium += sizeofobject + MALLOC_FAR_OVERHEAD; + cur_num_medium++; + if (cur_num_medium > max_num_medium) max_num_medium = cur_num_medium; +#endif + + result = far_malloc(sizeofobject); + if (result == NULL) + out_of_memory(2); + return result; +} + + +METHODDEF void +free_medium (void FAR *ptr) +/* Free a "medium" (all in memory, but in far heap) object */ +{ + far_free(ptr); + +#ifdef MEM_STATS + cur_num_medium--; +#endif +} + +#endif /* NEED_FAR_POINTERS */ + + +METHODDEF JSAMPARRAY +alloc_small_sarray (long samplesperrow, long numrows) +/* Allocate a "small" (all-in-memory) 2-D sample array */ +{ + JSAMPARRAY result; + long i; + +#ifdef MEM_STATS + total_num_sarray++; + total_bytes_sarray += (samplesperrow * SIZEOF(JSAMPLE) + MALLOC_FAR_OVERHEAD) + * numrows; + cur_num_sarray++; + if (cur_num_sarray > max_num_sarray) max_num_sarray = cur_num_sarray; +#endif + + /* Get space for row pointers; this is always "near" on 80x86 */ + result = (JSAMPARRAY) alloc_small((size_t) (numrows * SIZEOF(JSAMPROW))); + + /* Get the rows themselves; on 80x86 these are "far" */ + for (i = 0; i < numrows; i++) { + result[i] = (JSAMPROW) far_malloc((size_t) (samplesperrow * SIZEOF(JSAMPLE))); + if (result[i] == NULL) + out_of_memory(3); + } + + return result; +} + + +METHODDEF void +free_small_sarray (JSAMPARRAY ptr, long numrows) +/* Free a "small" (all-in-memory) 2-D sample array */ +{ + long i; + + /* Free the rows themselves; on 80x86 these are "far" */ + for (i = 0; i < numrows; i++) { + far_free((void FAR *) ptr[i]); + } + + /* Free space for row pointers; this is always "near" on 80x86 */ + free_small((void *) ptr); + +#ifdef MEM_STATS + cur_num_sarray--; +#endif +} + + +METHODDEF JBLOCKARRAY +alloc_small_barray (long blocksperrow, long numrows) +/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */ +{ + JBLOCKARRAY result; + long i; + +#ifdef MEM_STATS + total_num_barray++; + total_bytes_barray += (blocksperrow * SIZEOF(JBLOCK) + MALLOC_FAR_OVERHEAD) + * numrows; + cur_num_barray++; + if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray; +#endif + + /* Get space for row pointers; this is always "near" on 80x86 */ + result = (JBLOCKARRAY) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW))); + + /* Get the rows themselves; on 80x86 these are "far" */ + for (i = 0; i < numrows; i++) { + result[i] = (JBLOCKROW) far_malloc((size_t) (blocksperrow * SIZEOF(JBLOCK))); + if (result[i] == NULL) + out_of_memory(4); + } + + return result; +} + + +METHODDEF void +free_small_barray (JBLOCKARRAY ptr, long numrows) +/* Free a "small" (all-in-memory) 2-D coefficient-block array */ +{ + long i; + + /* Free the rows themselves; on 80x86 these are "far" */ + for (i = 0; i < numrows; i++) { + far_free((void FAR *) ptr[i]); + } + + /* Free space for row pointers; this is always "near" on 80x86 */ + free_small((void *) ptr); + +#ifdef MEM_STATS + cur_num_barray--; +#endif +} + + + +/* + * About "big" array management: + * + * To allow machines with limited memory to handle large images, + * all processing in the JPEG system is done a few pixel or block rows + * at a time. The above "small" array routines are only used to allocate + * strip buffers (as wide as the image, but just a few rows high). + * In some cases multiple passes must be made over the data. In these + * cases the "big" array routines are used. The array is still accessed + * a strip at a time, but the memory manager must save the whole array + * for repeated accesses. The intended implementation is that there is + * a strip buffer in memory (as high as is possible given the desired memory + * limit), plus a backing file that holds the rest of the array. + * + * The request_big_array routines are told the total size of the image (in case + * it is useful to know the total file size that will be needed). They are + * also given the unit height, which is the number of rows that will be + * accessed at once; the in-memory buffer should usually be made a multiple of + * this height for best efficiency. + * + * The request routines create control blocks (and may open backing files), + * but they don't create the in-memory buffers. This is postponed until + * alloc_big_arrays is called. At that time the total amount of space needed + * is known (approximately, anyway), so free memory can be divided up fairly. + * + * The access_big_array routines are responsible for making a specific strip + * area accessible (after reading or writing the backing file, if necessary). + * Note that the access routines are told whether the caller intends to modify + * the accessed strip; during a read-only pass this saves having to rewrite + * data to disk. + * + * The typical access pattern is one top-to-bottom pass to write the data, + * followed by one or more read-only top-to-bottom passes. However, other + * access patterns may occur while reading. For example, translation of image + * formats that use bottom-to-top scan order will require bottom-to-top read + * passes. The memory manager need not support multiple write passes nor + * funny write orders (meaning that rearranging rows must be handled while + * reading data out of the big array, not while putting it in). + * + * In current usage, the access requests are always for nonoverlapping strips; + * that is, successive access start_row numbers always differ by exactly the + * unitheight. This allows fairly simple buffer dump/reload logic if the + * in-memory buffer is made a multiple of the unitheight. It would be + * possible to keep subsampled rather than fullsize data in the "big" arrays, + * thus reducing temp file size, if we supported overlapping strip access + * (access requests differing by less than the unitheight). At the moment + * I don't believe this is worth the extra complexity. + * + * This particular implementation doesn't use temp files; the whole of a big + * array is allocated in (virtual) memory, and any swapping is done behind the + * scenes by the operating system. + */ + + + +/* The control blocks for virtual arrays. + * These are pretty minimal in this implementation. + * Note: in this implementation we could realize big arrays + * at request time and make alloc_big_arrays a no-op; + * however, doing it separately keeps callers honest. + */ + +struct big_sarray_control { + JSAMPARRAY mem_buffer; /* memory buffer (the whole thing, here) */ + long rows_in_mem; /* Height of memory buffer */ + long samplesperrow; /* Width of memory buffer */ + long unitheight; /* # of rows accessed by access_big_sarray() */ + big_sarray_ptr next; /* list link for unrealized arrays */ +}; + +struct big_barray_control { + JBLOCKARRAY mem_buffer; /* memory buffer (the whole thing, here) */ + long rows_in_mem; /* Height of memory buffer */ + long blocksperrow; /* Width of memory buffer */ + long unitheight; /* # of rows accessed by access_big_barray() */ + big_barray_ptr next; /* list link for unrealized arrays */ +}; + + +/* Headers of lists of control blocks for unrealized big arrays */ +static big_sarray_ptr unalloced_sarrays; +static big_barray_ptr unalloced_barrays; + + +METHODDEF big_sarray_ptr +request_big_sarray (long samplesperrow, long numrows, long unitheight) +/* Request a "big" (virtual-memory) 2-D sample array */ +{ + big_sarray_ptr result; + + /* get control block */ + result = (big_sarray_ptr) alloc_small(SIZEOF(struct big_sarray_control)); + + result->mem_buffer = NULL; /* lets access routine spot premature access */ + result->rows_in_mem = numrows; + result->samplesperrow = samplesperrow; + result->unitheight = unitheight; + result->next = unalloced_sarrays; /* add to list of unallocated arrays */ + unalloced_sarrays = result; + + return result; +} + + +METHODDEF big_barray_ptr +request_big_barray (long blocksperrow, long numrows, long unitheight) +/* Request a "big" (virtual-memory) 2-D coefficient-block array */ +{ + big_barray_ptr result; + + /* get control block */ + result = (big_barray_ptr) alloc_small(SIZEOF(struct big_barray_control)); + + result->mem_buffer = NULL; /* lets access routine spot premature access */ + result->rows_in_mem = numrows; + result->blocksperrow = blocksperrow; + result->unitheight = unitheight; + result->next = unalloced_barrays; /* add to list of unallocated arrays */ + unalloced_barrays = result; + + return result; +} + + +METHODDEF void +alloc_big_arrays (long extra_small_samples, long extra_small_blocks, + long extra_medium_space) +/* Allocate the in-memory buffers for any unrealized "big" arrays */ +/* 'extra' values are upper bounds for total future small-array requests */ +/* and far-heap requests */ +{ + /* In this implementation we just malloc the whole arrays */ + /* and expect the system's virtual memory to worry about swapping them */ + big_sarray_ptr sptr; + big_barray_ptr bptr; + + for (sptr = unalloced_sarrays; sptr != NULL; sptr = sptr->next) { + sptr->mem_buffer = alloc_small_sarray(sptr->samplesperrow, + sptr->rows_in_mem); + } + + for (bptr = unalloced_barrays; bptr != NULL; bptr = bptr->next) { + bptr->mem_buffer = alloc_small_barray(bptr->blocksperrow, + bptr->rows_in_mem); + } + + unalloced_sarrays = NULL; /* reset for possible future cycles */ + unalloced_barrays = NULL; +} + + +METHODDEF JSAMPARRAY +access_big_sarray (big_sarray_ptr ptr, long start_row, boolean writable) +/* Access the part of a "big" sample array starting at start_row */ +/* and extending for ptr->unitheight rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + /* debugging check */ + if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_mem || + ptr->mem_buffer == NULL) + ERREXIT(methods, "Bogus access_big_sarray request"); + + return ptr->mem_buffer + start_row; +} + + +METHODDEF JBLOCKARRAY +access_big_barray (big_barray_ptr ptr, long start_row, boolean writable) +/* Access the part of a "big" coefficient-block array starting at start_row */ +/* and extending for ptr->unitheight rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + /* debugging check */ + if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_mem || + ptr->mem_buffer == NULL) + ERREXIT(methods, "Bogus access_big_barray request"); + + return ptr->mem_buffer + start_row; +} + + +METHODDEF void +free_big_sarray (big_sarray_ptr ptr) +/* Free a "big" (virtual-memory) 2-D sample array */ +{ + free_small_sarray(ptr->mem_buffer, ptr->rows_in_mem); + free_small((void *) ptr); /* free the control block too */ +} + + +METHODDEF void +free_big_barray (big_barray_ptr ptr) +/* Free a "big" (virtual-memory) 2-D coefficient-block array */ +{ + free_small_barray(ptr->mem_buffer, ptr->rows_in_mem); + free_small((void *) ptr); /* free the control block too */ +} + + + +/* + * The method selection routine for virtual memory systems. + * The system-dependent setup routine should call this routine + * to install the necessary method pointers in the supplied struct. + */ + +GLOBAL void +jselvirtmem (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + + emethods->alloc_small = alloc_small; + emethods->free_small = free_small; +#ifdef NEED_FAR_POINTERS + emethods->alloc_medium = alloc_medium; + emethods->free_medium = free_medium; +#endif + emethods->alloc_small_sarray = alloc_small_sarray; + emethods->free_small_sarray = free_small_sarray; + emethods->alloc_small_barray = alloc_small_barray; + emethods->free_small_barray = free_small_barray; + emethods->request_big_sarray = request_big_sarray; + emethods->request_big_barray = request_big_barray; + emethods->alloc_big_arrays = alloc_big_arrays; + emethods->access_big_sarray = access_big_sarray; + emethods->access_big_barray = access_big_barray; + emethods->free_big_sarray = free_big_sarray; + emethods->free_big_barray = free_big_barray; + + unalloced_sarrays = NULL; /* make sure list headers are empty */ + unalloced_barrays = NULL; +} diff --git a/jwrgif.c b/jwrgif.c new file mode 100644 index 00000000..44062ec8 --- /dev/null +++ b/jwrgif.c @@ -0,0 +1,497 @@ +/* + * jwrgif.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to write output images in GIF format. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * These routines are invoked via the methods put_pixel_rows, put_color_map, + * and output_init/term. + */ + +/* + * This code is loosely based on ppmtogif from the PBMPLUS distribution + * of Feb. 1991. That file contains the following copyright notice: + * Based on GIFENCODE by David Rowley . + * Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al. + * Copyright (C) 1989 by Jef Poskanzer. + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. This software is provided "as is" without express or + * implied warranty. + * + * We are also required to state that + * "The Graphics Interchange Format(c) is the Copyright property of + * CompuServe Incorporated. GIF(sm) is a Service Mark property of + * CompuServe Incorporated." + */ + +#include "jinclude.h" + +#ifdef GIF_SUPPORTED + + +static decompress_info_ptr dcinfo; /* to avoid passing to all functions */ + +#define MAX_LZW_BITS 12 /* maximum LZW code size (4096 symbols) */ + +typedef INT16 code_int; /* must hold -1 .. 2**MAX_LZW_BITS */ + +#define LZW_TABLE_SIZE ((code_int) 1 << MAX_LZW_BITS) + +#define HSIZE 5003 /* hash table size for 80% occupancy */ + +typedef int hash_int; /* must hold -2*HSIZE..2*HSIZE */ + +static int n_bits; /* current number of bits/code */ +static code_int maxcode; /* maximum code, given n_bits */ +#define MAXCODE(n_bits) (((code_int) 1 << (n_bits)) - 1) + +static int init_bits; /* initial n_bits ... restored after clear */ + +static code_int ClearCode; /* clear code (doesn't change) */ +static code_int EOFCode; /* EOF code (ditto) */ + +static code_int free_code; /* first not-yet-used symbol code */ + +/* + * The LZW hash table consists of three parallel arrays: + * hash_code[i] code of symbol in slot i, or 0 if empty slot + * hash_prefix[i] symbol's prefix code; undefined if empty slot + * hash_suffix[i] symbol's suffix character; undefined if empty slot + * where slot values (i) range from 0 to HSIZE-1. + * + * Algorithm: use open addressing double hashing (no chaining) on the + * prefix code / suffix character combination. We do a variant of Knuth's + * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + * secondary probe. + * + * The hash tables are allocated from FAR heap space since they would use up + * rather a lot of the near data space in a PC. + */ + +static code_int FAR *hash_code; /* => hash table of symbol codes */ +static code_int FAR *hash_prefix; /* => hash table of prefix symbols */ +static UINT8 FAR *hash_suffix; /* => hash table of suffix bytes */ + + +/* + * Routines to package compressed data bytes into GIF data blocks. + * A data block consists of a count byte (1..255) and that many data bytes. + */ + +static int bytesinpkt; /* # of bytes in current packet */ +static char packetbuf[256]; /* workspace for accumulating packet */ + + +LOCAL void +flush_packet (void) +/* flush any accumulated data */ +{ + if (bytesinpkt > 0) { /* never write zero-length packet */ + packetbuf[0] = bytesinpkt++; + if (fwrite(packetbuf, 1, bytesinpkt, dcinfo->output_file) != bytesinpkt) + ERREXIT(dcinfo->emethods, "Output file write error"); + bytesinpkt = 0; + } +} + + +LOCAL void +char_out (int c) +/* Add a character to current packet; flush to disk if necessary */ +{ + packetbuf[++bytesinpkt] = c; + if (bytesinpkt >= 255) + flush_packet(); +} + + +/* Routine to convert variable-width codes into a byte stream */ + +static INT32 cur_accum; /* holds bits not yet output */ +static int cur_bits; /* # of bits in cur_accum */ + + +LOCAL void +output (code_int code) +/* Emit a code of n_bits bits */ +/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */ +{ + if (cur_bits > 0) + cur_accum |= ((INT32) code << cur_bits); + else + cur_accum = code; + cur_bits += n_bits; + + while (cur_bits >= 8) { + char_out((int) (cur_accum & 0xFF)); + cur_accum >>= 8; + cur_bits -= 8; + } + + /* + * If the next entry is going to be too big for the code size, + * then increase it, if possible. We do this here to ensure + * that it's done in sync with the decoder's codesize increases. + */ + if (free_code > maxcode) { + n_bits++; + if (n_bits == MAX_LZW_BITS) + maxcode = LZW_TABLE_SIZE; /* free_code will never exceed this */ + else + maxcode = MAXCODE(n_bits); + } +} + + +/* The LZW algorithm proper */ + +static code_int waiting_code; /* symbol not yet output; may be extendable */ +static boolean first_byte; /* if TRUE, waiting_code is not valid */ + + +LOCAL void +clear_hash (void) +/* Fill the hash table with empty entries */ +{ + /* It's sufficient to zero hash_code[] */ + jzero_far((void FAR *) hash_code, HSIZE * SIZEOF(code_int)); +} + + +LOCAL void +clear_block (void) +/* Reset compressor and issue a Clear code */ +{ + clear_hash(); /* delete all the symbols */ + free_code = ClearCode + 2; + output(ClearCode); /* inform decoder */ + n_bits = init_bits; /* reset code size */ + maxcode = MAXCODE(n_bits); +} + + +LOCAL void +compress_init (int i_bits) +/* Initialize LZW compressor */ +{ + /* init all the static variables */ + n_bits = init_bits = i_bits; + maxcode = MAXCODE(n_bits); + ClearCode = ((code_int) 1 << (init_bits - 1)); + EOFCode = ClearCode + 1; + free_code = ClearCode + 2; + first_byte = TRUE; /* no waiting symbol yet */ + /* init output buffering vars */ + bytesinpkt = 0; + cur_accum = 0; + cur_bits = 0; + /* clear hash table */ + clear_hash(); + /* GIF specifies an initial Clear code */ + output(ClearCode); +} + + +LOCAL void +compress_byte (int c) +/* Accept and compress one 8-bit byte */ +{ + register hash_int i; + register hash_int disp; + + if (first_byte) { /* need to initialize waiting_code */ + waiting_code = c; + first_byte = FALSE; + return; + } + + /* Probe hash table to see if a symbol exists for + * waiting_code followed by c. + * If so, replace waiting_code by that symbol and return. + */ + i = ((hash_int) c << (MAX_LZW_BITS-8)) + waiting_code; + /* i is less than twice 2**MAX_LZW_BITS, therefore less than twice HSIZE */ + if (i >= HSIZE) + i -= HSIZE; + + if (hash_code[i] != 0) { /* is first probed slot empty? */ + if (hash_prefix[i] == waiting_code && hash_suffix[i] == c) { + waiting_code = hash_code[i]; + return; + } + if (i == 0) /* secondary hash (after G. Knott) */ + disp = 1; + else + disp = HSIZE - i; + while (1) { + i -= disp; + if (i < 0) + i += HSIZE; + if (hash_code[i] == 0) + break; /* hit empty slot */ + if (hash_prefix[i] == waiting_code && hash_suffix[i] == c) { + waiting_code = hash_code[i]; + return; + } + } + } + + /* here when hashtable[i] is an empty slot; desired symbol not in table */ + output(waiting_code); + if (free_code < LZW_TABLE_SIZE) { + hash_code[i] = free_code++; /* add symbol to hashtable */ + hash_prefix[i] = waiting_code; + hash_suffix[i] = c; + } else + clear_block(); + waiting_code = c; +} + + +LOCAL void +compress_term (void) +/* Clean up at end */ +{ + /* Flush out the buffered code */ + if (! first_byte) + output(waiting_code); + /* Send an EOF code */ + output(EOFCode); + /* Flush the bit-packing buffer */ + if (cur_bits > 0) { + char_out((int) (cur_accum & 0xFF)); + } + /* Flush the packet buffer */ + flush_packet(); +} + + +/* GIF header construction */ + + +LOCAL void +put_word (UINT16 w) +/* Emit a 16-bit word, LSB first */ +{ + putc(w & 0xFF, dcinfo->output_file); + putc((w >> 8) & 0xFF, dcinfo->output_file); +} + + +LOCAL void +put_3bytes (int val) +/* Emit 3 copies of same byte value --- handy subr for colormap construction */ +{ + putc(val, dcinfo->output_file); + putc(val, dcinfo->output_file); + putc(val, dcinfo->output_file); +} + + +LOCAL void +emit_header (int num_colors, JSAMPARRAY colormap) +/* Output the GIF file header, including color map */ +/* If colormap==NULL, synthesize a gray-scale colormap */ +{ + int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; + int i; + + if (num_colors > 256) + ERREXIT(dcinfo->emethods, "GIF can only handle 256 colors"); + /* Compute bits/pixel and related values */ + if (num_colors <= 2) + BitsPerPixel = 1; + else if (num_colors <= 4) + BitsPerPixel = 2; + else if (num_colors <= 8) + BitsPerPixel = 3; + else if (num_colors <= 16) + BitsPerPixel = 4; + else if (num_colors <= 32) + BitsPerPixel = 5; + else if (num_colors <= 64) + BitsPerPixel = 6; + else if (num_colors <= 128) + BitsPerPixel = 7; + else + BitsPerPixel = 8; + ColorMapSize = 1 << BitsPerPixel; + if (BitsPerPixel <= 1) + InitCodeSize = 2; + else + InitCodeSize = BitsPerPixel; + /* + * Write the GIF header. + * Note that we generate a plain GIF87 header for maximum compatibility. + */ + fwrite("GIF87a", 1, 6, dcinfo->output_file); + /* Write the Logical Screen Descriptor */ + put_word((UINT16) dcinfo->image_width); + put_word((UINT16) dcinfo->image_height); + FlagByte = 0x80; /* Yes, there is a global color table */ + FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */ + FlagByte |= (BitsPerPixel-1); /* size of global color table */ + putc(FlagByte, dcinfo->output_file); + putc(0, dcinfo->output_file); /* Background color index */ + putc(0, dcinfo->output_file); /* Reserved in GIF87 (aspect ratio in GIF89) */ + /* Write the Global Color Map */ + for (i=0; i < ColorMapSize; i++) { + if (i < num_colors) { + if (colormap != NULL) { + if (dcinfo->out_color_space == CS_RGB) { + /* Normal case: RGB color map */ + putc(GETJSAMPLE(colormap[0][i]), dcinfo->output_file); + putc(GETJSAMPLE(colormap[1][i]), dcinfo->output_file); + putc(GETJSAMPLE(colormap[2][i]), dcinfo->output_file); + } else { + /* Grayscale "color map": possible if quantizing grayscale image */ + put_3bytes(GETJSAMPLE(colormap[0][i])); + } + } else { + /* Create a gray-scale map of num_colors values, range 0..255 */ + put_3bytes((i * 255 + (num_colors-1)/2) / (num_colors-1)); + } + } else { + /* fill out the map to a power of 2 */ + put_3bytes(0); + } + } + /* Write image separator and Image Descriptor */ + putc(',', dcinfo->output_file); /* separator */ + put_word((UINT16) 0); /* left/top offset */ + put_word((UINT16) 0); + put_word((UINT16) dcinfo->image_width); /* image size */ + put_word((UINT16) dcinfo->image_height); + /* flag byte: not interlaced, no local color map */ + putc(0x00, dcinfo->output_file); + /* Write Initial Code Size byte */ + putc(InitCodeSize, dcinfo->output_file); + + /* Initialize for LZW compression of image data */ + compress_init(InitCodeSize+1); +} + + + +/* + * Initialize for GIF output. + */ + +METHODDEF void +output_init (decompress_info_ptr cinfo) +{ + dcinfo = cinfo; /* save for use by local routines */ + if (cinfo->final_out_comps != 1) /* safety check */ + ERREXIT(cinfo->emethods, "GIF output got confused"); + /* Allocate space for hash table */ + hash_code = (code_int FAR *) (*cinfo->emethods->alloc_medium) + (HSIZE * SIZEOF(code_int)); + hash_prefix = (code_int FAR *) (*cinfo->emethods->alloc_medium) + (HSIZE * SIZEOF(code_int)); + hash_suffix = (UINT8 FAR *) (*cinfo->emethods->alloc_medium) + (HSIZE * SIZEOF(UINT8)); + /* + * If we aren't quantizing, put_color_map won't be called, + * so emit the header now. This only happens with gray scale output. + * (If we are quantizing, wait for the color map to be provided.) + */ + if (! cinfo->quantize_colors) + emit_header(256, (JSAMPARRAY) NULL); +} + + +/* + * Write the color map. + */ + +METHODDEF void +put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) +{ + emit_header(num_colors, colormap); +} + + +/* + * Write some pixel data. + */ + +METHODDEF void +put_pixel_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + register JSAMPROW ptr; + register long col; + register long width = cinfo->image_width; + register int row; + + for (row = 0; row < num_rows; row++) { + ptr = pixel_data[0][row]; + for (col = width; col > 0; col--) { + compress_byte(GETJSAMPLE(*ptr)); + ptr++; + } + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +output_term (decompress_info_ptr cinfo) +{ + /* Flush LZW mechanism */ + compress_term(); + /* Write a zero-length data block to end the series */ + putc(0, cinfo->output_file); + /* Write the GIF terminator mark */ + putc(';', cinfo->output_file); + /* Make sure we wrote the output file OK */ + fflush(cinfo->output_file); + if (ferror(cinfo->output_file)) + ERREXIT(cinfo->emethods, "Output file write error"); + /* Free space */ + (*cinfo->emethods->free_medium) ((void FAR *) hash_code); + (*cinfo->emethods->free_medium) ((void FAR *) hash_prefix); + (*cinfo->emethods->free_medium) ((void FAR *) hash_suffix); +} + + +/* + * The method selection routine for GIF format output. + * This should be called from d_ui_method_selection if GIF output is wanted. + */ + +GLOBAL void +jselwgif (decompress_info_ptr cinfo) +{ + cinfo->methods->output_init = output_init; + cinfo->methods->put_color_map = put_color_map; + cinfo->methods->put_pixel_rows = put_pixel_rows; + cinfo->methods->output_term = output_term; + + if (cinfo->out_color_space != CS_GRAYSCALE && + cinfo->out_color_space != CS_RGB) + ERREXIT(cinfo->emethods, "GIF output must be grayscale or RGB"); + + /* Force quantization if color or if > 8 bits input */ + if (cinfo->out_color_space == CS_RGB || cinfo->data_precision > 8) { + /* Force quantization to at most 256 colors */ + cinfo->quantize_colors = TRUE; + if (cinfo->desired_number_of_colors > 256) + cinfo->desired_number_of_colors = 256; + } +} + +#endif /* GIF_SUPPORTED */ diff --git a/jwrjfif.c b/jwrjfif.c new file mode 100644 index 00000000..cc379ac6 --- /dev/null +++ b/jwrjfif.c @@ -0,0 +1,468 @@ +/* + * jwrjfif.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to write standard JPEG file headers/markers. + * The file format created is a raw JPEG data stream with (optionally) an + * APP0 marker per the JFIF spec. This will handle baseline and + * JFIF-convention JPEG files, although there is currently no provision + * for inserting a thumbnail image in the JFIF header. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. However, the changes to write to something + * else are localized in the macros appearing just below. + * + * These routines are invoked via the methods write_file_header, + * write_scan_header, write_jpeg_data, write_scan_trailer, and + * write_file_trailer. + */ + +#include "jinclude.h" + +#ifdef JFIF_SUPPORTED + + +/* + * To output to something other than a stdio stream, you'd need to redefine + * these macros. + */ + +/* Write a single byte */ +#define emit_byte(cinfo,x) putc((x), cinfo->output_file) + +/* Write some bytes from a (char *) buffer */ +#define WRITE_BYTES(cinfo,dataptr,datacount) \ + { if (fwrite((dataptr), 1, (datacount), cinfo->output_file) != (datacount)) \ + ERREXIT(cinfo->emethods, "Output file write error"); } + +/* Clean up and verify successful output */ +#define CHECK_OUTPUT(cinfo) \ + { fflush(cinfo->output_file); \ + if (ferror(cinfo->output_file)) \ + ERREXIT(cinfo->emethods, "Output file write error"); } + + +/* End of stdio-specific code. */ + + +typedef enum { /* JPEG marker codes */ + M_SOF0 = 0xc0, + M_SOF1 = 0xc1, + M_SOF2 = 0xc2, + M_SOF3 = 0xc3, + + M_SOF5 = 0xc5, + M_SOF6 = 0xc6, + M_SOF7 = 0xc7, + + M_JPG = 0xc8, + M_SOF9 = 0xc9, + M_SOF10 = 0xca, + M_SOF11 = 0xcb, + + M_SOF13 = 0xcd, + M_SOF14 = 0xce, + M_SOF15 = 0xcf, + + M_DHT = 0xc4, + + M_DAC = 0xcc, + + M_RST0 = 0xd0, + M_RST1 = 0xd1, + M_RST2 = 0xd2, + M_RST3 = 0xd3, + M_RST4 = 0xd4, + M_RST5 = 0xd5, + M_RST6 = 0xd6, + M_RST7 = 0xd7, + + M_SOI = 0xd8, + M_EOI = 0xd9, + M_SOS = 0xda, + M_DQT = 0xdb, + M_DNL = 0xdc, + M_DRI = 0xdd, + M_DHP = 0xde, + M_EXP = 0xdf, + + M_APP0 = 0xe0, + M_APP15 = 0xef, + + M_JPG0 = 0xf0, + M_JPG13 = 0xfd, + M_COM = 0xfe, + + M_TEM = 0x01, + + M_ERROR = 0x100 +} JPEG_MARKER; + + +LOCAL void +emit_marker (compress_info_ptr cinfo, JPEG_MARKER mark) +/* Emit a marker code */ +{ + emit_byte(cinfo, 0xFF); + emit_byte(cinfo, mark); +} + + +LOCAL void +emit_2bytes (compress_info_ptr cinfo, int value) +/* Emit a 2-byte integer; these are always MSB first in JPEG files */ +{ + emit_byte(cinfo, (value >> 8) & 0xFF); + emit_byte(cinfo, value & 0xFF); +} + + +LOCAL int +emit_dqt (compress_info_ptr cinfo, int index) +/* Emit a DQT marker */ +/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ +{ + QUANT_TBL_PTR data = cinfo->quant_tbl_ptrs[index]; + int prec = 0; + int i; + + for (i = 0; i < DCTSIZE2; i++) { + if (data[i] > 255) + prec = 1; + } + + emit_marker(cinfo, M_DQT); + + emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); + + emit_byte(cinfo, index + (prec<<4)); + + for (i = 0; i < DCTSIZE2; i++) { + if (prec) + emit_byte(cinfo, data[i] >> 8); + emit_byte(cinfo, data[i] & 0xFF); + } + + return prec; +} + + +LOCAL void +emit_dht (compress_info_ptr cinfo, int index, boolean is_ac) +/* Emit a DHT marker */ +{ + HUFF_TBL * htbl; + int length, i; + + if (is_ac) { + htbl = cinfo->ac_huff_tbl_ptrs[index]; + index += 0x10; /* output index has AC bit set */ + } else { + htbl = cinfo->dc_huff_tbl_ptrs[index]; + } + + if (! htbl->sent_table) { + emit_marker(cinfo, M_DHT); + + length = 0; + for (i = 1; i <= 16; i++) + length += htbl->bits[i]; + + emit_2bytes(cinfo, length + 2 + 1 + 16); + emit_byte(cinfo, index); + + for (i = 1; i <= 16; i++) + emit_byte(cinfo, htbl->bits[i]); + + for (i = 0; i < length; i++) + emit_byte(cinfo, htbl->huffval[i]); + + htbl->sent_table = TRUE; + } +} + + +LOCAL void +emit_dac (compress_info_ptr cinfo) +/* Emit a DAC marker */ +/* Since the useful info is so small, we want to emit all the tables in */ +/* one DAC marker. Therefore this routine does its own scan of the table. */ +{ + char dc_in_use[NUM_ARITH_TBLS]; + char ac_in_use[NUM_ARITH_TBLS]; + int length, i; + + for (i = 0; i < NUM_ARITH_TBLS; i++) + dc_in_use[i] = ac_in_use[i] = 0; + + for (i = 0; i < cinfo->num_components; i++) { + dc_in_use[cinfo->comp_info[i].dc_tbl_no] = 1; + ac_in_use[cinfo->comp_info[i].ac_tbl_no] = 1; + } + + length = 0; + for (i = 0; i < NUM_ARITH_TBLS; i++) + length += dc_in_use[i] + ac_in_use[i]; + + emit_marker(cinfo, M_DAC); + + emit_2bytes(cinfo, length*2 + 2); + + for (i = 0; i < NUM_ARITH_TBLS; i++) { + if (dc_in_use[i]) { + emit_byte(cinfo, i); + emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); + } + if (ac_in_use[i]) { + emit_byte(cinfo, i + 0x10); + emit_byte(cinfo, cinfo->arith_ac_K[i]); + } + } +} + + +LOCAL void +emit_dri (compress_info_ptr cinfo) +/* Emit a DRI marker */ +{ + emit_marker(cinfo, M_DRI); + + emit_2bytes(cinfo, 4); /* fixed length */ + + emit_2bytes(cinfo, (int) cinfo->restart_interval); +} + + +LOCAL void +emit_sof (compress_info_ptr cinfo, JPEG_MARKER code) +/* Emit a SOF marker */ +{ + int i; + + emit_marker(cinfo, code); + + emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ + + emit_byte(cinfo, cinfo->data_precision); + emit_2bytes(cinfo, (int) cinfo->image_height); + emit_2bytes(cinfo, (int) cinfo->image_width); + + emit_byte(cinfo, cinfo->num_components); + + for (i = 0; i < cinfo->num_components; i++) { + emit_byte(cinfo, cinfo->comp_info[i].component_id); + emit_byte(cinfo, (cinfo->comp_info[i].h_samp_factor << 4) + + cinfo->comp_info[i].v_samp_factor); + emit_byte(cinfo, cinfo->comp_info[i].quant_tbl_no); + } +} + + +LOCAL void +emit_sos (compress_info_ptr cinfo) +/* Emit a SOS marker */ +{ + int i; + + emit_marker(cinfo, M_SOS); + + emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ + + emit_byte(cinfo, cinfo->comps_in_scan); + + for (i = 0; i < cinfo->comps_in_scan; i++) { + emit_byte(cinfo, cinfo->cur_comp_info[i]->component_id); + emit_byte(cinfo, (cinfo->cur_comp_info[i]->dc_tbl_no << 4) + + cinfo->cur_comp_info[i]->ac_tbl_no); + } + + emit_byte(cinfo, 0); /* Spectral selection start */ + emit_byte(cinfo, DCTSIZE2-1); /* Spectral selection end */ + emit_byte(cinfo, 0); /* Successive approximation */ +} + + +LOCAL void +emit_jfif_app0 (compress_info_ptr cinfo) +/* Emit a JFIF-compliant APP0 marker */ +{ + /* + * Length of APP0 block (2 bytes) + * Block ID (4 bytes - ASCII "JFIF") + * Zero byte (1 byte to terminate the ID string) + * Version Major, Minor (2 bytes - 0x01, 0x01) + * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) + * Xdpu (2 bytes - dots per unit horizontal) + * Ydpu (2 bytes - dots per unit vertical) + * Thumbnail X size (1 byte) + * Thumbnail Y size (1 byte) + */ + + emit_marker(cinfo, M_APP0); + + emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ + + emit_byte(cinfo, 'J'); /* Identifier */ + emit_byte(cinfo, 'F'); + emit_byte(cinfo, 'I'); + emit_byte(cinfo, 'F'); + emit_byte(cinfo, 0); + emit_byte(cinfo, 1); /* Major version */ + emit_byte(cinfo, 1); /* Minor version */ + emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ + emit_2bytes(cinfo, (int) cinfo->X_density); + emit_2bytes(cinfo, (int) cinfo->Y_density); + emit_byte(cinfo, 0); /* No thumbnail image */ + emit_byte(cinfo, 0); +} + + +/* + * Write the file header. + */ + + +METHODDEF void +write_file_header (compress_info_ptr cinfo) +{ + char qt_in_use[NUM_QUANT_TBLS]; + int i, prec; + boolean is_baseline; + + emit_marker(cinfo, M_SOI); /* first the SOI */ + + if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ + emit_jfif_app0(cinfo); + + /* Emit DQT for each quantization table. */ + /* Note that doing it here means we can't adjust the QTs on-the-fly. */ + /* If we did want to do that, we'd have a problem with checking precision */ + /* for the is_baseline determination. */ + + for (i = 0; i < NUM_QUANT_TBLS; i++) + qt_in_use[i] = 0; + + for (i = 0; i < cinfo->num_components; i++) + qt_in_use[cinfo->comp_info[i].quant_tbl_no] = 1; + + prec = 0; + for (i = 0; i < NUM_QUANT_TBLS; i++) { + if (qt_in_use[i]) + prec += emit_dqt(cinfo, i); + } + /* now prec is nonzero iff there are any 16-bit quant tables. */ + + if (cinfo->restart_interval) + emit_dri(cinfo); + + /* Check for a non-baseline specification. */ + /* Note we assume that Huffman table numbers won't be changed later. */ + is_baseline = TRUE; + if (cinfo->arith_code || (cinfo->data_precision != 8)) + is_baseline = FALSE; + for (i = 0; i < cinfo->num_components; i++) { + if (cinfo->comp_info[i].dc_tbl_no > 1 || cinfo->comp_info[i].ac_tbl_no > 1) + is_baseline = FALSE; + } + if (prec && is_baseline) { + is_baseline = FALSE; + /* If it's baseline except for quantizer size, warn the user */ + TRACEMS(cinfo->emethods, 0, + "Caution: quantization tables are too coarse for baseline JPEG"); + } + + + /* Emit the proper SOF marker */ + if (cinfo->arith_code) + emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ + else if (is_baseline) + emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ + else + emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ +} + + +/* + * Write the start of a scan (everything through the SOS marker). + */ + +METHODDEF void +write_scan_header (compress_info_ptr cinfo) +{ + int i; + + if (cinfo->arith_code) { + /* Emit arith conditioning info. We will have some duplication + * if the file has multiple scans, but it's so small it's hardly + * worth worrying about. + */ + emit_dac(cinfo); + } else { + /* Emit Huffman tables. Note that emit_dht takes care of + * suppressing duplicate tables. + */ + for (i = 0; i < cinfo->comps_in_scan; i++) { + emit_dht(cinfo, cinfo->cur_comp_info[i]->dc_tbl_no, FALSE); + emit_dht(cinfo, cinfo->cur_comp_info[i]->ac_tbl_no, TRUE); + } + } + + emit_sos(cinfo); +} + + +/* + * Write some bytes of compressed data within a scan. + */ + +METHODDEF void +write_jpeg_data (compress_info_ptr cinfo, char *dataptr, int datacount) +{ + WRITE_BYTES(cinfo, dataptr, datacount); +} + + +/* + * Finish up after a compressed scan (series of write_jpeg_data calls). + */ + +METHODDEF void +write_scan_trailer (compress_info_ptr cinfo) +{ + /* no work needed in this format */ +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +write_file_trailer (compress_info_ptr cinfo) +{ + emit_marker(cinfo, M_EOI); + /* Make sure we wrote the output file OK */ + CHECK_OUTPUT(cinfo); +} + + +/* + * The method selection routine for standard JPEG header writing. + * This should be called from c_ui_method_selection if appropriate. + */ + +GLOBAL void +jselwjfif (compress_info_ptr cinfo) +{ + cinfo->methods->write_file_header = write_file_header; + cinfo->methods->write_scan_header = write_scan_header; + cinfo->methods->write_jpeg_data = write_jpeg_data; + cinfo->methods->write_scan_trailer = write_scan_trailer; + cinfo->methods->write_file_trailer = write_file_trailer; +} + +#endif /* JFIF_SUPPORTED */ diff --git a/jwrppm.c b/jwrppm.c new file mode 100644 index 00000000..41687fec --- /dev/null +++ b/jwrppm.c @@ -0,0 +1,167 @@ +/* + * jwrppm.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to write output images in PPM format. + * The PBMPLUS library is required (well, it will be in the real version). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * These routines are invoked via the methods put_pixel_rows, put_color_map, + * and output_init/term. + */ + +#include "jinclude.h" + +#ifdef PPM_SUPPORTED + + +static JSAMPARRAY color_map; /* saves color map passed by quantizer */ + + +/* + * Write the file header. + */ + +METHODDEF void +output_init (decompress_info_ptr cinfo) +{ + if (cinfo->out_color_space == CS_GRAYSCALE) { + /* emit header for raw PGM format */ + fprintf(cinfo->output_file, "P5\n%ld %ld\n%d\n", + cinfo->image_width, cinfo->image_height, 255); + } else if (cinfo->out_color_space == CS_RGB) { + /* emit header for raw PPM format */ + fprintf(cinfo->output_file, "P6\n%ld %ld\n%d\n", + cinfo->image_width, cinfo->image_height, 255); + } else { + ERREXIT(cinfo->emethods, "PPM output must be grayscale or RGB"); + } +} + + +/* + * Write some pixel data. + */ + +METHODDEF void +put_pixel_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + register FILE * outfile = cinfo->output_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + register long width = cinfo->image_width; + register int row; + + if (cinfo->out_color_space == CS_GRAYSCALE) { + for (row = 0; row < num_rows; row++) { + ptr0 = pixel_data[0][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(*ptr0), outfile); + ptr0++; + } + } + } else { + for (row = 0; row < num_rows; row++) { + ptr0 = pixel_data[0][row]; + ptr1 = pixel_data[1][row]; + ptr2 = pixel_data[2][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(*ptr0), outfile); + ptr0++; + putc(GETJSAMPLE(*ptr1), outfile); + ptr1++; + putc(GETJSAMPLE(*ptr2), outfile); + ptr2++; + } + } + } +} + + +/* + * Write some pixel data when color quantization is in effect. + */ + +METHODDEF void +put_demapped_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + register FILE * outfile = cinfo->output_file; + register JSAMPROW ptr; + register long col; + register long width = cinfo->image_width; + register int row; + + if (cinfo->out_color_space == CS_GRAYSCALE) { + for (row = 0; row < num_rows; row++) { + ptr = pixel_data[0][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(color_map[0][GETJSAMPLE(*ptr)]), outfile); + ptr++; + } + } + } else { + for (row = 0; row < num_rows; row++) { + ptr = pixel_data[0][row]; + for (col = width; col > 0; col--) { + register int pixval = GETJSAMPLE(*ptr); + + putc(GETJSAMPLE(color_map[0][pixval]), outfile); + putc(GETJSAMPLE(color_map[1][pixval]), outfile); + putc(GETJSAMPLE(color_map[2][pixval]), outfile); + ptr++; + } + } + } +} + + +/* + * Write the color map. + * For PPM output, we just demap the output data! + */ + +METHODDEF void +put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) +{ + color_map = colormap; /* save for use in output */ + cinfo->methods->put_pixel_rows = put_demapped_rows; +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +output_term (decompress_info_ptr cinfo) +{ + /* No work except to make sure we wrote the output file OK */ + fflush(cinfo->output_file); + if (ferror(cinfo->output_file)) + ERREXIT(cinfo->emethods, "Output file write error"); +} + + +/* + * The method selection routine for PPM format output. + * This should be called from d_ui_method_selection if PPM output is wanted. + */ + +GLOBAL void +jselwppm (decompress_info_ptr cinfo) +{ + cinfo->methods->output_init = output_init; + cinfo->methods->put_color_map = put_color_map; + cinfo->methods->put_pixel_rows = put_pixel_rows; + cinfo->methods->output_term = output_term; +} + +#endif /* PPM_SUPPORTED */ diff --git a/makcjpeg.cf b/makcjpeg.cf new file mode 100644 index 00000000..ea93ce4b --- /dev/null +++ b/makcjpeg.cf @@ -0,0 +1,5 @@ +L jcmain.mix jerror.mix jcdeflts.mix jrdgif.mix jrdppm.mix jwrjfif.mix +L jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmaster.mix jcmcu.mix +L jcpipe.mix jcsample.mix jfwddct.mix jutils.mix jvirtmem.mix +fa; +b cjpeg,8K,48K, diff --git a/makcjpeg.lnk b/makcjpeg.lnk new file mode 100644 index 00000000..23702b22 --- /dev/null +++ b/makcjpeg.lnk @@ -0,0 +1,21 @@ +jcmain.obj + +jerror.obj + +jcdeflts.obj + +jrdgif.obj + +jrdppm.obj + +jwrjfif.obj + +jcarith.obj + +jccolor.obj + +jcexpand.obj + +jchuff.obj + +jcmaster.obj + +jcmcu.obj + +jcpipe.obj + +jcsample.obj + +jfwddct.obj + +jutils.obj + +jvirtmem.obj +cjpeg.exe /NOI +nul.map + +nul.def diff --git a/makdjpeg.cf b/makdjpeg.cf new file mode 100644 index 00000000..968af311 --- /dev/null +++ b/makdjpeg.cf @@ -0,0 +1,6 @@ +L jdmain.mix jerror.mix jrdjfif.mix jwrgif.mix jwrppm.mix +L jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmaster.mix jdmcu.mix +L jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jutils.mix +L jvirtmem.mix +fa; +b djpeg,8K,48K, diff --git a/makdjpeg.lnk b/makdjpeg.lnk new file mode 100644 index 00000000..6e9107cf --- /dev/null +++ b/makdjpeg.lnk @@ -0,0 +1,22 @@ +jdmain.obj + +jerror.obj + +jrdjfif.obj + +jwrgif.obj + +jwrppm.obj + +jbsmooth.obj + +jdarith.obj + +jdcolor.obj + +jdhuff.obj + +jdmaster.obj + +jdmcu.obj + +jdpipe.obj + +jdsample.obj + +jquant1.obj + +jquant2.obj + +jrevdct.obj + +jutils.obj + +jvirtmem.obj /NOI +djpeg.exe +nul.map + +nul.def diff --git a/makefile.amiga b/makefile.amiga new file mode 100644 index 00000000..2fde93ab --- /dev/null +++ b/makefile.amiga @@ -0,0 +1,143 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is suitable for Amiga systems using Manx Aztec C ver 5.x. +# Thanks to D.J. James for this version. + +# See README and edit jconfig.h before saying "make" !! + +CC= cc + +# You may need to adjust these cc options: +CFLAGS= -MC -MD -DTWO_FILE_COMMANDLINE +LDFLAGS= +LDLIBS= -lml -lcl + +# miscellaneous OS-dependent stuff +LN= ln # linker +RM= delete quiet # file deletion command +AR= lb # library (.lib) file creation command + + +# source files +INCLUDES= jinclude.h jconfig.h jpegdata.h +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c \ + jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c \ + jdarith.c jdcolor.c jdhuff.c jdmain.c jdmaster.c jdmcu.c \ + jdpipe.c jdsample.c jerror.c jfwddct.c jquant1.c jquant2.c \ + jrdjfif.c jrdgif.c jrdppm.c jrevdct.c jutils.c jvirtmem.c \ + jwrjfif.c jwrgif.c jwrppm.c egetopt.c +DOCS= README architecture codingrules +MAKEFILES= makefile.unix makefile.amiga \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk \ + makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) ansi2knr.c $(SOURCES) $(INCLUDES) $(TESTFILES) + +# compression objectfiles +COBJECTS = jcmain.o jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ + jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ + jrdgif.o jrdppm.o jwrjfif.o \ + jutils.o jvirtmem.o jerror.o +# decompression objectfiles +DOBJECTS = jdmain.o jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ + jrdjfif.o jwrgif.o jwrppm.o \ + jutils.o jvirtmem.o jerror.o +# These objectfiles are included in libjpeg.lib (all but jcmain.o, jdmain.o) +LIBOBJECTS = jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ + jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ + jrdgif.o jrdppm.o jwrjfif.o \ + jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ + jrdjfif.o jwrgif.o jwrppm.o \ + jutils.o jvirtmem.o jerror.o + + +all: cjpeg djpeg +# By default, libjpeg.lib is not built unless you explicitly request it. + + +# If you have a C compiler that doesn't understand function prototypes, +# uncomment the 5 lines below and make sure PROTO is not defined by jconfig.h. +# Then say "make ansi2knr" before "make". + +#.c.o: +# ./ansi2knr $*.c tmpansi.c +# $(CC) $(CFLAGS) -c tmpansi.c +# mv tmpansi.o $*.o +# $(RM) tmpansi.c + +ansi2knr: ansi2knr.c + $(CC) -o ansi2knr ansi2knr.c +# You may need to add one of -DBSD, -DVMS, or -DMSDOS to the line above. + + +cjpeg: $(COBJECTS) + $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) $(LDLIBS) + +djpeg: $(DOBJECTS) + $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) $(LDLIBS) + +# libjpeg.lib is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.lib: $(LIBOBJECTS) + -$(RM) libjpeg.lib + $(AR) libjpeg.lib $(LIBOBJECTS) + +# Use the following to test the built library +#cjpeg: jcmain.o libjpeg.lib +# $(LN) $(LDFLAGS) -o cjpeg jcmain.o -llibjpeg $(LDLIBS) +# +#djpeg: jdmain.o libjpeg.lib +# $(LN) $(LDFLAGS) -o djpeg jdmain.o -llibjpeg $(LDLIBS) + +clean: + -$(RM) *.o cjpeg djpeg libjpeg.lib ansi2knr core tmpansi.* testout.ppm testout.jpg + +distribute: + -$(RM) jpegsrc.tar* + tar cvf jpegsrc.tar $(DISTFILES) + list jpegsrc.tar + compress -v jpegsrc.tar + list jpegsrc.tar* + +test: cjpeg djpeg + -$(RM) testout.ppm testout.jpg + ./djpeg testorig.jpg testout.ppm + ./cjpeg testimg.ppm testout.jpg + cmp testimg.ppm testout.ppm + cmp testimg.jpg testout.jpg + + +jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h +jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h +jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h +jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h +jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.mc5 b/makefile.mc5 new file mode 100644 index 00000000..eee9f217 --- /dev/null +++ b/makefile.mc5 @@ -0,0 +1,115 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for Microsoft C for MS-DOS, version 5.x. + +# See README and edit jconfig.h before saying "make" !! + +# Microsoft's brain-damaged version of make uses nonstandard syntax (a blank +# line is needed to terminate a command list) and it simply scans the rules +# in order, rather than doing a true dependency-tree walk. Furthermore, +# expanded command lines can't exceed 128 chars (this is a DOS bug, not +# make's fault); so we can't just name all the objectfiles in the link steps. +# Instead we shove each objectfile into a library as it is made, and link +# from the library. The objectfiles are also kept separately as timestamps. + +# You may need to adjust these cc options: +CFLAGS= /AS /I. /W3 /Oail /Gs /DMEM_STATS # NB: /Gs turns off stack oflo checks +LDFLAGS= /Fm /F 2000 # /F hhhh sets stack size (in hex) +# In particular: +# Add /DMSDOS if your compiler doesn't automatically #define MSDOS. +# Add /DHAVE_GETOPT if your library includes getopt(3) (see jcmain.c, jdmain.c). +# /DMEM_STATS is optional -- it enables gathering of memory usage statistics. + +# compression objectfiles +COBJECTS = jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jrdgif.obj jrdppm.obj jwrjfif.obj \ + jutils.obj jvirtmem.obj jerror.obj +# decompression objectfiles +DOBJECTS = jdmain.obj jdmaster.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.obj \ + jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj jrevdct.obj \ + jrdjfif.obj jwrgif.obj jwrppm.obj \ + jutils.obj jvirtmem.obj jerror.obj + + +# inference rule used for all compilations except jcmain.c, jdmain.c +# notice that objectfile is also inserted into libjpeg.lib +.c.obj: + cl $(CFLAGS) /c $*.c + lib libjpeg -+$*.obj; + +# these two objectfiles are not inserted into libjpeg +# because they have duplicate global symbol names (notably main()). +jcmain.obj: jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c + cl $(CFLAGS) /c $*.c + +jdmain.obj: jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c + cl $(CFLAGS) /c $*.c + + +jbsmooth.obj: jbsmooth.c jinclude.h jconfig.h jpegdata.h + +jcarith.obj: jcarith.c jinclude.h jconfig.h jpegdata.h + +jccolor.obj: jccolor.c jinclude.h jconfig.h jpegdata.h + +jcdeflts.obj: jcdeflts.c jinclude.h jconfig.h jpegdata.h + +jcexpand.obj: jcexpand.c jinclude.h jconfig.h jpegdata.h + +jchuff.obj: jchuff.c jinclude.h jconfig.h jpegdata.h + +jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpegdata.h + +jcmcu.obj: jcmcu.c jinclude.h jconfig.h jpegdata.h + +jcpipe.obj: jcpipe.c jinclude.h jconfig.h jpegdata.h + +jcsample.obj: jcsample.c jinclude.h jconfig.h jpegdata.h + +jdarith.obj: jdarith.c jinclude.h jconfig.h jpegdata.h + +jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpegdata.h + +jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpegdata.h + +jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpegdata.h + +jdmcu.obj: jdmcu.c jinclude.h jconfig.h jpegdata.h + +jdpipe.obj: jdpipe.c jinclude.h jconfig.h jpegdata.h + +jdsample.obj: jdsample.c jinclude.h jconfig.h jpegdata.h + +jerror.obj: jerror.c jinclude.h jconfig.h jpegdata.h + +jfwddct.obj: jfwddct.c jinclude.h jconfig.h jpegdata.h + +jquant1.obj: jquant1.c jinclude.h jconfig.h jpegdata.h + +jquant2.obj: jquant2.c jinclude.h jconfig.h jpegdata.h + +jrdjfif.obj: jrdjfif.c jinclude.h jconfig.h jpegdata.h + +jrdgif.obj: jrdgif.c jinclude.h jconfig.h jpegdata.h + +jrdppm.obj: jrdppm.c jinclude.h jconfig.h jpegdata.h + +jrevdct.obj: jrevdct.c jinclude.h jconfig.h jpegdata.h + +jutils.obj: jutils.c jinclude.h jconfig.h jpegdata.h + +jvirtmem.obj: jvirtmem.c jinclude.h jconfig.h jpegdata.h + +jwrjfif.obj: jwrjfif.c jinclude.h jconfig.h jpegdata.h + +jwrgif.obj: jwrgif.c jinclude.h jconfig.h jpegdata.h + +jwrppm.obj: jwrppm.c jinclude.h jconfig.h jpegdata.h + + +cjpeg.exe: $(COBJECTS) + cl /Fecjpeg.exe jcmain.obj libjpeg.lib $(LDFLAGS) + +djpeg.exe: $(DOBJECTS) + cl /Fedjpeg.exe jdmain.obj libjpeg.lib $(LDFLAGS) diff --git a/makefile.mc6 b/makefile.mc6 new file mode 100644 index 00000000..b9ca60f4 --- /dev/null +++ b/makefile.mc6 @@ -0,0 +1,79 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for Microsoft C for MS-DOS, version 6.x (use NMAKE). +# Thanks to Alan Wright and Chris Turner of Olivetti Research Ltd. + +# See README and edit jconfig.h before saying "make" !! + +all: cjpeg.exe djpeg.exe + +# compiler flags. -D gives a #define to the sources: +# -O default optimisation +# -W3 warning level 3 +# -Za ANSI conformance, defines__STDC__ but undefines far +# and near! +# -D__STDC__ pretend we have full ANSI compliance. MSC is near +# enough anyway +# -DMSDOS we are on an MSDOS machine +# -DMEM_STATS enable memory usage statistics (optional) +# -DHAVE_GETOPT library has getopt routine to parse cmnd line options +# -c compile, don't link (implicit in inference rules) + +CFLAGS = -c -O -W3 -DMSDOS -D__STDC__ -DMEM_STATS + + +# compression objectfiles +COBJECTS = jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jrdgif.obj jrdppm.obj jwrjfif.obj \ + jutils.obj jvirtmem.obj jerror.obj +# decompression objectfiles +DOBJECTS = jdmain.obj jdmaster.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.obj \ + jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj jrevdct.obj \ + jrdjfif.obj jwrgif.obj jwrppm.obj \ + jutils.obj jvirtmem.obj jerror.obj + + +# default rules in nmake will use cflags and compile the list below + +jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h +jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h +jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h +jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h +jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h + + +# use linker response files because file list > 128 chars + +cjpeg.exe: $(COBJECTS) + link /STACK:8192 @makcjpeg.lnk + +djpeg.exe: $(DOBJECTS) + link /STACK:8192 @makdjpeg.lnk diff --git a/makefile.pwc b/makefile.pwc new file mode 100644 index 00000000..f41dd480 --- /dev/null +++ b/makefile.pwc @@ -0,0 +1,100 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for Mix Software's Power C, v2.1.1 +# and Dan Grayson's pd make 2.14 under MS-DOS. +# Thanks to Bob Hardy for this version. + +# See README and edit jconfig.h before saying "make" !! + +# NOTE: make sure you have converted end-of-line markers to CR/LF in this file +# and in the three mak*.cf files; otherwise pd make and the Mix linker will +# choke. Power C doesn't seem to care whether end-of-lines are CR/LF or just +# LF in the *.h and *.c files. If you blindly converted LF to CR/LF in ALL +# the files, then you broke the test*.* files, which contain binary data. + +CC=pc + +# You may need to adjust these cc options: +MODEL=m +CFLAGS=-dMEM_STATS -dMSDOS -m$(MODEL) +LDFLAGS= +# In particular: +# -dMEM_STATS is optional -- it enables gathering of memory usage statistics. +LDLIBS= + +# miscellaneous OS-dependent stuff +# linker +LN=pcl +# file deletion command +RM=del +# library (.mix) file creation command +AR=merge + + +# compression objectfiles +COBJECTS = jcmain.mix jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jrdgif.mix jrdppm.mix jwrjfif.mix jutils.mix jvirtmem.mix jerror.mix +# decompression objectfiles +DOBJECTS = jdmain.mix jdmaster.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jutils.mix jvirtmem.mix jerror.mix +# These objectfiles are included in libjpeg.mix (all but jcmain, jdmain) +LIBOBJECTS = jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jrdgif.mix jrdppm.mix jwrjfif.mix jdmaster.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jutils.mix jvirtmem.mix jerror.mix + + +all: cjpeg.exe djpeg.exe test +# By default, libjpeg.mix is not built unless you explicitly request it. + + +cjpeg.exe: $(COBJECTS) + $(LN) $(LDFLAGS) @makcjpeg.cf + +djpeg.exe: $(DOBJECTS) + $(LN) $(LDFLAGS) @makdjpeg.cf + +# libjpeg.mix is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.mix: $(LIBOBJECTS) + @$(RM) libjpeg.mix + $(AR) libjpeg.mix @makljpeg.cf + +clean: + $(RM) *.mix cjpeg.exe djpeg.exe testout.* + +test: + @$(RM) testout.* + +djpeg testorig.jpg testout.ppm + +cjpeg testimg.ppm testout.jpg + fc testimg.ppm testout.ppm + fc testimg.jpg testout.jpg + + +jbsmooth.mix : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.mix : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.mix : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.mix : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.mix : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.mix : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.mix : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jcmaster.mix : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.mix : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.mix : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.mix : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.mix : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.mix : jdcolor.c jinclude.h jconfig.h jpegdata.h +jdhuff.mix : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.mix : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jdmaster.mix : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.mix : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.mix : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.mix : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.mix : jerror.c jinclude.h jconfig.h jpegdata.h +jfwddct.mix : jfwddct.c jinclude.h jconfig.h jpegdata.h +jquant1.mix : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.mix : jquant2.c jinclude.h jconfig.h jpegdata.h +jrdjfif.mix : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.mix : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.mix : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrevdct.mix : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.mix : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.mix : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jwrjfif.mix : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.mix : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.mix : jwrppm.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.unix b/makefile.unix new file mode 100644 index 00000000..0f11afa4 --- /dev/null +++ b/makefile.unix @@ -0,0 +1,152 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is suitable for Unix-like systems. + +# See README and edit jconfig.h before saying "make" !! + +# Comment out this line if you don't have gcc: +CC=gcc + +# You may need to adjust these cc options: +CFLAGS= -O -g -Wall -DHAVE_GETOPT -DMEM_STATS +LDFLAGS= -g +# In particular: +# Remove -g and -Wall if not using gcc. +# Add -DBSD if on a pure BSD system (see jinclude.h). +# Remove -DHAVE_GETOPT if you don't have getopt(3) (see jcmain.c, jdmain.c). +# -DMEM_STATS is optional -- it enables gathering of memory usage statistics. +# You may also want to add -DTWO_FILE_COMMANDLINE or -D switches for other +# symbols listed in jconfig.h, if you prefer not to change jconfig.h. +# If your compiler is non-ANSI, also see the .c.o rule below. + +# On HP-UX (and probably other SysV systems) the alternate malloc(3X) is a lot +# faster than the standard malloc; this makes a noticeable difference in the +# startup time when handling big noninterleaved images. I say "-lmalloc" to +# get the alternate allocator. On most non-SysV systems you can just +# define LDLIBS as empty. +LDLIBS= -lmalloc + +# miscellaneous OS-dependent stuff +LN= $(CC) # linker +RM= rm -f # file deletion command +AR= ar rc # library (.a) file creation command +AR2= ranlib # second step in .a creation (use "touch" if not needed) + + +# source files +INCLUDES= jinclude.h jconfig.h jpegdata.h +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c \ + jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c \ + jdarith.c jdcolor.c jdhuff.c jdmain.c jdmaster.c jdmcu.c \ + jdpipe.c jdsample.c jerror.c jfwddct.c jquant1.c jquant2.c \ + jrdjfif.c jrdgif.c jrdppm.c jrevdct.c jutils.c jvirtmem.c \ + jwrjfif.c jwrgif.c jwrppm.c egetopt.c +DOCS= README architecture codingrules +MAKEFILES= makefile.unix makefile.amiga \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk \ + makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) ansi2knr.c $(SOURCES) $(INCLUDES) $(TESTFILES) + +# compression objectfiles +COBJECTS = jcmain.o jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ + jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ + jrdgif.o jrdppm.o jwrjfif.o \ + jutils.o jvirtmem.o jerror.o +# decompression objectfiles +DOBJECTS = jdmain.o jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ + jrdjfif.o jwrgif.o jwrppm.o \ + jutils.o jvirtmem.o jerror.o +# These objectfiles are included in libjpeg.a (all but jcmain.o, jdmain.o) +LIBOBJECTS = jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ + jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ + jrdgif.o jrdppm.o jwrjfif.o \ + jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ + jrdjfif.o jwrgif.o jwrppm.o \ + jutils.o jvirtmem.o jerror.o + + +all: cjpeg djpeg +# By default, libjpeg.a is not built unless you explicitly request it. + + +# If you have a C compiler that doesn't understand function prototypes, +# uncomment the 5 lines below and make sure PROTO is not defined by jconfig.h. +# Then say "make ansi2knr" before "make". + +#.c.o: +# ./ansi2knr $*.c tmpansi.c +# $(CC) $(CFLAGS) -c tmpansi.c +# mv tmpansi.o $*.o +# $(RM) tmpansi.c + +ansi2knr: ansi2knr.c + $(CC) -o ansi2knr ansi2knr.c +# You may need to add one of -DBSD, -DVMS, or -DMSDOS to the line above. + + +cjpeg: $(COBJECTS) + $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) $(LDLIBS) + +djpeg: $(DOBJECTS) + $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) $(LDLIBS) + +# libjpeg.a is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.a: $(LIBOBJECTS) + $(RM) libjpeg.a + $(AR) libjpeg.a $(LIBOBJECTS) + $(AR2) libjpeg.a + +clean: + $(RM) *.o cjpeg djpeg libjpeg.a ansi2knr core tmpansi.* testout.ppm testout.jpg + +distribute: + $(RM) jpegsrc.tar* + tar cvf jpegsrc.tar $(DISTFILES) + ls -l jpegsrc.tar + compress -v jpegsrc.tar + ls -l jpegsrc.tar* + +test: cjpeg djpeg + $(RM) testout.ppm testout.jpg + ./djpeg testorig.jpg >testout.ppm + ./cjpeg testimg.ppm >testout.jpg + cmp testimg.ppm testout.ppm + cmp testimg.jpg testout.jpg + + +jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h +jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h +jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h +jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h +jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h diff --git a/makljpeg.cf b/makljpeg.cf new file mode 100644 index 00000000..3325bf44 --- /dev/null +++ b/makljpeg.cf @@ -0,0 +1,5 @@ +jbsmooth.mix,jcarith.mix,jccolor.mix,jcdeflts.mix,jcexpand.mix,jchuff.mix +jcmaster.mix,jcmcu.mix,jcpipe.mix,jcsample.mix,jdarith.mix,jdcolor.mix +jdhuff.mix,jdmaster.mix,jdmcu.mix,jdpipe.mix,jdsample.mix,jerror.mix +jfwddct.mix,jquant1.mix,jquant2.mix,jrdgif.mix,jrdjfif.mix,jrdppm.mix +jrevdct.mix,jutils.mix,jvirtmem.mix,jwrgif.mix,jwrjfif.mix,jwrppm.mix diff --git a/testimg.jpg b/testimg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b6b68bc7bee62b012c9937c09df2f63819125b0c GIT binary patch literal 3583 zcmbW3dsLIxmcTy*9|%+tQ3+5hU~G9-AVfvWwU%f^s$df!fUJs%B=Jj>S45HATLr6> zvH*dBjCGJlB_9cfN5VUEMII5Nf&_$*Bo~CJ!6XVohx^?T;pEAYq#v$dw88w)Q{^uE^Q6`OHtJZ&u@8u zb&ei+?-g`5^(Whn+qUm;LF`8E`SL68U{nZt-~Izfz6-}3J%&Ag`Uf07CN_?ce2z#u zpF*ajrDtR^E@xf2ej_*U=Fhio7nj^AEi3=Gipu-dHMMoWKd5InHMg|#1#Rsek9r^X z^$!e+o{YX2lZ;QioSd4OeKj|)c>U(B^26fN$K@66s_xStTvmYfKd>z8KfwNl%hAHM z#>U3lX8j*rR%;lRY3*pUcGuo@TMkF9|M8NON8n#JZ2h*ViuYGr&!Fh{&Sz6cHg59@ zp4t835469N{qMkj`hSuA571BZ~LCWOu{(>hU`2)!HfHg3s_o@oWC83*X(paJW8eG)LD}Mw(*F`%WpN zpvX-hvSI2beH8xFF}2@RB)ca9)VJ~uh~_4_DmY$2;@p4gLp|$$JZyI|Y={VNY5|d& zu7_M@Ni4`gs7wgos$#OgOV1LRWXNPk$PlAmna|mccfA4=vM4Z)c?)``XakSLw!sJ} z2%Hl3o++AjK@1!&5wYHVV5>+;UGjIFEX{S0uyl&-!tgeTJGeRXL0<~Vr!>LwsOIJZ zX8tOaxV=!JgZ3Ax|-CN-tr#`%}b(HYY8$oQG6 z>RvBU-=Rc;P#ikV?<+(&GD}@gU2%uvzE*x7fwe|KSWgLaM7j)r=k9D8{&?W? z75c^ov>kGxup)=<&!x&vTec8Y`$oC6(f3;U$Xt zmdggs0eZlYE|YBr9D*AflKs@!`s~r80u2aF(Lc4 zYBSKlT8%N5a$fDc{Dd~L-wYsvnUhNapG2k1zkO{6R&bksYLWBaQoZu|*d7Y&F?HqV z8G#u%O&RsJSlW6|6?H)LJ6mMKDrM%?^>F)UUe!MB*f)OHLq+HvT^^*B8_%juDr%PO ztWo&{IhwzVL;^WcqD8Kn+DPwE!Tb8{kY z^*rMz6O(Kq>1Ot9Uh4g zz4}rU(hQUp7?pFH^fpo#j9?oicZ|BpyXlP^57kBWM~0*7=OP(eLK|xtPM5rh z%ux7GZl}hC<_LSFxNwxG?-9kXH^-s_nW!XJmCL>_}fo;3PweMNSk9;TL^ zlpXrg2NSaQ$L8XY#krz$W`HEv<}BdpJIN2@*kYryaW?VW(D;yoct!o&R90uxK{N39 z)6I$?3@5>m>HAzKztZ?UCs^#sbf%Ion&!)Cn#!tBC$H(-Ar5rvrcaR_YN;XYN=^G1 zXNI(xqtQ~MQ&f2H1$SzG*$g1DU4w)UzwJ)zUb|#%Nf5cuT`hY^OQv^f*;Gu)YRo(o zN%!wCUP8)=m z(~j!<7EL5PClZyMw{r#*_MPHzx+t7I!*I?53Tu>#I~6)yjz$li{vL7WJ6t_8b5Gc; z$deuP`57YTc zNK|pyUgms($>heB)HR9gQeme3EuJQhl|{ptIh=d;-u!MMPcfFYWe)1WL5k-on%dMv#yBgOD$F0qrE z%R2mPXx%hip0S(Qo|b>r@eO`4F#(HyKM~uM6-v2Vvls4%Hmd58pg0b@kai67q_5sm zCi}X(^m5dJtO^{2RAVTm^^q^3v`cYmSUi$m2@TknZ+9GU13iPTNw~K!9rYtOzokYn zku^porlGT(A#SIZjyGr{?Zw)f$_OaW4AfDzR5sW!B9JAmF!N1o ze^}lzSGnIasghg@;)J;jw3z=NPCV91p@6(s>aD_?fdR;0@li@8my;?ng~l>&M%|d- zIpbVvpc&{)^rRs2Se{u$gCpahx*at!B%oND95KCgL>m0tyFB=Zf(l%Z#WJPwgxtH8 z)X!`7IR?d)(@R>Z`@M+wUp9u)2%AzU^`1Sy2w9y9&b-qvp!b9DgJX z(6WE|1@6I3%cW3E^R>MGQ0LZIwX33{XDKGpU7d=jj2{|OIr(JE7q(L^PQAeVQ6H@c zJoiUt;MvJiMz;K2ql~UsR#P)^NdXF?bl%eJ%Ziy-jS}_;Rc<+5?8ammYYUhwWQ1V< zwp!7IrIA`xt{U%Yg;QKo8LRHj5w0y2smzeS-zw^rRZ_;zlUG3^K zX@}+Sy+=ZAQ^?WG7ENq5Enu1J9_H)V2WaLU1a)-JqNjmwmrNA^+j5@;?#9w}OGgHND zG+jS6z{ghhlM%-hZ8y{JJ%Z!aoYT}>ehO;d^bq4x5Jo7)>8KldUFqnm(1_EiDWIb8 zLJ<@bR8J0J1|3B}%w~Lz#8R*Wn`q0sP0Oj+-)?v&Z&MEpmCUn+!OXtXXOwnEWnbIa zH(GJ@{g=P*yN|U*ZV8_~u~8U=!h-fwwWGbCNk}H7zO`y+ZgLxMsd6D>4Ac)Ym=5XR z=AZXn@V^=6{-{Nk>;oos@>zRe%_5Y<]@ _E*_E*VC2S@/N@5OA6J;6G83N<8]KGqZTs\ViLFY<6cS{kᨔéɱƴϪtfcUZHfTȌr찖ؾջжʰʯγҷӸȬͱɭz}~uo~jz{hɨ~h}g|zzszf\ZTJHbPFm[QnWGdM=O8_Hw`tǙΠҥըҧӨөԪӬԭհհҶѵѴϲϮέϪΩǜęzrn~l}kr{nviqdp`qasbtct^pZjReM_FV=vL3mC*_@!cD%cH-bG,XC2T?.O>4P?5G83C4/H62UC?hQKlUOeJCW<5^Oufܢʰ®ɵΨvfcSZGeRĆmᣊѷͳɯΧɮеɭ˯ɭ~}zrlvb}lƥu_~h{{ɽŹ`UQRGCeQFq]RqVEfK:T=iRmƖ˝͟ҥثԩժի׭֯رسٴչԸԷҵұѰҭѬХˠǘ~wuuv}zwtqrsum~iybt]pWhO^EV=kH*nK-lL3hH/ZC3U>.O=3O=3E61?0+@.*I73[D>bKE`E>W<5UCfTʎvߣȭîˢvdbPYDdOcԔxƬŪŪƫʯβͱʮ¦|wp~kr^nģzhsζnefSF@NA;dM?mVHqU@mQ<]Ft]zРϡ̞ҥڭ֫׬خڰٲ۴ܷݸؼ׻׺ոմӲհԯ֫Хʛ“zzÎ|Ő~~|~vrlh{cs[jRbJ|S7}T8wS;oK3_C5W;-N:1N:1G51@.*;)%@.*P93XA;Y@9V=6L8WCvZňlvr{ǝ|vdaO[BfMz\ȇitvϴѶͲγչϳ̰ƪ}¯Ǯ|un}jwcnƥy{ʵnefWNON?8QB;bH7eK:qQ:zZCjSiʚեѣ͟Ѥ٬׬حٯ۱۴޷ߺߺھٽػֹ׶մֱֱ׬Ѧ̝ĕÐ}Ð}Ƒȓ‘ÒxuolhxaoXhQ]D\CYCxN8dB6Z8,N5.N5.J73B/+:'#;($D0)M92S<4S<4J4RdG5dG5uQ7cIybr̜ԤҤϡѤ֩֫׬خ۱ܵ޷໫໫ھٽػֹ׶մֱֱ֫ҧΟșǔƓȓɔÏÏÏĐĐĐőőyvqok|et]mVhQeN^JP*#;' 3$/ ,,. /!J7\I΃l鞇ؾٿ˱{sāgłhɀ_}\zɣs|v˰γyŝ¨˱ͯxtȡyi}mƤ˴һÿ]caGID;=8C5*PB7rM:_LsYpĘƚʞ΢ѧөԫԫϩѫүֳشڶطط޸޸߷޶ݳڰج֪ҤѣϠ̜͞˛͚Λȡɢˡˡ͟˝̘˗˓ɑȍ{ĉwƒqm|jzhvWpQdJP6i@.[2 L.#L.#>*#;' 3$/ ,,-. I7P>pY׌uγպγèǒt|czaxXwWyy~efϵ}hɮͲt{Ûūͳϱyu{vfoǫʮͺľcghLPQ?>:984G5)SA5tN9ePdΛ~Ǜʞ͡ҦԪ֭֬׮ѫӭӰֳشڶططݷݷ޶ݵݳٯج֪ҤѣϠ̜͞͝ϜϜɢɢˡˡ̞ʜ˗ɕ˓ɑȍ{ĉwƒqm|jzhrSlM`FM3e<*W.H*H*=)":&2#.,,-. G6D3^G|eŧΰͰŨ˓rs[mUnNoOynjQlSδ}sγ˰wk~tūͳͯ~vsstdtϻɼ{zooqqqsA<9@;8O9,WA4uM4fMc͛zɝ˟΢ҦԪ֭֭֬ҬԮղ״ٵڶط׶ܶݷݵܴܲٯ׫թҤТϠ͞Ξ͝Нўɢɢˡʠ˝ȚʖȔʒȐnjzÈvp~l{iygoPhI\BI/a8&S*E'D&<(!9%1"-++,-L;D3YDydť˫˫ƦΓpjSaJcDgHzofM]DjxsϴǬwkwšĪ˱ɫ~yrpqueyƪû÷zuyA64D97T:-[A4yR5oRc˙tɝ˟΢ҦөԪԫԫԮְֳصڶڶ׶׶ܶܶݵܴ۱خ֪ԨѣТСΟϟϟҟӠɢɢˡɟʜǙȔƒǏ~Ǝ}ĉwsn|jxfwelMfGZ@|F,_6$Q(B$B$<(!9%0!-**+,RBJ:cNքo̪˩ʩȧҔpeOYC]?eGmiaHoM4|bIpWrZzbʯŪv̤ĪʰȪ{wp}nvyi˯ŭëĿ¼VLT<,,A11R5'_B4\>bǘnϠvʞ̠ϣҦөԪӪӪְزصٶڶڶ׶׶۵۵ܴ۳ڰ׭թԨѣТСϠϟРԡբʣɢˡɟɛŗƒĐČ{Šyto|jxftbsakLeFY?{E+^5#P'A#A#;' 8$0!,))*+PAK=!:-)"!G,@%K1[AybqūɹȪ{fvWmP̓fĘ{q|~{ufuhm`yktuɲȭ{ywɺŹ÷źsmE2,N2&W;/yTA|iÙΤҤӥددٰ۲۵ܷܷܶطٸٹٹظֶҵѴ׬֫ժժԩӨҧҧҧҧѦХϤϤΣΣИϗ̕ɒ~ƍz‰vpoh|ew^rYmSjPhNgMe@^9S4zC$e5!W'E@=!:-)"!B*B*R:fNćt՘ɪͮȷƬoawWŊjk~alhkW`LqWHY?0nXKdNAw`Ryuuȱʯ|xtȹȼĸũlYSJ71I-!^B6dQvʠө֨Ԧ۲۲ܳ޵ݷ߹ߺߺڹۺںںظֶҵѴӨӨѦѦѦҧӨӨҧҧҧҧХϤ̡͢ϗ͕ʓƏ{Êwsmkybw`rYnUiOfLdJdJc>\7Q2zC$e5!X(G!B=!:-)"!@&I/aJzc۞뮜׶ЯDzūvdtS`uXvYohwXD]>*T:+J0!_I<]G:v_Qz}{ǰɮ|yuy~˿¶DZsu_LFS@:G+fJ>r_ͣԪتשܳݴ޵߶߹ລ໨Ἡܻܻܼۻٹ׷ҵгҧѦϤϤϤѦӨժҧӨӨӨѦϤˠɞΖ̔ɒ~čytpj~hu^r[oVjQeKcIbHbHajMwwyZFS4 R8)[A2`J=l_ĭĩ}~ʱοô¶̲wy}xe_Q>8eI=pdŠȞͣש٫ܳܳݴ߶޸߹໨໨߾߾޾ݽں׷ҵгحժҧϤΣѦԩ׬ҧӨժ֫ӨΣɞŚ̔ɑƏ{up~kzdxbqZoXkRhOdJbHaGaG]8W2N/yB#f6"\,L&H"=!:-)"!D$E%F+N3r`ș̬ǧϮҪǟǓ~p[K2H/gJrU~~cOY:&T:+Z@1dNA|o|ì{~Ӻȹĸأn[UO<6uYMuơʥƜʠէت۲۲ܳ޵޸߹ߺߺ࿮࿮߿ݽں׷ҵг۰حԩХϤѦԩ׬ҧԩ֫֫ӨΣȝŚ˓ɑŎzto}jxbv`pYnWkRhOdJbHbHbH\7V1M.yB#f6"\,M'I#=!:-)"!VSWTYR^Wp_uƢүүvhe[g]wj{nvxj_;-U4%hYp`pup|éȮʮųùǯzxkI?mKAj]wjv}‘˛ե֩ثٯ޴߶෣޸޸⽭㾮Ὧ༮ܺٷյӳح֫ԩӨҧҧӨԩ֫ԩҧХ̡ʟǜƛƎ}Č{vrm|iycwar[qZpWmTiOgMeKdJZ;T5M1E)x@'n6[.S&E#?/, ')'&yyw~}}wʧΫv~t{vyvrN@jI:yjtwfsɯƬȬúønljH>iG=obwj}npqv͝ը֩ثۮܱൢḦ仩޹޹ݹݹضִӱѯح׬ժӨҧӨӨԩ֫ժӨХ͢ʟȝǜǏ~ō|‹wsn}jzdxbt]s\qXoVkQhNfLeKZ;T5M1F*yA(p8]0U(F$?/, ')&&ЩϨϩΨʦß~ƣʧĠbT|[Ltuzizé˱Īƪ˹˼Ǥxvx`^rPFzXN{n|ozkufqcugu͞͞Ρҥժ۰߶⹧ٲڳڴٳ׳ձѯϭٮ׬ժԩӨӨԩժ֫ժӨХ͢ˠȝǜɑǏ~čyupl|fzdw`v_t[qXlRiOgMfL[%d7$]0I'B 2.()&%ٿջؽڿеӸòڻҳΫɦǟԮҬݞ}}n~sctd{j~ūԺɯ¨¦Ӻȶӫkig]řĘē{~prdj^g[yfo{Ϝ֥کګ٪׫جٯ۱ٱذׯ֮گٮ׬ժԩժժ֫ح׬ժҧϤ̡ʟɞΖ̔ɒ~čyuqjizcybv]rYmSjPgMeK[TC^Mm]}m~ɕΜОҢեרة֪֪ܱگح׬֫֫׬حٮح֫ӨХΣˠʟӛљΗʓƍz‰vpnxav_sZnUhNdJ`F^D[+O-!G%7 0)*&$ѽǪæʩѰϩĜ׵ضǦʪxz[FgqäʫʫƦ¢¦ǾҸ~afejnhrl‰~}Ƅv€r|lwgqbn_YRTMJ@FbSmГ͔јѠԣϤХЫӮبק֦֦֦ק٩ڪ֦֦֦֦ԤҢϟΞљϗ̕ǐ|Êwslk{dxasZmTgMcI`F_EYSDjXweŠyϗРѡ͡΢ףףףؤף֢աԠҞѝϛ͙˗ʖʖʖ˓ɑƏ{Ìxtpjiybv_pWiPaG\BX>W=YyTN]WxwpfX^PXEdQva…pɏ{ϕқԝʐ|̒~ϕЖΔɏ{Ċvrl}ixds_r^s_vbxdwfvet`r^o\lYjTiSmVkTgNdK`F^D]C]CYcEE\>>ZAGbIOsYXml}ywol^j\]NeVvdńrʑј͜͜˙xȖuɒsȑȑsNJn€hyauanZfSaNdNfPfPeOcSdTeSeScPaN_J^IeOeOdMbK^F\D\A[@S>R=O8J3|F*v@$l=i:[8T1?)5$ +#  !"ϷѶػˮɨέɦǗԫլǧĤɯҸ͸ιкͷͱͱӳ׷ظҲĬôȿĖɿupscfV[RVMpPQgGHcJPjQWoUTedtq{xrjkcdVdVaRiZygdžtʑϖɘɘ˙xȖuɐsǎqɋrÅl|fu_lXdP\HUAT?S>S>~Q{P?}R?}R?M8O:P:O9~K0wD)l?"h;\7U0C*9 +) ( #$ ˳zsŨȫƥŤ}yÓد෱ͭūؾ˶̷ͷʴʮȬήѱͭ׷׿{Ѷ˻͵ǡӢ~}opgh_`b{WYwYaaionrqolkh`X\T[M^PbSk\|jʉw͔Зɘǖ̔yȐuÊoj~iu`iWaOR@I7s@-j7$]4 Z1R/O,E*#E*#F)!H+#K-%N0(R1(T3*W5)Z8,`<.eA3jE5kF6lE6lE6pA-sD0xH2zJ4zH/vD+m?%i;![5V0E*-f7%_0U2T1M1J.G,%F+$E( E( G)!H*"M,#O.%S1%V4(]9+a=/d?/c>.c<-a:+`5"d9&k<(o@,rB+qA*m?'j<$[5 V0G*?"1.))ӻ~Ѩ弶ٹƦ¨ѷɴʵʴưũçȨ˫µӳ˳͵ͤżDzooƛ͢Л͘|{npimfkojns|}zspd\\TTFQC[LfW{i͌zӚ֝Ϟ̒͜|ŋuoyfn]aPSDI:r=-k6&Z1V-P1R3L6!J4P/&O.%L,!K+ L*N, T0"W3%\7'`;+f?.jC2nC2lA0h=*f;(]4"_6$b7$d9&h;&i<'h;&h;&]4"X/J*C#62-,̴Ǭ{{w{™߶ݽʪéϵ͸ιθʴȬƪ˫ήٹϯƽ¥IJ|}͡ϣӛҚ{ymoilfmqnrx~zwnfd\XJRD^OiZ}kώ|ԛ՜̛ɘ͐}ƉvnuchYZKL>|A3i5'c/!R+O(I.L1F5!E4 U/"S- Q,Q,T-X1 _6$c:(k@-oD1xI5}N:P:~N8zJ3wG0c>,b=+b9'`7%b5 c6!c6!e8#\2"Y/L* F$9 4.-սԹĩģ~ssosoٰ޾ήĪͳѼҽҼͷ̰ɭήѱƦʪĵ¹~{΢͡ҚΖxujlficjnkovyqog`RWIbSm^oѐ~ӚӚɘŔ̏}Ɖw~lsaeVVGG9x=/b1#\+M(J%D+G.A2@1U+S)S*S*X-_4!h;&l?*vF0{K5R;XA[CZBWPJJ@KAP@YIaHaH]=Y9VW=T:}M6uE.n;(e2[,W(L%M&D(C'7'2"( %ؿŰ}ǩۻ̬ ŕ~t{q˟ƜҬѰֵ׺׺Ҹδ˴̵̬Ȩʲи~{|¼Ȼڟय़ߡؚΛȕ}rqih`\]YZ`WaXd[jarh{qyÉ~ÊʑӝܦܨףϛɕɄtzjlZ\JR=wC.c9#Y/N(O)P)R+W-Y/!\0#^2%`;)e@.wQDgZphmeickenhe_[NUHUAWCZ@[AW/pK.qL/tL2rJ0rE0l?*f8(c5%V,T*J(E#9!5/-ҵƩ¤ĦȨĤɧѯϫ˧׳ЬžЬֲֲܸܸϫʦȤƦ˫ɺlchȚ͟ڙ٘ܜߟҡҡʤȢ̜ȘϏ͍ˋˋʊɉĈ~Ç}ˆ}|ʑјآިު֢͙ƒwgiYWEF4r>)i5 ]3Y/X2_9&hA0oH7qG9kA3d8+^2%Z20]53dECuVTq[]gQS\LM\LMsa_n\ZoSOkOKpH@iA9h6+a/$`? cB#hE)kH,nD.kA+i;+e7'\2$Y/!P+"J%>":43ؿˮťʨ̪ұ¡âЯέßʦѭڴܶزҬͧ˥ϯ̬͵ȹ~zqv|Ǿ˛˛ۗޚߜߜѢСȣǢ̞̞ӘӘՕёˋƆ}†|Ĉ~Ǎʐҙ؟ݧ᫟ުԠɕn^`PM;|=+j6!d0Z0X.X2`:'mF5vO>zPBuK=mA4f:-lEFjCDkMOtVXgWXYIJJABI@A]QQYMM\DBYA?b;6^72_-&Z(!P3U8^< dB&kB,jA+j<,g9)]1$Z.!Q+"L&B$@";";"׾ֽ¥yovɩ̪ǥٹǧͬЯȤĠ̨ױ۵ڲխѩШں˫иɿ|mjxotxu|εÑٓ✚㠗ߜѢϠǢŠȜɝԙ՚Ғˋx{r{qyɏЖڡড়㭡寣߫ӟƒ}gWYIF4u6$d0a-X.W-U/_9&nG6zSBVH|RDtH;l@3}VYsLOeHLeHLWHKPADJFGRNORIJMDEO:9K65V0-V0-[($Y&"H+ N1V7_@#gA*gA*h=,e:)\0#Y- Q+"L&F%F%C(!C(!ϺnkpmʤФʞدͤɡ̥֮Ƥ̪ҳԵҴϱ˱̲ŷ}~yz|rdsv׻γèȗȗߘ㜖ٓҞҞˡʠϛ̘ԑҏɄuȃtÁuÁuċēȗ٬ڭܰݱ۬Οv}heQS?qA+g7!d:"f<$a<"]8d?%c>$pF.X@`J\FWCXDcP\I|VKrLA`LMaMNYS]\V`iis]]gQKM?9;>+$:' A'C)6! :%E*L1X4$[7'`6*a7+a2*_0(Z.%V*!O) M'I'J(̷˥ϣ˟׮Ϧ˜ĜШˤţʨбӴѳΰ˱˱ǵ˹zpbqē۔ߘߙܖӟӟˡɟ̘Ȕό̉ȃtȃt‚vÃwÊʑ˚Ϟ٬ۮ߰߰کʙpva_KP)h5 f9"h;$b=#_: d?%c>$rE.YBcNaL^J`LjWdQ^T}UKlWVmXWh^fkaipmvdajWNQE$?%9$<'D)J/U1#Y5'_5)`6*`1'^/%Z.%W+"Q+ P*L*L*ϺŰʤѫԨФӪѨƜĜƟ Ȧίҳвΰ˱̲ͻvfqwix¶ğwՎْݗݗӟӟʠȞʖƒ̉ʇɇwɇwŇzlj|ǐϘѢ֧ܯݰ౧ޯ٦Ɠ{gjVUBI6p<'j6!f9"i<%f>%c;"h@'g?&tG0[DfQgRdQgTp_kZf]aXcbfe~msqw~syrgmcUUPBBE1*<(!>"=!<'=(B'E*O+T0"\2&^4(\-#\-#Y-"X,!S- S- O.O.Կιǫͧױڮӧ̣Ϧǝĝţ̭Ѳвΰ̲ͳ˹w|lw}q»³Љԍٓݗѝѝʠɟ͙ʖюόϒΑʐˑ˖ҝզ٪ᴮ೭䲩߭֡|q^`MK9~C1q:&n7#j:$m='i?'h>&mC+kA)xH2ZDeQeQcQfTm_k]i^h]kipnyy}}vxlno[Z\HGO61C*%?#< ;%;%>"?#H$M)W,#Z/&X)X)W+X,T/T/P/P/Կȳѫج΢ěˢǝ{ĝĢ̭ѲѳвϵжIJótuscnuiwtƼǺψъ֐ڔΚϛʠˡҞѝۘڗמ՜ϚΙ͛ҠӦת縲䵯䯧ܧїsiWXFE3}@.t;(r9&o<'q>)m@)m@)tG0qD-{H3YDaNaN_McQgZfYf\f\kdpiwu{yrojgv]YeLHW<5J/(C&?"8"7!;<E J%S(W,#V(W)X-Z/V1V1Q1P0ιwtvϣƚȟǝ~ƟĢͮӴԶԶӹջñºƳxhiuep}o~u·ъԎ֐̘͙ɟ̢ա֢ߜܥ٢Ӡў͞ѢӦת縲Წݦњlj|uh^NO?@/~?.y>,x=+t@+t@+qC,qC,yK4uG0~J5YD`N_M^McRe[dZbYaXc[e]ickec]^XuTOiHCY:5N/*E("A$56;>!H#M("U*#W,%Z,\.!]2!_4#\8 [7U6S4͸DzvsriɝǛɠʠǠʣţϰն׹׹׽ٿ˹Ƹļ~pbqr§·ԍՏԎ̘͙ɟˡӟӟݚܙإ֣ѠПСԥתۮ䳮۪ӚŌymg[SDG8?/@0C1B0yB.xA-sC-tD.|L6wG1K7ZFcQeSdTiYkdhac[]UZQWNVLUKzOHwLElG?d?7W61N-(D'#@#57@#F)%Q+(U/,[0)\1*c5(e7*g<)i>+eA'b>$[<Y:Ѽũqhɝ΢ÚˢͣśȠΧΧƤбַغٻٿ´̻~vuvp{oap}Ǭ͆֏בԎ͙ΚɟʠМϛؕהբӠΟϠϣթۮ೭߮դ˒znb^RL=B3?/B2F4E3{D0yB.vC.wD/~K6yF1K7\HgUkYl\qarkngf_\USILB{G1nC0pE2lI-hE)`A"]>ؽؽֽռѽмͼͼϺɴƭŠæŤģşְƪͱ˸Ѿ˻֥}t_fltvahwhmɽǻːієӖӘ֛՝՝ҞҞޠڜ՛؞קݭݱ޲ᱥԤȐ}njW[HK4C,D/G2J5J5E0C.C.E0G2J5O:S>WB^IhSp[vmqhh_]TTII>xC5t?1rC3m>.b9']4"X3 U0N.J*L(L(O*S.]3#g=-sF3yL9}M7|L6}K2M4L2}G-v>#o7ؽؽֽռѽмͼͼѼDzΩ¥ŤŤşկ˰׼ƹ˾ëlswbit|nu||Œ̑іӖԗԙל֞ןԠӟޠ۝՝ؠئݫݮݮԤǗso`^KQ>E-?'F1I4K6I4E0B-B-D/J5N9R=VAYDaLkVr]vktioch\`RVHO@J;yH7tC2j?,f;(a;&_9$Z7!V3W0!V/ U.X1 b7&lA0xK6~Q"n8ؽؽֽռѽмͼͼԿɴytͨĥäȤ˧ƠÞЫ¡ʹĽ۶ɰ~rvxcjnu}zckmtŶ|uy|Ď̑͒ԗ֛֙ٞؠ١֢աڡ؟֞١ڥީ۩٧˗tfbTT@K7E+A'H3J5L7I4D/}@+~A,D/M8QN9K0H-J5K6L7H3B-|?*~A,D/N9QO:N2L0J5K6J5F1~A,}@+C.F1M8P;T?VAYD_JhSoZr_vc{hllzgvbr^nZgS_JWBR=L7{G1vB,L0~H,yC'wA%yC)I/R7W<\AWO8L-{H)G2G2F1C.~A,C.I4N9QJ:~C3v>1t/s@/vC2zE5~I9K;M=TBXF]J`M`LcOhUlYvfyi|jmm}kydwbs]r\oXlUiPgNeLdK^D]C\BZ@X?V=U=T.q6&k3&i1$e4%e4%f3"j7&r=-{F6M=SCXF\JaNdQdPgSlYp]~nononm|g{fwau_r[nWkRhOeLdK`F^D[AV.s8(n6)l4'd3$b1"b/e2!n9)zE5N>VFZH_MdQfSgSjVn[s`ppnnm}k|g{fwav`r[nWjQfMcJbI_E^DZ@U;Q8L3J2H0yC+v@(m='h8"a4^1[1Z0ͷͷ˶ʵŶŶµµƷDZ˵ϱñɻȷóͣaKWpXet\isr{u~}}͋}яχyҊ|яӑϕԚ֤ݫ㶱߲ڪ͝yse`NUCR.v>1u=0i8)d3$a.b/j5%xC3QAZJ^LcQhUkXkWnZr_wdpo}k{iygxfxcxcu_s]nWjSeL`G]D[BS9Q7N4J0G.C*z@(y?'o9!m7d4`0Z-X+U+U+ϹϹ͸͸ȹǸŸķĮů˳ݤjT`pZfrZglyzr~yist~ɕ̘Ґ̊|Ԍ~ؐؖٗЖϕ˙͛{zpj\_QUCP>H2F0D/B-{@0y>.w?2w?2k:+f5&b/b/j5%xC3QA[K_MdRiVlYlXo[s`xepo|jygwevdvawbs]q[mVhQcJ^E[BY@L2K1G-D*A(|>%v<$u;#k5i3`0\,V)T'Q'Q'ø·ĵôȱɲϱвɩήвϱĭ»ҿ亰tjrywgqzfqoz{jtrakv~riwҍҍԎؒנϘĔǗԘӗԉ|nwfm[`NUEM=J1s?2sB4uD6iE9^:.Y.Y.m9$|H3P9U>bHgMlToWp^r`wh|mzczczcybw`t]qZoXpYkTeNaJ_H[DU>P9F*D(B(>$}=$y9 p8!o7 b/a.Y.W,R+P)L(K'÷¶ijòɯʰΰϱ˫˫ǬȭŰȳǶȷ¾ÿǷҟvltueop{ualm\fnxzpx΋юՑؔқϘș͞؞Ҙ̓urhUcP[JQ@I8@/w<,t9)q<,o:*j9*h7(g9*j<-k?2mA4fB6[7+V+W,l8#|H3Q:V?cIhNlTnVo]q_vgzkybybxaw`u^r[oXnWlUgPaJ]F[DW@Q:L5F)D'A&>#y;"v8o7 n6_/^.Y.W,P+N)L(K'³ð¯Ƭǭ̬ͭҴ˭éɶ˾ͼ~rblt`kjVawfp{xnvu}ˋА̘͙֒ؔ͠ԧݥҚȁ}qmWDS@L:~C1s;*k3"c0`-_0 ^/Y/Y/Y4$]8(`<.c?1`<0V2&R'T)k7"}I4S,e4#^-Z,Y+P)P)N*O+O/ T4%W:,Z=/Z6*Q-!P%U*n:%M8W@\EfLiOlTmUkYkYn_rcr[r[r[qZoXkTiRgPcL^GXAT=R;N7H1C,@&?%}=$y9 q7!m3g3e1[-Z,S,Q*K)H&F&E%§ĤťƦǧͯȪ˶ľ¾ÿ¾״ófV`UALzfqujrvksДҖӕϑ̜ΞͤѨڦ֢ڗԑyik[VErA0a2"[,X-Z/N)M(J(K)K. O2$S7+V:.S/#N*Q&\1!vB-U@^GbKhNkQmUlTiWhVj[m^nWnWnWmVkTgPeNcLaJ\EV?R;P9L5F/A*~>%|<#x:#t6m4 i0b/a.W,V+Q+N(H(F&B$A#¡âģŤ¯ѾíſοҴبgWa{grkvzisrakujrЖїіϔ˞̟ɣ˥ӢԣޝޝŠ}zmbT}H:g6(^-[- ]/"S+!R* N) M(K+ N.#O1'Q3)N*M)V+f;+N9`KfOgPiOlRmUkSfTdRfWhYjSjSjSiRgPdMaJ_H]FXAR;O8L5I2C,>'y;$w9"t7"p3i2e.],\+U+T*L*J(E'B$@#?"žâèɸÿӸЇwzjt|hskZdyhr}͔̓ҙ֝ɜ˞ȤɥϠΟٚٚ̐xncWLyC9l6,b0'`.%Z.%X,#Q)!N&K&L'L)#M*$K'N*\1!qF6ZEkVmVlUkQmSmUjReSbPcTeVgPgPgPfOdMaJ^G\EXAS#="ǬϴļپȾtdnwcntcmãȏɐӚݤÙȞȤɥΟʛђђёȈxod[QI{@8k4-e.'_.)],'U(#P#J!J!J#J#J&N*`5%wL(t:&r8$l5!j3d1a.[-Z,T-T-P0#I)B'C(:&35">+%ÝƠģʵǾĿ½®Єyj_gpclxrblǷİȴ˯ƠȢ͞ƗϗƎ}Ŋz̑Ж͓̓Зؗ֕LjwradR_MXGN=t@2f2$Y)\,^2%_3&d:,nD6O?WG`NfTfTfTgRhSmWkUgPcL`G^E]D]D^?[ZFZJ^NcQeSdRdRfQiThRfPbK`I^E^E^E^EZ;W8T7R5R7O4I/C)G.E,C+|@(v<&r8"p6"n4 i2h1a._,X*W)R+R+H(H(F+"E*!5!-4!D1+ĩʷĿŽȽŒ]PYy{ĵŗ}{kjZ]PeXmekcc]_Yrm|Ώԕٚܝ՗ɋuffW[JYHXCS>R>WCZJ^NbPdRcQdRgRkVfPeOaJ`I^E^E^E_F[(t:$r8$p6"h1g0a.^+W)V(Q*Q*J*H(D) E*!A-&N:3p]Wy¨ж½¾½ÿüܩmae{os}nsdUZģ{qp^aO^QoblhTP>A:=F?MFXQg`rhtjpgjaRESFVEXGYGZH\J\J^F`HaG`F^E_FdIhMdGeHeF`AZ:X8Y9\<\@[?Z>V:T9O4J1H/{E-zD,uA,s?*n;&l9$j7$h5"\2$[1#Y.W,X*W)V*V*M(T/&J0/?%$:+2ZKRuʳվĿſÿњ}quo`egX]±xu|jucqdylvrhdVYMP90:1?5E;LCKBGPCTGZL\NV>ZB^F`H_FbIgLkPcGeIcG`DZ:W7Y9[;[?[?Y=V:S8O4J1H/{E-zD,uA,s?*n;&l9$j7$h5"]3%[1#Z/X-X*X*V*V*DL'E+*@&%=.5TELi^lujxDzº½ĽʿÈ}¶\MRo`eɸòvyÄrȉw΄w~q{wzvorbe@4<08-6+8-6+3)z-#v3+u2*n3+p5-p>7wE>}LGQLQY=XB7@6<2:26.q0*n-'f,(e+'d3/k:6oAAuGGN:S?YE\HZFYE[E]G_FaHcH`E[?W;W;X0I9RBXG]LaO`N[EU?R;=::45/2*2*~8,=1H6M;WA^HbG`EZ?W9 #R96E9J>L:P>[D`IbH_EZ?WF=I@QDWJR?VC^GaJcI_E[@W,g9)b4$g7#c3^/[,V,Y/!W5,Z8/I,(dGCnpsw`MQ?075&-ĿſǸ³ܤƭƅxhrzйѲyŠ}ˌ{ņur_aNVDP>H:G9OH[Teajfa]WSRHOEI7=+;$A*?8B;FS:R9T-m>,k<*e7'a3#b3`1^0 \.T-T-N-$N-$K/+kOKqrpq`PS<,/- '3&-½ýŶȳȲxtu~vaV^w͸̮Ø~Žʍ{ÆtuafR\FS=E4?.@7F=KFNIQKGAC7D8D.='?%F,~>4B8F:HYAU=R9R9S;R:O9K5{H5wD1p?.m<+l=+j;)d6&_1!\/^1\3!\3!U0 O*C%> 3R;5hVVaOO>24, "1&,?4:½üĵ¾ƴÿ¾rlv^T\{khÒēɎ|‡u}hu`cKZBM:D1<3;27351?;626+:/>(z9#y=!E)|B6G;K=M?M?N@TCXGVBXD\E^G^E\CZAY@W?S;P7P7Q9P8M7}I3zG4uB/o>-l;*j;)h9'b4$^0 Z0[1Z4!Y3 R1 L+A%=!A-&VB;^NNP@@4*+* !,#(1(-ĿſǸ¾ڽÿ׿nktndlkgŖǘɐ}ŌyƉtƉtyarZdS[JPJGA<;5485|1.v3*{8/u<(p7#k< rC'{F8K=O?P@M>L=O>RAT?VAXA[D\C\C[BZAU=Q9N5M4O7N6~J4zF0yF3tA.m<+k:)i:(g8&a3#]/]4\3V1T/O.O.K0%L1&s_Xt`Y`RQE761'(/%&*$(%#ʿ¼ʻôýݾĠ涳olu}v}|wz|xxƗɚ˒ȏ|ϒ}֙ǐ{upxikg^ZOQEGAB;<~?8D={H5tA.lD*qI/yE7}I;MU>YBZA[BZBZBS;O7L3K2M5L4}I3yE/xE2tA.m<+j9(i:(g8&a3#\.`:#[5S.O*K,R3!V;0\A6}v~kdVHG4&%*!":12?9=:48Ǿ㫢¹涭̶ǾԶԽ˽þѭ½ʛӦwecñq^`xzb_ƚמΕޞؘʢˣˠǜ{xmpeaTYLOAI;J;M>M?M?L9I6F3C0C/D0F1H3K5L6O8Q:T+l=+i:(e7'b4$^3#^3#_3&`4'c-#c-#V.&M%6"8$92,E>8NMI651'"+&"<+$;*#<#<#̗żѤ¹żǾ¹־µ½Ӯʚڬ^NQhf֞љ㥐ݟխذܱ޳߰۬ڦ֢՝͕Ŋ|rvgm^bT[MXEUBP=J7H4F2G2H3F0G1I2J3L4M5N6O7{G1xD.t@+s?*s@-r?,l;*h7&f8(d6&`5%^3#]1$]1$]3']3'b3)\-#K) F$:'!?,&?74F>;40/($#&-%#7(#3$0.żĻӱĻθغһȽ簫եȺ▇aRWrvyxĨ™֡ќ䧔ݠӫխ۰ݲ౧߰ଡު՝И͒nj~ąv{loagYaN^KWDP=L8I5I4I4H2H2J3J3K3L4L4L4yF1uB-q>+p=*n=,l;*g8(c4$b7'a6&^4&^4&Z2&Z2&Z2(Z2(T2&K)>!?"@.*J84LBANDC0*,-')/%&2()7(%1"-(ԞѭǧѮͷϸŮþĹޔ봯؁v|shnkZ`ѷȡĝ֢ѝ⧕۠ҪԬحٮܭګܨۧӛИΓʏʋ|svhn`iVeR^KWDR>M9M8M8M7M7N7M6N6M5M5M5xG6tC2p?.n=,m>.k<,c8(_4$`6(`6(]5+]5+Z4)Y3(W1(V0'E. ;$14 <-*F74H<@F:>-"(,!',!%+ $0"!1#",%ȿŽΞҵǾ˧ůɫ̎ЩȾ|rzΞ_PWȥӡϝਗؠԬխحح٪ةڦ٥١՝і͒ˌ}ƒtwioao\kXdQ\IWCS?R=R=R.j?/h=-a7)]3%\4*\4*[5,Z4+V1(S.%N,#L*!6)0#*,2$#7)(4'.1$+$ %!#$/!!8**3%$(ا˺ŜúƨƽαԻ̻ԪЧĿĿŦĻ}ِbU^ġϟ̜ਙןӫӫժժר֧٥ؤؠԜϔʏȉzsxjrds`o\gT`M[GWCWBVAS=S=R;P9P8M5L4K3vH8rD4m?0j<-h.f;+d:,b8*Z2&V."S-$S-$R-%P+#I& C <9"#-)1-"6,-6,-8(27'1L:FM;GH8BK;EXLP`TXKA@-#"ĥ͛ۜʻͳþҶ§Ĺɾ̸ɿǽŵåi^d͹riСy㫔Қݤۢ٠מ֜֜ככ̍~ʋ|ɇwŃs~mziwfudmWkUgQbL_IZDWBU@UCQ?NQ>L9}J7{H5zI8xG6rD4n@0vB4o;-c3%]-W-!X."U3)V4*A&?$5".##&-#!0$(4(,6*.=15PDHbVZ\PTK?CnbfthlXLP:.2<04=157+/=15іִߧ۟ەЬܺ}y䘎ӛ~yܮqgoŻʆsujMI֣ǔ̓˒ʑɐȎǍNjƊƒts}myiudq`n]l[fPdNaM\HVDQ?P=M:K9|G5uD3sB1qC3oA1i>.e:*i=0f:-`6*[1%R-$O*!J,$J,$=$;"=+)D204)''0&'G=>UIMTHLI=AG;?dX\w{xlpVJNVJNbVZL@D-!%''0$(G;?ܶڊ㌀ӏŖɹĿź̺vqwĺ‘ȿĩʠyyjou[Z}ȚƍƍƍŌĊˆ}zyp}nyiueq`l[iXgVdObM^KYFUBP=M;K9xG6tC2k@/j?.g@/e>-`;+\7'T0$X4(Y7-X6,O1)F( ;"9 =('C.-ZJKueffZ^E9=A8=WNSswswg[_L@DVJNwkoxlp_SW:.2G;?8,0#$%0$(L@D¦ȇ{Ͽ檛ڙզȻ|źȟ㜒ꨟķqdk}vq‰Êʈ}zvuzkyjtdp`l[hWdScRaM_K\HWCR@M;{J9yH7pE4lA0e>-c<+a=-_;+Y8)U4%H+#K.&L1*J/(E.(G0*L76S>=@01N>?uhoi^fQGPXNWtx~rvYMQH<@VJN_SWYMQ/#'5)-)!"."&, $, $?37ŧձۢ䘉ϔУþīɺuuĢ͏ԏ͸tnr٫mclͺqphg~yzvxyzw~synwlsdqbm]iYeT`O]L\K[IYGWDR?|M;wH6qF5nC2hA0d=,\;*Z9(Y9*W7(P4&L0"F2+C/(<)#7$<*(R@>p`axyVJNaUYvmbrbWg`TXsgkznrfZ^L@DA59B6:E9=2&*2&*%%6*.-!%"-!%Ѱϵʿãϗȹ;åĿŵ¸Ⱥ~{ζĦ}؟nfqʻ|cfhk~~ritkvmxovkrgmbj_j[hYdT`P\KWFTCRAUAS?~O=yJ8sE5n@0e>-c<+_;+[7'T4%R2#O3%N2$H.!D*=0*22ZNNswpemmbjshv{zpgzVJNVJN[OS_SWRFJ<041%)4(,1%)/#'#&5)-)!+#ᢞȱƺҬԢ笧ުĿź}ru¸ؤ~៙tnzu_bqth_jamdnembi^cX_TcTbS]MYIUDQ@MnZ8=`4TP@=Snq}CL%r>YV{Q)=uX)JS4iEmdj>jU{TSRH;(? zzScZdTWP5!WGtO7RG(V9p=f!XnRn*AkMF(zIro0~-!H#&_xby?fa?Is17hN0qLShV z#igK<((>vsc{w?G6halQZlHrR($~?`HL-TJGck9z(ABfQM0Ebylj=u3eU=^>>>c6i zL-hherKIF#u0%*y8E+{(?%FD|)PdcUmvK}ADjQ*%peTYE>(@BX1sDUmsKIY}G6UT>n($mlEL;5cwAL5H>h*?i;fAwIh7di# z*8Pj>+J)PFek_riTkfvmGUlQ=qxSI_Tz`uQ8`za`Z$=!j7H}u>VBbQnJw&g2mE2?# zHTW*jL$asjA5jle4*I5@uPJ_TRzzzeC6IXZRJk32=Td<2G1gKev!dG`vP8>oDIQQV zg0-#qsQQNP1hTX!=hND|@Bgl!PK?{CJkbz>-JP=7EIQ_siRObm1_@N z8S)_8-N}y^&qcN?VEE6c^<+s@nLMKYcgn~|iue^;d7zI2vvFL&S`p3ApLL)q%95-O zi8=X4-=DbputVboO=|X$Vt?xA1+jFF?}*J(oOkZl;10Q(<+hkwL!nR0;%eu^g3!UZ z<*9|P6xgeu8{2kAgkRqI9_5>GX<;VOBk_t~xy-XtBH^*XUAaLUm6sDParvT1+piVq zL7Q^lq`t{LFUq;CN%R>@T3@7)(LG4vUC@2=;J~y#) z>&n(_D+@ToMpGn4igp|;0E&)Zc1QWqqGLhkEjk;hw@9lk<>LVO?2BZOOYB&S$*Kcx zxU8NwzO8yBf;wKkK4&ngJOi`BJP`yqLB{h^%$swE#+9Z%q3^ zaG-c_FwIE?+GnP*hG+qP>OS%P%~;HGhnEMRZ~JZha7|3*`4u0n{!2C>^>gfS9Gd4ciZGwCPkUWwG@fDrBd@&%*`INX!@c?6{Pka)zC#&16-H^o42#m z^{uMP;yh8P2vc%RUYtAmSg5f^cr;(RS!TnkydLaC1J8^F%_okIH*tH-5$DuTLtZte zG(5`|t~ULJ)I6pMc@cd5`xtMu)C!_{!zvVRoFM#ls-EBPlBKC5{SXi%Osk~(spvbz zQ*a}>?=qzDLt%|Vo0X5i!6ALhdCzFAinq(L+&Za(opJMF#(aCa%J&s7{ne>Lt*3r= zBV109fn;fQ%BO~>?Xq|>&S0`vwE|~|<@RGbL-}SWM`8jff#%_oIp|Gj6lgKb)4g-8j>f)2lTgyPf#L8cUl*9`j1yKsiG?5r*e|3|pvh?_Yv? zDlXK|5ZG0xzulQXe62|-@H|QPa{E9akJGOy+&gSC3*{+bT z^w4&93s|g6R{HgcE;Mr#5V9kxT$Pm7sk3qYm!p|s#jF;?Ru4xl5&qp3VOnYv7wXCgwsfsS zz?51Ifh?HD8FlzU`+Qe!ld^Z%9u})23TL_TV!l=b z9#b{4+jPFO>9bShtDJO+S0qcuLy2yQ_qOcz1B+|)p3D3VCXr;AWZ0%NDe;^mmOo zmCCkq1j1;+iTp)Bgvl!`W$yzT3`j7w&qliz*pUqTZ5Rm7n;3?s7UYAUkUPX zSTvN~#NKv$t+vfc+Hstj%^$v)T--r2F**`eI0~4=5R}*pWE*w7PuQW!ov4KHyi&d- z{k@ABQ(+}advW7UH8!0g=*Q$xkDMS>-Aulrb+g*pG-m|jFc}^Gji$(q2lfkM%D(-1Ta)Z zt&a=Zp&A9UlsYr?5Ai52)gn30p3LqiUmj4eDhtM%%b5*x?>EP>ew*7)moScS&)6G# zXAC4AkKdgW`@CXsXQT-Y5n4o))wWK*XjIhH7BLEW{Qv?x`Rmv0g`m|eTXyWwo3D`y zM##-?XOC*wbwYhiKRpI|tv#hhlt3%)GZT&sHReB`DVXGp>$;-jDYu;1pU5Vsc?GAE z^Dv4oDXE-wdk4+I1!{iHC*TvTzd{SXL0~sY500{a!CYr3;%u-L7vy!rnPV((U~8sM zt8wp(f0z<$Bw38gi8=MXDq6DHBuCzB5Poj?>S<)xg5oq|DR^UH57TQFfU>nps~Awg zoxR{JRen@xR4H1@4zL5zsAp>{JQeTbEZDYs#XomcvrKz>L**=jb2yexR1I;2=VJN& z;bfZ{t7`X=CVTG7D4vG4!DqZV!JLkmCqPd^)}qJ><2ly4c}(P;Je`>qmaVELE3~;) brDBbQ8YN>1E@e3vpGLftG~`KL-T&=hT}>#F literal 0 HcmV?d00001 From 98f16a9b4d9c73a12e052bed8a877eb01d08f6a0 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lane" Date: Fri, 13 Dec 1991 00:00:00 +0000 Subject: [PATCH 088/985] The Independent JPEG Group's JPEG software v2 --- CHANGELOG | 37 ++++ README | 340 +++++++++++++--------------------- SETUP | 235 ++++++++++++++++++++++++ USAGE | 162 +++++++++++++++++ ansi2knr.c | 37 ++-- cjpeg.1 | 130 +++++++++++++ config.c | 403 +++++++++++++++++++++++++++++++++++++++++ djpeg.1 | 114 ++++++++++++ egetopt.c | 96 +++++----- jbsmooth.c | 2 +- jccolor.c | 9 +- jcdeflts.c | 51 +++--- jchuff.c | 63 ++++--- jcmain.c | 106 +++++++---- jconfig.h | 18 +- jcpipe.c | 8 +- jcsample.c | 4 +- jdcolor.c | 6 +- jddeflts.c | 117 ++++++++++++ jdhuff.c | 43 +++-- jdmain.c | 148 +++++++-------- jdpipe.c | 3 +- jerror.c | 6 +- jfwddct.c | 197 ++++++++++++-------- jinclude.h | 37 +++- jpegdata.h | 110 ++++++----- jquant1.c | 27 +-- jrdgif.c | 18 +- jrdjfif.c | 37 ++-- jrdppm.c | 281 ++++++++++++++++++++++++---- jrdrle.c | 372 +++++++++++++++++++++++++++++++++++++ jrdtarga.c | 483 +++++++++++++++++++++++++++++++++++++++++++++++++ jrevdct.c | 186 ++++++++++++------- jversion.h | 14 ++ jvirtmem.c | 76 +++++++- jwrgif.c | 19 +- jwrjfif.c | 6 +- jwrppm.c | 10 + jwrrle.c | 231 +++++++++++++++++++++++ jwrtarga.c | 223 +++++++++++++++++++++++ makcjpeg.cf | 7 +- makcjpeg.lnk | 14 +- makcjpeg.lst | 4 + makdjpeg.cf | 8 +- makdjpeg.lnk | 17 +- makdjpeg.lst | 4 + makefile.amiga | 143 --------------- makefile.ansi | 140 ++++++++++++++ makefile.manx | 133 ++++++++++++++ makefile.mc5 | 146 +++++++++------ makefile.mc6 | 121 ++++++++----- makefile.pwc | 111 +++++++----- makefile.sas | 152 ++++++++++++++++ makefile.tc | 113 ++++++++++++ makefile.unix | 139 +++++++------- makljpeg.cf | 11 +- testimg.jpg | Bin 3583 -> 4383 bytes testimg.ppm | Bin 49167 -> 46890 bytes testorig.jpg | Bin 2899 -> 4380 bytes 59 files changed, 4585 insertions(+), 1143 deletions(-) create mode 100644 CHANGELOG create mode 100644 SETUP create mode 100644 USAGE create mode 100644 cjpeg.1 create mode 100644 config.c create mode 100644 djpeg.1 create mode 100644 jddeflts.c create mode 100644 jrdrle.c create mode 100644 jrdtarga.c create mode 100644 jversion.h create mode 100644 jwrrle.c create mode 100644 jwrtarga.c create mode 100644 makcjpeg.lst create mode 100644 makdjpeg.lst delete mode 100644 makefile.amiga create mode 100644 makefile.ansi create mode 100644 makefile.manx create mode 100644 makefile.sas create mode 100644 makefile.tc diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 00000000..7146f385 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,37 @@ +CHANGELOG for Independent JPEG Group's JPEG software + +Version 2 13-Dec-91 +-------------------- + +Documentation improved a little --- there are man pages now. +Installation instructions moved from README to a separate file SETUP. + +New program config.c is provided to help you get the configuration options +right. This should make installation a lot more foolproof. + +Sense of djpeg -D switch reversed: dithering is now ON by default. + +RLE image file support added (thanks to Mike Lijewski). + +Targa image file support added (thanks to Lee Crocker). + +PPM input now accepts all PPM and PGM files. + +Bug fix: on machines where 'int' is 16 bits, high-Q-setting JPEG files +were not decoded correctly. + +Numerous changes to improve portability. There should be few or no compiler +warnings now. + +Makefiles cleaned up; defaults now appropriate for production use rather than +debugging. + +Subroutine interface cleaned up. If you wrote code based on version 1's +jcmain/jdmain, you'll need to change it, but it should get a little shorter +and simpler. + + +Version 1 7-Oct-91 +-------------------- + +Initial public release. diff --git a/README b/README index 9a2a1bba..524f3295 100644 --- a/README +++ b/README @@ -1,27 +1,27 @@ The Independent JPEG Group's JPEG software ========================================== -README for release of 7-Oct-91 -=============================== +README for release 2 of 13-Dec-91 +================================= -This distribution contains the first public release of the Independent JPEG +This distribution contains the second public release of the Independent JPEG Group's free JPEG software. You are welcome to redistribute this software and to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. -This software is still undergoing revision. Updated versions may be obtained -by anonymous FTP to uunet.uu.net; look under directory /graphics/jpeg. This -particular version will be archived as jpegsrc.v1.tar.Z. If you don't have -access to Internet FTP, UUNET's archives are also available via UUCP; contact -postmaster@uunet.uu.net for information on retrieving files that way. +For installation instructions, see file SETUP; for usage instructions, see +file USAGE (or the cjpeg.1 and djpeg.1 manual pages). -Please report any problems with this software to jpeg-info@uunet.uu.net. +This software is still undergoing revision. Updated versions may be obtained +by FTP or UUCP to uunet.uu.net and other archive sites; see ARCHIVE LOCATIONS +below for details. If you intend to become a serious user of this software, please contact -jpeg-info@uunet to be added to our electronic mailing list. Then you'll be -notified of updates and have a chance to participate in discussions, etc. +jpeg-info@uunet.uu.net to be added to our electronic mailing list. Then +you'll be notified of updates and have a chance to participate in discussions, +etc. -This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, and other -members of the independent JPEG group. +This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, +Lee Crocker, and other members of the Independent JPEG Group. DISCLAIMER @@ -32,20 +32,23 @@ useful for anything, nor to be compatible with subsequent releases, nor to be an accurate implementation of the JPEG standard. (See LEGAL ISSUES for even more disclaimers.) +Please report any problems with this software to jpeg-info@uunet.uu.net. + WHAT'S HERE =========== This distribution contains software to implement JPEG image compression and -decompression. JPEG is a standardized compression method for full-color and -gray-scale images. JPEG is intended for "real-world" scenes; cartoons and -other non-realistic images are not its strong suit. JPEG is lossy, meaning -that the output image is not necessarily identical to the input image. Hence -you should not use JPEG if you have to have identical output bits. However, -on typical images of real-world scenes, very good compression levels can be -obtained with hardly any visible change, and amazingly high compression levels -can be obtained if you can tolerate a low-quality image. For more details, -see the references, or just experiment with various compression settings. +decompression. JPEG (pronounced "jay-peg") is a standardized compression +method for full-color and gray-scale images. JPEG is intended for +"real-world" scenes; cartoons and other non-realistic images are not its +strong suit. JPEG is lossy, meaning that the output image is not necessarily +identical to the input image. Hence you should not use JPEG if you have to +have identical output bits. However, on typical images of real-world scenes, +very good compression levels can be obtained with no visible change, and +amazingly high compression levels can be obtained if you can tolerate a +low-quality image. For more details, see the references, or just experiment +with various compression settings. The software implements JPEG baseline and extended-sequential compression processes. Provision is made for supporting all variants of these processes, @@ -67,9 +70,9 @@ the future. This software can be used on several levels: * As canned software for JPEG compression and decompression. Just edit the - Makefile and configuration files as needed (see SETUP), compile and go. + Makefile and configuration files as needed (see file SETUP), compile and go. Members of the independent JPEG group will improve the out-of-the-box - functionality as time goes on. + functionality and speed as time goes on. * As the basis for other JPEG programs. For example, you could incorporate the decompressor into a general image viewing package by replacing the @@ -77,7 +80,7 @@ This software can be used on several levels: specific hardware, you might want to replace some of the inner loops with assembly code. For a non-command-line-driven system, you might want a different user interface. (Members of the group will be producing Macintosh - and Amiga versions with appropriate user interfaces, for example.) + and Amiga versions with more appropriate user interfaces, for example.) * As a toolkit for experimentation with JPEG and JPEG-like algorithms. Most of the individual decisions you might want to mess with are packaged up into @@ -90,181 +93,85 @@ In particular, we welcome the use of this software as the basis for commercial products; no royalty is required. -SETUP -===== +ARCHIVE LOCATIONS +================= -The installation process is not very automatic; you will need at least some -familiarity with C programming and program build procedures for your system. -(Volunteers to work on improving this situation are welcome. Also, we will -probably start distributing pre-built binaries for popular systems at some -point.) +The "official" archive site for this software is uunet.uu.net (Internet +address 137.39.1.2 or 192.48.96.2). The most recent released version can +always be found there in directory graphics/jpeg. This particular version +will be archived as jpegsrc.v2.tar.Z. If you are on the Internet, you can +retrieve files from UUNET by anonymous FTP. If you don't have FTP access, +UUNET's archives are also available via UUCP; contact postmaster@uunet.uu.net +for information on retrieving files that way. -First, select a makefile and copy it to "Makefile". "makefile.unix" -is appropriate for most Unix and Unix-like systems. Special makefiles are -included for various PC compilers. If you don't see a makefile for your -system, we recommend starting from makefile.unix. +Various other Internet sites maintain copies of the UUNET file, which may or +may not be up-to-date. In Europe, try nic.funet.fi (128.214.6.100; look in +directory pub/graphics/programs/jpeg). -Look over the Makefile and adjust options as needed. In particular, you'll -need to change the CC= and CFLAGS= definitions if you don't have gcc -(makefile.unix only). If you have a function-prototype-less compiler, be sure -to uncomment the .c.o rule and say "make ansi2knr". This will cause the -source files to be preprocessed to change our ANSI-style function definitions -to old-style definitions. (Thanks to Peter Deutsch of Aladdin Enterprises for -ansi2knr.) +You can also obtain this software from CompuServe, in the GRAPHSUPPORT forum +(GO PICS), library 10; this version will be file jpsrc2.zip. -Also look over jconfig.h and adjust #defines as necessary. If you have an -ANSI-compliant C compiler (gcc for instance), no changes should be necessary -except perhaps for RIGHT_SHIFT_IS_UNSIGNED and TWO_FILE_COMMANDLINE. For -older compilers other mods may be needed, depending on what ANSI features are -supported. If you prefer, you can usually leave jconfig.h unmodified and add --D switches to the Makefile's CFLAGS= definition. - -Then say "make". - -If you have trouble with missing system include files or inclusion of the -wrong ones, you can fix it in jinclude.h. In particular, if you are using -gcc on a machine with non-ANSI system include files, you are likely to find -that jinclude.h tries to include the wrong files (because gcc defines -__STDC__). There's no good automatic solution to this, so you'll just have -to hand-edit jinclude.h. - -As a quick test of functionality we've included three sample files: - testorig.jpg same as blkint.jpg from JPEG validation floppy. - testimg.ppm output of djpeg testorig.jpg - testimg.jpg output of cjpeg testimg.ppm -The two .jpg files aren't identical due to different parameter choices (and -wouldn't be anyway, since JPEG is lossy). However, if you can generate -duplicates of testimg.ppm and testimg.jpg then you probably have a working -port. "make test" will perform the necessary comparisons (by generating -testout.ppm and testout.jpg and comparing these to testimg.*). NOTE: this -is far from an exhaustive test of the JPEG software; some modules, such as -color quantization and GIF I/O, are not exercised at all. It's just a quick -test to give you some confidence that you haven't missed something major. - -If you need to make a smaller version of the JPEG software, some optional -functions can be removed at compile time. See the xxx_SUPPORTED #defines -in jconfig.h. (Not a lot is actually removed right now, but as more optional -stuff gets added, this mechanism will start to make a difference.) - -If you want to incorporate the JPEG code as subroutines in a larger program, -we recommend that you make libjpeg.a. Then use the .h files and libjpeg.a as -your interface to the JPEG functions. Your surrounding program will have to -provide functionality similar to what's in jcmain.c or jdmain.c, and you may -want to replace jerror.c and possibly other modules depending on your needs. -See the "architecture" file for more info. If it seems to you that the system -structure doesn't accommodate what you want to do, please contact the authors. - -Special notes for Macintosh Think C users: If you have version 5.0 you should -be able to just turn on __STDC__ through the compiler switch that enables -that. With version 4.0 you must manually edit jconfig.h to define PROTO, -HAVE_UNSIGNED_CHAR, HAVE_UNSIGNED_SHORT, and const. (It seems to be safe to -just define __STDC__ to take care of the first three.) When setting up -project files, use the COBJECTS and DOBJECTS lists in makefile.unix as a guide -to which files need to be included, and add the ANSI and Unix C libraries in a -separate segment. You may need to divide the JPEG files into more than one -segment; you can do this pretty much as you please. +If you are not reasonably handy at configuring and installing portable C +programs, you may have some difficulty installing this package. You may +prefer to obtain a pre-built executable version. A collection of pre-built +executables for various machines is currently available for anonymous FTP at +procyon.cis.ksu.edu (129.130.10.80 --- this number is due to change soon); +look under /pub/JPEG. The administrators of this system ask that FTP traffic +be limited to non-prime hours. For more information on this archive, please +contact Steve Davis (strat@cis.ksu.edu). This collection is not maintained by +the Independent JPEG Group, and programs in it may not be the latest version. -USAGE -===== +SUPPORTING SOFTWARE +=================== -The user interface is pretty minimal at this point. We haven't bothered to -generate manual-page files since the switches badly need redesign. At the -moment, things work like this: +You will probably want Jef Poskanzer's PBMPLUS image software, which provides +many useful operations on PPM-format image files. In particular, it can +convert PPM images to and from a wide range of other formats. You can FTP +this free software from export.lcs.mit.edu (contrib/pbmplus*.tar.Z) or +ftp.ee.lbl.gov (pbmplus*.tar.Z). Unfortunately PBMPLUS is not nearly as +portable as the JPEG software is; you are likely to have difficulty making it +work on any non-Unix machine. -There are two programs, cjpeg to compress an image file into JPEG format, -and djpeg to decompress. +If you are using X Windows you might want to use the xv or xloadimage viewers +to save yourself the trouble of converting PPM to some other format. Both of +these can be found in the contrib directory at export.lcs.mit.edu. +There will soon be a new release of xv that incorporates our software and thus +can read and write JPEG files directly. (NOTE: since xv internally reduces +all images to 8 bits/pixel, a JPEG file written by xv will not be very high +quality. Caveat user.) -On Unix systems, you say: - cjpeg [switches] [imagefile] >jpegfile - djpeg [switches] [jpegfile] >imagefile -The programs read the specified input file, or standard input if none is -named. They always write to standard output (with trace/error messages to -standard error). These conventions are handy for piping images between -programs. -On PC, Macintosh, and Amiga systems, you say: - cjpeg [switches] imagefile jpegfile - djpeg [switches] jpegfile imagefile -i.e., both input and output files are named on the command line. This style -is a little more foolproof, and it loses no functionality if you don't have -pipes. You can get this style on Unix too, if you prefer, by defining -TWO_FILE_COMMANDLINE in jconfig.h or in the Makefile. You MUST use this style -on any system that doesn't cope well with binary data fed through -stdin/stdout. +SOFTWARE THAT'S NO HELP AT ALL +============================== -Currently supported image file formats include raw-format PPM, raw-format PGM -(for monochrome images), and GIF. cjpeg recognizes the input image format -automatically, but you have to tell djpeg which format to generate. +Handmade Software's shareware PC program GIF2JPG produces files that are +totally incompatible with our programs. They use a proprietary format that is +an amalgam of GIF and JPEG representations. However, you can force GIF2JPG +to produce compatible files with its -j switch, and their decompression +program JPG2GIF can read our files (at least ones produced with our default +option settings). -The only JPEG file format currently supported is a raw JPEG data stream. -Unless modified, the programs use the JFIF conventions for variables left -unspecified by the JPEG standard. (In particular, cjpeg generates a JFIF APP0 -marker.) Support for the JPEG-in-TIFF format will probably be added at some -future date. +Unfortunately, most commercial JPEG implementations are also incompatible as +of this writing, especially programs released before summer 1991. The root of +the problem is that the ISO JPEG committee failed to specify a concrete file +format. Many vendors "filled in the blanks" on their own, creating +proprietary formats that no one else could read. (For example, none of the +early commercial JPEG implementations for the Macintosh were able to exchange +compressed files.) -The command line switches for cjpeg are: +The file format we have adopted is called JFIF (see REFERENCES). This format +has been agreed to by a number of major commercial JPEG vendors, and we expect +that it will become the de facto standard. JFIF is a minimal representation; +work is also going forward to incorporate JPEG compression into the TIFF +standard, for use in "high end" applications that need to record a lot of +additional data about an image. We intend to support JPEG-in-TIFF in the +future. We hope that these two formats will be sufficient and that other, +incompatible JPEG file formats will not proliferate. - -I Generate noninterleaved JPEG file (not yet supported). - - -Q quality Scale quantization tables to adjust quality. - Quality is 0 (worst) to 100 (best); default is 75. - (See below for more info.) - - -a Use arithmetic coding rather than Huffman coding. - (Not currently supported, see LEGAL ISSUES.) - - -o Perform optimization of entropy encoding parameters. - Without this, default Huffman or arithmetic - parameters are used. -o makes the JPEG file a tad - smaller, but compression uses much more memory. - Image quality is unaffected by -o. - - -d Enable debug printout. More -d's give more printout. - -Typically you'd use -Q settings of 50 or 75 or so. -Q 100 will generate a -quantization table of all 1's, meaning no quantization loss; then any -differences between input and output images are due to subsampling or to -roundoff error in the DCT or colorspace-conversion steps. -Q values below 50 -may be useful for making real small, low-quality images. Try -Q 2 (or so) for -some amusing Cubist effects. (Note that -Q values below about 25 generate -2-byte quantization tables, which are not decodable by pure baseline JPEG -decoders. cjpeg emits a warning message when you give such a -Q value.) - -The command line switches for djpeg are: - - -G Select GIF output format (implies -q, with default - of 256 colors). - - -b Perform cross-block smoothing. This is quite - memory-intensive and only seems to improve the image - at very low quality settings (-Q 10 to 20 or so). - - -g Force gray-scale output even if input is color. - - -q N Quantize to N colors. - - -D Use Floyd-Steinberg dithering in color quantization. - - -2 Use two-pass color quantization (not yet supported). - - -d Enable debug printout. More -d's give more printout. - -Color quantization currently uses a rather shoddy algorithm (although it's not -so horrible when dithered). Because of this, the GIF output mode is not -recommended in the current release, except for gray-scale output. You can get -better results by applying ppmquant to the unquantized (PPM) output of djpeg, -then converting to GIF with ppmtogif. We expect to provide a considerably -better quantization algorithm in a future release. - -Note that djpeg *can* read noninterleaved JPEG files even though cjpeg can't -yet generate them. For most applications this is a nonissue, since hardly -anybody seems to be using noninterleaved format. - -On a non-virtual-memory machine, you may run out of memory if you use -I or -o -in cjpeg, or -q ... -2 in djpeg, or try to read an interlaced GIF file. This -will be addressed eventually by replacing jvirtmem.c with something that uses -temporary files for large images (see TO DO). +Indeed, part of the reason for developing and releasing this free software is +to help force rapid convergence to de facto standards for JPEG file formats. +SUPPORT STANDARD, NON-PROPRIETARY FORMATS: demand JFIF or JPEG-in-TIFF! REFERENCES @@ -276,13 +183,25 @@ algorithm is Wallace's article in the April '91 CACM: Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) We highly recommend reading that -article before looking at any of the JPEG software. +article before trying to understand the innards of any JPEG software. For more detail about the JPEG standard you pretty much have to go to the -draft standard, which is not nearly as intelligible as Wallace's article. -The current version is ISO/IEC Committee Draft CD 10918-1 dated 1991-03-15. -The standard is not presently available electronically; you must order a paper -copy through ISO. +draft standard (which is not nearly as intelligible as Wallace's article). +The standard is not now available electronically; you must order a paper copy +through ISO. In the US, copies may be ordered from ANSI Sales at (212) +642-4900. The standard is divided into two parts: Part 1 is the actual +specification, and Part 2 covers compliance testing methods. The current +"committee draft" version of Part 1 is titled "Digital Compression and Coding +of Continuous-tone Still Images, Part 1: Requirements and guidelines" and has +document number ISO/IEC CD 10918-1. (The alternate number SC2 N2215 should +also be mentioned when ordering.) This draft is expected to be superseded by +the Draft International Standard version around the end of November 1991. +Ordering info will be the same as above, but replace "CD" with "DIS" in the +document number (alternate number not yet known). The committee draft of +Part 2 is expected to be available around the end of December 1991. It will +be titled "Digital Compression and Coding of Continuous-tone Still Images, +Part 2: Compliance testing" and will have document number ISO/IEC CD 10918-2 +(alternate number not yet known). The JPEG standard does not specify all details of an interchangeable file format. For the omitted details we follow the "JFIF" conventions, revision @@ -292,28 +211,14 @@ format. For the omitted details we follow the "JFIF" conventions, revision 399A West Trimble Road San Jose, CA 95131 (408) 944-6300 -Requests can also be e-mailed to info@c3.pla.ca.us (this address good after -10/10/91). The same source can supply copies of the draft JPEG-in-TIFF specs. +Requests can also be e-mailed to info@c3.pla.ca.us. The same source can +supply copies of the draft JPEG-in-TIFF specs. If you want to understand this implementation, start by reading the "architecture" documentation file. Please read "codingrules" if you want to contribute any code. -SUPPORTING SOFTWARE -=================== - -You will probably want Jef Poskanzer's PBMPLUS image software; this provides -many useful operations on PPM-format image files. In particular, it can -convert PPM images to and from a wide range of other formats. You can FTP -this free software from export.lcs.mit.edu (contrib/pbmplus*.tar.Z) or -ftp.ee.lbl.gov (pbmplus*.tar.Z). - -If you are using X Windows you might want to use the xv or xloadimage viewers -to save yourself the trouble of converting PPM to some other format. -Both of these can be found in the contrib directory at export.lcs.mit.edu. - - LEGAL ISSUES ============ @@ -360,14 +265,21 @@ the foregoing paragraphs do. It appears that the arithmetic coding option of the JPEG spec is covered by -patents held by IBM, and possibly also patents of AT&T and Mitsubishi. Hence -arithmetic coding cannot legally be used without obtaining one or more -licenses. For this reason, support for arithmetic coding has been removed -from the free JPEG software. (Since arithmetic coding provides only a +patents owned by IBM and AT&T, as well as a pending Japanese patent of +Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining +one or more licenses. For this reason, support for arithmetic coding has been +removed from the free JPEG software. (Since arithmetic coding provides only a marginal gain over the unpatented Huffman mode, it is unlikely that very many -people will choose to use it. If you do obtain such a license, contact -jpeg-info@uunet.uu.net for a copy of our arithmetic coding modules.) So far -as we are aware, there are no patent restrictions on the remaining code. +people will choose to use it. If you do obtain the necessary licenses, +contact jpeg-info@uunet.uu.net for a copy of our arithmetic coding modules.) +So far as we are aware, there are no patent restrictions on the remaining +code. + + +We are required to state that + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." TO DO diff --git a/SETUP b/SETUP new file mode 100644 index 00000000..31f445c0 --- /dev/null +++ b/SETUP @@ -0,0 +1,235 @@ +SETUP instructions for the Independent JPEG Group's JPEG software +================================================================= + +This file explains how to configure and compile the JPEG software. We have +tried to make this software extremely portable and flexible, so that it can be +adapted to almost any environment. The downside of this decision is that the +installation process is not very automatic; you will need at least a little +familiarity with C programming and program build procedures for your system. + +This file contains general instructions, then sections of specific hints for +certain systems. You may save yourself considerable time if you scan the +whole file before starting to do anything. + +Before installing the software you must unpack the distributed source code. +Since you are reading this file, you have probably already succeeded in this +task. However, there is one potential trap if you are on a non-Unix system: +you may need to convert these files to the local standard text file format +(for example, if you are on MS-DOS you probably have to convert LF end-of-line +to CR/LF). If so, apply the conversion to all the files EXCEPT those whose +names begin with "test". The test files contain binary data; if you change +them in any way then the self-test will give bad results. + + +STEP 1: PREPARE A MAKEFILE +========================== + +First, select a makefile and copy it to "Makefile" (or whatever your version +of make uses as the default makefile name; for example, "makefile.mak" for +Borland C). We include several standard makefiles in the distribution: + + makefile.ansi: for Unix systems with ANSI-compatible C compilers. + makefile.unix: for Unix systems with non-ANSI C compilers. + makefile.mc5: for Microsoft C 5.x under MS-DOS. + makefile.mc6: for Microsoft C 6.x under MS-DOS. + makefile.tc: for Borland's Turbo C under MS-DOS. + makefile.pwc: for Mix Software's Power C under MS-DOS. + makefile.manx: for Manx Aztec C on Amigas. + makefile.sas: for SAS C on Amigas. + +If you don't see a makefile for your system, we recommend starting from either +makefile.ansi or makefile.unix, depending on whether your compiler accepts +ANSI C or not. Actually you should start with makefile.ansi whenever your +compiler supports ANSI-style function definitions; you don't need full ANSI +compatibility. The difference between the two makefiles is that makefile.unix +preprocesses the source code to convert function definitions to old-style C. +(Our thanks to Peter Deutsch of Aladdin Enterprises for the ansi2knr program.) + +If you don't know whether your compiler supports ANSI-style function +definitions, then take a look at config.c. It is a test program that will +help you figure out this fact, as well as some other facts you'll need in +later steps. You must compile and execute config.c by hand; the makefiles +don't provide any support for this. config.c may not compile the first try +(in fact, the whole idea is for it to fail if anything is going to). If you +get compile errors, fix them by editing config.c according to the directions +given in config.c. Once you get it to run, select a makefile according to the +advice it prints out, and make any other changes it recommends. + +Look over the selected Makefile and adjust options as needed. In particular +you may want to change the CC and CFLAGS definitions. For instance, if you +are using GCC, set CC=gcc. + +If you are on a system that doesn't use makefiles, you'll need to set up +project files (or whatever you do use) to compile all the source files and +link them into executable files cjpeg and djpeg. See the file lists in any of +the makefiles to find out which files go into each program (makcjpeg.lst and +makdjpeg.lst are handy summaries). + + +STEP 2: EDIT JCONFIG.H +====================== + +Look over jconfig.h and adjust #defines to reflect the properties of your +system and C compiler. (If you prefer, you can usually leave jconfig.h +unmodified and add -Dsymbol switches to the Makefile's CFLAGS definition.) + +If you have an ANSI-compliant C compiler, no changes should be necessary +except perhaps for RIGHT_SHIFT_IS_UNSIGNED and TWO_FILE_COMMANDLINE. For +older compilers other changes may be needed, depending on what ANSI features +are supported. + +If you don't know enough about C programming to understand the questions in +jconfig.h, then use config.c to figure out what to change. (See description +of config.c in step 1.) + +A note about TWO_FILE_COMMANDLINE: defining this selects the command line +syntax in which the input and output files are both named on the command line. +If it's not defined, the output image goes to standard output, and the input +can optionally come from standard input. You MUST use two-file style on any +system that doesn't cope well with binary data fed through stdin/stdout; this +is true for most MS-DOS compilers, for example. If you're not on a Unix +system, it's probably safest to assume you need two-file style. + + +STEP 3: MAKE +============ + +Now you should be able to "make" the software. + +If you have trouble with missing system include files or inclusion of the +wrong ones, look at jinclude.h (or use config.c, if you are not a C expert). + +If your compiler complains about big_sarray_control and big_barray_control +being undefined structures, you should be able to shut it up by adding +-DINCOMPLETE_TYPES_BROKEN to CFLAGS (or add #define INCOMPLETE_TYPES_BROKEN +to jconfig.h). + +There are a fair number of routines that do not use all of their parameters; +some compilers will issue warnings about this, which you can ignore. Any +other warning deserves investigation. + + +STEP 4: TEST +============ + +As a quick test of functionality we've included three small sample files: + testorig.jpg A reduced section of the well-known Lenna picture. + testimg.ppm The output of djpeg testorig.jpg + testimg.jpg The output of cjpeg testimg.ppm +(The two .jpg files aren't identical since JPEG is lossy.) If you can +generate duplicates of testimg.ppm and testimg.jpg then you probably have a +working port. + +With most of the makefiles, "make test" will perform the necessary +comparisons. If you're using a makefile that doesn't provide this option, run +djpeg and cjpeg to generate testout.ppm and testout.jpg, then compare these to +testimg.* with whatever file comparison tool you have. The files should be +bit-for-bit identical. + +NOTE: this is far from an exhaustive test of the JPEG software; some modules, +such as color quantization and GIF I/O, are not exercised at all. It's just a +quick test to give you some confidence that you haven't missed something +major. + +If the test passes, you can copy the executable files cjpeg and djpeg to +wherever you normally install programs. Read the file USAGE to learn more +about using the programs. + + +OPTIONAL STUFF +============== + +We distribute the software with support for RLE image files (Utah Raster +Toolkit format) disabled, because the RLE support won't compile without the +Utah library. If you have URT version 3.0, you can enable RLE support as +follows: + 1. #define RLE_SUPPORTED in jconfig.h or in the Makefile. + 2. Add a -I option to CFLAGS in the Makefile for the directory + containing the URT .h files (typically the "include" + subdirectory of the URT distribution). + 3. Add -L... -lrle to LDLIBS in the Makefile, where ... specifies + the directory containing the URT "librle.a" file (typically the + "lib" subdirectory of the URT distribution). + +If you want to incorporate the JPEG code as subroutines in a larger program, +we recommend that you make libjpeg.a. Then use the jconfig.h and jpegdata.h +files as your interface to the JPEG functions, and link libjpeg.a with your +program. Your surrounding program will have to provide functionality similar +to what's in jcmain.c or jdmain.c, and you may want to replace jerror.c and +possibly other modules depending on your needs. See the "architecture" file +for more info. If it seems to you that the system structure doesn't +accommodate what you want to do, please contact the authors. + +CAUTION: When you use the JPEG code as subroutines, we recommend that you make +any required configuration changes by modifying jconfig.h, not by adding -D +switches to the Makefile. Otherwise you must be sure to provide the same -D +switches when compiling any program that includes the JPEG .h files. + +If you need to make a smaller version of the JPEG software, some optional +functions can be removed at compile time. See the xxx_SUPPORTED #defines in +jconfig.h. If at all possible, we recommend that you leave in decoder support +for all valid JPEG files, to ensure that you can read anyone's output. +Restricting your encoder, or removing optional functions like block smoothing, +won't hurt compatibility. Taking out support for image file formats that you +don't use is the most painless way to make the programs smaller. + + +NOTES FOR SPECIFIC SYSTEMS +========================== + +We welcome reports on changes needed for systems not mentioned here. +Submit 'em to jpeg-info@uunet.uu.net. Also, config.c is fairly new and not +yet thoroughly tested; if it's wrong about how to configure the JPEG software +for your system, please let us know. + + +HP/Apollo DOMAIN: + +At least in version 10.3.5, the C compiler is ANSI but the system include +files are not. Use makefile.ansi and add -DNONANSI_INCLUDES to CFLAGS. + +HP-UX: + +If you have HP-UX 7.05 or later with the "software development" C compiler, +then you can use makefile.ansi. Add "-Aa" to the CFLAGS line in the +makefile. If you have a pre-7.05 system, or if you are using the non-ANSI C +compiler delivered with a minimum HP-UX 8.0 system, then you must use +makefile.unix (and do NOT add -Aa). Also, adding "-lmalloc" to LDLIBS is +recommended if you have libmalloc.a (it seems not to be present in minimum +8.0). + +On HP series 800 machines, the HP C compiler is buggy in revisions prior to +A.08.07. If you get complaints about "not a typedef name", you'll have to +convert the code to K&R style (i.e., use makefile.unix). + +IBM RS/6000 AIX: + +The CFLAGS switch to make the compiler define __STDC__ is "-qlanglvl=ansi". + +Macintosh Think C: + +You'll have to prepare project files for cjpeg and djpeg; we don't include +those in the distribution since they are not text files. The COBJECTS and +DOBJECTS lists in makefile.unix show which files should be included in each +project. Also add the ANSI and Unix C libraries in a separate segment. You +may need to divide the JPEG files into more than one segment; you can do this +pretty much as you please. + +If you have Think C version 5.0 you should be able to just turn on __STDC__ +through the compiler switch that enables that. With version 4.0 you must +manually edit jconfig.h. (You can #define __STDC__, but also #define const.) + +Microsoft C for MS-DOS: + +Some versions of MS C fail with an "out of macro expansion space" error +because they can't cope with the macro TRACEMS8 (defined in jpegdata.h). +If this happens to you, the easiest solution is to change TRACEMS8 to +expand to nothing. You'll lose the ability to dump out JPEG coefficient +tables with djpeg -d -d, but at least you can compile. + +Sun: + +Don't forget to add -DBSD to CFLAGS. If you are using GCC on SunOS 4.0.1 or +earlier, you will need to add -DNONANSI_INCLUDES to CFLAGS (your compiler may +be ANSI, but your system include files aren't). I've gotten conflicting +reports on whether this is still necessary on SunOS 4.1 or later. diff --git a/USAGE b/USAGE new file mode 100644 index 00000000..409cb415 --- /dev/null +++ b/USAGE @@ -0,0 +1,162 @@ +USAGE instructions for the Independent JPEG Group's JPEG software +================================================================= + +This distribution contains software to implement JPEG image compression and +decompression. JPEG (pronounced "jay-peg") is a standardized compression +method for full-color and gray-scale images. JPEG is intended for +"real-world" scenes; cartoons and other non-realistic images are not its +strong suit. JPEG is lossy, meaning that the output image is not necessarily +identical to the input image. Hence you should not use JPEG if you have to +have identical output bits. However, on typical images of real-world scenes, +very good compression levels can be obtained with no visible change, and +amazingly high compression levels can be obtained if you can tolerate a +low-quality image. + +This file describes usage of the standard programs "cjpeg" and "djpeg" that +can be built directly from the distributed software. See the README file for +hints on incorporating the JPEG software into other programs. + +If you are on a Unix machine you may prefer to read the Unix-style manual +pages in files cjpeg.1 and djpeg.1. + +NOTE: at some point we will probably redesign the user interface, so the +command line switches described here will change. + + +We provide two programs, cjpeg to compress an image file into JPEG format, +and djpeg to decompress a JPEG file back into a conventional image format. + +On Unix-like systems, you say: + cjpeg [switches] [imagefile] >jpegfile +or + djpeg [switches] [jpegfile] >imagefile +The programs read the specified input file, or standard input if none is +named. They always write to standard output (with trace/error messages to +standard error). These conventions are handy for piping images between +programs. + +On PC, Macintosh, and Amiga systems, you say: + cjpeg [switches] imagefile jpegfile +or + djpeg [switches] jpegfile imagefile +i.e., both input and output files are named on the command line. This style +is a little more foolproof, and it loses no functionality if you don't have +pipes. (You can get this style on Unix too, if you prefer, by defining +TWO_FILE_COMMANDLINE; see SETUP.) + +The currently supported image file formats are: PPM (PBMPLUS color format), +PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster Toolkit +format). (RLE is supported only if the URT library is available.) +cjpeg recognizes the input image format automatically, with the exception +of some Targa-format files. + +The only JPEG file format currently supported is the JFIF format. Support for +the TIFF/JPEG format will probably be added at some future date. + + +The command line switches for cjpeg are: + + -Q quality Scale quantization tables to adjust image quality. + Quality is 0 (worst) to 100 (best); default is 75. + (See below for more info.) + + -o Perform optimization of entropy encoding parameters. + Without this, default encoding parameters are used. + -o usually makes the JPEG file a little smaller, but + cjpeg runs much slower. Image quality and speed of + decompression are unaffected by -o. + + -T Input file is Targa format. Targa files that contain + an "identification" field will not be automatically + recognized by cjpeg; for such files you must specify + -T to force cjpeg to treat the input as Targa format. + + -I Generate noninterleaved JPEG file (not yet supported). + + -a Use arithmetic coding rather than Huffman coding. + (Not currently supported for legal reasons.) + + -d Enable debug printout. More -d's give more printout. + Also, version information is printed at startup. + +The -Q switch lets you trade off compressed file size against quality of the +reconstructed image: the higher the -Q setting, the larger the JPEG file, and +the closer the output image will be to the original input. Normally you want +to use the lowest -Q setting (smallest file) that decompresses into something +visually indistinguishable from the original image. For this purpose the -Q +setting should be between 50 and 95; the default of 75 is often about right. +If you see defects at -Q 75, then go up 5 or 10 counts at a time until you are +happy with the output image. (The optimal setting will vary from one image to +another.) + +-Q 100 will generate a quantization table of all 1's, eliminating loss in the +quantization step (but there is still information loss in subsampling, as well +as roundoff error). This setting is mainly of interest for experimental +purposes. -Q values above about 95 are NOT recommended for normal use; the +compressed file size goes up dramatically for hardly any gain in output image +quality. + +In the other direction, -Q values below 50 will produce very small files of +low image quality. Settings around 5 to 10 might be useful in preparing an +index of a large image library, for example. Try -Q 2 (or so) for some +amusing Cubist effects. (Note: -Q values below about 25 generate 2-byte +quantization tables, which are considered optional in the JPEG standard. +cjpeg emits a warning message when you give such a -Q value, because some +commercial JPEG programs may be unable to decode the resulting file.) + + +The command line switches for djpeg are: + + -G Select GIF output format (implies -q, with default + of 256 colors). + + -P Select PPM or PGM output format (this is the default). + PGM is emitted if the JPEG file is gray-scale or if -g + is specified. + + -R Select RLE output format. Requires URT library. + + -T Select Targa output format. Gray-scale format is + emitted if the JPEG file is gray-scale or if -g is + specified; otherwise, colormapped format is emitted + if -q is specified; otherwise, 24-bit full-color + format is emitted. + + -b Perform cross-block smoothing. This is quite + memory-intensive and only seems to improve the image + at very low quality settings (-Q 10 to 20 or so). + At normal -Q settings it may make the image worse. + + -g Force gray-scale output even if input is color. + + -q N Quantize to N colors. + + -D Do NOT use dithering in color quantization. + By default, Floyd-Steinberg dithering is applied when + quantizing colors, but on some images dithering may + result in objectionable "graininess". If that + happens, you can turn off dithering with -D. + + -2 Use two-pass color quantization (not yet supported). + + -d Enable debug printout. More -d's give more printout. + Also, version information is printed at startup. + +Color quantization currently uses a rather shoddy algorithm (although it's not +as horrible when dithered). Because of this, the GIF output mode is NOT +RECOMMENDED in the current release, except for gray-scale output. You can get +better results by applying ppmquant to the unquantized (PPM) output of djpeg, +then converting to GIF with ppmtogif. (See SUPPORTING SOFTWARE in the README +file.) We expect to provide a considerably better quantization algorithm in a +future release. (The same applies to colormapped RLE or Targa output, of +course.) + +Note that djpeg *can* read noninterleaved JPEG files even though cjpeg can't +yet generate them. For most applications this is a nonissue, since hardly +anybody seems to be using noninterleaved format. + +On a non-virtual-memory machine, you may run out of memory if you use -I or -o +in cjpeg, or -q ... -2 in djpeg, or try to read an interlaced GIF file, or try +to read or write an RLE file, or try to read an interlaced or bottom-up Targa +file. This will be addressed soon by replacing jvirtmem.c with something that +uses temporary files for large images. diff --git a/ansi2knr.c b/ansi2knr.c index 77d3d819..04e4789e 100644 --- a/ansi2knr.c +++ b/ansi2knr.c @@ -1,6 +1,7 @@ /* * Received from Peter Deutsch (ghost@aladdin.com) * Fri, 26 Apr 91 10:10:10 PDT + * Small portability improvements by Tom Lane */ /* Copyright (C) 1989, 1991 Aladdin Enterprises. All rights reserved. @@ -174,34 +175,32 @@ BY ANY OTHER PARTY. /* ansi2knr.c */ /* Convert ANSI function declarations to K&R syntax */ + #include #include #ifdef BSD -# include -# define strchr index +#include +#define strchr index #else -# ifdef VMS +#ifdef VMS extern char *strcat(), *strchr(), *strcpy(), *strupr(); extern int strcmp(), strlen(), strncmp(); -# else -# include -# endif +#else +#include +#endif #endif #ifdef MSDOS -# include +#include #else -# ifdef VMS +#ifdef VMS extern char *malloc(); extern void free(); -# else -# ifdef BSD - extern char *malloc(); -# else -# include -# endif -# endif +#else + extern char *malloc(); + extern int free(); +#endif #endif /* Usage: @@ -226,12 +225,13 @@ BY ANY OTHER PARTY. #define isidchar(ch) (isalnum(ch) || (ch) == '_') #define isidfirstchar(ch) (isalpha(ch) || (ch) == '_') +int main(argc, argv) int argc; char *argv[]; { FILE *in, *out; #define bufsize 500 /* arbitrary size */ - char buf[bufsize]; + char buf[bufsize+1]; char *line; switch ( argc ) { @@ -296,12 +296,13 @@ skipspace(p, dir) /* * Write blanks over part of a string. */ -void +int writeblanks(start, end) char *start; char *end; { char *p; for ( p = start; p < end; p++ ) *p = ' '; + return 0; } /* @@ -313,6 +314,7 @@ writeblanks(start, end) * -1 - may be the beginning of a function definition, * append another line and look again. */ +int test1(buf) char *buf; { register char *p = buf; @@ -359,6 +361,7 @@ test1(buf) return contin; } +int convert1(buf, out) char *buf; FILE *out; diff --git a/cjpeg.1 b/cjpeg.1 new file mode 100644 index 00000000..9a183220 --- /dev/null +++ b/cjpeg.1 @@ -0,0 +1,130 @@ +.TH CJPEG 1 "11 December 1991" +.SH NAME +cjpeg \- compress an image file to a JPEG file +.SH SYNOPSIS +.B cjpeg +[ +.BI \-Q " quality" +] +[ +.B \-oTIad +] +[ +.I filename +] +.LP +.SH DESCRIPTION +.LP +.B cjpeg +compresses the named image file, or the standard input if no file is +named, and produces a JPEG/JFIF file on the standard output. +The currently supported image file formats are: PPM (PBMPLUS color +format), PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster +Toolkit format). (RLE is supported only if the URT library is available.) +.SH OPTIONS +.TP +.BI \-Q " quality" +Scale quantization tables to adjust image quality. Quality is 0 (worst) to +100 (best); default is 75. (See below for more info.) +.TP +.B \-o +Perform optimization of entropy encoding parameters. Without this, default +encoding parameters are used. +.B \-o +usually makes the JPEG file a little smaller, but +.B cjpeg +runs much slower. Image quality and speed of decompression are unaffected by +.BR \-o . +.TP +.B \-T +Input file is Targa format. Targa files that contain an "identification" +field will not be automatically recognized by +.BR cjpeg ; +for such files you must specify +.B \-T +to force +.B cjpeg +to treat the input as Targa format. +.TP +.B \-I +Generate noninterleaved JPEG file (not yet supported). +.TP +.B \-a +Use arithmetic coding rather than Huffman coding (not currently +supported for legal reasons). +.TP +.B \-d +Enable debug printout. More +.BR \-d 's +give more output. Also, version information is printed at startup. +.PP +The +.B \-Q +switch lets you trade off compressed file size against quality of the +reconstructed image: the higher the +.B \-Q +setting, the larger the JPEG file, and the closer the output image will be to +the original input. Normally you want to use the lowest +.B \-Q +setting (smallest file) that decompresses into something visually +indistinguishable from the original image. For this purpose the +.B \-Q +setting should be between 50 and 95; the default of 75 is often about right. +If you see defects at +.B \-Q +75, then go up 5 or 10 counts at a time until you are happy with the output +image. (The optimal setting will vary from one image to another.) +.PP +.B \-Q +100 will generate a quantization table of all 1's, eliminating loss in the +quantization step (but there is still information loss in subsampling, as well +as roundoff error). This setting is mainly of interest for experimental +purposes. +.B \-Q +values above about 95 are +.B not +recommended for normal use; the compressed file size goes up dramatically for +hardly any gain in output image quality. +.PP +In the other direction, +.B \-Q +values below 50 will produce very small files of low image quality. Settings +around 5 to 10 might be useful in preparing an index of a large image library, +for example. Try +.B \-Q +2 (or so) for some amusing Cubist effects. (Note: +.B \-Q +values below about 25 generate 2-byte quantization tables, which are +considered optional in the JPEG standard. +.B cjpeg +emits a warning message when you give such a +.B \-Q +value, because some commercial JPEG programs may be unable to decode the +resulting file.) +.SH EXAMPLES +.LP +This example compresses the PPM file foo.ppm with a quality factor of +60 and saves the output as foo.jpg: +.IP +.B cjpeg \-Q +.I 60 foo.ppm +.B > +.I foo.jpg +.SH SEE ALSO +.BR djpeg (1) +.br +Wallace, Gregory K. "The JPEG Still Picture Compression Standard", +Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. +.SH AUTHOR +Independent JPEG Group +.SH BUGS +Arithmetic coding and interleaved output not yet supported. +.PP +Not all variants of Targa file format are supported. +.PP +The +.B -T +switch is not a bug, it's a feature. (It would be a bug if the Targa format +designers had not been clueless.) +.PP +Not as fast as we'd like. diff --git a/config.c b/config.c new file mode 100644 index 00000000..938fd197 --- /dev/null +++ b/config.c @@ -0,0 +1,403 @@ +/* + * config.c + * + * Copyright (C) 1991, 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. + */ + +/* + * This program is intended to help you determine how to configure the JPEG + * software for installation on a particular system. The idea is to try to + * compile and execute this program. If your compiler fails to compile the + * program, make changes as indicated in the comments below. Once you can + * compile the program, run it, and it will tell you how to set the various + * switches in jconfig.h and in your Makefile. + * + * This could all be done automatically if we could assume we were on a Unix + * system, but we don't want to assume that, so you'll have to edit and + * recompile this program until it works. + * + * As a general rule, each time you try to compile this program, + * pay attention only to the *first* error message you get from the compiler. + * Many C compilers will issue lots of spurious error messages once they + * have gotten confused. Go to the line indicated in the first error message, + * and read the comments preceding that line to see what to change. + * + * Almost all of the edits you may need to make to this program consist of + * changing a line that reads "#define SOME_SYMBOL" to "#undef SOME_SYMBOL", + * or vice versa. This is called defining or undefining that symbol. + */ + + +/* First we must see if your system has the include files we need. + * We start out with the assumption that your system follows the ANSI + * conventions for include files. If you get any error in the next dozen + * lines, undefine INCLUDES_ARE_ANSI. + */ + +#define INCLUDES_ARE_ANSI /* replace 'define' by 'undef' if error here */ + +#ifdef INCLUDES_ARE_ANSI /* this will be skipped if you undef... */ +#include /* If you ain't got this, you ain't got C. */ +#ifdef __SASC /* Amiga SAS C provides size_t in stddef.h. */ +#include /* (They are wrong...) */ +#endif +#include /* size_t might be here too. */ +typedef size_t my_size_t; /* The payoff: do we have size_t now? */ +#include /* Check other ANSI includes we use. */ +#endif + + +/* If your system doesn't follow the ANSI conventions, we have to figure out + * what it does follow. If you didn't get an error before this line, you can + * ignore everything down to "#define HAVE_ANSI_DEFINITIONS". + */ + +#ifndef INCLUDES_ARE_ANSI /* skip these tests if INCLUDES_ARE_ANSI */ + +#include /* If you ain't got this, you ain't got C. */ + +/* jinclude.h will try to include if you don't set + * INCLUDES_ARE_ANSI. We need to test whether that include file is provided. + * If you get an error here, undefine HAVE_TYPES_H. + */ + +#define HAVE_TYPES_H + +#ifdef HAVE_TYPES_H +#include +#endif + +/* We have to see if your string functions are defined by + * strings.h (BSD convention) or string.h (everybody else). + * We try the non-BSD convention first; define BSD if the compiler + * says it can't find string.h. + */ + +#undef BSD + +#ifdef BSD +#include +#else +#include +#endif + +/* Usually size_t is defined in stdio.h, sys/types.h, and/or string.h. + * If not, you'll get an error on the "typedef size_t my_size_t;" line below. + * In that case, you'll have to search through your system library to + * figure out which include file defines "size_t". Look for a line that + * says "typedef something-or-other size_t;" (stddef.h and stdlib.h are + * good places to look first). Then, change the line below that says + * "#include " to instead include the file + * you found size_t in, and define NEED_SPECIAL_INCLUDE. + */ + +#undef NEED_SPECIAL_INCLUDE /* assume we DON'T need it, for starters */ + +#ifdef NEED_SPECIAL_INCLUDE +#include +#endif + +typedef size_t my_size_t; /* The payoff: do we have size_t now? */ + + +#endif /* INCLUDES_ARE_ANSI */ + + + +/* The next question is whether your compiler supports ANSI-style function + * definitions. You need to know this in order to choose between using + * makefile.ansi and using makefile.unix. + * The #define line below is set to assume you have ANSI function definitions. + * If you get an error in this group of lines, undefine HAVE_ANSI_DEFINITIONS. + */ + +#define HAVE_ANSI_DEFINITIONS + +#ifdef HAVE_ANSI_DEFINITIONS +int testfunction (int arg1, int * arg2); /* check prototypes */ + +struct methods_struct { /* check method-pointer declarations */ + int (*error_exit) (char *msgtext); + int (*trace_message) (char *msgtext); +}; + +int testfunction (int arg1, int * arg2) /* check definitions */ +{ + return arg2[arg1]; +} +#endif + + +/* Now we want to find out if your compiler knows what "unsigned char" means. + * If you get an error on the "unsigned char un_char;" line, + * then undefine HAVE_UNSIGNED_CHAR. + */ + +#define HAVE_UNSIGNED_CHAR + +#ifdef HAVE_UNSIGNED_CHAR +unsigned char un_char; +#endif + + +/* Now we want to find out if your compiler knows what "unsigned short" means. + * If you get an error on the "unsigned short un_short;" line, + * then undefine HAVE_UNSIGNED_SHORT. + */ + +#define HAVE_UNSIGNED_SHORT + +#ifdef HAVE_UNSIGNED_SHORT +unsigned short un_short; +#endif + + +/* Now we want to find out if your compiler understands type "void". + * If you get an error anywhere in here, undefine HAVE_VOID. + */ + +#define HAVE_VOID + +#ifdef HAVE_VOID +typedef void * void_ptr; /* check void * */ +typedef void (*void_func) (); /* check ptr to function returning void */ + +void testfunction2 (arg1, arg2) /* check void function result */ + void_ptr arg1; + void_func arg2; +{ + char * locptr = (char *) arg1; /* check casting to and from void * */ + arg1 = (void *) locptr; + (*arg2) (1, 2); /* check call of fcn returning void */ +} +#endif + + +/* Now we want to find out if your compiler knows what "const" means. + * If you get an error here, undefine HAVE_CONST. + */ + +#define HAVE_CONST + +#ifdef HAVE_CONST +static const int carray[3] = {1, 2, 3}; + +int testfunction3 (arg1) + const int arg1; +{ + return carray[arg1]; +} +#endif + + + +/************************************************************************ + * OK, that's it. You should not have to change anything beyond this + * point in order to compile and execute this program. (You might get + * some warnings, but you can ignore them.) + * When you run the program, it will make a couple more tests that it + * can do automatically, and then it will print out a summary of the changes + * that you need to make to the makefile and jconfig.h. + ************************************************************************ + */ + + +static int any_changes = 0; + +int new_change () +{ + if (! any_changes) { + printf("\nMost of the changes recommended by this program can be made either\n"); + printf("by editing jconfig.h, or by adding -Dsymbol switches to the CFLAGS\n"); + printf("line in your Makefile. (Some PC compilers expect /Dsymbol instead.)\n"); + printf("The CFLAGS method is simpler, but if your system doesn't use makefiles,\n"); + printf("or if your compiler doesn't support -D, then you must change jconfig.h.\n"); + any_changes = 1; + } + printf("\n"); /* blank line before each problem report */ + return 0; +} + + +int test_char_sign (arg) + int arg; +{ + if (arg == 189) { /* expected result for unsigned char */ + new_change(); + printf("You should add -DCHAR_IS_UNSIGNED to CFLAGS,\n"); + printf("or else remove the /* */ comment marks from the line\n"); + printf("/* #define CHAR_IS_UNSIGNED */ in jconfig.h.\n"); + printf("(Be sure to delete the space before the # character too.)\n"); + } + else if (arg != -67) { /* expected result for signed char */ + new_change(); + printf("Hmm, it seems 'char' is less than eight bits wide on your machine.\n"); + printf("I fear the JPEG software will not work at all.\n"); + } + return 0; +} + + +int test_shifting (arg) + long arg; +/* See whether right-shift on a long is signed or not. */ +{ + long res = arg >> 4; + + if (res == 0x80817F4L) { /* expected result for unsigned */ + new_change(); + printf("You must add -DRIGHT_SHIFT_IS_UNSIGNED to CFLAGS,\n"); + printf("or else remove the /* */ comment marks from the line\n"); + printf("/* #define RIGHT_SHIFT_IS_UNSIGNED */ in jconfig.h.\n"); + } + else if (res != -0x7F7E80CL) { /* expected result for signed */ + new_change(); + printf("Right shift isn't acting as I expect it to.\n"); + printf("I fear the JPEG software will not work at all.\n"); + } + return 0; +} + + +int main (argc, argv) + int argc; + char ** argv; +{ + char signed_char_check = (char) (-67); + + printf("Results of configuration check for Independent JPEG Group's software:\n"); + printf("\nIf there's not a specific makefile provided for your compiler,\n"); +#ifdef HAVE_ANSI_DEFINITIONS + printf("you should use makefile.ansi as the starting point for your Makefile.\n"); +#else + printf("you should use makefile.unix as the starting point for your Makefile.\n"); +#endif + + /* Check whether we have all the ANSI features, */ + /* and whether this agrees with __STDC__ being predefined. */ +#ifdef __STDC__ +#define MY__STDC__ /* ANSI compilers won't allow redefining __STDC__ */ +#endif + +#ifdef HAVE_ANSI_DEFINITIONS +#ifdef HAVE_UNSIGNED_CHAR +#ifdef HAVE_UNSIGNED_SHORT +#ifdef HAVE_CONST +#define HAVE_ALL_ANSI_FEATURES +#endif +#endif +#endif +#endif + +#ifdef HAVE_ALL_ANSI_FEATURES +#ifndef MY__STDC__ + new_change(); + printf("Your compiler doesn't claim to be ANSI-compliant, but it is close enough\n"); + printf("for me. Either add -D__STDC__ to CFLAGS, or add #define __STDC__ at the\n"); + printf("beginning of jinclude.h (NOT jconfig.h).\n"); + printf("Some compilers will not let you do this: they will complain that __STDC__\n"); + printf("is a reserved name. In that case you have a compiler that really is ANSI,\n"); + printf("but you have to give it a special switch (often -ansi) to make it so.\n"); + printf("Check your compiler documentation and add the proper switch to CFLAGS.\n"); +#define MY__STDC__ +#endif +#else /* !HAVE_ALL_ANSI_FEATURES */ +#ifdef MY__STDC__ + new_change(); + printf("Your compiler claims to be ANSI-compliant, but it is lying!\n"); + printf("Either add -U__STDC__ to CFLAGS, or add #undef __STDC__\n"); + printf("at the beginning of jinclude.h (NOT jconfig.h).\n"); +#undef MY__STDC__ +#endif +#endif /* HAVE_ALL_ANSI_FEATURES */ + +#ifndef MY__STDC__ + +#ifdef HAVE_ANSI_DEFINITIONS + new_change(); + printf("You should add -DPROTO to CFLAGS, or else take out the several\n"); + printf("#ifdef/#else/#endif lines surrounding #define PROTO in jconfig.h.\n"); + printf("(Leave only one #define PROTO line.)\n"); +#endif + +#ifdef HAVE_UNSIGNED_CHAR +#ifdef HAVE_UNSIGNED_SHORT + new_change(); + printf("You should add -DHAVE_UNSIGNED_CHAR and -DHAVE_UNSIGNED_SHORT\n"); + printf("to CFLAGS, or else take out the #ifdef __STDC__/#endif lines\n"); + printf("surrounding #define HAVE_UNSIGNED_CHAR and #define HAVE_UNSIGNED_SHORT\n"); + printf("in jconfig.h.\n"); +#else /* only unsigned char */ + new_change(); + printf("You should add -DHAVE_UNSIGNED_CHAR to CFLAGS,\n"); + printf("or else move #define HAVE_UNSIGNED_CHAR outside the\n"); + printf("#ifdef __STDC__/#endif lines surrounding it in jconfig.h.\n"); +#endif +#else /* !HAVE_UNSIGNED_CHAR */ +#ifdef HAVE_UNSIGNED_SHORT + new_change(); + printf("You should add -DHAVE_UNSIGNED_SHORT to CFLAGS,\n"); + printf("or else move #define HAVE_UNSIGNED_SHORT outside the\n"); + printf("#ifdef __STDC__/#endif lines surrounding it in jconfig.h.\n"); +#endif +#endif /* HAVE_UNSIGNED_CHAR */ + +#ifdef HAVE_CONST + new_change(); + printf("You can delete the #define const line from jconfig.h.\n"); + printf("(But things should still work if you don't.)\n"); +#endif + +#endif /* MY__STDC__ */ + + test_char_sign((int) signed_char_check); + + test_shifting(-0x7F7E80B1L); + +#ifndef HAVE_VOID + new_change(); + printf("You should add -Dvoid=char to CFLAGS,\n"); + printf("or else remove the /* */ comment marks from the line\n"); + printf("/* #define void char */ in jconfig.h.\n"); + printf("(Be sure to delete the space before the # character too.)\n"); +#endif + +#ifdef INCLUDES_ARE_ANSI +#ifndef MY__STDC__ + new_change(); + printf("You should add -DINCLUDES_ARE_ANSI to CFLAGS, or else add\n"); + printf("#define INCLUDES_ARE_ANSI at the beginning of jinclude.h (NOT jconfig.h).\n"); +#endif +#else /* !INCLUDES_ARE_ANSI */ +#ifdef MY__STDC__ + new_change(); + printf("You should add -DNONANSI_INCLUDES to CFLAGS, or else add\n"); + printf("#define NONANSI_INCLUDES at the beginning of jinclude.h (NOT jconfig.h).\n"); +#endif +#ifdef NEED_SPECIAL_INCLUDE + new_change(); + printf("In jinclude.h, change the line reading #include \n"); + printf("to instead include the file you found size_t in.\n"); +#else /* !NEED_SPECIAL_INCLUDE */ +#ifndef HAVE_TYPES_H + new_change(); + printf("In jinclude.h, delete the line reading #include .\n"); +#endif +#endif /* NEED_SPECIAL_INCLUDE */ +#ifdef BSD + new_change(); + printf("You should add -DBSD to CFLAGS, or else add\n"); + printf("#define BSD at the beginning of jinclude.h (NOT jconfig.h).\n"); +#endif +#endif /* INCLUDES_ARE_ANSI */ + + if (any_changes) { + printf("\nI think that's everything...\n"); + } else { + printf("\nI think jconfig.h is OK as distributed.\n"); + } + + return any_changes; +} diff --git a/djpeg.1 b/djpeg.1 new file mode 100644 index 00000000..5eec670a --- /dev/null +++ b/djpeg.1 @@ -0,0 +1,114 @@ +.TH DJPEG 1 "11 December 1991" +.SH NAME +djpeg \- decompress a JPEG file to an image file +.SH SYNOPSIS +.B djpeg +[ +.B \-GPRTbgD2d +] +[ +.BI \-q " N" +] +[ +.I filename +] +.LP +.SH DESCRIPTION +.LP +.B djpeg +decompresses the named JPEG file, or the standard input if no file is named, +and produces an image file on the standard output. PPM, GIF, Targa, or RLE +output format can be selected. (RLE is supported only if the URT library is +available.) +.LP +The color quantization algorithm is currently shoddy. Because of this, the +GIF output mode is not recommended in the current release, except for +gray-scale output (obtained with +.BR \-g ). +.SH OPTIONS +.TP +.B \-G +Select GIF output format (implies +.BR \-q , +with default of 256 colors). +Currently the color quantization uses a shoddy algorithm and external +quantization (e.g. +.IR ppmquant , +.IR rlequant ) +is recommended before conversion to GIF format. +.TP +.B \-P +Select PPM or PGM output format (this is the default). PGM is emitted if the +JPEG file is gray-scale or if +.B \-g +is specified. +.TP +.B \-R +Select RLE output format. Requires URT library. +.TP +.B \-T +Select Targa output format. Gray-scale format is emitted if the JPEG file is +gray-scale or if +.B \-g +is specified; otherwise, colormapped format is emitted if +.B \-q +is specified; otherwise, 24-bit full-color format is emitted. +.TP +.B \-b +Perform cross-block smoothing. This is quite memory-intensive and only seems +to improve the image at low quality settings (\fB\-Q\fR 10 to 20 or so). +At normal +.B \-Q +settings it may make the image worse. +.TP +.B \-g +Force gray-scale output even if input is color. +.TP +.BI \-q " N" +Quantize to N colors. +.TP +.B \-D +Do not use dithering in color quantization. By default, Floyd-Steinberg +dithering is applied when quantizing colors, but on some images dithering may +result in objectionable "graininess". If that happens, you can turn off +dithering with +.BR \-D . +.TP +.B \-2 +Use two-pass color quantization (not yet supported). +.TP +.B \-d +Enable debug printout. More +.BR \-d 's +give more output. Also, version information is printed at startup. +.SH EXAMPLES +.LP +This example decompresses the JPEG file foo.jpg and saves the output +as a gray-scale image in foo.pgm: +.IP +.B djpeg \-g +.I foo.jpg +.B > +.I foo.pgm +.SH SEE ALSO +.BR cjpeg (1) +.br +.BR ppmquant (1) +[From the PBMplus distribution] +.br +.BR rlequant (1) +[From the Utah Raster Toolkit distribution] +.br +Wallace, Gregory K. "The JPEG Still Picture Compression Standard", +Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. +.SH AUTHOR +Independent JPEG Group +.SH BUGS +.B djpeg +currently uses a shoddy color quantization algorithm. This leads to +poor GIF file output. Two-pass color quantization is not yet +supported. +.PP +Arithmetic coding is not supported for legal reasons. +.PP +Not as fast as we'd like. diff --git a/egetopt.c b/egetopt.c index 8183d358..dbfd7fd5 100644 --- a/egetopt.c +++ b/egetopt.c @@ -40,21 +40,27 @@ * UUCP: ...!ames!fxgrp!ljz * * May, 1988 + * + * Modified for use in free JPEG code: + * + * Ed Hanway + * UUCP: uunet!sisd!jeh + * + * October, 1991 */ -/* - * If you want, include stdio.h or something where EOF and NULL are defined. - * However, egetopt() is written so as not to need stdio.h, which should - * make it significantly smaller on some systems. +/* The original egetopt.c was written not to need stdio.h. + * For the JPEG code this is an unnecessary and unportable assumption. + * Also, we make all the variables and routines "static" to avoid + * possible conflicts with a system-library version of getopt. + * + * In the JPEG code, this file is compiled by #including it in jcmain.c + * or jdmain.c. Since ANSI2KNR does not process include files, we can't + * rely on it to convert function definitions to K&R style. Hence we + * provide both styles of function header with an explicit #ifdef PROTO (ick). */ -#ifndef EOF -# define EOF (-1) -#endif /* ! EOF */ - -#ifndef NULL -# define NULL (char *)0 -#endif /* ! NULL */ +#define GVAR static /* make empty to export these variables */ /* * None of these constants are referenced in the executable portion of @@ -63,23 +69,21 @@ #define BADCH (int)'?' #define NEEDSEP (int)':' #define MAYBESEP (int)'\0' -#define ERRFD 2 #define EMSG "" #define START "-" /* * Here are all the pertinent global variables. */ -int opterr = 1; /* if true, output error message */ -int optind = 1; /* index into parent argv vector */ -int optopt; /* character checked for validity */ -int optbad = BADCH; /* character returned on error */ -int optchar = 0; /* character that begins returned option */ -int optneed = NEEDSEP; /* flag for mandatory argument */ -int optmaybe = MAYBESEP;/* flag for optional argument */ -int opterrfd = ERRFD; /* file descriptor for error text */ -char *optarg; /* argument associated with option */ -char *optstart = START; /* list of characters that start options */ +GVAR int opterr = 1; /* if true, output error message */ +GVAR int optind = 1; /* index into parent argv vector */ +GVAR int optopt; /* character checked for validity */ +GVAR int optbad = BADCH; /* character returned on error */ +GVAR int optchar = 0; /* character that begins returned option */ +GVAR int optneed = NEEDSEP; /* flag for mandatory argument */ +GVAR int optmaybe = MAYBESEP; /* flag for optional argument */ +GVAR const char *optarg; /* argument associated with option */ +GVAR const char *optstart = START; /* list of characters that start options */ /* @@ -88,17 +92,11 @@ char *optstart = START; /* list of characters that start options */ /* * Conditionally print out an error message and return (depends on the - * setting of 'opterr' and 'opterrfd'). Note that this version of - * TELL() doesn't require the existence of stdio.h. + * setting of 'opterr'). */ #define TELL(S) { \ - if (opterr && opterrfd >= 0) { \ - char option = optopt; \ - write(opterrfd, *nargv, strlen(*nargv)); \ - write(opterrfd, (S), strlen(S)); \ - write(opterrfd, &option, 1); \ - write(opterrfd, "\n", 1); \ - } \ + if (opterr) \ + fprintf(stderr, "%s%s%c\n", *nargv, (S), optopt); \ return (optbad); \ } @@ -106,10 +104,16 @@ char *optstart = START; /* list of characters that start options */ * This works similarly to index() and strchr(). I include it so that you * don't need to be concerned as to which one your system has. */ -static char * -_sindex(string, ch) -char *string; -int ch; + +#ifdef PROTO +LOCAL const char * +_sindex (const char *string, int ch) +#else +LOCAL const char * +_sindex (string, ch) + const char *string; + int ch; +#endif { if (string != NULL) { for (; *string != '\0'; ++string) { @@ -125,15 +129,21 @@ int ch; /* * Here it is: */ -int -egetopt(nargc, nargv, ostr) -int nargc; -char **nargv; -char *ostr; + +#ifdef PROTO +LOCAL int +egetopt (int nargc, char **nargv, const char *ostr) +#else +LOCAL int +egetopt (nargc, nargv, ostr) + int nargc; + char **nargv; + const char *ostr; +#endif { - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ - register char *osi = NULL; /* option start list index */ + static const char *place = EMSG; /* option letter processing */ + register const char *oli; /* option letter list index */ + register const char *osi = NULL; /* option start list index */ if (nargv == (char **)NULL) { return (EOF); diff --git a/jbsmooth.c b/jbsmooth.c index ad2138df..ee58c91b 100644 --- a/jbsmooth.c +++ b/jbsmooth.c @@ -94,7 +94,7 @@ smooth_coefficients (decompress_info_ptr cinfo, #define ABS(x) ((x) < 0 ? -(x) : (x)) -#define COND_ASSIGN(_ac,_n,_z) if ((ABS(output[col][_n] - (_ac))<<1) <= Qptr[_z]) output[col][_n] = (_ac) +#define COND_ASSIGN(_ac,_n,_z) if ((ABS(output[col][_n] - (_ac))<<1) <= Qptr[_z]) output[col][_n] = (JCOEF) (_ac) COND_ASSIGN(AC01, 1, 1); COND_ASSIGN(AC02, 2, 5); diff --git a/jccolor.c b/jccolor.c index 7fd198c9..bd0e1a25 100644 --- a/jccolor.c +++ b/jccolor.c @@ -66,11 +66,14 @@ get_rgb_ycc_rows (compress_info_ptr cinfo, * must be too; do not need an explicit range-limiting operation. */ /* Y */ - *outptr0++ = ( 306*r + 601*g + 117*b + (INT32) 512) >> 10; + *outptr0++ = (JSAMPLE) + (( 306*r + 601*g + 117*b + (INT32) 512) >> 10); /* Cb */ - *outptr1++ = ((-173)*r - 339*g + 512*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10; + *outptr1++ = (JSAMPLE) + (((-173)*r - 339*g + 512*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10); /* Cr */ - *outptr2++ = ( 512*r - 429*g - 83*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10; + *outptr2++ = (JSAMPLE) + (( 512*r - 429*g - 83*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10); } } } diff --git a/jcdeflts.c b/jcdeflts.c index cd1624ad..15039899 100644 --- a/jcdeflts.c +++ b/jcdeflts.c @@ -6,6 +6,8 @@ * For conditions of distribution and use, see the accompanying README file. * * This file contains optional default-setting code for the JPEG compressor. + * User interfaces do not have to use this file, but those that don't use it + * must know a lot more about the innards of the JPEG code. */ #include "jinclude.h" @@ -17,11 +19,11 @@ add_huff_table (compress_info_ptr cinfo, /* Define a Huffman table */ { if (*htblptr == NULL) - *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); - memcpy((void *) (*htblptr)->bits, (void *) bits, + memcpy((void *) (*htblptr)->bits, (const void *) bits, SIZEOF((*htblptr)->bits)); - memcpy((void *) (*htblptr)->huffval, (void *) val, + memcpy((void *) (*htblptr)->huffval, (const void *) val, SIZEOF((*htblptr)->huffval)); /* Initialize sent_table FALSE so table will be written to JPEG file. @@ -152,7 +154,7 @@ add_quant_table (compress_info_ptr cinfo, int which_tbl, long temp; if (*qtblptr == NULL) - *qtblptr = (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); + *qtblptr = (QUANT_TBL_PTR) (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); for (i = 0; i < DCTSIZE2; i++) { temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; @@ -207,14 +209,16 @@ j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline) * * User interfaces that don't choose to use this routine must do their * own setup of all these parameters. Alternately, you can call this - * to establish defaults and then alter parameters selectively. + * to establish defaults and then alter parameters selectively. This + * is the recommended approach since, if we add any new parameters, + * your code will still work (they'll be set to reasonable defaults). * - * See above for the meaning of the 'quality' parameter. Typically, - * the application's default quality setting will be passed to this - * routine. A later call on j_set_quality() can be used to change to - * a user-specified quality setting. + * See above for the meaning of the 'quality' and 'force_baseline' parameters. + * Typically, the application's default quality setting will be passed to this + * routine. A later call on j_set_quality() can be used to change to a + * user-specified quality setting. * - * This sets up for a color image; to output a grayscale image, + * This routine sets up for a color image; to output a grayscale image, * do this first and call j_monochrome_default() afterwards. * (The latter can be called within c_ui_method_selection, so the * choice can depend on the input file header.) @@ -223,17 +227,17 @@ j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline) * a JFIF header (set write_JFIF_header = FALSE). * * CAUTION: if you want to compress multiple images per run, it's safest - * to call j_default_compression before *each* call to jpeg_compress (and - * j_free_defaults afterwards). If this isn't practical, you'll have to + * to call j_c_defaults before *each* call to jpeg_compress (and + * j_c_free_defaults afterwards). If this isn't practical, you'll have to * be careful to reset any individual parameters that may change during - * the compression run. The main thing you need to worry about as this - * is written is that the sent_table boolean in each Huffman table must - * be reset to FALSE before each compression; otherwise, Huffman tables - * won't get emitted for the second and subsequent images. + * the compression run. The main thing you need to worry about at present + * is that the sent_table boolean in each Huffman table must be reset to + * FALSE before each compression; otherwise, Huffman tables won't get + * emitted for the second and subsequent images. */ GLOBAL void -j_default_compression (compress_info_ptr cinfo, int quality) +j_c_defaults (compress_info_ptr cinfo, int quality, boolean force_baseline) /* NB: the external methods must already be set up. */ { short i; @@ -260,8 +264,8 @@ j_default_compression (compress_info_ptr cinfo, int quality) cinfo->write_JFIF_header = TRUE; cinfo->jpeg_color_space = CS_YCbCr; cinfo->num_components = 3; - cinfo->comp_info = (*cinfo->emethods->alloc_small) - (4 * SIZEOF(jpeg_component_info)); + cinfo->comp_info = (jpeg_component_info *) + (*cinfo->emethods->alloc_small) (4 * SIZEOF(jpeg_component_info)); /* Note: we allocate a 4-entry comp_info array so that user interface can * easily change over to CMYK color space if desired. */ @@ -294,8 +298,7 @@ j_default_compression (compress_info_ptr cinfo, int quality) compptr->ac_tbl_no = 1; /* Set up two quantization tables using the specified quality scaling */ - /* Baseline compatibility is forced (a nonissue for reasonable defaults) */ - j_set_quality(cinfo, quality, TRUE); + j_set_quality(cinfo, quality, force_baseline); /* Set up two Huffman tables in case user interface wants Huffman coding */ std_huff_tables(cinfo); @@ -327,7 +330,7 @@ j_default_compression (compress_info_ptr cinfo, int quality) GLOBAL void j_monochrome_default (compress_info_ptr cinfo) -/* Change the j_default_compression() values to emit a monochrome JPEG file. */ +/* Change the j_c_defaults() values to emit a monochrome JPEG file. */ { jpeg_component_info * compptr; @@ -341,13 +344,13 @@ j_monochrome_default (compress_info_ptr cinfo) -/* This routine releases storage allocated by j_default_compression. +/* This routine releases storage allocated by j_c_defaults. * Note that freeing the method pointer structs and the compress_info_struct * itself are the responsibility of the user interface. */ GLOBAL void -j_free_defaults (compress_info_ptr cinfo) +j_c_free_defaults (compress_info_ptr cinfo) { short i; diff --git a/jchuff.c b/jchuff.c index 531bc75e..44a0885a 100644 --- a/jchuff.c +++ b/jchuff.c @@ -39,8 +39,8 @@ fix_huff_tbl (HUFF_TBL * htbl) p = 0; for (l = 1; l <= 16; l++) { - for (i = 1; i <= htbl->bits[l]; i++) - huffsize[p++] = l; + for (i = 1; i <= (int) htbl->bits[l]; i++) + huffsize[p++] = (char) l; } huffsize[p] = 0; lastp = p; @@ -52,7 +52,7 @@ fix_huff_tbl (HUFF_TBL * htbl) si = huffsize[0]; p = 0; while (huffsize[p]) { - while (huffsize[p] == si) { + while (((int) huffsize[p]) == si) { huffcode[p++] = code; code++; } @@ -95,10 +95,10 @@ flush_bytes (void) } -#define emit_byte(val) ((bytes_in_buffer >= JPEG_BUF_SIZE ? \ - (flush_bytes(), 0) : 0), \ - output_buffer[bytes_in_buffer] = (val), \ - bytes_in_buffer++) +#define emit_byte(val) \ + MAKESTMT( if (bytes_in_buffer >= JPEG_BUF_SIZE) \ + flush_bytes(); \ + output_buffer[bytes_in_buffer++] = (char) (val); ) @@ -157,16 +157,22 @@ flush_bits (void) LOCAL void encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) { - register INT32 temp; + register int temp, temp2; register int nbits; register int k, r, i; /* Encode the DC coefficient difference per section 7.3.5.1 */ - /* Find the number of bits needed for the magnitude of the coefficient */ - temp = block[0]; - if (temp < 0) temp = -temp; + temp = temp2 = block[0]; + + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + /* For a negative input, want temp2 = bitwise complement of abs(input) */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } + /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { nbits++; @@ -175,13 +181,10 @@ encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) /* Emit the Huffman-coded symbol for the number of bits */ emit_bits(dctbl->ehufco[nbits], dctbl->ehufsi[nbits]); - - /* If positive, emit nbits low order bits; */ - /* if negative, emit nbits low order bits of value-1 */ - if ((temp = block[0]) < 0) - temp--; - - emit_bits((UINT16) temp, nbits); + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + emit_bits((UINT16) temp2, nbits); /* Encode the AC coefficients per section 7.3.5.2 */ @@ -196,10 +199,15 @@ encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) emit_bits(actbl->ehufco[0xF0], actbl->ehufsi[0xF0]); r -= 16; } + + temp2 = temp; + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } /* Find the number of bits needed for the magnitude of the coefficient */ - if (temp < 0) temp = -temp; - nbits = 1; /* there must be at least one 1 bit */ while (temp >>= 1) nbits++; @@ -208,12 +216,9 @@ encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) i = (r << 4) + nbits; emit_bits(actbl->ehufco[i], actbl->ehufsi[i]); - /* If positive, emit nbits low order bits; */ - /* if negative, emit nbits low order bits of value-1 */ - if ((temp = block[k]) < 0) - temp--; - - emit_bits((UINT16) temp, nbits); + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + emit_bits((UINT16) temp2, nbits); r = 0; } @@ -488,7 +493,7 @@ gen_huff_coding (compress_info_ptr cinfo, HUFF_TBL *htbl, long freq[]) for (i = 1; i <= MAX_CLEN; i++) { for (j = 0; j <= 255; j++) { if (codesize[j] == i) { - htbl->huffval[p] = j; + htbl->huffval[p] = (UINT8) j; p++; } } @@ -645,7 +650,7 @@ huff_optimize (compress_info_ptr cinfo, MCU_output_caller_ptr source_method) if (dc_count_ptrs[tbl] != NULL) { htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; if (*htblptr == NULL) - *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); /* Set sent_table FALSE so updated table will be written to JPEG file. */ (*htblptr)->sent_table = FALSE; /* Compute the optimal Huffman encoding */ @@ -656,7 +661,7 @@ huff_optimize (compress_info_ptr cinfo, MCU_output_caller_ptr source_method) if (ac_count_ptrs[tbl] != NULL) { htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; if (*htblptr == NULL) - *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); /* Set sent_table FALSE so updated table will be written to JPEG file. */ (*htblptr)->sent_table = FALSE; /* Compute the optimal Huffman encoding */ diff --git a/jcmain.c b/jcmain.c index f71d5adf..3b00b409 100644 --- a/jcmain.c +++ b/jcmain.c @@ -21,7 +21,7 @@ */ #include "jinclude.h" -#ifdef __STDC__ +#ifdef INCLUDES_ARE_ANSI #include /* to declare exit() */ #endif @@ -37,20 +37,14 @@ #define WRITE_BINARY "wb" #endif +#include "jversion.h" /* for version message */ + /* - * If your system has getopt(3), you can use your library version by - * defining HAVE_GETOPT. By default, we use the PD 'egetopt'. + * PD version of getopt(3). */ -#ifdef HAVE_GETOPT -extern int getopt PP((int argc, char **argv, char *optstring)); -extern char * optarg; -extern int optind; -#else #include "egetopt.c" -#define getopt(argc,argv,opt) egetopt(argc,argv,opt) -#endif /* @@ -58,24 +52,44 @@ extern int optind; * and selects the appropriate input-reading module. * * To determine which family of input formats the file belongs to, - * we look only at the first byte of the file, since C does not + * we may look only at the first byte of the file, since C does not * guarantee that more than one character can be pushed back with ungetc. - * This is sufficient for the currently envisioned set of input formats. - * - * If you need to look at more than one character to select an input module, - * you can either - * 1) assume you can fseek() the input file (may fail for piped input); - * 2) assume you can push back more than one character (works in + * Looking at additional bytes would require one of these approaches: + * 1) assume we can fseek() the input file (fails for piped input); + * 2) assume we can push back more than one character (works in * some C implementations, but unportable); - * or 3) don't put back the data, and modify the various input_init - * methods to assume they start reading after the start of file. + * 3) provide our own buffering as is done in djpeg (breaks input readers + * that want to use stdio directly, such as the RLE library); + * or 4) don't put back the data, and modify the input_init methods to assume + * they start reading after the start of file (also breaks RLE library). + * #1 is attractive for MS-DOS but is untenable on Unix. + * + * The most portable solution for file types that can't be identified by their + * first byte is to make the user tell us what they are. This is also the + * only approach for "raw" file types that contain only arbitrary values. + * We presently apply this method for Targa files. Most of the time Targa + * files start with 0x00, so we recognize that case. Potentially, however, + * a Targa file could start with any byte value (byte 0 is the length of the + * seldom-used ID field), so we accept a -T switch to force Targa input mode. */ +static boolean is_targa; /* records user -T switch */ + + LOCAL void select_file_type (compress_info_ptr cinfo) { int c; + if (is_targa) { +#ifdef TARGA_SUPPORTED + jselrtarga(cinfo); +#else + ERREXIT(cinfo->emethods, "Targa support was not compiled"); +#endif + return; + } + if ((c = getc(cinfo->input_file)) == EOF) ERREXIT(cinfo->emethods, "Empty input file"); @@ -89,9 +103,23 @@ select_file_type (compress_info_ptr cinfo) case 'P': jselrppm(cinfo); break; +#endif +#ifdef RLE_SUPPORTED + case 'R': + jselrrle(cinfo); + break; +#endif +#ifdef TARGA_SUPPORTED + case 0x00: + jselrtarga(cinfo); + break; #endif default: - ERREXIT(cinfo->emethods, "Unsupported input file format"); +#ifdef TARGA_SUPPORTED + ERREXIT(cinfo->emethods, "Unrecognized input file format --- did you forget -T ?"); +#else + ERREXIT(cinfo->emethods, "Unrecognized input file format"); +#endif break; } @@ -126,7 +154,7 @@ usage (char * progname) /* complain about bad command line */ { fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-I] [-Q quality 0..100] [-a] [-o] [-d]"); + fprintf(stderr, "[-Q quality 0..100] [-o] [-T] [-I] [-a] [-d]"); #ifdef TWO_FILE_COMMANDLINE fprintf(stderr, " inputfile outputfile\n"); #else @@ -160,18 +188,13 @@ main (int argc, char **argv) jselvirtmem(&e_methods); /* memory allocation routines */ c_methods.c_ui_method_selection = c_ui_method_selection; - /* Set up default input and output file references. */ - /* (These may be overridden below.) */ - cinfo.input_file = stdin; - cinfo.output_file = stdout; + /* Set up default JPEG parameters. */ + j_c_defaults(&cinfo, 75, FALSE); /* default quality level = 75 */ + is_targa = FALSE; - /* Set up default parameters. */ - e_methods.trace_level = 0; - j_default_compression(&cinfo, 75); /* default quality level */ - - /* Scan parameters */ + /* Scan command line options, adjust parameters */ - while ((c = getopt(argc, argv, "IQ:aod")) != EOF) + while ((c = egetopt(argc, argv, "IQ:Taod")) != EOF) switch (c) { case 'I': /* Create noninterleaved file. */ #ifdef MULTISCAN_FILES_SUPPORTED @@ -188,13 +211,16 @@ main (int argc, char **argv) usage(argv[0]); if (sscanf(optarg, "%d", &val) != 1) usage(argv[0]); - /* Note: for now, we leave force_baseline FALSE. - * In a production user interface, probably should make it TRUE - * unless overridden by a separate switch. + /* Note: for now, we make force_baseline FALSE. + * This means non-baseline JPEG files can be created with low Q values. + * To ensure only baseline files are generated, pass TRUE instead. */ j_set_quality(&cinfo, val, FALSE); } break; + case 'T': /* Input file is Targa format. */ + is_targa = TRUE; + break; case 'a': /* Use arithmetic coding. */ #ifdef ARITH_CODING_SUPPORTED cinfo.arith_code = TRUE; @@ -222,6 +248,11 @@ main (int argc, char **argv) break; } + /* If -d appeared, print version identification */ + if (e_methods.trace_level > 0) + fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n", + JVERSION, JCOPYRIGHT); + /* Select the input and output files */ #ifdef TWO_FILE_COMMANDLINE @@ -241,6 +272,9 @@ main (int argc, char **argv) #else /* not TWO_FILE_COMMANDLINE -- use Unix style */ + cinfo.input_file = stdin; /* default input file */ + cinfo.output_file = stdout; /* always the output file */ + if (optind < argc-1) { fprintf(stderr, "%s: only one input file\n", argv[0]); usage(argv[0]); @@ -261,9 +295,9 @@ main (int argc, char **argv) jpeg_compress(&cinfo); /* Release memory. */ - j_free_defaults(&cinfo); + j_c_free_defaults(&cinfo); #ifdef MEM_STATS - if (e_methods.trace_level > 0) + if (e_methods.trace_level > 0) /* Optional memory-usage statistics */ j_mem_stats(); #endif diff --git a/jconfig.h b/jconfig.h index 3b22acb7..9d6883bc 100644 --- a/jconfig.h +++ b/jconfig.h @@ -21,7 +21,7 @@ */ /* Does your compiler support function prototypes? */ -/* (If not, you also need to use ansi2knr, see README) */ +/* (If not, you also need to use ansi2knr, see SETUP) */ #ifdef __STDC__ /* ANSI C compilers always have prototypes */ #define PROTO @@ -139,6 +139,8 @@ */ typedef int boolean; +#undef FALSE /* in case these macros already exist */ +#undef TRUE #define FALSE 0 /* values of boolean */ #define TRUE 1 @@ -171,8 +173,10 @@ typedef int boolean; #define JFIF_SUPPORTED /* JFIF or "raw JPEG" files */ #undef JTIFF_SUPPORTED /* JPEG-in-TIFF (not yet implemented) */ /* these defines indicate which image (non-JPEG) file formats are allowed */ -#define PPM_SUPPORTED /* PPM/PGM image file format */ #define GIF_SUPPORTED /* GIF image file format */ +/* #define RLE_SUPPORTED */ /* RLE image file format */ +#define PPM_SUPPORTED /* PPM/PGM image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ #undef TIFF_SUPPORTED /* TIFF image file format (not yet impl.) */ /* more capability options later, no doubt */ @@ -205,6 +209,8 @@ typedef int boolean; /* First define the representation of a single pixel element value. */ #ifdef EIGHT_BIT_SAMPLES +#define BITS_IN_JSAMPLE 8 + /* JSAMPLE should be the smallest type that will hold the values 0..255. * You can use a signed char by having GETJSAMPLE mask it with 0xFF. * If you have only signed chars, and you are more worried about speed than @@ -237,6 +243,8 @@ typedef char JSAMPLE; #ifdef TWELVE_BIT_SAMPLES +#define BITS_IN_JSAMPLE 12 + /* JSAMPLE should be the smallest type that will hold the values 0..4095. */ /* On nearly all machines "short" will do nicely. */ @@ -250,6 +258,8 @@ typedef short JSAMPLE; #ifdef SIXTEEN_BIT_SAMPLES +#define BITS_IN_JSAMPLE 16 + /* JSAMPLE should be the smallest type that will hold the values 0..65535. */ #ifdef HAVE_UNSIGNED_SHORT @@ -312,9 +322,13 @@ typedef unsigned int UINT16; /* INT16 must hold at least the values -32768..32767. */ +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ typedef short INT16; +#endif /* INT32 must hold signed 32-bit values; if your machine happens */ /* to have 64-bit longs, you might want to change this. */ +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ typedef long INT32; +#endif diff --git a/jcpipe.c b/jcpipe.c index f58e7dbf..a911487b 100644 --- a/jcpipe.c +++ b/jcpipe.c @@ -248,7 +248,7 @@ subsample (compress_info_ptr cinfo, * row of whole_scan_MCUs as we can get without exceeding 64KB per row. */ -#define MAX_WHOLE_ROW_BLOCKS (65500 / SIZEOF(JBLOCK)) /* max blocks/row */ +#define MAX_WHOLE_ROW_BLOCKS ((int) (65500 / SIZEOF(JBLOCK))) /* max blocks/row */ static big_barray_ptr whole_scan_MCUs; /* Big array for saving the MCUs */ static int MCUs_in_big_row; /* # of MCUs in each row of whole_scan_MCUs */ @@ -407,7 +407,8 @@ single_ccontroller (compress_info_ptr cinfo) /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ /* Then we have exactly DCTSIZE row groups for subsampling. */ - rows_this_time = MIN(rows_in_mem, cinfo->image_height - cur_pixel_row); + rows_this_time = (int) MIN((long) rows_in_mem, + cinfo->image_height - cur_pixel_row); (*cinfo->methods->get_sample_rows) (cinfo, rows_this_time, fullsize_data[whichss]); @@ -569,7 +570,8 @@ single_eopt_ccontroller (compress_info_ptr cinfo) /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ /* Then we have exactly DCTSIZE row groups for subsampling. */ - rows_this_time = MIN(rows_in_mem, cinfo->image_height - cur_pixel_row); + rows_this_time = (int) MIN((long) rows_in_mem, + cinfo->image_height - cur_pixel_row); (*cinfo->methods->get_sample_rows) (cinfo, rows_this_time, fullsize_data[whichss]); diff --git a/jcsample.c b/jcsample.c index d23e23a0..f86034ed 100644 --- a/jcsample.c +++ b/jcsample.c @@ -63,10 +63,10 @@ subsample (compress_info_ptr cinfo, int which_component, for (v = 0; v < v_expand; v++) { inptr = input_data[inrow+v] + (outcol*h_expand); for (h = 0; h < h_expand; h++) { - outvalue += GETJSAMPLE(*inptr++); + outvalue += (INT32) GETJSAMPLE(*inptr++); } } - *outptr++ = (outvalue + numpix2) / numpix; + *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); } inrow += v_expand; } diff --git a/jdcolor.c b/jdcolor.c index a39ebff2..bc718b78 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -61,15 +61,15 @@ ycc_rgb_convert (decompress_info_ptr cinfo, int num_rows, x = y + 1436*v + 512; /* red */ if (x < 0) x = 0; if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr0++ = x >> 10; + *outptr0++ = (JSAMPLE) (x >> 10); x = y - 352*u - 731*v + 512; /* green */ if (x < 0) x = 0; if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr1++ = x >> 10; + *outptr1++ = (JSAMPLE) (x >> 10); x = y + 1815*u + 512; /* blue */ if (x < 0) x = 0; if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr2++ = x >> 10; + *outptr2++ = (JSAMPLE) (x >> 10); } } } diff --git a/jddeflts.c b/jddeflts.c new file mode 100644 index 00000000..ffcc108e --- /dev/null +++ b/jddeflts.c @@ -0,0 +1,117 @@ +/* + * jddeflts.c + * + * Copyright (C) 1991, 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. + * + * This file contains optional default-setting code for the JPEG decompressor. + * User interfaces do not have to use this file, but those that don't use it + * must know more about the innards of the JPEG code. + */ + +#include "jinclude.h" + + +/* + * Reload the input buffer after it's been emptied, and return the next byte. + * See the JGETC macro for calling conditions. + * + * This routine is used only if the system-dependent user interface passes + * standard_buffering = TRUE to j_d_defaults. Otherwise, the UI must supply + * a corresponding routine. Note that in any case, this routine is likely + * to be used only for JFIF or similar serial-access JPEG file formats. + * The input file control module for a random-access format such as TIFF/JPEG + * would need to override the read_jpeg_data method with its own routine. + * + * This routine would need to be replaced if reading JPEG data from something + * other than a stdio stream. + */ + +METHODDEF int +read_jpeg_data (decompress_info_ptr cinfo) +{ + cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; + + cinfo->bytes_in_buffer = (int) FREAD(cinfo->input_file, + cinfo->next_input_byte, + JPEG_BUF_SIZE); + + if (cinfo->bytes_in_buffer <= 0) + ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); + + return JGETC(cinfo); +} + + + +/* Default parameter setup for decompression. + * + * User interfaces that don't choose to use this routine must do their + * own setup of all these parameters. Alternately, you can call this + * to establish defaults and then alter parameters selectively. This + * is the recommended approach since, if we add any new parameters, + * your code will still work (they'll be set to reasonable defaults). + * + * standard_buffering should be TRUE if the JPEG data is to come from + * a stdio stream and the user interface isn't interested in changing + * the normal input-buffering logic. If FALSE is passed, the user + * interface must provide its own read_jpeg_data method and must + * set up its own input buffer. (Alternately, you can pass TRUE to + * let the buffer be allocated here, then override read_jpeg_data with + * your own routine.) + */ + +GLOBAL void +j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering) +/* NB: the external methods must already be set up. */ +{ + /* Default to RGB output */ + /* UI can override by changing out_color_space */ + cinfo->out_color_space = CS_RGB; + cinfo->jpeg_color_space = CS_UNKNOWN; + /* Setting any other value in jpeg_color_space overrides heuristics in */ + /* jrdjfif.c. That might be useful when reading non-JFIF JPEG files, */ + /* but ordinarily the UI shouldn't change it. */ + + /* Default to no gamma correction of output */ + cinfo->output_gamma = 1.0; + + /* Default to no color quantization */ + cinfo->quantize_colors = FALSE; + /* but set reasonable default parameters for quantization, */ + /* so that turning on quantize_colors is sufficient to do something useful */ + cinfo->two_pass_quantize = FALSE; /* may change to TRUE later */ + cinfo->use_dithering = TRUE; + cinfo->desired_number_of_colors = 256; + + /* Default to no smoothing */ + cinfo->do_block_smoothing = FALSE; + cinfo->do_pixel_smoothing = FALSE; + + if (standard_buffering) { + /* Allocate memory for input buffer. */ + cinfo->input_buffer = (char *) (*cinfo->emethods->alloc_small) + ((size_t) (JPEG_BUF_SIZE + MIN_UNGET)); + cinfo->bytes_in_buffer = 0; /* initialize buffer to empty */ + + /* Install standard buffer-reloading method. */ + cinfo->methods->read_jpeg_data = read_jpeg_data; + } +} + + +/* This routine releases storage allocated by j_d_defaults. + * Note that freeing the method pointer structs and the decompress_info_struct + * itself are the responsibility of the user interface. + * + * standard_buffering must agree with what was passed to j_d_defaults. + */ + +GLOBAL void +j_d_free_defaults (decompress_info_ptr cinfo, boolean standard_buffering) +{ + if (standard_buffering) { + (*cinfo->emethods->free_small) ((void *) cinfo->input_buffer); + } +} diff --git a/jdhuff.c b/jdhuff.c index e9af688c..dd429fc4 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -17,7 +17,7 @@ static decompress_info_ptr dcinfo; -static unsigned int get_buffer; /* current bit-extraction buffer */ +static INT32 get_buffer; /* current bit-extraction buffer */ static int bits_left; /* # of unused bits in it */ @@ -35,8 +35,8 @@ fix_huff_tbl (HUFF_TBL * htbl) p = 0; for (l = 1; l <= 16; l++) { - for (i = 1; i <= htbl->bits[l]; i++) - huffsize[p++] = l; + for (i = 1; i <= (int) htbl->bits[l]; i++) + huffsize[p++] = (char) l; } huffsize[p] = 0; lastp = p; @@ -48,7 +48,7 @@ fix_huff_tbl (HUFF_TBL * htbl) si = huffsize[0]; p = 0; while (huffsize[p]) { - while (huffsize[p] == si) { + while (((int) huffsize[p]) == si) { huffcode[p++] = code; code++; } @@ -77,10 +77,11 @@ fix_huff_tbl (HUFF_TBL * htbl) htbl->maxcode[l] = -1; } } + htbl->maxcode[17] = 0xFFFFFL; /* ensures huff_DECODE terminates */ } -/* Extract the next N bits from the input stream (N <= 8) */ +/* Extract the next N bits from the input stream (N <= 15) */ LOCAL int get_bits (int nbits) @@ -90,7 +91,8 @@ get_bits (int nbits) while (nbits > bits_left) { int c = JGETC(dcinfo); - get_buffer = (get_buffer << 8) + c; + get_buffer <<= 8; + get_buffer |= c; bits_left += 8; /* If it's 0xFF, check and discard stuffed zero byte */ if (c == 0xff) { @@ -102,14 +104,14 @@ get_bits (int nbits) } bits_left -= nbits; - result = (get_buffer >> bits_left) & ((1 << nbits) - 1); + result = ((int) (get_buffer >> bits_left)) & ((1 << nbits) - 1); return result; } /* Macro to make things go at some speed! */ #define get_bit() (bits_left ? \ - ((get_buffer >> (--bits_left)) & 1) : \ + ((int) (get_buffer >> (--bits_left))) & 1 : \ get_bits(1)) @@ -127,15 +129,23 @@ huff_DECODE (HUFF_TBL * htbl) code = (code << 1) + get_bit(); l++; } + + /* With garbage input we may reach the sentinel value l = 17. */ + + if (l > 16) { + ERREXIT(dcinfo->emethods, "Corrupted data in JPEG file"); + } + + p = (int) (htbl->valptr[l] + (code - htbl->mincode[l])); - p = htbl->valptr[l] + (code - htbl->mincode[l]); - - return htbl->huffval[p]; + return (int) htbl->huffval[p]; } /* Figure 13.4.2.1.1: extend sign bit */ +/* NB: on some compilers this will only work for s > 0 */ + #define huff_EXTEND(x, s) ((x) < (1 << ((s)-1)) ? \ (x) + (-1 << (s)) + 1 : \ (x)) @@ -156,9 +166,12 @@ decode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) /* Section 13.4.2.1: decode the DC coefficient difference */ s = huff_DECODE(dctbl); - r = get_bits(s); - block[0] = huff_EXTEND(r, s); - + if (s) { + r = get_bits(s); + s = huff_EXTEND(r, s); + } + block[0] = s; + /* Section 13.4.2.2: decode the AC coefficients */ for (k = 1; k < DCTSIZE2; k++) { @@ -168,7 +181,7 @@ decode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) n = r >> 4; if (s) { - k = k + n; + k += n; r = get_bits(s); block[k] = huff_EXTEND(r, s); } else { diff --git a/jdmain.c b/jdmain.c index 109d124c..3b60a9d8 100644 --- a/jdmain.c +++ b/jdmain.c @@ -21,7 +21,7 @@ */ #include "jinclude.h" -#ifdef __STDC__ +#ifdef INCLUDES_ARE_ANSI #include /* to declare exit() */ #endif @@ -37,28 +37,35 @@ #define WRITE_BINARY "wb" #endif +#include "jversion.h" /* for version message */ + /* - * If your system has getopt(3), you can use your library version by - * defining HAVE_GETOPT. By default, we use the PD 'egetopt'. + * PD version of getopt(3). */ -#ifdef HAVE_GETOPT -extern int getopt PP((int argc, char **argv, char *optstring)); -extern char * optarg; -extern int optind; -#else #include "egetopt.c" -#define getopt(argc,argv,opt) egetopt(argc,argv,opt) -#endif -typedef enum { /* defines known output image formats */ - FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ +/* + * This list defines the known output image formats + * (not all of which need be supported by a given version). + * You can change the default output format by defining DEFAULT_FMT; + * indeed, you had better do so if you undefine PPM_SUPPORTED. + */ + +typedef enum { FMT_GIF, /* GIF format */ + FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ + FMT_RLE, /* RLE format */ + FMT_TARGA, /* Targa format */ FMT_TIFF /* TIFF format */ } IMAGE_FORMATS; +#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ +#define DEFAULT_FMT FMT_PPM +#endif + static IMAGE_FORMATS requested_fmt; @@ -92,6 +99,16 @@ d_ui_method_selection (decompress_info_ptr cinfo) case FMT_PPM: jselwppm(cinfo); break; +#endif +#ifdef RLE_SUPPORTED + case FMT_RLE: + jselwrle(cinfo); + break; +#endif +#ifdef TARGA_SUPPORTED + case FMT_TARGA: + jselwtarga(cinfo); + break; #endif default: ERREXIT(cinfo->emethods, "Unsupported output file format"); @@ -100,37 +117,12 @@ d_ui_method_selection (decompress_info_ptr cinfo) } -/* - * Reload the input buffer after it's been emptied, and return the next byte. - * See the JGETC macro for calling conditions. - * - * This routine would need to be replaced if reading JPEG data from something - * other than a stdio stream. - */ - -METHODDEF int -read_jpeg_data (decompress_info_ptr cinfo) -{ - cinfo->bytes_in_buffer = fread(cinfo->input_buffer + MIN_UNGET, - 1, JPEG_BUF_SIZE, - cinfo->input_file); - - cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; - - if (cinfo->bytes_in_buffer <= 0) - ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); - - return JGETC(cinfo); -} - - - LOCAL void usage (char * progname) /* complain about bad command line */ { fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-b] [-q colors] [-2] [-d] [-g] [-G]"); + fprintf(stderr, "[-G] [-P] [-R] [-T] [-b] [-g] [-q colors] [-2] [-D] [-d]"); #ifdef TWO_FILE_COMMANDLINE fprintf(stderr, " inputfile outputfile\n"); #else @@ -163,45 +155,36 @@ main (int argc, char **argv) jselerror(&e_methods); /* error/trace message routines */ jselvirtmem(&e_methods); /* memory allocation routines */ dc_methods.d_ui_method_selection = d_ui_method_selection; - dc_methods.read_jpeg_data = read_jpeg_data; - /* Allocate memory for input buffer. */ - cinfo.input_buffer = (char *) (*cinfo.emethods->alloc_small) - ((size_t) (JPEG_BUF_SIZE + MIN_UNGET)); - cinfo.bytes_in_buffer = 0; /* initialize buffer to empty */ + /* Set up default JPEG parameters. */ + j_d_defaults(&cinfo, TRUE); + requested_fmt = DEFAULT_FMT; /* set default output file format */ - /* Set up default input and output file references. */ - /* (These may be overridden below.) */ - cinfo.input_file = stdin; - cinfo.output_file = stdout; - - /* Set up default parameters. */ - e_methods.trace_level = 0; - cinfo.output_gamma = 1.0; - cinfo.quantize_colors = FALSE; - cinfo.two_pass_quantize = FALSE; - cinfo.use_dithering = FALSE; - cinfo.desired_number_of_colors = 256; - cinfo.do_block_smoothing = FALSE; - cinfo.do_pixel_smoothing = FALSE; - cinfo.out_color_space = CS_RGB; - cinfo.jpeg_color_space = CS_UNKNOWN; - /* setting any other value in jpeg_color_space overrides heuristics */ - /* in jrdjfif.c ... */ - /* You may wanta change the default output format; here's the place: */ -#ifdef PPM_SUPPORTED - requested_fmt = FMT_PPM; -#else - requested_fmt = FMT_GIF; -#endif - - /* Scan parameters */ + /* Scan command line options, adjust parameters */ - while ((c = getopt(argc, argv, "bq:2DdgG")) != EOF) + while ((c = egetopt(argc, argv, "GPRTbdgq:2D")) != EOF) switch (c) { + case 'G': /* GIF output format. */ + requested_fmt = FMT_GIF; + break; + case 'P': /* PPM output format. */ + requested_fmt = FMT_PPM; + break; + case 'R': /* RLE output format. */ + requested_fmt = FMT_RLE; + break; + case 'T': /* Targa output format. */ + requested_fmt = FMT_TARGA; + break; case 'b': /* Enable cross-block smoothing. */ cinfo.do_block_smoothing = TRUE; break; + case 'd': /* Debugging. */ + e_methods.trace_level++; + break; + case 'g': /* Force grayscale output. */ + cinfo.out_color_space = CS_GRAYSCALE; + break; case 'q': /* Do color quantization. */ { int val; if (optarg == NULL) @@ -215,17 +198,8 @@ main (int argc, char **argv) case '2': /* Use two-pass quantization. */ cinfo.two_pass_quantize = TRUE; break; - case 'D': /* Use dithering in color quantization. */ - cinfo.use_dithering = TRUE; - break; - case 'd': /* Debugging. */ - e_methods.trace_level++; - break; - case 'g': /* Force grayscale output. */ - cinfo.out_color_space = CS_GRAYSCALE; - break; - case 'G': /* GIF output format. */ - requested_fmt = FMT_GIF; + case 'D': /* Suppress dithering in color quantization. */ + cinfo.use_dithering = FALSE; break; case '?': default: @@ -233,6 +207,11 @@ main (int argc, char **argv) break; } + /* If -d appeared, print version identification */ + if (e_methods.trace_level > 0) + fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n", + JVERSION, JCOPYRIGHT); + /* Select the input and output files */ #ifdef TWO_FILE_COMMANDLINE @@ -252,6 +231,9 @@ main (int argc, char **argv) #else /* not TWO_FILE_COMMANDLINE -- use Unix style */ + cinfo.input_file = stdin; /* default input file */ + cinfo.output_file = stdout; /* always the output file */ + if (optind < argc-1) { fprintf(stderr, "%s: only one input file\n", argv[0]); usage(argv[0]); @@ -278,9 +260,9 @@ main (int argc, char **argv) jpeg_decompress(&cinfo); /* Release memory. */ - (*cinfo.emethods->free_small) ((void *) cinfo.input_buffer); + j_d_free_defaults(&cinfo, TRUE); #ifdef MEM_STATS - if (e_methods.trace_level > 0) + if (e_methods.trace_level > 0) /* Optional memory-usage statistics */ j_mem_stats(); #endif diff --git a/jdpipe.c b/jdpipe.c index 8e088749..cdfdf2d7 100644 --- a/jdpipe.c +++ b/jdpipe.c @@ -1230,7 +1230,8 @@ multi_dcontroller (decompress_info_ptr cinfo) } emit_1pass (cinfo, - (int) MIN(rows_in_mem, cinfo->image_height-pixel_rows_output), + (int) MIN((long) rows_in_mem, + cinfo->image_height - pixel_rows_output), fullsize_ptrs, color_data); } diff --git a/jerror.c b/jerror.c index 591b1850..f719dbcc 100644 --- a/jerror.c +++ b/jerror.c @@ -21,7 +21,7 @@ */ #include "jinclude.h" -#ifdef __STDC__ +#ifdef INCLUDES_ARE_ANSI #include /* to declare exit() */ #endif @@ -30,7 +30,7 @@ static external_methods_ptr methods; /* saved for access to message_parm */ METHODDEF void -trace_message (char *msgtext) +trace_message (const char *msgtext) { fprintf(stderr, msgtext, methods->message_parm[0], methods->message_parm[1], @@ -42,7 +42,7 @@ trace_message (char *msgtext) METHODDEF void -error_exit (char *msgtext) +error_exit (const char *msgtext) { trace_message(msgtext); exit(1); diff --git a/jfwddct.c b/jfwddct.c index 58291ac9..21d8448b 100644 --- a/jfwddct.c +++ b/jfwddct.c @@ -17,96 +17,145 @@ #include "jinclude.h" -/* The poop on this scaling stuff is as follows: - * - * Most of the numbers (after multiplication by the constants) are - * (logically) shifted left by LG2_DCT_SCALE. This is undone by UNFIXH - * before assignment to the output array. Note that we want an additional - * division by 2 on the output (required by the equations). - * - * If right shifts are unsigned, then there is a potential problem. - * However, shifting right by 16 and then assigning to a short - * (assuming short = 16 bits) will keep the sign right!! - * - * For other shifts, - * - * ((x + (1 << 30)) >> shft) - (1 << (30 - shft)) - * - * gives a nice right shift with sign (assuming no overflow). However, all the - * scaling is such that this isn't a problem. (Is this true?) +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a signed right shift of an INT32 quantity. + * It is only applied with constant shift counts. */ - -#define ONE 1L /* remove L if long > 32 bits */ - #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define LG2_DCT_SCALE 15 -#define RIGHT_SHIFT(_x,_shft) ((((_x) + (ONE << 30)) >> (_shft)) - (ONE << (30 - (_shft)))) +#define SHIFT_TEMPS INT32 shift_temp; +#define RIGHT_SHIFT(x,shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~0) << (32-(shft))) : \ + (shift_temp >> (shft))) #else -#define LG2_DCT_SCALE 16 -#define RIGHT_SHIFT(_x,_shft) ((_x) >> (_shft)) +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif + +/* The poop on this scaling stuff is as follows: + * + * We have to do addition and subtraction of the integer inputs, which + * is no problem, and multiplication by fractional constants, which is + * a problem to do in integer arithmetic. We multiply all the constants + * by DCT_SCALE and convert them to integer constants (thus retaining + * LG2_DCT_SCALE bits of precision in the constants). After doing a + * multiplication we have to divide the product by DCT_SCALE, with proper + * rounding, to produce the correct output. The division can be implemented + * cheaply as a right shift of LG2_DCT_SCALE bits. The DCT equations also + * specify an additional division by 2 on the final outputs; this can be + * folded into the right-shift by shifting one more bit (see UNFIXH). + * + * If you are planning to recode this in assembler, you might want to set + * LG2_DCT_SCALE to 15. This loses a bit of precision, but then all the + * multiplications are between 16-bit quantities (given 8-bit JSAMPLEs!) + * so you could use a signed 16x16=>32 bit multiply instruction instead of + * full 32x32 multiply. Unfortunately there's no way to describe such a + * multiply portably in C, so we've gone for the extra bit of accuracy here. + */ + +#ifdef EIGHT_BIT_SAMPLES +#define LG2_DCT_SCALE 16 +#else +#define LG2_DCT_SCALE 15 /* lose a little precision to avoid overflow */ +#endif + +#define ONE ((INT32) 1) + #define DCT_SCALE (ONE << LG2_DCT_SCALE) +/* In some places we shift the inputs left by a couple more bits, */ +/* so that they can be added to fractional results without too much */ +/* loss of precision. */ #define LG2_OVERSCALE 2 -#define OVERSCALE (ONE << LG2_OVERSCALE) +#define OVERSCALE (ONE << LG2_OVERSCALE) +#define OVERSHIFT(x) ((x) <<= LG2_OVERSCALE) -#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) +/* Scale a fractional constant by DCT_SCALE */ +#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) + +/* Scale a fractional constant by DCT_SCALE/OVERSCALE */ +/* Such a constant can be multiplied with an overscaled input */ +/* to produce something that's scaled by DCT_SCALE */ #define FIXO(x) ((INT32) ((x) * DCT_SCALE / OVERSCALE + 0.5)) -#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) -#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) -#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)), LG2_DCT_SCALE-LG2_OVERSCALE) -#define OVERSH(x) ((x) << LG2_OVERSCALE) -#define SIN_1_4 FIX(0.7071067811856476) +/* Descale and correctly round a value that's scaled by DCT_SCALE */ +#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) + +/* Same with an additional division by 2, ie, correctly rounded UNFIX(x/2) */ +#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) + +/* Take a value scaled by DCT_SCALE and round to integer scaled by OVERSCALE */ +#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)),\ + LG2_DCT_SCALE-LG2_OVERSCALE) + +/* Here are the constants we need */ +/* SIN_i_j is sine of i*pi/j, scaled by DCT_SCALE */ +/* COS_i_j is cosine of i*pi/j, scaled by DCT_SCALE */ + +#define SIN_1_4 FIX(0.707106781) #define COS_1_4 SIN_1_4 -#define SIN_1_8 FIX(0.3826834323650898) -#define COS_1_8 FIX(0.9238795325112870) +#define SIN_1_8 FIX(0.382683432) +#define COS_1_8 FIX(0.923879533) #define SIN_3_8 COS_1_8 #define COS_3_8 SIN_1_8 -#define SIN_1_16 FIX(0.1950903220161282) -#define COS_1_16 FIX(0.9807852804032300) +#define SIN_1_16 FIX(0.195090322) +#define COS_1_16 FIX(0.980785280) #define SIN_7_16 COS_1_16 #define COS_7_16 SIN_1_16 -#define SIN_3_16 FIX(0.5555702330196022) -#define COS_3_16 FIX(0.8314696123025450) +#define SIN_3_16 FIX(0.555570233) +#define COS_3_16 FIX(0.831469612) #define SIN_5_16 COS_3_16 #define COS_5_16 SIN_3_16 -#define OSIN_1_4 FIXO(0.707106781185647) +/* OSIN_i_j is sine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */ +/* OCOS_i_j is cosine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */ + +#define OSIN_1_4 FIXO(0.707106781) #define OCOS_1_4 OSIN_1_4 -#define OSIN_1_8 FIXO(0.3826834323650898) -#define OCOS_1_8 FIXO(0.9238795325112870) +#define OSIN_1_8 FIXO(0.382683432) +#define OCOS_1_8 FIXO(0.923879533) #define OSIN_3_8 OCOS_1_8 #define OCOS_3_8 OSIN_1_8 -#define OSIN_1_16 FIXO(0.1950903220161282) -#define OCOS_1_16 FIXO(0.9807852804032300) +#define OSIN_1_16 FIXO(0.195090322) +#define OCOS_1_16 FIXO(0.980785280) #define OSIN_7_16 OCOS_1_16 #define OCOS_7_16 OSIN_1_16 -#define OSIN_3_16 FIXO(0.5555702330196022) -#define OCOS_3_16 FIXO(0.8314696123025450) +#define OSIN_3_16 FIXO(0.555570233) +#define OCOS_3_16 FIXO(0.831469612) #define OSIN_5_16 OCOS_3_16 #define OCOS_5_16 OSIN_3_16 +/* + * Perform a 1-dimensional DCT. + * Note that this code is specialized to the case DCTSIZE = 8. + */ + INLINE LOCAL void fast_dct_8 (DCTELEM *in, int stride) { - /* tmp1x are new values of tmpx -- flashy register colourers + /* many tmps have nonoverlapping lifetime -- flashy register colourers * should be able to do this lot very well */ - INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17; - INT32 tmp25, tmp26; INT32 in0, in1, in2, in3, in4, in5, in6, in7; + INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 tmp14, tmp15, tmp16, tmp17; + INT32 tmp25, tmp26; + SHIFT_TEMPS in0 = in[ 0]; in1 = in[stride ]; @@ -126,44 +175,42 @@ fast_dct_8 (DCTELEM *in, int stride) tmp6 = in1 - in6; tmp7 = in0 - in7; - tmp10 = tmp3 + tmp0 ; - tmp11 = tmp2 + tmp1 ; - tmp12 = tmp1 - tmp2 ; - tmp13 = tmp0 - tmp3 ; + tmp10 = tmp3 + tmp0; + tmp11 = tmp2 + tmp1; + tmp12 = tmp1 - tmp2; + tmp13 = tmp0 - tmp3; - /* Now using tmp10, tmp11, tmp12, tmp13 */ - - in[ 0] = UNFIXH((tmp10 + tmp11) * SIN_1_4); - in[stride*4] = UNFIXH((tmp10 - tmp11) * COS_1_4); - - in[stride*2] = UNFIXH(tmp13*COS_1_8 + tmp12*SIN_1_8); - in[stride*6] = UNFIXH(tmp13*SIN_1_8 - tmp12*COS_1_8); + in[ 0] = (DCTELEM) UNFIXH((tmp10 + tmp11) * SIN_1_4); + in[stride*4] = (DCTELEM) UNFIXH((tmp10 - tmp11) * COS_1_4); + in[stride*2] = (DCTELEM) UNFIXH(tmp13*COS_1_8 + tmp12*SIN_1_8); + in[stride*6] = (DCTELEM) UNFIXH(tmp13*SIN_1_8 - tmp12*COS_1_8); + tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); + + OVERSHIFT(tmp4); + OVERSHIFT(tmp7); + + /* tmp4, tmp7, tmp15, tmp16 are overscaled by OVERSCALE */ + + tmp14 = tmp4 + tmp15; + tmp25 = tmp4 - tmp15; + tmp26 = tmp7 - tmp16; + tmp17 = tmp7 + tmp16; - /* Now using tmp10, tmp11, tmp13, tmp14, tmp15, tmp16 */ - - tmp14 = OVERSH(tmp4) + tmp15; - tmp25 = OVERSH(tmp4) - tmp15; - tmp26 = OVERSH(tmp7) - tmp16; - tmp17 = OVERSH(tmp7) + tmp16; - - /* These are now overscaled by OVERSCALE */ - - /* tmp10, tmp11, tmp12, tmp13, tmp14, tmp25, tmp26, tmp17 */ - - in[stride ] = UNFIXH(tmp17*OCOS_1_16 + tmp14*OSIN_1_16); - in[stride*7] = UNFIXH(tmp17*OCOS_7_16 - tmp14*OSIN_7_16); - in[stride*5] = UNFIXH(tmp26*OCOS_5_16 + tmp25*OSIN_5_16); - in[stride*3] = UNFIXH(tmp26*OCOS_3_16 - tmp25*OSIN_3_16); + in[stride ] = (DCTELEM) UNFIXH(tmp17*OCOS_1_16 + tmp14*OSIN_1_16); + in[stride*7] = (DCTELEM) UNFIXH(tmp17*OCOS_7_16 - tmp14*OSIN_7_16); + in[stride*5] = (DCTELEM) UNFIXH(tmp26*OCOS_5_16 + tmp25*OSIN_5_16); + in[stride*3] = (DCTELEM) UNFIXH(tmp26*OCOS_3_16 - tmp25*OSIN_3_16); } /* * Perform the forward DCT on one block of samples. * - * Note that this code is specialized to the case DCTSIZE = 8. + * A 2-D DCT can be done by 1-D DCT on each row + * followed by 1-D DCT on each column. */ GLOBAL void diff --git a/jinclude.h b/jinclude.h index ec7a7e8f..779c61da 100644 --- a/jinclude.h +++ b/jinclude.h @@ -13,6 +13,19 @@ */ +/* + * Normally the __STDC__ macro can be taken as indicating that the system + * include files conform to the ANSI C standard. However, if you are running + * GCC on a machine with non-ANSI system include files, that is not the case. + * In that case change the following, or add -DNONANSI_INCLUDES to your CFLAGS. + */ + +#ifdef __STDC__ +#ifndef NONANSI_INCLUDES +#define INCLUDES_ARE_ANSI /* this is what's tested before including */ +#endif +#endif + /* * is included to get the FILE typedef and NULL macro. * Note that the core portable-JPEG files do not actually do any I/O @@ -27,11 +40,15 @@ * We need the size_t typedef, which defines the parameter type of malloc(). * In an ANSI-conforming implementation this is provided by , * but on non-ANSI systems it's more likely to be in . + * On some not-quite-ANSI systems you may find it in . */ -#ifndef __STDC__ /* shouldn't need this if __STDC__ */ +#ifndef INCLUDES_ARE_ANSI /* shouldn't need this if ANSI C */ #include #endif +#ifdef __SASC /* Amiga SAS C provides it in stddef.h. */ +#include +#endif /* * In ANSI C, and indeed any rational implementation, size_t is also the @@ -41,8 +58,20 @@ * we always use this SIZEOF() macro in place of using sizeof() directly. */ +#undef SIZEOF /* in case you included X11/xmd.h */ #define SIZEOF(object) ((size_t) sizeof(object)) +/* + * fread() and fwrite() are always invoked through these macros. + * On some systems you may need to twiddle the argument casts. + * CAUTION: argument order is different from underlying functions! + */ + +#define FREAD(file,buf,sizeofbuf) \ + ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) +#define FWRITE(file,buf,sizeofbuf) \ + ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) + /* * We need the memcpy() and strcmp() functions, plus memory zeroing. * ANSI and System V implementations declare these in . @@ -51,10 +80,10 @@ * Insert casts in these macros if not! */ -#ifdef __STDC__ +#ifdef INCLUDES_ARE_ANSI #include #define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) -#else /* not STDC */ +#else /* not ANSI */ #ifdef BSD #include #define MEMZERO(voidptr,size) bzero((voidptr), (size)) @@ -63,7 +92,7 @@ #include #define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) #endif /* BSD */ -#endif /* STDC */ +#endif /* ANSI */ /* Now include the portable JPEG definition files. */ diff --git a/jpegdata.h b/jpegdata.h index 3e4d7533..947a8af2 100644 --- a/jpegdata.h +++ b/jpegdata.h @@ -200,7 +200,8 @@ typedef struct { /* A Huffman coding table */ UINT16 ehufco[256]; /* code for each symbol */ char ehufsi[256]; /* length of code for each symbol */ UINT16 mincode[17]; /* smallest code of length k */ - INT32 maxcode[17]; /* largest code of length k (-1 if none) */ + INT32 maxcode[18]; /* largest code of length k (-1 if none) */ + /* maxcode[17] is a sentinel to ensure huff_DECODE terminates */ short valptr[17]; /* huffval[] index of 1st symbol of length k */ } HUFF_TBL; @@ -220,7 +221,7 @@ struct compress_info_struct { * All of these fields shall be established by the user interface before * calling jpeg_compress, or by the input_init or c_ui_method_selection * methods. - * Most parameters can be set to reasonable defaults by j_default_compression. + * Most parameters can be set to reasonable defaults by j_c_defaults. * Note that the UI must supply the storage for the main methods struct, * though it sets only a few of the methods there. */ @@ -309,8 +310,10 @@ typedef struct compress_info_struct * compress_info_ptr; struct decompress_info_struct { /* * These fields shall be established by the user interface before - * calling jpeg_decompress. Note that the UI must supply the storage for - * the main methods struct, though it sets only a few of the methods there. + * calling jpeg_decompress. + * Most parameters can be set to reasonable defaults by j_d_defaults. + * Note that the UI must supply the storage for the main methods struct, + * though it sets only a few of the methods there. */ decompress_methods_ptr methods; /* Points to list of methods to use */ @@ -425,7 +428,7 @@ typedef struct decompress_info_struct * decompress_info_ptr; #ifdef CHAR_IS_UNSIGNED #define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \ (*(cinfo)->methods->read_jpeg_data) (cinfo) : \ - (int) *(cinfo)->next_input_byte++ ) + (int) (*(cinfo)->next_input_byte++) ) #else #define JGETC(cinfo) ( --(cinfo)->bytes_in_buffer < 0 ? \ (*(cinfo)->methods->read_jpeg_data) (cinfo) : \ @@ -435,17 +438,34 @@ typedef struct decompress_info_struct * decompress_info_ptr; #define JUNGETC(ch,cinfo) ((cinfo)->bytes_in_buffer++, \ *(--((cinfo)->next_input_byte)) = (ch)) -#define MIN_UNGET 2 /* may always do at least 2 JUNGETCs */ +#define MIN_UNGET 4 /* may always do at least 4 JUNGETCs */ /* A virtual image has a control block whose contents are private to the * memory manager module (and may differ between managers). The rest of the - * code only refers to virtual images by these pointer types. + * code only refers to virtual images by these pointer types, and never + * dereferences the pointer. */ typedef struct big_sarray_control * big_sarray_ptr; typedef struct big_barray_control * big_barray_ptr; +/* Although a real ANSI C compiler can deal perfectly well with pointers to + * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI + * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, + * add -DINCOMPLETE_TYPES_BROKEN to CFLAGS in your Makefile. Then we will + * pseudo-define the structs as containing a single "dummy" field. + * The memory manager(s) #define AM_MEMORY_MANAGER before including this file, + * so that they can make their own definitions of the structs. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef AM_MEMORY_MANAGER +struct big_sarray_control { long dummy; }; +struct big_barray_control { long dummy; }; +#endif +#endif + /* Method types that need typedefs */ @@ -490,8 +510,8 @@ struct external_methods_struct { /* by an enumerated-type code so that non-English error messages */ /* can be substituted easily. This will not be done until all the */ /* code is in place, so that we know what messages are needed. */ - METHOD(void, error_exit, (char *msgtext)); - METHOD(void, trace_message, (char *msgtext)); + METHOD(void, error_exit, (const char *msgtext)); + METHOD(void, trace_message, (const char *msgtext)); /* Working data for error/trace facility */ /* See macros below for the usage of these variables */ @@ -559,42 +579,36 @@ struct external_methods_struct { (emeth)->message_parm[3] = (p4), \ (*(emeth)->error_exit) (msg)) +#define MAKESTMT(stuff) do { stuff } while (0) + #define TRACEMS(emeth,lvl,msg) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + (*(emeth)->trace_message) (msg); } ) #define TRACEMS1(emeth,lvl,msg,p1) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((emeth)->message_parm[0] = (p1), \ - (*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + (emeth)->message_parm[0] = (p1); \ + (*(emeth)->trace_message) (msg); } ) #define TRACEMS2(emeth,lvl,msg,p1,p2) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((emeth)->message_parm[0] = (p1), \ - (emeth)->message_parm[1] = (p2), \ - (*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + (emeth)->message_parm[0] = (p1); \ + (emeth)->message_parm[1] = (p2); \ + (*(emeth)->trace_message) (msg); } ) #define TRACEMS3(emeth,lvl,msg,p1,p2,p3) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((emeth)->message_parm[0] = (p1), \ - (emeth)->message_parm[1] = (p2), \ - (emeth)->message_parm[2] = (p3), \ - (*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + int * _mp = (emeth)->message_parm; \ + *_mp++ = (p1); *_mp++ = (p2); *_mp = (p3); \ + (*(emeth)->trace_message) (msg); } ) #define TRACEMS4(emeth,lvl,msg,p1,p2,p3,p4) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((emeth)->message_parm[0] = (p1), \ - (emeth)->message_parm[1] = (p2), \ - (emeth)->message_parm[2] = (p3), \ - (emeth)->message_parm[3] = (p4), \ - (*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + int * _mp = (emeth)->message_parm; \ + *_mp++ = (p1); *_mp++ = (p2); *_mp++ = (p3); *_mp = (p4); \ + (*(emeth)->trace_message) (msg); } ) #define TRACEMS8(emeth,lvl,msg,p1,p2,p3,p4,p5,p6,p7,p8) \ - ( (emeth)->trace_level >= (lvl) ? \ - ((emeth)->message_parm[0] = (p1), \ - (emeth)->message_parm[1] = (p2), \ - (emeth)->message_parm[2] = (p3), \ - (emeth)->message_parm[3] = (p4), \ - (emeth)->message_parm[4] = (p5), \ - (emeth)->message_parm[5] = (p6), \ - (emeth)->message_parm[6] = (p7), \ - (emeth)->message_parm[7] = (p8), \ - (*(emeth)->trace_message) (msg), 0) : 0) + MAKESTMT( if ((emeth)->trace_level >= (lvl)) { \ + int * _mp = (emeth)->message_parm; \ + *_mp++ = (p1); *_mp++ = (p2); *_mp++ = (p3); *_mp++ = (p4); \ + *_mp++ = (p5); *_mp++ = (p6); *_mp++ = (p7); *_mp = (p8); \ + (*(emeth)->trace_message) (msg); } ) /* Methods used during JPEG compression. */ @@ -740,16 +754,24 @@ struct decompress_methods_struct { /* main entry for compression */ EXTERN void jpeg_compress PP((compress_info_ptr cinfo)); + /* default parameter setup for compression */ -EXTERN void j_default_compression PP((compress_info_ptr cinfo, int quality)); +EXTERN void j_c_defaults PP((compress_info_ptr cinfo, int quality, + boolean force_baseline)); EXTERN void j_monochrome_default PP((compress_info_ptr cinfo)); EXTERN void j_set_quality PP((compress_info_ptr cinfo, int quality, boolean force_baseline)); -EXTERN void j_free_defaults PP((compress_info_ptr cinfo)); +EXTERN void j_c_free_defaults PP((compress_info_ptr cinfo)); /* main entry for decompression */ EXTERN void jpeg_decompress PP((decompress_info_ptr cinfo)); +/* default parameter setup for decompression */ +EXTERN void j_d_defaults PP((decompress_info_ptr cinfo, + boolean standard_buffering)); +EXTERN void j_d_free_defaults PP((decompress_info_ptr cinfo, + boolean standard_buffering)); + /* forward DCT */ EXTERN void j_fwd_dct PP((DCTBLOCK data)); /* inverse DCT */ @@ -775,6 +797,8 @@ EXTERN void jselccolor PP((compress_info_ptr cinfo)); /* jccolor.c */ /* The user interface should call one of these to select input format: */ EXTERN void jselrgif PP((compress_info_ptr cinfo)); /* jrdgif.c */ EXTERN void jselrppm PP((compress_info_ptr cinfo)); /* jrdppm.c */ +EXTERN void jselrrle PP((compress_info_ptr cinfo)); /* jrdrle.c */ +EXTERN void jselrtarga PP((compress_info_ptr cinfo)); /* jrdtarga.c */ /* and one of these to select output header format: */ EXTERN void jselwjfif PP((compress_info_ptr cinfo)); /* jwrjfif.c */ @@ -793,6 +817,8 @@ EXTERN void jselrjfif PP((decompress_info_ptr cinfo)); /* jrdjfif.c */ /* and one of these to select output image format: */ EXTERN void jselwgif PP((decompress_info_ptr cinfo)); /* jwrgif.c */ EXTERN void jselwppm PP((decompress_info_ptr cinfo)); /* jwrppm.c */ +EXTERN void jselwrle PP((decompress_info_ptr cinfo)); /* jwrrle.c */ +EXTERN void jselwtarga PP((decompress_info_ptr cinfo)); /* jwrtarga.c */ /* method selection routines for system-dependent modules */ EXTERN void jselerror PP((external_methods_ptr emethods)); /* jerror.c */ @@ -805,7 +831,9 @@ EXTERN void j_mem_stats PP((void)); /* Miscellaneous useful macros */ +#undef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)) +#undef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) diff --git a/jquant1.c b/jquant1.c index 49dfd971..ea01c239 100644 --- a/jquant1.c +++ b/jquant1.c @@ -60,7 +60,7 @@ static JSAMPARRAY colorindex; /* Precomputed mapping for speed */ */ #ifdef EIGHT_BIT_SAMPLES -typedef short FSERROR; /* 16 bits should be enough */ +typedef INT16 FSERROR; /* 16 bits should be enough */ #else typedef INT32 FSERROR; /* may need more than 16 bits? */ #endif @@ -135,11 +135,13 @@ color_quant_init (decompress_info_ptr cinfo) nci = Ncolors[i]; /* # of distinct values for this color */ blksize = blkdist / nci; for (j = 0; j < nci; j++) { - val = (j * MAXJSAMPLE + (nci-1)/2) / (nci-1); /* j'th value of color */ + /* Compute j'th output value (out of nci) for component */ + val = (j * MAXJSAMPLE + (nci-1)/2) / (nci-1); + /* Fill in all colormap entries that have this value of this component */ for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { /* fill in blksize entries beginning at ptr */ for (k = 0; k < blksize; k++) - colormap[i][ptr+k] = val; + colormap[i][ptr+k] = (JSAMPLE) val; } } blkdist = blksize; /* blksize of this color is blkdist of next */ @@ -149,8 +151,7 @@ color_quant_init (decompress_info_ptr cinfo) /* compute index of color closest to pixel value j */ val = (j * (nci-1) + CENTERJSAMPLE) / MAXJSAMPLE; /* premultiply so that no multiplication needed in main processing */ - val *= blksize; - colorindex[i][j] = val; + colorindex[i][j] = (JSAMPLE) (val * blksize); } } @@ -196,7 +197,7 @@ color_quantize (decompress_info_ptr cinfo, int num_rows, pixcode += GETJSAMPLE(colorindex[ci] [GETJSAMPLE(input_data[ci][row][col])]); } - output_data[row][col] = pixcode; + output_data[row][col] = (JSAMPLE) pixcode; } } } @@ -222,7 +223,7 @@ color_quantize3 (decompress_info_ptr cinfo, int num_rows, pixcode = GETJSAMPLE(colorindex[0][GETJSAMPLE(*ptr0++)]); pixcode += GETJSAMPLE(colorindex[1][GETJSAMPLE(*ptr1++)]); pixcode += GETJSAMPLE(colorindex[2][GETJSAMPLE(*ptr2++)]); - *ptrout++ = pixcode; + *ptrout++ = (JSAMPLE) pixcode; } } } @@ -255,7 +256,7 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, /* compute pixel value + accumulated error */ val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) + thisrowerr[ci]; - if (val < 0) val = 0; /* must watch for range overflow! */ + if (val <= 0) val = 0; /* must watch for range overflow! */ else { val += 8; /* divide by 16 with proper rounding */ val >>= 4; @@ -264,10 +265,10 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, thisrowerr[ci] = val; /* save for error propagation */ pixcode += GETJSAMPLE(colorindex[ci][val]); } - output_data[row][col] = pixcode; + output_data[row][col] = (JSAMPLE) pixcode; /* propagate error to adjacent pixels */ for (ci = 0; ci < nc; ci++) { - val = thisrowerr[ci] - GETJSAMPLE(colormap[ci][pixcode]); + val = thisrowerr[ci] - (FSERROR) GETJSAMPLE(colormap[ci][pixcode]); thisrowerr[ci-nc] += val * 7; nextrowerr[ci+nc] += val * 3; nextrowerr[ci ] += val * 5; @@ -290,7 +291,7 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, /* compute pixel value + accumulated error */ val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) + thisrowerr[ci]; - if (val < 0) val = 0; /* must watch for range overflow! */ + if (val <= 0) val = 0; /* must watch for range overflow! */ else { val += 8; /* divide by 16 with proper rounding */ val >>= 4; @@ -299,10 +300,10 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, thisrowerr[ci] = val; /* save for error propagation */ pixcode += GETJSAMPLE(colorindex[ci][val]); } - output_data[row][col] = pixcode; + output_data[row][col] = (JSAMPLE) pixcode; /* propagate error to adjacent pixels */ for (ci = 0; ci < nc; ci++) { - val = thisrowerr[ci] - GETJSAMPLE(colormap[ci][pixcode]); + val = thisrowerr[ci] - (FSERROR) GETJSAMPLE(colormap[ci][pixcode]); thisrowerr[ci+nc] += val * 7; nextrowerr[ci-nc] += val * 3; nextrowerr[ci ] += val * 5; diff --git a/jrdgif.c b/jrdgif.c index e2d4b338..7b6bd6d4 100644 --- a/jrdgif.c +++ b/jrdgif.c @@ -62,7 +62,7 @@ static JSAMPARRAY colormap; /* the colormap to use */ #define INTERLACE 0x40 /* mask for bit signifying interlaced image */ #define COLORMAPFLAG 0x80 /* mask for bit signifying colormap presence */ -#define ReadOK(file,buffer,len) (fread(buffer, 1, len, file) == (len)) +#define ReadOK(file,buffer,len) (FREAD(file,buffer,len) == ((size_t) (len))) /* Static vars for GetCode and LZWReadByte */ @@ -261,7 +261,7 @@ LZWReadByte (compress_info_ptr cinfo) /* If any codes are stacked from a previously read symbol, return them */ if (sp > symbol_stack) - return *(--sp); + return (int) *(--sp); code = GetCode(cinfo); @@ -286,7 +286,7 @@ LZWReadByte (compress_info_ptr cinfo) incode = code; /* save for a moment */ if (code >= max_code) { /* special case for not-yet-defined symbol */ - *sp++ = firstcode; /* it will be defined as oldcode/firstcode */ + *sp++ = (UINT8) firstcode; /* it will be defined as oldcode/firstcode */ code = oldcode; } @@ -302,7 +302,7 @@ LZWReadByte (compress_info_ptr cinfo) if ((code = max_code) < LZW_TABLE_SIZE) { /* Define a new symbol = prev sym + head of this sym's expansion */ symbol_head[code] = oldcode; - symbol_tail[code] = firstcode; + symbol_tail[code] = (UINT8) firstcode; max_code++; /* Is it time to increase code_size? */ if ((max_code >= limit_code) && (code_size < MAX_LZW_BITS)) { @@ -323,9 +323,9 @@ ReadColorMap (compress_info_ptr cinfo, int cmaplen, JSAMPARRAY cmap) int i; for (i = 0; i < cmaplen; i++) { - cmap[CM_RED][i] = ReadByte(cinfo); - cmap[CM_GREEN][i] = ReadByte(cinfo); - cmap[CM_BLUE][i] = ReadByte(cinfo); + cmap[CM_RED][i] = (JSAMPLE) ReadByte(cinfo); + cmap[CM_GREEN][i] = (JSAMPLE) ReadByte(cinfo); + cmap[CM_BLUE][i] = (JSAMPLE) ReadByte(cinfo); } } @@ -457,7 +457,7 @@ input_init (compress_info_ptr cinfo) * of get_input_row. */ interlaced_image = (*cinfo->emethods->request_big_sarray) - ((long) width, (long) height, (long) 1); + ((long) width, (long) height, 1L); cinfo->methods->get_input_row = load_interlaced_image; } @@ -519,7 +519,7 @@ load_interlaced_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) for (col = cinfo->image_width; col > 0; col--) { if ((c = LZWReadByte(cinfo)) < 0) ERREXIT(cinfo->emethods, "Premature end of GIF image"); - *sptr++ = c; + *sptr++ = (JSAMPLE) c; } } diff --git a/jrdjfif.c b/jrdjfif.c index 5ff14baa..0729b676 100644 --- a/jrdjfif.c +++ b/jrdjfif.c @@ -98,11 +98,11 @@ typedef enum { /* JPEG marker codes */ METHODDEF int read_jpeg_data (decompress_info_ptr cinfo) { - cinfo->bytes_in_buffer = fread(cinfo->input_buffer + MIN_UNGET, - 1, JPEG_BUF_SIZE, - cinfo->input_file); - cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; + + cinfo->bytes_in_buffer = (int) FREAD(cinfo->input_file, + cinfo->next_input_byte, + JPEG_BUF_SIZE); if (cinfo->bytes_in_buffer <= 0) ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); @@ -138,7 +138,7 @@ skip_variable (decompress_info_ptr cinfo, int code) length = get_2bytes(cinfo); TRACEMS2(cinfo->emethods, 1, - "Skipping marker 0x%02x, length %d", code, length); + "Skipping marker 0x%02x, length %u", code, (int) length); for (length -= 2; length > 0; length--) (void) JGETC(cinfo); @@ -165,7 +165,7 @@ get_dht (decompress_info_ptr cinfo) bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { - bits[i] = JGETC(cinfo); + bits[i] = (UINT8) JGETC(cinfo); count += bits[i]; } @@ -180,7 +180,7 @@ get_dht (decompress_info_ptr cinfo) ERREXIT(cinfo->emethods, "Bogus DHT counts"); for (i = 0; i < count; i++) - huffval[i] = JGETC(cinfo); + huffval[i] = (UINT8) JGETC(cinfo); length -= 1 + 16 + count; @@ -195,7 +195,7 @@ get_dht (decompress_info_ptr cinfo) ERREXIT1(cinfo->emethods, "Bogus DHT index %d", index); if (*htblptr == NULL) - *htblptr = (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); + *htblptr = (HUFF_TBL *) (*cinfo->emethods->alloc_small) (SIZEOF(HUFF_TBL)); memcpy((void *) (*htblptr)->bits, (void *) bits, SIZEOF((*htblptr)->bits)); @@ -225,10 +225,10 @@ get_dac (decompress_info_ptr cinfo) ERREXIT1(cinfo->emethods, "Bogus DAC index %d", index); if (index >= NUM_ARITH_TBLS) { /* define AC table */ - cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = val; + cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; } else { /* define DC table */ - cinfo->arith_dc_L[index] = val & 0x0F; - cinfo->arith_dc_U[index] = val >> 4; + cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); + cinfo->arith_dc_U[index] = (UINT8) (val >> 4); if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) ERREXIT1(cinfo->emethods, "Bogus DAC value 0x%x", val); } @@ -261,7 +261,8 @@ get_dqt (decompress_info_ptr cinfo) ERREXIT1(cinfo->emethods, "Bogus table number %d", n); if (cinfo->quant_tbl_ptrs[n] == NULL) - cinfo->quant_tbl_ptrs[n] = (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); + cinfo->quant_tbl_ptrs[n] = (QUANT_TBL_PTR) + (*cinfo->emethods->alloc_small) (SIZEOF(QUANT_TBL)); quant_ptr = cinfo->quant_tbl_ptrs[n]; for (i = 0; i < DCTSIZE2; i++) { @@ -290,7 +291,7 @@ get_dri (decompress_info_ptr cinfo) if (get_2bytes(cinfo) != 4) ERREXIT(cinfo->emethods, "Bogus length in DRI"); - cinfo->restart_interval = get_2bytes(cinfo); + cinfo->restart_interval = (UINT16) get_2bytes(cinfo); TRACEMS1(cinfo->emethods, 1, "Define Restart Interval %d", cinfo->restart_interval); @@ -312,7 +313,7 @@ get_app0 (decompress_info_ptr cinfo) if (length >= JFIF_LEN) { for (buffp = 0; buffp < JFIF_LEN; buffp++) - b[buffp] = JGETC(cinfo); + b[buffp] = (UINT8) JGETC(cinfo); length -= JFIF_LEN; if (b[0]=='J' && b[1]=='F' && b[2]=='I' && b[3]=='F' && b[4]==0) { @@ -364,8 +365,8 @@ get_sof (decompress_info_ptr cinfo, int code) cinfo->num_components = JGETC(cinfo); TRACEMS4(cinfo->emethods, 1, - "Start Of Frame 0x%02x: width=%d, height=%d, components=%d", - code, cinfo->image_width, cinfo->image_height, + "Start Of Frame 0x%02x: width=%u, height=%u, components=%d", + code, (int) cinfo->image_width, (int) cinfo->image_height, cinfo->num_components); /* We don't support files in which the image height is initially specified */ @@ -391,7 +392,7 @@ get_sof (decompress_info_ptr cinfo, int code) if (length != (cinfo->num_components * 3 + 8)) ERREXIT(cinfo->emethods, "Bogus SOF length"); - cinfo->comp_info = (*cinfo->emethods->alloc_small) + cinfo->comp_info = (jpeg_component_info *) (*cinfo->emethods->alloc_small) (cinfo->num_components * SIZEOF(jpeg_component_info)); for (ci = 0; ci < cinfo->num_components; ci++) { @@ -538,7 +539,7 @@ process_tables (decompress_info_ptr cinfo) case M_SOI: case M_EOI: case M_SOS: - return c; + return ((JPEG_MARKER) c); case M_DHT: get_dht(cinfo); diff --git a/jrdppm.c b/jrdppm.c index 15e2393f..f10e0f63 100644 --- a/jrdppm.c +++ b/jrdppm.c @@ -6,7 +6,8 @@ * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to read input images in PPM format. - * The PBMPLUS library is required (well, it will be in the real version). + * The PBMPLUS library is NOT required to compile this software, + * but it is highly useful as a set of PPM image manipulation programs. * * These routines may need modification for non-Unix environments or * specialized applications. As they stand, they assume input from @@ -24,6 +25,194 @@ #ifdef PPM_SUPPORTED +static JSAMPLE * rescale; /* => maxval-remapping array, or NULL */ + + +/* Portions of this code are based on the PBMPLUS library, which is: +** +** Copyright (C) 1988 by Jef Poskanzer. +** +** Permission to use, copy, modify, and distribute this software and its +** documentation for any purpose and without fee is hereby granted, provided +** that the above copyright notice appear in all copies and that both that +** copyright notice and this permission notice appear in supporting +** documentation. This software is provided "as is" without express or +** implied warranty. +*/ + + +LOCAL int +pbm_getc (FILE * file) +/* Read next char, skipping over any comments */ +/* A comment/newline sequence is returned as a newline */ +{ + register int ch; + + ch = getc(file); + if (ch == '#') { + do { + ch = getc(file); + } while (ch != '\n' && ch != EOF); + } + return ch; +} + + +LOCAL unsigned int +read_pbm_integer (compress_info_ptr cinfo) +/* Read an unsigned decimal integer from the PPM file */ +/* Swallows one trailing character after the integer */ +/* Note that on a 16-bit-int machine, only values up to 64k can be read. */ +/* This should not be a problem in practice. */ +{ + register int ch; + register unsigned int val; + + /* Skip any leading whitespace */ + do { + ch = pbm_getc(cinfo->input_file); + if (ch == EOF) + ERREXIT(cinfo->emethods, "Premature EOF in PPM file"); + } while (ch == ' ' || ch == '\t' || ch == '\n'); + + if (ch < '0' || ch > '9') + ERREXIT(cinfo->emethods, "Bogus data in PPM file"); + + val = ch - '0'; + while ((ch = pbm_getc(cinfo->input_file)) >= '0' && ch <= '9') { + val *= 10; + val += ch - '0'; + } + return val; +} + + +/* + * Read one row of pixels. + * + * We provide several different versions depending on input file format. + * In all cases, input is scaled to the size of JSAMPLE; it's possible that + * when JSAMPLE is 12 bits, this would not really be desirable. + * + * Note that a really fast path is provided for reading raw files with + * maxval = MAXJSAMPLE, which is the normal case (at least for 8-bit JSAMPLEs). + */ + + +METHODDEF void +get_text_gray_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading text-format PGM files with any maxval */ +{ + register JSAMPROW ptr0; + register unsigned int val; + register long col; + + ptr0 = pixel_row[0]; + for (col = cinfo->image_width; col > 0; col--) { + val = read_pbm_integer(cinfo); + if (rescale != NULL) + val = rescale[val]; + *ptr0++ = (JSAMPLE) val; + } +} + + +METHODDEF void +get_text_rgb_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading text-format PPM files with any maxval */ +{ + register JSAMPROW ptr0, ptr1, ptr2; + register unsigned int val; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + val = read_pbm_integer(cinfo); + if (rescale != NULL) + val = rescale[val]; + *ptr0++ = (JSAMPLE) val; + val = read_pbm_integer(cinfo); + if (rescale != NULL) + val = rescale[val]; + *ptr1++ = (JSAMPLE) val; + val = read_pbm_integer(cinfo); + if (rescale != NULL) + val = rescale[val]; + *ptr2++ = (JSAMPLE) val; + } +} + + +METHODDEF void +get_scaled_gray_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading raw-format PGM files with any maxval */ +{ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0; + register long col; + + ptr0 = pixel_row[0]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = rescale[getc(infile)]; + } +} + + +METHODDEF void +get_scaled_rgb_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading raw-format PPM files with any maxval */ +{ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = rescale[getc(infile)]; + *ptr1++ = rescale[getc(infile)]; + *ptr2++ = rescale[getc(infile)]; + } +} + + +METHODDEF void +get_raw_gray_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading raw-format PGM files with maxval = MAXJSAMPLE */ +{ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0; + register long col; + + ptr0 = pixel_row[0]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = (JSAMPLE) getc(infile); + } +} + + +METHODDEF void +get_raw_rgb_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading raw-format PPM files with maxval = MAXJSAMPLE */ +{ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = (JSAMPLE) getc(infile); + *ptr1++ = (JSAMPLE) getc(infile); + *ptr2++ = (JSAMPLE) getc(infile); + } +} + + /* * Read the file header; return image size and component count. */ @@ -31,19 +220,45 @@ METHODDEF void input_init (compress_info_ptr cinfo) { - int c, w, h, prec; + int c; + unsigned int w, h, maxval; if (getc(cinfo->input_file) != 'P') ERREXIT(cinfo->emethods, "Not a PPM file"); - c = getc(cinfo->input_file); + c = getc(cinfo->input_file); /* save format discriminator for a sec */ + + w = read_pbm_integer(cinfo); /* while we fetch the header info */ + h = read_pbm_integer(cinfo); + maxval = read_pbm_integer(cinfo); + switch (c) { - case '5': /* it's a PGM file */ + case '2': /* it's a text-format PGM file */ + cinfo->methods->get_input_row = get_text_gray_row; cinfo->input_components = 1; cinfo->in_color_space = CS_GRAYSCALE; break; - case '6': /* it's a PPM file */ + case '3': /* it's a text-format PPM file */ + cinfo->methods->get_input_row = get_text_rgb_row; + cinfo->input_components = 3; + cinfo->in_color_space = CS_RGB; + break; + + case '5': /* it's a raw-format PGM file */ + if (maxval == MAXJSAMPLE) + cinfo->methods->get_input_row = get_raw_gray_row; + else + cinfo->methods->get_input_row = get_scaled_gray_row; + cinfo->input_components = 1; + cinfo->in_color_space = CS_GRAYSCALE; + break; + + case '6': /* it's a raw-format PPM file */ + if (maxval == MAXJSAMPLE) + cinfo->methods->get_input_row = get_raw_rgb_row; + else + cinfo->methods->get_input_row = get_scaled_rgb_row; cinfo->input_components = 3; cinfo->in_color_space = CS_RGB; break; @@ -53,44 +268,29 @@ input_init (compress_info_ptr cinfo) break; } - if (fscanf(cinfo->input_file, " %d %d %d", &w, &h, &prec) != 3) + if (w <= 0 || h <= 0 || maxval <= 0) /* error check */ ERREXIT(cinfo->emethods, "Not a PPM file"); - if (getc(cinfo->input_file) != '\n' || w <= 0 || h <= 0 || prec != 255) - ERREXIT(cinfo->emethods, "Not a PPM file"); + /* Compute the rescaling array if necessary */ + /* This saves per-pixel calculation */ + if (maxval == MAXJSAMPLE) + rescale = NULL; /* no rescaling required */ + else { + INT32 val, half_maxval; + + /* On 16-bit-int machines we have to be careful of maxval = 65535 */ + rescale = (JSAMPLE *) (*cinfo->emethods->alloc_small) + ((size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE))); + half_maxval = maxval / 2; + for (val = 0; val <= (INT32) maxval; val++) { + /* The multiplication here must be done in 32 bits to avoid overflow */ + rescale[val] = (JSAMPLE) ((val * MAXJSAMPLE + half_maxval) / maxval); + } + } cinfo->image_width = w; cinfo->image_height = h; - cinfo->data_precision = 8; -} - - -/* - * Read one row of pixels. - */ - -METHODDEF void -get_input_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) -{ - register FILE * infile = cinfo->input_file; - register JSAMPROW ptr0, ptr1, ptr2; - register long col; - - if (cinfo->input_components == 1) { - ptr0 = pixel_row[0]; - for (col = cinfo->image_width; col > 0; col--) { - *ptr0++ = getc(infile); - } - } else { - ptr0 = pixel_row[0]; - ptr1 = pixel_row[1]; - ptr2 = pixel_row[2]; - for (col = cinfo->image_width; col > 0; col--) { - *ptr0++ = getc(infile); - *ptr1++ = getc(infile); - *ptr2++ = getc(infile); - } - } + cinfo->data_precision = BITS_IN_JSAMPLE; } @@ -101,7 +301,8 @@ get_input_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) METHODDEF void input_term (compress_info_ptr cinfo) { - /* no work required */ + if (rescale != NULL) + (*cinfo->emethods->free_small) ((void *) rescale); } @@ -117,7 +318,7 @@ GLOBAL void jselrppm (compress_info_ptr cinfo) { cinfo->methods->input_init = input_init; - cinfo->methods->get_input_row = get_input_row; + /* cinfo->methods->get_input_row is set by input_init */ cinfo->methods->input_term = input_term; } diff --git a/jrdrle.c b/jrdrle.c new file mode 100644 index 00000000..0571d2cd --- /dev/null +++ b/jrdrle.c @@ -0,0 +1,372 @@ +/* + * jrdrle.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to read input images in Utah RLE format. + * The Utah Raster Toolkit library is required (version 3.0). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume input from + * an ordinary stdio stream. They further assume that reading begins + * at the start of the file; input_init may need work if the + * user interface has already read some data (e.g., to determine that + * the file is indeed RLE format). + * + * These routines are invoked via the methods get_input_row + * and input_init/term. + * + * Based on code contributed by Mike Lijewski. + */ + +#include "jinclude.h" + +#ifdef RLE_SUPPORTED + +/* rle.h is provided by the Utah Raster Toolkit. */ + +#include + + +/* + * load_image assumes that JSAMPLE has the same representation as rle_pixel, + * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples. + */ + +#ifndef EIGHT_BIT_SAMPLES + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + + +/* + * We support the following types of RLE files: + * + * GRAYSCALE - 8 bits, no colormap + * PSEUDOCOLOR - 8 bits, colormap + * TRUECOLOR - 24 bits, colormap + * DIRECTCOLOR - 24 bits, no colormap + * + * For now, we ignore any alpha channel in the image. + */ + +typedef enum { GRAYSCALE, PSEUDOCOLOR, TRUECOLOR, DIRECTCOLOR } rle_kind; + +static rle_kind visual; /* actual type of input file */ + +/* + * Since RLE stores scanlines bottom-to-top, we have to invert the image + * to conform to JPEG's top-to-bottom order. To do this, we read the + * incoming image into a virtual array on the first get_input_row call, + * then fetch the required row from the virtual array on subsequent calls. + */ + +static big_sarray_ptr image; /* single array for GRAYSCALE/PSEUDOCOLOR */ +static big_sarray_ptr red_channel; /* three arrays for TRUECOLOR/DIRECTCOLOR */ +static big_sarray_ptr green_channel; +static big_sarray_ptr blue_channel; +static long cur_row_number; /* last row# read from virtual array */ + +static rle_hdr header; /* Input file information */ +static rle_map *colormap; /* RLE colormap, if any */ + + +/* + * Read the file header; return image size and component count. + */ + +METHODDEF void +input_init (compress_info_ptr cinfo) +{ + long width, height; + + /* Use RLE library routine to get the header info */ + header.rle_file = cinfo->input_file; + switch (rle_get_setup(&header)) { + case RLE_SUCCESS: + /* A-OK */ + break; + case RLE_NOT_RLE: + ERREXIT(cinfo->emethods, "Not an RLE file"); + break; + case RLE_NO_SPACE: + ERREXIT(cinfo->emethods, "Insufficient memory for RLE header"); + break; + case RLE_EMPTY: + ERREXIT(cinfo->emethods, "Empty RLE file"); + break; + case RLE_EOF: + ERREXIT(cinfo->emethods, "Premature EOF in RLE header"); + break; + default: + ERREXIT(cinfo->emethods, "Bogus RLE error code"); + break; + } + + /* Figure out what we have, set private vars and return values accordingly */ + + width = header.xmax - header.xmin + 1; + height = header.ymax - header.ymin + 1; + header.xmin = 0; /* realign horizontally */ + header.xmax = width-1; + + cinfo->image_width = width; + cinfo->image_height = height; + cinfo->data_precision = 8; /* we can only handle 8 bit data */ + + if (header.ncolors == 1 && header.ncmap == 0) { + visual = GRAYSCALE; + TRACEMS(cinfo->emethods, 1, "Gray-scale RLE file"); + } else if (header.ncolors == 1 && header.ncmap == 3) { + visual = PSEUDOCOLOR; + colormap = header.cmap; + TRACEMS1(cinfo->emethods, 1, "Colormapped RLE file with map of length %d", + 1 << header.cmaplen); + } else if (header.ncolors == 3 && header.ncmap == 3) { + visual = TRUECOLOR; + colormap = header.cmap; + TRACEMS1(cinfo->emethods, 1, "Full-color RLE file with map of length %d", + 1 << header.cmaplen); + } else if (header.ncolors == 3 && header.ncmap == 0) { + visual = DIRECTCOLOR; + TRACEMS(cinfo->emethods, 1, "Full-color RLE file"); + } else + ERREXIT(cinfo->emethods, "Can't handle this RLE setup"); + + switch (visual) { + case GRAYSCALE: + /* request one big array to hold the grayscale image */ + image = (*cinfo->emethods->request_big_sarray) (width, height, 1L); + cinfo->in_color_space = CS_GRAYSCALE; + cinfo->input_components = 1; + break; + case PSEUDOCOLOR: + /* request one big array to hold the pseudocolor image */ + image = (*cinfo->emethods->request_big_sarray) (width, height, 1L); + cinfo->in_color_space = CS_RGB; + cinfo->input_components = 3; + break; + case TRUECOLOR: + case DIRECTCOLOR: + /* request three big arrays to hold the RGB channels */ + red_channel = (*cinfo->emethods->request_big_sarray) (width, height, 1L); + green_channel = (*cinfo->emethods->request_big_sarray) (width, height, 1L); + blue_channel = (*cinfo->emethods->request_big_sarray) (width, height, 1L); + cinfo->in_color_space = CS_RGB; + cinfo->input_components = 3; + break; + } +} + + +/* + * Read one row of pixels. + * These are called only after load_image has read the image into + * the virtual array(s). + */ + + +METHODDEF void +get_grayscale_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This is used for GRAYSCALE images */ +{ + JSAMPROW inputrows[1]; /* a pseudo JSAMPARRAY structure */ + + cur_row_number--; /* work down in array */ + + inputrows[0] = *((*cinfo->emethods->access_big_sarray) + (image, cur_row_number, FALSE)); + + jcopy_sample_rows(inputrows, 0, pixel_row, 0, 1, cinfo->image_width); +} + + +METHODDEF void +get_pseudocolor_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This is used for PSEUDOCOLOR images */ +{ + long col; + JSAMPROW image_ptr, ptr0, ptr1, ptr2; + int val; + + cur_row_number--; /* work down in array */ + + image_ptr = *((*cinfo->emethods->access_big_sarray) + (image, cur_row_number, FALSE)); + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + + for (col = cinfo->image_width; col > 0; col--) { + val = GETJSAMPLE(*image_ptr++); + *ptr0++ = colormap[val ] >> 8; + *ptr1++ = colormap[val + 256] >> 8; + *ptr2++ = colormap[val + 512] >> 8; + } +} + + +METHODDEF void +get_truecolor_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This is used for TRUECOLOR images */ +/* The colormap consists of 3 independent lookup tables */ +{ + long col; + JSAMPROW red_ptr, green_ptr, blue_ptr, ptr0, ptr1, ptr2; + + cur_row_number--; /* work down in array */ + + red_ptr = *((*cinfo->emethods->access_big_sarray) + (red_channel, cur_row_number, FALSE)); + green_ptr = *((*cinfo->emethods->access_big_sarray) + (green_channel, cur_row_number, FALSE)); + blue_ptr = *((*cinfo->emethods->access_big_sarray) + (blue_channel, cur_row_number, FALSE)); + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + + for (col = cinfo->image_width; col > 0; col--) { + *ptr0++ = colormap[GETJSAMPLE(*red_ptr++) ] >> 8; + *ptr1++ = colormap[GETJSAMPLE(*green_ptr++) + 256] >> 8; + *ptr2++ = colormap[GETJSAMPLE(*blue_ptr++) + 512] >> 8; + } +} + + +METHODDEF void +get_directcolor_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This is used for DIRECTCOLOR images */ +{ + JSAMPROW inputrows[3]; /* a pseudo JSAMPARRAY structure */ + + cur_row_number--; /* work down in array */ + + inputrows[0] = *((*cinfo->emethods->access_big_sarray) + (red_channel, cur_row_number, FALSE)); + inputrows[1] = *((*cinfo->emethods->access_big_sarray) + (green_channel, cur_row_number, FALSE)); + inputrows[2] = *((*cinfo->emethods->access_big_sarray) + (blue_channel, cur_row_number, FALSE)); + + jcopy_sample_rows(inputrows, 0, pixel_row, 0, 3, cinfo->image_width); +} + + +/* + * Load the color channels into separate arrays. We have to do + * this because RLE files start at the lower left while the JPEG standard + * has them starting in the upper left. This is called the first time + * we want to get a row of input. What we do is load the RLE data into + * big arrays and then call the appropriate routine to read one row from + * the big arrays. We also change cinfo->methods->get_input_row so that + * subsequent calls go straight to the row-reading routine. + */ + +METHODDEF void +load_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + long row; + rle_pixel *rle_row[3]; + + /* Read the RLE data into our virtual array(s). + * We assume here that (a) rle_pixel is represented the same as JSAMPLE, + * and (b) we are not on a machine where FAR pointers differ from regular. + */ + RLE_CLR_BIT(header, RLE_ALPHA); /* don't read the alpha channel */ + + switch (visual) { + case GRAYSCALE: + case PSEUDOCOLOR: + for (row = 0; row < cinfo->image_height; row++) { + /* + * Read a row of the image directly into our big array. + * Too bad this doesn't seem to return any indication of errors :-(. + */ + rle_row[0] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) + (image, row, TRUE)); + rle_getrow(&header, rle_row); + } + break; + case TRUECOLOR: + case DIRECTCOLOR: + for (row = 0; row < cinfo->image_height; row++) { + /* + * Read a row of the image directly into our big arrays. + * Too bad this doesn't seem to return any indication of errors :-(. + */ + rle_row[0] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) + (red_channel, row, TRUE)); + rle_row[1] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) + (green_channel, row, TRUE)); + rle_row[2] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) + (blue_channel, row, TRUE)); + rle_getrow(&header, rle_row); + } + break; + } + + /* Set up to call proper row-extraction routine in future */ + switch (visual) { + case GRAYSCALE: + cinfo->methods->get_input_row = get_grayscale_row; + break; + case PSEUDOCOLOR: + cinfo->methods->get_input_row = get_pseudocolor_row; + break; + case TRUECOLOR: + cinfo->methods->get_input_row = get_truecolor_row; + break; + case DIRECTCOLOR: + cinfo->methods->get_input_row = get_directcolor_row; + break; + } + + /* And fetch the topmost (bottommost) row */ + cur_row_number = cinfo->image_height; + (*cinfo->methods->get_input_row) (cinfo, pixel_row); +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +input_term (compress_info_ptr cinfo) +{ + switch (visual) { + case GRAYSCALE: + case PSEUDOCOLOR: + (*cinfo->emethods->free_big_sarray) (image); + break; + case TRUECOLOR: + case DIRECTCOLOR: + (*cinfo->emethods->free_big_sarray) (red_channel); + (*cinfo->emethods->free_big_sarray) (green_channel); + (*cinfo->emethods->free_big_sarray) (blue_channel); + break; + } +} + + +/* + * The method selection routine for RLE format input. + * Note that this must be called by the user interface before calling + * jpeg_compress. If multiple input formats are supported, the + * user interface is responsible for discovering the file format and + * calling the appropriate method selection routine. + */ + +GLOBAL void +jselrrle (compress_info_ptr cinfo) +{ + cinfo->methods->input_init = input_init; + cinfo->methods->get_input_row = load_image; /* until first call */ + cinfo->methods->input_term = input_term; +} + +#endif /* RLE_SUPPORTED */ diff --git a/jrdtarga.c b/jrdtarga.c new file mode 100644 index 00000000..b8aa0332 --- /dev/null +++ b/jrdtarga.c @@ -0,0 +1,483 @@ +/* + * jrdtarga.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to read input images in Targa format. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume input from + * an ordinary stdio stream. They further assume that reading begins + * at the start of the file; input_init may need work if the + * user interface has already read some data (e.g., to determine that + * the file is indeed Targa format). + * + * These routines are invoked via the methods get_input_row + * and input_init/term. + * + * Based on code contributed by Lee Daniel Crocker. + */ + +#include "jinclude.h" + +#ifdef TARGA_SUPPORTED + + +/* Macros to deal with unsigned chars as efficiently as compiler allows */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char U_CHAR; +#define UCH(x) ((int) (x)) +#else /* !HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED +typedef char U_CHAR; +#define UCH(x) ((int) (x)) +#else +typedef char U_CHAR; +#define UCH(x) ((int) (x) & 0xFF) +#endif +#endif /* HAVE_UNSIGNED_CHAR */ + + +#define ReadOK(file,buffer,len) (FREAD(file,buffer,len) == ((size_t) (len))) + + +static JSAMPARRAY colormap; /* Targa colormap (converted to my format) */ + +static big_sarray_ptr whole_image; /* Needed if funny input row order */ +static long current_row; /* Current logical row number to read */ + +/* Pointer to routine to extract next Targa pixel from input file */ +static void (*read_pixel) PP((compress_info_ptr cinfo)); + +/* Result of read_pixel is delivered here: */ +static U_CHAR tga_pixel[4]; + +static int pixel_size; /* Bytes per Targa pixel (1 to 4) */ + +/* State info for reading RLE-coded pixels; both counts must be init to 0 */ +static int block_count; /* # of pixels remaining in RLE block */ +static int dup_pixel_count; /* # of times to duplicate previous pixel */ + +/* This saves the correct pixel-row-expansion method for preload_image */ +static void (*get_pixel_row) PP((compress_info_ptr cinfo, + JSAMPARRAY pixel_row)); + + +/* For expanding 5-bit pixel values to 8-bit with best rounding */ + +static const UINT8 c5to8bits[32] = { + 0, 8, 16, 24, 32, 41, 49, 57, + 65, 74, 82, 90, 98, 106, 115, 123, + 131, 139, 148, 156, 164, 172, 180, 189, + 197, 205, 213, 222, 230, 238, 246, 255 +}; + + + +LOCAL int +read_byte (compress_info_ptr cinfo) +/* Read next byte from Targa file */ +{ + register FILE *infile = cinfo->input_file; + register int c; + + if ((c = getc(infile)) == EOF) + ERREXIT(cinfo->emethods, "Premature EOF in Targa file"); + return c; +} + + +LOCAL void +read_colormap (compress_info_ptr cinfo, int cmaplen, int mapentrysize) +/* Read the colormap from a Targa file */ +{ + int i; + + /* Presently only handles 24-bit BGR format */ + if (mapentrysize != 24) + ERREXIT(cinfo->emethods, "Unsupported Targa colormap format"); + + for (i = 0; i < cmaplen; i++) { + colormap[2][i] = (JSAMPLE) read_byte(cinfo); + colormap[1][i] = (JSAMPLE) read_byte(cinfo); + colormap[0][i] = (JSAMPLE) read_byte(cinfo); + } +} + + +/* + * read_pixel methods: get a single pixel from Targa file into tga_pixel[] + */ + +LOCAL void +read_non_rle_pixel (compress_info_ptr cinfo) +/* Read one Targa pixel from the input file; no RLE expansion */ +{ + register FILE * infile = cinfo->input_file; + register int i; + + for (i = 0; i < pixel_size; i++) { + tga_pixel[i] = (U_CHAR) getc(infile); + } +} + + +LOCAL void +read_rle_pixel (compress_info_ptr cinfo) +/* Read one Targa pixel from the input file, expanding RLE data as needed */ +{ + register FILE * infile = cinfo->input_file; + register int i; + + /* Duplicate previously read pixel? */ + if (dup_pixel_count > 0) { + dup_pixel_count--; + return; + } + + /* Time to read RLE block header? */ + if (--block_count < 0) { /* decrement pixels remaining in block */ + i = read_byte(cinfo); + if (i & 0x80) { /* Start of duplicate-pixel block? */ + dup_pixel_count = i & 0x7F; /* number of duplications after this one */ + block_count = 0; /* then read new block header */ + } else { + block_count = i & 0x7F; /* number of pixels after this one */ + } + } + + /* Read next pixel */ + for (i = 0; i < pixel_size; i++) { + tga_pixel[i] = (U_CHAR) getc(infile); + } +} + + +/* + * Read one row of pixels. + * + * We provide several different versions depending on input file format. + */ + + +METHODDEF void +get_8bit_gray_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading 8-bit grayscale pixels */ +{ + register JSAMPROW ptr0; + register long col; + + ptr0 = pixel_row[0]; + for (col = cinfo->image_width; col > 0; col--) { + (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ + *ptr0++ = (JSAMPLE) UCH(tga_pixel[0]); + } +} + +METHODDEF void +get_8bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading 8-bit colormap indexes */ +{ + register int t; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ + t = UCH(tga_pixel[0]); + *ptr0++ = colormap[0][t]; + *ptr1++ = colormap[1][t]; + *ptr2++ = colormap[2][t]; + } +} + +METHODDEF void +get_16bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading 16-bit pixels */ +{ + register int t; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ + t = UCH(tga_pixel[0]); + t += UCH(tga_pixel[1]) << 8; + /* We expand 5 bit data to 8 bit sample width. + * The format of the 16-bit (LSB first) input word is + * xRRRRRGGGGGBBBBB + */ + *ptr2++ = (JSAMPLE) c5to8bits[t & 0x1F]; + t >>= 5; + *ptr1++ = (JSAMPLE) c5to8bits[t & 0x1F]; + t >>= 5; + *ptr0++ = (JSAMPLE) c5to8bits[t & 0x1F]; + } +} + +METHODDEF void +get_24bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading 24-bit pixels */ +{ + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ + *ptr0++ = (JSAMPLE) UCH(tga_pixel[2]); /* convert BGR to RGB order */ + *ptr1++ = (JSAMPLE) UCH(tga_pixel[1]); + *ptr2++ = (JSAMPLE) UCH(tga_pixel[0]); + } +} + +METHODDEF void +get_32bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* This version is for reading 32-bit pixels */ +/* Attribute bits are ignored for now */ +{ + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + +/* NOTE: there seems to be considerable confusion over whether the order + * of the bytes in a 32-bit Targa file is A,B,G,R or B,G,R,A. + * On Lee Crocker's authority, we think the attribute byte comes first. + * Make ATTR_BYTE_FIRST be 0 if you have files in which it comes last. + */ +#ifndef ATTR_BYTE_FIRST /* so you can say -DATTR_BYTE_FIRST=0 in Makefile */ +#define ATTR_BYTE_FIRST 1 /* must be 0 or 1 */ +#endif + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = cinfo->image_width; col > 0; col--) { + (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ + /* convert ABGR (or BGRA) to RGB order */ + *ptr0++ = (JSAMPLE) UCH(tga_pixel[2+ATTR_BYTE_FIRST]); + *ptr1++ = (JSAMPLE) UCH(tga_pixel[1+ATTR_BYTE_FIRST]); + *ptr2++ = (JSAMPLE) UCH(tga_pixel[0+ATTR_BYTE_FIRST]); + } +} + + +/* + * This method is for re-reading the input data in standard top-down + * row order. The entire image has already been read into whole_image + * with proper conversion of pixel format, but it's in a funny row order. + */ + +METHODDEF void +get_memory_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + JSAMPARRAY image_ptr; + long source_row; + + /* Compute row of source that maps to current_row of normal order */ + /* For now, assume image is bottom-up and not interlaced. */ + /* NEEDS WORK to support interlaced images! */ + source_row = cinfo->image_height - current_row - 1; + + /* Fetch that row from virtual array */ + image_ptr = (*cinfo->emethods->access_big_sarray) + (whole_image, source_row * cinfo->input_components, FALSE); + + jcopy_sample_rows(image_ptr, 0, pixel_row, 0, + cinfo->input_components, cinfo->image_width); + + current_row++; +} + + +/* + * This method loads the image into whole_image during the first call on + * get_input_row. The get_input_row pointer is then adjusted to call + * get_memory_row on subsequent calls. + */ + +METHODDEF void +preload_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +{ + JSAMPARRAY image_ptr; + long row; + + /* Read the data into a virtual array in input-file row order */ + for (row = 0; row < cinfo->image_height; row++) { + image_ptr = (*cinfo->emethods->access_big_sarray) + (whole_image, row * cinfo->input_components, TRUE); + (*get_pixel_row) (cinfo, image_ptr); + } + /* Set up to read from the virtual array in unscrambled order */ + cinfo->methods->get_input_row = get_memory_row; + current_row = 0; + /* And read the first row */ + get_memory_row(cinfo, pixel_row); +} + + +/* + * Read the file header; return image size and component count. + */ + +METHODDEF void +input_init (compress_info_ptr cinfo) +{ + U_CHAR targaheader[18]; + int idlen, cmaptype, subtype, flags, interlace_type, components; + UINT16 width, height, maplen; + boolean is_bottom_up; + +#define GET_2B(offset) ((unsigned int) UCH(targaheader[offset]) + \ + (((unsigned int) UCH(targaheader[offset+1])) << 8)) + + if (! ReadOK(cinfo->input_file, targaheader, 18)) + ERREXIT(cinfo->emethods, "Unexpected end of file"); + + /* Pretend "15-bit" pixels are 16-bit --- we ignore attribute bit anyway */ + if (targaheader[16] == 15) + targaheader[16] = 16; + + idlen = UCH(targaheader[0]); + cmaptype = UCH(targaheader[1]); + subtype = UCH(targaheader[2]); + maplen = GET_2B(5); + width = GET_2B(12); + height = GET_2B(14); + pixel_size = UCH(targaheader[16]) >> 3; + flags = UCH(targaheader[17]); /* Image Descriptor byte */ + + is_bottom_up = ((flags & 0x20) == 0); /* bit 5 set => top-down */ + interlace_type = flags >> 6; /* bits 6/7 are interlace code */ + + if (cmaptype > 1 || /* cmaptype must be 0 or 1 */ + pixel_size < 1 || pixel_size > 4 || + (UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */ + interlace_type != 0) /* currently don't allow interlaced image */ + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + + if (subtype > 8) { + /* It's an RLE-coded file */ + read_pixel = read_rle_pixel; + block_count = dup_pixel_count = 0; + subtype -= 8; + } else { + /* Non-RLE file */ + read_pixel = read_non_rle_pixel; + } + + /* Now should have subtype 1, 2, or 3 */ + components = 3; /* until proven different */ + cinfo->in_color_space = CS_RGB; + + switch (subtype) { + case 1: /* colormapped image */ + if (pixel_size == 1 && cmaptype == 1) + get_pixel_row = get_8bit_row; + else + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + break; + case 2: /* RGB image */ + switch (pixel_size) { + case 2: + get_pixel_row = get_16bit_row; + break; + case 3: + get_pixel_row = get_24bit_row; + break; + case 4: + get_pixel_row = get_32bit_row; + break; + default: + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + break; + } + break; + case 3: /* Grayscale image */ + components = 1; + cinfo->in_color_space = CS_GRAYSCALE; + if (pixel_size == 1) + get_pixel_row = get_8bit_gray_row; + else + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + break; + default: + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + break; + } + + if (is_bottom_up) { + whole_image = (*cinfo->emethods->request_big_sarray) + ((long) width, (long) height * components, + (long) components); + cinfo->methods->get_input_row = preload_image; + } else { + whole_image = NULL; + cinfo->methods->get_input_row = get_pixel_row; + } + + while (idlen--) /* Throw away ID field */ + (void) read_byte(cinfo); + + if (maplen > 0) { + if (maplen > 256 || GET_2B(3) != 0) + ERREXIT(cinfo->emethods, "Colormap too large"); + /* Allocate space to store the colormap */ + colormap = (*cinfo->emethods->alloc_small_sarray) + ((long) maplen, 3L); + /* and read it from the file */ + read_colormap(cinfo, (int) maplen, UCH(targaheader[7])); + } else { + if (cmaptype) /* but you promised a cmap! */ + ERREXIT(cinfo->emethods, "Invalid or unsupported Targa file"); + colormap = NULL; + } + + cinfo->input_components = components; + cinfo->image_width = width; + cinfo->image_height = height; + cinfo->data_precision = 8; /* always, even if 12-bit JSAMPLEs */ +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +input_term (compress_info_ptr cinfo) +{ + if (whole_image != NULL) + (*cinfo->emethods->free_big_sarray) (whole_image); + if (colormap != NULL) + (*cinfo->emethods->free_small_sarray) (colormap, 3L); +} + + +/* + * The method selection routine for Targa format input. + * Note that this must be called by the user interface before calling + * jpeg_compress. If multiple input formats are supported, the + * user interface is responsible for discovering the file format and + * calling the appropriate method selection routine. + */ + +GLOBAL void +jselrtarga (compress_info_ptr cinfo) +{ + cinfo->methods->input_init = input_init; + /* cinfo->methods->get_input_row is set by input_init */ + cinfo->methods->input_term = input_term; +} + +#endif /* TARGA_SUPPORTED */ diff --git a/jrevdct.c b/jrevdct.c index bafbf551..7c6d83ff 100644 --- a/jrevdct.c +++ b/jrevdct.c @@ -16,99 +16,147 @@ #include "jinclude.h" -/* The poop on this scaling stuff is as follows: - * - * Most of the numbers (after multiplication by the constants) are - * (logically) shifted left by LG2_DCT_SCALE. This is undone by UNFIXH - * before assignment to the output array. Note that we want an additional - * division by 2 on the output (required by the equations). - * - * If right shifts are unsigned, then there is a potential problem. - * However, shifting right by 16 and then assigning to a short - * (assuming short = 16 bits) will keep the sign right!! - * - * For other shifts, - * - * ((x + (1 << 30)) >> shft) - (1 << (30 - shft)) - * - * gives a nice right shift with sign (assuming no overflow). However, all the - * scaling is such that this isn't a problem. (Is this true?) +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a signed right shift of an INT32 quantity. + * It is only applied with constant shift counts. */ - -#define ONE 1L /* remove L if long > 32 bits */ - #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define LG2_DCT_SCALE 15 -#define RIGHT_SHIFT(_x,_shft) ((((_x) + (ONE << 30)) >> (_shft)) - (ONE << (30 - (_shft)))) +#define SHIFT_TEMPS INT32 shift_temp; +#define RIGHT_SHIFT(x,shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~0) << (32-(shft))) : \ + (shift_temp >> (shft))) #else -#define LG2_DCT_SCALE 16 -#define RIGHT_SHIFT(_x,_shft) ((_x) >> (_shft)) +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif + +/* The poop on this scaling stuff is as follows: + * + * We have to do addition and subtraction of the integer inputs, which + * is no problem, and multiplication by fractional constants, which is + * a problem to do in integer arithmetic. We multiply all the constants + * by DCT_SCALE and convert them to integer constants (thus retaining + * LG2_DCT_SCALE bits of precision in the constants). After doing a + * multiplication we have to divide the product by DCT_SCALE, with proper + * rounding, to produce the correct output. The division can be implemented + * cheaply as a right shift of LG2_DCT_SCALE bits. The DCT equations also + * specify an additional division by 2 on the final outputs; this can be + * folded into the right-shift by shifting one more bit (see UNFIXH). + * + * If you are planning to recode this in assembler, you might want to set + * LG2_DCT_SCALE to 15. This loses a bit of precision, but then all the + * multiplications are between 16-bit quantities (given 8-bit JSAMPLEs!) + * so you could use a signed 16x16=>32 bit multiply instruction instead of + * full 32x32 multiply. Unfortunately there's no way to describe such a + * multiply portably in C, so we've gone for the extra bit of accuracy here. + */ + +#ifdef EIGHT_BIT_SAMPLES +#define LG2_DCT_SCALE 16 +#else +#define LG2_DCT_SCALE 15 /* lose a little precision to avoid overflow */ +#endif + +#define ONE ((INT32) 1) + #define DCT_SCALE (ONE << LG2_DCT_SCALE) +/* In some places we shift the inputs left by a couple more bits, */ +/* so that they can be added to fractional results without too much */ +/* loss of precision. */ #define LG2_OVERSCALE 2 -#define OVERSCALE (ONE << LG2_OVERSCALE) +#define OVERSCALE (ONE << LG2_OVERSCALE) +#define OVERSHIFT(x) ((x) <<= LG2_OVERSCALE) -#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) +/* Scale a fractional constant by DCT_SCALE */ +#define FIX(x) ((INT32) ((x) * DCT_SCALE + 0.5)) + +/* Scale a fractional constant by DCT_SCALE/OVERSCALE */ +/* Such a constant can be multiplied with an overscaled input */ +/* to produce something that's scaled by DCT_SCALE */ #define FIXO(x) ((INT32) ((x) * DCT_SCALE / OVERSCALE + 0.5)) -#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) -#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) -#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)), LG2_DCT_SCALE-LG2_OVERSCALE) -#define OVERSH(x) ((x) << LG2_OVERSCALE) -#define SIN_1_4 FIX(0.7071067811856476) +/* Descale and correctly round a value that's scaled by DCT_SCALE */ +#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE) + +/* Same with an additional division by 2, ie, correctly rounded UNFIX(x/2) */ +#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1) + +/* Take a value scaled by DCT_SCALE and round to integer scaled by OVERSCALE */ +#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)),\ + LG2_DCT_SCALE-LG2_OVERSCALE) + +/* Here are the constants we need */ +/* SIN_i_j is sine of i*pi/j, scaled by DCT_SCALE */ +/* COS_i_j is cosine of i*pi/j, scaled by DCT_SCALE */ + +#define SIN_1_4 FIX(0.707106781) #define COS_1_4 SIN_1_4 -#define SIN_1_8 FIX(0.3826834323650898) -#define COS_1_8 FIX(0.9238795325112870) +#define SIN_1_8 FIX(0.382683432) +#define COS_1_8 FIX(0.923879533) #define SIN_3_8 COS_1_8 #define COS_3_8 SIN_1_8 -#define SIN_1_16 FIX(0.1950903220161282) -#define COS_1_16 FIX(0.9807852804032300) +#define SIN_1_16 FIX(0.195090322) +#define COS_1_16 FIX(0.980785280) #define SIN_7_16 COS_1_16 #define COS_7_16 SIN_1_16 -#define SIN_3_16 FIX(0.5555702330196022) -#define COS_3_16 FIX(0.8314696123025450) +#define SIN_3_16 FIX(0.555570233) +#define COS_3_16 FIX(0.831469612) #define SIN_5_16 COS_3_16 #define COS_5_16 SIN_3_16 -#define OSIN_1_4 FIXO(0.707106781185647) +/* OSIN_i_j is sine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */ +/* OCOS_i_j is cosine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */ + +#define OSIN_1_4 FIXO(0.707106781) #define OCOS_1_4 OSIN_1_4 -#define OSIN_1_8 FIXO(0.3826834323650898) -#define OCOS_1_8 FIXO(0.9238795325112870) +#define OSIN_1_8 FIXO(0.382683432) +#define OCOS_1_8 FIXO(0.923879533) #define OSIN_3_8 OCOS_1_8 #define OCOS_3_8 OSIN_1_8 -#define OSIN_1_16 FIXO(0.1950903220161282) -#define OCOS_1_16 FIXO(0.9807852804032300) +#define OSIN_1_16 FIXO(0.195090322) +#define OCOS_1_16 FIXO(0.980785280) #define OSIN_7_16 OCOS_1_16 #define OCOS_7_16 OSIN_1_16 -#define OSIN_3_16 FIXO(0.5555702330196022) -#define OCOS_3_16 FIXO(0.8314696123025450) +#define OSIN_3_16 FIXO(0.555570233) +#define OCOS_3_16 FIXO(0.831469612) #define OSIN_5_16 OCOS_3_16 #define OCOS_5_16 OSIN_3_16 +/* + * Perform a 1-dimensional inverse DCT. + * Note that this code is specialized to the case DCTSIZE = 8. + */ + INLINE LOCAL void fast_idct_8 (DCTELEM *in, int stride) { - /* tmp1x are new values of tmpx -- flashy register colourers + /* many tmps have nonoverlapping lifetime -- flashy register colourers * should be able to do this lot very well */ + INT32 in0, in1, in2, in3, in4, in5, in6, in7; INT32 tmp10, tmp11, tmp12, tmp13; INT32 tmp20, tmp21, tmp22, tmp23; INT32 tmp30, tmp31; INT32 tmp40, tmp41, tmp42, tmp43; INT32 tmp50, tmp51, tmp52, tmp53; - INT32 in0, in1, in2, in3, in4, in5, in6, in7; - + SHIFT_TEMPS + in0 = in[ 0]; in1 = in[stride ]; in2 = in[stride*2]; @@ -117,7 +165,9 @@ fast_idct_8 (DCTELEM *in, int stride) in5 = in[stride*5]; in6 = in[stride*6]; in7 = in[stride*7]; - + + /* These values are scaled by DCT_SCALE */ + tmp10 = (in0 + in4) * COS_1_4; tmp11 = (in0 - in4) * COS_1_4; tmp12 = in2 * SIN_1_8 - in6 * COS_1_8; @@ -127,35 +177,43 @@ fast_idct_8 (DCTELEM *in, int stride) tmp21 = tmp11 + tmp12; tmp22 = tmp11 - tmp12; tmp23 = tmp10 - tmp13; - + + /* These values are scaled by OVERSCALE */ + tmp30 = UNFIXO((in3 + in5) * COS_1_4); tmp31 = UNFIXO((in3 - in5) * COS_1_4); - - tmp40 = OVERSH(in1) + tmp30; - tmp41 = OVERSH(in7) + tmp31; - tmp42 = OVERSH(in1) - tmp30; - tmp43 = OVERSH(in7) - tmp31; - + + OVERSHIFT(in1); + OVERSHIFT(in7); + + tmp40 = in1 + tmp30; + tmp41 = in7 + tmp31; + tmp42 = in1 - tmp30; + tmp43 = in7 - tmp31; + + /* And these are scaled by DCT_SCALE */ + tmp50 = tmp40 * OCOS_1_16 + tmp41 * OSIN_1_16; tmp51 = tmp40 * OSIN_1_16 - tmp41 * OCOS_1_16; tmp52 = tmp42 * OCOS_5_16 + tmp43 * OSIN_5_16; tmp53 = tmp42 * OSIN_5_16 - tmp43 * OCOS_5_16; - in[ 0] = UNFIXH(tmp20 + tmp50); - in[stride ] = UNFIXH(tmp21 + tmp53); - in[stride*2] = UNFIXH(tmp22 + tmp52); - in[stride*3] = UNFIXH(tmp23 + tmp51); - in[stride*4] = UNFIXH(tmp23 - tmp51); - in[stride*5] = UNFIXH(tmp22 - tmp52); - in[stride*6] = UNFIXH(tmp21 - tmp53); - in[stride*7] = UNFIXH(tmp20 - tmp50); + in[ 0] = (DCTELEM) UNFIXH(tmp20 + tmp50); + in[stride ] = (DCTELEM) UNFIXH(tmp21 + tmp53); + in[stride*2] = (DCTELEM) UNFIXH(tmp22 + tmp52); + in[stride*3] = (DCTELEM) UNFIXH(tmp23 + tmp51); + in[stride*4] = (DCTELEM) UNFIXH(tmp23 - tmp51); + in[stride*5] = (DCTELEM) UNFIXH(tmp22 - tmp52); + in[stride*6] = (DCTELEM) UNFIXH(tmp21 - tmp53); + in[stride*7] = (DCTELEM) UNFIXH(tmp20 - tmp50); } /* * Perform the inverse DCT on one block of coefficients. * - * Note that this code is specialized to the case DCTSIZE = 8. + * A 2-D IDCT can be done by 1-D IDCT on each row + * followed by 1-D IDCT on each column. */ GLOBAL void diff --git a/jversion.h b/jversion.h new file mode 100644 index 00000000..a9313854 --- /dev/null +++ b/jversion.h @@ -0,0 +1,14 @@ +/* + * jversion.h + * + * Copyright (C) 1991, 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. + * + * This file contains software version identification. + */ + + +#define JVERSION "2 13-Dec-91" + +#define JCOPYRIGHT "Copyright (C) 1991, Thomas G. Lane" diff --git a/jvirtmem.c b/jvirtmem.c index 4a0627ca..6e1d332c 100644 --- a/jvirtmem.c +++ b/jvirtmem.c @@ -17,9 +17,11 @@ * They should exit to error_exit if unsuccessful. */ +#define AM_MEMORY_MANAGER /* we define big_Xarray_control structs */ + #include "jinclude.h" -#ifdef __STDC__ +#ifdef INCLUDES_ARE_ANSI #include /* to declare malloc(), free() */ #else extern void * malloc PP((size_t size)); @@ -52,6 +54,20 @@ extern void free PP((void *ptr)); #endif /* NEED_FAR_POINTERS */ +/* + * When allocating 2-D arrays we can either ask malloc() for each row + * individually, or grab the whole space in one chunk. The latter is + * a lot faster on large arrays, but fails if malloc can't handle big + * requests, as is typically true on MS-DOS. + * We assume here that big malloc requests are safe whenever + * NEED_FAR_POINTERS is not defined, but you can change this if you are + * on a weird machine. + */ + +#ifndef NEED_FAR_POINTERS +#define BIG_MALLOCS_OK /* safe to ask far_malloc for > 64Kb */ +#endif + /* * Some important notes: @@ -220,12 +236,20 @@ alloc_small_sarray (long samplesperrow, long numrows) /* Allocate a "small" (all-in-memory) 2-D sample array */ { JSAMPARRAY result; +#ifdef BIG_MALLOCS_OK + JSAMPROW workspace; +#endif long i; #ifdef MEM_STATS total_num_sarray++; +#ifdef BIG_MALLOCS_OK + total_bytes_sarray += numrows * samplesperrow * SIZEOF(JSAMPLE) + + MALLOC_FAR_OVERHEAD; +#else total_bytes_sarray += (samplesperrow * SIZEOF(JSAMPLE) + MALLOC_FAR_OVERHEAD) * numrows; +#endif cur_num_sarray++; if (cur_num_sarray > max_num_sarray) max_num_sarray = cur_num_sarray; #endif @@ -234,11 +258,24 @@ alloc_small_sarray (long samplesperrow, long numrows) result = (JSAMPARRAY) alloc_small((size_t) (numrows * SIZEOF(JSAMPROW))); /* Get the rows themselves; on 80x86 these are "far" */ + +#ifdef BIG_MALLOCS_OK + workspace = (JSAMPROW) far_malloc((size_t) + (numrows * samplesperrow * SIZEOF(JSAMPLE))); + if (workspace == NULL) + out_of_memory(3); for (i = 0; i < numrows; i++) { - result[i] = (JSAMPROW) far_malloc((size_t) (samplesperrow * SIZEOF(JSAMPLE))); + result[i] = workspace; + workspace += samplesperrow; + } +#else + for (i = 0; i < numrows; i++) { + result[i] = (JSAMPROW) far_malloc((size_t) + (samplesperrow * SIZEOF(JSAMPLE))); if (result[i] == NULL) out_of_memory(3); } +#endif return result; } @@ -248,12 +285,16 @@ METHODDEF void free_small_sarray (JSAMPARRAY ptr, long numrows) /* Free a "small" (all-in-memory) 2-D sample array */ { + /* Free the rows themselves; on 80x86 these are "far" */ +#ifdef BIG_MALLOCS_OK + far_free((void FAR *) ptr[0]); +#else long i; - /* Free the rows themselves; on 80x86 these are "far" */ for (i = 0; i < numrows; i++) { far_free((void FAR *) ptr[i]); } +#endif /* Free space for row pointers; this is always "near" on 80x86 */ free_small((void *) ptr); @@ -269,12 +310,20 @@ alloc_small_barray (long blocksperrow, long numrows) /* Allocate a "small" (all-in-memory) 2-D coefficient-block array */ { JBLOCKARRAY result; +#ifdef BIG_MALLOCS_OK + JBLOCKROW workspace; +#endif long i; #ifdef MEM_STATS total_num_barray++; +#ifdef BIG_MALLOCS_OK + total_bytes_barray += numrows * blocksperrow * SIZEOF(JBLOCK) + + MALLOC_FAR_OVERHEAD; +#else total_bytes_barray += (blocksperrow * SIZEOF(JBLOCK) + MALLOC_FAR_OVERHEAD) * numrows; +#endif cur_num_barray++; if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray; #endif @@ -283,11 +332,24 @@ alloc_small_barray (long blocksperrow, long numrows) result = (JBLOCKARRAY) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW))); /* Get the rows themselves; on 80x86 these are "far" */ + +#ifdef BIG_MALLOCS_OK + workspace = (JBLOCKROW) far_malloc((size_t) + (numrows * blocksperrow * SIZEOF(JBLOCK))); + if (workspace == NULL) + out_of_memory(4); for (i = 0; i < numrows; i++) { - result[i] = (JBLOCKROW) far_malloc((size_t) (blocksperrow * SIZEOF(JBLOCK))); + result[i] = workspace; + workspace += blocksperrow; + } +#else + for (i = 0; i < numrows; i++) { + result[i] = (JBLOCKROW) far_malloc((size_t) + (blocksperrow * SIZEOF(JBLOCK))); if (result[i] == NULL) out_of_memory(4); } +#endif return result; } @@ -297,12 +359,16 @@ METHODDEF void free_small_barray (JBLOCKARRAY ptr, long numrows) /* Free a "small" (all-in-memory) 2-D coefficient-block array */ { + /* Free the rows themselves; on 80x86 these are "far" */ +#ifdef BIG_MALLOCS_OK + far_free((void FAR *) ptr[0]); +#else long i; - /* Free the rows themselves; on 80x86 these are "far" */ for (i = 0; i < numrows; i++) { far_free((void FAR *) ptr[i]); } +#endif /* Free space for row pointers; this is always "near" on 80x86 */ free_small((void *) ptr); diff --git a/jwrgif.c b/jwrgif.c index 44062ec8..9423af2a 100644 --- a/jwrgif.c +++ b/jwrgif.c @@ -97,8 +97,9 @@ flush_packet (void) /* flush any accumulated data */ { if (bytesinpkt > 0) { /* never write zero-length packet */ - packetbuf[0] = bytesinpkt++; - if (fwrite(packetbuf, 1, bytesinpkt, dcinfo->output_file) != bytesinpkt) + packetbuf[0] = (char) bytesinpkt++; + if (FWRITE(dcinfo->output_file, packetbuf, bytesinpkt) + != (size_t) bytesinpkt) ERREXIT(dcinfo->emethods, "Output file write error"); bytesinpkt = 0; } @@ -106,7 +107,7 @@ flush_packet (void) LOCAL void -char_out (int c) +char_out (char c) /* Add a character to current packet; flush to disk if necessary */ { packetbuf[++bytesinpkt] = c; @@ -133,7 +134,7 @@ output (code_int code) cur_bits += n_bits; while (cur_bits >= 8) { - char_out((int) (cur_accum & 0xFF)); + char_out((char) (cur_accum & 0xFF)); cur_accum >>= 8; cur_bits -= 8; } @@ -225,7 +226,7 @@ compress_byte (int c) i -= HSIZE; if (hash_code[i] != 0) { /* is first probed slot empty? */ - if (hash_prefix[i] == waiting_code && hash_suffix[i] == c) { + if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c) { waiting_code = hash_code[i]; return; } @@ -239,7 +240,7 @@ compress_byte (int c) i += HSIZE; if (hash_code[i] == 0) break; /* hit empty slot */ - if (hash_prefix[i] == waiting_code && hash_suffix[i] == c) { + if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c) { waiting_code = hash_code[i]; return; } @@ -251,7 +252,7 @@ compress_byte (int c) if (free_code < LZW_TABLE_SIZE) { hash_code[i] = free_code++; /* add symbol to hashtable */ hash_prefix[i] = waiting_code; - hash_suffix[i] = c; + hash_suffix[i] = (UINT8) c; } else clear_block(); waiting_code = c; @@ -269,7 +270,7 @@ compress_term (void) output(EOFCode); /* Flush the bit-packing buffer */ if (cur_bits > 0) { - char_out((int) (cur_accum & 0xFF)); + char_out((char) (cur_accum & 0xFF)); } /* Flush the packet buffer */ flush_packet(); @@ -334,7 +335,7 @@ emit_header (int num_colors, JSAMPARRAY colormap) * Write the GIF header. * Note that we generate a plain GIF87 header for maximum compatibility. */ - fwrite("GIF87a", 1, 6, dcinfo->output_file); + (void) FWRITE(dcinfo->output_file, "GIF87a", 6); /* Write the Logical Screen Descriptor */ put_word((UINT16) dcinfo->image_width); put_word((UINT16) dcinfo->image_height); diff --git a/jwrjfif.c b/jwrjfif.c index cc379ac6..28813554 100644 --- a/jwrjfif.c +++ b/jwrjfif.c @@ -36,7 +36,8 @@ /* Write some bytes from a (char *) buffer */ #define WRITE_BYTES(cinfo,dataptr,datacount) \ - { if (fwrite((dataptr), 1, (datacount), cinfo->output_file) != (datacount)) \ + { if (FWRITE(cinfo->output_file, dataptr, datacount) \ + != (size_t) (datacount)) \ ERREXIT(cinfo->emethods, "Output file write error"); } /* Clean up and verify successful output */ @@ -247,6 +248,9 @@ emit_sof (compress_info_ptr cinfo, JPEG_MARKER code) emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ + if (cinfo->image_height > 65535L || cinfo->image_width > 65535L) + ERREXIT(cinfo->emethods, "Maximum image dimension for JFIF is 65535 pixels"); + emit_byte(cinfo, cinfo->data_precision); emit_2bytes(cinfo, (int) cinfo->image_height); emit_2bytes(cinfo, (int) cinfo->image_width); diff --git a/jwrppm.c b/jwrppm.c index 41687fec..7a5255c4 100644 --- a/jwrppm.c +++ b/jwrppm.c @@ -21,6 +21,16 @@ #ifdef PPM_SUPPORTED +/* + * Haven't yet got around to making this work with text-format output, + * hence cannot handle pixels wider than 8 bits. + */ + +#ifndef EIGHT_BIT_SAMPLES + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + + static JSAMPARRAY color_map; /* saves color map passed by quantizer */ diff --git a/jwrrle.c b/jwrrle.c new file mode 100644 index 00000000..f324758f --- /dev/null +++ b/jwrrle.c @@ -0,0 +1,231 @@ +/* + * jwrrle.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to write output images in RLE format. + * The Utah Raster Toolkit library is required (version 3.0). + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * These routines are invoked via the methods put_pixel_rows, put_color_map, + * and output_init/term. + * + * Based on code contributed by Mike Lijewski. + */ + +#include "jinclude.h" + +#ifdef RLE_SUPPORTED + +/* rle.h is provided by the Utah Raster Toolkit. */ + +#include + + +/* + * output_term assumes that JSAMPLE has the same representation as rle_pixel, + * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples. + */ + +#ifndef EIGHT_BIT_SAMPLES + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + + +/* + * Since RLE stores scanlines bottom-to-top, we have to invert the image + * from JPEG's top-to-bottom order. To do this, we save the outgoing data + * in virtual array(s) during put_pixel_row calls, then actually emit the + * RLE file during output_term. We use one virtual array if the output is + * grayscale or colormapped, more if it is full color. + */ + +#define MAX_CHANS 4 /* allow up to four color components */ +static big_sarray_ptr channels[MAX_CHANS]; /* Virtual arrays for saved data */ + +static long cur_output_row; /* next row# to write to virtual array(s) */ + + +/* + * For now, if we emit an RLE color map then it is always 256 entries long, + * though not all of the entries need be used. + */ + +#define CMAPBITS 8 +#define CMAPLENGTH (1<<(CMAPBITS)) + +static rle_map *output_colormap; /* RLE-style color map, or NULL if none */ +static int number_colors; /* Number of colors actually used */ + + +/* + * Write the file header. + * + * In this module it's easier to wait till output_term to actually write + * anything; here we just request the big arrays we'll need. + */ + +METHODDEF void +output_init (decompress_info_ptr cinfo) +{ + short ci; + + if (cinfo->final_out_comps > MAX_CHANS) + ERREXIT1(cinfo->emethods, "Cannot handle %d output channels for RLE", + cinfo->final_out_comps); + + for (ci = 0; ci < cinfo->final_out_comps; ci++) { + channels[ci] = (*cinfo->emethods->request_big_sarray) + (cinfo->image_width, cinfo->image_height, 1L); + } + + output_colormap = NULL; /* No output colormap as yet */ + number_colors = 0; + cur_output_row = 0; /* Start filling virtual arrays at row 0 */ +} + + +/* + * Write some pixel data. + * + * This routine just saves the data away in virtual arrays. + */ + +METHODDEF void +put_pixel_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + JSAMPROW outputrow[1]; /* a pseudo JSAMPARRAY structure */ + int row; + short ci; + + for (row = 0; row < num_rows; row++) { + for (ci = 0; ci < cinfo->final_out_comps; ci++) { + outputrow[0] = *((*cinfo->emethods->access_big_sarray) + (channels[ci], cur_output_row, TRUE)); + jcopy_sample_rows(pixel_data[ci], row, outputrow, 0, + 1, cinfo->image_width); + } + cur_output_row++; + } +} + + +/* + * Write the color map. + * + * For RLE output we just save the colormap for the output stage. + */ + +METHODDEF void +put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) +{ + size_t cmapsize; + short ci; + int i; + + if (num_colors > CMAPLENGTH) + ERREXIT1(cinfo->emethods, "Cannot handle %d colormap entries for RLE", + num_colors); + + /* Allocate storage for RLE-style cmap, zero any extra entries */ + cmapsize = cinfo->color_out_comps * CMAPLENGTH * SIZEOF(rle_map); + output_colormap = (rle_map *) (*cinfo->emethods->alloc_small) (cmapsize); + MEMZERO((void *) output_colormap, cmapsize); + + /* Save away data in RLE format --- note 8-bit left shift! */ + /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */ + for (ci = 0; ci < cinfo->color_out_comps; ci++) { + for (i = 0; i < num_colors; i++) { + output_colormap[ci * CMAPLENGTH + i] = GETJSAMPLE(colormap[ci][i]) << 8; + } + } + number_colors = num_colors; +} + + +/* + * Finish up at the end of the file. + * + * Here is where we really output the RLE file. + */ + +METHODDEF void +output_term (decompress_info_ptr cinfo) +{ + rle_hdr header; /* Output file information */ + rle_pixel *output_rows[MAX_CHANS]; + char cmapcomment[80]; + short ci; + long row; + + /* Initialize the header info */ + MEMZERO((void *) &header, SIZEOF(rle_hdr)); /* make sure all bits are 0 */ + header.rle_file = cinfo->output_file; + header.xmin = 0; + header.xmax = cinfo->image_width - 1; + header.ymin = 0; + header.ymax = cinfo->image_height - 1; + header.alpha = 0; + header.ncolors = cinfo->final_out_comps; + for (ci = 0; ci < cinfo->final_out_comps; ci++) { + RLE_SET_BIT(header, ci); + } + if (number_colors > 0) { + header.ncmap = cinfo->color_out_comps; + header.cmaplen = CMAPBITS; + header.cmap = output_colormap; + /* Add a comment to the output image with the true colormap length. */ + sprintf(cmapcomment, "color_map_length=%d", number_colors); + rle_putcom(cmapcomment, &header); + } + /* Emit the RLE header and color map (if any) */ + rle_put_setup(&header); + + /* Now output the RLE data from our virtual array(s). + * We assume here that (a) rle_pixel is represented the same as JSAMPLE, + * and (b) we are not on a machine where FAR pointers differ from regular. + */ + for (row = cinfo->image_height-1; row >= 0; row--) { + for (ci = 0; ci < cinfo->final_out_comps; ci++) { + output_rows[ci] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) + (channels[ci], row, FALSE)); + } + rle_putrow(output_rows, (int) cinfo->image_width, &header); + } + + /* Emit file trailer */ + rle_puteof(&header); + fflush(cinfo->output_file); + if (ferror(cinfo->output_file)) + ERREXIT(cinfo->emethods, "Output file write error"); + + /* Release memory */ + for (ci = 0; ci < cinfo->final_out_comps; ci++) { + (*cinfo->emethods->free_big_sarray) (channels[ci]); + } + if (output_colormap != NULL) + (*cinfo->emethods->free_small) ((void *) output_colormap); +} + + +/* + * The method selection routine for RLE format output. + * This should be called from d_ui_method_selection if RLE output is wanted. + */ + +GLOBAL void +jselwrle (decompress_info_ptr cinfo) +{ + cinfo->methods->output_init = output_init; + cinfo->methods->put_color_map = put_color_map; + cinfo->methods->put_pixel_rows = put_pixel_rows; + cinfo->methods->output_term = output_term; +} + +#endif /* RLE_SUPPORTED */ diff --git a/jwrtarga.c b/jwrtarga.c new file mode 100644 index 00000000..72259e77 --- /dev/null +++ b/jwrtarga.c @@ -0,0 +1,223 @@ +/* + * jwrtarga.c + * + * Copyright (C) 1991, 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. + * + * This file contains routines to write output images in Targa format. + * + * These routines may need modification for non-Unix environments or + * specialized applications. As they stand, they assume output to + * an ordinary stdio stream. + * + * These routines are invoked via the methods put_pixel_rows, put_color_map, + * and output_init/term. + * + * Based on code contributed by Lee Daniel Crocker. + */ + +#include "jinclude.h" + +#ifdef TARGA_SUPPORTED + + +/* + * To support 12-bit JPEG data, we'd have to scale output down to 8 bits. + * This is not yet implemented. + */ + +#ifndef EIGHT_BIT_SAMPLES + Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ +#endif + + +static JSAMPARRAY color_map; /* saves color map passed by quantizer */ + + +LOCAL void +write_header (decompress_info_ptr cinfo, int num_colors) +/* Create and write a Targa header */ +{ + char targaheader[18]; + + /* Set unused fields of header to 0 */ + MEMZERO((void *) targaheader, SIZEOF(targaheader)); + + if (num_colors > 0) { + targaheader[1] = 1; /* color map type 1 */ + targaheader[5] = (char) (num_colors & 0xFF); + targaheader[6] = (char) (num_colors >> 8); + targaheader[7] = 24; /* 24 bits per cmap entry */ + } + + targaheader[12] = (char) (cinfo->image_width & 0xFF); + targaheader[13] = (char) (cinfo->image_width >> 8); + targaheader[14] = (char) (cinfo->image_height & 0xFF); + targaheader[15] = (char) (cinfo->image_height >> 8); + targaheader[17] = 0x20; /* Top-down, non-interlaced */ + + if (cinfo->out_color_space == CS_GRAYSCALE) { + targaheader[2] = 3; /* image type = uncompressed gray-scale */ + targaheader[16] = 8; /* bits per pixel */ + } else { /* must be RGB */ + if (num_colors > 0) { + targaheader[2] = 1; /* image type = colormapped RGB */ + targaheader[16] = 8; + } else { + targaheader[2] = 2; /* image type = uncompressed RGB */ + targaheader[16] = 24; + } + } + + if (FWRITE(cinfo->output_file, targaheader, 18) != (size_t) 18) + ERREXIT(cinfo->emethods, "Could not write Targa header"); +} + + +/* + * Write the file header. + */ + +METHODDEF void +output_init (decompress_info_ptr cinfo) +{ + if (cinfo->out_color_space == CS_GRAYSCALE) { + /* Targa doesn't have a mapped grayscale format, so we will */ + /* demap quantized gray output. Never emit a colormap. */ + write_header(cinfo, 0); + } else if (cinfo->out_color_space == CS_RGB) { + /* For quantized output, defer writing header until put_color_map time. */ + if (! cinfo->quantize_colors) + write_header(cinfo, 0); + } else { + ERREXIT(cinfo->emethods, "Targa output must be grayscale or RGB"); + } +} + + +/* + * Write some pixel data. + */ + +METHODDEF void +put_pixel_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + register FILE * outfile = cinfo->output_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + register long width = cinfo->image_width; + register int row; + + if (cinfo->final_out_comps == 1) { + /* here for grayscale or quantized color output */ + for (row = 0; row < num_rows; row++) { + ptr0 = pixel_data[0][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(*ptr0), outfile); + ptr0++; + } + } + } else { + /* here for unquantized color output */ + for (row = 0; row < num_rows; row++) { + ptr0 = pixel_data[0][row]; + ptr1 = pixel_data[1][row]; + ptr2 = pixel_data[2][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(*ptr2), outfile); /* write in BGR order */ + ptr2++; + putc(GETJSAMPLE(*ptr1), outfile); + ptr1++; + putc(GETJSAMPLE(*ptr0), outfile); + ptr0++; + } + } + } +} + + +/* + * Write some demapped pixel data when color quantization is in effect. + * For Targa, this is only applied to grayscale data. + */ + +METHODDEF void +put_demapped_rows (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE pixel_data) +{ + register FILE * outfile = cinfo->output_file; + register JSAMPROW ptr; + register long col; + register long width = cinfo->image_width; + register int row; + + for (row = 0; row < num_rows; row++) { + ptr = pixel_data[0][row]; + for (col = width; col > 0; col--) { + putc(GETJSAMPLE(color_map[0][GETJSAMPLE(*ptr)]), outfile); + ptr++; + } + } +} + + +/* + * Write the color map. + */ + +METHODDEF void +put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) +{ + register FILE * outfile = cinfo->output_file; + int i; + + if (cinfo->out_color_space == CS_RGB) { + /* We only support 8-bit colormap indexes, so only 256 colors */ + if (num_colors > 256) + ERREXIT(cinfo->emethods, "Too many colors for Targa output"); + /* Time to write the header */ + write_header(cinfo, num_colors); + /* Write the colormap. Note Targa uses BGR byte order */ + for (i = 0; i < num_colors; i++) { + putc(GETJSAMPLE(colormap[2][i]), outfile); + putc(GETJSAMPLE(colormap[1][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + } + } else { + color_map = colormap; /* save for use in output */ + cinfo->methods->put_pixel_rows = put_demapped_rows; + } +} + + +/* + * Finish up at the end of the file. + */ + +METHODDEF void +output_term (decompress_info_ptr cinfo) +{ + /* No work except to make sure we wrote the output file OK */ + fflush(cinfo->output_file); + if (ferror(cinfo->output_file)) + ERREXIT(cinfo->emethods, "Output file write error"); +} + + +/* + * The method selection routine for Targa format output. + * This should be called from d_ui_method_selection if Targa output is wanted. + */ + +GLOBAL void +jselwtarga (decompress_info_ptr cinfo) +{ + cinfo->methods->output_init = output_init; + cinfo->methods->put_color_map = put_color_map; + cinfo->methods->put_pixel_rows = put_pixel_rows; + cinfo->methods->output_term = output_term; +} + +#endif /* TARGA_SUPPORTED */ diff --git a/makcjpeg.cf b/makcjpeg.cf index ea93ce4b..7c9d736d 100644 --- a/makcjpeg.cf +++ b/makcjpeg.cf @@ -1,5 +1,6 @@ -L jcmain.mix jerror.mix jcdeflts.mix jrdgif.mix jrdppm.mix jwrjfif.mix -L jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmaster.mix jcmcu.mix -L jcpipe.mix jcsample.mix jfwddct.mix jutils.mix jvirtmem.mix +L jcmain.mix jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix +L jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix +L jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix jutils.mix jvirtmem.mix +L jerror.mix fa; b cjpeg,8K,48K, diff --git a/makcjpeg.lnk b/makcjpeg.lnk index 23702b22..258f644b 100644 --- a/makcjpeg.lnk +++ b/makcjpeg.lnk @@ -1,20 +1,22 @@ jcmain.obj + -jerror.obj + +jcmaster.obj + jcdeflts.obj + -jrdgif.obj + -jrdppm.obj + -jwrjfif.obj + jcarith.obj + jccolor.obj + jcexpand.obj + jchuff.obj + -jcmaster.obj + jcmcu.obj + jcpipe.obj + jcsample.obj + jfwddct.obj + +jwrjfif.obj + +jrdgif.obj + +jrdppm.obj + +jrdrle.obj + +jrdtarga.obj + jutils.obj + -jvirtmem.obj +jvirtmem.obj + +jerror.obj cjpeg.exe /NOI nul.map diff --git a/makcjpeg.lst b/makcjpeg.lst new file mode 100644 index 00000000..aa758b36 --- /dev/null +++ b/makcjpeg.lst @@ -0,0 +1,4 @@ +jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj +jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj jwrjfif.obj +jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj jutils.obj jvirtmem.obj +jerror.obj diff --git a/makdjpeg.cf b/makdjpeg.cf index 968af311..ea02876b 100644 --- a/makdjpeg.cf +++ b/makdjpeg.cf @@ -1,6 +1,6 @@ -L jdmain.mix jerror.mix jrdjfif.mix jwrgif.mix jwrppm.mix -L jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmaster.mix jdmcu.mix -L jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jutils.mix -L jvirtmem.mix +L jdmain.mix jdmaster.mix jddeflts.mix jbsmooth.mix jdarith.mix jdcolor.mix +L jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix +L jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jwrrle.mix jwrtarga.mix +L jutils.mix jvirtmem.mix jerror.mix fa; b djpeg,8K,48K, diff --git a/makdjpeg.lnk b/makdjpeg.lnk index 6e9107cf..7f909db0 100644 --- a/makdjpeg.lnk +++ b/makdjpeg.lnk @@ -1,22 +1,25 @@ jdmain.obj + -jerror.obj + -jrdjfif.obj + -jwrgif.obj + -jwrppm.obj + +jdmaster.obj + +jddeflts.obj + jbsmooth.obj + jdarith.obj + jdcolor.obj + jdhuff.obj + -jdmaster.obj + jdmcu.obj + jdpipe.obj + jdsample.obj + jquant1.obj + jquant2.obj + jrevdct.obj + +jrdjfif.obj + +jwrgif.obj + +jwrppm.obj + +jwrrle.obj + +jwrtarga.obj + jutils.obj + -jvirtmem.obj /NOI -djpeg.exe +jvirtmem.obj + +jerror.obj +djpeg.exe /NOI nul.map nul.def diff --git a/makdjpeg.lst b/makdjpeg.lst new file mode 100644 index 00000000..9c9e7249 --- /dev/null +++ b/makdjpeg.lst @@ -0,0 +1,4 @@ +jdmain.obj jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj +jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj +jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj +jutils.obj jvirtmem.obj jerror.obj diff --git a/makefile.amiga b/makefile.amiga deleted file mode 100644 index 2fde93ab..00000000 --- a/makefile.amiga +++ /dev/null @@ -1,143 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is suitable for Amiga systems using Manx Aztec C ver 5.x. -# Thanks to D.J. James for this version. - -# See README and edit jconfig.h before saying "make" !! - -CC= cc - -# You may need to adjust these cc options: -CFLAGS= -MC -MD -DTWO_FILE_COMMANDLINE -LDFLAGS= -LDLIBS= -lml -lcl - -# miscellaneous OS-dependent stuff -LN= ln # linker -RM= delete quiet # file deletion command -AR= lb # library (.lib) file creation command - - -# source files -INCLUDES= jinclude.h jconfig.h jpegdata.h -SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c \ - jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c \ - jdarith.c jdcolor.c jdhuff.c jdmain.c jdmaster.c jdmcu.c \ - jdpipe.c jdsample.c jerror.c jfwddct.c jquant1.c jquant2.c \ - jrdjfif.c jrdgif.c jrdppm.c jrevdct.c jutils.c jvirtmem.c \ - jwrjfif.c jwrgif.c jwrppm.c egetopt.c -DOCS= README architecture codingrules -MAKEFILES= makefile.unix makefile.amiga \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk \ - makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) ansi2knr.c $(SOURCES) $(INCLUDES) $(TESTFILES) - -# compression objectfiles -COBJECTS = jcmain.o jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ - jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ - jrdgif.o jrdppm.o jwrjfif.o \ - jutils.o jvirtmem.o jerror.o -# decompression objectfiles -DOBJECTS = jdmain.o jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ - jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ - jrdjfif.o jwrgif.o jwrppm.o \ - jutils.o jvirtmem.o jerror.o -# These objectfiles are included in libjpeg.lib (all but jcmain.o, jdmain.o) -LIBOBJECTS = jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o \ - jchuff.o jcmcu.o jcpipe.o jcsample.o jfwddct.o \ - jrdgif.o jrdppm.o jwrjfif.o \ - jdmaster.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ - jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o \ - jrdjfif.o jwrgif.o jwrppm.o \ - jutils.o jvirtmem.o jerror.o - - -all: cjpeg djpeg -# By default, libjpeg.lib is not built unless you explicitly request it. - - -# If you have a C compiler that doesn't understand function prototypes, -# uncomment the 5 lines below and make sure PROTO is not defined by jconfig.h. -# Then say "make ansi2knr" before "make". - -#.c.o: -# ./ansi2knr $*.c tmpansi.c -# $(CC) $(CFLAGS) -c tmpansi.c -# mv tmpansi.o $*.o -# $(RM) tmpansi.c - -ansi2knr: ansi2knr.c - $(CC) -o ansi2knr ansi2knr.c -# You may need to add one of -DBSD, -DVMS, or -DMSDOS to the line above. - - -cjpeg: $(COBJECTS) - $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) $(LDLIBS) - -djpeg: $(DOBJECTS) - $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) $(LDLIBS) - -# libjpeg.lib is useful if you are including the JPEG software in a larger -# program; you'd include it in your link, rather than the individual modules. -libjpeg.lib: $(LIBOBJECTS) - -$(RM) libjpeg.lib - $(AR) libjpeg.lib $(LIBOBJECTS) - -# Use the following to test the built library -#cjpeg: jcmain.o libjpeg.lib -# $(LN) $(LDFLAGS) -o cjpeg jcmain.o -llibjpeg $(LDLIBS) -# -#djpeg: jdmain.o libjpeg.lib -# $(LN) $(LDFLAGS) -o djpeg jdmain.o -llibjpeg $(LDLIBS) - -clean: - -$(RM) *.o cjpeg djpeg libjpeg.lib ansi2knr core tmpansi.* testout.ppm testout.jpg - -distribute: - -$(RM) jpegsrc.tar* - tar cvf jpegsrc.tar $(DISTFILES) - list jpegsrc.tar - compress -v jpegsrc.tar - list jpegsrc.tar* - -test: cjpeg djpeg - -$(RM) testout.ppm testout.jpg - ./djpeg testorig.jpg testout.ppm - ./cjpeg testimg.ppm testout.jpg - cmp testimg.ppm testout.ppm - cmp testimg.jpg testout.jpg - - -jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h -jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h -jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h -jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h -jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h -jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h -jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h -jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h -jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h -jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h -jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h -jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h -jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h -jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h -jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h -jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h -jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h -jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h -jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h -jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h -jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h -jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h -jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h -jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h -jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h -jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h -jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h -jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h -jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.ansi b/makefile.ansi new file mode 100644 index 00000000..4b99f083 --- /dev/null +++ b/makefile.ansi @@ -0,0 +1,140 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is suitable for Unix-like systems with ANSI-capable compilers. +# If you have a non-ANSI compiler, makefile.unix is a better starting point. + +# Read SETUP instructions before saying "make" !! + +# The name of your C compiler: +CC= cc + +# You may need to adjust these cc options: +CFLAGS= -O +# In particular: +# Add -DBSD if on a pure BSD system (see jinclude.h). +# Add -DMEM_STATS to enable gathering of memory usage statistics. +# You may also want to add -DTWO_FILE_COMMANDLINE or -D switches for other +# symbols listed in jconfig.h, if you prefer not to change jconfig.h. + +# Link-time cc options: +LDFLAGS= + +# To link any special libraries, add the necessary -l commands here. +# In particular, on some versions of HP-UX (and probably other SysV-derived +# systems) there is a faster alternate malloc(3) library that you can use +# by adding "-lmalloc" to this line. +LDLIBS= + +# miscellaneous OS-dependent stuff +LN= $(CC) # linker +RM= rm -f # file deletion command +AR= ar rc # library (.a) file creation command +AR2= ranlib # second step in .a creation (use "touch" if not needed) + + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ + jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ + jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ + $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.o jvirtmem.o jerror.o +# compression objectfiles +CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ + jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ + jrdrle.o jrdtarga.o +COBJECTS= jcmain.o $(CLIBOBJECTS) $(COMOBJECTS) +# decompression objectfiles +DLIBOBJECTS= jdmaster.o jddeflts.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o jrdjfif.o \ + jwrgif.o jwrppm.o jwrrle.o jwrtarga.o +DOBJECTS= jdmain.o $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.a +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) + + +all: cjpeg djpeg +# By default, libjpeg.a is not built unless you explicitly request it. +# You can add libjpeg.a to the line above if you want it built by default. + + +cjpeg: $(COBJECTS) + $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) $(LDLIBS) + +djpeg: $(DOBJECTS) + $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) $(LDLIBS) + +# libjpeg.a is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.a: $(LIBOBJECTS) + $(RM) libjpeg.a + $(AR) libjpeg.a $(LIBOBJECTS) + $(AR2) libjpeg.a + +clean: + $(RM) *.o cjpeg djpeg libjpeg.a core testout.ppm testout.jpg + +distribute: + $(RM) jpegsrc.tar* + tar cvf jpegsrc.tar $(DISTFILES) + compress -v jpegsrc.tar + +test: cjpeg djpeg + $(RM) testout.ppm testout.jpg + ./djpeg testorig.jpg >testout.ppm + ./cjpeg testimg.ppm >testout.jpg + cmp testimg.ppm testout.ppm + cmp testimg.jpg testout.jpg + + +jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.o : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.o : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.o : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.manx b/makefile.manx new file mode 100644 index 00000000..bb89926e --- /dev/null +++ b/makefile.manx @@ -0,0 +1,133 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for Amiga systems using Manx Aztec C ver 5.x. +# Thanks to D.J. James for this version. + +# Read SETUP instructions before saying "make" !! + +# The name of your C compiler: +CC= cc + +# You may need to adjust these cc options: +CFLAGS= -MC -MD -DTWO_FILE_COMMANDLINE + +# Link-time cc options: +LDFLAGS= + +# To link any special libraries, add the necessary -l commands here. +LDLIBS= -lml -lcl + +# miscellaneous OS-dependent stuff +# linker +LN= ln +# file deletion command +RM= delete quiet +# library (.lib) file creation command +AR= lb + + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ + jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ + jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ + $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.o jvirtmem.o jerror.o +# compression objectfiles +CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ + jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ + jrdrle.o jrdtarga.o +COBJECTS= jcmain.o $(CLIBOBJECTS) $(COMOBJECTS) +# decompression objectfiles +DLIBOBJECTS= jdmaster.o jddeflts.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o jrdjfif.o \ + jwrgif.o jwrppm.o jwrrle.o jwrtarga.o +DOBJECTS= jdmain.o $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.lib +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) + + +all: cjpeg djpeg +# By default, libjpeg.lib is not built unless you explicitly request it. +# You can add libjpeg.lib to the line above if you want it built by default. + + +cjpeg: $(COBJECTS) + $(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) $(LDLIBS) + +djpeg: $(DOBJECTS) + $(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) $(LDLIBS) + +# libjpeg.lib is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.lib: $(LIBOBJECTS) + -$(RM) libjpeg.lib + $(AR) libjpeg.lib $(LIBOBJECTS) + +clean: + -$(RM) *.o cjpeg djpeg libjpeg.lib core testout.ppm testout.jpg + +distribute: + -$(RM) jpegsrc.tar* + tar cvf jpegsrc.tar $(DISTFILES) + compress -v jpegsrc.tar + +test: cjpeg djpeg + -$(RM) testout.ppm testout.jpg + djpeg testorig.jpg testout.ppm + cjpeg testimg.ppm testout.jpg + cmp testimg.ppm testout.ppm + cmp testimg.jpg testout.jpg + + +jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.o : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.o : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.o : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.mc5 b/makefile.mc5 index eee9f217..31a6a9b4 100644 --- a/makefile.mc5 +++ b/makefile.mc5 @@ -2,7 +2,7 @@ # This makefile is for Microsoft C for MS-DOS, version 5.x. -# See README and edit jconfig.h before saying "make" !! +# Read SETUP instructions before saying "make" !! # Microsoft's brain-damaged version of make uses nonstandard syntax (a blank # line is needed to terminate a command list) and it simply scans the rules @@ -13,23 +13,48 @@ # from the library. The objectfiles are also kept separately as timestamps. # You may need to adjust these cc options: -CFLAGS= /AS /I. /W3 /Oail /Gs /DMEM_STATS # NB: /Gs turns off stack oflo checks -LDFLAGS= /Fm /F 2000 # /F hhhh sets stack size (in hex) +CFLAGS= /AS /I. /W3 /Oail /Gs # NB: /Gs turns off stack oflo checks +LDFLAGS= /Fm /F 2000 # /F hhhh sets stack size (in hex) # In particular: # Add /DMSDOS if your compiler doesn't automatically #define MSDOS. -# Add /DHAVE_GETOPT if your library includes getopt(3) (see jcmain.c, jdmain.c). -# /DMEM_STATS is optional -- it enables gathering of memory usage statistics. +# Add /DMEM_STATS to enable gathering of memory usage statistics. +# You might also want to add /G2 if you have an 80286, etc. + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ + jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ + jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ + $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.obj jvirtmem.obj jerror.obj # compression objectfiles -COBJECTS = jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ - jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ - jrdgif.obj jrdppm.obj jwrjfif.obj \ - jutils.obj jvirtmem.obj jerror.obj +CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj +COBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS) # decompression objectfiles -DOBJECTS = jdmain.obj jdmaster.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.obj \ - jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj jrevdct.obj \ - jrdjfif.obj jwrgif.obj jwrppm.obj \ - jutils.obj jvirtmem.obj jerror.obj +DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \ + jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \ + jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \ + jwrrle.obj jwrtarga.obj +DOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.lib +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) # inference rule used for all compilations except jcmain.c, jdmain.c @@ -38,74 +63,83 @@ DOBJECTS = jdmain.obj jdmaster.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.o cl $(CFLAGS) /c $*.c lib libjpeg -+$*.obj; -# these two objectfiles are not inserted into libjpeg -# because they have duplicate global symbol names (notably main()). -jcmain.obj: jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c + +jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h + +jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h + +jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h + +jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h + +jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h + +jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h + +jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c cl $(CFLAGS) /c $*.c -jdmain.obj: jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c +jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h + +jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h + +jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h + +jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h + +jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h + +jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h + +jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h + +jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h + +jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c cl $(CFLAGS) /c $*.c +jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h -jbsmooth.obj: jbsmooth.c jinclude.h jconfig.h jpegdata.h +jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h -jcarith.obj: jcarith.c jinclude.h jconfig.h jpegdata.h +jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h -jccolor.obj: jccolor.c jinclude.h jconfig.h jpegdata.h +jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h -jcdeflts.obj: jcdeflts.c jinclude.h jconfig.h jpegdata.h +jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h -jcexpand.obj: jcexpand.c jinclude.h jconfig.h jpegdata.h +jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h -jchuff.obj: jchuff.c jinclude.h jconfig.h jpegdata.h +jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h -jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpegdata.h +jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h -jcmcu.obj: jcmcu.c jinclude.h jconfig.h jpegdata.h +jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h -jcpipe.obj: jcpipe.c jinclude.h jconfig.h jpegdata.h +jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h -jcsample.obj: jcsample.c jinclude.h jconfig.h jpegdata.h +jvirtmem.obj : jvirtmem.c jinclude.h jconfig.h jpegdata.h -jdarith.obj: jdarith.c jinclude.h jconfig.h jpegdata.h +jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h -jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpegdata.h +jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h -jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpegdata.h +jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h -jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpegdata.h +jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h -jdmcu.obj: jdmcu.c jinclude.h jconfig.h jpegdata.h +jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h -jdpipe.obj: jdpipe.c jinclude.h jconfig.h jpegdata.h +jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h -jdsample.obj: jdsample.c jinclude.h jconfig.h jpegdata.h +jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h -jerror.obj: jerror.c jinclude.h jconfig.h jpegdata.h +jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h -jfwddct.obj: jfwddct.c jinclude.h jconfig.h jpegdata.h +jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h -jquant1.obj: jquant1.c jinclude.h jconfig.h jpegdata.h +jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h -jquant2.obj: jquant2.c jinclude.h jconfig.h jpegdata.h - -jrdjfif.obj: jrdjfif.c jinclude.h jconfig.h jpegdata.h - -jrdgif.obj: jrdgif.c jinclude.h jconfig.h jpegdata.h - -jrdppm.obj: jrdppm.c jinclude.h jconfig.h jpegdata.h - -jrevdct.obj: jrevdct.c jinclude.h jconfig.h jpegdata.h - -jutils.obj: jutils.c jinclude.h jconfig.h jpegdata.h - -jvirtmem.obj: jvirtmem.c jinclude.h jconfig.h jpegdata.h - -jwrjfif.obj: jwrjfif.c jinclude.h jconfig.h jpegdata.h - -jwrgif.obj: jwrgif.c jinclude.h jconfig.h jpegdata.h - -jwrppm.obj: jwrppm.c jinclude.h jconfig.h jpegdata.h cjpeg.exe: $(COBJECTS) diff --git a/makefile.mc6 b/makefile.mc6 index b9ca60f4..8007209c 100644 --- a/makefile.mc6 +++ b/makefile.mc6 @@ -3,71 +3,100 @@ # This makefile is for Microsoft C for MS-DOS, version 6.x (use NMAKE). # Thanks to Alan Wright and Chris Turner of Olivetti Research Ltd. -# See README and edit jconfig.h before saying "make" !! - -all: cjpeg.exe djpeg.exe +# Read SETUP instructions before saying "make" !! # compiler flags. -D gives a #define to the sources: # -O default optimisation # -W3 warning level 3 # -Za ANSI conformance, defines__STDC__ but undefines far -# and near! +# and near, so we DON'T use it. # -D__STDC__ pretend we have full ANSI compliance. MSC is near # enough anyway # -DMSDOS we are on an MSDOS machine # -DMEM_STATS enable memory usage statistics (optional) -# -DHAVE_GETOPT library has getopt routine to parse cmnd line options # -c compile, don't link (implicit in inference rules) +# You might also want to add -G2 if you have an 80286, etc. -CFLAGS = -c -O -W3 -DMSDOS -D__STDC__ -DMEM_STATS +CFLAGS = -c -O -W3 -D__STDC__ -DMSDOS +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ + jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ + jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ + $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.obj jvirtmem.obj jerror.obj # compression objectfiles -COBJECTS = jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ - jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ - jrdgif.obj jrdppm.obj jwrjfif.obj \ - jutils.obj jvirtmem.obj jerror.obj +CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj +COBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS) # decompression objectfiles -DOBJECTS = jdmain.obj jdmaster.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.obj \ - jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj jrevdct.obj \ - jrdjfif.obj jwrgif.obj jwrppm.obj \ - jutils.obj jvirtmem.obj jerror.obj +DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \ + jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \ + jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \ + jwrrle.obj jwrtarga.obj +DOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.lib +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) +all: cjpeg.exe djpeg.exe + # default rules in nmake will use cflags and compile the list below -jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h -jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h -jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h -jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h -jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h -jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h -jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h -jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h -jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h -jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h -jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h -jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h -jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h -jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h -jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h -jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h -jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h -jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h -jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h -jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h -jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h -jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h -jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h -jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h -jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h -jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h -jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h -jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h -jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h +jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.obj : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h # use linker response files because file list > 128 chars diff --git a/makefile.pwc b/makefile.pwc index f41dd480..f89e8409 100644 --- a/makefile.pwc +++ b/makefile.pwc @@ -4,22 +4,19 @@ # and Dan Grayson's pd make 2.14 under MS-DOS. # Thanks to Bob Hardy for this version. -# See README and edit jconfig.h before saying "make" !! - -# NOTE: make sure you have converted end-of-line markers to CR/LF in this file -# and in the three mak*.cf files; otherwise pd make and the Mix linker will -# choke. Power C doesn't seem to care whether end-of-lines are CR/LF or just -# LF in the *.h and *.c files. If you blindly converted LF to CR/LF in ALL -# the files, then you broke the test*.* files, which contain binary data. +# Read SETUP instructions before saying "make" !! +# The name of your C compiler: CC=pc # You may need to adjust these cc options: MODEL=m -CFLAGS=-dMEM_STATS -dMSDOS -m$(MODEL) -LDFLAGS= +CFLAGS= -dMSDOS -m$(MODEL) # In particular: -# -dMEM_STATS is optional -- it enables gathering of memory usage statistics. +# Add -dMEM_STATS to enable gathering of memory usage statistics. + +# Link-time cc options: +LDFLAGS= LDLIBS= # miscellaneous OS-dependent stuff @@ -31,16 +28,31 @@ RM=del AR=merge +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.mix jvirtmem.mix jerror.mix # compression objectfiles -COBJECTS = jcmain.mix jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jrdgif.mix jrdppm.mix jwrjfif.mix jutils.mix jvirtmem.mix jerror.mix +CLIBOBJECTS= jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix +COBJECTS= jcmain.mix $(CLIBOBJECTS) $(COMOBJECTS) # decompression objectfiles -DOBJECTS = jdmain.mix jdmaster.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jutils.mix jvirtmem.mix jerror.mix -# These objectfiles are included in libjpeg.mix (all but jcmain, jdmain) -LIBOBJECTS = jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jrdgif.mix jrdppm.mix jwrjfif.mix jdmaster.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jutils.mix jvirtmem.mix jerror.mix +DLIBOBJECTS= jdmaster.mix jddeflts.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jwrrle.mix jwrtarga.mix +DOBJECTS= jdmain.mix $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.mix +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) -all: cjpeg.exe djpeg.exe test +all: cjpeg.exe djpeg.exe # By default, libjpeg.mix is not built unless you explicitly request it. +# You can add libjpeg.mix to the line above if you want it built by default. cjpeg.exe: $(COBJECTS) @@ -66,35 +78,40 @@ test: fc testimg.jpg testout.jpg -jbsmooth.mix : jbsmooth.c jinclude.h jconfig.h jpegdata.h -jcarith.mix : jcarith.c jinclude.h jconfig.h jpegdata.h -jccolor.mix : jccolor.c jinclude.h jconfig.h jpegdata.h -jcdeflts.mix : jcdeflts.c jinclude.h jconfig.h jpegdata.h -jcexpand.mix : jcexpand.c jinclude.h jconfig.h jpegdata.h -jchuff.mix : jchuff.c jinclude.h jconfig.h jpegdata.h -jcmain.mix : jcmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jcmaster.mix : jcmaster.c jinclude.h jconfig.h jpegdata.h -jcmcu.mix : jcmcu.c jinclude.h jconfig.h jpegdata.h -jcpipe.mix : jcpipe.c jinclude.h jconfig.h jpegdata.h -jcsample.mix : jcsample.c jinclude.h jconfig.h jpegdata.h -jdarith.mix : jdarith.c jinclude.h jconfig.h jpegdata.h -jdcolor.mix : jdcolor.c jinclude.h jconfig.h jpegdata.h -jdhuff.mix : jdhuff.c jinclude.h jconfig.h jpegdata.h -jdmain.mix : jdmain.c jinclude.h jconfig.h jpegdata.h egetopt.c -jdmaster.mix : jdmaster.c jinclude.h jconfig.h jpegdata.h -jdmcu.mix : jdmcu.c jinclude.h jconfig.h jpegdata.h -jdpipe.mix : jdpipe.c jinclude.h jconfig.h jpegdata.h -jdsample.mix : jdsample.c jinclude.h jconfig.h jpegdata.h -jerror.mix : jerror.c jinclude.h jconfig.h jpegdata.h -jfwddct.mix : jfwddct.c jinclude.h jconfig.h jpegdata.h -jquant1.mix : jquant1.c jinclude.h jconfig.h jpegdata.h -jquant2.mix : jquant2.c jinclude.h jconfig.h jpegdata.h -jrdjfif.mix : jrdjfif.c jinclude.h jconfig.h jpegdata.h -jrdgif.mix : jrdgif.c jinclude.h jconfig.h jpegdata.h -jrdppm.mix : jrdppm.c jinclude.h jconfig.h jpegdata.h -jrevdct.mix : jrevdct.c jinclude.h jconfig.h jpegdata.h -jutils.mix : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.mix : jvirtmem.c jinclude.h jconfig.h jpegdata.h -jwrjfif.mix : jwrjfif.c jinclude.h jconfig.h jpegdata.h -jwrgif.mix : jwrgif.c jinclude.h jconfig.h jpegdata.h -jwrppm.mix : jwrppm.c jinclude.h jconfig.h jpegdata.h +jbsmooth.mix : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.mix : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.mix : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.mix : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.mix : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.mix : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.mix : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.mix : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.mix : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.mix : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.mix : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.mix : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.mix : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.mix : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.mix : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.mix : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.mix : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.mix : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.mix : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.mix : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.mix : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.mix : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.mix : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.mix : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.mix : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.mix : jutils.c jinclude.h jconfig.h jpegdata.h +jvirtmem.mix : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jrdjfif.mix : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.mix : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.mix : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.mix : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.mix : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.mix : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.mix : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.mix : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.mix : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.mix : jwrtarga.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.sas b/makefile.sas new file mode 100644 index 00000000..877edc53 --- /dev/null +++ b/makefile.sas @@ -0,0 +1,152 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for Amiga systems using SAS C 5.10b. +# Contributed by Ed Hanway (sisd!jeh@uunet.uu.net). + +# Read SETUP instructions before saying "make" !! + +# The name of your C compiler: +CC= lc + +# Uncomment the following lines for generic 680x0 version +ARCHFLAGS= +SUFFIX= + +# Uncomment the following lines for 68030-only version +#ARCHFLAGS= -m3 +#SUFFIX=.030 + +# You may need to adjust these cc options: +CFLAGS= -v -b -rr -O -j104 -D__STDC__ -DTWO_FILE_COMMANDLINE -DINCOMPLETE_TYPES_BROKEN $(ARCHFLAGS) +# -j104 disables warnings for mismatched const qualifiers + +# Link-time cc options: +LDFLAGS= SC SD ND BATCH + +# To link any special libraries, add the necessary commands here. +LDLIBS= LIB LIB:lcr.lib + +# miscellaneous OS-dependent stuff +# linker +LN= blink +# file deletion command +RM= delete quiet +# library (.lib) file creation command +AR= oml + + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ + jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ + jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf +OTHERFILES= ansi2knr.c config.c +TESTFILES= testorig.jpg testimg.ppm testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ + $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.o jvirtmem.o jerror.o +# compression objectfiles +CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ + jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ + jrdrle.o jrdtarga.o +COBJECTS= jcmain.o $(CLIBOBJECTS) $(COMOBJECTS) +# decompression objectfiles +DLIBOBJECTS= jdmaster.o jddeflts.o jbsmooth.o jdarith.o jdcolor.o jdhuff.o \ + jdmcu.o jdpipe.o jdsample.o jquant1.o jquant2.o jrevdct.o jrdjfif.o \ + jwrgif.o jwrppm.o jwrrle.o jwrtarga.o +DOBJECTS= jdmain.o $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.lib +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) + + +all: cjpeg$(SUFFIX) djpeg$(SUFFIX) +# By default, libjpeg.lib is not built unless you explicitly request it. +# You can add libjpeg.lib to the line above if you want it built by default. + + +cjpeg$(SUFFIX): $(COBJECTS) + $(LN) V<#=b^FvwQj1*yrbizjAZ*%#{Hs|Qh2u} z^Xtt<2e?E?<#|Jc^FIgB06z-XzSb_KiU=g0IH!IwjFJ9-&uZ&fRME{T*`1nC7SPJ# zL6h?XpTmxnlIk!)2bl7YEOWSX+dZqzr@ERcV^MJ1pOYwT6Tvv+x6|`AQ$*9X4SMLz zXOb&O$P!!=f<1?;bJCN-#(z4up&rux4_J!m+?4VdOT1-SPDVX*=~@=nWw|HJ$8+~o z`+C(a4@!qm(_psR>28bi#>eMwdbjv?t-{Kq3IH821#!yPve=2wq7W#EgnHb_3WBD(O>FcYk{uO(*WHk3hq@^H?1AUc#4hs(FrBamL=>^xen?>6_;R?&pDA z-leR0hT_{{3mGNk2e)CzS}DOxL%MS1T9+<$i{q z^V`j6ANO&td64zv+m20Bl8&s4U1(d=^oE;Lwz#|VJhK<@58`3OYxD<`UZJFD@z_BV zNg5}XKX(d!*nh|MKJ}BJX(r!3Y}@6HuzFw<>G)!|u4OR*fr%%rabl;y_N^$j z&t`8qP|xWGPf~ zZLoAA;6wlp2wV=t)w@Yl8Ij}jL#|io6q0_mNPmB$-xQdzWp9~>W9wGd7oK~23u3P$ zpo}(h0{!COPJcsGno8nj%N;T=5X)sgSV0nbcL26oh(9Wis3Y>PQ_<`qw@{lE9464K z(HHxp`qd8&cz!E5qS}KBq(pJgJzV>q-h#IS!)-LzGPsW3A-8jJlU{9VuB5cs9ip68 z<9}`AShWea3?hYX$G;fk@~EYp$n0Yn$>SrXW9oXh+gKQHR?+~#0mfML89j%!XUVPV z8hyb=jw`6wuEzO=X5Ti()bPz~EzZK$J&pweJk+zcWC}RjR)1_X z=DqV6E<%t2#ZtFWEo(?EMU-K9M`zEjFu&5XWCDFWze!`1?iu8k1E0-L=UooCAeT(u zsslz!;EoWp5^{U>z#iV!%BdjmPES16({^T1)f3Nk9mFyDv5`8iJk|a@Z~-6IyAJ~B zsqjdx0~=|v{U=2{eRj%{{YIYojE3e#>g3c4RS@Ov!;~?70o^0;CZ+9U4Pt{@xaXT zvz!G}^EXUm{PA60x!~K64&U3}Y4>blk+A6}&CkE6&2HORU0PfQw_>1VE)AtC#a8Vlv0KHPafA(IOQ& zZf0mqM!9V+dGn*m{{VrC+VMwJ9(; zl~KP;e}!~Ei5%w~N#)P2cm5KyOI;j1ytK`{eJg~uj7>aI0h1(waqV8AYit%3i5CkR zg&3^sO3|=Kdz_AyblSDm)HjTc0&xnE0;wm1?tRU3nv^nF>JwYd8zZBh2*>4JU9HWA zhi4;9vE0XX0|M&cVSkTcJ+oOh7Wcj;zO|ZI+DmIBRF%NVUh+(zAY`>eW8^90IZOI572)!)0r)s6B&K4#opd8Y>IbjcY zqj9%z$9n9vHWFwOu6a?K;oV*14hOwKMrW=g`H}2JD{o$9R#} zI|k2EMRm7~K7Vd{99IG2+o00LY!CZJs*>iKMY(d)FoTHg(fSpYf5y7sh)Ub6u0Y`Y zg#7>``I_Xec+=AzORIjB+4!k`+2JcorRW556YIt+wZC~BOy~SDXlB;Xk(Gr@6YpM~ zYaYl$ALHh@zXe*8V=d7f%-9FmS8uyu3OWkp#7Vi>e}82jaSnrXue=Lw7n5eOg^L5P zT(b_D&wA>-EN#3yr(PjslG5C?vs|CzYz_yhH~?0Tq|c*TCXsI9Tj^9slppHXpvSqd zJ=X7%YpC>yCI0|Jicj9iy(O2XeuJR=PkPz6RokJOS6;h+nM+yJ?z}^&%XxBHSN>SU z4pj%GSbx!C4QDwckuvf5)@`;LZg?DwR*sDRP`pFgfc!vj@U3TVR*|hWX(o0Sqikw9 z#cDv<0FhZXG6`W;_N^$G5sLFVp0m{&5jI9?w@`_rDtn5hE!tVAX(14y3k=osXbI9vdZLjG0I=@u6nZGVf-^W?hYXc)y&)3y5>TaelF4l#jN zuDnZPZRECyNX!O$cRi}njb~O~>RK6Egv$(4I~*c{N%R%vw^OzC`_9?Rw*%02uD8ZI ziHgoUML3dfSb8u209@B00*^O6famhA>^wPQSZ=|rEqe==mXM?s)j zi%l-p5W7fS%stOFs>hm&-8Qa002K0h>0WjDo!Co9W18_ksC1t(Jk^(3yHaJ4f6D|T zp!6huLlwXj#=-~(H8tGwU0uy_G^SZ3a(~S2)sL+-sUAq@lU}SL$s0Y)uXk{Wa$7tT znz?G*ZY9C{#5dQ2{xzN%muq(DYGB85u(lgT-)Fq|>@R8dX%4j-mF;8OY|Tc`F+d5Pk!#Sb|iOA27l9t$!PM zB5|HK3d+U%PC~7{-Lz^y(Bo$wvF4Kc>L^lMxsf7JqvTPHdRDu~7*oQo1#n(8y&>jzU*8=CYXs)`Oea-Z_BlKI*)<(XTbT(ZkIFp4BVN{Ks^Yq7E!g-`n+*DYq!O&ydK-I;RU*4Y5^;Z?_>HKz=T8V)(C zR_Y3dJ^NJS{a{|z$lEt@Mt_tWZkuZ$!RkRZ7O&tt4P-2_~Uq?pS;ea6UbKbne z;x~otG;~InI1)sounw6NhEsb_Hbg4*X&9$b*%#}4zQR6IwgkL`>Ut~FcJGZoz zkylMQ!fjpivE(NhDi5EWlldT_(gf3=z}1ur14>gQUYGm-_ngn?e9q_by}i{N@UOZL ze?$Ey`E&3CXmTWPg&?6gTJ9kBEG7xmr4Lq}h3y=MbZYME#)R_S{)OELsaDqjT&$l^ z&V{PS%3sKypZVd=nf;9gBOFIp6>UOj>^o{sf)m%iEkuB|&Lq`Tbci{#kzXt6M{QAQxYkxKRI&_bZ_)~zKC@6dlY=tgbm;A#Q}_56Be*vnwZ??C-vyMGs)GrIJs_|EUWgemRP7jtX>G!Bv?*%SBjo*IscG3yxWUHM?vEY z;qO(I(0{-2qLzqj|Ji1gyaIwtWP~1u-~q7o`;^>^I?fmg@j-oY+mf_L^`}tvk)RSP zZs-yBO+BxF)UiuZ~+1m$zIc7ZdrqI7+vCR?JDb+VfZjEne$Pg&D#}rrhytlOdo8*=kL# zozQO1hnYQO_XK!pM^*GZ6v~`H$f85)CMA}NwWbX}6F%u(Dq4_(h%1W8+D)u=@Z1?4 zUesD=A_-H$kdJH0EXPY@e(VzbZD3DAK?Hb(Z3_#q9X7rmOT^VbVw9$B>X;esEeQC@ zkoyp+L+qIpt8VX}Q9SS1!51K9N}q9>x8}YI-RrFMV0`*laoy$_TdsoEg`kBl?M=61 z{8n!BCmEl%Kcz{^SYHY}4sk7^2Ph%ZoLbG~0Pf$R=+-D8jlai>sMr6lS3U>52%wGXA;?VvO=(k5hmalmxr%IL9( zmNERw-dPo3DiEB~dn~yD@a;0ul(wN%MJKL zaf|I;r2-t5>EI;Q*1@45CTqH}y0FiQ098i}`@Rm1kKPIW(pnxpKT~$fi=xRl_{k;C zPWru6p~h`)p3e9_CM}wqW@>zuE$D37>qR|yf2BGyUX?B##;=K4A3S+2dJPL$`#!P5s&~a+sB0e;P0{8#Hal=E%R&O5iYI0ly(kQ!YmnT5 z-MAk5_=SJL=jp1znTu8Tn3=3jyAX)4SWcdW6InrFCi3NWe1QFVID%WR=`=Zr9Geq9{uBDd4@9UD%HJM4tqNjAs`PSOI>Gb!jp)>?7JQW^U`KZN z`?*qwNvS96-kys1wWwM!RE*POjMEj%qfLhJN|b7zri*;rDu zc^!gSijN4~{DtoLX@X#uam;h9R@yIDKZMD;RkAn-@bUfl^5;Vgv*;_QbWO@#XJ3h6 z7qiwq?b1Fnz7#eg$$5DiX)<_vvPJZ1;@?85UW9)vSSpZ%j;wAfkxK5)$%XCYdrYew zZ>SSoEDNrMBo1^(MImsT zJm@>MQtr#C6yyvbg^C#Tpj7NQ8>D$c_%?>T+Vj}ZM6r|*>3D)Ku^3U%$eqbMq9@aZ z@p7F!fE-WtEat!kTUE~f=3}F|io7h>%bAQ$ph&R)Mohyb!pqx6ZO?&9E`IisG@p@9 zz`q$wX(@O*8!6K@>i{5+o{%*m#ZXKkFre zrBXS4r#{3&@}dUdFw-N$Azd^#U*#)Mh**+v_q7+*hRtt5`Zb$Flzp;WIja&GLt8YR z*0Ftg^qjxn_?#ZP*79)tM2*Ko<*w3d#nDb)dB! zH#Q_^_$H5 zLPSXAFoxPIY{#x`J^Z+g!|1MwmuPS^yc0j(SBBe#*RLZz#7UzbPHz3RxIe~Enqmzw zRrf3;X9QZaNetb-A> zMAgq)y{M{k2)gLj3g23acr49ki0!WDLQ8bCeD{WW)tGNreK!}~x9!RaF)eXe4^mk? zt4sPMUW2xj^-z8P*75>mq+m~*b>HT4PF?Kk^VrqKHzC6@E3)Y1#24g#gs1idYK}g7 z*mBTEYACjvjUU8OgGqR}Q`k6HLc zdnFUI6pPtpt)b}0pS5v4qvg00GI`qh=U4JAl4j4PqXRMmzn_jiWKvwoy?q}^vx<%b zSFt9bcyfq+E;3%JCpv(YlCE5QO-#b^>@3h!dZr9cj%=hyLy-s3Fa))d>a@P{j%Z;n zZu2Z=6aKgyl)1q=FjO%sR7OF4$4{77xy^lw(QoaVV|SkYx$6$WC*A_7aBQVA5=Q`6 zPt=d}eyXK;FivUBmZD6BWPv}IHwroj+0dHY?@Lbamc+ry90vYsylQIUmTUrtDvc?7YzOBFEdAXY-x8Py1}%I0OnI;-S?)8Q zZVNu_MSu2!pT`u}eLFJvxiEUp&uhq?xyBDUNJv--3E7AaU5((aMe%pzV|J5;+ljI3 ziE*3B@mq<)&4jqEB*B_6a-Q$I8qM2JiF%eCxfmC?k`TO^8od-BIv(afCkWk4P2LbC zt)wI@B*boJrEKSk@7DHbi4h&HRTo;DZ1=&bxS((+-b>E%Gf z^WNIs&gz|xs;#yP&}?TNXtA??sjFeLyLqRt?VzvY7&T!aMY{sMqecFpL>+QA` z!JG5r0P}f&?j+Z9A<+M+Kmg=-;v&`}gO|b%$?qh^?THfB5@P3~!WJUKrbBs)(V?4( zF>5iwpxuP9t+xPKcY13SUb-B)^p{+R05@%N8!AMolIL z&!vVhqzBHW`UCUr-1w(ind>RZYYC}aDVa-gq6IS^ot;>7aR`#~9?&DC?>)zT|JvIA1HG5rE!2AyZ^SQ1==BvHU+r6#3{p~OM zJ3-HT+d=#PCci(>2?Fe|r-nX^w~Q7D+arCaGGpHr=kKH@P5b-xxiMEF!?)rDPm8jC zX{`n9+kXCQUR(&~X;(Th2Tf3@FcuK!0305|5WowdBlr^x=CnI&mhCa)!5Vj`gJ!*1 zO95Uh!TuvG`UHo)781M~61Ef+vJ?`&7#y}361)<|UkVRj;PaPb1e*zoO9J6|Fn>8V zel{X{BR=6EGwWGu@>W9JdQ8L&&wrZdHRwg34fB7Vk?>R$yDkjh6$xMGrB6o$%|(YS z$H#1^CGDgqZ=}Spi{dxa64x?>3&~Ln2{B7av1`dmt4WC~iAl=|i3v!imWvudZi z2DH^$v(sMpw6kHqr}^1H>;7Qd-jRmecLrK^hFbSVJD!er?v8crO?JPWAKWR=A4`fE z6Y$rvl6O)Q#zXwa1AW$FBUj@EGZCTB%ZtAa_pjEJ0dO!D5Ck&_nD=9_-ALyaTRV6N zRs*!*yRhlw3ju%lvYY#uD}9JU9;Q+zSd0Z9&$VFRO@6?T8*S8svEc8w9vZUFkJycl z-HeKz^a+^q^WBPx-b+eajf$G#hs}jYOooOJ_y$bzBc{V5m!e}16&1cA6l@40M}0ik z1tH6kfx9V!m)Xf{abYujzm?cS@@t9FTcS9?zMd>xO^lt3313QxnTw5>ON>}f6)YwS zCZa-TqN9L3FrNsI0OoVT*m+UhN@mh_Mf%I8!tL6$+5G68+T6W{f)}l&Z#pYqc2z!a zFWYS{-fAdVYb;!EDq3$Y-e@V=Xs`GK`yb3-^tT-hcYvM^wI7lnZhtn?@pPnpcew4@ zWcRE2!TsspjiHwANZus;J<}7W;v)~4hxji=@z>*`MuPk%LW5q{RD7GA%=DlS;fTX{ z(j>)op2?bVWe#EqU5?Hj4o)Kkmn9Zw*~4>|?zYO|Zg71U-Pv;t_h~oxAs2Et4h!TL zxn5hmptZn&d9K$WgFflWfjHj`k6H?j+K3QtM~Rkrv6H@`YZ39AF`^~Da4JMN!%r9q z6tubp)YH6M-2ez*mA!-6)1(O^&u z5izTR`1RQI#fYSx+g^;c9}KtcjJ9r%w5$y`J)Q1)I@z&4)cAb5`^)C!!FcCrW%e{L zd?Pk#ElxNY95TxDo#Y30`Y;M{c8y%O`IOkNUESX%r^t^q0s91*HcexUktlsAEHH;F z3E2n5d z0ru5~yp{S~2=dL=(v9}At7z8u%i>M}q{?1dToihQslk^Rstbsc>*DwWU-bm<5(D878<~OP4Yf+ z!*UwkB6A&C|?3*?foI4wtG0IEq^7ZQr3|dHwepQqArY(Q1L^zfizEB+hw7ufZ zVAG4#!6wkt zk>=gurp@u@jj^WPu@=y)(YAM!U0=t#-}E%D7i12^@Sg@JjZ%DTop7brj?p@50Z;BH zI2iSXdvBKH{e8Ii+vq|HilYDh&3-fvm;=u?J4AzpHT-zQ98e$G4*Uo=z`PTIgfSW- zy3DiK8~y=+eb9y6iziI7SlgkY%Ypp0;D~W{V5yaJijH+XhB?8F8Fc5jlLH!Y+zKQM zunYCjk?IZteSE4FV=ypdoS(OrT)mu7(c*qcKF6M(hhUbX{jzOYH7@=WA!&0_sS}|I zW1*3t90az@3rvYO9-J~1kXeQcDn^9`DPUMvb!!O0fW6NrrrXbdCoB71L($WcwCPO# zTu#J#RqETG@^`~6&%0}Y`9V+XeoqyU-{~ydY%Bhs*pG|_m_O~Se>&Lwhu-uxf%XR) zK|4c@fE}0v`RCJ}n?nsRhFiWa4*fdbvtC^=kt7%qM)qJ>g}U}JPt@X7v;}$^Nv8Uh zEW%=X%%{%ge~$M5(mCQFa}%&nQJI|xRE>#cgN5w?hB!@gTXgqaVtFmNab{fICn;b) zGF#KLug3ks?8bl(a;L zh$P1l9}P;BnOi0%xRw)N#flXnxiOY>o-T!O&BQ|W89HJdU z{b^t0^P$#f!>zjmO%U*K-5zOLAE?_LY22M?-5EWk{c5^vqqpY$a69Oq{hfd7Y5Q7I zvK$f7O{7%WIHW%@On#t~scTwbViRYmUyMP`q{hE(s{Y&P*gwW6LX4cvPG3VxYIZm{ zH(A+(`q2d7{0HrMCL2a%lt>*RPzJFi_!Ms735*N8Hh_1Tbz_fG=u4hHQ!MW#AKrR! zY>$gar31N*$eHjKj(Q5}P=1+)E;UYm1?FyidArcZw*C(t+^?F@ub2r9-Mf7Yd;E%) z65HCj*+U^E1z3J5F(TQD6K@w5ZsHfH%U~&B6YRJ=T^ITTGwNMq+C3Au$CfO4N2H7n z{)&~Qn1-FCv4fPU%@5aE*Y&3(Gk&S*n@)@yjO0(Ig)ZjB?6+pU>dHUpE!*!ddDd0? zyr+Jzt7WUT{txV1on`+MI|Mm|`c_x%c6S{BhiKm$Y61R$9n9qUY!_f(?y1@stbaYz z4f<_n;GnyHD?f8o5Z>eNUV=bm>l%vGw6c{=Qy=Rms_10sm=vOrVH>q%R}>A8U$i};1aV$(Zqwz62Bga#TnP1}2nW2t93p%O=Q4~Z19OOT06t4|pQbST zQKU(-+mx%vmS4ymCuq{mw*}2?aH4gR0;jq0W1N&a=YVVz7AVi$D^8Ut)S_mYdu3P! z@)U@n8q6H0s9dbD-Xp(^n%3@Ho@~cYMMQAq@ox7~#0OM;F%wTsP6jDG*euXUTpxGa z$w$}2=(MJttf_;nvFoy+g;Ur{Y|^Q4cncypxxdk zNYO!XvoYGTGT88Ry!~LN=fgzL=jr}0{T+LC<;%&5eL(?rXnd}jRj#^0nu2E5V~w0A zS|Sa-6m{KnW3wg_WjZGIX-?jU=FV@k%kNqS849`%XXWjr9yy#)ZnU&(wRHr%N1+Y| z0@z^)fHOpR9|{l5!CT!b^Pl;Ao=ai4SZTK5i`VET09=sEiKjY!u~R`diX zwgDZKW9(XD>)S~c);RNvtbIEfDIN6WGK|3g5jIen8m`R>)n&(+`embI6Rd*;X8su-75*SyoyxY1Dy%t4SMzF8c6J>0(DTt1W}DD-emv9*pd zHjGu#h*QPG3>hP4QEJB=|H%zsx=^=o7Eens7j>PCS*LI1>g$MXs{ zk`FAtd)S4*LgY>nVsW+D9Cdf>4XmY2NblHV3rTeovAZC?33@%Ral0_Tp6l5a5xkg_wpg6@qOI~}f6ab(#naBR-HuWa z+&qPvsIByAOW9uQA?hRYa9wXZ)OLF%G+{PcD)xIDUk*UY-}0=x39g6rQD5uJ;m!|J z1OJ>J-EXSt4GPM|U@}ZBW7T!i)eVxBv{MwcveXTW^esyatwE(mHYHfZRCpjXG}coR zzczM$sc)}i@!5|JEKlCHI(5fMO36Xu2~u1Mz>eT)0Ct(>v%vHM=I{gr%t1p~3Pd%0 z3YG#94sVWO$$)*0?YGGEnqhdgBXG@*E=>p$Fduaf?WIN3I&sVF{cBO709>T!9-~a+ z-E;D|VnvY9rpj5-FWWM1VklRfSP#i@7W_neK{=z4r|TVI5(L=OoP{nA@fj|n2&+)% zs|egpoP(@`pO#;+L9p%*YIbMM0lU`s_fc0gvxq@mp`wX|qH;Gzofl_0FXK&f?LlkB zeskGkb;f#Q9?;%tF9Gd!l>_$8rozqoLMWGx(#8K9>i-Y>c6;^nzC+qjmV$u)+mY@! z!(AVz2cHkLtydJ)hxo^tn+K?=#cAjYHTBZe^Z~m_Q9DP|xXjqL-Uii$rVNu=z1fggA%Ps z;XlO3s*|4bo~Q${G8<+{WQIzEy7YU z{9q#{OOX_)=i#O7ZX;>ttL(+NLsk3J13Pge%M%YN*Nt{wEjQ+uwz_XaT?3(U)SL1a$8L}=X&}TE(Pz~y zzP|&ZPQIvd6v_W>AUJ9-l5pfL!#FDF$Z!BY48b6V3_tGq@Mg(OaF}5%r622Bq+{OV zM4fUEn(&Bh!+K>KQX?PPdR;N+Trv&0k4?~U3%ctVE{}DQG63u-aRao3A^NP9$R;WS zB@#I%2I~j1o-i%N&FrMDDR&5f9e>jz($bS>z+pVbk#1m&f7bPsXEE>6fVs~9R&bD1 zYWK<9%&r&;Ps+yOntgl@ySQbkuiDF@yET#(2OWU5#(b#vp{WJ+K2)HaEk%HRy)Fls zKW#4f@A4mtBT!4(AK15BtM)qU0QeE}gWi_e(%i-&H|NLqjHUGOSP?Y zm5m#WoVsj?<5cd3Z{&J-{6<6qFy9kp@0BILtjTy&TiO>E;Q2($>ePAr)Atb)51k~H zvF9~umkr5sdbo2+lVtJ?jW$DNjN)DT5V$T|)PMtd9L*d-(MQpYAp&!l=+=uRb~%-1nZPV0RM*GpG0Mlr zpKHjmzGR{M7X^dwmD8;QgA|E2-(3q+b{y~xTZ_-^3*pvzkVj)Z-#2Ey>Zm+uEqmHf zxLKXEQke$y%c!#%ohW4^pRcQ36yUQepwi-y;33J;Q zvR@`~_tLn}(!F=Ge0Q_`UKBR{XYoyL2NVVF|{k3l@6(}~pPi0Ve;yYTonG#auR$Sr5x z{I>ifXSwnDM)+D(Sgx68&?7waq7~!1Ly$5xOv|172oF3F;#y7@tT31CEl+A9&zU%$ z(IH*7$U+2*to>501A|p5juP6oC)HRF2+6kLNw!hUdqf&!>?Rz{eP@jms+Om89M77@ z=(=<7J4b7v2e_j3gscvafHE3pJcjqWHuYn3_Oqs9pt@C)yIz^KT#@ky_SLE^&{}o& zdQHxDZ606;!Oc=#0bqaDSp^+~?UvHbrsCzM!iD<0@#=hND!v%(uZxWdHbHo4n(@`` zgH>#V_SAR>S_#pk$3J>5Bn0}XPosi%BLm+i`oE0xejd+xmF&Hf!r4q@0rvNmQQsyu zCnC~3AL^Taf8P4o4Zse}QIaY+X>GvnBCB_Vea@XVNFYKE3E6wA6}r!fJce5_BX+4BLO z`-tfI2uHkVX>&@=`lKrDrn7^jk@-)m&eF#AVj6ym#0pXZ=N>Xhnd~g7>vYDDb{!F6 z2vKLRkiw%zAa+W^DmH0WFqig5U<;frndl&}J-wH6xe>wi{u* ziXroP+tu)VAFk@dv5!!t3(k|DHXrXV>PPPE=2;cRH=i;Rq? zu|dy-!7r2i-iQKUr3D|P1n#EsUl+vv-cj>_j2>s#5f|2iN5Cx0 zXMjlWL{js$ENZREbvBe@OSepYlFuzWH#rl}JE%xacOQ8d*J}uZoQ2aFeZoaEx4Vw6 zw@|jH_04`%!JId9xnvQh&4f5dLRNFx%KDhH%Vk@Ev9G{9n6K{>Zp;(fL}4G3)lTZV zsWUyaScb=xsCS*(y)%aSC1YW!#duB;k+hhU{Hd+-T~q1vy3CKACBSo~A{&@5mS!9h zuFPJo%sF}pv|%7-i&N){QWr|n;W>~$beOgZV7^gT0BO(L?z&g)wYzmCrM{kc`TGVE z=fdrfd?S?GW5arSRGn*NB7&8L_bb4Aw0MP&`uVLyN3Vx_@5S++$9um@_J5un0Qypy z`mL|(Z_vX`iv(}6`Wfob8$?+pjI;t$;t}qwCPqq~a88#jYX~~RUT0<3Z12>Kb{T@S zoaixvbL(@YciNJB9O$4vl*bs!cgi(rk`_4T8Zb)pud=4cJTQq@aumqh@gE}-wW*#^ zMczmAR2hB>6!LWkD14|l9js1i(C;9kj6E@DO%bQ{EWTGE$yo7K>EY^37$C$6P2vSh z!g&k4jBU7%caSERBTtX9jN~Y>RDLk=Gmc3oW;k6z>K%KSOBT$hmb3-NCLx_`yts2& z2`?H-U$&O-L##Fz?L%5pTew=Czf_U4Sf0IHnR}@6oTaktg%TKuththmnW8ih+^kgP zZPpjBHWX|$7w<}xC-&CK1Ifue8Gqyt%p6M3D{d4kiA&SAdx!MZ3-Az#Oyfkf&J!4H+InE&^jJSMCR1U^NXh}H2z7gxU9Uu5y!~^pGsxSQ3 zQ@4|rmSSOnJ$J+Q#CiNVMcbcmI-IzRKdS`H9Zo#No>6zbWb_Aiyp%3RQlrfY--UJ= zz%wB^8N|7RnGd4aLugKiy?Z~3JB$wmbz^*65bSD8M!6}q%*H=Mk115A#%s_#uG+y& z%DGSQS9B#@vZLQdTc6g0+(Z961+EgM!c_zTZ~nca<7pUfJ;oKg7%dOq`#8i2ZNgbI zX9;7*H6;B88gtId>}MUQo+8ac4Ug#%?s5tkjh^bB-df%n1fCG#$ul)C<9O}X<^%0# z%>^%@0_rH=X)Rf6C|<12Tdgf#sw!A4%UvqZTdOKutt?nB$(hSfAJ0gf$pvr8UM|mr zk5(!R*6T~Rn=2uQfoXK3B5SEg^s+qXb7R^2tjwj*koX50X-Wq9x|pOVR?(`2G-FnX z7Cl(gwVa+(!^+4(dna1cJG{7~q5PR}?siJ}v-Ic>#iFkj*A<5bwN;XOg& zj^VwBF`g~f^dYS87%8|P?F-m@asDliUd4u_1XWVJ3X%T^9j8WNU9sgoCh#@c@uoq} z=gc7w)cdQV(>XKbdD9>*_fkp{TE^Jnl$NukK3T@X?V3XXd?Ri-JD=9ao-t^40J(`dQaQEi?sNB18zg!n$%PVFCJt92$KnK5?fe?^RpHD=7IJ za@Xqf0Q*K$=^VIvRl$6D?p$#ekO$^R*k|+7CbNX$M4Q2C? zLpBt`AZ}J>f2b?|t*!dE;-cNS*a=skOjYBUyG8|i*lY{03{!TpO<;nhUmB9%?44go z2q?h&*U=f{Vd3*pzF(`dzqOWqt;`zs^9@#b0?d&Tx17(Y*_}Kz7P721=8Q7j&@LJ< zt{CH_v>?2Xu#?Ui0Cs0F^?m|ljK-Owdk+%aIuW!sJ938uy~~j~fbj$14L0m*b7m`w z2TIo>hupMeU$zZ-LxRGC5}zX)9)k9$PyMLVZ+7QkHR&rk4|tf9M=X3uw) zHncmTLB41e_{0SQo^;k6CuvNRwP9SckI-NR$de;=Jweo)j`3DJKTSIMHX_(i5Nn$z zu#af)uTCR*=ePzArNqt`WNbBLZPaC~)unDVWkTTzMbJWZ(R5kvba5t-2e$LYS@0T! z`f72`d~VuYPU=cg_GVSlb`4Csg}{HYG9TW2)>saD(Ngxdv-)qHHNUo2{H>(mV^-QK z)4$CEm8W2rcF!zHom}e_nuUt?d_v%9yB3q_f>T+aT)L%ZV-z)PJZ44h9Y;w03_=X7W?`qT@0a6>t-3pem1+~XuP&|<2nQ)+`G zw*exv8%1rh#Wq;r0DG@93oIS5_d0tI5JHDYVYPPN$;zmpYi3*-J)fISez%={?_vTU z5<=D7qI5iYY98$SB;|v(yJcF1}v%p+xMuA&MQ*iR3R}^M0RV0I! ztCLr2MNs=g9XeH-Ggg=}S(pywXA3i?@=_tl58o`v1m*z$@FqVU#$u@~ccZ3wv#}gZ z=6Q4FepAIkb18gxeru})?Eh6+`g>8{dw${w%C%J8Ipcu^{~ki9Oc0p)^7TA?REWVk z^g8#L8fH|p8@JytbUvCt668}uCImcrh!m3n?9LL3Af%)r2rI5il+py$|9|W*XSD%4 z>XeG}N!1}NeE?1Cv?sP&W4j#4!&vum7w{IJP87F57hPe+8gh-PL-UihDWUQh-`n=y zw=fJ@Te6H5`xeSyks72z_mn3y?_$B*QRgi{PSU2H4@oYU?A>o;LNz=>G?}DJRuBf3 zKdIUOtZDP38vcw4z(*WcBS;(CA6K&c{t-$_oqf-idfhPEi0Yw4r`{)onz7=Y0!!E- zosp@dY4Ky}3A05B3#G|Rm8l>|3ulT%V|k*HoMf0TrwT+fxheAnX{!+Jd1-68Y3q6E zn+2K6St&E=2@BaNn^gq|EmhAuYWCZ!-!|30Zm53VR00A2zN7SGSNT61ivLzy@GUiG ziOy~{!j~#p2VF7ZNUL)mA)^f4`I;p9b+Zy&Amo!>o?)ZB_(9*$Rwg&c4(oB_vBU8z zNUEuQ7BX9x*x=}sVaSYDL<4ruYgSA-JJK0bh*g*t-EX6O zpOD#)NYoohxB`5foDJfPG50YUd*0IR7CILh7jN!Qy=G^7LJKWz;&Q=dvLV7^+FzEPjO zQk@Q|_;_x@P*&n_cG7fV>SX>Q^R@EawZcqT=2*-~0_IDZ$sibo-HL*jZ8h(@8xNr0 z)l%`Uxemxfv_lpO*gtfZ{j0I$AN56mecRK2z?M;~<;1^f&Ja_;${4U8I>i~gvF=z4 z42Vr`f>w7PU?1m2b+P^P9PnOu6oI+p$!oShKLWul2IR@-^!~t3lhp&c%IVTC>XFZD z5~Nfy;)>3viAMdIHawr*h_9y=SRj!+1^)l2MOfrl?vAR2?G~?O^O&Wet4g zaZp`iB@FOqjF4hF4#zc!vKD>{F5o9%&i=}@Kvg>R3c~h;j@Nw`!g(9UWn`K~cor_! zN1bN&vzpCm9Z2ATKS9bEC8moOQ+GP93`6gD{2@g~Io;B=n&KC%Y9Vy=Nk#__#1(f% z<}Tz_F6LLw<>hQwS3<->Q3HJd*m^OSmpq;xJDM7Ec+HHP%uQS^&e$l+hMh>`ap7~q zsIAPDwbX>&oV0_Af{#sAAG+#6FFR|Vw^e>=XaGSc=XGb*i~iDszLH;B@;^1^{Fa{l zG&B$zBUM^ff`{flGAc-ERp+y6Vd~ByDvqq{dTnlkI+x%+uY~!q++KEUk^zo&MZ@{z zedLLI_CG&zJoyB=E>H?l&gy}v=XGcobQu?Qn3r_jE^C8G(u#OVdCciYs8bKnr=E0J zIuALyOcIz=M7ME*`xxGB0K)?8rRK!w2L{XwDg?3ns8dRwH?0B`iS%nWj>k2L(k762 z+yAVNmNxQ!Oz>5qG4G*09}xgM{W{X_q%QXXnRvk#D{0QYiOVI%19`$_8_4HTQpR>C zwUH;a?S52698poPY$7G7R8H?=WH)W*+TF05HCt^@3w zmF0)b>r0`pvRs-rnJFAfjs%T}q9<|^pa|V8&sl@|C@p?M7y;!EV1JgM`MRv&U48kd z=IYn2Rfp=Xd*9y#%)d4@z3Zuc-&^;3r~=3X_RmeZ|IE#J8y7W!aVu3d70O!$U(*5X zHm4plujxf;W2v%g^^~wSW>h~naW$s6$3qY-Z$Z1D2pI8_PasP~iYcNcHIS!O$-iW1a=(p) z_LtiYBu2_4@R2J`#sPEEgdlF=r|nkjRTyRB8)@tlro(33LV~yG{pqH|j}Jk#3#z3^ zpT(#Qktr(M4m%PUHJ?*I7++Yz;q?nMcdD9qt6SE~p(btItE<|rsn{sXozE3bh+;+( zBgPWLCz2zVN>ZV(xCI4KcESSeQx(PTW+d(Bq`oW7`&3!trS(y<&@6kfXP$?_U)>&)#9w_%*64O=+UG|U_K>^UM~5rTzUt1MKpBIZ^d$vikSoiocCkeXGp- zHD9#F3Fx$O&elQ%$SGPKzvU?T$np4f&P|uE4x$ZZ5)Y2BW5wYMqPXbjGG&cvF+7`#&T=7uW2EC-6OT7FRp$Vagadh$%aY ztCHl5DVNPS4^RYIQ@pGtbQFWt*-(DcuAyK>gLDU-PtEYw^)L|AQu^y1i}O0h$L^~C z$3>Lb%^X|Tg)m_&jgyVAfjy<4nu{mndE?QEn^{H0EYJSfglX4`Pq>v7yO);uIVE~O!he(JxgQyDkQDhMISTfyelE>>*CtReCFc6}(N4dsmSDYh}Uviu_O2MS%TNOT`g( zU=C}4!2H!fHDLcZ()8PKD_{rahw7~Qy*BSfyl{xgs4~PS-7^X~t;hcJ6PxdqVLEfY z1T9uOfgWKYrhHzI-|wH`D{tr`_n3M~jc{H8BdH45q3Z&*zl)3(RH=ZSan;c6x*=e9 zk zYSwZ=X@!4aw=iL{AZMmHf4K%0BdYgWs^?3xCsPGeX|e0+@oQ;9*nmA3!P^Y=Sr6uJ zMFzY~ihPqHe482nt|;x->imz@`CsaaJ~fqpZm#&yUiqoB`eRS+m;Qz~y;bk}Yu*nv z0QRpVt-p=6|6{BX^lh-_KRb%wWG0XKcr;iLQXdmIvmnjQ?PN|1!LlQ z1J}#uWLaahq!wCA4}abWBdrho$(O7_7C&jAq|Jn;!QeAd`u;pMHsc}1N1f9dTu-}? z)%eRb^*>(?(?az6CHAv}tI+gOZ@n?>1FJ;{_&DF!sfy=(+faX@0Yke=3htK{vYu7wses(K}+gj&lFk7UryFik1_jmlC2@<09bn&0Kf@XeTc8Sz^RN zYRt>@*ym|6pci?`pDJ=b)faqjDE!<~2Kv-i{<*#4m!7&``x-v>RDbHN`7qe(gB}wy{u0>r-c$%#z?B+r8SA?bV1Pj zZL(&I9^0|bYp`XsNOJnP^V+ed+(0!7RPi_|6XF>o>%Sw_p|9(H%L$kRd566k3Y`%I?lm76yM&H~B$3P=gk0?nAkz zQBCI$cm`EtX~6t>eB6F=>>@v4EhqkEb?!=C_C{0wdTYyMd0BNtcsko-GCO;>zW!x> z?QVJLOoCuCE^00|Y(6f0DTY4}=b@s5;fT#%LiqFKD8T+AO#sYaX2!iKO8Zik_pvVj z2>X}Ta=?B_zN-evf9Qs=Kg9lNxCzb~{ek_Tlhr`}KN}0-@YFb!Q(%!WE-(%}ED>uLnK9gce0PGOzfE_2L4$%(SVIc!(9|`!=F6n{K6V7VFoD0}- zQW}J_I`E%@#&5I&iFLu0cpm0lYg;KjprK7kZQPu_uQgC(qlWHz#n4uvnvUb5hMs_;enq4qOlU*;yf zDNX%Qnfb9g`*UsXFU=)iTS`B-mV>^uRsGUl{Yz)X*RINs{qvTfP@47wntP%S*!t<^ZFxUFa zL!m97`G|l!Z%L4`c0Q#;xnN=X*GC934f0iUp}AM276ab2{y`B0>vVt}DQ*<5$+16a z;3DThkhP;;MFMtE4l<5%1)=|^CpO1)jQ;oaI73D!JGh#}F0!#$kK}($k6sI5uS9Wo z6L~`kJRrZ`Q8wQIEBNIz4K+(uRrOI(fE~1*n!XaBxDg$*5*`7}x1z$fW5YLN_?v>T z-T0_|QQXUn#8;UKpo47TtGvWl#VMcU$y@!MqOKRSw@<;N^?yqoMCOP-jEuBt-<2|i9>yg!2(;x$HFLgK4MLVmXweZr$&?k4jZsYk76>ZM(Q6q5gJ3;fx z_9tbWlmYInnf(cE7g>A0I>+)yEy4xcOhhc$3zS9PPh6mkvOBF||J_6M31#kGqe^^0 zmOUcQ(0D$K`#M{=o8Y&X6tI>MFdywToE*ATn7G_jyxLMan3V#X|CbALXEM`X6%}u$ zrtJw5Hp63{g+?8O3tqAo z^6Qe6_Z8`%>hpeS0*5aF9Zj!a+Dm@vDE-`B`%7>A$KmELV{Kn2n}3~Z`F*Sk^sTe( zZD}$bnrJ~dmMWNK-PQ(^Ihs=Ke}3YA!@ytOri&|hnpsy%3xFxr=aCuMyXz%G_AN_b z4x-3uz|0HSk8+s9)J0m8BC8M44i*H=9e!2;>{M9?*NcuZW;|O7Bl9yx`X{vF>>~p8 zxwa>D&3;gW-V093i1Wai`xwL1rLh%Iki!6WhvRBUF)e3_!zEGtIcw&1wCP{faObRH zG6j=CpEC_oW5AXe%mpKym>TA!N~cF`7dwuxt~uZz_dJ>fe@@)w~VaerYU#LhNHx(Z|Lz(1+#%ApfPO?rUGe`@u#y z0{nTb0m%P-vi2WSb>9Z-es9d%4-0RycSyaa7JTv=c&zOYDu@$`AmGWpZ{Fm_hiGs0 z2=jWN%eiX^(GE*UZrA?JTn1?Cz~~%dhr9)nMp#QFo;!3HupqpYKI*gJDySp z=CA>PauETIFY9AE%o~_+T@I8>^jmh2_Mk85Sf5g0oVk~0f*%WtE_5Olk`WZR)8^@%EpOh7kmxrt3Gd^QKZ-KGX6Am)%KVrrdYcyiDLdtTe!|Pl7}&V-z9jKu zP1Y|Bd7l~zKh_t#t1AY5YAN`oz4&Vf_a^ZGT$V z^D!DyO?wFyqwnv=t60zZC1zMTr&}U-^V0VUG8a-pb_;~>Dw5xnC9b804f8#Q;zD-H zvYxlsK~40rrtFu7s_mr23M?i`U8~5#x(h|9G_`KBaHux4EYdK@SJf@oGwXD~K>Tk7 zguY2g`86x=_uL%7{xVtc9(+Dau%8<7A~)tuq40fG#^<`64|VzPYxCaJ6oLTz$L9Qx z&86V>zjW09*4^~?z9zu_4Z^-AXIID{^JcU;VAB<~!p}VL{prdPcJOwjm0_35hyH`w@1+SuMz998VsuXtQtH zg=zQ+jl!(NO-zpKIbO0oTupOHqTWZDey89drhS;MTrhRLV^6$l;c&@_sf;CF(8NkZ zw8Pg&-AP;!q=(u&e`glL}(PtQX#fjN+O zzi!67Y6939mo1K%L&Zcmr;3$Q!kkfrn1_4@5_p(lA^71MsNfi`=}*0cF*|91IA_a@*PT?d`B}yCM@6i( zx%WdCSig(X^R_&$4Er2x#GV-caK}+vp_CG~8W2=wZaEhf`nD)%I3aX7KWVorT2I4`ZGga>!HAPr9ijxb!$$?qTv>l`4IkNmsWQ;nAOxg`ZR6U!{h>6ooxY4SAIv3G?IU z>Wn|I1NnCi8K95#MIiW{0PqVChS(l;7<87dc7l?E=!s&ffl4CRHsB`bx!hFiQZUZI*89Vg8fH?@dF@H42 zpeF#eD)5igA_OS1oFy&MGPd4I%rG;5`wM2S_np&FQLtYTHibe>fq0r!|I;E(8pd}%}X9-{NqhK3HdMsY>Rh7 zAJK7+Lw#M8vYQbzmMvJX$)2pp-0Q1fsL1P1iRp{tFXyCxsIPfhQ92VR==Ad$wY8dc zcHChyR$NH)Wb!x$)8l~L_vgKUlii*HlXzA?g4}72YtTcKDp+LQ)=jygnEgPr$<$_r z>G?b?_(eqMUX1^NkoPnx=w(Luo05dj)iAN*pJo~f+WVeMFFXwhVBJLE(hMsZrqNhRvI0%a8B&xgxl;%YFZLL-ZP+t~Y&;YLaY zm`tUMPk@3IR7_yqJVg|wh=ASWmKjt@5Z?dpz$oI+LPJ0m1RXFKHIV0B(`0i-cB|8B<|mcS&T3-s+N4^uydGG>#A^N111GTe zGrEXVy0$-Sn*3D}Hil8ISr~nHAFyL&HClZVOQ|897~9`6gur|oe(^|U#&ShEFyHN| zg>6NHnF-UPgy+>|fPE$*E+2=9FwpBYHEPw>>M%CyHZvVXp=$N?B4jU@Y3ad^`W{DI zm5z0phIz9gve%l_WA4&wfa$bA*JxYS8kkSuso+lAfxcVe+~;vYI|%_V(!-9hL!$un zuC4_1x?Xfpow$<~H^TR7bD@;kBWlg<8mth_X12v@x&?~bRobTIT8PX?#tAn}lWv*Q zWUYWa)Jotp(7A<7#_NIpYGNs1uc7*fYdS%d3QJ4j>IA4g-LF}5?pQ!P|Mz4nsQ}nP z5c2>W$U}M=tc)md_IAAJ=%ejJyn)HUq)=`mwf~R2y`(Pe4~f)en|-ecJ4pH3?ywAM zeq0@PV!(b3*yxyI6@tBBYV=om$8(0(;#xM6YWC8aR;L~~omEDP-*XhZ=Xi(jWCZAFX5 zxuK1Oz#6oVo2*8JqJzgpHJY@%tK>b7tYXk*JrGaMB;=Br*KG?}eTGG6%Rk@7oL2F> z@4&rlvL>urjW5VW&=O5hv`g~Dvr69g%v@znJa5{uFX_9URmVft0r?&*1A)%z<7ADo z=d^53$WtyTq?izUm_F!h=m7lycX`)bVg_J`o%{}G^t=>^j2j4~q&`y0Aki|=E zh2|1u(NA+@LC-2vKeQGC_7|OHM?0VQN=rI;K}lMc!S~b?ZW=_&sry~gW=KAE7k>i( zaN>7&JS0@;XOxkDz2PFIg!u6m?!X|3JpFLcXBt`@n)OXUe%@%aYTjNgp!*1H1ECJ*=}a%60UN}nO3wRP7w7W zm1o2Y)bq_DWe{&T>iwV$8%H79!C_c;ouJ;yK}7;~Sb(+`(}o+%V~RdcaIi~FWXFS( zq-H;>m>*YmIHThzr3%@L^2>ihL7E*NGYPvDNwFz zMVb+OHSEZj6&)pRI{Zlz@uxHKS2S8oNSg%u8kRaiAWo577AUlJH`Y6M?++fnFGE8= z#>8xuroL}01LpfJ`QJKgzqMDtPRl8CK*g$>xm~zNl8^^s#U8OP>vC`CFlCjgl6Prm z?y=4&vZa;1q;-7G>l3BbV3!2|M;v>MmsIE8wxM6roD9j`O{=INcqSM-d)?Eb$!YjK zw1jA9UA1zBzU~=ijJWb4b}4P=GqB>Ui#-n~EEH`|KIYuiDn)T7{rKQ8!N$Q6=Ap^R zc+^E}iz{}LBQ_KG3k7k{8giZvlmYggw&Km^0>C~L z@G@F?n*zx~%ls~(7_nv!Bot!>CPGUb@s;|DP zx9SrvaiV;_3D`xOf-9qV%{8ZChp18vN^rhhoAL*nVr$pjWjnfQ9M~%+YYuy#So%h! zdMD9LWo7+XQPF?A?#FuNU=3^H&KiJxp7pvK$hQ zCaJD-vugtBB8wdZ}gvTxpLTqQPiI4lz9ep~&LZ6Zlg~^i({uIkF_%>m&3uT2TZ*3&a z!jHT(Naw;fxNwkaCVb_bIM0P+=km~0{WVv3mdX9$+_9O%yJt@wm^!|<>+*qto5#AI zoauRX?)AM3?;c*7$S%TJw%6Kux20prDmTqnYblFX3s*ZOOq-ye7NcBTQzqW#9IoLr!6@qLP|pNzW*>rZiR;hu<$0zve67 z3e^*O!_O6!L&taibm#ofFRuT+`Oe4Nm+vYBV%x1En=PDW_M}f&v6i|Sw#MEPmY=4W zMrzJq;bdjn2d6FEz+JFiX6Yec;VWF|mbMJ8>jvNm?@-wRyKt4y9QI3mLxE3Ru4lAt zeQ>rbL9#jq*xAdyQWv|Sz>f3=vKhv5Kk70cv_5IeTtw?b>Z4NcDT~^&3+q$&7(+5^ z$Q7nQT@2d#E5d=DY84LP3G+Nji~S6)EI53sZ3Kc3u!A|sGpqw+zHkWsw;hP^5Gloe z?vZL02-``#=b*%sIihIi%PvQMAEdy(5C}90D7@`e626!*{ozj-9*y zKx8O!4L;@;bw82!Fd*VtXzW7*=_Q@f&gAs)gfm?E9QHp~R!yGUj|Ruznr_3!c2(?* z4A5_OSFUw5Z3~gvd5BjAKzC6S#66Oz9<9CbNL9HzEJbeThCm1M>5JT9b5br~hgb+A zMg$pPf040oa{t#iB-wdhF>rXz*2n@cieh~N$g?n}w8S0VRg@*!*1^y$q2mlowe-kv zBb`oBJkpjm8gq8B_G^Po2e|u;!TM-uy{w}NO9K&S5RMY&c~F-5@zzA|BjpO$CnPTq zfKe=*!#`byJ8o+~=<0|FR<)m4tf)Z=XW$vI-LeQ>_TcG0p;85=xL1~9%M zD5{)eOYFn*y%KUg;>4bzMdHg0Y|VNv&it*cuQu}+x(XJVy&cjuh=Yg`NrX+zJB3z)o1~!(0_fT)HE1 z(KgPS5Yke&_%ARr;Fs{3N6OL=+G3A`1mn>Z>CSj&@9yg6io$0_iis0d1J}$8F2)~T z#Nadb7xiB}@=&L$3=PDsq#=dhoWN@%2pDqhVmJDUB<<|3 z+mp5DpQ$Q#h04idKc0c96N&9(NU0zRH&3tvQariCxG1Uz)>Ed78zd66ry*G54sk^fL#cu%IvjxCh?Y4@`C z6eSdbc`6ha)?s0vIx%g-;ObDqATFg@2bp7tbqL2UlCr`z>hp~_9XNKuC=exn?#Nu~ zO`Ydb=$ZUfx2rOm@HDq{_{8p4HTgZqiwDnCbUnG;_Ta+I6TMYO5!eylOZ^!*QW0T*9b!mC zb;NecLZJ5N*aoI7bA@0`y51X0iXN!5Z_A9g#o~Q}BXPFG7d6j!rPb?vB#1N8?NpFY zUh11T-yNqU1V||s(ChlASO(#{ATM*KS-NvqhY%Jz$9=Lr=?f>~XFEhIL+>l9_s2=j z3FO~jyxDuG1~ZJK7iuOi*Y~}+-ud{_kN2*39olu3Ou0-XgZX1(3TC=7+}$YBw8@QK zqKrnC>RE!|P8b7%+ixORFH$wF{LB~9+}^C(f!#-8GZ(K-p1+Kp71PH~Oczvu{3ure z?4wi`u)icyTIp$E-a%uI(FMT%Iy3Jdb$d|P{n+&6pY2aEtn|dFzr^RBAabvBHP4mh zPh=%erPYIlr(f4x?9V;?P?&KnI5R0=sfUEHarh z4AWrUN!*wa*z>((D}z~xGtxD&9E)H8M}&bY5+A^vZ4-biDyor)mKWHDC;EI~zax>H zGhXGp%kGvu$c)O-_=rtGO4$xtBDzA0JrWnV;$lT!?2c5Qy37j(Av(pvm$f0YBAECdt3u*CYN~#?e6ewNVb_tWnY+ivZyv;+miJ8$Uhm#>jzYcZ z7Sa?=9isC4$(#mZdXrf4RIO|<=z3HcT?*qATRX~7ydZP#$I|Y^&|$X{n9$olml_@l zRM&*^TM~6kX5Mf`?T3<@A1mtroLxR8*7p(V-HDVYN=ip6y91kusHwv=!7NufX~_9& z&7L1_U;Wth>~C!^P*U!xsm8{_7Hu}HO;h|rob`m8(ICouoTfezL_XvbQMt{dXroi! z+U->iq1BFI+T|X)6`suHp1_VV0hn%Ul45-f$IAT#RR`?-HOKcQa^UbaVO-VbaCkd& zSpcF63geW;?r0xFq=YH~e!tE>YHu9tra1etF6$eq=AK-#M{r~(=fDxkak;Omf{?$T zRZCnJ5b?PSb%ifwxesNjCz!+V0a^|i!!`&8IX4RLq%XF{{M(ug`_PB-lKlzv^Gxyh zkwcxe)qN+-s~3l^?0Ng})Z~*J5Yb(r(X0LZ8>1-QM0RHaV}_&XP^w@r_1afPeV-<) zSDpDrV4C6Tzs)S`<*T2PxWIljn*JbJ@Hky_pQkvN#=poBJ=YjJ^NOdkiqPhGug)1@ zNx{6AKm+q0HXnh#g~GtsI?a|3DGh(FtT$tCdGWEkY39zA!Cm!TRh1pa{1-C)eYWOm za{A?@^jlQL^(6iQuej>%US*qIs~x;+9DVk9#??AUsF%8FmbuTxb{wWK^A&Y{4BOJ} zC|Qjl1MFwglo;--4&_MK1>rnRUE&AYw56UHG~lE0u{IQyUi|)CcjD<3`8U$sdrHGi zvFf2pu8qj4NZoy0dAg3Z`>Nrr%#9bjz=Mv!zT5|yIb(%)%5pCl#4mx_@ ziYB#0Q+kQ4DXwIUDI8KOVVwp|w@Ei>Fb?PqqjK%AR6SxebVwzg>5>kixRopJN>_9$ zjjd8`lRm52klmYK+Fw{cV9bMI3IIzdfPFAIwVNwI>InEPwA2AAZ-ONq)S7;%sGYt3 z^?x=!`)7aKnLUpD%E=#Z@mA5eg z)%B!>ZsetA+H?62KFoau3G)J&wh3{c?uhxLJ+S9F$F^n`oujaB2szl(IIzER=wNl< znLXGn`uEFvSF+m)~b6m4FfqDD zHlt6iYL|%nWXfT+4z*lZpDw#so7I(5)SX*ATv|O+Rx_GiJegnqEp~Mpa|g(bu@p|9 zK-9}m?@Z$$!UOwgs%ShT_xtjiv9C}4{Pf;GdRsocd@ytJ)bN3WZ!1d2^K;Oa>d}~* zc*>V7DH5vtiS!$hv9R0mWR!o;_$Tdi49Q;ZUS#X{>)^vL*x~K6wNYuyoew0+x+@Oj zqWXt&!<^>qpw6>97|u3L|y0| z{r}i2*SKF!(>#=kjwZx3WJ%r~tsXyK{rcSQ?o+#detGM==0~+M_Mugdj{*q~LK5x= z$9JXjIvLz13T;}ceyuj!tU>oK)AYI^_ia)Bcyaz%Q68j>BPE%0mGensChUDt)%Rs} z@9OqWSJX|`>>jVGA1p414d)a#%QYh@oJp2&KqT!Ih&r&-GL_X&;|(!{!=~(S%d3aK zKKawryMOO(`M&Y->+|QwPn>vHo;{k4ZmgzHDevHl+Bxa?%J7rYKqfs+On6El--(L7 z7Lt6@Ewa$Uqu2@+Epy&J7i4f(65EBREOFQqE9xpgG&#P z6#@8n@$-^q>5EjKyZ|C$w>j)wJ9^v~p{OkqoF_PA6&z!$#L>0ob6hWA++Zwm9? z6&FmE6-|~F&eRkF`@6EDA8IPTD=Pg^Sc22@PgT2teX6_`%%^JiOjOmuM)QhaNt6>z z!3JB9KRA03Rp|w$(=o zfc^E6t4Q6E%pkDiqKdIcr0#I_U)D(*oX>uAzapV+Tl5-mJvs{@m4;vyD@Kv6HU z_3uy`AEfg4MfqU?c-!GJ6ubJaoyI1jpYK0vso$eqy*=N_|B{R6gW!n9L{ck>3hP4b zoXL|% z{`1k@e{?kd-1v0-_Vum{r=ewnkZi1=2;IgJsbL^pGtQKZFw%!pm;+QsQxdr$o^U^r zamFX2aE)iCl_P7ZN9rP1>8dc8YF)Iz5_0!#rGC_|(*3gsFSZu#&TaLKP!@PW z62Pzs$LttyslQ-(Ap7&p;>Aw80~7BH^iOp9yK==XRr<3WT}MTBHX(1H^x(CeQ^iE1 z5@NGh@vb;Uc?jR+m;z}Bb}~RGL$wG1`Gghju}fWmJ;5r5`qlP>af(;z%DZ&Vd3yZ& zgEa$Z>&Gu27`=0G;{KJ%b6<;`Tvcm!WZ8RN^YDEX8il{k|0niIli^Kn_H0Q$u)nD) zd0kojW_R7Yz4dSQ?wqc#2JPv+b+CzD)nGoer}jgAotb=D`BYy1n9eweb+}qhvr0M0 zlk~ELz&?@8nZw>9mX2g(O`JIV_XoFu{m)I$fW7nlshK_1<8@`g-k+I0CN~X=v~$>p z=xKwr)D|KI9`cZocGfqtXss8pbC!F7yv#0Ku_jWpA(n69Pno~Dz?0ZfymxBfd0?*! zBct&F?8);z;j0jZVqOo-VcajbYOK8vM^Yb&OpmoXV85f4yvQ>E`_7aqp%aH}8xXU^ zP3IPOOIvkKT!0NWnNB36tVv&DUqJxW8mPu3S^C7|SC;w`m-~xt-Jhr`?{NiZ5(rOB zvTslA!_Feq6({fC!j{WD6i(P@OJvKo)_KI;_6vR%8P`gnv=OPWZt8z|`=m-eY0$sU z%A6_8MO1lTRr;Z({QaKV@AlWf-@o(Co|@Uckl5AD9;lnzTm5z))L(Vq?Si*geOp>G zlb1VXG>vI>-8yZjMm-{w4{*g($YGK>!xT0Qo99PO8PJFP}>jvmKT$EZ+4tJ zIbB~lUQ;?=SUi}WJE6=R66?lT5}XCV4r@(jG!bc!NL;iI^Va$rtzEe&w_11syLx?$ zVM`)!g>{#fC@jv zFp$KMmij^K3+%}&1EaojjbG$-FjnwLQGP3peJ+VKbGQz5Y%D4I;rR`$@jsTKjbCKL zShYp5!v07o{b5LCLu^tzi8hD5hn9vQGa?Wn$V@0z6MEfDhG{Y{>rF|)x7B6e*HzA8 z|8Q^@$iF?X^ZlV+Zw}RCh5q{k^}zn2zUFOB#k=C7>D(M(M|HQ?pzqP^#>J{3zI2+# zpTj;v;-aBlvzCI@k5oGk@*xH{rYJ2kC^ zoC55peWG*M_!z8Q*vs7cmfm995Z$Ku%=jONH<{AsI8T+bM;hhR9A#69v9l^m-MbyBXJ z&}yd*hAEt?`MH=+{GqP$!>)=S_tpGxsP4N1HHcjw4%gwI(5^$Qg^_^|wWV(=3SQ@D zO=cM;^_mHt8Y}%_lVarvUouYTj8K?^ROT?9-NsKx6dK>Z>u)zMf9!bmvAg-r)4QEt zpM~o7IDTf!I2K93I~9l!D>rkH&IgW68T5HVoY{EDhn6%EPx%c1=w?( z$cQ-zGO~64&3QWqs*gU@6+ShU0y}x$7ScSk3?6w16L%{M59$|N1Pj*h_9Z+J$(}2< z_mskCMnz+Zwyo0CS(RyU;{$utAJ-*(xuwuI`i8^=>{t2fy|G+ikN)G9xX`WZ2AF9jV)s=p~r|SEIwZQ)E zp;};ncc2>DbugdZRrao`Xr?rGI>$6-(vE9YqiO|Sa>0us6C%YhPdr9r50O)U!#=7t z4DYV}`SSUHw!Qq=+xq^+gRYCGfPJL0XtJPiG$(fs`xH+;$`lRK(?(L+!2XJyaw~zo z-z7|I?Ji&Dn6}tOVCBPF;-%dfm+PF&#D#JGX5mWDSJ^fFRYx9Z3$SxrwKc1LA~W+MTMF{xi{6k59N zicB~~WuBp>w&xckx6k(oNB$G{>BiVETodPe0(^=Nsoo zub!Q`eR=TK-Ghcq|M_caoBjBUT`;Fmw=(>+6a8^m^s6`mTpi4ND2zb{doYa)L!6nE z$dSyohiwj z&C*R6loKlHs9e;Gr$c1&F`;ablRivk_LEWuC~5HaP7Z%ep&qF!`}y?oe>6V**wgy9 z;bGgwlasY&V+b<&1tZxxGrG(%g>F(H8|9!O%N%5~8|kd4MB2p|X01brWVxqc5xm`5 zWb2D$Mzb**-k!3+ne^p4Ts*P-f1u{@BYhFJotOAg;f=K-0G?ySF~8qteJ+;?G?X%s^p(@s6G0aYqQW3jbh`pV@!z z5=UipN`lNI`ZMS7KkSH_=N`MztHw97L6dtSHT5Wg@c#T!*z3Dje|&zg>CAKsUlv(+tFLST94ms<>KpKPCj=S_eL`g$s ztUoyw*xOm$5t$P2ef)6j(0{ym__3?`e`Cj`7}%$T@-eP>AdLm=uV~CiiOJ_8QYyCv zq%U#f&POKWCRybV+Q6RWK%{=Qxn@WI>g#O zdcHl))(7Gi(R}9v8=_BaCw$`@1oF-C#4bb_oTn+Q5hibpEg0pcPY5Ll@3U&{j9&l7 zWO|#E{XQ=j1CQ^k@_(o={b_gkx4TN-)|qL8IerRY?@M!L@{MmZbu$Lls94a&Oc@l2 zQ3UHtW%s9X`l*bLByty#fUR6h6-swiGHl zYxO<#rmpIYDvz}ErQZ7WJ_U{u=V{FDg0lYd>N4Lzk)0!kqgx732<-f#KevzkbZg94 zJF@*)*BFe4>FFnF1k7#ybnoilpWl7=a1V@IIr`0Q+mB@lAHtyWAXLhf9B3Q}`VQ9(NYa zVKZ+vWT__3>D;O=EG zA1=um%gLF;J}gy@@kPTNK_81fhy4*LWv?$;XXBbS-+d0dY;~Z(%I`PqiJ#gb$ec+P z0sGU8;uqOvz|OUCiTh-mc|gg=mtlp$(oLETewQh%MpXuwKT!x8a>T7g%8nXcSDm4= z%9Ob|lsRv6p>x>LIMxlG>dn5>Kb^UCD2YW~unBdu3!DO!=)?bL7yNHFDb_pokkTJY z`L_kkuZ3yfo;~u@!@D0_Ufn9+6=uCYVu_>oC+qOP#^gfz)>y?N=h}5X`|U&T1%}~N zZA~Pbu_rV7sb+^alV=Mi_~I$4VpgGs!@t!T-ezQco1OipC=>R&Bzb{`;|feYOQn#xuGh)#Y^265!hal|95EeAKsn4c1au%6}a3k zXx>)e&o(4|;UHccxyv;f4FX_4hJ84VJIvyb^F#>mGjbIi{ZS^e7_0_)Fh{`u^{1dHYdT9irIC**#A5>904og_0VJhh-pfb>_BK*- zdm^bVf!K{(CyNJ{{!mpl`}L`hFCYD7sO{VKXX6zGgGE`xri>w@X;Q75!#>R60Xqx} zr7wiV_s5RbJ&yNuhcx zTAU8(C{dQVCC=X=uym{sWjvLr8`UN-f36mGl&U(*)NNIo)=G6tslL!P;yOonjjJp2 zh%(p*9w&>=rDfJd@TiO2&FAv!;J8mWNBnUGY4N(+gv93sh38W#mpP2T+`abK`!`0; zU#v}KdH&IwXy+FDg>&?0jwzoztL>r=`X-xf+{!lX*z4wd$2aJ4NMutSp_4?L!#>R5 zj4}C$GvgfLWV&=lqL`MeW|f*ZTK#*2X*$O^k*OQY)K2CYri-%Pl;y!*m*&nEXTL7V zd7qm(ZPZRHK%oL`cXIKV3^I7QIRiUZoLU{kyHFv_R6*1 zM-$VZNi{DO`WKq?S9(cTxdsO2&E?9bBE#MYdUHng9dTBfPn>>RK)F9bzdagK5W<&^ z&|siB680~vxvQOvgGtypdVoeh$4Kre&7VGVWc1j+C)IVy>o>Xo-qQP1TL=tbz^+;q ziEUTec3#Enx9xWEzU>qEC^+Ib>;p9BNGccD!2|~@PSt6#d{U~I`M;rNJVOfu_K9r$ zWI+bV&myptYmHAFXXyLgR~_>(Osbh_Ld4&Q<(zTD+1%L@Km=XS(mulieP$)f3j#z1Wx4S z1(*u-#OaJ<;y6QeSDSxRBdSXbKTJt{lA*bqZEC76KcUnoZ`ek%@(BBKGvzBUD%O8} z;%HnMc{YksxX~+r^ZHtM=l|jD@JwWPqYUnx&zr-$P>KY8TBe)}HDh}9gi(u2=v20G zA{TXojH$w`>7wk}f~;wLHfYB*%4sC(>7wpr+OzPeu7ufEJiSgHMxUkoRKxBooa`o8-ayuBw!+oMqp7<5xw?SNR^$6~=+Qt6F!%K1oQ(Rv5Q zLI?W%?U=NsFONxCxZSWVO0zLsza`4BH9Bpv6ZxyPw1pcb>vr6hn|iDFz04_lk-76E zT?vH-)+j}Nx+Qt3J9K^bB*hI%1FS7e)tadUa|D^@GIdj_s<}9WXN?MjdresKNt!r) zwI^-y795K)f7lZLscYoF?SR9V1qym=54V@^Z7$DkD9*gAkv=l2`VQ=wJbgSjo)m3m z=l_Q_iOXGpoxZ@A{i##t>X^%k+;aPX!mS(YJY4Sihdd37MgoZ-(?d3&s=osHCDb6i z1G_namnzWvz}Y&YRZg08xQD{VbBwTweE7T>`&6z8)d1W~XXFZC?;s{W2n<0}58b5+ zLHbm>cq~2LY;0~nozX{TAc60bDBfo0PnULapvg zPsh&)tSN>1l0rHe9GAUvGv&*zw0ZWx4g+?heKfG^Hb=sM9j=b8ENLs&Tuavs?mW~~ zP=zO=&a?Dbwh8QEzuy2g3u;!+wKX_T5!*X+wf`G?@>i~~{5VZ+j7salO^xDo%banry2{!UH(!+pgK$7{xR<-IvvK6v2#n{&7OcAnfv;_d01*?!#7_r6!)i{PlvSi&HQK1`v(hNzTb8g(>{F~Mez z@wgKL{-{VaA(c)kROXaMt%1$zw6FELsSN#0mJzgP@-t`iGG}r#W=wjJpOVXmg+h4y zi^!M;QgS~}Fv)}Sr}RdX#)zr!Xu`KtL3;#YFp1I4NgtPMQB3}Lo3Qq8#X4TeCdXnEbN9NEc9mDMx?I@m0Cv@I)tlN zx#eyR5-!<--;g#R8+6@Hvx=Llcfs!HOkbx@HDs70WvcrN|@&Hle4e`4BlyxU_IGwMzgv~! z?B0C*^n<-ccmm+ZGxgt}s(b(Sy@t}gyAs*FHO?`gTStCk0qo=zE)*;O*aa@=e*yd1 zNLIB&#NLh0XWW8-{drJidvs!NVsbx`JU~hwNG5~)9QJWO57@`V;z^mz-09Qk-l){D z8Lj5OV@G%~GtbSK%`jKMrWFc&Q++f>Q(R&%MvZF%J2_rfit zH;xMIEh+3?o_M6Z_^)S9{BZg7#L+#2ImRx-FU+-4Fdq@|2YB+PWY#^Z_NX6CVhwcI zV(JU*5H>@pE4B<*tc=OC4^gdj&D!LjzH}>dffonOHQWcu8DQR8xAz;3;hJ2XyCZ@A z#a7;mjjDAnS2^OwjDqJ{Wur;gm?`<+*u`5DE=hM@7S-`qM-Ug9g)u4C-XXtV8}Ua= z!oqcRk;LB0y?y)Yzq@jw|NNeb>qkF){rn^+Bh|_={P$L|pJQY8`ox6}cwJ>~3Kg1U z)u!mLV|n$iu?OuvzV?lHC*5@Sy|T^a zuAAQzzlg`a;SYkN9*4!=Oh|f?lG>G<`NQG;Z%!T@*i|`EkPGp^fI>X1mSI9_P$=kR z%U>pQuMyRyTca2Yy{KQgVQvfZewt+NCZ8_q zWwKtzB%<1b1PO;V%8w9<^${3QMSkNO0_=}yDeWT3Fgmk`_s<;L*I!>TU0eX{{c;ho z52XvugJ~=owxyj2TeR$ZpJe%(>V`Cs-_#~9-KMITNehQb@U(Bp*V@w zEmW6$yAY@gAefB%(v01>BMF+HLjlQ$9KFwYhdvL9Zj4Omj3)wnFOk$oBF|wTpizby z^f3+_4iA7Jk2Deq{ES34E0xcvRd0Ur_BrezkF#|uKND_0k!^s(!*I6tNz%<{G@XS@ z6Dpi-G)6Cr+s5HFq@+GfP3cg`MoJ6c@7ek7@dMwVIy`Y`7k1Ii<`)#NvyNgls$r-@ zwiM`THi0q+Qmz9jdpn^vUQij$*{jf=&oAlNweONjcOjH;Erxb1mNZ;a^R}x&n?{WJ z(jMCpadk~z=)kgY6R!yntj5j<-#P4%H<%mjf-UyC(Bh@jRUNfSSe~@Y3 ziWH+9A?~U@Ob-4dlRCqc-iTb~O-a#zoILvR@`b-&J^$0$V`B$)c2*TlX6N7`^%13V zKq~EG3p-hY=PA+~F$|f7H|xvol%>8*n^0hfyqRttz+D$9w+XBD736I3EpZA3cDdCK z9I|Qiydh{oN8_3%qqF|NRhiswb zz}ih1io|j-sHC8P#pHs(+8;$2o^3Ex!T6IvQE#+Qgtr6x5to2-eo;?Dq8cLO+Y^Xg z1hcop`pKlZ@IIc(nBZ`x`TTJ~I&3UmV$LMf#WP|l4$U_j&1)knlZNR`0|E;i9?a*k zk7eq{v-IN`x)FmK_gvVZNIZ}(>e9$3^0OcefIOhF*fhMa^24PQf4Pmd)fe7fI68Eo zuDzys(wH@>HI68?y&_pBPu|5>+#pG7oscNHF_(H_2n$BB3M8%Y!@E=>Y!9#vt`8Js zY;-Si4$fHXskU}hu8iR=4uB|*IM4NzK-N@Qe^a5v^SDLMF_~L}_l5d4sKqa}BHT<{ za}~|m5HjgI%e1Yf+LjVcbD^QBK;N8af*3o~DfzCp`l2xJYED7({=*$-kG7sVR2LOd z6&7;HEg0)(e>`$&vgSyNe~AB@jS#fcmIXoq3!#pDZMbYr7_L_^oXAjR1G|1}{EcK8 zupf61#wOe6VKI%-iD2HBOdm+5^pk(hWJc(;NoLvDenUyMGV{!$Wvm@C?^r!xG>d-&0oE_R*F>`$P_g7AV`A^r+zBzYzU|$Uu zMULw;Ml^;Yxw=~@=@F{>M4F3ne5189uwy+ec|}mdA|JYK2+aoLb-wcLalpPSNT^@y zTx0`w#Lb`O@a9T@Q_>N2ZKYxA;mg!iD7cu529&0@z*9p0Aq2 z4)VWYZ_L*Ldx=BRE5*)7wFmB3?fqtV#L!f@Zj=W&tPoZhIE<_K@p!A5l| za}JZChr!PQ9Ig%}OhvUP8RHvd$QP|bW0v^EW9ksI0M-H6#)G1_ zer;%#C*8ExxnP@*Zlw#z3zmd%urK#3H@rw#fk$TZOJ3&WJTe%H93zg!aPG1Qtr~ud zDgBj>*PJ8iDpofaD`8E=+QuTys{%tqzW!C7akn3{JLB-JlDcaJRp@z*-oM_nvvMyv z;b36!`S`?2|L_k-&Q!#tQ7p~LdE(+7X;$G_?*QiP<-V*%ZW5b7^~PA~>hL-2l&`Qq zHsC^{0NBAC2_wZvZ>yhT@h5BtRX6$ro$$4ihYg$=MoP zk{|3_j53J3v@+I+k}hl!4>;h-diy zpzs&b32jLv+~vCw*eO(;r?5Hf6D;-=hdaejpB9KvpMg!{j?Wj4pvJ-%j!PuCkWMP( z6LQ(43Mw+yv`#anRgbF_FcfFZU2K&K+Jn(7BgWpxstW&n>fp!wS1~yA_WYsoWA)!& zIQF0Sul?=j*Y8gs8n3TzFUal@>n8O1OOf#M9T>3 z3U9iluWnP2WZJ(sewQFL^?vCt5!wml9uj$gN<&ot4f{Bg^&9p{ zfdqyikEX*Qi-Yb1Zm%FeCNe=tlADh@!11WebS3aW7##2XK64PzE!nD#E1r1CmC0c~i z*TjQ)l2s(Ir&#$Jwm=&bROpZh%iQ2xVDFW&#zSl4q_mD(FXO=D?H zIQ%3>FwIK`bCku9NumG_=Ex+c#ZsKMFnqwT;2Xhb^N&Ni=+{(VBK`GlYcwL%%w}eM zS6J{CCUz zLBYP-tJ+^S0M}@P0{$_ujt+R0ri90VK z>2tT3-#aLFxZX47^i-CfNu!@iVBX)P#EDv40T}d=?fwQn8#RekNIR1WwA@) zs>FkCLW~#?=R2h>*&(oYmsmIfJ0|yG+AWb-AP?qq*vnj^FN9NTw)vfRa{I=5ufg#yUqyX3M#li_tqQNO|Pn8j)oruV2d4IKWpxI|!o#gVtm zbDnY3*lC=CX?^QJOblULSMpk7oJC}kO)NChm=XeZ{c5igr^L*SVa40M=CCU*wr6di z3Kj+@e&!nYM<>CCZPygK-m0=w4C?h%8L)S#SbYWon1g(G5l;DEvH!wc1Ln^PG%s`1 z!$bEv+OK>#c;G5C?UGx}HLrw&F=-EFdG~jph+5}JUgZDSNOs=VkTao_s%`$K>>aOp`8|z{ zZcIp;!w%p$Qeox~^b|9BCU=6(pW=(B1(G?KU<=3Yq|ojMhu-$_e;gA2Dki=)5%L3S zFBQU%lpYEl6-XG;B=k@kq7z<3#yyXS#fPSZXx*iP6i#p{+#;7rVdm*9RD^-HILK z^lSWqz0|=cdyS`f!G^reDYE5}$zOVszwlt$Z8*&pbypOfVkAG6WFW!^8WoU*N-_&_}^x_%2{KJ^ik^d0%nyyz1(8 z!^0Ql{TI=Y<-a;)bYSl?r2{)`4*Sbe9mvDyLB63t{qf3;zn(t7 zHzsj^93j&)_!LV#efs7_c{X8%0}O9Bqtb=GD*7FqW&U`w5NSE?M0j0-XX%TFC(>8? zi&pxew_f0qD6nva^Wg8YCoC;vYe=;p-t~w-Pt40H;cr~vKHyEKsKdB-Xb-(N`-=9F1Me_?4{5;2&Bf)sOJHp&%FX0d_%fJ zV~1l&W3l9sXyWr&dP73$%OuW=MD~+J?lS_vfu?L@8CrR|F2{eZk0$o70Opa zcDGvEqOX3bEZrHB%EIcKg$~#&MP2TnW)qrf6--^`m;9A8=G+Y%qIBybFdeB~8BpsM zpSLlfU~^E7Yn*YFw`k!uw3)CS0@KiVxr4C8zC4QCTUL8tq3<**UMU2fS<*I>s5MK{ zU7+eI)gpmxEmF7r5^50Sk-Ed03N;^Z-nqfz9ZVqAN5ozdX@>S3>#RQ^-tL=h?E*s) z7>1>tz|LCYE3yd_tqcNoZ0YB$@CI{%jW4jv*9K;7k50F8XD{6js|}#)Hu#r&5lY+> z_HOk$;TC!mxo8X-J4FeE=2M&_c`pP5o}<8s4{k$lufGi?i_i0h8Wnp^3m7O%wcaY z!CeW={|h@RHkg7rOro4kW4}ImrGMA4;)pbgl_SO4i)!PYY7+p1`~$j}J zEU_a#t}8L2mypm$Oq{FF45XwELkq{^K_-M0-JGS%WXRZ&z~C4iVRHKEsY4XTFg10Q z%ori13@1`Yl4w(;)Ynw@JCWfhRqkIit3MX({#bhOW5tn=)u%r0JooX))sHpDr}cU5 z9BG$OGNv(%X*GRP$^G$I#VX7NxJ#BhXKxDK z?Mup7>s{>T*x=(j6tC%%0M!XZlR^3Y&G3o_u9TwzMTv z+?l6nFVetJifJn|-<5tbd@x&mNWc|l$~h)y=HQW${ik;m(um9LnQJ_gtvo?K%{CB* zv0`ASFK}fo^TxAH7&pM~4tV<1D9Ynj*0X-3RpeP?mWu zQ<%wfATwYOkm;}?0u2W2qXhaSkugn98)wR13$)+L^M2Bne6K6}pecE$Dt)6U{ywvM zQl8f>P`0wf9emM*&IEO9k63h?Ad%a;;TVDv0~;FgSHoyI2F!^IJ%7V4v-RUFcE%E? z+%4gI{gX{=yx{Z2+d@rtUfJvXMAqIl0Zh7uH^@_#I~D|{bQM>;%FIJ&yxpYeD^z#p z$l&cAxpFXXD^vq}d%6C9V86g5T^BO2yZE2q+}TeS3f8%C*5Yw$7c7vWTZN*T$gzuN zTKQopHEpRg&&m_eW?`EFE~H#5U!kp^XjOn@b%1wS(p1z+-uzZV+!C^D%bD&|#mY+Gzpdt7vTVr&;Np(mNtM@{Z!Q2W#90|Gv} z55KngWO9@U%#r{W2P$Yt9D7LAUNQ}CKLQyHD(xitAeB3wCVDMUe~=o#lV^P^&3G*~ z&7>QKILbk`VnnDN6X{2!x+!($h)mN!O)GRs<}LG}&38#d4%5oV{HB|wW3GR4dvSS7 zK}k=ZwliDRU#RQKQMP2uI`UPhuA|b6vH)aYjm5a4{%R0xH0Nr2%X24bN<>m%+BN0Y_6q;Xq6ww(rjQ3w+C~)=!C~s@Z<_KJi09rh%j*Y z4EylR?GeD9wIi~~+NpAl=fQ2hXFVcs1w?}Uv#^Ng;gPK|k!JG$7kfXAVrI@vLA$4) z&l?h$uc%;-g4j4;ILziEv4`v*WlR{D!v=`7t~g>hA+?Xp8l>?t_BEO&9Z8i8FeH6+ zQ726}%GXTGGheH6W_39jAApGZT1b@0%9p#;9W`FWOsujrzfolqn!Ln^vntHI&SI%6 z&)P?}${a0aR!$|((X}241zUq_++vFDg9|nXXRY-WTY1+7u(&G&fSqCElI24L^Nx}V zVDHY=%wccKRdg1p+l%!e5A3aFhNcqzZ`NFF?5xcD^VQS+yY{FZoms2Ah>Pv?^=5Fx%24-408fJmKx|`SevGc(Y8rIt1j+@a+O{#N+A;Q*8*) zZw<|NiG#Q2Si2Y6`Rv@}f5<8FYwzgmK}q+5qVEUCyoic?86DLW7ul8++eMD=qY(xf zbALI%kXdGa25s09&Lq`KMP-rJ%B&vl-gEb{lnhDfK z0u_@-jii)UM0yV^eOh4{mK*!U+A)1$yHI;BBw?3>4`Z=6Yq@!GJsEGD{jzZp>%2f- zygmw7Bs6aLw%*cJo}6Vn6f0e;eF!B^;ib+Ic=@Z$A?%m%?v8p$tq%iR2QjP5T;-nO zmDHSH)LmZHm9K^M6zV&2)opodtdDLlGqsi&;N$@Qs?_*jR+2Gubl3Oik7%7;d282$ zIcdpu<#rlYCjon^bpqZafXz*(rY(2m+2AEUx4CoYH|+3vL>qyX7t}kry7H~uBz9iv zje)sNF__WLwsOl~=~cbXd*AlZv+m)S{o-!>N8AaBd>k6`BrNo0ROm0{qd~rxn$%Ax zg87^cVG1T47gAiHP%aS8&4A#{#fO1Z4yHn2_|VJXbkUd{l+;dYS~r6Ol{>P~F_Cgs zW%?5~c1rb#?E}i}=L}K(4(}Z6jj3>Ki$GLVNMGTlB-EGi+NQ5)L%eijj9_&bcHCj# z8g{iIy;Rw`?+T(8Y!9wsR5LgnaQndYmA;7Za`VOmAFhQ< zx~->bLy%!xME?2^t%ZBxTE9An=(;Wb2VEksha_GLPPi2ib|*OUX=GGmLSiSG&_gBn zPzc@0Nf;=DZ^PSxeMBgR4GBdUAMWGwp@-?^3%alY59&uAe@H4FSE>3{su8^&gO(FU z{kTE%OTW)BZqSWqW?@pVMXJT{Y_qyxUtl6`c3E5eP_>2(hPc27hLO5d%TUa`uvdm+ z6F81n4raJ4+Yvs;i*=xLEru8AkjtT0`Q5;Jz-f9oY zCjV!qtdaUX2rPZ2hL=VO8hNex+V(DkY z1G~`1L$NLZZ=wOadbw-PO3$io;Z+;FcWw>1;1hWzFz#Mx^n>u&=g~2*;uBhv;yXx5 zz}`zG_OZBT`z6#2@`QjtC`bo(z(?(6SR#cDi6tXa88lrG#?R*FzAG&JP*m_PKle>; z=G(li*Ew0!nI>TG*J$xteUCN^BNe%uJ-Lh413P*&(7=E>d6BtIh6W{=&tZon32gAf ztS7Fnxb%rF9S%gK0ejAN|2nVO3YYNQb-wu<{IfQNm$?w+>%-UpIaK4Ta&8pknoi$ri`F3Z``<)fDRmHE%^JdF( zryyU?GY;qGw5pV?#)9^YqJ6RKw56NL3%9AZMPMIS61;th9~o~_TLh=!eQMiKJm4i= z8^N{mM;%pY>x1hyhL5DSUWa2vW!}*_j)C<)@l|e-dFy?OHV5QwiK=iR;*CQ5m6TFbMWN-`QsGaAdYo)u^OVwum1&Boo}owCw7 z#nuDZF)2f{@Bwx_v4kH+mQAE^U94bj47{DX#5K*zU9>(3n^I60#rl0<$6h9^x5fA> zo&-e>k6HneNxrog9;xJ6d5BkeOYD4%>%+t=JQP;$xOxD)#=tpig$YW9i*dfZr@E5R;DAf}N<7^go=I6pN5sc~7nd<-3 z)p3RIrpBKaa2^gl%a|A-lQZDAP`DOLZ|`Kdk-l<2%#4h%h(lrcNFQ( zhB}H0C^}Y9#xisC+%sp+x}WY7a?gCYYdtFqXJ)ODA20jA|NGth+3i>r@xG_^ZATNZ zLrcwdcI*#S%K3)&X{D(yoJ9YN2X?ZHebeBC27x&;WZdE*Lk4rKPQ#KN;9tLh_{EM7d7}uyeiQrW+cbZQuT=N%f=+ z)7JdkCIzt1wwZoxHBL9_ZXnLI8m5|RSEQe6vPm6NQ{kD*a3sJ*6GQG0b^u|6IVM4> zkfL~}!+!wSaoTa_h2Ldhryjfwao}MS1Y0)rz~g~#+i2z#&vV-XTNON&s^KB*6oVj- zfP;XKZv+Jdq?dZ%G{O3C(JFtPOJtXC;?7_qvdZ&Gl&hG^Cl=kxDZWpw#Pe|u9ds-3 z=c_m%58yB4$^|K`PT-teyVTh5uB8cDY_YtynqRlKE_SxR>u6bOv%c?W{Mgm>zO4~W z!t=GYvs&$ZefQ;ZG5+tRtAd2yWDv%-or3jgwDqa@meGBL^*VTx+Du4L>~%~Mx~HKR zqQ)T-l6w#i=P5gqavLLwI}&r-!wJCN9FSu6BUuBu$H0(5!nM!MxQpY1P}*WVA~eRaNXlf@4xStRpv)@Hc@8FwCj` zz|Qj|*!)beM1FlNuw#!Q7J~viiqbgnsFJ~a!?rwYLoC-diRYe(1Pn(Vz=56P9E5$raC)D%&i8xqi9T3R{@vj+VD=Rxro@CSZp?bz47gZ~LXI`CW7UJ-PgmMsrWw zd?1qn<}8PBnSVaA^dhHpnsWxu7`D=5|1YqExh;FdceEbIBL#~%+3TXX8)B4R>4zwa z&Mg#6RQk>&N?TYOu(t-LSpu?}Hf3Xu43(Ku$IaCnBkozPz&_WeS?JPVuayBiuI)e` z*r6LOMrfj`)+UR=u1c@+{IwLSLspqvA^r})UhW)Mye_iBDT?EfDDou;zJr;e4Lgpv z*q4l>ZpRL{J&?zkHbxJy4FS&=yx-ZegErqS0m2t-VE0W&R)&A24xC7RH?h0+q9 z*65Si6-sIi&VhivC5{Q~FnYa@T}3@T!2Y;HcSA1+`6;9PM!o80lOCrXk$lopJ7&?X zNIz!Lk2mUzHWU`F%ZF_~RJ1mM=74gX4SO|;oZiW@O(d}&maV`;G6Ilg0Tdhi=O+UYC&OxCLuWbJ6SKnqKOb zft7r)G-0n#!Jc=OA4Tn-hi-XPjY>AeN&|C%9i2Hi^H|&o;g1M4*!MyGODM7$Y}^(g zRJtZZ=v-3zW}_4-_llQqw3YR=?!vs6KASHyGq@#1L%XG6|dP6K3WL05|bcDm1l*^$ph5VXUGilII84Y9g zMrhpJknNF?=}yddCo=tV)BhAoUAG0x4zQaEHyU*zOnp$1c2faHa_rc}0oec!>^Sh1 zjwulSh$$O1CZU3g`Y>LgP&l<04Y2DLpTgCCEFXe6ERXI} zmcNl+;$Bql$zZ$Wi@X>@?>xAOz{k~&z05tP+BuZt7GVw}?a8XNWA98RL%`k?ks)KwY^QNjFR(FZmSAG~a(Q__hcn3M4~T?A5^=vwI-rnW z(J1@1s;jlSUT#NCOetY?G!fo|&Z&7YD*q}H8}|fmL_;u5A4Emd7xk-P+v>>;(L%or zSdhV@8J{*wtM%9-VY5B7U9}_mS&N18(Y6PZd#czg9pxI7%LHyQ5Q?QRoe(=F>byz7 z-X5IWxp_-ZNb25L!l{gc{+x2So=y~suhZo-Y{?^@{ILkNapgmS4Escf8Lk3vcJwUo+3~Pv>nR@J zltvMRBrv~=rZ@#s{W8fLQy3eGbaw(83(?Y9IgXK6)$#*E_IDV4FuIE%t!Ag zmIAvqp463+1Jws5Hijnm#22+0m-X6YS~}_$}x-H@$cCoc=&nNFjMuMDFUSN|zJ} z%MtV;g$+@3p+_n-@=oA; z#Nr*Q(jlVy+eo2fVuNp5S47_4_{?L(!odRCR7u61GPX?&-fcSfCcO+5+B;>{KUT2s zvDo*kI5TX{0}dCK4sgJx)X38d=dOLfYlloGBa_PmV`$zX^bO&7Nvy*AsTYaigdV&k zI#xD?(8H;ExD{@Qw@zDZhBB6Gg> zXKYAhd87k74bGVk(I5}(%7Bcvh9r%Fq4-~k-ikI)&1ifH=^X*YKd=yOCG zB73akY%kML=}W@kK!sZ}5em4x-!#SMOq&&|Q*w#p7TBU9$m2(V zpAklHa1Vm|Fqq@C+l+0UQJhT0_!!$Ai_W8vRU(H(dn7DzOunhzF@^h+NN32j2^#%c zG4pOQ1Ac&bOTxPnjH%&VdbgzfemUzQs|I=dESn9@acZ9MxeH>!Q;Bdv%zq-{LHOdK zTn;@_$>+7Id9(UOo9WdqY<6pZ-Piu<{LW9qebCZS-}313pRb?$G=1sS=;7t-C%;@D ze0uiqS*5XolwakSlKG8ao?~ndJm^-1<$N2CULdJoIvSI@V;Q^2m38464dKL=IC4X9 zD%2j8XAR9pV6XEhA;|0{RlM1`>$a(GR9kadQZgtO42bwcV!?=11Pf&t?;y5csH!?w zR(YnR`~;nOluAERKp*S5&{1v@CzJ}~m?P#sMJyA;8mx_}ESGrMrYvAbgehJV%vc?y z49e1lQ$QQcnH!SeiTZzDkt@XnT>JsMJ{Fa_*9&p56}EQUU8b%XV>Ag}XG zY>%KEOwKx&%b27yrWnQ3v?7p4&HNsf36o@y2X_1F0W5vM=qNPLWdr*Y5rFgO1suB` z3%U2i;u)#b{u%}5@3vXr?rZz`VCSz`C3fli<^BUdUp)xsA0|#MO`Li&cH-mo*~N*Y zAIE<9>(tdR1Cu`;Idei}6@_JItqD*6CYbQ200_U@==DYPMkn6)IV@u+(HNX!jmffO zZ;PZ@f-^N9$@WL;L2~u;t=kaWht*Ys%1T(V*|ATm z6(<=b$7v-O%!kz^t~|N2CcLnjB0a6xPIHW7c@ryK;>7`(>X4iYr|8131IYj3r3%VY z1d@Oq%prUM@^E0rX~#Bac$EXY-H_Jy((04|^0k6w8X%Y`hIcw472QEX~i6?8fEsmn(EnV*vYaNc-*H# z-ZK$@LBO?1$bKr~Jdy|>E2Iks?zGrR(_VHTIxJF?Y zwgVtzACXCsJtBwf=LxQG`B!SVKUA?VRPCMcZfYa8-;S;4ZV8`GXu3T~EK_1v~;IWbzPTIgO z@mblA0bsXo}C`uFRrf&B4#?^iY=(dGfBTG8=cHMvsl`|wED1gQwYJ1y>WAv z$&Xkckgf9~0Q(Tf^r*Q7L1swBnlkbybt=0iw8{yU@(=PuBFUgoJirz7vw2vJq{|c@ zlx}OI>&rIfmicDZkpx5ahlOE<e^23qpI3Dk$@tAogxKZTJvgp3Q! zp;D(LmOK7S65Epq^0rX39!sL*aVJ&dmMr@&PVN(r4oR7JD%&9r@7*%zIHUo463M4? zN{90Dp&zN#`!w1^G>p-T|AoB*uHe9q8zo$7ybw#k9KF^H0t6h+Jh$dC54TJF7gEuJ zTJn=l{=8oErpfTKtIm#n`EbYb*{#sqi(B7a+V-};_ubVU?*?})5A9sMy8Yw$-ruer z`TNx2|DHJck85XspC0_@ZTJAsz`^o-Q@bLQQsf+(w=NKsJ(*9&RzjuHH_aG?OL-#9 zj*z-og0kU!V(`h3VJntL%r$BATx-j9opwM`cFQcnRwHQ2pqbRGCv=)IjcQb-7*Wbc z6v|<_0uG!5A~Afe%YyPs0&@=tyE~bteCNcPpuDYg-EmPD%QFQ+u1;GM#)PHkw?V+J z49qHbOT(Lm{S%=E*wG3O>_V)c^UkPtO<4)@aVX>9Zk@9+70gxsNtS55?c&xx$yV-g zvbE9fj?V)2;rs$S_6H2cY$0vFhyeq31er%=RakCAj6F;w2z>eb;TxhIDJN7sGn%^C2e|x$cT0GyqbfIVQ^0uWb+n26xe>>2-G|>BD zY|q~&4t^Ow@au5j=h0(drhfRxt%3K~M*nB-{@bx}(zS+ku2cX!hGnjsbda4qu#aoi;~LeNS~;%PjH%Qx z_#KhShs1Ja8b9>keJ%N#k=FC<&>}$;QxR8oz5RT(52?Zvby3_1L^0P!p#rH7$yfSk zp=4*rjxP{uRziIOunT;%I9};2H*D0xvo#LOJ;5BcdaX~aAt13mwzxhhSLBq+bx6c0 zVoNA>M{M@#+{)p6239xXx*y9O<_ekf)RLR%1b}xIE|}QD1^C_ZB+mrmpM(E#lm?@zFAa*?;ZmHRJ+F|DQdao7X{oV2I?bKHf+km!&Kve(VJlWARZWdXIq*_<+4F#Ij~==(?OF) g&4fWcUaJ|?si9G=YD}jc)oKPcs;er+6}jSn0rPLRX8-^I literal 49167 zcmaI8Rd5{Gmah3Y_nzCgyU!^wGh1d`W)NAnWs8|v7Bgdtl9`zqm8=9Qg{c%X*)F?I z_w+#;X|NqOq@bJHQ zO4GNxYriR}|HGx&@k(d3WS53IW8tl9xem&pzPXHFlE%({BQH-~BDVhzhw$6H@za!M z+a+DM3wK<~!%5w~SGR7HEg8k@R>iVOHqIx@(S3r!cFAbB0@JT%kW750l}po6ae928 zkvL$&cBqFN4I_;+oKZ8bQ`A*qr4BA@IWr2Di%*=vw>l7&E@IyVb&!YXVsy9gi9{KL zLBSDv+B!iQ$Q)tB9^9t$mMC2igapa3b8B!T@X8z715jWq~+b6%9oc4!%t>E zKbaqKw(#|JP)78<)QH;&5#foE596LaeDnBz!t=-Z@82}#q_yN_RDFoee*SQxGrk;ie{suz70o|q= zYEbo8`c`ZB4^j;N#{v=xHj#gYO<6ZH5q7`)e(IHM)UjRZqRN zy$YhhYb@e76$@KRM6IR5)&g#04!t^sR348hj74O;X#a4(F8X?5#JSR#OQmmbmb|%< z6@4%5)vd&r50YMm1N`U*x8FXzmmdA9GWmUNdSZE8bmsGLcR}K2Tg4YC{{L~wK20f> z#uzh3#-g3Sre=5;L+17hVQH!$=Z(5NWe!>QcNuomDPFbm7ftLrEp1v!n^Dmhje-rk ze9<6UHc5d0goFXuA@g;l5j%%CCSZ*#L>?*6#3TWK4W?T=+AJTa6}6X4&=C%DpJJdE z`1=*~NeOM7M^LmC8v84qt;dSI0u+T^<~-Ojjn z$En$}tG3M2%`r)EQRw*_3i`5`w7^FC$o&)84iCD`i)x!dw~u4{?5J+bNQY^#)re>^ z4K|yHTdbpPrlC4rf0eSUMADkiZ_K1uCSnU-4`sZld3(M7{mt4B_bcDt&WXOC{_b7NkXynkKv`X%tUq({$Iq=C15li>me@`QBMt-#J2Y0FZg zmo{K+FB6p{39@6BWr6%U?vhEk1}oYOE+m~%axF|8 zB)^_K>Jm`xQvRe)F|C$ZI8+_3SBVUokF39j*IWSq{Bi1l3Nnp4I47feMHD9&uj#I| zjkb6gXa{*%OC_#3EC(xV({?8rg|08JNR5q1hcGHPhP-3(t&zLj|Mip2P z@RyIYDF^GNebwTQ(n-c(h`*ga4EgU7l5H%E4b$bo^*HEQ8x?KjFqiBWpB;X}0sPE_ z#DrImlcS!MynR&u{%KS4)9##Tes!t^QMJS!-c=AcWq8Q{O*!dM&kDjf@DEL*&t?h0 z|LRnKb8A7LCdUpZOa~sro=dmyP(cXx%n}g%eW({J0^A&9c$VA;@>2!^5DVh4k1!O{ z6lrjpJTyZYnxzhV@trPAn|-vwGE{3Cs8n|riyE@nmC2<17-C-ZaCUTO!sD{2hdGaL zB!u4r#XY(obvx|ol?%_VUW~bOE&j>9)aMUC+PDXnl;_5}XM375Iby=!YBTcqk{OAN!=T$GVgZ%eSYB0CSd{+$LvqC9%-EM@Z^A)s$&XN_?{r-y9!&EJe{@Gq z*pd@q2>|~+4gGum1OG2}CGh{%qXYdJfB5@QGS)vQ-bp0yS$io7qZDY(qJ2^G4__jG8ENih%1u?vs!#$JbRyvI<-gImH4@rU9IA@ET97sYrxsaM)t&@g!I)4eWAm{C!_Ac+)8EI%J-(F^@v!n;cwNHN!MsRjQ-%xGI79A&{NDufGW>=V z2mGP`37Wr_1LhC@^F9Cn?$rmA-)juz|DIjBW0gblg9QQqV7-=8Aq1;j)G~W?nK=Sl zq+viybnI_JFVau}+UNpxWRBD~jqjeswt3Ml9#oTKsMgR`s%pvCH{_^mGFT-^$mCbG zk&g@RUr)Fj7JujZ+xvGSZ(MtH@$B8x$M2s#_UPiN7uU|d3On!4jPRF!2#i*K;}5Lq zF>}%Zmk{BV3`0gOa)tsUb&lp-S3_E$zjPH@5g05U7osfeL4a@N3<-xD@l6F1WZS%! z1Ia(9=FX~k5Q1?&1^fr<@0?ly`~!B=n%xK`82E$#1e>3sVDhiZ$aUhCU?GfXMtYn))~eay)dw~0aQkfI9d)&duVbEHJ@fWKSmoRM?HQ58k8$$8qG?j+ zJgqmt9$Xb50X{5&4H*#xFrftR>3_4J|L`Bk|3COY@DKSv_z%QuPsM-`Y>NpS0_++G zwaP}Wv5BB{4hgiz#;>w)%S`kV1EMep)nSI%HBIQ8!nZ>RtOHg0&Js&&p`js%UzUnZ ziL8%$QV9HSUyr|a?al3*5mzriICtvSi6b|U|8VEj&*A5eKDuz+{pP`TQT!gU{r^^z zKhLTTrsQ6SP_HB|j0s&*@+7Vknz8wz%0*=D(nyIPQDDKhZR+SNT8bXqMDH%fHD%HJ zE3AT1my9@P|q$)`{TjHYFS&LiLfTLXGPKiaMyY@Qbq)>KSU zPYuY)BTPtWJ{3<#Ly5ZT15(!JxOq+|pLE&xx7NJ#Gh_}kEjvBxO?2$jTS+mG8{!^! zr$@6(;5gpj%hjzt*QwjPy zZUB9A8ooO8zgShD#^eWj(Y{W&C8ux7XzOAklz#64Qid$%@R`@aiO2a~cxpWNpZn>EyBv)HGg z&k%atqb+lTAA=!46#Dz}oRscG8GeE{WW=|a7`+zufPppOlHnw{cAF5hJSGDElU$-^ zw9A4;%nN8UYR$6QvT8C+hy*qg(uhGAQJvc1)=3sJAR!C7sw91NE&&PnPb#^8QVRUsbuFT?WWqSkom|IB}djRpS8v?1Uh zAoR>(Izs#>daHrIwLR0&n9MDULnb|}inx_~@9c+L7eN1+|IIVO5KO*%G@ta+)0n-F zZ(Fmncio~1yU?Pg0mfN1YXSBn$kv(O(y8v^+0Lw)j!Xx+3ncC@mkd<+6!>*Je?mpF z36ZqEN*x0MdjV*N+)S(-(P|j&ndMRDb^2ASZQX2|6bpgB2|H*)cj-pjtoWWO4w~Cu zAscA$imAYVLc!6~(F;29l2Nwmw(ZYNPP(0RGNJTi<%gu?S1+GFdHmo___fr?@YaMU zxbh_1VA&e4e}Ojy@K+`1EhS+`OWo7c_YACkBO8)`+rZr(6a0byFHSuunEZAf!2a>gt$yUd@Joi)Xmm z(~@hiOLx~Ncp4G`zHYQ0U!6>>O?3)J)@(et9Is>a3DGT90UDwPOTbDR=5^F4`&%a% zxDbEHfAAkOeprv{2mjFwwdh7#T+~5!Ynghaby~p+@i%h_(+2sv$FdukS@b%@eBMA$ zcSA!{Q&UUi^CuC{9w$Dzks0}*E&c(qBHl4ly2|Tb6pRF&M~eA9e+a>rp0i`*f%)v) zBw#+F{NHydzBqKj5ZHBJY}zjtCGZFH+12nN|2L#m@E^$kH6a#403~2ki2KfeNlXRv z32<>sOmu*b1pf(;2SWZcJ=8eSUkm=@?)s>2NK#b3qvk~oyt`fe_;Tv?qpz==jJbRQ zdY&hjPTxI$;^yfiVJCkA-8lUdgkb)|vkBmz9kbL`Hm|@h>!@xWb6i7T*75yH)*5Zt zgJ`r@r|OI2ETu7yk8i<$^vDKuMf^a1j9|DL{6|Udl;B#7?BNL&6?)MHJ#P$;0REc6 zju|d_POAg|S=4D9Y$m{04RwL}D+d}iLrqTd0H>|ofa&sU`92wAO3imk7!zaajakq7 z{H)WU6Z1qoCYOjIbhmXyK70`Kx>CZK4JmGP=`yGF_xywAqos!Y2jK68 zlHV=`_#l8E;vWpbZ~Q--6$eHsB>#?@2j&m_HzXwJf7V4f(3S`fh4?%FMG*y(e}RJq z_;vOH;HuFi__j&ewTS;ZT2PDF3)jlzc)ldt|9b@3P|#Q)B@ zr+$PGtfoZG$33-|ChUzgKviAVklh-FSI1h?a04p#7JYPLpwU{MsLGBu z=D%{3ztN7=DG^n}#cvzpAM}>I!!~B3n{&wBC1C!*A2!0!3)v~7%As~UVR%K(1^!E8 z=73ghWze9pQ6M@1zPzvAh-!!Y2miN`5iq!bB`|N0%<4pQKG(vG*E{aCnv9b!pU*u- z!%#9lq&>fJBl7Oul<+HsQ4dD*UTP2}3+(!JaXXmLiWs#n!$SUt_-||JAb@`WmDesk zbjW_s|Fc~Sg5>{f)j;vxH%K7)f6pJ50Knf6<98&)T`6fvMi2Q9@L%NN=UHfgKSv&# z!}rW!yQYz?-oXZd@9eCwx0cviiq$nAq~)=s>{mUn!wSMLBwhI_^1@LN6yL`ePXT{0 zpKHf|09`-%1B75LDRS}s^U138UvV94TI!q_Z4u+gmDE)YZ%xZT;9zHlTY{7;vjry zu=s}Zf6p%eWYYvg0Prp9@BFt_-0%4h`~m)^gaGjOWMtqUl$aXgKgUGD=4*zCm_m0< zBHJd08eRRh0N>hLVreQIYsml3AM*eA{K5PmT{sEN4>-^7`7gYC>VNyhSDo>9eCMKq z;AZwK=?Iemv#t|t8bn_NL_ez2S&<9|Wi5*G)h2-XTM6yFt|DaFdvtv|u{D>_QOFst z8J7~gN(#V-CE%Ab9aN-)I5Nq^gZZr69ngP*|LBl?;6GsgU_l=G@C*;D7;Kv0U|=Q* zdk28O?J;?$J=Sr{#N^b<>bl1gQ$1(RKb+S++1X;&okELg8zi_|2uy$ zAISedHZLAFN$34%=VF+Cy0%DcArf=YL{c@ZQOtuWkl9FYExy|5tgJ!iysq= zL*-6f{k#}C%^%WW+a0XoX%*WkAkG@ZOE%S-Q!{TAJGp2bvDZc)m=fb=_40sOGp7-n znK%WyTZ!p`T^O7KOvxAy4o*YHnAsHHm|J} zU|h5B)b2Sn+YU9%JipoGU#+rVEYdG#$)QoWtL1Jgnd@@;wwk@AVr?iG@ckNW1fU!% z7@#dKW|MvXoa(k{(=5xOcfS`VP4! z%SGx~6rq6su8IKUL+~N(4=jR1tMCvS9-9QiGO>FWodnefaMpBQJj?j_^No^Ilw#wnUB63%anld~_89LZFnWfWMT< zHb`X1mb%yXZUFquXSci3A|<_5vz$TL>Tb!g+X`F|`)`Kx*~0&97k_a`zBuI|fPXly zI&^742je=(e@K2fb^+#lIv6!@K>$C59YPQitcB1L0P?U3KmdQ8gipbgzgzk z`xLU#H`*{UQ0eY12l$reY)E^3b&|F+LGv+QQXauAc!EuR0Q}3t&t+cu;q{rHBaZ*| z&-ip;Kf55Pgd zIV8Xy`px$cz&D`~tV*dX5(>ayWsE@b`$;{s*bX1EWn#F_Gg#y7DzSGI0eoY9x~?iw zUGYI#76%fQzGUY;LMPt~@z1*Y*6``R@njmwnSS zj&Zxq3!3)M_@@`l3e`YMTj7V;)QG2V!p>C0y<{~PI;jJzG92{z2U_yJh6Ln)u?YeG zH-{MD|LRu!>QVpQtNG&52IVz;_UI2?dME*q{~J~X;0+mm$YkJq;16rzdmuv5fj?aq zlNW`=HRk9FeHfB|j?guQYV{5`x)Igm{gu|Xg0bdYQ$vQfIvLDaQTk3^@)jg0e$LDZ zM1^pR+dE~{h_&biW59@v9pQV)l%c1z}GOX#vb|KkslK8a@ zmjLahb}4#FxaF~u+IT{747WbnMrs?wHMM0#r9L>D{OD@>vm1G_PioTNVw%gqe_VX5 zgM%7}9hm?RiniybcjjmOZZ9Ofd2D=r zZEs_FQzn#;cJ=f$G&SaDrbRwW4!_o(lK_L$Ne*&Z5*+mae-Oa`1Al-I`Z}Qp{W4*M z5PWhQzVi=x4rF-9UVuOR1{^8GKjcgBJ^bmCh_t}R2a}&VxIpfm!F5cIHoFjYj@}Ae zcNxGpHfHN8EUVrC7+o7l$7xdmHU!e9q*uYfVy&Gfq%;5 zYq^p4isD`j)fUPL16DrKBg9XLi2&cp8k$fF=L`zye=ICKz}MjWO(X;e%pbx5{=a0_ zuKB#PHnYcMhWz(U`se3XECwrf6gS+_h3OmUEH6xc`MCVu3w&dln=v#mCIo~?SOSpz zhdK)6e`pCn{(l{p1($#aj#|{;CJmsklO_nk@A)4X1fgsXIedse6ov2nAr`O%fIlSv zJQo{GehLE2XA08>$?xp10r-~A5>r!-p&?6Glkx}toczbM%zL8=w?q8%ZXEq^`PAF< z$Nr2zDdr;i^(AC%7%}0#q`3%Ae^&I81r^`RqplkjTUz0Qh_*oMmpA5O-rqyMy-oWV zCu~lK;tLuoP0W6J8T=!hy4FnpAq!UH}(hq(ELCMAm>9S|9k$Sh47t!KtKTgp*h<; zvD=4k^$ayQ`l7)v`*)};b>l&ZrbL1kvN-I)KT3rh!1GT%e=H08h_mRx%d|5}eW3+t&-#1AZ zn4t_W^GLf24jeVYZHGe>=c`Tl%_05ODf>FE0R78^;a?|>f1fb@>NS3G8xNhjUAubQ zss#8zIOIZ*^P#j4k%zDFBg6&DZpeK6JX~gZc}d4^)9*{mpsCNed^&-$lN@)){f7{^62^r#LivENDS16jx&UYM(^XlpvwBp0t9X&3jmsz!T& zydK$Q!4G(u82Dv#LPYhur`)b;0~ukY42nlvsT~!d}041@((d2Rd+Q_iXBI zvtkpb%?1Iu4OkGEOb9-F6XGBGCGdyN2lzw&ga5;vZJzL(`J-CggY}UAA^)+o=9^pc z%uQKPf}!n)<`Y^V2*G#$sMzaWkyjfZpUJ;-D*ftDu@{g2fj__pZD{oCYTdd&EnwO7qb4Q)@elKU(FC#$+rucZ6lEHR#PE4O<<3Ip^nn$z{5y+CX-rNuJ;noQ; z+0I5o{xiC(6u53kemKDa{vL@GMsR+u#w`?B=_Ch>>Jc!!LZ(kCG0;hRE_>PK+zc#x ztqz$~4brMCt4q5p(+hHrh}_xUSya%R6x*GZ0GFWDy$!nV8f9CBw5e3t_R&1p1~)@i zVOA`}u1WC0Ygby<=P|)Ihx}h$D!6m<$qLgR)uC0nZ&mI727lcU-1CO`hn7GHK9Gk+ z@q7Nz{Dk-i54lLcH9x=k|M);{sQyCpX=^XEwdO(yjI}ADB>*81=RW7AKO`mGL%#{@ ziN4*Gb=@$Gl-tubBi} zR>`uC8Bo)f)$|~L9?nS}nqXm<FRCw+Hdm-SYdyG*DRQr$ zIRr!d9R=-^j`PVR{9+a#7{!Ms$-$WX(5%=uEBD3}J4V^IK??l8TM&c*1lU2LeHr`+ z6#ax)B>>GQgaG<~M`y94Js-9Ju=x$`zrOP)C*H@tyV>{pM*GW4 zWsfex5_oszMAX?I@16MJ){%d@dJIOOM}YsOW5*7COS>Nb!Nknh*}x~?_=epGmkGbl zT0VJ{TUH^M&!Up*<6`Y(golQLTD)VFZ0SY7A6CJPkZi*B31OH_=qI<7Qd-NHJ=I!R zusZIJTLb=M=V3$qXOs#%hixL`z=9zEfj^kfw%h(~bvXdFmoEZYE#ouO3(J9Ro!Uwm zLW2aO!^1UIP;`v=p?MB|j*Xk6jd-vxo=YJ8Rg$655W98d`SN9z67QOtx>21{GtD!Mz>9j zG(rFG8mJoYE)9m@H~yjhZ>R)7{_`>(QIa0u-`_^Oy$u#r`Rr;*`1$wOPQ{%6`Toft zL;SCwIQsAW=eD;dR(7Wr59d}lUG^!pd=?Ia#&!GS@--6=mcX2xVz9w0VF>x2N+NXb4`Iq?GDt`S9+d(0cfr3hJ>>`UXVQe&fl=@umqbKpYZ)oY(xUqp z1>_|mWfe|9m?#gnSKCzs{3*rhqUtP7Yl(BH5speXg@k=MZC}X(?WuYD8vcP^^2sRs zY*KQ0a%YT>NPO-9VH(ZC-B@Le<{%%~v*4hGVI z?_+jVF*+-Ghz0|7a9YJ&flF~V*{W3v{SO>L&Z?9aCPRlu!4iP}2bREr&poG8s+n{J zjbhar7AB{ClXKudQjr#<7Rby>y@|ybs;(T!PgRa|&$6(P|BGylpMiw_2THKGv5Z-f zL(O@|E=rVEXPY`I+@o!N${^fN*b)Zy^f;@*()& z`NNOEKeRgo3xX;P^Uu)y4Yt5A{DdVC9R3W~h2{_7|4@Iye4z3||0yks1^)cZ$F!7S z2^fukF!1J9WAvS>=hqT$oP`qb@XQe?0l(+J?f!oCffLJopdf z|FlXC{ZEL$7Kb#FunsmE`X8@MsG|~~{{jEmT3nfNdDSX|T&5B7lwQ}|yn9M7QBk@& z>NC>%^HOw}0WWzNG)*3yA|brEKFeT>qOD3$S3Da39F_PIpBBw5h?myoTl(sz@cnQ; zzQ(6)2x(hV_O61ruNEI@BzxMRVC)PQ6mpyI{Ncy%i{cObw|Usm{5d!R`j7eBc0>2NJ@b4;|Z5&Ag92?k+~Pv5uO4jlFcrNl;q9WHT6 z%hMA&yK`d&10PkGCI@S1R!&;daX@}0XGY3^>(Fo`*C*%LI7A&CZ(@_-Ie>vnS8><| zk#Nf4-0&|(;M)&zg+Gh~W zzTR4Q$45s~iM76vnw>&Oi$}&q48=aj#lIAnqJA;F}#e8ytD8eD}zI zxp4Gv7mxjL_T-6kr%rxa+}@d8J(vvu|J`Z#yjctW@7Ie0Iu7h%;acpfp0}nJO!LTI zI^M@3?O4o*PRFWV<>4}Bq_j=5)Wb(nTM7Wak=*I#A?Fn25dQ@gcTUa%_;4c^_P;Ry z*HEzrCeg@a0Dp&CwdirL&CPo)Rxwv7Wb@5>3(VXWX7+SSHwVWh3=r`Rts(wqB*Hz| zZtrcfw|}&@mOEO@K(@xxvD!jbQ7$<<4fP?WKl<5V^g~i|jI1IJu5H7~_%gYFok!Ra zQ`hCZ4F!K)E!on^0r(&ILqtGeR)8J80{Kk|1K`8vVuers{rnS#&rpAZ@PDhnkpE!* zFn+1*WDleSNX2Dvw=WOex60rMw@Aebp0j z5ApgDG5Hlc_noclqi>`+KpWl?5H_XkEg5H3Ay`ui_m%AbUu{WfpbZgaT}WONkXCqv zWiEb+gM;}Sw4eb>-|y$2z#se{MxbE+F#mzE8^Gsfzv5)R_%r@__fMr<`{C)?zur6g zU%%%+@c+ED1N=YDFMakeAI?t#|5Yp87?gnd!x+uW!@|w{O`RA*upnYhGKp(?-7g;Z zFJ31sfqSuO6OJg8}{Vi%<{ z@{`1sx!UG(bwio7s(@cz#raslD9Xd8CnG;Zj>NqJ7ow!bD5|q89p!LE0TOsaOx=Xr zgA(SNl(jEogmfTh!Z&+T`mTfqYXnO6rho+N<=?Lt!X?k&^u7O|#dm(6KZp23{=@u1 zQgIj3Py%#Hy;LBh;h0LH zX3}JHstv-S0Yq6bsj5gd*s1GjfQA#783*Eg%u~15=(-v;9rfDYevqcKRoqa+E6Jv0 zC6dx&K)izY+PWN=m@QKW*7-PSP1hi?h2(7^en&*u6%+R)B=`zHZtyU0)pnhWhOcnp z87|hs&3_OywD3J#vI>rXVEB(|gZVT31B2$%UkUvuY=J}m6Kp#RV!(X(IT3%B|3#0^ zW!yaS;=+#)j{i4+AL4)J#POi{FKmMOKnVc@F^y&7`pODuYEmwlFcj=<*5(>;Rs?zkf8xY+NJlRE}O%jO?BvRj2&o3{aWyKLvVi;MkpFWRbhZfX4OG|=XBc&YVCDvUUbtuCLj{L# z?%@U)KEV7fH2(<}UpRtk%nbQ|sQD4)NBYJRZykMg>F4kh|L}YMkpEyozXXCM z82lfWz=A<+q@%`p7^uGi6>I@0elY`<0Qe8&e?Y0&vsuA^cC1G5AK(xE4?E?3mt@x| z3T~NA+*Kn#sNeD*_;1=Z%VUa38QUgcfd9LcVy9dP^>=d2H0>OR5Xgm69)qKnX(q-e z7ba(?oL&uwGu+bBQIOqJl0RCM*_V~r82hw3;z9Y7TU9UawZ%oF^3rM5WxVEEGn(im z(x>Q*2@2IY)GKeO;uIuNGTzcNW2EIN_Ri8dRPz$0Z=E>=dA)q-)C6Hs*xRUts>M z`k3(Voj)|61u=idzx3(FtlP&TE+2V#^1oj`@zeMGhyLg5>i*ZoHQ@hsY4%^%77l%u z88r{;@9ww~j_}}SKJ-7}KTyABc{IOVwl!w@H))hBC@3_G!f;ug%l;K80e%k{m0+Z`wY$0+ z*IYwtZ$Or0G=7Mvcz&nk@s0fZS3t#&@72Y;>`F@*%Fh&cBD6zTH-S7srnyiEO-G}+ zB8y#+1o2~HxB(+0xKcvunZv@7db1l*>+Gwt zbe0)f3iZte@O7-c1b&2Vow2=K*IJ}$E>Jh*DQdIj)oHS-R9#($rY0>2zwG_@{ddUOD;){_8U<2g|!(*Y^&WHV@_(_huJ1UCw!fZr5%7b$;@T&%B`J&&z4> zK4n$Q^sqXmRz<5%()P2zRCav2_ijVsn&@)d_<)yxBJTZMZL2^{=E zA)eDq7tJb{R;3qkU1Rox^&L3!qLP^XJwrUUXu|0MjhieUi`^iTV-bU--cFlD5KwXz z!ySx|nVgzjLP5e%YIJj4MC03+rLSM-y?mJy`KIJuVoP=ws;*Xv=riNcj=?T{M}x7p zKwq7w$WJhoXE@u-=0_m^5wI6n<>NrhoX!BVZIRj%pfs%(8fT$$M%+EIBWR zlov_Njlib9#H74HB|aXCyWbmoy*=V$?Ta&2PfzAPKAv{>hgaAB8h++~xp?X?7f$}y zGiU$#-1)z4%&zV)?R;L@K3LrNw6F{zSa;edm2#h4u;~cCQ(HEQ;c@Pofe(W?CmmrO z9#~+}c65pm|2a7a_-~DC0REawx#3onV%_h8GS0RGb&5ganYJ%`n~#ei>) zN#kNsL^_3SGmkINFZx^)T8Ui9V8ew634>*UFv%rTLaL35gvXvnM5DB&lu?m^%uN~0 zh;K|v{`lr?X`?I z8wL7z{^XVgV$&k7d3LmR5{8*=g@)QJMOhLv?=2}k5|#D}nfelu`m#Uyd22#sTVhmu za%5*}ba!eLs5dndG?W=Lob?)&6@$)xjmeJwO;MQaD1Z+_r#u}=c-a5;MrYLJ|KNWz z?e0$z*Z&6mFP;1g=-ipVT{!pS*8KWzU~50HzPGUU%hKBCz{-lvVi)ja=)nmo4=xPA zJ8^iN4w{n?Y?MBIZ|5wH1n>{Xv;o+cNtgknXwPd1Ccj(to&U-hcgrH!wTl5hEP)l9 z)^C(=%})K>-uBY8U&0pjb|E-Sf!jGbKeOnz!7E7_pT^`;=o|uR(qh}1aF5HxaETGl zBi2MDc<<>%c4#`Qm^CG&vfRGhyq4sYx|HnJ?4q{Zoc^*>N=+rLu9{n(&nU_g7bHoG zQuJl%w%UAn6S0VHU#1SOF-8`cqkhK73ac|fYxNTvXR&nv-`ihqZ!H4&!oqk)M$Ab3 zlb)D64G}kLUt9yn4mK^}H!>gI%zAt?_t~Ao7k7(a-7kx{R~~u4`gM5in@5fB9=CjW z)}8pWC+SsRN>GUS$3uxvN0OcnCqC(af2SknTJ5XzmCsJ+Jvx_1ntE*X8wPtJ%z9!P|2q4L`5u26O`01%m}m2`~=Y zfT6Do_#c=wzdFsU2I-WTF|XqvOq#%dR-AH3{w14e$;b}qnQKPQra4%Jf&aeGelX?O zTbP5ZCK|C~qz6GGv&QY-)ul~`)lDN%up?**n+FzTldG0JldEhdBA@O z(*d)H4HgoTA40G~?+TFHX0Z*Eqt)L2Dr;Mjx+)Xi*b-7AM&3PYiMUw} zxqTw>#?jZ;FMwjNoqHR0;r&f`Npv;k?$xyW*E7Sf!Q0ZJ=eI(!sEK`8`#Pw`$eS%O zcRJtR>yCTS{q}ZyOjzBkOI6R#<%XZmxO43F^&`*E{o}3Ef4y@Z zdu|y*0Q^B~4x5e7g@^xo3Krgk!m~J^kN}$Gq1>!t%TWIuoeatUzfCx|t!l{s88v6u zqhGX1mh3_J3ueAwOP^Cy7d7-%cn9s!z`-l<|7G6eciOZ(Hk(A})7aqulb#uq-U>!U z#u8x!;Tp5fdwnaeiE)KSjmJrmqb>>xZcuOViE!oBhwU}@){7e|xm6|j@=8=u>1ahg zsj*WqJj5GB2s_*8^)nKj~<8(?|6B$;?bqTJEzm{old)ZD*o=txLe2G+_)4QcJcMqv!FK+ zh3n_zZ(K;cbt(1krHltx^PhwjzqnoY>UQbNTcyu$7C#Lu3O`@=;Kl$qXk9W`fbnE2buAMjv0{(l8+h9JB|KLB6|JxpyPo*$3 zNmh37K{{L%ge_Q5oKY8Z2>4GBFq>-Wzj+;pE+f=m;J@iqf9LNXgP8+uRz(ROpXr$Y zGGm8R?`5lI)vkj}4k9uE@_%t^e$l@wm#9aFFa#{cZnDDu7vP)Kx&@09xY=Ff>+)>MH0p4YcZddP}c(0Ih^bp;5BFZca-hrz{WhpP3d* zOOBT1elS*K!kd&;eD^jNvnRl>3keW{6>9H1uFVHG8M-PA_4(rBB-kvY-aT!8akJ*( z<(#``GH#wog5!)FioOb7Y=KV`~kFFFw3#)i_ zt2+8#ee}KB$UBuUu2(#}3J>n!*+t2tix7p%XP2v3;P$07Nl|AFQQ_(T2uvbcIU?Sm4qpjUwZ1AO>Q3`qV7K5m>bXd(6JdOA!4 zJu@8IHwRqpuq_9MX)ER0O;ni%|{si@Q5y^%W2TNPc=sjItmR>hEM<%{s9cl7AP- z^RQq+tMITL#%PFoOIxY3GMk1lt$`lSw}1o|1S6m+5z$WV*P>cvEe#+C0R0l;5lVtm7$=C*2pFRUu1SJyLOF4vAwj}X;F z0xSVNa#%eyVC-s=H++QR3l;?aZ?7wu8En`j_e1`J0RB9Ec!dP~J3RfhV=cw9@(g;$ zo1r&PI$zu_xqBfm>{R^Kqj8shiU~XN=GO7Zd#57qo=gurk$UYIJmUgo-8^3S;2b1# z?W^nUv3GjjhmWK@!)8U2a-)ekQP|AqsI(`wZy#5^4ljFgqu|ly{Cj6Wh4;?D`D2KG zeAxNeizl9)IsNFw@!Q8v-aK;raCIH@X?f#tY5j11ZEt3IZ(?@GGp#34lo*^>NdM%u zKpP2{`8B8-7ko4XvR~6$JJ#Q}En$BfQ^H(vMb7@ku7PWQaM|h0jCp@T4{Kq;BAPV| z<}5-me>eqjiWqC~!>}fKz zRI2Jq^ewQ5ZJNdnz@zCMF-+KK>pbEz3%iN$4Gg!yixqHwdeQsQX0uY- zyxe{-c2Lz;tLG1lz`EJVHklf&%n~~F3-7Vy_O}N(yx*piaDPo+%H1f z0hi>b4Z-zD^H8&*y+U4DBr46-3fw@{yRUC!?>Ncy#6Hz4Jd@ zJ^RC@Q~&&FZ3FaWbqhl9C9nxg;M4R1gkX%u5FmyWsJ;b_=(9(;qGwGBhi1eh^9-D^ zzg64QG)+Y>i|BJ~!VI4THzMGJbl~F@_T5_0*0>4|f0u326}t>Z&~OT{WKnO78%<&X zp}&VXiq*^1BEC$>lR^m?=pE+JSTo+KwfO+#|MK+sgjG8w;DA1fIKL`H-y}@nzsAD` z7$Y7+-`G&IzNt!9S)|O%mu2UOi!vp}S@N=6ZFRA+xf1e!a-?e((?5$HSfU`e1(YvJ z?iV&nrz?yPieI>QL5R;oQoc?wcwrrWvn4Ab~ zZsc(0^TG6|{Yj5I-ra4CxbgAPg~B^$Aq4Nv{}6ZK$Ix4($Cr;jIRE2~^FLoZ^Fz>l ze#ak{z~`9&gkVA}1q(7!PywwN@_*gL4Jfh88Ul>aU4$V!1|B|>H`M$^31ePFg&RTe zSyJ#>3ZeH7+Yb12Dd~z?41(bU@CX05@+i>!2#7ePKss)+LEF>a(T^O)T1<|)$r-&; zD`s&uVwpk6QnJW4BF@90?sFNx%7p(SWq%dYH^n5FUe2;n9`b;5u*1+%H&$7tD=m|j zWP=ptdBES$^wHkc;2r9iM)d|rBkN4uzJ&2jBlxNnz!C`Y_YXF?+sYLcX|%Mc{dmqd(&VA|+}dIdU-h85Cmp@E`aHpx&fM9q;coN8he~cBL%*QqkRW;Ax=O zmySdK^XTHw56=B?>nuD0{$YQ46+Yl7Xghuw<^GbKDo4TD6?i1!DtQ!qyQfd!r+uk zLqS3Q&pWI(-54E59vVP`^T@<1C;>2krsB!OQM5`ZVIc>E1mrl0FwJHjaOhtI>|e#q zze`x#QVN7%QB0iYWBpXrBz9oBuXm!W6U^VyUN_#^;Oc60^|g2g+JHakJO8h0{_pwE z^wrrLi$p~UgoNjvF}LfUTr7BSI_uU^F#qiPXA2)+fztUATKcCq3h!TrC6IpW3Mlt! zczyiaj@+!C!o2>9GIV1-wyAEox&o1(*_oc$0|Sb<7p>6`8eZORe1EIy!|m1&_nPD2 zWar#OT#Z^+&B%M7I*dZ>kG%8ock#p?t-5B;pU0I?gW;07ncuU{<*jY@DJuz z0si5Xf6MOlYjiX4fL95}h{0PxA^vdZWQtGp!e=0;H~@S@FN9lIE(Qv|*|W&MjB7#g z4g9qwB^z!Bf%(G{fZ>l%C4fgpF#nNpMYW}sL>v`1Uod~*bHun&44cX{DK$2oQAWfV z*t7tbyDAcW;xG=`^e=qsHxXk?LIy3#DFG=7j%5RE{5pxSO294ShCoZ$!9@&W4&6VC z>YG9LLH>jJY_bUlQf7$%o|Li5!TYJB-j0vPs%&QF>(ST;%`dN2g`ds8e+v8u>Te-* z?2&gG-acx2^Q0#7e%a$NSOPis?&OExFMA!`mXX$!oBuI6HSa?_sHM2DJ};*sHL)h~ zedF7Rs>mmm55tOYUo3icwlwNOsgU5#JS65%t` zW+YS>8#61VZJ5OH`E|1*3S2}4+VEZ#?puCwXkcAHMF3M;RQLDiWSAd*Gvrj3Vkc*djJkVzr{VSLCjZXt@O3CmzJs=}5 z0DmC`w9Tf2b{Y6h3K~M-NA}Gidm#i1grOz!=oW`~Afo@G;{9DGg8Ya62h4w(fUwpV zD2kHs@y~i+gjGL0S9a$_&Yk0s|G>ZK>6N{c6iby)7QT~O`{a0}?1i&9&<^ufS`wKn^uEXtc7`t5N78L{Vrw2Qs z1%=}48}3>pjchP+pCrs*Rs4T7NdCQ$Nlh{7}$4p`NJ4pVvhZg~U@y(+E zAN(Ku2lBuE%|n=QA~N3gro^d%a$csmYJDRX3LBRF4TKnJvGxYzhRb+ZlAbOJ-4SF8H!JzeeR35GWW{dxifP! zxWuA-a!KI=x&0g^9K&2x0KVXCWtg$U>e^y-oQeCMW=1ZhgX;{^@i6alV(@NJ_^>R# zTjE{Mqc4?uxj@^4UpQKQJ>6T9^ivv}dTQ&q-HaiIfY?AP%P4QF>e!y&eY$+!oZlMi z9~u#2e9+Y4nD~^-fc(m1{C$A)8=v~h?7kc9fn115=OQ9b$uR`xflj)k^_+E7p0-yU zwpK!RyP9RB4jGe*fBQN$@@abX%bfJ<{K)4iKBhYCkgDbya|SX)iQ&$ruKL;5su^}_ zSq>Vh4r+-uA2OUZ)15R*yo@l_5geg!MG-OUG}sCe8@pt)nR+}A+i0OPQ2i=uLt{p|L2)8><}R+%02HRtaX-* zSEX{2{kuaPN}Y6bEI(%1A~UR!=BS=*_fd&|nWs@#tQ#jih?N?^PV(cX1PJn?xf!8d zNfC{a{sqxdg)z}NNm==+xg~{F8L4^EL7|=w&Mt;pwpuDq8h^v_uC2y@a?t)K58WU9 zjNe6?s>fnrg{3Z3kYcKxWULANqxIE7^*@H_As6uh@_cv%!Lb(vSL4@4{+SD|DVOWDodxX@knL**Qbc9c2S7nt}=hjROP9LnugiLX3bz5&2eL^y^G`%!V?Vg|!wn$xj zG~y$b@X8>6<&q#u{9*j3gNn)!48Z{S=iRMm-PMqz?z)qnhLhf&Yaab}Xy9p7{AG6h z>)ga|^P|7aN?%9V*uE{)XN&WqsF7}MzE&j;+8}@6pX;ER<)oQzua@JYo$ahu;cY^Q z_uyxR_GgC)GD1b!5t5SR!TdOSRw6kyra3*WEi1FBu)M9bx~aUjEW0p0GBU)?&C^s5 z<4v5@esEO%n}hZbjygZOY5(A%p`4$i}&W{M>yQ>>b8c0YB6(YynljA>T4`*?rA12O)MX59xP5R zio2Re$(>64Z+hAvkZ59d1OHnA0RsGC|0vOc3T~+cEP-oA%N4!(ytnNF9Z4MOoq+u~ zB6^(|{(WiYx5epyER6p;J^Uo5?~@xQN|X9h0=xWeo7_!H?X-%l)${B$3LUj`owakE zv7nAR2ytPuFh7xlcV^ zARpkr-A|JZag_Ljf1rZvWyZ}4Q?@WXH`u!~E&X~aJ6v4qsHiMYFJiV+XT@{9ZS>0A z>XwSOapA=A*2%^qT7ku||7ivZ#t#a*CbZoWJDz$wKCuW_{LbtCF5nLeQr1d+<}p5T z>Cc0tM+~asV_aU3yq|F=;@*#lo+pO?+uFiEmS_JlJNji*c+2hCY%L$jjb_JqwRxI1 zx)@d1>y+7Q6+38yhzea40?RM;Fs%16C&zm5Q-dHl7Z9amA;j^sVmVm}5Jr9mw8VIOD!wz%FC`wjLi)2!5CXVV;y&`56)_DY}9_VR{g>L!w(KBKYD&dHt&77jtW!| zrSmpg_g#$P`#58jDANy+P}4UdCO<#!A3`4Xk07@PXWs?Jzc)EIP9ZX@E2Pa;`)G%h zaE|$uJ#OczkfOBznXaZ~O6Oi50~DmhAC2?i|A!SmnX@cBwsA-L1g?f!YQY zT=LrG2*W`BLu6E}p>FLr0pcRg7b*R9h zvC?9hsWFW7cvfbjGXFqGPi#+$sf-BD^>L52v&4`?PaQQ^jSrR|ezH>e+5W>%PO5Kx z)R9nCi_}w(HqeYSP)RUSO*B(Ywop&7`514l5^41&+~TK)y#vVoo(yucfBIeIYuh*q zS>P}kRpq?0+(k+ULcWuJD)7f96!UO)+1;zOZdBx+i2BYY13Lq~;GgTcfyb4h=XHTX zw)wBS1K^*R^4jgWdH=02d>d}0`$_aBQh zpC_dEeC83kbG^23G&`Ob?m_mpX>~Skb1`XgH*I!9i?mS2Y2#`=QM6kqk68#t!9Y2y;?->G6!jNM+8gD=MHf(!Va)r#is1z}q>)**eSbOSja?wARaZ(9Lzy&veyJbJB=+P>HpB z|5y0mZtXwr9UYC2pa_s#nlnRa2L9lmLp}lgBbTs``YEW$MN#6_s0af7M+l1e=V?{) zvN8C&DFpbR_Xi&imj3~eFF)>PG5Sv55vnBYrWO6rSKOGu66AX;HQyE18)P*%R*D7T{Lz?NIA!SL|X{h(QB~Me@(1Ld)>OCCc z>`9nM!)%#E(F=(#m?I&EeMwgtJ$wBOl$y)ur59`Cw>z^h7n{G`A3i)iK0ZH5#X}t} ztusR->(ld$#*T{QtoDKmK^K+V)>D<5Q=L;d&KI6-@1Jb$&UCgflZiWY5(L?M$VG3< zEvM_2)ppP6xaSd``bm$1UdSEVD+Zari0GdND3ATLmqEt!sNn0g#{FAL+p&r4BH ze%jl*+*mZ77d;s7!|}JEx*N257fbqQr>a2;WX$ry6(53TM+Yck@CgBb;+74i?QnMw+}2GWyvMVZY8B zNU+|UaH9{2=IYswhUH%7wE?z`f!0`Jjs9lMffj86W{uv4RZi-~*6;obf7n0xXMb#X zP1wK0>Y1UoZ}SM4lYby(EAfX46iopf67YYV9bRVk>z_Oe6jQ8UiSOT z8Sp=l9ZrspK?MsV69PKBwV=E@Etl8YL#k+KFRG+Bv`_Sl)+f*jCgoEZlWi>u6%g81 zdfImg4F}|wOL{Bt2lx-%&WFC9=K=E5ApKd$co4Dgg)HFzSwMw4UPR275y98Vp|3L| z5P*NeC2h2oj~1thll)nsP83hWZfEUwFVikx3xdBDJ^_2Pn;`^BfjUS*wzM!uW)y1p zJqA+)Fh+Q`EODbMf2|^Swm5w(C!s$j43&-D!7gon_O(9N74Bwv&IUO1O|{obw$+G3 zv5NWoXcN^a?{QL@X03&D;TnG{)Dg9Y+BFB;0Q{C9%a%a1dLP3IC$%D*zr-K$ z59}YtKg(eZchm}-D{vhKu8NRJnTMzg9p)hahPu!l9_4V5eKR?<%px6#d6@J3Rkr>0 z=H$2g^Iu*re|?pI`to^YZFOsH{qpo|Zg{Mztg0qG53sWuJL}T(+X^cd1j9!wo3MXE zLrZIAEi#`=q@KmD76|Z{f%);j%V-1mPkr4m{?|b&pneszo`!I$!ucfbeGyWj5xn^% z75p+T{yaYPIx4#0l940D{SmmogB{^Q_O~W@>UX$mclwwE>Ye~=;1AdvUG$q=6^nux zXhRJ}>xv6I#=S4WTa+F&UJyNBk-T1=4_U3wU#iHNEJ>5(#PL!>nehSL5$>%)jy1m4 z6`tmx6c9_Ui$Rv7ZkD}Xx{Y?Kl{y56??{0*h1hmRyL3f4w}(5lg;=)+TLJ$%Z-a72 z^+N0Se`WvoJBJ8?j;6*Y8B}^{R(E#7aC7mon2tg$l*3(OLd69COv2ma)AstAXTt-V z16-L@bha{w^77{^H1(Z7KFT5g`j5Zw?CsvluU;N-62&dcQh-mZYpqDkY{)De=%#Lt zOpo;qwv<*imR7?4<-~CJek%S zr9=$;*U4R=pgm#}?EjR~cucDQEBx;ywA&#nBGOkW_ltD!lVsqjpL@$;oDfMIlt zGI4>RbPzicJ?Q}^O8oH&A_DTTfABw^VgHm6dwPVkl79x0{lNbiWT zjiY%~hvKs%#0KEk`lHbu=UDxv{bTb57yP`lp;!W>mj3z@_+MP%@vX~Ins~TfZajv5sF1uS8mXkx4C(-yL)zid3|$tcCV=Iy1u=UUth`g_6K-siU))t%(^*w7>}4;GPOeVQu24wxgs%CHrn&aUt*$!o|2a+Jg8zzt zu7;_Q$6@x%DDM~PAdZY5SPYyC>^Ie{lov|Uqd8H28P z2*8IrzS}?W2L-|Z4rhl=7Gaon;zDK0N^Qn^LpEf!E)zA?;3bUUKozyCCm(McijO-9lrYQeg<8E#yz1{85Of6a zHzwz1C8I0?d91k+E*SVPbT)5x*6#K+f`2fE_pki#rGz2}{v({1@xEV&2VVzy_cZEx zSLb$3`BHJ7G(DOh6F`Y{LP2tK0JgWfh;tyo9A*#j@djtyK*py6WTWqoNwI=nSHf--(I6CKO%Pp==>&u`~ZTf4QnwX@CV zaOo84_WbhF*c5zjR%lFjNljI9HUd$^KMRtvwegug3LWe;(b^3A2meF1yXzq!fB4_O zia*bXk(*WEkC_9&|3$#PBa=_t+IDLyR!a)Tv*U${q4ZccQn*7)uyMVg9%3E{j349= z^1%b#fs*+Vb^>`gUl>39?;re+(Z1hc2l7ibDG-2fB+o7=5&*C}_^D|Ob%wFUkv_uIP=Q2ov3 z-sQIJV(aj13xx?TA(5M({(>Vy_#gp#H3{*V{M2% zE0s)3#A74lXD8=hfBF0E-ShU=K0+RR?(NDpxAwNS_t99iG`oDUb0TI5DwFdYvdRi0 z)AGYpddizu#nbcR$*!uF%AC@khE9zAM;ZvbiA8GX9=Z8|+Imi?L)-5&t@Sgr^9!H+ zwOvS(dq)mAjc&dzjaHSvLCEH2c|g`q_2)+cUylaVRNF@EuAH7)kaYPYasMj#$c% znXSlJK(BFqF6P{#vv|EBZ>1)EsVa4`G=8BZZlNf8Ha}t}Cm8qROl0_vr~3^hdy11h z(1?MK$i8@mu;Sd9v93Mg_FW-1*aB2~8W*|hR>e;FC`%&A19-1y`r#hD$So`V)N+`~cx5ck?PI(+UUUB1a>fl9#&}SGk+jd0IC4 z+5&t+pd-p5xG`R$L_bMN;Al#~M0)UiPULbyEN<91S-CwsxxYC3{OQ-lh1DT2$@-4$@N{)$b7O7uT7GkMe7?IUJ3qPr z{`3w?NqRwfVs1rJURhi=yOB81#c0W^s?03r5g4lzi`#SSm#zjw zdfQ&PJplg~4&f7z_`)Gvu?ROD;;m8l!+mvLnSQeu4xq zW~57xzg44~S*4v`v9(@-g?6ruZl0}Pp`C7tqd}FcDV9KYfCDkunHA~Y7v}@xm!<{7 z_@^>M7jmOki{h8-@>UxPVEh<0jH*!-F0R*O_)G>`HdZQ%#D)-L)$D89;AK?iW>Daum1(1zYVjWD{t0I9L#%8c zuIwHx?;I>{Ko_^0JK!H&oiIiuOmw#{Gssu-!q=^d&$5;0y@l(8t*5iYyQ}N#i%VGk z%6mq$`ys^ExbAS7=w7kB(bAWk<=+ z*_6iaotd@0#VrX(NGQ(XG*&6V=TLBBdq``$A~#)AnqTSdSOQP1t_MbkoY{Sg6B%s2 z#sptxC%(>2{yHmt85=~Nd8ealwj>F+CHBX8aHCu(Xoc`Ht#vXgwbIHr*UB~3$h6Re zWSJxO)SON%y z>a*6XQxz&GiwFMm`C;GjmtYFPw_a3Ulmk87jvQp!6=2cfXIAfNSnIA|?5qpgPq#u* z=-YTx#nJ!e${GaVLjb;Pc?;n0FKxpY0RPLC_3QO5++MLaB--j@?)0-y=OvFjbDz(4 zUr)9%r5_?YINI9So}66V+L8hM^NX8f*~#I)>}dZ0VdwPB!lCRG_>20*&1Lmco_LNw zQW%}ym|2D;P!yBVUD`O_Cs`j~gllN6Xe5^A@tSKu{@Xm-3A0Pd|8N2Kq{c^zVl6;` zKluMy%KvqG==Y`B-xgF@||7`!j zAEGe+!j%K zEAziDOn;gX$py^)?%L_{On?tEVTL*M2HS#sfPcM)*0Y4L#;`H7MK{>;$_t2VNmI;UGAuJPwgCb8Ltya09OMrQ!UJ5u(d+_La5O4~3!bBN&r=B~R=Ypmd%QSPT0TsDUxtRE zBl+#8{iCZ*4AR>;*x%Ya*xujY+=R%lz)$zedFJ@f&Pk>^i|aFj;tC>Co3ktW+G+5= zr25X<-15$v)*<%b9`gS}T>VMJ5`gms|G@vk=5Gjf59B704=4!a5C4n!=TX9Y7#+GE z5}fj=8^o5msvKcvG}^dO+eQhnBKcW#dYiR*7z2MS0r=laM-%WrmH_a_63DaEtZ_F- zbi|JH6C?!;rH4-DM9$>LEaXQo7sYLsCGS;dd;`CDtuY@V&`NFga!nTE9|*_?E*Ru9 zlNS!=2l$di4_p+;3Abg1TK5K7ko`XlHC#x;{Vq`|I=b%NK+|i!)0n2dBS3d>!VB@*+}7;<7+K z;Q!vbE<#xo!0)JN0{A=g8!&#{l!}|GVE?F?y5x}n{w1*i;J@^?!TG`$E1WO8=c11) z@9*7ZP&TPO%boQTbtS`j34O_-Fn(HyQ;&~Xx0eaPZ*enJ;$Q7-2FbV6&$844_=7p#_*x{Y`tk4ZA$_nq74ooHVN(G%D@Y^DW=!n!g432?jqz>HbrM_J0o5{x6Wj zwXK8IP1*9s;nMo){QB9##`XN>&BE5%_|nzPIv(&M9HN=(~>4YA3jPaQ%h?p;qo-avSEK6Cg#)R|2 zow{_TY~!NC>XfyLM8rG@JHb4N{Kqqcq^W+AWFKL?M_;59E5w%KrAPA6A-L&uIB7IG zYSh|(EU{57w*HuA{3g}t=U5{g$G=61H43c*bbj*J{_${i^I&B|wzz({uy!`Pc0RX$ zHK$O)#pDX)WNP_zdgW+t^%UXI%GT-XHc(aKe6X{-zrAy~y9Wn=H>--kuw%tp-BDLRAyB_HsFRX5KuLJ+nzD`V=#8C_QN8aADTUj=h6FHh5G8pg23Uwj) z+TeJ%+QFd0R=3o_px90ip=OS?PPVOHo`Ye&vzel#(9J5|T0ctvZM4C=0vmPUPYbnU zMLA=J2F6$c|GA6YIRbtwO6aMQ33cx2zZR&CK#gd@{XqIkhUEUb|b`xtLzvADufKUpQOYx<^Is@%jD9#m>eia-uU6 zlfxphuzvtDG$_Q`3h>9Tfd3T&pi4QxhYGMp0RG|W#o4KRYjcm#)Ya46Ju^5~mR3-a zlAjlqTAfwWM_>pT{I2@;nxd-a%Enb`|GbdB+1s;D?M7kYO>g%TqZ9Zm&wu42(!(g@ zt5ngHblTduR$7QT553_o-2vEPnU>q@<(sR)v8EWlL)CqfG0OPAiG@a@jShN6)16II z9899jw8FH1jL`i#-&(EF*Mc7Iz=?6i45jb*;~EiMCNf`+eOAs!RkBjPgRj_d=}k8&Q7`RqDg9?h)CcMhLUF7Hk* z$G-#@?~;1lem;H9fu+1cgY?bGtoIxKuv zIxSn;DNM|caPcpW&tkPxq^vflpt*NWbdoIB2ZtOAG3a^=u8WD|bR{qn>2=F3#Xxto~apa7d8e zn_&I7!NwmWEHtC-4B{M(T4OK%l{}!qDrpQjSHPD6~?SkwXMt5R{D(ru@FmftC zRv|^nb7ko;c%>+52gpz7hQabj(*uT*ya7Hh!V%yzf~?6trrqua?Jinv&YDW*DYaHD zG=HCM{vp%!T|6pJ4Bmwsyhj%jW>ErsFRiy|2LQr*D=+i{0WB8 z&aR(MEbUJ%UaV{b`RB_U`N^4VXAhhM&WE)x&o8VmuYiScumz`}1Rr#yQ~}-teEiwP z%{}b@{_Yu`dYC_Sb9{BUxSbW166qQM7r^PH^)~lZ=9N|DmvhLhwV9Q*3E|ujcY{TO z+^~pu9P&N8>zdwnInZ@ANI$5_%MD^f~V5*LHjU%qL*=}t6r0nW`l!zjh%Xh zl}e$-$6S+lXaP$#QqUbpFI4|Skj`5lo%aAARnV^LKLhqX>CC=ldT(gzKs{~9Mh1pwhB#9q z)&`Hd#qUKK^DUQ*!{2LG$HidxrI3KDCz0($NBo0?^^1TDIUqJJ)D?2mA{u?{vaNKI z3{~O{KPIASR9`hr?_&@uU3FB@x*KGq9&D-|YOV|LQIiHJvh4NSf^5-(Hw-4p4*6#M zVZeVnKOC3cOEbcTv!cVrOuCUod_! zII%C9gcgAR;n@7y+Rmfw{Nd{6UVeRgeuhjwEF8oF{()_;EGzM09X+4*S2px<^Lz;r#CI^rpMIwJxuM(?)5?DbJ6~sLd%OG1LC)&A>m#6h`fQ*RDmWb`S_3EgML52_)ER4(0?b)kHRFG zi2}e5;}2JmPhQwaX1F9RM4TRh22~imQb71h@IgDUe1Ojlcc2Ga0eR3qz;AWbYOqnQ zvQe+JRx7qtEin6#Vf;ST;7y$V+Zf%S!}LCcC>Em%%AVacQ6TizN&TIp+S@&m0{mT! z{1S}q4U9nrdqRZ@5cym$ZQmc9zMftIQbaf?W58hw&{hgq2!I1*{0bBVf!kGj2mAqk z3y<)8{{Z|Ee?C6E?rb0Y{`~9d&T&OX5q7)mR&sTEQAK(oyMxN7af!{{JSt~zWoK@L zzc?;9l<>9%4D=A4^>(6l_v zw=m2!(oQzgO*GJs)KL#n|KO+kULkmZXuSdcDVCbm0S-9B9Vtu1BqiLWpu``+5AcWa z52XeRQ^TMFzzzZD0Q`|Oe}tL=W%(?~)4&N_{@YBd(`E37rjt<;OmRr8GB zryIRXM%S?3+bEr%Lv`N+e_tIHZ}eY$!ynBTcB*eqh0~DZp_vnjg8U&{(&^3NDMXuh zXoS4J`*i!D2qTY<_xJbra52})7H-DDdCS)7Hg>fK+lTnX+$!7{wYso|U*X0;j4{M+ z3pr1WRJu63g5b}t&u<>CANlP5&iZz21jL-d{FI!+lw2N(H9+QI3(W1NPYsM*Ew5iL zuF9m6B{mbqy$5{8jj$K;fChF}JFWu3JiTj7CS-SGcZQa_8)}W5RJqfbJDL?nM-yVO zeZ7}OiM?)?wKf`W(ef6e^;4ks8(;MwFo7RyKTZ3`B6IZ?Pjgy?8!9|eYBg09J6D!C zUyN&vqOq9*&ZDV5$RuDt3mHrIkfyjwl3a(A-6Scgw$J<^J{c;nVHq9p*{m{rRc<{`Lv^ANlDO)PXDswUNz7E@kK}W6aV@i* zvNg4Gy0DCl_sRGu?n^~+BZkgh57I99Bn)sy32BMBF+zQ{)-q_1=bP{1~S7$J!4yREe?B!qxz10pw6;{IM`C1j9nd z6%-T${AUUjn^}dOf6L@3@gGTblO#Ed6P$+fb%|pQi z@Q2R@=WGbaw!{;NdCr%&u22q*fM0$MxxBnQJv}`-Ifh_F7_P+x_;Zul2t(a$Z;W?WkYk05Sr%H}bl)Zzd_Wr=nirJq_zz z^eXK&ORd!vwErjkm65O#f2IAqYQ2ZxB3et;H!yx*D-$rkBJ7dOzzeJmj&4h)PL?*X z+qyr!d^nSX(iPbTu*k*v@%b49Falm+j+73L6rl*H00Pbd^WeQwBY+w0RbNt@Z`s6aCgF-fxMh=`xP)h3&n2a4v!QURGnQJfviO$;W4yCb(* zV53)PtB*6U5@(ZYADh-NH*P|}Kx(KYCkg{XK|ZLnm1KqtXW{BPcwR+50VEId0scx6 zCpZqq+Vw}-@*{2fqU<^0HUOXGYmD1)x_wRBklS?At9AtQD8MhW_z3br*pqJZKE?12 z@Q*=B0C1=P3jxzRfjnp*BoAvx!XJQxe~wTMadD&kibVm9 zTppYw)dTX!wzs#PoD>>|?Esd*AeA>Q7(H6YMTDCtOEVjzVhneJBL@B_JOT!Y?PC;V zOX+D(-7UTQn$~$qZkJO!?pQs~ebfgI>5SBJ&{4bJUbEg*GFy=aEzqNV+x%=>e5_l2 zZSdI<>`006;w1(O(!z$aBcTEqzc?cd_+tr7=7vw?gefDOKjV-4L@>|1FT$D^ZUyj} zA(lvNc6;h0vE1Qh*y3T(;G$FI0OnD|JcZ^eAfFslBv;=h8~luIAn*^Q_06bjhVz9A6q-A}#J_#IeMSg`D}9l0*k0He zpz&e@B0)Z)UcQ*#-%ny6Y^=$)Hjb92*G5I#Le{RBb3Q%y?Wv4xDcTDm#kN(J^J#r{dT!`b7t};`U8OezDgrCK1D`K!CIn0R_ z=Y>>rUs4cyTSS@R03QP5AI*(WfS(lt;~!4({cikt_>Mm}%#s~u%?MT)f2X@Ha?9pJ-|;W8QiJ`&_<=vjANT|OXhfdh@Q3q-c>v2kgUpFOM&I#Q+P{*2l>86;vrQBm-XwiQo^PUbeo{_8@z?(V z3Ig~Dfp8HsTyUVBMOJtq;(Xx0JUFsDHixb5?^h3B@19=2;g7Hr8z3tzdWL* zaQET_W(=wa?7$p0uXF)`9gY>B&;kewp(fBq2n5>s{Q3**AEX2q0RD$;Eo@Lb$VVFo zvi1Fz@`jY~1jIkE|N8t&R6)#7Pi(9#9<9yo;MQ8qI*@Spne7;XI8mGo>ShGF_C@+g z6Cx#X;rvj4b^ywCVyB7=_S+gSDTD_$^`(z-!|0ZE)z6it4W&o)$N4BE#*-c9%nEbh zMY-TV(w`Cn`~MI41N@PUKa$Dc?H~9n`Tslqu>bG)EBU7pU1N&iM+3nRmH>?ZJN_{K z@A&)ay;sJcP=TwVR*;=J?)76d*Di5H8v`Q;WAisFyPq%u?)(;mfY1vM{&~K=f50lZ zy}P-)MGc{n|G_XIpYPTV6-nf1lxB08tBs5~Pwj@sO@GQG1nvAH6hULBc{Nd|WWylry*Vp}Or z)p0&JmK3^PoVHnzBZ&y1I=K?<964Ujf2)|&bTue<)+@q9CR+^*?#ofk zS<;9{+o{n9Bz%8QYr~0a+`n0L^yuSLZu4=cqY#}Xk(8Yr9V8XO9q+98eZ48N4 z`YqK0xrOVu8A6|;DAl+Y- z6(mga5@-1Q5Bwc?(YAdtcKvY?KSE{yw4<&jHwcv^}IR#sSDfSkWj=w;_dDcL$l{R-^v~ z|6p*Cf`UvwDvmhy-$DSsqV3mQ5B6{I=4bPtfAX+&$c#!X&L}HPD*+qGHg~SiE)Z>A zot`7f54Zd2=^3=IApdXp-`?I{U0o^hS4Ne98k|2qJTW1igciU;SP@VPzDh+Scn@C; znnKtkzqo`bHgU%%$W$YJjjN{QvXh;~)t;ud-Nn^k?w-(m5g!oB?C2Tg35cx>E>$=u z9Nie7KbDHN`Z-&qx@BBw*i@jzUshMRTT%e~zieohRaD=U7o6m!uO&oJh4>5nJUH%- zLtRo zA5Bxz&QiiY|CtG4dxF+(eSOVC8DYjq+ zDv($UeYgPFKPV_AG^V|xzN@~cp|p8@b?snp|NQ(M2*X!G?rv_MAD>|M3iSVkKQ>|) z7mEECEF5S9b4-j!RSzyr5DyGt3jjqxDR_V*1_c59$D1dRKkOgJ0r0;#Aiy!f&hnaK z)Y#mTki|pK-TBTzeL-n$UNOMubdxLc8@iilqnyFbiG|C_kpuC-4y6J9cdxbhl2ZRf zZa!}*KPWFgtSC9JYm_&({6?a_w0E6V*KX$*&ZeeHA|si;K13Ji7CW1IOY>3_gFIc$ zG|i8x8Y(H8DrwrPIVS3bmOAD322ccMu66}FAZ5f$^hf=bq68&1P@EDlfZDl8XLh(f z1h6ZmH{6;SYNfRQ|26(t0*Pj7z+ajF!Ppaszt($9{_!?6Nb+!RD6C+1klJgy@{$W> zrza;DKwmDuy}7-=gM9z_5BS53aRdYW!7U&bP(1+0Md8CjDO7;O8ZK>z3jqJa^1=Vu zZ7H1f!Qt-qj`E})#{`OF;^j5)&+^2~>eSqg>=aFTU>-34^2j8#kQSTQTGKNlkRB~< zp{-zF)Q|XQrL*Foz4U}o^+0UABh(*Pmm>r^EU&t2>-?2H{FyF#ruN4zlYc<|z~9%{D8F5srC7B1klwsI*mbu+){zP;;)BEF># zJu-%0Ib)x=;yYU3NlV90b^Tmc`gD5AWKzU%bf6%_h3jX>@Gzmd8kX7^mRK7Ad?+GQ z|9!5pDl(!CuBM!5)PI71zTqF|&5dwnhB!h1`*-<{KSI#I;-A05Kh!`ShjAWyy1|wf zi9wOsG08#hp{80EkB^Tao|~JSFW-LffUkI|WFCCQa(H-nz$f_U1l5MSdk|%8zp-?% zIK4R~T^$pnNO~W#JiEO#vxU$|0sbDg%V)~7usqiS$o2&RsA6n!-KopzJggb{kvwn%cI@D<)D>#i1dhkYJ{hJ;TwC zVrN0HG;TK2gEZL~v^$!1`&eNp7CqV({Y30EZ)S=oInKE!+JPSJObLgxuJGI< z4Sx&Tczw-V0__@nttvgtaqe8=YFy-Om}94xVWpLAp_*m>5hac(#vkL2)nNR}339cHOGwiKt#$*^I<3dfj=Y01=agKp*Bzfrust# zZ9z6oeiqFEw)H-iXaW8Y_~%-w1AkP%B>WHNi80rYvov&3{otdkmEi8xn33I4Tv3{k z8t&%jY2g6WfiU0&;P_Djj+amY%pPBrKTryMv`nUmB;ic|*oCd1tS#&(&@Our~Ee~2^0 zBlA!cfzpT-f#hUn=}0VI>h0a864r?wyPcTriHh9%0rH6G)QN-;et-+x-IC{J!}4@td%3cGT$o-?G%rVn zFY2aHJ>^FWL+2wdG4$?B_3KOb1^$Z5ETSFIx`GA@Vwf!iJuFZG2KzVrTQ>RI)OlN! zyP1|a8x^}46*?(~yro%aVBlxExe7{;P>F$=hnTq+ZD|l^W9)07li}^&QB=Zf>*y-4 zP6-TkHnFzUGW_)E)ARE)p#J`YuisxPmjl2@BKi!uf0-hZ`49NdPi#$(tgX&rde6?( z$kK>t2H?XrE02J&?Sjf+`B(_ElT)yKsN>hqUr;^)`^T>kk>U*=I$PU7M0+dyn8j3+ zQ--FP#et!l_1)Wrxn&Lu<%sAA+v%!B!NUc){-~>Rxhxsw`twm9lOaw+K6YYn+mT?O zh4_fI%+&3?tcBFXvFLD7n2#XXljCbmbky&**PyuS5u9yEZuVp^2a2~N*~hUrz?Bt= z;&Xom__1Etk@3^~zvEAeaYXk}ZH6Z@R`k0j1Sz6XnQkoJH?qFbS_)*(j%kcH}Rf)DT z+EId!mw3RsP{gE{sAl_i3UGGzKl9JZ+>Vlel&fG=JS*alfqxJeA=QAe2NZ-)s7whm zFvnN802Hw(lM+}I_!Z*Pnu9&U|MQyrkid{hk(VXCtnQwZO|!st-HSgC6fnjdA)b z`v>_{dnk;*&_TZdqZI9RLH^06stLw#l1$$vn5#k}O+I1}guCWjr;oV#_lGch%bcjF z)ZkzzGYf-{YNlES&K7on9Z-X9VCwk61HR%VmIJ zOC!R0fX`nLY~VKs#{0C}_lh4*bE{p}ef1 zDk&lX$Mj+yaK;ZF@D(pX`%2EiGmytZP_BjlPyPY_BLo8fO9YdHypaK}06Q{NCjwsBHvS2K zh3AE-gMYyPV4JV6pFmJ3-+};tEC&XahJE+$)=^P@MNvipi^yQKb+S7N5@J_Je)c@6 zZIwuro%NcLq9jU?@$n6EVz{6yc1#P;ZPYTrj|gFyq~z z0+2rmum@SAucNee&Y6Z6(AL9XE@e-U5 z*b#8z2X6pA-ry5>LU0NL7ksdFzPWt3G`%}Fz6s-p3=d8r{(=7m{z&z}+lmE)z#OXp z@efu3Fh`uDjC_DR^r9>o5)BAA4CcT8*MD1C+$t`pY^-V&VJ>b%b60iUFsYl}P&3k6 zgQhSX#GmnrxHRpQ)^N>eeCq2s>8;-7L#sSGP`khbCv6 zb`M8IpyFy&;GtLQYh3FI>$PtQbinisG@qjX4o8zXrbJ$j8195lZ8Qr5c7PA&hamXu z0qg;av`>4WC3+ZP{I#BFqc&6GpJ%J{9e;3sik&*HdI>jr8?5)EzrmX@bJZw&lLS|* z-o~n?{ER3cZwoC=JykV3Q!{5`7}Or8Dr-~K*1Bt`4`fB*ZxAvuQp%x}-1a3?aJ z@o;^7hRLX?Lcw1mFNd_y%If;u?9%bk`OWnMntUh6<{^BBP~0~%(myF=4YLV+W*2Xe zE}0VIFl!H6W*o#oWy;(g(iixOEgK@(PmiDR+kVafgTh402>ZYh7Na^deQ##waDKit zDTP#1w>>sG)5mK~OJ3)5_u0f_J`FS9aEIM5gPkwD=5tJ_mh@eSxF-Y5J$m<2XZ=)7 z;c!W2UupzBHh>t6&R_c;KYMbZ6D`nLApy2zU#lK3^DcLj4tL{D4-+)#b@`ZMdO%lz z724!`LhayZDbdc<7#CWsD>w(Rqk9no%ZI@7tK3aWUC_#EkZY%xX{D8ho+b;;R4Xk= zlKR^WU3dZA2yIn6_4oD~9~^DW0=!+zD~f_c{49)h%?!2O&GaE&hFac6+Q@e9uB>D5 zG62W66gRM(?jAf`Tp>$AmX;o5|Az`ZO_lg7+LV0E z+I`JC0xY|Ntg*>LoCz&JVDLb`-ov=g-KZ9=e4ZvS`%))`&xP3|=26hTxjF4xf%C?l;v&G%MnZ*kOUYi8i-WD^wVYh`Jwt@c4*OU*%F!(LC_LHz>+uyd(&+NWWq< zkf2x2CL9qPHe1SYYx7iL(r}vMYAT#X@*>@!1&W__kB>#Sml?o^{bO`StG8*ZuNm&G z1Lm-KP(27AQ%!0-j4-AT=Ulj*s?6B{4mZbI3scPz@Su(n$YZv%LcZONm}ahvIiLQz zxaZ}qowlm8ftItig_o1Pg^96_hPu{=cZQnk);j9u8Y(95{$}*%pFuJ_8UxiPAQ?OW zaG3qv=mf6fLd`Rl1HNK8;46~GxT50m>1AVc8?DyhA5=A?$$ffaadv81Dwr5xiCH~; zjBYOQ2l)Vh2y)TLOCxKfJdOeEU?C)q{_Xewh72lxi=$zPGIs>B;`a2MZfyKNzy2$y zo0u9Fjk!$gBNLrvRqWat+1ThlkAbUyp2W=C0qQ?SSzkpI7(Z0-d2aOU!Z@a_LIuA~ ziGP_80{^w1+|k0X9Tm%Whu_2<%@W0N>BN z)nB0krC=yrrJErPzQj=vgah!iF;CtCHymNe(zj~@EVSaxl%f-7rW0YNg^G74)t^z@ z>|&(nXJZlI<{ISTZlY&ksI3dPYo?=Xt)pqGregT!Uv&QVpI9U+4x~Wrxcd*|_pu5v z1RGZYB1H_q@do^lmow5ae1#V{zmS81(B6)gmW%UiR5dTots`ie8Ce|Sk8;TaPyvj8 zh&?*Y9mnTjpAd%v;1=)?%p2s7XJqZZzWl%acr$QRLwy~?8m9=R7u(XV$e ztyK->IYm2*>r?&W{J4}cD(!Z4?NmG<6QKB?eJkkw*HQLo5%q3D^e{E_GClk{BmFWh z`7|m1GA8&uI)Gb~fd3V<^PJXtPHNb1D_^V1nJY>Gsf}fZ{h@*|Cu*QAdW0d}fz}X^ zPiLSNEFbo-lp1d1bsMD71iQ_ySN9DkZQks68~;Kc2B1xMarV z{t0S?8p`TWCUkRrHAv$mheR*+558iuja0lp$VcZph7bHU#(fdd0KS5PriT?Om=L{; z3&B6HQa;9!VF}!F2v`Ca;ciuLMTEP;jM1az39&l;mPP>#aFSy-4O1Ot3Xq4sdT zgb+oN4JuG-p~ly?!qc+I#iYQ=D9_nA$I&p=T32zxVxb3#M{dDFKgv`m+(-C9@2LfgnxLto>^kD5QJs{im_W;{9eDW`}OPBpRG`6sV6Wzav0UE58H3>bL1C+m*l6bMMXr0 zYWN9}7urV_iYUy|Ku2`_vjxa}U>=@SJX(4Bban0i{K`o0B=NUd(k3l!kQCL)OBD*S zvZbb-*b1r#?Ld$ZyMR@o3l4853j*_l8w7$fM%4~!jK}wv=~1c3FPk2kdbjzO9=Vv1 zi!j?3Om&h>M99##HxZQb?)Pj^TR(7QMQL|x|>z9 zvl%b=;vGz5?TneH9ciu?X0DHcJY5YS?`fdvrmf+sdB{NUJtovWY^nG>6vL8 ziZt~sbVQcACg$45Ep;e``S}A=v`w$gwnOOd8>BZjGhpPPY>(TKO zs!oRFEUH>(>g6w0buX0i4}&cXc7D~TTJKeEFdn~G#qiawp4Nl8a2rikFY3x5|3?+M z@c(jg`omkvP|#fF<*C#tSco|r?NOe}^Jf`Q(-h$b_-q02Ck4gx0l&!0g3Kq&-8S`< zWrC9l?`7!VjjURTT8 zj;7uA#vPR$+f~XiI&z`?{n6+p87l?J5AzZha<0v1U7bk|n@S29jSC!%@nK>TSB>~T zV^X+T4P6YU&*RLH~%Rv6jG8*T6(aA3I?ra<;T_w|8c=6n5S(=(LS};2F;lPv2A4 zC+$S$QxlV|%`Mb{={BTXz3XpsQr@)yw70rRhhL{WEVj-YtyZ zZ*NfXC}wJKqO(bjC=$}N{3Bdw78jOEs%4+ve_2{sNxT%_-O{{c)gSU2$hyRsWi?+by!qrdr;MZT#69z1bj!bDmb*1pMWK6u`fi9Xp#5Go5y6 zJc02VH2M2?M|;6PO`)fFzFHgTR2Aq{#*|bq8xG5Pp0oUUbD$FG_?= zl6JU>PKc#ZsFjd5a%X`CJ^UsbKkEMYS4{ut5s|L8nZVG>(AZjN;%I&%z|A8j^!$Z@ zbKcIUQ(~@V#$U(tPnuXbm|5{#o8zW@4h;;pDOD8Yxe%cOKsEUN)(+7Y{J-se>{qHg z8k&FK+2eke5n+63lqpEm;cZS#P|DuUdtxgFpL6X_RE1KgKj8Uy@=I8S(%h;BF{iTe zd!tJaCRXO|KA0Yyn;MwK`58ORTYzuxzw#nuxN~rA|GCGOQqfu~mK5X`vUcyb-;WNC zr^Vf%Wqt4Yi}H-DL|@N7aoMt>YPP0mr@QVMdV=+oBg8KlRv@c*UR#3r%d_gDr&Wan zTsVIzKly%c0&WlT6Dd(+*CY3vY_Ixp&)#;ygGmvxKxc7)W4Z6iB5%9f?kBjEj_A(Y=j)G(MIzKrcH*&KuvobO;IC{iP-@x6` z3CBL?;p6G(iqBsSzfh8M3%3vT^21mQ9~U=~ww{5;F^rYsZ@`}`atiX)Dye{RV@S=R zshwOp0B>>P<9pN7Jqv8dH4A`xAUkik2N+h8e+IS|9PuqNnZL?@_&0$Q}P(t5kD%+ zTQ1FAEKGfnp91)ES+Rf*@^=%$hvGuJuKIVx_$n`YQ|(8K0q`Llz(2?{lUz&_olW9g zOk{kw+X&{4g^KY>4gLvsS%CKSY|0}}$? zZtrm5B`JNi`ix#ICU)+=+*lf)p)>HmpT03D7;@lw5rL8uE9WLM7P1`1{@$Rb4C30si&*j{$X0V~w2C z$J7v=MFWkp2Bc9D2y2onzx?*k$8(EmSCi_wPaGcUEiG)yP8+W(9upU>R2DuG7p+zm zV}QR@miMq2A;_$Ic}erRiL*>^OWg;5I6jOTX&>|CFZ;Gcd((V{yh}xp3*g`KvSXNV z>KQ9$1q1sP2PAz((e}q9Y>h&!^!8MF*Emba?Xms z(I#tRenP^QxhVPP`(L&v`i7L!dO~nleeP} ztHRvMf}C&r+UIy!r=2~4fG^5lD6d_x7oN8>jIa}i*%$^`>HC=JoTXM~YUp63Ya`Hf z5E=%#IHg{?TzNAWU@wP6+(Cm?)yMy+x~MieCOsxBj>IM-E-5c1olSvzyPmKk&ayi! z^o1C1j}aYUAr^v9dP~Mf#~>f(19K-rt(f?`f6iUv>4|D#bQ1q>s+7>9$P|KJg%ZMn z;XxQDXDwI-(jEceBoc3W7smA#s7U{8kNF5d4Gl%gP$n4PE!g7nO2VXH(bW z^aEy|aLAgyJKZW*FfC<$6~VVQNkw%@esN=+QrX{zl!@m2xeOk$@Y^&u(A2 zRve$CE-qFT6bz>)jASN_WhYPEyfL1gbT>V2Fgd0#F?ujDvOhk88U9_D0)V|W>}=Dy z(~Uu{Xf>7uI~Vvn=6cy?{CTiC@Oc~_ts=%01X<|%Tk82)2s})*(JFN`6FQh0*&R2u zG17OkusHAM2fg5ysjJ9Oi)SWT{P;+|a=d1;V1zHm+;~c~VHbtwn1M5`ulL7&Le)^rdibnF!!mJ{B zMct$Mmc>9&-Zh<<#RH}%O?E{)60plMi=c2BCQ4CHmJG_e9d$iR^Vx>7``U%rV2|)n@5r?H-0C~^m4$T~iTSY+ mQ3PKS8=T+&w7b2jB|L+l8y?kye6)Tz1o^}K>;k^C5&j1nfqD%9 diff --git a/testorig.jpg b/testorig.jpg index 1a628fcce7734217234069f0c292be786d1de130..d37b1da6de8aa36921997d3ffa1552ada8d62cb2 100644 GIT binary patch delta 4003 zcmZXRS2Uap!-ZdwV|0;3&FF)ui84YMy*r3RH$?A!kRZHDh(2Z{dJrY*C=o=B1T$)g z-cR)2d;iY2{;Pj|dtW?jJs10C57B3Gf;Zzge}Frhsv4>Q5fK0o{afH>3Qz(_Nk||h zf005U5Hd1Sa?1NuloS+{On2|m+-G5CV`X86LfK)$yzHEUTu|u4CwzjBMa0F$*?6T8 zlAik8k2*x-R`d z_q;;V0daO)!h7ucV+Ba+K3Wj<4K;-*?JI0Z=d;oCoXSpm=z8ym|4XsR$ShK?j;bt9H^Fr5y1Tse7*m!_e%(yt~wQ;st z2U0nFy-9`d&K)f5m2vc(zMCmd+i7kIVG%XjIA(=i%TaX5GHfHg$o~8Iehb%L_-j!C z3WEq(eU?PB{`LIgUpK(ScmAR_on4hMXNGUznov=eRAIVc&Pj#%$PvZIK!b0?9yB}l zu74cJrHM8nbOrp*Iy<0^Q~uRR)hgpFSr_80p7H0~2D&0W)RI$Evl;ckjM$q$LDRbe z8N)T`$J1u695%3~kmF6s4HZc~N55al(&tORs=PNAOXlU<^E2U7^`Wwf)} zPfoVDkndVKecu7`DU|3wp_~B50foOU!CMv{?=R1Vpy1KIYqcjWs(u1_WK_ zw*>m*h_AQd{i3W*fnHso7xPMa#!TrCuQ)yrZ^D&}@(7<6MU47}u``k0ZY#&tTlD0C5|G8_IbJ zy3FoZ>rbw#cElFpzx_$f-1)^X0_Jb^jA zKtP%tEbqOKE>Mq=I43fADcl~jZfHtQP%B<13-n)7mLQpavhNLawO$G^KXJ-SXCnKD z!|)l2mW|w_bpch7}27| zDa%!r)+hja=Nn6OsUNmTjEk`R4p}k42fK0x6K?>u7CsTn?tjFn38T2OM>5C9^c@yz z3XHCce_eF6WL`(6I|)Rm2>Nt3DG9wlv%0OZG<|Erp8c{!HV56^tgBWTGo$FL@0p=k zq5N_iy`e7ypF1s^k9DTx$IudFj!@fy0p!y(R9}aX-Sg6~BWL>X+Ws{q4cH;8MiogA zho8b%Ip1?22a6Dv^t7Zf<9LxIyqYFq_{gKS^6@M#pD2Vlu4+{@kjA+`$!u8s zA}k(iq*q}ce?T62RtqnTbTM)Fqp#ZZ)P-eYU91HGgh0knO%$BMi&H?gEi6Hbr1nqZ zSN5152g_21;h|W@3dz&7!kswv9MD^!vU$wSr|3kd*X#>>7rga#b^AS+S{zg_pA;8j zj^7z9XIR#zpdsUX`6>JlMI>|56#Wfg@_>EiyWS;w1$ou&+MEWo8nOrbzWVtbUKfoM zo3(?i>d4`=$`v`r9&tgbrrr%?@4;8U$At?kec^oSP$18!3P>#%e5_{I1M!n}g-*Dj zvVZ$b>3~&A3oG(yZ2}sEE4)q)+OXw6kb(zZNDAY}9REQSh9)e6^UeMdX<;+X7Etx%s! z5`c~nRczNYJT!;Ir_1>HVUfS)#ff2?&{PvZQMW>qzMunldm3GmU-f^vnx6G;-5eKUP=9yhvG6ERZI>f*;wqPTcVZNX?e_&1`8A?`~h zWSNWcvedzFLw?aY_tij0WhO&+`Cy=t9dykqrzeOXTUD-zo=3b}L0W%`D`m}J9CKUb zK8c7EeQ4L&2_mRa1*pHx-y0P#8l^m~tuNbbapKZobBtjn$WR6&ui+nX<2Qiy`ru@K z!~(P!0Wu#-&1ZG>Ol_)>8@zN^ztr|J?a1$iHPnNm_FRI2D097Hmb)A;l9%n@w!0(` zu4F%z$v$PoRow5WGiwYc8Ra^HoR89{Pw_;cA-{CNEAobyP#S^fNyKRe4-N^ZhCB0W zQiQwys15Uzx0@Zc2`pz$8Q>gJsLa}FK8i98MuB!ddZ1-lS*HHDsz@*9R}=05we<9& zcDxr$>q#>k-jj8YV1Y=%LusPnKX*Z1lIC zONuM-X*hlscHvjb`p*9JYn|6|thD}a3fBY8K_#bzlx?x$ z(DU?zAYlo|Nqbmjs_m6R8E1XPbETN&q7+d1)v+e+3l^X}a!{f5-!qbVPqZd$-SS)M zIs>ZXe>X-5G)@*N&V&WN6+wTC$f>kIZtd)%B9;As>US(umZRys{_=)Jot@< zeugAjz!IE<`=p2u^7SNR-a^&f(F0|r*YMFxMZ+08ZwO?Oca?~(cZ?f_&q`f4H#;ov z@6bB#Co?sFB+r$YZ6RVFf6+PbAU7AQBvJb|u8iL}JK%7`_*jwg24I7CobnH6Fu6x9 z+qcU8Y<#mtq^5vOjea6c_nXxVqz*?_G*P%QB-vL*#1dB^tEtoa1J;`a-I}BeEjVnk zgVSHDk=gUE)R1CHz%U`dKhKm0<34Y;rmyy%ZG9|u!j_!JT;g=<{5ir8=DD#{rCqgeaMn;W6%EDs9Zc z)2!+dW?BhVr@Cj+dHjJf1wxZ1MNVdpHlZC9#ZwJoJc@{TF$RXfT%vs4S3Z>9nowat zjRWLg^@*j3m*`mW2lvgrzEWBjtxaCV<2qf>-Z8e88d-2xN$i^`!|aI>(pe+w`0CO} zzCx5ZMY~8omIPV_*g5(BRPp5b)r#xVROqU-k=X)^a)$#;Zl=Z)K?K7MQ0|f#s+N(} ziaIm$V}(|EOKtqxQlJ;kZ6}4u5To1VMjHyi+Beb>I$DCD8=KBt2wk6f`BLk;H$cd_ z0XB@3<~$D36saQJGv0`nlfzuyneS<$rg=F7f*qezTu9CHg_l`Z(noCiRNOO+SVPGD zWezK3FMn-%{~lj%(k)@(?bU_bjk*t~*|P2bAYDa}u_bnR{v}cwM%1VMN+!h!h1BLt z)__(^``UmT+Wcx*sl~BkQg79M)PtF6PH1xf?d5XQ+No&I;619NKQ}ADOAY584&G@&0DsmTeh@iCa00?NVt>uHd^(A z0k=(2&=N2Nq@i*2m;Gazw9 zdx(K&*}J$K;1-YTPU0~}cU8r@JNv1n1Ct!ix$NDbwN(DrbqJr+oY~7~m9K#8u4h0y81USs*zfJT* zw@qe*FsUDPsOyvMN`6XCgEz9(@Mkwnqs+AvF!mhOdn7jf@IDPj4L7q!XmHK=1m(}d zt3(%UwG&T5H~DsNy@!iyh`(pa!a({^q;fn2IwIgn9*MZnU)TwqtT(gYemEHJ1`fH| zG9uJ@az`#9R%H<%?32kxJPV~$_DFChz+3Cuyu?8RsQK?778hLjn(rhV%=C6xHra6p zF-1|}ghj<_?Tf%mzG=}y_@R&5>mNY)kN$uIwx|~R%E8;Fzp`4CdLC+U>g{6#(VClu zQO8-Eby5q$hDlQX#{S<91*zOmHFZz?Oy8DxYpAd#fk&ku#F%)KxEjHy>zACb91ld+ x$CTM}ZhcU36f6DY;MV){vFl33D0+)*;ZK;h^HX9xe|39CgW<#Eq3N56{{U|fwFv+K delta 2534 zcma*dcQhLa0|4;Ej;d80(X!g~GWPYNMfxKQFF1LM4dNC7|@ zSy@GSMSU<>Kfv0=+B)F>g#O?AJ_wKz10(^G1c9mm0U4m64DdS#SP1|Cg@OM8_%EP< zppdYLs2E86OzwPpel`%2-voS4A0S2k&667)M3Y6A`;wTFj~8@5qZ;?xzQ&@KHc=oG zz~PgdT6$$i!yyc@rboWsv2wQJg;Q=R2=qvo7!x><`|F}4U^lEh{_OC2ksHWla0lPv zlrZ)#+)sL_>i2|anP-EuuQydbbrI8@%?!t?{8;OX;Soy_L6*9jct#?<=NUu1_L1@# zRdaC9c92GJ^l>;tmvBA1cks!dra9Q;!+QO;DCEh!-9g2rpgcHV&~Fset8$CU*c8np zPd~uwyNWYnDuqa)psh$tOifP|d93{8A8OMljaF#~G{3aFA+>Uo)mY36y1*|AV@~R8v&7^QahUU$ zI{27VZE*VV+-U&e+F?B=Q4x=ZZ0|G<`u4*qxmee9>#E!1QVCQ~-?A~i9cZ**64ZBj zcKgxY!=-KpaFGcoNO3EUJ?a3;9-mL9_=)1v5w=}M`-XqR91hhk10YMQ8G^*5=`O1s zcl1O}E15oXq;WBhG}E}ZY&NI12zEfc6b85#!wP!jC8m{PLwmr(OuxySMzES%?}sbr z+G9+I-BFp4aR-W*?pVg<)?ZU3;E>4BdTGWj2+ZfLbY*@=E%4UMp@@BPdH{#)tO(JDOy8+bvD+xuE*A^y+DfsBIPUBnvH0N35hx&2+Fiw$N)@ z7N9rnnQfB=qK#L6#&u5XfL0^#f19TBrm7u48V?+zA(pA4U*=o+BgA|iqjS#ycSOnc zln`}O_Y?w}Tl6kh)_OdqUF4wtxlm-(uv+mXxm)>hEt1_LTY5ZWJ3(FP%~Aih9bmdM zU#9yi#FfitMVLufH)eipd(|s%jYpf!aWv}CC?tCX(I3sXG2q?_BZS+=(xnUGktTkV z*BJ^|2?BN%WXxdg-+_wKqR*|6uHF0)q+3c^D#Imb_ zGDCvLa|zW$!yvc#s)`8i4Xc|I7xp8jEvyaMWb4JeKF&qBgr`qcYdICnLthTkdQWZ8 z=$C}KE6e1;d{T%P(#b6PjML`GM0W8}`(j5SM|V{IC~egdNuGmU3dq?v^aAxmQP+b| zT_i~0&k;j)H(D1l%m$0Er-J zxm*#iBHkTg@FFv}usT)ary?3*LBZ-=a!KqtFSVSdiQ8{8FR9Q4gmsoZTNm@lookX= zpK?={2BHRXqI-Sqz)8gXocpr_aM~0g>R4Q@Aw9p}X#f7tDtR%Lj4o8SpNFm(|CdLR zr(&bDEpl3yUN&drAL4Ij9%EGdIC<`&S=B$xEo0F6IQz}T-lbxtDUtl;Fn^sGUCr4W zEj1Wtitc$}W;0z|ARnxKRSR;~t;Cz%p%xf(NA2!=~6? z-Vc?gjn3EPiY`0uH@q!KibSx(sNZ~({1Jukb!GBLJe`#z^#*58eI_+1_1>A;duC&oGIX22uhxR~In&rC zlgfFxkFEtHg9lLqeLVdx+cQCZ;2~leV&6vZ7H%iDUc$eH{oK<%KewbTi@fm;8{j7G z|9DfAUR{u`P6gKG8zPwSDmEEupJ#{1aoG1dGwx4aO+%-P7{13DWB8j98=#D{V`B$3 zR%=~w%X8nflhx~cYN1f`bx-_f(RNR2J7=1WuF6K!Zp+X;Fb`)?bOIaJ{g8jEyMAJgzKGfvHq8hGcIO#&TXI%^zk+R&W>D*Am$gnC$Qd?sEX9B^$h9rH1syi9uDn3qjND&8 zMR07w44oaa>qeE(E;qbnYgI(1R1;-g0mlICR;HfPE6HKjx^s6x%4-iz`|MW_)Lo#g z3rQ5LMwADn2+1Fb#XB`QH2QKo+}LXgJZ(L*Pu8{=TMBdqBVz#CO~9wl6gnCg(_rPr nMvGkxXAK=jbf;psdfhJ0a0-va5Nir=zKUCuM)73n-~ad*^~{!o From 982106187722cf729892e41802beb7065b8017fd Mon Sep 17 00:00:00 2001 From: "Thomas G. Lane" Date: Tue, 17 Mar 1992 00:00:00 +0000 Subject: [PATCH 089/985] The Independent JPEG Group's JPEG software v3 --- CHANGELOG | 40 ++ README | 119 +++-- SETUP | 229 +++++++-- USAGE | 140 ++++-- architecture | 176 +++++-- cjpeg.1 | 18 +- config.c => ckconfig.c | 48 +- djpeg.1 | 82 +-- example.c | 624 +++++++++++++++++++++++ jbsmooth.c | 8 +- jcarith.c | 2 +- jccolor.c | 47 +- jcdeflts.c | 76 +-- jcexpand.c | 2 +- jchuff.c | 54 +- jcmain.c | 92 +++- jcmaster.c | 8 +- jcmcu.c | 2 +- jconfig.h | 71 +-- jcpipe.c | 47 +- jcsample.c | 2 +- jdarith.c | 2 +- jdcolor.c | 198 ++++++-- jddeflts.c | 119 +++-- jdhuff.c | 30 +- jdmain.c | 96 +++- jdmaster.c | 43 +- jdmcu.c | 81 ++- jdpipe.c | 684 +++++++------------------ jdsample.c | 115 ++++- jerror.c | 19 +- jfwddct.c | 166 +++--- jinclude.h | 8 +- jmemansi.c | 157 ++++++ jmemdos.c | 608 ++++++++++++++++++++++ jmemdos.h | 135 +++++ jmemdosa.asm | 379 ++++++++++++++ jmemmgr.c | 1049 ++++++++++++++++++++++++++++++++++++++ jmemname.c | 248 +++++++++ jmemnobs.c | 96 ++++ jmemsys.h | 127 +++++ jpegdata.h | 105 ++-- jquant1.c | 506 +++++++++++++------ jquant2.c | 1091 +++++++++++++++++++++++++++++++++++++++- jrdgif.c | 18 +- jrdjfif.c | 42 +- jrdppm.c | 5 +- jrdrle.c | 20 +- jrdtarga.c | 47 +- jrevdct.c | 186 ++++--- jutils.c | 14 +- jversion.h | 6 +- jvirtmem.c | 614 ---------------------- jwrgif.c | 61 +-- jwrjfif.c | 7 +- jwrppm.c | 11 +- jwrrle.c | 13 +- jwrtarga.c | 13 +- makcjpeg.cf | 4 +- makcjpeg.lnk | 6 +- makcjpeg.lst | 4 +- makdjpeg.cf | 2 +- makdjpeg.lnk | 6 +- makdjpeg.lst | 2 +- makefile.ansi | 48 +- makefile.bcc | 139 +++++ makefile.manx | 42 +- makefile.mc5 | 37 +- makefile.mc6 | 50 +- makefile.mms | 134 +++++ makefile.pwc | 29 +- makefile.sas | 41 +- makefile.tc | 113 ----- makefile.unix | 48 +- makefile.vms | 64 +++ makljpeg.cf | 3 +- makvms.opt | 3 + testimg.gif | Bin 0 -> 15754 bytes testimg.jpg | Bin 4383 -> 4386 bytes testimg.ppm | Bin 46890 -> 46890 bytes testorig.jpg | Bin 4380 -> 4387 bytes 81 files changed, 7327 insertions(+), 2454 deletions(-) rename config.c => ckconfig.c (90%) create mode 100644 example.c create mode 100644 jmemansi.c create mode 100644 jmemdos.c create mode 100644 jmemdos.h create mode 100644 jmemdosa.asm create mode 100644 jmemmgr.c create mode 100644 jmemname.c create mode 100644 jmemnobs.c create mode 100644 jmemsys.h delete mode 100644 jvirtmem.c create mode 100644 makefile.bcc create mode 100644 makefile.mms delete mode 100644 makefile.tc create mode 100644 makefile.vms create mode 100644 makvms.opt create mode 100644 testimg.gif diff --git a/CHANGELOG b/CHANGELOG index 7146f385..24d7a498 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,45 @@ CHANGELOG for Independent JPEG Group's JPEG software +Version 3 17-Mar-92 +-------------------- + +Memory manager is finally capable of swapping to temp files. There are +separate versions of jmemsys.c for no temp files (same behavior as older +versions), simple temp files with or without tmpfile(), and a DOS-specific +version (including special code for EMS and XMS). This is probably much more +system-dependent than any of the older code; some bugs may surface here. + +Hooks added for user interface to install progress monitoring routine +(percent-done bar, etc). See comments with dummy progress_monitor +routines in jcdeflts.c, jddeflts.c. + +Two-pass color quantization (finally!). This is now the default method when +quantizing; say '-1' to djpeg for quick-and-ugly 1-pass method. There is +a test file for checking 2-pass quantization and GIF output. + +Fixed bug in jcopy_block_row that broke cjpeg -o option and djpeg -b option +on MSDOS machines. + +Miscellaneous small speedups; notably, DCT computation rearranged so that +GCC "inline" feature is no longer needed for good code quality. + +File config.c renamed ckconfig.c to avoid name conflict with /etc/config +on Unix systems. + +Added example.c to document usage of JPEG subroutines better. + +Memory manager now knows how to release all storage during error exit --- +avoids memory leak when using JPEG as subroutines. This implies a couple +small changes to the subroutine interface: the old free_defaults subroutines +are no longer needed, but if you have a replacement error_exit method then it +must call the new free_all method. Also, jselvirtmem renamed to jselmemmgr. + +Code for reading Targa files with 32-bit pixels was incorrect. + +Colorspace conversion slightly faster and more accurate; because of +this, old "test" files will no longer match bit-for-bit. + + Version 2 13-Dec-91 -------------------- diff --git a/README b/README index 524f3295..3dc11406 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ The Independent JPEG Group's JPEG software ========================================== -README for release 2 of 13-Dec-91 -================================= +README for release 3 of 17-Mar-92 +================================== -This distribution contains the second public release of the Independent JPEG +This distribution contains the third official release of the Independent JPEG Group's free JPEG software. You are welcome to redistribute this software and to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. @@ -12,8 +12,8 @@ For installation instructions, see file SETUP; for usage instructions, see file USAGE (or the cjpeg.1 and djpeg.1 manual pages). This software is still undergoing revision. Updated versions may be obtained -by FTP or UUCP to uunet.uu.net and other archive sites; see ARCHIVE LOCATIONS -below for details. +by FTP or UUCP to UUNET and other archive sites; see ARCHIVE LOCATIONS below +for details. If you intend to become a serious user of this software, please contact jpeg-info@uunet.uu.net to be added to our electronic mailing list. Then @@ -21,7 +21,7 @@ you'll be notified of updates and have a chance to participate in discussions, etc. This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz, -Lee Crocker, and other members of the Independent JPEG Group. +Lee Crocker, Ge' Weijers, and other members of the Independent JPEG Group. DISCLAIMER @@ -38,7 +38,7 @@ Please report any problems with this software to jpeg-info@uunet.uu.net. WHAT'S HERE =========== -This distribution contains software to implement JPEG image compression and +This distribution contains C software to implement JPEG image compression and decompression. JPEG (pronounced "jay-peg") is a standardized compression method for full-color and gray-scale images. JPEG is intended for "real-world" scenes; cartoons and other non-realistic images are not its @@ -55,9 +55,9 @@ processes. Provision is made for supporting all variants of these processes, although some uncommon parameter settings aren't implemented yet. For legal reasons, we are not distributing code for the arithmetic-coding process; see LEGAL ISSUES. At present we have made no provision for supporting the -progressive or lossless processes defined in the standard. +progressive, hierarchical, or lossless processes defined in the standard. -The present software is still largely in the prototype stage. It does not +The present software is not far beyond the prototype stage. It does not support all possible variants of the JPEG standard, and some functions have rather slow and/or crude implementations. However, it is useful already. @@ -71,7 +71,7 @@ This software can be used on several levels: * As canned software for JPEG compression and decompression. Just edit the Makefile and configuration files as needed (see file SETUP), compile and go. - Members of the independent JPEG group will improve the out-of-the-box + Members of the Independent JPEG Group will improve the out-of-the-box functionality and speed as time goes on. * As the basis for other JPEG programs. For example, you could incorporate @@ -89,17 +89,17 @@ This software can be used on several levels: decompressor module. You'd probably also want to extend the user interface to give you more detailed control over the JPEG compression parameters. -In particular, we welcome the use of this software as the basis for commercial +In particular, we welcome the use of this software as a component of commercial products; no royalty is required. ARCHIVE LOCATIONS ================= -The "official" archive site for this software is uunet.uu.net (Internet -address 137.39.1.2 or 192.48.96.2). The most recent released version can +The "official" archive site for this software is ftp.uu.net (Internet +address 137.39.1.9 or 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 jpegsrc.v2.tar.Z. If you are on the Internet, you can +will be archived as jpegsrc.v3.tar.Z. If you are on the Internet, you can retrieve files from UUNET by anonymous FTP. If you don't have FTP access, UUNET's archives are also available via UUCP; contact postmaster@uunet.uu.net for information on retrieving files that way. @@ -109,7 +109,7 @@ may not be up-to-date. In Europe, try nic.funet.fi (128.214.6.100; look in directory pub/graphics/programs/jpeg). You can also obtain this software from CompuServe, in the GRAPHSUPPORT forum -(GO PICS), library 10; this version will be file jpsrc2.zip. +(GO PICS), library 10; this version will be file jpsrc3.zip. If you are not reasonably handy at configuring and installing portable C programs, you may have some difficulty installing this package. You may @@ -135,11 +135,16 @@ work on any non-Unix machine. If you are using X Windows you might want to use the xv or xloadimage viewers to save yourself the trouble of converting PPM to some other format. Both of -these can be found in the contrib directory at export.lcs.mit.edu. -There will soon be a new release of xv that incorporates our software and thus -can read and write JPEG files directly. (NOTE: since xv internally reduces -all images to 8 bits/pixel, a JPEG file written by xv will not be very high -quality. Caveat user.) +these can be found in the contrib directory at export.lcs.mit.edu. Actually, +xv version 2.00 and up incorporates our software and thus can read and write +JPEG files directly. (NOTE: since xv internally reduces all images to 8 +bits/pixel, a JPEG file written by xv will not be very high quality; you may +also prefer xloadimage for viewing if you have a 24-bit display. Caveat user.) + +For DOS machines, Lee Crocker's free Piclab program is a useful companion to +the JPEG software. The latest version, currently 1.91, is available by FTP +from SIMTEL20 and its various mirror sites, file piclb191.zip. +CompuServe also has it, in the same library as the JPEG software. SOFTWARE THAT'S NO HELP AT ALL @@ -152,10 +157,10 @@ to produce compatible files with its -j switch, and their decompression program JPG2GIF can read our files (at least ones produced with our default option settings). -Unfortunately, most commercial JPEG implementations are also incompatible as +Unfortunately, many commercial JPEG implementations are also incompatible as of this writing, especially programs released before summer 1991. The root of the problem is that the ISO JPEG committee failed to specify a concrete file -format. Many vendors "filled in the blanks" on their own, creating +format. Some vendors "filled in the blanks" on their own, creating proprietary formats that no one else could read. (For example, none of the early commercial JPEG implementations for the Macintosh were able to exchange compressed files.) @@ -174,6 +179,52 @@ to help force rapid convergence to de facto standards for JPEG file formats. SUPPORT STANDARD, NON-PROPRIETARY FORMATS: demand JFIF or JPEG-in-TIFF! +USING JPEG AS A SUBROUTINE IN A LARGER PROGRAM +============================================== + +You can readily incorporate the JPEG compression and decompression routines in +a larger program. The file example.c provides a skeleton of the interface +routines you'll need for this purpose. Essentially, you replace jcmain.c (for +compression) and/or jdmain.c (for decompression) with your own code. Note +that the fewer JPEG options you allow the user to twiddle, the less code you +need; all the default options are set up automatically. (Alternately, if you +know a lot about JPEG or have a special application, you may want to twiddle +the default options even more extensively than jcmain/jdmain do.) + +Most likely, you will want the uncompressed image to come from memory (for +compression) or go to memory or the screen (for decompression). For this +purpose you must provide image reading or writing routines that match the +interface used by the image file I/O modules (jrdXXX or jwrXXX); again, +example.c shows a skeleton of what is required. + +By default, any error detected inside the JPEG routines will cause a message +to be printed on stderr, followed by exit(). You can override this behavior +by supplying your own message-printing and/or error-exit routines; again, +example.c shows how. + +Mechanics: we recommend you create libjpeg.a as shown in the Makefile, then +link that with your surrounding program. (If your linker is at all +reasonable, only the code you actually need will get loaded.) Include the +files jconfig.h and jpegdata.h in C files that need to call the JPEG routines. + +CAUTION: some people have tried to compile JPEG and their surrounding code +with different compilers, e.g., cc for JPEG and c++ or gcc for the rest. This +is a Real Bad Move and you will deserve what happens to you if you try it. +(Hint: the parameter structures can get laid out differently with no warning.) + +Read our "architecture" file for more info. If it seems to you that the +software structure doesn't accommodate what you want to do, please contact +the authors. + +Beginning with version 3, we will endeavor to hold the interface described by +example.c constant, so that you can plug in updated versions of the JPEG code +just by recompiling. However, we can't guarantee this, especially if you +choose to twiddle any JPEG options not listed in example.c. Check the +CHANGELOG when installing any new version, and compare example.c against the +prior version. Recompile your calling software (don't just relink), as we may +add or subtract fields in the parameter structures. + + REFERENCES ========== @@ -184,6 +235,12 @@ algorithm is Wallace's article in the April '91 CACM: (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) We highly recommend reading that article before trying to understand the innards of any JPEG software. +If you don't have the CACM issue handy, a PostScript file containing a revised +version of the article is available at ftp.uu.net, graphics/jpeg/wallace.ps.Z. +The file (actually a preprint for an article to appear in IEEE Trans. Consumer +Electronics) omits the sample images that appeared in CACM, but it includes +corrections and some added material. Note: the Wallace article is copyright +ACM and IEEE, and it may not be used for commercial purposes. For more detail about the JPEG standard you pretty much have to go to the draft standard (which is not nearly as intelligible as Wallace's article). @@ -211,8 +268,12 @@ format. For the omitted details we follow the "JFIF" conventions, revision 399A West Trimble Road San Jose, CA 95131 (408) 944-6300 -Requests can also be e-mailed to info@c3.pla.ca.us. The same source can -supply copies of the draft JPEG-in-TIFF specs. +The same source can supply copies of the draft JPEG-in-TIFF documents +(Appendixes O and P to the TIFF spec). PostScript versions of these +documents can also be obtained by e-mail from the C-Cube mail server, +netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg" to obtain the +JFIF document; "send app_o_ps from jpeg" and "send app_p_ps from jpeg" will +produce the TIFF documents. Send the message "help" if you have trouble. If you want to understand this implementation, start by reading the "architecture" documentation file. Please read "codingrules" if you want to @@ -227,7 +288,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, Thomas G. Lane. +This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this @@ -286,12 +347,8 @@ TO DO ===== Many of the modules need fleshing out to provide more complete -implementations, or to provide faster paths for common cases. The greatest -needs are for (a) decent color quantization, and (b) a memory manager -implementation that can work in limited memory by swapping "big" images to -temporary files. I (Tom Lane) am going to work on color quantization next. -Volunteers to write a PC memory manager, or to work on any other modules, are -welcome. +implementations, or to provide faster paths for common cases. +Improving the speed will be the next big work item for the JPEG group. We'd appreciate it if people would compile and check out the code on as wide a variety of systems as possible, and report any portability problems diff --git a/SETUP b/SETUP index 31f445c0..580a194c 100644 --- a/SETUP +++ b/SETUP @@ -26,16 +26,19 @@ STEP 1: PREPARE A MAKEFILE First, select a makefile and copy it to "Makefile" (or whatever your version of make uses as the default makefile name; for example, "makefile.mak" for -Borland C). We include several standard makefiles in the distribution: +old versions of Borland C). We include several standard makefiles in the +distribution: makefile.ansi: for Unix systems with ANSI-compatible C compilers. makefile.unix: for Unix systems with non-ANSI C compilers. makefile.mc5: for Microsoft C 5.x under MS-DOS. makefile.mc6: for Microsoft C 6.x under MS-DOS. - makefile.tc: for Borland's Turbo C under MS-DOS. + makefile.bcc: for Borland C (Turbo C) under MS-DOS. makefile.pwc: for Mix Software's Power C under MS-DOS. makefile.manx: for Manx Aztec C on Amigas. makefile.sas: for SAS C on Amigas. + makefile.mms: for VAX/VMS systems with MMS. + makefile.vms: for VAX/VMS systems without MMS. If you don't see a makefile for your system, we recommend starting from either makefile.ansi or makefile.unix, depending on whether your compiler accepts @@ -46,24 +49,27 @@ preprocesses the source code to convert function definitions to old-style C. (Our thanks to Peter Deutsch of Aladdin Enterprises for the ansi2knr program.) If you don't know whether your compiler supports ANSI-style function -definitions, then take a look at config.c. It is a test program that will +definitions, then take a look at ckconfig.c. It is a test program that will help you figure out this fact, as well as some other facts you'll need in -later steps. You must compile and execute config.c by hand; the makefiles -don't provide any support for this. config.c may not compile the first try +later steps. You must compile and execute ckconfig.c by hand; the makefiles +don't provide any support for this. ckconfig.c may not compile the first try (in fact, the whole idea is for it to fail if anything is going to). If you -get compile errors, fix them by editing config.c according to the directions -given in config.c. Once you get it to run, select a makefile according to the -advice it prints out, and make any other changes it recommends. +get compile errors, fix them by editing ckconfig.c according to the directions +given in ckconfig.c. Once you get it to run, select a makefile according to +the advice it prints out, and make any other changes it recommends. Look over the selected Makefile and adjust options as needed. In particular you may want to change the CC and CFLAGS definitions. For instance, if you -are using GCC, set CC=gcc. +are using GCC, set CC=gcc. If you had to use any compiler switches to get +ckconfig.c to work, make sure the same switches are in CFLAGS. If you are on a system that doesn't use makefiles, you'll need to set up project files (or whatever you do use) to compile all the source files and link them into executable files cjpeg and djpeg. See the file lists in any of -the makefiles to find out which files go into each program (makcjpeg.lst and -makdjpeg.lst are handy summaries). +the makefiles to find out which files go into each program. As a last resort, +you can make a batch script that just compiles everything and links it all +together; makefile.vms is an example of this (it's for VMS systems that have +no make-like utility). STEP 2: EDIT JCONFIG.H @@ -79,8 +85,8 @@ older compilers other changes may be needed, depending on what ANSI features are supported. If you don't know enough about C programming to understand the questions in -jconfig.h, then use config.c to figure out what to change. (See description -of config.c in step 1.) +jconfig.h, then use ckconfig.c to figure out what to change. (See description +of ckconfig.c in step 1.) A note about TWO_FILE_COMMANDLINE: defining this selects the command line syntax in which the input and output files are both named on the command line. @@ -91,13 +97,70 @@ is true for most MS-DOS compilers, for example. If you're not on a Unix system, it's probably safest to assume you need two-file style. -STEP 3: MAKE +STEP 3: SELECT SYSTEM-DEPENDENT FILES +===================================== + +The only system-dependent file in the current version is jmemsys.c. This file +controls use of temporary files for big images that won't fit in main memory. +You'll notice there is no file by that name in the distribution; you must +select one of the provided versions and copy, rename, or link it to jmemsys.c. +Here are the provided versions: + + jmemansi.c This is a reasonably portable version that should + work on most ANSI and near-ANSI C compilers. It uses + the ANSI-standard library routine tmpfile(), which not + all pre-ANSI systems have. On some systems tmpfile() + may put the temporary file in a non-optimal location; + if you don't like what it does, use jmemname.c. + + jmemname.c This version constructs the temp file name by itself. + For anything except a Unix machine, you'll need to + configure the select_file_name() routine appropriately; + see the comments near the head of jmemname.c. + If you use this version, define NEED_SIGNAL_CATCHER + in jconfig.h or in the Makefile to make sure the temp + files are removed if the program is aborted. + + jmemnobs.c (That stands for No Backing Store :-). This will + compile on almost any system, but it assumes you + have enough main memory or virtual memory to hold + the biggest images you need to work with. + + jmemdos.c This should be used in most MS-DOS installations; see + the system-specific notes about MS-DOS for more info. + IMPORTANT: if you use this, also copy jmemdos.h to + jmemsys.h, replacing the standard version. ALSO, + include the assembly file jmemdosa.asm in the programs. + (This last is already done if you used one of the + supplied MS-DOS-specific makefiles.) + +If you have plenty of (real or virtual) main memory, just use jmemnobs.c. +"Plenty" means at least ten bytes for every pixel in the largest images +you plan to process, so a lot of systems don't meet this criterion. +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 #define DEFAULT_MAX_MEM to a +reasonable value for your system (either by editing jmemsys.c, 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 needs for cjpeg or djpeg are typically 100 to 150Kb more +than the max-memory setting. Larger max-memory settings reduce the amount of +I/O needed to process a large image, but too large a value can result in +"insufficient memory" failures. On most Unix machines (and other systems with +virtual memory), just set DEFAULT_MAX_MEM to several million and forget it. +At the other end of the spectrum, for MS-DOS machines you probably can't go +much above 300K to 400K. + + +STEP 4: MAKE ============ Now you should be able to "make" the software. If you have trouble with missing system include files or inclusion of the -wrong ones, look at jinclude.h (or use config.c, if you are not a C expert). +wrong ones, look at jinclude.h (or use ckconfig.c, if you are not a C expert). If your compiler complains about big_sarray_control and big_barray_control being undefined structures, you should be able to shut it up by adding @@ -109,27 +172,34 @@ some compilers will issue warnings about this, which you can ignore. Any other warning deserves investigation. -STEP 4: TEST +STEP 5: TEST ============ -As a quick test of functionality we've included three small sample files: +As a quick test of functionality we've included a small sample image in +several forms: testorig.jpg A reduced section of the well-known Lenna picture. testimg.ppm The output of djpeg testorig.jpg + testimg.gif The output of djpeg -G testorig.jpg testimg.jpg The output of cjpeg testimg.ppm (The two .jpg files aren't identical since JPEG is lossy.) If you can -generate duplicates of testimg.ppm and testimg.jpg then you probably have a -working port. +generate duplicates of the testimg.* files then you probably have working +programs. With most of the makefiles, "make test" will perform the necessary comparisons. If you're using a makefile that doesn't provide this option, run -djpeg and cjpeg to generate testout.ppm and testout.jpg, then compare these to -testimg.* with whatever file comparison tool you have. The files should be -bit-for-bit identical. +djpeg and cjpeg to generate testout.ppm, testout.gif, and testout.jpg, then +compare these to testimg.* with whatever binary file comparison tool you have. +The files should be bit-for-bit identical. + +If your choice of jmemsys.c was anything other than jmemnobs.c, you should +also test that temporary-file usage works. Try "djpeg -G -m 0 testorig.jpg" +and make sure its output matches testimg.gif. If you have any really large +images handy, try compressing them with -o and/or decompressing with -G +to make sure your DEFAULT_MAX_MEM setting is not too large. NOTE: this is far from an exhaustive test of the JPEG software; some modules, -such as color quantization and GIF I/O, are not exercised at all. It's just a -quick test to give you some confidence that you haven't missed something -major. +such as fast color quantization, are not exercised at all. It's just a quick +test to give you some confidence that you haven't missed something major. If the test passes, you can copy the executable files cjpeg and djpeg to wherever you normally install programs. Read the file USAGE to learn more @@ -152,13 +222,7 @@ follows: "lib" subdirectory of the URT distribution). If you want to incorporate the JPEG code as subroutines in a larger program, -we recommend that you make libjpeg.a. Then use the jconfig.h and jpegdata.h -files as your interface to the JPEG functions, and link libjpeg.a with your -program. Your surrounding program will have to provide functionality similar -to what's in jcmain.c or jdmain.c, and you may want to replace jerror.c and -possibly other modules depending on your needs. See the "architecture" file -for more info. If it seems to you that the system structure doesn't -accommodate what you want to do, please contact the authors. +we recommend that you make libjpeg.a. (See file README for more info.) CAUTION: When you use the JPEG code as subroutines, we recommend that you make any required configuration changes by modifying jconfig.h, not by adding -D @@ -178,33 +242,53 @@ NOTES FOR SPECIFIC SYSTEMS ========================== We welcome reports on changes needed for systems not mentioned here. -Submit 'em to jpeg-info@uunet.uu.net. Also, config.c is fairly new and not +Submit 'em to jpeg-info@uunet.uu.net. Also, ckconfig.c is fairly new and not yet thoroughly tested; if it's wrong about how to configure the JPEG software for your system, please let us know. +Amiga: + +Makefiles are provided for Manx Aztec C and SAS C. I have also heard from +people who have compiled with the free DICE compiler, using makefile.ansi as a +starting point (set "CC= dcc" and "CFLAGS= -c -DAMIGA -DTWO_FILE_COMMANDLINE +-DNEED_SIGNAL_CATCHER" in the makefile). For all compilers, we recommend you +use jmemname.c as the system-dependent memory manager. Assuming you have +-DAMIGA in the makefile, jmemname.c will put temporary files in JPEGTMP:. +Change jmemname.c if you don't like this. + + +Cray: + +Should you be so fortunate as to be running JPEG on a Cray YMP, there is a +compiler bug in Cray's Standard C versions prior to 3.1. You'll need to +insert a line reading "#pragma novector" just before the loop + for (i = 1; i <= (int) htbl->bits[l]; i++) + huffsize[p++] = (char) l; +in fix_huff_tbl (in V2, line 42 of jchuff.c and line 38 of jdhuff.c). The +usual symptom of not adding this line is a core-dump. See Cray's SPR 48222. + + HP/Apollo DOMAIN: At least in version 10.3.5, the C compiler is ANSI but the system include files are not. Use makefile.ansi and add -DNONANSI_INCLUDES to CFLAGS. + HP-UX: If you have HP-UX 7.05 or later with the "software development" C compiler, -then you can use makefile.ansi. Add "-Aa" to the CFLAGS line in the -makefile. If you have a pre-7.05 system, or if you are using the non-ANSI C -compiler delivered with a minimum HP-UX 8.0 system, then you must use -makefile.unix (and do NOT add -Aa). Also, adding "-lmalloc" to LDLIBS is -recommended if you have libmalloc.a (it seems not to be present in minimum -8.0). +then you can use makefile.ansi. Add "-Aa" to the CFLAGS line in the makefile +to make the compiler work in ANSI mode. If you have a pre-7.05 system, or if +you are using the non-ANSI C compiler delivered with a minimum HP-UX 8.0 +system, then you must use makefile.unix (and do NOT add -Aa). Also, adding +"-lmalloc" to LDLIBS is recommended if you have libmalloc.a (it seems not to +be present in minimum 8.0). -On HP series 800 machines, the HP C compiler is buggy in revisions prior to -A.08.07. If you get complaints about "not a typedef name", you'll have to +On HP 9000 series 800 machines, the HP C compiler is buggy in revisions prior +to A.08.07. If you get complaints about "not a typedef name", you'll have to convert the code to K&R style (i.e., use makefile.unix). -IBM RS/6000 AIX: - -The CFLAGS switch to make the compiler define __STDC__ is "-qlanglvl=ansi". Macintosh Think C: @@ -215,11 +299,56 @@ project. Also add the ANSI and Unix C libraries in a separate segment. You may need to divide the JPEG files into more than one segment; you can do this pretty much as you please. -If you have Think C version 5.0 you should be able to just turn on __STDC__ -through the compiler switch that enables that. With version 4.0 you must -manually edit jconfig.h. (You can #define __STDC__, but also #define const.) +If you have Think C version 5.0 you need not modify jconfig.h; instead you +should turn on both the ANSI Settings and Language Extensions option buttons +(so that both __STDC__ and THINK_C are predefined). With version 4.0 you must +edit jconfig.h. (You can #define HAVE_STDC to do the right thing for all +options except const; you must also #define const.) -Microsoft C for MS-DOS: +jcmain and jdmain are set up to provide the usual command-line interface +by means of Think's ccommand() library routine. Anybody want to write a +more Mac-like interface for us? + + +MS-DOS, generic comments: + +The JPEG code is designed to be compiled with 80x86 "small" or "medium" memory +models (i.e., data pointers are 16 bits unless explicitly declared "far"; code +pointers can be either size). You should be able to use small model to +compile cjpeg or djpeg by itself, but you will probably have to go to medium +model if you include the JPEG code in a larger application. This shouldn't +hurt performance much. You *will* take a noticeable performance hit if you +compile in a large-data memory model, and you should avoid "huge" model if at +all possible. Be sure that NEED_FAR_POINTERS is defined by jconfig.h or by +the Makefile if you use a small-data model; be sure it is NOT defined if you +use a large-data memory model. (As distributed, jconfig.h defines +NEED_FAR_POINTERS if MSDOS is defined.) + +The DOS-specific memory manager, jmemdos.c, should be used if possible. +(Be sure to install jmemdos.h and jmemdosa.asm along with it.) If you +can't use jmemdos.c for some reason --- for example, because you don't have +a Microsoft-compatible assembler to assemble jmemdosa.asm --- you'll have +to fall back to jmemansi.c or jmemname.c. IMPORTANT: if you use either of +those files, you will have to compile in a large-data memory model in order +to get the right stdio library. Too bad. + +None of the above advice applies if you are using a 386 flat-memory-space +environment, such as DJGPP or Watcom C. For these compilers, do NOT define +NEED_FAR_POINTERS, and do NOT use jmemdos.c. Use jmemnobs.c if the +environment supplies adequate virtual memory, otherwise use jmemansi.c or +jmemname.c. + + +MS-DOS, DJGPP: + +The file egetopt.c conflicts with some library routines in DJGPP 1.05. +Remove #include "egetopt.c" from jcmain.c and jdmain.c, and in each of +those files change the egetopt(...) call to getopt(...). This will be +fixed more cleanly in some future version. Use makefile.ansi, and put +"-DTWO_FILE_COMMANDLINE" (but *not* -DMSDOS) in CFLAGS. + + +MS-DOS, Microsoft C: Some versions of MS C fail with an "out of macro expansion space" error because they can't cope with the macro TRACEMS8 (defined in jpegdata.h). @@ -227,6 +356,10 @@ If this happens to you, the easiest solution is to change TRACEMS8 to expand to nothing. You'll lose the ability to dump out JPEG coefficient tables with djpeg -d -d, but at least you can compile. +makefile.mc6 (MS C 6.x makefile) has not been tested since jmemdosa.asm +was added; we'd appreciate hearing whether it works or not. + + Sun: Don't forget to add -DBSD to CFLAGS. If you are using GCC on SunOS 4.0.1 or diff --git a/USAGE b/USAGE index 409cb415..9ee86fe9 100644 --- a/USAGE +++ b/USAGE @@ -1,19 +1,24 @@ USAGE instructions for the Independent JPEG Group's JPEG software ================================================================= +INTRODUCTION + This distribution contains software to implement JPEG image compression and decompression. JPEG (pronounced "jay-peg") is a standardized compression -method for full-color and gray-scale images. JPEG is intended for -"real-world" scenes; cartoons and other non-realistic images are not its -strong suit. JPEG is lossy, meaning that the output image is not necessarily -identical to the input image. Hence you should not use JPEG if you have to -have identical output bits. However, on typical images of real-world scenes, -very good compression levels can be obtained with no visible change, and -amazingly high compression levels can be obtained if you can tolerate a -low-quality image. +method for full-color and gray-scale images. JPEG is designed to handle +"real-world" scenes, for example scanned photographs. Cartoons, line +drawings, and other non-realistic images are not JPEG's strong suit; on this +sort of material you may get poor image quality and/or little compression. + +JPEG is lossy, meaning that the output image is not necessarily identical to +the input image. Hence you should not use JPEG if you have to have identical +output bits. However, on typical real-world images, very good compression +levels can be obtained with no visible change, and amazingly high compression +is possible if you can tolerate a low-quality image. You can trade off image +quality against file size by adjusting the compressor's "quality" setting. This file describes usage of the standard programs "cjpeg" and "djpeg" that -can be built directly from the distributed software. See the README file for +can be built directly from the distributed C code. See the README file for hints on incorporating the JPEG software into other programs. If you are on a Unix machine you may prefer to read the Unix-style manual @@ -23,6 +28,8 @@ NOTE: at some point we will probably redesign the user interface, so the command line switches described here will change. +GENERAL USAGE + We provide two programs, cjpeg to compress an image file into JPEG format, and djpeg to decompress a JPEG file back into a conventional image format. @@ -35,25 +42,27 @@ named. They always write to standard output (with trace/error messages to standard error). These conventions are handy for piping images between programs. -On PC, Macintosh, and Amiga systems, you say: +On most non-Unix systems, you say: cjpeg [switches] imagefile jpegfile or djpeg [switches] jpegfile imagefile -i.e., both input and output files are named on the command line. This style -is a little more foolproof, and it loses no functionality if you don't have -pipes. (You can get this style on Unix too, if you prefer, by defining -TWO_FILE_COMMANDLINE; see SETUP.) +i.e., both the input and output files are named on the command line. This +style is a little more foolproof, and it loses no functionality if you don't +have pipes. (You can get this style on Unix too, if you prefer, by defining +TWO_FILE_COMMANDLINE when you compile the programs; see SETUP.) The currently supported image file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster Toolkit format). (RLE is supported only if the URT library is available.) cjpeg recognizes the input image format automatically, with the exception -of some Targa-format files. +of some Targa-format files. You have to tell djpeg which format to generate. The only JPEG file format currently supported is the JFIF format. Support for the TIFF/JPEG format will probably be added at some future date. +CJPEG DETAILS + The command line switches for cjpeg are: -Q quality Scale quantization tables to adjust image quality. @@ -63,8 +72,9 @@ The command line switches for cjpeg are: -o Perform optimization of entropy encoding parameters. Without this, default encoding parameters are used. -o usually makes the JPEG file a little smaller, but - cjpeg runs much slower. Image quality and speed of - decompression are unaffected by -o. + cjpeg runs somewhat slower and needs much more memory. + Image quality and speed of decompression are unaffected + by -o. -T Input file is Targa format. Targa files that contain an "identification" field will not be automatically @@ -79,6 +89,12 @@ The command line switches for cjpeg are: -d Enable debug printout. More -d's give more printout. Also, version information is printed at startup. + -m memory Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -m 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. + The -Q switch lets you trade off compressed file size against quality of the reconstructed image: the higher the -Q setting, the larger the JPEG file, and the closer the output image will be to the original input. Normally you want @@ -105,6 +121,8 @@ cjpeg emits a warning message when you give such a -Q value, because some commercial JPEG programs may be unable to decode the resulting file.) +DJPEG DETAILS + The command line switches for djpeg are: -G Select GIF output format (implies -q, with default @@ -122,41 +140,73 @@ The command line switches for djpeg are: if -q is specified; otherwise, 24-bit full-color format is emitted. + -g Force gray-scale output even if input is color. + + -q N Quantize to N colors. This reduces the number of + colors in the output image so that it can be displayed + on a colormapped display or stored in a colormapped + file format. For example, if you have an 8-bit + display, you'd need to quantize to 256 or fewer colors. + + -D Do not use dithering in color quantization. + By default, Floyd-Steinberg dithering is applied when + quantizing colors, but on some images dithering may + result in objectionable "graininess". If that + happens, you can turn off dithering with -D. + -D is ignored unless you also say -q or -G. + + -1 Use one-pass instead of two-pass color quantization. + The one-pass method is faster and needs less memory, + but it produces a lower-quality image. + -1 is ignored unless you also say -q or -G. Also, + the one-pass method is always used for gray-scale + output (the two-pass method is no improvement then). + -b Perform cross-block smoothing. This is quite memory-intensive and only seems to improve the image at very low quality settings (-Q 10 to 20 or so). At normal -Q settings it may make the image worse. - -g Force gray-scale output even if input is color. - - -q N Quantize to N colors. - - -D Do NOT use dithering in color quantization. - By default, Floyd-Steinberg dithering is applied when - quantizing colors, but on some images dithering may - result in objectionable "graininess". If that - happens, you can turn off dithering with -D. - - -2 Use two-pass color quantization (not yet supported). - -d Enable debug printout. More -d's give more printout. Also, version information is printed at startup. -Color quantization currently uses a rather shoddy algorithm (although it's not -as horrible when dithered). Because of this, the GIF output mode is NOT -RECOMMENDED in the current release, except for gray-scale output. You can get -better results by applying ppmquant to the unquantized (PPM) output of djpeg, -then converting to GIF with ppmtogif. (See SUPPORTING SOFTWARE in the README -file.) We expect to provide a considerably better quantization algorithm in a -future release. (The same applies to colormapped RLE or Targa output, of -course.) + -m memory Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -m 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. -Note that djpeg *can* read noninterleaved JPEG files even though cjpeg can't -yet generate them. For most applications this is a nonissue, since hardly -anybody seems to be using noninterleaved format. -On a non-virtual-memory machine, you may run out of memory if you use -I or -o -in cjpeg, or -q ... -2 in djpeg, or try to read an interlaced GIF file, or try -to read or write an RLE file, or try to read an interlaced or bottom-up Targa -file. This will be addressed soon by replacing jvirtmem.c with something that -uses temporary files for large images. +HINTS + +Avoid running an image through a series of JPEG compression/decompression +cycles. Image quality loss will accumulate; after ten or so cycles the image +may be noticeably worse than it was after one cycle. It's best to use a +lossless format while manipulating an image, then convert to JPEG format when +you are ready to file the image away. + +The -o option to cjpeg is worth using when you are making a "final" version +for posting or archiving. It's also a win when you are using low -Q settings +to make very small JPEG files; the percentage improvement is often a lot more +than it is on larger files. + +The default memory usage limit (-m) is set when the software is compiled. +If you get an "insufficient memory" error, try specifying a smaller -m value, +even -m 0 to use the absolute minimum space. You may want to recompile with +a smaller default value if this happens often. + +djpeg with two-pass color quantization requires a good deal of space; on +MS-DOS machines it may run out of memory even with -m 0. In that case you +can still decompress, with some loss of image quality, by specifying -1 +for one-pass quantization. + +If more space is needed than will fit in the available main memory (as +determined by -m), temporary files will be used. (MS-DOS versions will try to +get extended or expanded memory first.) The temporary files are often rather +large: in typical cases they occupy three bytes per pixel, for example +3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough free disk +space, leave out -o (for cjpeg) or specify -1 (for djpeg). On MS-DOS, the +temporary files are created in the directory named by the TMP or TEMP +environment variable, or in the current directory if neither of those exist. +Amiga implementations put the temp files in the directory named by JPEGTMP:, +so be sure to assign JPEGTMP: to a disk partition with adequate free space. diff --git a/architecture b/architecture index 78587cd7..e27ed189 100644 --- a/architecture +++ b/architecture @@ -1,5 +1,5 @@ - JPEG SYSTEM ARCHITECTURE 3-OCT-91 + JPEG SYSTEM ARCHITECTURE 29-FEB-92 This file provides an overview of the "architecture" of the portable JPEG @@ -13,7 +13,7 @@ to the mark. Also, it is frequently the case that several different modules present a common interface to callers; the term "object" or "method" refers to this common interface (see "Poor man's object-oriented programming", below). -JPEG-specific terminology follows the JPEG R9 draft: +JPEG-specific terminology follows the JPEG standard: A "component" means a color channel, e.g., Red or Luminance. A "sample" is a pixel component value (i.e., one number in the image data). A "coefficient" is a frequency coefficient (a DCT transform output number). @@ -52,8 +52,7 @@ real-time, which nobody is going to do with a pure software implementation. There is some value in supporting the hierarchical mode, which allows for successive frames of higher resolution. This could be of use for including -"thumbnail" representations. Also, Storm's JPEG++ files probably use the -hierarchical mode (I haven't looked). However, this appears to add a lot more +"thumbnail" representations. However, this appears to add a lot more complexity than it is worth. A variety of uncompressed image file formats and user interfaces must be @@ -79,10 +78,10 @@ baggage.) The *logical* steps needed in (non-lossless) JPEG compression are: 1. Conversion from incoming image format to a standardized internal form - (either RGB or greyscale). + (either RGB or grayscale). 2. Color space conversion (e.g., RGB to YCbCr). This is a null step for - greyscale (unless we support mapping color inputs to greyscale, which + grayscale (unless we support mapping color inputs to grayscale, which would most easily be done here). Gamma adjustment may also be needed here. 3. Subsampling (reduction of number of samples in some color components). @@ -171,7 +170,7 @@ The *logical* steps needed in (non-lossless) JPEG decompression are: 4. MCU disassembly (conversion of a possibly interleaved sequence of 8x8 blocks back to separate components in pixel map order). -5. (Optional) Cross-block smoothing per JPEG section 13.10 or a similar +5. (Optional) Cross-block smoothing per JPEG section K.8 or a similar algorithm. (Steps 5-8 operate independently on each component.) 6. Inverse DCT transformation of each 8x8 block. @@ -189,19 +188,23 @@ The *logical* steps needed in (non-lossless) JPEG decompression are: sizes. 10. Color space reconversion (e.g., YCbCr to RGB). This is a null step for - greyscale. (Note that if we support mapping color JPEG to greyscale, - it could be done as part of this step.) Gamma adjustment may also be - needed here. + grayscale. (Note that mapping a color JPEG to grayscale output is most + easily done in this step.) Gamma adjustment may also be needed here. 11. Color quantization (only if a colormapped output format is requested). - NOTE: it might be better to do this on the internal color space instead of - RGB? If so, it would need to be performed one step earlier. + NOTE: it is probably preferable to perform quantization in the internal + (JPEG) colorspace rather than the output colorspace. Doing it that way, + color conversion need only be applied to the colormap entries, not to + every pixel; and quantization gets to operate in a non-gamma-corrected + space. But the internal space may not be suitable for some algorithms. + The system design is such that only the color quantizer module knows + whether color conversion happens before or after quantization. 12. Writing of the desired image format. As before, some of these will be combined into single steps. When dealing with a noninterleaved JPEG file, steps 2-9 will be performed once for each -scan; the resulting data will need to be buffered up so that step 10 can +scan; the resulting data will need to be buffered up so that steps 10-12 can process all the color components together. The same auxiliary modules are needed as before, except for compression @@ -429,12 +432,8 @@ different instances (choose to execute different modules). To minimize the number of object pointers that have to be passed around, it will be easiest to have just a few big structs containing all the method -pointers. We'll actually use two such structs, one for "globally" defined -methods (applicable to the whole file or to all components of the current -scan) and one for methods applicable to a single component. There'll be one -copy of the second kind of struct for each component of the current scan. -This is necessary so that preselection of an optimal method can be done based -on component-specific information (like sampling ratios...) +pointers. We'll actually use two such structs, one for "system-dependent" +methods (memory allocation and error handling) and one for everything else. Because of this choice, it's best not to think of an "object" as a specific data structure. Rather, an "object" is just a group of related methods. @@ -528,7 +527,10 @@ aren't described here; see the header files. Notice that any object that might need to allocate working storage receives an "init" and a "term" call; "term" should be careful to free all allocated storage so that the JPEG system can be used multiple times during a program run. (For the same reason, -depending on static initialization of variables is a no-no.) +depending on static initialization of variables is a no-no. The only +exception to the free-all-allocated-storage rule is that storage allocated for +the entire processing of an image need not be explicitly freed, since the +memory manager's free_all cleanup will free it.) 1. Input file conversion to standardized form. This provides these methods: input_init: read the file header, report image size & component count. @@ -677,8 +679,8 @@ depending on static initialization of variables is a no-no.) afresh for each non-Unix-like platform the compressor is ported to. The UI is expected to supply input and output files and values for all non-automatically-chosen compression parameters. (Hence defaults are - determined by the UI; we should probably provide helpful routines to fill - in recommended defaults.) The UI must also supply error handling + determined by the UI; we should provide helpful routines to fill in + the recommended defaults.) The UI must also supply error handling routines and some mechanism for trace messages. (This module hides the user interface provided --- command line, interactive, etc. Except for error/message handling, the UI calls the @@ -749,7 +751,8 @@ depending on static initialization of variables is a no-no.) alloc_small: allocate an object of given size; use for any random data that's not an image array. free_small: release same. - alloc_medium: like alloc_small, but returns a FAR pointer. + alloc_medium: like alloc_small, but returns a FAR pointer. Use for + any object bigger than a couple kilobytes. free_medium: release same. alloc_small_sarray: construct an all-in-memory image sample array. free_small_sarray: release same. @@ -766,9 +769,13 @@ depending on static initialization of variables is a no-no.) figure out how much space to leave unallocated. access_big_sarray: obtain access to a specified portion of a virtual image sample array. - access_big_barray: ditto for block (coefficient) arrays. free_big_sarray: release a virtual sample array. + access_big_barray, free_big_barray: ditto for block (coefficient) arrays. + free_all: release any remaining storage. This is called + before normal or error termination; the main reason + why it must exist is to ensure that any temporary + files will be deleted upon error termination. alloc_big_arrays will be called by the pipeline controller, which does most of the memory allocation anyway. The only reason for having separate @@ -783,8 +790,8 @@ depending on static initialization of variables is a no-no.) The distinction between sample and coefficient array routines is annoying, but it has to be maintained for machines in which "char *" is represented - differently from "int *"... on byte-addressable machines some of these - methods could point to the same code. + differently from "int *". On byte-addressable machines some of these + methods could perhaps point to the same code. The array routines will operate on only 2-D arrays (one component at a time), since different components may require different-size arrays. @@ -796,8 +803,8 @@ Note that any given implementation will presumably contain only one instantiation of input file header reading, overall control, user interface, and memory management. Thus these could be called as simple subroutines, without bothering with an object indirection. This is essential for overall -control (which has to initialize the object structure); I'm undecided whether -to impose objectness on the other three. +control (which has to initialize the object structure); for consistency we +will impose objectness on the other three. *** Decompression object structure *** @@ -835,7 +842,7 @@ comments at the top of the compression object section also apply here. interface module to single-handedly implement special applications like reading from a non-stdio source. For JPEG-in-TIFF format, the need for random access will make it impossible for this to work; hence the TIFF - header module will probably override the UI read_jpeg_data routine. + header module will override the UI-supplied read_jpeg_data routine. Non-stdio input from a TIFF file will require extensive surgery to the TIFF header module, if indeed it is practical at all. @@ -864,7 +871,7 @@ comments at the top of the compression object section also apply here. always a multiple of an MCU's dimensions. (An object on the grounds that multiple instantiations might be useful.) -5. Cross-block smoothing per JPEG section 13.10 or a similar algorithm. +5. Cross-block smoothing per JPEG section K.8 or a similar algorithm. smooth_coefficients: Given three block rows' worth of a single component, emit a smoothed equivalent of the middle row. The "above" and "below" pointers @@ -874,8 +881,13 @@ comments at the top of the compression object section also apply here. extra memory is needed to buffer the additional block rows. (This object hides the details of the smoothing algorithm.) -6. Inverse DCT transformation of each 8x8 block. (This can be a plain - subroutine processing one block per call.) +6. Inverse DCT transformation of each 8x8 block. + reverse_DCT: given an MCU row's worth of blocks, perform inverse + DCT on each block and output the results into an array + of samples. + We put this method into the jdmcu module for symmetry with the division of + labor in compression. Note that the actual IDCT code is a separate source + file. 7. De-subsampling and smoothing: this will be applied to one component at a time. Note that cross-pixel smoothing, which was a separate step in the @@ -905,9 +917,13 @@ comments at the top of the compression object section also apply here. output are image arrays of same size but possibly different numbers of components. colorout_term: cleanup (probably a no-op except for memory dealloc). - In practice will always be given an MCU row's worth of pixel rows, except + In practice will usually be given an MCU row's worth of pixel rows, except at the bottom where a smaller number of rows may be left over. Note that this object works on all the components at once. + When quantizing colors, color_convert may be applied to the colormap + instead of actual pixel data. color_convert is called by the color + quantizer in this case; the pipeline controller calls color_convert + directly only when not quantizing. (Hides all knowledge of color space semantics and conversion. Remaining modules only need to know the number of JPEG and output components.) @@ -927,33 +943,44 @@ comments at the top of the compression object section also apply here. "big" sample image, output is via put_color_map and put_pixel_rows. (Used only in 2-pass quantization.) color_quant_term: cleanup (probably a no-op except for memory dealloc). + The input to the color quantizer is always in the unconverted colorspace; + its output colormap must be in the converted colorspace. The quantizer + has the choice of which space to work in internally. It must call + color_convert either on its input data or on the colormap it sends to the + output module. For one-pass quantization the image is simply processed by color_quantize, a few rows at a time. For two-pass quantization, the pipeline controller - accumulates the output of color_convert into a "big" sample image. The + accumulates the output of steps 1-8 into a "big" sample image. The color_quant_prescan method is invoked during this process so that the - quantizer can accumulate statistics. At the end of the image, - color_quant_doit is called; it must rescan the "big" image and pass - converted data to the output module. Additional scans of the image could - be made before the output pass is done (in fact, prescan could be a no-op). + quantizer can accumulate statistics. (If the input file has multiple + scans, the prescan may be done during the final scan or as a separate + pass.) At the end of the image, color_quant_doit is called; it must + create and output a colormap, then rescan the "big" image and pass mapped + data to the output module. Additional scans of the image could be made + before the output pass is done (in fact, prescan could be a no-op). As with entropy parameter optimization, the pipeline controller actually passes an iterator function rather than direct access to the big image. - NOTE: it might be better to do this on the internal color space instead of - RGB? If so, it would need to be performed one step earlier. (Hides color quantization algorithm.) 11. Writing of the desired image format. output_init: produce the file header given data from read_file_header. put_color_map: output colormap, if any (called by color quantizer). + If used, must be called before any pixel data is output. put_pixel_rows: output image data in desired format. output_term: finish up at the end. + The actual timing of I/O may differ from that suggested by the routine + names; for instance, writing of the file header may be delayed until + put_color_map time if the actual number of colors is needed in the header. + Also, the colormap is available to put_pixel_rows and output_term as well + as put_color_map. Note that whether colormapping is needed will be determined by the user interface object prior to method selection. In implementations that support multiple output formats, the actual output format will also be determined by the user interface. (Hides format of output image and mechanism used to write it. Note that - several other objects know the color model used by the output format. The - actual mechanism for writing the file is private to this object and the - user interface.) + several other objects know the color model used by the output format. + The actual mechanism for writing the file is private to this object and + the user interface.) 12. Pipeline control. This object will provide the "main loop" that invokes all the pipeline objects. Note that we will need several different main @@ -985,9 +1012,6 @@ comments at the top of the compression object section also apply here. application program", i.e., that which invokes the JPEG decompressor. The UI is expected to supply input and output files and values for all operational parameters. The UI must also supply error handling routines. - At the moment I can't think of any nonfatal errors the JPEG code is likely - to report, so a single report-this-error-and-exit method should be - sufficient. (This module hides the user interface provided --- command line, interactive, etc. Except for error handling, the UI calls the portable JPEG code, not the other way around.) @@ -1050,9 +1074,52 @@ needs a lot smaller temp file than is implied by the maximum-height method. For this approach we'd simply treat DNL as a no-op in the decompressor (at most, check that it matches the SOF image height). -We will not worry about making the compressor capable of outputting DNL. Note -that something similar to the first scheme above could be applied if anyone -ever wants to make that work. +We will not worry about making the compressor capable of outputting DNL. +Something similar to the first scheme above could be applied if anyone ever +wants to make that work. + + +*** Memory manager internal structure *** + +The memory manager contains the most potential for system dependencies. +To isolate system dependencies as much as possible, we have broken the +memory manager into two parts. There is a reasonably system-independent +"front end" (jmemmgr.c) and a "back end" that contains only the code +likely to change across systems. All of the memory management methods +outlined above are implemented by the front end. The back end provides +the following routines for use by the front end (none of these routines +are known to the rest of the JPEG code): + +jmem_init, jmem_term system-dependent initialization/shutdown + +jget_small, jfree_small interface to malloc and free library routines + +jget_large, jfree_large interface to FAR malloc/free in MS-DOS machines; + otherwise same as jget_small/jfree_small + +jmem_available estimate available memory + +jopen_backing_store create a backing-store object + +read_backing_store, manipulate a backing store object +write_backing_store, +close_backing_store + +On some systems there will be more than one type of backing-store object +(specifically, in MS-DOS a backing store file might be an area of extended +memory as well as a disk file). jopen_backing_store is responsible for +choosing how to implement a given object. The read/write/close routines +are method pointers in the structure that describes a given object; this +lets them be different for different object types. + +It may be necessary to ensure that backing store objects are explicitly +released upon abnormal program termination. (For example, MS-DOS won't free +extended memory by itself.) To support this, we will expect the main program +or surrounding application to arrange to call the free_all method upon +abnormal termination; this may require a SIGINT signal handler, for instance. +(We don't want to have the system-dependent module install its own signal +handler, because that would pre-empt the surrounding application's ability +to control signal handling.) *** Notes for MS-DOS implementors *** @@ -1067,10 +1134,10 @@ significant speed penalty. When integrating the JPEG code into a larger application, it's a good idea to stay with a small-data-space model if possible. An 8K stack is much more than sufficient for the JPEG code, and its static data requirements are less than -1K. When executed, it will typically malloc about 10K worth of near heap +1K. When executed, it will typically malloc about 10K-20K worth of near heap space (and lots of far heap, but that doesn't count in this calculation). This figure will vary depending on image size and other factors, but figuring -20K should be more than sufficient. Thus you have about 35K available for +30K should be more than sufficient. Thus you have about 25K available for other modules' static data and near heap requirements before you need to go to a larger memory model. The C library's static data will account for several K of this, but that still leaves a good deal for your needs. (If you are tight @@ -1084,6 +1151,13 @@ JPEG code is stand-alone. (The LZW tables in jrdgif/jwrgif are examples.) To make an optimal implementation, you might want to move these structures back to near heap if you know there is sufficient space. +FAR data space may also be a tight resource when you are dealing with large +images. The most memory-intensive case is decompression with two-pass color +quantization. This requires a 128Kb color histogram plus strip buffers +amounting to about 150 bytes per column for typical sampling ratios (eg, about +96000 bytes for a 640-pixel-wide image). You may not be able to process wide +images if you have large data structures of your own. + *** Potential optimizations *** diff --git a/cjpeg.1 b/cjpeg.1 index 9a183220..c2ca5171 100644 --- a/cjpeg.1 +++ b/cjpeg.1 @@ -1,4 +1,4 @@ -.TH CJPEG 1 "11 December 1991" +.TH CJPEG 1 "28 February 1992" .SH NAME cjpeg \- compress an image file to a JPEG file .SH SYNOPSIS @@ -10,6 +10,9 @@ cjpeg \- compress an image file to a JPEG file .B \-oTIad ] [ +.BI \-m " memory" +] +[ .I filename ] .LP @@ -33,7 +36,8 @@ encoding parameters are used. .B \-o usually makes the JPEG file a little smaller, but .B cjpeg -runs much slower. Image quality and speed of decompression are unaffected by +runs somewhat slower and needs much more memory. Image quality and speed of +decompression are unaffected by .BR \-o . .TP .B \-T @@ -57,6 +61,13 @@ supported for legal reasons). Enable debug printout. More .BR \-d 's give more output. Also, version information is printed at startup. +.TP +.BI \-m " memory" +Set limit for amount of memory to use in processing large images. Value is +in thousands of bytes, or millions of bytes if "M" is attached to the +number. For example, +.B \-m 4m +selects 4000000 bytes. If more space is needed, temporary files will be used. .PP The .B \-Q @@ -113,6 +124,9 @@ This example compresses the PPM file foo.ppm with a quality factor of .SH SEE ALSO .BR djpeg (1) .br +.BR ppm (5), +.BR pgm (5) +.br Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. .SH AUTHOR diff --git a/config.c b/ckconfig.c similarity index 90% rename from config.c rename to ckconfig.c index 938fd197..63fa1160 100644 --- a/config.c +++ b/ckconfig.c @@ -1,7 +1,7 @@ /* - * config.c + * ckconfig.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. */ @@ -121,12 +121,18 @@ int testfunction (int arg1, int * arg2); /* check prototypes */ struct methods_struct { /* check method-pointer declarations */ int (*error_exit) (char *msgtext); int (*trace_message) (char *msgtext); + int (*another_method) (void); }; int testfunction (int arg1, int * arg2) /* check definitions */ { return arg2[arg1]; } + +int testfunction1 (void) /* check void arg list */ +{ + return 0; +} #endif @@ -278,7 +284,7 @@ int main (argc, argv) /* Check whether we have all the ANSI features, */ /* and whether this agrees with __STDC__ being predefined. */ #ifdef __STDC__ -#define MY__STDC__ /* ANSI compilers won't allow redefining __STDC__ */ +#define HAVE_STDC /* ANSI compilers won't allow redefining __STDC__ */ #endif #ifdef HAVE_ANSI_DEFINITIONS @@ -292,28 +298,23 @@ int main (argc, argv) #endif #ifdef HAVE_ALL_ANSI_FEATURES -#ifndef MY__STDC__ +#ifndef HAVE_STDC new_change(); printf("Your compiler doesn't claim to be ANSI-compliant, but it is close enough\n"); - printf("for me. Either add -D__STDC__ to CFLAGS, or add #define __STDC__ at the\n"); - printf("beginning of jinclude.h (NOT jconfig.h).\n"); - printf("Some compilers will not let you do this: they will complain that __STDC__\n"); - printf("is a reserved name. In that case you have a compiler that really is ANSI,\n"); - printf("but you have to give it a special switch (often -ansi) to make it so.\n"); - printf("Check your compiler documentation and add the proper switch to CFLAGS.\n"); -#define MY__STDC__ + printf("for me. Either add -DHAVE_STDC to CFLAGS, or add #define HAVE_STDC at the\n"); + printf("beginning of jconfig.h.\n"); +#define HAVE_STDC #endif #else /* !HAVE_ALL_ANSI_FEATURES */ -#ifdef MY__STDC__ +#ifdef HAVE_STDC new_change(); printf("Your compiler claims to be ANSI-compliant, but it is lying!\n"); - printf("Either add -U__STDC__ to CFLAGS, or add #undef __STDC__\n"); - printf("at the beginning of jinclude.h (NOT jconfig.h).\n"); -#undef MY__STDC__ + printf("Delete the line #define HAVE_STDC near the beginning of jconfig.h.\n"); +#undef HAVE_STDC #endif #endif /* HAVE_ALL_ANSI_FEATURES */ -#ifndef MY__STDC__ +#ifndef HAVE_STDC #ifdef HAVE_ANSI_DEFINITIONS new_change(); @@ -326,31 +327,30 @@ int main (argc, argv) #ifdef HAVE_UNSIGNED_SHORT new_change(); printf("You should add -DHAVE_UNSIGNED_CHAR and -DHAVE_UNSIGNED_SHORT\n"); - printf("to CFLAGS, or else take out the #ifdef __STDC__/#endif lines\n"); + printf("to CFLAGS, or else take out the #ifdef HAVE_STDC/#endif lines\n"); printf("surrounding #define HAVE_UNSIGNED_CHAR and #define HAVE_UNSIGNED_SHORT\n"); printf("in jconfig.h.\n"); #else /* only unsigned char */ new_change(); printf("You should add -DHAVE_UNSIGNED_CHAR to CFLAGS,\n"); printf("or else move #define HAVE_UNSIGNED_CHAR outside the\n"); - printf("#ifdef __STDC__/#endif lines surrounding it in jconfig.h.\n"); + printf("#ifdef HAVE_STDC/#endif lines surrounding it in jconfig.h.\n"); #endif #else /* !HAVE_UNSIGNED_CHAR */ #ifdef HAVE_UNSIGNED_SHORT new_change(); printf("You should add -DHAVE_UNSIGNED_SHORT to CFLAGS,\n"); printf("or else move #define HAVE_UNSIGNED_SHORT outside the\n"); - printf("#ifdef __STDC__/#endif lines surrounding it in jconfig.h.\n"); + printf("#ifdef HAVE_STDC/#endif lines surrounding it in jconfig.h.\n"); #endif #endif /* HAVE_UNSIGNED_CHAR */ #ifdef HAVE_CONST new_change(); - printf("You can delete the #define const line from jconfig.h.\n"); - printf("(But things should still work if you don't.)\n"); + printf("You should delete the #define const line from jconfig.h.\n"); #endif -#endif /* MY__STDC__ */ +#endif /* HAVE_STDC */ test_char_sign((int) signed_char_check); @@ -365,13 +365,13 @@ int main (argc, argv) #endif #ifdef INCLUDES_ARE_ANSI -#ifndef MY__STDC__ +#ifndef __STDC__ new_change(); printf("You should add -DINCLUDES_ARE_ANSI to CFLAGS, or else add\n"); printf("#define INCLUDES_ARE_ANSI at the beginning of jinclude.h (NOT jconfig.h).\n"); #endif #else /* !INCLUDES_ARE_ANSI */ -#ifdef MY__STDC__ +#ifdef __STDC__ new_change(); printf("You should add -DNONANSI_INCLUDES to CFLAGS, or else add\n"); printf("#define NONANSI_INCLUDES at the beginning of jinclude.h (NOT jconfig.h).\n"); diff --git a/djpeg.1 b/djpeg.1 index 5eec670a..df4064c4 100644 --- a/djpeg.1 +++ b/djpeg.1 @@ -1,13 +1,16 @@ -.TH DJPEG 1 "11 December 1991" +.TH DJPEG 1 "28 February 1992" .SH NAME djpeg \- decompress a JPEG file to an image file .SH SYNOPSIS .B djpeg [ -.B \-GPRTbgD2d +.B \-GPRTgD1bd ] [ -.BI \-q " N" +.BI \-q " colors" +] +[ +.BI \-m " memory" ] [ .I filename @@ -20,22 +23,12 @@ decompresses the named JPEG file, or the standard input if no file is named, and produces an image file on the standard output. PPM, GIF, Targa, or RLE output format can be selected. (RLE is supported only if the URT library is available.) -.LP -The color quantization algorithm is currently shoddy. Because of this, the -GIF output mode is not recommended in the current release, except for -gray-scale output (obtained with -.BR \-g ). .SH OPTIONS .TP .B \-G Select GIF output format (implies .BR \-q , with default of 256 colors). -Currently the color quantization uses a shoddy algorithm and external -quantization (e.g. -.IR ppmquant , -.IR rlequant ) -is recommended before conversion to GIF format. .TP .B \-P Select PPM or PGM output format (this is the default). PGM is emitted if the @@ -54,18 +47,14 @@ is specified; otherwise, colormapped format is emitted if .B \-q is specified; otherwise, 24-bit full-color format is emitted. .TP -.B \-b -Perform cross-block smoothing. This is quite memory-intensive and only seems -to improve the image at low quality settings (\fB\-Q\fR 10 to 20 or so). -At normal -.B \-Q -settings it may make the image worse. -.TP .B \-g Force gray-scale output even if input is color. .TP .BI \-q " N" -Quantize to N colors. +Quantize to N colors. This reduces the number of colors in the output image +so that it can be displayed on a colormapped display or stored in a +colormapped file format. For example, if you have an 8-bit display, you'd +need to quantize to 256 or fewer colors. .TP .B \-D Do not use dithering in color quantization. By default, Floyd-Steinberg @@ -73,42 +62,61 @@ dithering is applied when quantizing colors, but on some images dithering may result in objectionable "graininess". If that happens, you can turn off dithering with .BR \-D . +.B \-D +is ignored unless you also say +.B \-q +or +.BR \-G . .TP -.B \-2 -Use two-pass color quantization (not yet supported). +.B \-1 +Use one-pass instead of two-pass color quantization. The one-pass method is +faster and needs less memory, but it produces a lower-quality image. +.B \-1 +is ignored unless you also say +.B \-q +or +.BR \-G . +Also, the one-pass method is always used for gray-scale output (the two-pass +method is no improvement then). +.TP +.B \-b +Perform cross-block smoothing. This is quite memory-intensive and only seems +to improve the image at low quality settings (\fB\-Q\fR 10 to 20 or so). +At normal +.B \-Q +settings it may make the image worse. .TP .B \-d Enable debug printout. More .BR \-d 's give more output. Also, version information is printed at startup. +.TP +.BI \-m " memory" +Set limit for amount of memory to use in processing large images. Value is +in thousands of bytes, or millions of bytes if "M" is attached to the +number. For example, +.B \-m 4m +selects 4000000 bytes. If more space is needed, temporary files will be used. .SH EXAMPLES .LP -This example decompresses the JPEG file foo.jpg and saves the output -as a gray-scale image in foo.pgm: +This example decompresses the JPEG file foo.jpg, quantizes to 256 colors, +and saves the output in GIF format in foo.gif: .IP -.B djpeg \-g +.B djpeg \-G .I foo.jpg .B > -.I foo.pgm +.I foo.gif .SH SEE ALSO .BR cjpeg (1) .br -.BR ppmquant (1) -[From the PBMplus distribution] -.br -.BR rlequant (1) -[From the Utah Raster Toolkit distribution] +.BR ppm (5), +.BR pgm (5) .br Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. .SH AUTHOR Independent JPEG Group .SH BUGS -.B djpeg -currently uses a shoddy color quantization algorithm. This leads to -poor GIF file output. Two-pass color quantization is not yet -supported. -.PP Arithmetic coding is not supported for legal reasons. .PP Not as fast as we'd like. diff --git a/example.c b/example.c new file mode 100644 index 00000000..2cd3afb7 --- /dev/null +++ b/example.c @@ -0,0 +1,624 @@ +/* + * example.c + * + * This file is not actually part of the JPEG software. Rather, it provides + * a skeleton that may be useful for constructing applications that use the + * JPEG software as subroutines. This code will NOT do anything useful as is. + * + * This file illustrates how to use the JPEG code as a subroutine library + * to read or write JPEG image files. We assume here that you are not + * merely interested in converting the image to yet another image file format + * (if you are, you should be adding another I/O module to cjpeg/djpeg, not + * constructing a new application). Instead, we show how to pass the + * decompressed image data into or out of routines that you provide. For + * example, a viewer program might use the JPEG decompressor together with + * routines that write the decompressed image directly to a display. + * + * We present these routines in the same coding style used in the JPEG code + * (ANSI function definitions, etc); but you are of course free to code your + * routines in a different style if you prefer. + */ + +/* + * Include file for declaring JPEG data structures. + * This file also includes some system headers like ; + * if you prefer, you can include "jconfig.h" and "jpegdata.h" instead. + */ + +#include "jinclude.h" + +/* + * is used for the optional error recovery mechanism shown in + * the second part of the example. + */ + +#include + + + +/******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/ + +/* This half of the example shows how to feed data into the JPEG compressor. + * We present a minimal version that does not worry about refinements such + * as error recovery (the JPEG code will just exit() if it gets an error). + */ + + +/* + * To supply the image data for compression, you must define three routines + * input_init, get_input_row, and input_term. These routines will be called + * from the JPEG compressor via function pointer values that you store in the + * cinfo data structure; hence they need not be globally visible and the exact + * names don't matter. (In fact, the "METHODDEF" macro expands to "static" if + * you use the unmodified JPEG include files.) + * + * The input file reading modules (jrdppm.c, jrdgif.c, jrdtarga.c, etc) may be + * useful examples of what these routines should actually do, although each of + * them is encrusted with a lot of specialized code for its own file format. + */ + + +METHODDEF void +input_init (compress_info_ptr cinfo) +/* Initialize for input; return image size and component data. */ +{ + /* This routine must return five pieces of information about the incoming + * image, and must do any setup needed for the get_input_row routine. + * The image information is returned in fields of the cinfo struct. + * (If you don't care about modularity, you could initialize these fields + * in the main JPEG calling routine, and make this routine be a no-op.) + * We show some example values here. + */ + cinfo->image_width = 640; /* width in pixels */ + cinfo->image_height = 480; /* height in pixels */ + /* JPEG views an image as being 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 or + * grayscale data. If you want to use something else, you'll need to study + * and perhaps modify jcdeflts.c, jccolor.c, and jdcolor.c. + */ + cinfo->input_components = 3; /* or 1 for grayscale */ + cinfo->in_color_space = CS_RGB; /* or CS_GRAYSCALE for grayscale */ + cinfo->data_precision = 8; /* bits per pixel component value */ + /* In the current JPEG software, data_precision must be set equal to + * BITS_IN_JSAMPLE, which is 8 unless you twiddle jconfig.h. Future + * versions might allow you to say either 8 or 12 if compiled with + * 12-bit JSAMPLEs, or up to 16 in lossless mode. In any case, + * it is up to you to scale incoming pixel values to the range + * 0 .. (1<input_components-1, and column runs + * from 0 to cinfo->image_width-1 (column 0 is left edge of image). Note that + * this is actually an array of pointers to arrays rather than a true 2D array, + * since C does not support variable-size multidimensional arrays. + * JSAMPLE is typically typedef'd as "unsigned char". + */ + + +METHODDEF void +get_input_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) +/* Read next row of pixels into pixel_row[][] */ +{ + /* This example shows how you might read RGB data (3 components) + * from an input file in which the data is stored 3 bytes per pixel + * in left-to-right, top-to-bottom order. + */ + register FILE * infile = cinfo->input_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + + ptr0 = pixel_row[0]; + ptr1 = pixel_row[1]; + ptr2 = pixel_row[2]; + for (col = 0; col < cinfo->image_width; col++) { + *ptr0++ = (JSAMPLE) getc(infile); /* red */ + *ptr1++ = (JSAMPLE) getc(infile); /* green */ + *ptr2++ = (JSAMPLE) getc(infile); /* blue */ + } +} + + +METHODDEF void +input_term (compress_info_ptr cinfo) +/* Finish up at the end of the input */ +{ + /* This termination routine will very often have no work to do, */ + /* but you must provide it anyway. */ + /* Note that the JPEG code will only call it during successful exit; */ + /* if you want it called during error exit, you gotta do that yourself. */ +} + + +/* + * That's it for the routines that deal with reading the input image data. + * Now we have overall control and parameter selection routines. + */ + + +/* + * This routine must determine what output JPEG file format is to be written, + * and make any other compression parameter changes that are desirable. + * This routine gets control after the input file header has been read + * (i.e., right after input_init has been called). You could combine its + * functions into input_init, or even into the main control routine, but + * if you have several different input_init routines, it's a definite win + * to keep this separate. You MUST supply this routine even if it's a no-op. + */ + +METHODDEF void +c_ui_method_selection (compress_info_ptr cinfo) +{ + /* If the input is gray scale, generate a monochrome JPEG file. */ + if (cinfo->in_color_space == CS_GRAYSCALE) + j_monochrome_default(cinfo); + /* For now, always select JFIF output format. */ + jselwjfif(cinfo); +} + + +/* + * OK, here is the main function that actually causes everything to happen. + * We assume here that the target filename is supplied by the caller of this + * routine, and that all JPEG compression parameters can be default values. + */ + +GLOBAL void +write_JPEG_file (char * filename) +{ + /* These three structs contain JPEG parameters and working data. + * They must survive for the duration of parameter setup and one + * call to jpeg_compress; typically, making them local data in the + * calling routine is the best strategy. + */ + struct compress_info_struct cinfo; + struct compress_methods_struct c_methods; + struct external_methods_struct e_methods; + + /* Initialize the system-dependent method pointers. */ + cinfo.methods = &c_methods; /* links to method structs */ + cinfo.emethods = &e_methods; + /* Here we use the default JPEG error handler, which will just print + * an error message on stderr and call exit(). See the second half of + * this file for an example of more graceful error recovery. + */ + jselerror(&e_methods); /* select std error/trace message routines */ + /* Here we use the standard memory manager provided with the JPEG code. + * In some cases you might want to replace the memory manager, or at + * least the system-dependent part of it, with your own code. + */ + jselmemmgr(&e_methods); /* select std memory allocation routines */ + /* If the compressor requires full-image buffers (for entropy-coding + * optimization or a noninterleaved JPEG file), it will create temporary + * files for anything that doesn't fit within the maximum-memory setting. + * (Note that temp files are NOT needed if you use the default parameters.) + * You can change the default maximum-memory setting by changing + * e_methods.max_memory_to_use after jselmemmgr returns. + * On some systems you may also need to set up a signal handler to + * ensure that temporary files are deleted if the program is interrupted. + * (This is most important if you are on MS-DOS and use the jmemdos.c + * memory manager back end; it will try to grab extended memory for + * temp files, and that space will NOT be freed automatically.) + * See jcmain.c or jdmain.c for an example signal handler. + */ + + /* Here, set up pointers to your own routines for input data handling + * and post-init parameter selection. + */ + c_methods.input_init = input_init; + c_methods.get_input_row = get_input_row; + c_methods.input_term = input_term; + c_methods.c_ui_method_selection = c_ui_method_selection; + + /* Set up default JPEG parameters in the cinfo data structure. */ + j_c_defaults(&cinfo, 75, FALSE); + /* Note: 75 is the recommended default quality level; you may instead pass + * a user-specified quality level. Be aware that values below 25 will cause + * non-baseline JPEG files to be created (and a warning message to that + * effect to be emitted on stderr). This won't bother our decoder, but some + * commercial JPEG implementations may choke on non-baseline JPEG files. + * If you want to force baseline compatibility, pass TRUE instead of FALSE. + * (If non-baseline files are fine, but you could do without that warning + * message, set e_methods.trace_level to -1.) + */ + + /* At this point you can modify the default parameters set by j_c_defaults + * as needed. For a minimal implementation, you shouldn't need to change + * anything. See jcmain.c for some examples of what you might change. + */ + + /* Select the input and output files. + * Note that cinfo.input_file is only used if your input reading routines + * use it; otherwise, you can just make it NULL. + * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that + * requires it in order to write binary files. + */ + + cinfo.input_file = NULL; /* if no actual input file involved */ + + if ((cinfo.output_file = fopen(filename, "wb")) == NULL) { + fprintf(stderr, "can't open %s\n", filename); + exit(1); + } + + /* Here we go! */ + jpeg_compress(&cinfo); + + /* That's it, son. Nothin' else to do, except close files. */ + /* Here we assume only the output file need be closed. */ + fclose(cinfo.output_file); + + /* Note: if you want to compress more than one image, we recommend you + * repeat this whole routine. You MUST repeat the j_c_defaults()/alter + * parameters/jpeg_compress() sequence, as some data structures allocated + * in j_c_defaults are freed upon exit from jpeg_compress. + */ +} + + + +/******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/ + +/* This half of the example shows how to read data from the JPEG decompressor. + * It's a little more refined than the above in that we show how to do your + * own error recovery. If you don't care about that, you don't need these + * next two routines. + */ + + +/* + * These routines replace the default trace/error routines included with the + * JPEG code. The example trace_message routine shown here is actually the + * same as the standard one, but you could modify it if you don't want messages + * sent to stderr. The example error_exit routine is set up to return + * control to read_JPEG_file() rather than calling exit(). You can use the + * same routines for both compression and decompression error recovery. + */ + +/* These static variables are needed by the error routines. */ +static jmp_buf setjmp_buffer; /* for return to caller */ +static external_methods_ptr emethods; /* needed for access to message_parm */ + + +/* This routine is used for any and all trace, debug, or error printouts + * from the JPEG code. The parameter is a printf format string; up to 8 + * integer data values for the format string have been stored in the + * message_parm[] field of the external_methods struct. + */ + +METHODDEF void +trace_message (const char *msgtext) +{ + fprintf(stderr, msgtext, + emethods->message_parm[0], emethods->message_parm[1], + emethods->message_parm[2], emethods->message_parm[3], + emethods->message_parm[4], emethods->message_parm[5], + emethods->message_parm[6], emethods->message_parm[7]); + fprintf(stderr, "\n"); /* there is no \n in the format string! */ +} + +/* + * The error_exit() routine should not return to its caller. The default + * routine calls exit(), but here we assume that we want to return to + * read_JPEG_data, which has set up a setjmp context for the purpose. + * You should make sure that the free_all method is called, either within + * error_exit or after the return to the outer-level routine. + */ + +METHODDEF void +error_exit (const char *msgtext) +{ + trace_message(msgtext); /* report the error message */ + (*emethods->free_all) (); /* clean up memory allocation & temp files */ + longjmp(setjmp_buffer, 1); /* return control to outer routine */ +} + + + +/* + * To accept the image data from decompression, you must define four routines + * output_init, put_color_map, put_pixel_rows, and output_term. + * + * You must understand the distinction between full color output mode + * (N independent color components) and colormapped output mode (a single + * output component representing an index into a color map). You should use + * colormapped mode to write to a colormapped display screen or output file. + * Colormapped mode is also useful for reducing grayscale output to a small + * number of gray levels: when using the 1-pass quantizer on grayscale data, + * the colormap entries will be evenly spaced from 0 to MAX_JSAMPLE, so you + * can regard the indexes are directly representing gray levels at reduced + * precision. In any other case, you should not depend on the colormap + * entries having any particular order. + * To get colormapped output, set cinfo->quantize_colors to TRUE and set + * cinfo->desired_number_of_colors to the maximum number of entries in the + * colormap. This can be done either in your main routine or in + * d_ui_method_selection. For grayscale quantization, also set + * cinfo->two_pass_quantize to FALSE to ensure the 1-pass quantizer is used + * (presently this is the default, but it may not be so in the future). + * + * The output file writing modules (jwrppm.c, jwrgif.c, jwrtarga.c, etc) may be + * useful examples of what these routines should actually do, although each of + * them is encrusted with a lot of specialized code for its own file format. + */ + + +METHODDEF void +output_init (decompress_info_ptr cinfo) +/* This routine should do any setup required */ +{ + /* This routine can initialize for output based on the data passed in cinfo. + * Useful fields include: + * image_width, image_height Pretty obvious, I hope. + * data_precision bits per pixel value; typically 8. + * out_color_space output colorspace previously requested + * color_out_comps number of color components in same + * final_out_comps number of components actually output + * final_out_comps is 1 if quantize_colors is true, else it is equal to + * color_out_comps. + * + * If you have requested color quantization, the colormap is NOT yet set. + * You may wish to defer output initialization until put_color_map is called. + */ +} + + +/* + * This routine is called if and only if you have set cinfo->quantize_colors + * to TRUE. It is given the selected colormap and can complete any required + * initialization. This call will occur after output_init and before any + * calls to put_pixel_rows. Note that the colormap pointer is also placed + * in a cinfo field, whence it can be used by put_pixel_rows or output_term. + * num_colors will be less than or equal to desired_number_of_colors. + * + * The colormap data is supplied as a 2-D array of JSAMPLEs, indexed as + * JSAMPLE colormap[component][indexvalue] + * where component runs from 0 to cinfo->color_out_comps-1, and indexvalue + * runs from 0 to num_colors-1. Note that this is actually an array of + * pointers to arrays rather than a true 2D array, since C does not support + * variable-size multidimensional arrays. + * JSAMPLE is typically typedef'd as "unsigned char". If you want your code + * to be as portable as the JPEG code proper, you should always access JSAMPLE + * values with the GETJSAMPLE() macro, which will do the right thing if the + * machine has only signed chars. + */ + +METHODDEF void +put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) +/* Write the color map */ +{ + /* You need not provide this routine if you always set cinfo->quantize_colors + * FALSE; but a safer practice is to provide it and have it just print an + * error message, like this: + */ + fprintf(stderr, "put_color_map called: there's a bug here somewhere!\n"); +} + + +/* + * This function is called repeatedly, with a few more rows of pixels supplied + * on each call. With the current JPEG code, some multiple of 8 rows will be + * passed on each call except the last, but it is extremely bad form to depend + * on this. You CAN assume num_rows > 0. + * The data is supplied in top-to-bottom row order (the standard order within + * a JPEG file). If you cannot readily use the data in that order, you'll + * need an intermediate array to hold the image. See jwrrle.c for an example + * of outputting data in bottom-to-top order. + * + * The data is supplied as a 3-D array of JSAMPLEs, indexed as + * JSAMPLE pixel_data[component][row][column] + * where component runs from 0 to cinfo->final_out_comps-1, row runs from 0 to + * num_rows-1, and column runs from 0 to cinfo->image_width-1 (column 0 is + * left edge of image). Note that this is actually an array of pointers to + * pointers to arrays rather than a true 3D array, since C does not support + * variable-size multidimensional arrays. + * JSAMPLE is typically typedef'd as "unsigned char". If you want your code + * to be as portable as the JPEG code proper, you should always access JSAMPLE + * values with the GETJSAMPLE() macro, which will do the right thing if the + * machine has only signed chars. + * + * If quantize_colors is true, then there is only one component, and its values + * are indexes into the previously supplied colormap. Otherwise the values + * are actual data in your selected output colorspace. + */ + + +METHODDEF void +put_pixel_rows (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE pixel_data) +/* Write some rows of output data */ +{ + /* This example shows how you might write full-color RGB data (3 components) + * to an output file in which the data is stored 3 bytes per pixel. + */ + register FILE * outfile = cinfo->output_file; + register JSAMPROW ptr0, ptr1, ptr2; + register long col; + register int row; + + for (row = 0; row < num_rows; row++) { + ptr0 = pixel_data[0][row]; + ptr1 = pixel_data[1][row]; + ptr2 = pixel_data[2][row]; + for (col = 0; col < cinfo->image_width; col++) { + putc(GETJSAMPLE(*ptr0), outfile); /* red */ + ptr0++; + putc(GETJSAMPLE(*ptr1), outfile); /* green */ + ptr1++; + putc(GETJSAMPLE(*ptr2), outfile); /* blue */ + ptr2++; + } + } +} + + +METHODDEF void +output_term (decompress_info_ptr cinfo) +/* Finish up at the end of the output */ +{ + /* This termination routine may not need to do anything. */ + /* Note that the JPEG code will only call it during successful exit; */ + /* if you want it called during error exit, you gotta do that yourself. */ +} + + +/* + * That's it for the routines that deal with writing the output image. + * Now we have overall control and parameter selection routines. + */ + + +/* + * This routine gets control after the JPEG file header has been read; + * at this point the image size and colorspace are known. + * The routine must determine what output routines are to be used, and make + * any decompression parameter changes that are desirable. For example, + * if it is found that the JPEG file is grayscale, you might want to do + * things differently than if it is color. You can also delay setting + * quantize_colors and associated options until this point. + * + * j_d_defaults initializes out_color_space to CS_RGB. If you want grayscale + * output you should set out_color_space to CS_GRAYSCALE. Note that you can + * force grayscale output from a color JPEG file (though not vice versa). + */ + +METHODDEF void +d_ui_method_selection (decompress_info_ptr cinfo) +{ + /* if grayscale input, force grayscale output; */ + /* else leave the output colorspace as set by main routine. */ + if (cinfo->jpeg_color_space == CS_GRAYSCALE) + cinfo->out_color_space = CS_GRAYSCALE; + + /* select output routines */ + cinfo->methods->output_init = output_init; + cinfo->methods->put_color_map = put_color_map; + cinfo->methods->put_pixel_rows = put_pixel_rows; + cinfo->methods->output_term = output_term; +} + + +/* + * OK, here is the main function that actually causes everything to happen. + * We assume here that the JPEG filename is supplied by the caller of this + * routine, and that all decompression parameters can be default values. + * The routine returns 1 if successful, 0 if not. + */ + +GLOBAL int +read_JPEG_file (char * filename) +{ + /* These three structs contain JPEG parameters and working data. + * They must survive for the duration of parameter setup and one + * call to jpeg_decompress; typically, making them local data in the + * calling routine is the best strategy. + */ + struct decompress_info_struct cinfo; + struct decompress_methods_struct dc_methods; + struct external_methods_struct e_methods; + + /* Select the input and output files. + * In this example we want to open the input file before doing anything else, + * so that the setjmp() error recovery below can assume the file is open. + * Note that cinfo.output_file is only used if your output handling routines + * use it; otherwise, you can just make it NULL. + * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that + * requires it in order to read binary files. + */ + + if ((cinfo.input_file = fopen(filename, "rb")) == NULL) { + fprintf(stderr, "can't open %s\n", filename); + return 0; + } + + cinfo.output_file = NULL; /* if no actual output file involved */ + + /* Initialize the system-dependent method pointers. */ + cinfo.methods = &dc_methods; /* links to method structs */ + cinfo.emethods = &e_methods; + /* Here we supply our own error handler; compare to use of standard error + * handler in the previous write_JPEG_file example. + */ + emethods = &e_methods; /* save struct addr for possible access */ + e_methods.error_exit = error_exit; /* supply error-exit routine */ + e_methods.trace_message = trace_message; /* supply trace-message routine */ + + /* prepare setjmp context for possible exit from error_exit */ + if (setjmp(setjmp_buffer)) { + /* If we get here, the JPEG code has signaled an error. + * Memory allocation has already been cleaned up (see free_all call in + * error_exit), but we need to close the input file before returning. + * You might also need to close an output file, etc. + */ + fclose(cinfo.input_file); + return 0; + } + + /* Here we use the standard memory manager provided with the JPEG code. + * In some cases you might want to replace the memory manager, or at + * least the system-dependent part of it, with your own code. + */ + jselmemmgr(&e_methods); /* select std memory allocation routines */ + /* If the decompressor requires full-image buffers (for two-pass color + * quantization or a noninterleaved JPEG file), it will create temporary + * files for anything that doesn't fit within the maximum-memory setting. + * You can change the default maximum-memory setting by changing + * e_methods.max_memory_to_use after jselmemmgr returns. + * On some systems you may also need to set up a signal handler to + * ensure that temporary files are deleted if the program is interrupted. + * (This is most important if you are on MS-DOS and use the jmemdos.c + * memory manager back end; it will try to grab extended memory for + * temp files, and that space will NOT be freed automatically.) + * See jcmain.c or jdmain.c for an example signal handler. + */ + + /* Here, set up the pointer to your own routine for post-header-reading + * parameter selection. You could also initialize the pointers to the + * output data handling routines here, if they are not dependent on the + * image type. + */ + dc_methods.d_ui_method_selection = d_ui_method_selection; + + /* Set up default decompression parameters. */ + j_d_defaults(&cinfo, TRUE); + /* TRUE indicates that an input buffer should be allocated. + * In unusual cases you may want to allocate the input buffer yourself; + * see jddeflts.c for commentary. + */ + + /* At this point you can modify the default parameters set by j_d_defaults + * as needed; for example, you can request color quantization or force + * grayscale output. See jdmain.c for examples of what you might change. + */ + + /* Set up to read a JFIF or baseline-JPEG file. */ + /* This is the only JPEG file format currently supported. */ + jselrjfif(&cinfo); + + /* Here we go! */ + jpeg_decompress(&cinfo); + + /* That's it, son. Nothin' else to do, except close files. */ + /* Here we assume only the input file need be closed. */ + fclose(cinfo.input_file); + + return 1; /* indicate success */ + + /* Note: if you want to decompress more than one image, we recommend you + * repeat this whole routine. You MUST repeat the j_d_defaults()/alter + * parameters/jpeg_decompress() sequence, as some data structures allocated + * in j_d_defaults are freed upon exit from jpeg_decompress. + */ +} diff --git a/jbsmooth.c b/jbsmooth.c index ee58c91b..c18addd5 100644 --- a/jbsmooth.c +++ b/jbsmooth.c @@ -1,7 +1,7 @@ /* * jbsmooth.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 @@ smooth_coefficients (decompress_info_ptr cinfo, if (above != NULL && below != NULL) { for (col = 1; col < blocks_in_row-1; col++) { - /* See section 13.10 of JPEG-8-R8, or K.8 of JPEG-9-R6. + /* See section K.8 of the JPEG standard. * * As I understand it, this produces approximations * for the low frequency AC components, based on the @@ -51,9 +51,7 @@ smooth_coefficients (decompress_info_ptr cinfo, * (Thus it can't be used for blocks on the image edges.) */ - /* The layout of these variables corresponds to - * the text in 13.10 - */ + /* The layout of these variables corresponds to text and figure in K.8 */ JCOEF DC1, DC2, DC3; JCOEF DC4, DC5, DC6; diff --git a/jcarith.c b/jcarith.c index 1949459c..f6867478 100644 --- a/jcarith.c +++ b/jcarith.c @@ -1,7 +1,7 @@ /* * jcarith.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * diff --git a/jccolor.c b/jccolor.c index bd0e1a25..6fb15129 100644 --- a/jccolor.c +++ b/jccolor.c @@ -1,7 +1,7 @@ /* * jccolor.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,11 +32,35 @@ colorin_init (compress_info_ptr cinfo) /* * Fetch some rows of pixels from get_input_row and convert to the * JPEG colorspace. + */ + + +/* * This version handles RGB -> YCbCr conversion. * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + * The conversion equations to be implemented are therefore + * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + * where Cb and Cr must be incremented by MAXJSAMPLE/2 to create a + * nonnegative output value. + * (These numbers are derived from TIFF Appendix O, draft of 4/10/91.) + * + * To avoid floating-point arithmetic, we represent the fractional constants + * as integers scaled up by 2^14 (about 4 digits precision); we have to divide + * the products by 2^14, with appropriate rounding, to get the correct answer. + * + * For even more speed, we could avoid any multiplications in the inner loop + * by precalculating the constants times R,G,B for all possible values. + * This is not currently implemented. */ +#define SCALEBITS 14 +#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) +#define FIX(x) ((INT32) ((x) * (1L<> 10); + (( FIX(0.29900)*r + FIX(0.58700)*g + FIX(0.11400)*b + + ONE_HALF) >> SCALEBITS); /* Cb */ *outptr1++ = (JSAMPLE) - (((-173)*r - 339*g + 512*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10); + (((-FIX(0.16874))*r - FIX(0.33126)*g + FIX(0.50000)*b + + ONE_HALF*(MAXJSAMPLE+1)) >> SCALEBITS); /* Cr */ *outptr2++ = (JSAMPLE) - (( 512*r - 429*g - 83*b + (INT32) 512*(MAXJSAMPLE+1)) >> 10); + (( FIX(0.50000)*r - FIX(0.41869)*g - FIX(0.08131)*b + + ONE_HALF*(MAXJSAMPLE+1)) >> SCALEBITS); } } } @@ -132,9 +161,7 @@ get_noconvert_rows (compress_info_ptr cinfo, METHODDEF void colorin_term (compress_info_ptr cinfo) { - /* Release the workspace. */ - (*cinfo->emethods->free_small_sarray) - (pixel_row, (long) cinfo->input_components); + /* no work (we let free_all release the workspace) */ } @@ -153,6 +180,8 @@ jselccolor (compress_info_ptr cinfo) break; case CS_RGB: + case CS_YCbCr: + case CS_YIQ: if (cinfo->input_components != 3) ERREXIT(cinfo->emethods, "Bogus input colorspace"); break; @@ -183,6 +212,8 @@ jselccolor (compress_info_ptr cinfo) ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); if (cinfo->in_color_space == CS_RGB) cinfo->methods->get_sample_rows = get_rgb_ycc_rows; + else if (cinfo->in_color_space == CS_YCbCr) + cinfo->methods->get_sample_rows = get_noconvert_rows; else ERREXIT(cinfo->emethods, "Unsupported color conversion request"); break; diff --git a/jcdeflts.c b/jcdeflts.c index 15039899..fe25f74a 100644 --- a/jcdeflts.c +++ b/jcdeflts.c @@ -1,7 +1,7 @@ /* * jcdeflts.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -13,6 +13,35 @@ #include "jinclude.h" +/* Default do-nothing progress monitoring routine. + * This can be overridden by a user interface that wishes to + * provide progress monitoring; just set methods->progress_monitor + * after j_c_defaults is done. The routine will be called periodically + * during the compression process. + * + * During any one pass, loopcounter increases from 0 up to (not including) + * looplimit; the step size is not necessarily 1. Both the step size and + * the limit may differ between passes. The expected total number of passes + * is in cinfo->total_passes, and the number of passes already completed is + * in cinfo->completed_passes. Thus the fraction of work completed may be + * estimated as + * completed_passes + (loopcounter/looplimit) + * ------------------------------------------ + * total_passes + * ignoring the fact that the passes may not be equal amounts of work. + */ + +METHODDEF void +progress_monitor (compress_info_ptr cinfo, long loopcounter, long looplimit) +{ + /* do nothing */ +} + + +/* + * Table setup routines + */ + LOCAL void add_huff_table (compress_info_ptr cinfo, HUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) @@ -38,7 +67,8 @@ add_huff_table (compress_info_ptr cinfo, LOCAL void std_huff_tables (compress_info_ptr cinfo) -/* Set up the standard Huffman tables (cf. JPEG-8-R8 section 13.3) */ +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ { static const UINT8 dc_luminance_bits[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; @@ -111,7 +141,7 @@ std_huff_tables (compress_info_ptr cinfo) } -/* This is the sample quantization table given in JPEG-8-R8 sec 13.1, +/* 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). * The spec says that the values given produce "good" quality, and * when divided by 2, "very good" quality. (These two settings are @@ -226,14 +256,9 @@ j_set_quality (compress_info_ptr cinfo, int quality, boolean force_baseline) * you should also change the component ID codes, and you should NOT emit * a JFIF header (set write_JFIF_header = FALSE). * - * CAUTION: if you want to compress multiple images per run, it's safest - * to call j_c_defaults before *each* call to jpeg_compress (and - * j_c_free_defaults afterwards). If this isn't practical, you'll have to - * be careful to reset any individual parameters that may change during - * the compression run. The main thing you need to worry about at present - * is that the sent_table boolean in each Huffman table must be reset to - * FALSE before each compression; otherwise, Huffman tables won't get - * emitted for the second and subsequent images. + * CAUTION: if you want to compress multiple images per run, it's necessary + * to call j_c_defaults before *each* call to jpeg_compress, since subsidiary + * structures like the Huffman tables are automatically freed during cleanup. */ GLOBAL void @@ -252,7 +277,7 @@ j_c_defaults (compress_info_ptr cinfo, int quality, boolean force_baseline) cinfo->ac_huff_tbl_ptrs[i] = NULL; } - cinfo->data_precision = 8; /* default; can be overridden by input_init */ + cinfo->data_precision = BITS_IN_JSAMPLE; /* default; can be overridden by input_init */ cinfo->density_unit = 0; /* Pixel size is unknown by default */ cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ cinfo->Y_density = 1; @@ -324,6 +349,9 @@ j_c_defaults (compress_info_ptr cinfo, int quality, boolean force_baseline) /* No restart markers */ cinfo->restart_interval = 0; + + /* Install default do-nothing progress monitoring method. */ + cinfo->methods->progress_monitor = progress_monitor; } @@ -341,27 +369,3 @@ j_monochrome_default (compress_info_ptr cinfo) compptr->h_samp_factor = 1; compptr->v_samp_factor = 1; } - - - -/* This routine releases storage allocated by j_c_defaults. - * Note that freeing the method pointer structs and the compress_info_struct - * itself are the responsibility of the user interface. - */ - -GLOBAL void -j_c_free_defaults (compress_info_ptr cinfo) -{ - short i; - -#define FREE(ptr) if ((ptr) != NULL) \ - (*cinfo->emethods->free_small) ((void *) ptr) - - FREE(cinfo->comp_info); - for (i = 0; i < NUM_QUANT_TBLS; i++) - FREE(cinfo->quant_tbl_ptrs[i]); - for (i = 0; i < NUM_HUFF_TBLS; i++) { - FREE(cinfo->dc_huff_tbl_ptrs[i]); - FREE(cinfo->ac_huff_tbl_ptrs[i]); - } -} diff --git a/jcexpand.c b/jcexpand.c index 94878bd9..1f209381 100644 --- a/jcexpand.c +++ b/jcexpand.c @@ -1,7 +1,7 @@ /* * jcexpand.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * diff --git a/jchuff.c b/jchuff.c index 44a0885a..07bff649 100644 --- a/jchuff.c +++ b/jchuff.c @@ -1,7 +1,7 @@ /* * jchuff.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 @@ fix_huff_tbl (HUFF_TBL * htbl) UINT16 huffcode[257]; UINT16 code; - /* Figure 7.3.5.4.2.1: make table of Huffman code length for each symbol */ + /* Figure C.1: make table of Huffman code length for each symbol */ /* Note that this is in code-length order. */ p = 0; @@ -45,7 +45,7 @@ fix_huff_tbl (HUFF_TBL * htbl) huffsize[p] = 0; lastp = p; - /* Figure 7.3.5.4.2.2: generate the codes themselves */ + /* Figure C.2: generate the codes themselves */ /* Note that this is in code-length order. */ code = 0; @@ -60,27 +60,21 @@ fix_huff_tbl (HUFF_TBL * htbl) si++; } - /* Figure 7.3.5.4.2.3: generate encoding tables */ + /* Figure C.3: generate encoding tables */ /* These are code and size indexed by symbol value */ + /* Set any codeless symbols to have code length 0; + * this allows emit_bits to detect any attempt to emit such symbols. + */ + MEMZERO((void *) htbl->ehufsi, SIZEOF(htbl->ehufsi)); + for (p = 0; p < lastp; p++) { htbl->ehufco[htbl->huffval[p]] = huffcode[p]; htbl->ehufsi[htbl->huffval[p]] = huffsize[p]; } - /* Figure 13.4.2.3.1: generate decoding tables */ - - p = 0; - for (l = 1; l <= 16; l++) { - if (htbl->bits[l]) { - htbl->valptr[l] = p; /* huffval[] index of 1st sym of code len l */ - htbl->mincode[l] = huffcode[p]; /* minimum code of length l */ - p += htbl->bits[l]; - htbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ - } else { - htbl->maxcode[l] = -1; - } - } + /* We don't bother to fill in the decoding tables mincode[], maxcode[], */ + /* and valptr[], since they are not used for encoding. */ } @@ -117,6 +111,10 @@ emit_bits (UINT16 code, int size) register INT32 put_buffer = code; register int put_bits = huff_put_bits; + /* if size is 0, caller used an invalid Huffman table entry */ + if (size == 0) + ERREXIT(cinfo->emethods, "Missing Huffman code table entry"); + put_buffer &= (((INT32) 1) << size) - 1; /* Mask off any excess bits in code */ put_bits += size; /* new number of bits in buffer */ @@ -161,7 +159,7 @@ encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) register int nbits; register int k, r, i; - /* Encode the DC coefficient difference per section 7.3.5.1 */ + /* Encode the DC coefficient difference per section F.1.2.1 */ temp = temp2 = block[0]; @@ -184,9 +182,10 @@ encode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ - emit_bits((UINT16) temp2, nbits); + if (nbits) /* emit_bits rejects calls with size 0 */ + emit_bits((UINT16) temp2, nbits); - /* Encode the AC coefficients per section 7.3.5.2 */ + /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ @@ -378,7 +377,7 @@ gen_huff_coding (compress_info_ptr cinfo, HUFF_TBL *htbl, long freq[]) int p, i, j; long v; - /* This algorithm is explained in section 13.2 of JPEG-8-R8 */ + /* This algorithm is explained in section K.2 of the JPEG standard */ MEMZERO((void *) bits, SIZEOF(bits)); MEMZERO((void *) codesize, SIZEOF(codesize)); @@ -512,7 +511,7 @@ htest_one_block (JBLOCK block, JCOEF block0, register int nbits; register int k, r; - /* Encode the DC coefficient difference per section 7.3.5.1 */ + /* Encode the DC coefficient difference per section F.1.2.1 */ /* Find the number of bits needed for the magnitude of the coefficient */ temp = block0; @@ -524,7 +523,7 @@ htest_one_block (JBLOCK block, JCOEF block0, /* Count the Huffman symbol for the number of bits */ dc_counts[nbits]++; - /* Encode the AC coefficients per section 7.3.5.2 */ + /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ @@ -689,6 +688,15 @@ jselchuffman (compress_info_ptr cinfo) cinfo->methods->entropy_encoder_term = huff_term; #ifdef ENTROPY_OPT_SUPPORTED cinfo->methods->entropy_optimize = huff_optimize; + /* The standard Huffman tables are only valid for 8-bit data precision. + * If the precision is higher, force optimization on so that usable + * tables will be computed. This test can be removed if default tables + * are supplied that are valid for the desired precision. + */ + if (cinfo->data_precision > 8) + cinfo->optimize_coding = TRUE; + if (cinfo->optimize_coding) + cinfo->total_passes++; /* one pass needed for entropy optimization */ #endif } } diff --git a/jcmain.c b/jcmain.c index 3b00b409..8263426e 100644 --- a/jcmain.c +++ b/jcmain.c @@ -1,7 +1,7 @@ /* * jcmain.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -24,6 +24,9 @@ #ifdef INCLUDES_ARE_ANSI #include /* to declare exit() */ #endif +#ifdef NEED_SIGNAL_CATCHER +#include /* to declare signal() */ +#endif #ifdef THINK_C #include /* command-line reader for Macintosh */ @@ -37,6 +40,18 @@ #define WRITE_BINARY "wb" #endif +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#ifdef VMS +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#else +#define EXIT_SUCCESS 0 +#endif +#endif + + #include "jversion.h" /* for version message */ @@ -149,18 +164,39 @@ c_ui_method_selection (compress_info_ptr cinfo) } +/* + * Signal catcher to ensure that temporary files are removed before aborting. + * NB: for Amiga Manx C this is actually a global routine named _abort(); + * see -Dsignal_catcher=_abort in CFLAGS. Talk about bogus... + */ + +#ifdef NEED_SIGNAL_CATCHER + +static external_methods_ptr emethods; /* for access to free_all */ + +GLOBAL void +signal_catcher (int signum) +{ + emethods->trace_level = 0; /* turn off trace output */ + (*emethods->free_all) (); /* clean up memory allocation & temp files */ + exit(EXIT_FAILURE); +} + +#endif + + LOCAL void usage (char * progname) /* complain about bad command line */ { fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-Q quality 0..100] [-o] [-T] [-I] [-a] [-d]"); + fprintf(stderr, "[-Q quality 0..100] [-o] [-T] [-I] [-a] [-d] [-m mem]"); #ifdef TWO_FILE_COMMANDLINE fprintf(stderr, " inputfile outputfile\n"); #else fprintf(stderr, " [inputfile]\n"); #endif - exit(2); + exit(EXIT_FAILURE); } @@ -168,7 +204,7 @@ usage (char * progname) * The main program. */ -GLOBAL void +GLOBAL int main (int argc, char **argv) { struct compress_info_struct cinfo; @@ -185,16 +221,25 @@ main (int argc, char **argv) cinfo.methods = &c_methods; cinfo.emethods = &e_methods; jselerror(&e_methods); /* error/trace message routines */ - jselvirtmem(&e_methods); /* memory allocation routines */ + jselmemmgr(&e_methods); /* memory allocation routines */ c_methods.c_ui_method_selection = c_ui_method_selection; + /* Now OK to enable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + emethods = &e_methods; + signal(SIGINT, signal_catcher); +#ifdef SIGTERM /* not all systems have SIGTERM */ + signal(SIGTERM, signal_catcher); +#endif +#endif + /* Set up default JPEG parameters. */ j_c_defaults(&cinfo, 75, FALSE); /* default quality level = 75 */ is_targa = FALSE; /* Scan command line options, adjust parameters */ - while ((c = egetopt(argc, argv, "IQ:Taod")) != EOF) + while ((c = egetopt(argc, argv, "IQ:Taom:d")) != EOF) switch (c) { case 'I': /* Create noninterleaved file. */ #ifdef MULTISCAN_FILES_SUPPORTED @@ -202,7 +247,7 @@ main (int argc, char **argv) #else fprintf(stderr, "%s: sorry, multiple-scan support was not compiled\n", argv[0]); - exit(2); + exit(EXIT_FAILURE); #endif break; case 'Q': /* Quality factor. */ @@ -227,7 +272,7 @@ main (int argc, char **argv) #else fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", argv[0]); - exit(2); + exit(EXIT_FAILURE); #endif break; case 'o': /* Enable entropy parm optimization. */ @@ -236,9 +281,22 @@ main (int argc, char **argv) #else fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", argv[0]); - exit(2); + exit(EXIT_FAILURE); #endif break; + case 'm': /* Maximum memory in Kb (or Mb with 'm'). */ + { long lval; + char ch = 'x'; + + if (optarg == NULL) + usage(argv[0]); + if (sscanf(optarg, "%ld%c", &lval, &ch) < 1) + usage(argv[0]); + if (ch == 'm' || ch == 'M') + lval *= 1000L; + e_methods.max_memory_to_use = lval * 1000L; + } + break; case 'd': /* Debugging. */ e_methods.trace_level++; break; @@ -263,11 +321,11 @@ main (int argc, char **argv) } if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); - exit(2); + exit(EXIT_FAILURE); } if ((cinfo.output_file = fopen(argv[optind+1], WRITE_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind+1]); - exit(2); + exit(EXIT_FAILURE); } #else /* not TWO_FILE_COMMANDLINE -- use Unix style */ @@ -282,7 +340,7 @@ main (int argc, char **argv) if (optind < argc) { if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); - exit(2); + exit(EXIT_FAILURE); } } @@ -294,13 +352,7 @@ main (int argc, char **argv) /* Do it to it! */ jpeg_compress(&cinfo); - /* Release memory. */ - j_c_free_defaults(&cinfo); -#ifdef MEM_STATS - if (e_methods.trace_level > 0) /* Optional memory-usage statistics */ - j_mem_stats(); -#endif - /* All done. */ - exit(0); + exit(EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ } diff --git a/jcmaster.c b/jcmaster.c index b15217a0..ec5c96d7 100644 --- a/jcmaster.c +++ b/jcmaster.c @@ -1,7 +1,7 @@ /* * jcmaster.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -92,6 +92,10 @@ initial_setup (compress_info_ptr cinfo) GLOBAL void jpeg_compress (compress_info_ptr cinfo) { + /* Init pass counts to 0 --- total_passes is adjusted in method selection */ + cinfo->total_passes = 0; + cinfo->completed_passes = 0; + /* Read the input file header: determine image size & component count. * NOTE: the user interface must have initialized the input_init method * pointer (eg, by calling jselrppm) before calling me. @@ -123,5 +127,7 @@ jpeg_compress (compress_info_ptr cinfo) (*cinfo->methods->colorin_term) (cinfo); (*cinfo->methods->input_term) (cinfo); + (*cinfo->emethods->free_all) (); + /* My, that was easy, wasn't it? */ } diff --git a/jcmcu.c b/jcmcu.c index 1400eab7..b1b15a8d 100644 --- a/jcmcu.c +++ b/jcmcu.c @@ -1,7 +1,7 @@ /* * jcmcu.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * diff --git a/jconfig.h b/jconfig.h index 9d6883bc..92b697ec 100644 --- a/jconfig.h +++ b/jconfig.h @@ -1,7 +1,7 @@ /* * jconfig.h * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,10 +20,23 @@ * predefined by such compilers. */ +/* + * HAVE_STDC is tested below to see whether ANSI features are available. + * We avoid testing __STDC__ directly for arcane reasons of portability. + * (On some compilers, __STDC__ is only defined if a switch is given, + * but the switch also disables machine-specific features we need to get at. + * In that case, -DHAVE_STDC in the Makefile is a convenient solution.) + */ + +#ifdef __STDC__ /* if compiler claims to be ANSI, believe it */ +#define HAVE_STDC +#endif + + /* Does your compiler support function prototypes? */ /* (If not, you also need to use ansi2knr, see SETUP) */ -#ifdef __STDC__ /* ANSI C compilers always have prototypes */ +#ifdef HAVE_STDC /* ANSI C compilers always have prototypes */ #define PROTO #else #ifdef __cplusplus /* So do C++ compilers */ @@ -34,7 +47,7 @@ /* Does your compiler support the declaration "unsigned char" ? */ /* How about "unsigned short" ? */ -#ifdef __STDC__ /* ANSI C compilers must support both */ +#ifdef HAVE_STDC /* ANSI C compilers must support both */ #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT #endif @@ -49,7 +62,6 @@ /* Define this if your compiler implements ">>" on signed values as a logical * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift, * which is the normal and rational definition. - * The DCT and IDCT routines will compute wrong values if you get this wrong! */ /* #define RIGHT_SHIFT_IS_UNSIGNED */ @@ -64,7 +76,7 @@ /* Define const as empty if your compiler doesn't know the "const" keyword. */ /* (Even if it does, defining const as empty won't break anything.) */ -#ifndef __STDC__ /* ANSI C and C++ compilers should know it. */ +#ifndef HAVE_STDC /* ANSI C and C++ compilers should know it. */ #ifndef __cplusplus #define const #endif @@ -77,16 +89,12 @@ * "far" pointers and to be allocated with a special version of malloc.) */ -#ifdef MSDOS /* Microsoft C and compatibles */ +#ifdef MSDOS #define NEED_FAR_POINTERS -#else -#ifdef __TURBOC__ /* Turbo C doesn't define MSDOS */ -#define NEED_FAR_POINTERS -#endif #endif -/* The next couple of symbols only affect the system-dependent user interface +/* The next three symbols only affect the system-dependent user interface * modules (jcmain.c, jdmain.c). You can ignore these if you are supplying * your own user interface code. */ @@ -99,15 +107,20 @@ #ifdef MSDOS /* two-file style is needed for PCs */ #define TWO_FILE_COMMANDLINE -#else -#ifdef __TURBOC__ /* Turbo C doesn't define MSDOS */ -#define TWO_FILE_COMMANDLINE -#endif #endif #ifdef THINK_C /* needed for Macintosh too */ #define TWO_FILE_COMMANDLINE #endif +/* Define this if your system needs explicit cleanup of temporary files. + * This is crucial under MS-DOS, where the temporary "files" may be areas + * of extended memory; on most other systems it's not as important. + */ + +#ifdef MSDOS +#define NEED_SIGNAL_CATCHER +#endif + /* By default, we open image files with fopen(...,"rb") or fopen(...,"wb"). * This is necessary on systems that distinguish text files from binary files, * and is harmless on most systems that don't. If you have one of the rare @@ -122,16 +135,6 @@ */ -/* If your compiler supports inline functions, define INLINE as - * the inline keyword; otherwise define it as empty. - */ - -#ifdef __GNUC__ /* GNU C has inline... */ -#define INLINE inline -#else /* ...but I don't think anyone else does. */ -#define INLINE -#endif - /* On a few systems, type boolean and/or macros FALSE, TRUE may appear * in standard header files. Or you may have conflicts with application- * specific header files that you want to include together with these files. @@ -168,13 +171,13 @@ typedef int boolean; #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing during decoding? */ #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ -#undef QUANT_2PASS_SUPPORTED /* 2-pass color quantization? (not yet impl.) */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ /* these defines indicate which JPEG file formats are allowed */ #define JFIF_SUPPORTED /* JFIF or "raw JPEG" files */ #undef JTIFF_SUPPORTED /* JPEG-in-TIFF (not yet implemented) */ /* these defines indicate which image (non-JPEG) file formats are allowed */ #define GIF_SUPPORTED /* GIF image file format */ -/* #define RLE_SUPPORTED */ /* RLE image file format */ +/* #define RLE_SUPPORTED */ /* RLE image file format (by default, no) */ #define PPM_SUPPORTED /* PPM/PGM image file format */ #define TARGA_SUPPORTED /* Targa image file format */ #undef TIFF_SUPPORTED /* TIFF image file format (not yet impl.) */ @@ -190,6 +193,11 @@ typedef int boolean; * color value. 16-bit should only be used for the lossless JPEG mode (not * currently supported). Note that 12- and 16-bit values take up twice as * much memory as 8-bit! + * Note: if you select 12- or 16-bit precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. */ #define EIGHT_BIT_SAMPLES @@ -209,8 +217,6 @@ typedef int boolean; /* First define the representation of a single pixel element value. */ #ifdef EIGHT_BIT_SAMPLES -#define BITS_IN_JSAMPLE 8 - /* JSAMPLE should be the smallest type that will hold the values 0..255. * You can use a signed char by having GETJSAMPLE mask it with 0xFF. * If you have only signed chars, and you are more worried about speed than @@ -236,6 +242,7 @@ typedef char JSAMPLE; #endif /* CHAR_IS_UNSIGNED */ #endif /* HAVE_UNSIGNED_CHAR */ +#define BITS_IN_JSAMPLE 8 #define MAXJSAMPLE 255 #define CENTERJSAMPLE 128 @@ -243,14 +250,13 @@ typedef char JSAMPLE; #ifdef TWELVE_BIT_SAMPLES -#define BITS_IN_JSAMPLE 12 - /* JSAMPLE should be the smallest type that will hold the values 0..4095. */ /* On nearly all machines "short" will do nicely. */ typedef short JSAMPLE; #define GETJSAMPLE(value) (value) +#define BITS_IN_JSAMPLE 12 #define MAXJSAMPLE 4095 #define CENTERJSAMPLE 2048 @@ -258,8 +264,6 @@ typedef short JSAMPLE; #ifdef SIXTEEN_BIT_SAMPLES -#define BITS_IN_JSAMPLE 16 - /* JSAMPLE should be the smallest type that will hold the values 0..65535. */ #ifdef HAVE_UNSIGNED_SHORT @@ -278,6 +282,7 @@ typedef unsigned int JSAMPLE; #endif /* HAVE_UNSIGNED_SHORT */ +#define BITS_IN_JSAMPLE 16 #define MAXJSAMPLE 65535 #define CENTERJSAMPLE 32768 diff --git a/jcpipe.c b/jcpipe.c index a911487b..eca34acf 100644 --- a/jcpipe.c +++ b/jcpipe.c @@ -1,7 +1,7 @@ /* * jcpipe.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -169,18 +169,17 @@ alloc_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2], } +#if 0 /* this routine not currently needed */ + LOCAL void free_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2]) /* Release a sampling buffer created by alloc_sampling_buffer */ { - short ci, vs; - - vs = cinfo->max_v_samp_factor; /* row group height */ + short ci; for (ci = 0; ci < cinfo->num_components; ci++) { /* Free the real storage */ - (*cinfo->emethods->free_small_sarray) - (fullsize_data[0][ci], (long) (vs * (DCTSIZE+2))); + (*cinfo->emethods->free_small_sarray) (fullsize_data[0][ci]); /* Free the scrambled-order pointers */ (*cinfo->emethods->free_small) ((void *) fullsize_data[1][ci]); } @@ -190,6 +189,8 @@ free_sampling_buffer (compress_info_ptr cinfo, JSAMPIMAGE fullsize_data[2]) (*cinfo->emethods->free_small) ((void *) fullsize_data[1]); } +#endif + LOCAL void subsample (compress_info_ptr cinfo, @@ -302,6 +303,8 @@ dump_scan_MCUs (compress_info_ptr cinfo, MCU_output_method_ptr output_method) next_index = MCUs_in_big_row; for (mcurow = 0; mcurow < cinfo->MCU_rows_in_scan; mcurow++) { + (*cinfo->methods->progress_monitor) (cinfo, mcurow, + cinfo->MCU_rows_in_scan); for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) { if (next_index >= MCUs_in_big_row) { rowptr = (*cinfo->emethods->access_big_barray) (whole_scan_MCUs, @@ -311,7 +314,7 @@ dump_scan_MCUs (compress_info_ptr cinfo, MCU_output_method_ptr output_method) } #ifdef NEED_FAR_POINTERS jcopy_block_row(rowptr[0] + next_index * cinfo->blocks_in_MCU, - (JBLOCKROW) MCU_data, /* note cast */ + (JBLOCKROW) MCU_data, /* casts near to far pointer! */ (long) cinfo->blocks_in_MCU); (*output_method) (cinfo, MCU_data); #else @@ -320,6 +323,8 @@ dump_scan_MCUs (compress_info_ptr cinfo, MCU_output_method_ptr output_method) next_index++; } } + + cinfo->completed_passes++; } @@ -360,6 +365,7 @@ single_ccontroller (compress_info_ptr cinfo) /* in an interleaved scan, one MCU row contains Vk block rows */ mcu_rows_per_loop = 1; } + cinfo->total_passes++; /* Compute dimensions of full-size pixel buffers */ /* Note these are the same whether interleaved or not. */ @@ -403,6 +409,9 @@ single_ccontroller (compress_info_ptr cinfo) for (cur_pixel_row = 0; cur_pixel_row < cinfo->image_height; cur_pixel_row += rows_in_mem) { + (*cinfo->methods->progress_monitor) (cinfo, cur_pixel_row, + cinfo->image_height); + whichss ^= 1; /* switch to other fullsize_data buffer */ /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ @@ -463,15 +472,10 @@ single_ccontroller (compress_info_ptr cinfo) (*cinfo->methods->subsample_term) (cinfo); (*cinfo->methods->entropy_encoder_term) (cinfo); (*cinfo->methods->write_scan_trailer) (cinfo); + cinfo->completed_passes++; /* Release working memory */ - free_sampling_buffer(cinfo, fullsize_data); - for (ci = 0; ci < cinfo->num_components; ci++) { - (*cinfo->emethods->free_small_sarray) - (subsampled_data[ci], - (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); - } - (*cinfo->emethods->free_small) ((void *) subsampled_data); + /* (no work -- we let free_all release what's needful) */ } @@ -514,6 +518,7 @@ single_eopt_ccontroller (compress_info_ptr cinfo) /* in an interleaved scan, one MCU row contains Vk block rows */ mcu_rows_per_loop = 1; } + cinfo->total_passes += 2; /* entropy encoder must add # passes it uses */ /* Compute dimensions of full-size pixel buffers */ /* Note these are the same whether interleaved or not. */ @@ -566,6 +571,9 @@ single_eopt_ccontroller (compress_info_ptr cinfo) for (cur_pixel_row = 0; cur_pixel_row < cinfo->image_height; cur_pixel_row += rows_in_mem) { + (*cinfo->methods->progress_monitor) (cinfo, cur_pixel_row, + cinfo->image_height); + whichss ^= 1; /* switch to other fullsize_data buffer */ /* Obtain rows_this_time pixel rows and expand to rows_in_mem rows. */ @@ -626,6 +634,8 @@ single_eopt_ccontroller (compress_info_ptr cinfo) (*cinfo->methods->extract_term) (cinfo); (*cinfo->methods->subsample_term) (cinfo); + cinfo->completed_passes++; + (*cinfo->methods->entropy_optimize) (cinfo, dump_scan_MCUs); /* Emit scan to output file */ @@ -639,14 +649,7 @@ single_eopt_ccontroller (compress_info_ptr cinfo) (*cinfo->methods->write_scan_trailer) (cinfo); /* Release working memory */ - free_sampling_buffer(cinfo, fullsize_data); - for (ci = 0; ci < cinfo->num_components; ci++) { - (*cinfo->emethods->free_small_sarray) - (subsampled_data[ci], - (long) (cinfo->comp_info[ci].v_samp_factor * DCTSIZE)); - } - (*cinfo->emethods->free_small) ((void *) subsampled_data); - (*cinfo->emethods->free_big_barray) (whole_scan_MCUs); + /* (no work -- we let free_all release what's needful) */ } #endif /* ENTROPY_OPT_SUPPORTED */ diff --git a/jcsample.c b/jcsample.c index f86034ed..9362ec41 100644 --- a/jcsample.c +++ b/jcsample.c @@ -1,7 +1,7 @@ /* * jcsample.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * diff --git a/jdarith.c b/jdarith.c index 0f19be8d..9af54835 100644 --- a/jdarith.c +++ b/jdarith.c @@ -1,7 +1,7 @@ /* * jdarith.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * diff --git a/jdcolor.c b/jdcolor.c index bc718b78..35a6656d 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -1,7 +1,7 @@ /* * jdcolor.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -13,34 +13,107 @@ #include "jinclude.h" +/**************** YCbCr -> RGB conversion: most common case **************/ + +/* + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + * The conversion equations to be implemented are therefore + * R = Y + 1.40200 * Cr + * G = Y - 0.34414 * Cb - 0.71414 * Cr + * B = Y + 1.77200 * Cb + * where Cb and Cr represent the incoming values less MAXJSAMPLE/2. + * (These numbers are derived from TIFF Appendix O, draft of 4/10/91.) + * + * To avoid floating-point arithmetic, we represent the fractional constants + * as integers scaled up by 2^14 (about 4 digits precision); we have to divide + * the products by 2^14, with appropriate rounding, to get the correct answer. + * Notice that Y, being an integral input, does not contribute any fraction + * so it need not participate in the rounding. + * + * For even more speed, we avoid doing any multiplications in the inner loop + * by precalculating the constants times Cb and Cr for all possible values. + * For 8-bit JSAMPLEs this is very reasonable (only 256 table entries); for + * 12-bit samples it is still acceptable. It's not very reasonable for 16-bit + * samples, but if you want lossless storage you shouldn't be changing + * colorspace anyway. + * The Cr=>R and Cb=>B values can be rounded to integers in advance; the + * values for the G calculation are left scaled up, since we must add them + * together before rounding. + */ + +#define SCALEBITS 14 +#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) +#define FIX(x) ((INT32) ((x) * (1L< table for Cr to R conversion */ +static INT16 * Cb_b_tab; /* => table for Cb to B conversion */ +static INT32 * Cr_g_tab; /* => table for Cr to G conversion */ +static INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + + /* * Initialize for colorspace conversion. */ METHODDEF void -colorout_init (decompress_info_ptr cinfo) +ycc_rgb_init (decompress_info_ptr cinfo) { - /* no work needed */ +#ifdef SIXTEEN_BIT_SAMPLES + INT32 i, x2; +#else + int i, x2; /* smart compiler may do 16x16=>32 multiply */ +#endif + SHIFT_TEMPS + + Cr_r_tab = (INT16 *) (*cinfo->emethods->alloc_small) + ((MAXJSAMPLE+1) * SIZEOF(INT16)); + Cb_b_tab = (INT16 *) (*cinfo->emethods->alloc_small) + ((MAXJSAMPLE+1) * SIZEOF(INT16)); + Cr_g_tab = (INT32 *) (*cinfo->emethods->alloc_small) + ((MAXJSAMPLE+1) * SIZEOF(INT32)); + Cb_g_tab = (INT32 *) (*cinfo->emethods->alloc_small) + ((MAXJSAMPLE+1) * SIZEOF(INT32)); + + for (i = 0; i <= MAXJSAMPLE; i++) { + /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ + /* The Cb or Cr value we are thinking of is x = i - MAXJSAMPLE/2 */ + x2 = 2*i - MAXJSAMPLE; /* twice x */ + /* Cr=>R value is nearest int to 1.40200 * x */ + Cr_r_tab[i] = (INT16) + RIGHT_SHIFT(FIX(1.40200/2) * x2 + ONE_HALF, SCALEBITS); + /* Cb=>B value is nearest int to 1.77200 * x */ + Cb_b_tab[i] = (INT16) + RIGHT_SHIFT(FIX(1.77200/2) * x2 + ONE_HALF, SCALEBITS); + /* Cr=>G value is scaled-up -0.71414 * x */ + Cr_g_tab[i] = (- FIX(0.71414/2)) * x2; + /* Cb=>G value is scaled-up -0.34414 * x */ + /* We also add in ONE_HALF so that need not do it in inner loop */ + Cb_g_tab[i] = (- FIX(0.34414/2)) * x2 + ONE_HALF; + } } /* * Convert some rows of samples to the output colorspace. - * This version handles YCbCr -> RGB conversion. - * YCbCr is defined per CCIR 601-1, except that Cb and Cr are - * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. */ METHODDEF void -ycc_rgb_convert (decompress_info_ptr cinfo, int num_rows, +ycc_rgb_convert (decompress_info_ptr cinfo, int num_rows, long num_cols, JSAMPIMAGE input_data, JSAMPIMAGE output_data) { - register INT32 y, u, v, x; +#ifdef SIXTEEN_BIT_SAMPLES + register UINT16 y, cb, cr; + register INT32 x; +#else + register int y, cb, cr; + register int x; +#endif register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW outptr0, outptr1, outptr2; - register long col; - register long width = cinfo->image_width; - register int row; + long col; + int row; + SHIFT_TEMPS for (row = 0; row < num_rows; row++) { inptr0 = input_data[0][row]; @@ -49,45 +122,70 @@ ycc_rgb_convert (decompress_info_ptr cinfo, int num_rows, outptr0 = output_data[0][row]; outptr1 = output_data[1][row]; outptr2 = output_data[2][row]; - for (col = width; col > 0; col--) { - y = GETJSAMPLE(*inptr0++); - u = (int) GETJSAMPLE(*inptr1++) - CENTERJSAMPLE; - v = (int) GETJSAMPLE(*inptr2++) - CENTERJSAMPLE; + for (col = num_cols; col > 0; col--) { + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); /* Note: if the inputs were computed directly from RGB values, * range-limiting would be unnecessary here; but due to possible * noise in the DCT/IDCT phase, we do need to apply range limits. */ - y *= 1024; /* in case compiler can't spot common subexpression */ - x = y + 1436*v + 512; /* red */ + x = y + Cr_r_tab[cr]; /* red */ if (x < 0) x = 0; - if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr0++ = (JSAMPLE) (x >> 10); - x = y - 352*u - 731*v + 512; /* green */ + else if (x > MAXJSAMPLE) x = MAXJSAMPLE; + *outptr0++ = (JSAMPLE) x; + x = y + ((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS)); if (x < 0) x = 0; - if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr1++ = (JSAMPLE) (x >> 10); - x = y + 1815*u + 512; /* blue */ + else if (x > MAXJSAMPLE) x = MAXJSAMPLE; + *outptr1++ = (JSAMPLE) x; + x = y + Cb_b_tab[cb]; /* blue */ if (x < 0) x = 0; - if (x > ((INT32) MAXJSAMPLE*1024)) x = (INT32) MAXJSAMPLE*1024; - *outptr2++ = (JSAMPLE) (x >> 10); + else if (x > MAXJSAMPLE) x = MAXJSAMPLE; + *outptr2++ = (JSAMPLE) x; } } } +/* + * Finish up at the end of the file. + */ + +METHODDEF void +ycc_rgb_term (decompress_info_ptr cinfo) +{ + /* no work (we let free_all release the workspace) */ +} + + +/**************** Cases other than YCbCr -> RGB **************/ + + +/* + * Initialize for colorspace conversion. + */ + +METHODDEF void +null_init (decompress_info_ptr cinfo) +/* colorout_init for cases where no setup is needed */ +{ + /* no work needed */ +} + + /* * Color conversion for no colorspace change: just copy the data. */ METHODDEF void -null_convert (decompress_info_ptr cinfo, int num_rows, +null_convert (decompress_info_ptr cinfo, int num_rows, long num_cols, JSAMPIMAGE input_data, JSAMPIMAGE output_data) { short ci; for (ci = 0; ci < cinfo->num_components; ci++) { jcopy_sample_rows(input_data[ci], 0, output_data[ci], 0, - num_rows, cinfo->image_width); + num_rows, num_cols); } } @@ -99,11 +197,11 @@ null_convert (decompress_info_ptr cinfo, int num_rows, */ METHODDEF void -grayscale_convert (decompress_info_ptr cinfo, int num_rows, +grayscale_convert (decompress_info_ptr cinfo, int num_rows, long num_cols, JSAMPIMAGE input_data, JSAMPIMAGE output_data) { jcopy_sample_rows(input_data[0], 0, output_data[0], 0, - num_rows, cinfo->image_width); + num_rows, num_cols); } @@ -112,12 +210,14 @@ grayscale_convert (decompress_info_ptr cinfo, int num_rows, */ METHODDEF void -colorout_term (decompress_info_ptr cinfo) +null_term (decompress_info_ptr cinfo) +/* colorout_term for cases where no teardown is needed */ { /* no work needed */ } + /* * The method selection routine for output colorspace conversion. */ @@ -133,8 +233,8 @@ jseldcolor (decompress_info_ptr cinfo) break; case CS_RGB: - case CS_YIQ: case CS_YCbCr: + case CS_YIQ: if (cinfo->num_components != 3) ERREXIT(cinfo->emethods, "Bogus JPEG colorspace"); break; @@ -155,32 +255,37 @@ jseldcolor (decompress_info_ptr cinfo) cinfo->color_out_comps = 1; if (cinfo->jpeg_color_space == CS_GRAYSCALE || cinfo->jpeg_color_space == CS_YCbCr || - cinfo->jpeg_color_space == CS_YIQ) + cinfo->jpeg_color_space == CS_YIQ) { cinfo->methods->color_convert = grayscale_convert; - else + cinfo->methods->colorout_init = null_init; + cinfo->methods->colorout_term = null_term; + } else ERREXIT(cinfo->emethods, "Unsupported color conversion request"); break; case CS_RGB: cinfo->color_out_comps = 3; - if (cinfo->jpeg_color_space == CS_YCbCr) + if (cinfo->jpeg_color_space == CS_YCbCr) { cinfo->methods->color_convert = ycc_rgb_convert; - else if (cinfo->jpeg_color_space == CS_RGB) + cinfo->methods->colorout_init = ycc_rgb_init; + cinfo->methods->colorout_term = ycc_rgb_term; + } else if (cinfo->jpeg_color_space == CS_RGB) { cinfo->methods->color_convert = null_convert; - else - ERREXIT(cinfo->emethods, "Unsupported color conversion request"); - break; - - case CS_CMYK: - cinfo->color_out_comps = 4; - if (cinfo->jpeg_color_space == CS_CMYK) - cinfo->methods->color_convert = null_convert; - else + cinfo->methods->colorout_init = null_init; + cinfo->methods->colorout_term = null_term; + } else ERREXIT(cinfo->emethods, "Unsupported color conversion request"); break; default: - ERREXIT(cinfo->emethods, "Unsupported output colorspace"); + /* Permit null conversion from CMYK or YCbCr to same output space */ + if (cinfo->out_color_space == cinfo->jpeg_color_space) { + cinfo->color_out_comps = cinfo->num_components; + cinfo->methods->color_convert = null_convert; + cinfo->methods->colorout_init = null_init; + cinfo->methods->colorout_term = null_term; + } else /* unsupported non-null conversion */ + ERREXIT(cinfo->emethods, "Unsupported color conversion request"); break; } @@ -188,7 +293,4 @@ jseldcolor (decompress_info_ptr cinfo) cinfo->final_out_comps = 1; /* single colormapped output component */ else cinfo->final_out_comps = cinfo->color_out_comps; - - cinfo->methods->colorout_init = colorout_init; - cinfo->methods->colorout_term = colorout_term; } diff --git a/jddeflts.c b/jddeflts.c index ffcc108e..60d8427f 100644 --- a/jddeflts.c +++ b/jddeflts.c @@ -1,7 +1,7 @@ /* * jddeflts.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -13,19 +13,45 @@ #include "jinclude.h" +/* Default do-nothing progress monitoring routine. + * This can be overridden by a user interface that wishes to + * provide progress monitoring; just set methods->progress_monitor + * after j_d_defaults is done. The routine will be called periodically + * during the decompression process. + * + * During any one pass, loopcounter increases from 0 up to (not including) + * looplimit; the step size is not necessarily 1. Both the step size and + * the limit may differ between passes. The expected total number of passes + * is in cinfo->total_passes, and the number of passes already completed is + * in cinfo->completed_passes. Thus the fraction of work completed may be + * estimated as + * completed_passes + (loopcounter/looplimit) + * ------------------------------------------ + * total_passes + * ignoring the fact that the passes may not be equal amounts of work. + * + * When decompressing, the total_passes figure is an estimate that may be + * on the high side; completed_passes will jump by more than one if some + * passes are skipped. + */ + +METHODDEF void +progress_monitor (decompress_info_ptr cinfo, long loopcounter, long looplimit) +{ + /* do nothing */ +} + + /* * Reload the input buffer after it's been emptied, and return the next byte. * See the JGETC macro for calling conditions. * - * This routine is used only if the system-dependent user interface passes - * standard_buffering = TRUE to j_d_defaults. Otherwise, the UI must supply - * a corresponding routine. Note that in any case, this routine is likely - * to be used only for JFIF or similar serial-access JPEG file formats. - * The input file control module for a random-access format such as TIFF/JPEG - * would need to override the read_jpeg_data method with its own routine. - * - * This routine would need to be replaced if reading JPEG data from something - * other than a stdio stream. + * This routine can be overridden by the system-dependent user interface, + * in case the data source is not a stdio stream or some other special + * condition applies. Note, however, that this capability only applies for + * JFIF or similar serial-access JPEG file formats. The input file control + * module for a random-access format such as TIFF/JPEG would most likely + * override the read_jpeg_data method with its own routine. */ METHODDEF int @@ -33,9 +59,9 @@ read_jpeg_data (decompress_info_ptr cinfo) { cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; - cinfo->bytes_in_buffer = (int) FREAD(cinfo->input_file, - cinfo->next_input_byte, - JPEG_BUF_SIZE); + cinfo->bytes_in_buffer = (int) JFREAD(cinfo->input_file, + cinfo->next_input_byte, + JPEG_BUF_SIZE); if (cinfo->bytes_in_buffer <= 0) ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); @@ -53,19 +79,43 @@ read_jpeg_data (decompress_info_ptr cinfo) * is the recommended approach since, if we add any new parameters, * your code will still work (they'll be set to reasonable defaults). * - * standard_buffering should be TRUE if the JPEG data is to come from - * a stdio stream and the user interface isn't interested in changing - * the normal input-buffering logic. If FALSE is passed, the user - * interface must provide its own read_jpeg_data method and must - * set up its own input buffer. (Alternately, you can pass TRUE to - * let the buffer be allocated here, then override read_jpeg_data with - * your own routine.) + * standard_buffering should be TRUE to cause an input buffer to be allocated + * (the normal case); if FALSE, the user interface must provide a buffer. + * This option is most useful in the case that the buffer must not be freed + * at the end of an image. (For example, when reading a sequence of images + * from a single file, the remaining data in the buffer represents the + * start of the next image and mustn't be discarded.) To handle this, + * allocate the input buffer yourself at startup, WITHOUT using alloc_small + * (probably a direct call to malloc() instead). Then pass FALSE on each + * call to j_d_defaults to ensure the buffer state is not modified. + * + * If the source of the JPEG data is not a stdio stream, override the + * read_jpeg_data method with your own routine after calling j_d_defaults. + * You can still use the standard buffer if it's appropriate. + * + * CAUTION: if you want to decompress multiple images per run, it's necessary + * to call j_d_defaults before *each* call to jpeg_decompress, since subsidiary + * structures like the quantization tables are automatically freed during + * cleanup. */ GLOBAL void j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering) /* NB: the external methods must already be set up. */ { + short i; + + /* Initialize pointers as needed to mark stuff unallocated. */ + /* Outer application may fill in default tables for abbreviated files... */ + cinfo->comp_info = NULL; + for (i = 0; i < NUM_QUANT_TBLS; i++) + cinfo->quant_tbl_ptrs[i] = NULL; + for (i = 0; i < NUM_HUFF_TBLS; i++) { + cinfo->dc_huff_tbl_ptrs[i] = NULL; + cinfo->ac_huff_tbl_ptrs[i] = NULL; + } + cinfo->colormap = NULL; + /* Default to RGB output */ /* UI can override by changing out_color_space */ cinfo->out_color_space = CS_RGB; @@ -81,7 +131,7 @@ j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering) cinfo->quantize_colors = FALSE; /* but set reasonable default parameters for quantization, */ /* so that turning on quantize_colors is sufficient to do something useful */ - cinfo->two_pass_quantize = FALSE; /* may change to TRUE later */ + cinfo->two_pass_quantize = TRUE; cinfo->use_dithering = TRUE; cinfo->desired_number_of_colors = 256; @@ -89,29 +139,16 @@ j_d_defaults (decompress_info_ptr cinfo, boolean standard_buffering) cinfo->do_block_smoothing = FALSE; cinfo->do_pixel_smoothing = FALSE; + /* Allocate memory for input buffer, unless outer application provides it. */ if (standard_buffering) { - /* Allocate memory for input buffer. */ cinfo->input_buffer = (char *) (*cinfo->emethods->alloc_small) ((size_t) (JPEG_BUF_SIZE + MIN_UNGET)); cinfo->bytes_in_buffer = 0; /* initialize buffer to empty */ - - /* Install standard buffer-reloading method. */ - cinfo->methods->read_jpeg_data = read_jpeg_data; - } -} - - -/* This routine releases storage allocated by j_d_defaults. - * Note that freeing the method pointer structs and the decompress_info_struct - * itself are the responsibility of the user interface. - * - * standard_buffering must agree with what was passed to j_d_defaults. - */ - -GLOBAL void -j_d_free_defaults (decompress_info_ptr cinfo, boolean standard_buffering) -{ - if (standard_buffering) { - (*cinfo->emethods->free_small) ((void *) cinfo->input_buffer); } + + /* Install standard buffer-reloading method (outer code may override). */ + cinfo->methods->read_jpeg_data = read_jpeg_data; + + /* Install default do-nothing progress monitoring method. */ + cinfo->methods->progress_monitor = progress_monitor; } diff --git a/jdhuff.c b/jdhuff.c index dd429fc4..8071fa27 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -1,7 +1,7 @@ /* * jdhuff.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,12 +25,12 @@ LOCAL void fix_huff_tbl (HUFF_TBL * htbl) /* Compute derived values for a Huffman table */ { - int p, i, l, lastp, si; + int p, i, l, si; char huffsize[257]; UINT16 huffcode[257]; UINT16 code; - /* Figure 7.3.5.4.2.1: make table of Huffman code length for each symbol */ + /* Figure C.1: make table of Huffman code length for each symbol */ /* Note that this is in code-length order. */ p = 0; @@ -39,9 +39,8 @@ fix_huff_tbl (HUFF_TBL * htbl) huffsize[p++] = (char) l; } huffsize[p] = 0; - lastp = p; - /* Figure 7.3.5.4.2.2: generate the codes themselves */ + /* Figure C.2: generate the codes themselves */ /* Note that this is in code-length order. */ code = 0; @@ -55,16 +54,11 @@ fix_huff_tbl (HUFF_TBL * htbl) code <<= 1; si++; } - - /* Figure 7.3.5.4.2.3: generate encoding tables */ - /* These are code and size indexed by symbol value */ - for (p = 0; p < lastp; p++) { - htbl->ehufco[htbl->huffval[p]] = huffcode[p]; - htbl->ehufsi[htbl->huffval[p]] = huffsize[p]; - } - - /* Figure 13.4.2.3.1: generate decoding tables */ + /* We don't bother to fill in the encoding tables ehufco[] and ehufsi[], */ + /* since they are not used for decoding. */ + + /* Figure F.15: generate decoding tables */ p = 0; for (l = 1; l <= 16; l++) { @@ -115,7 +109,7 @@ get_bits (int nbits) get_bits(1)) -/* Figure 13.4.2.3.2: extract next coded symbol from input stream */ +/* Figure F.16: extract next coded symbol from input stream */ LOCAL int huff_DECODE (HUFF_TBL * htbl) @@ -142,7 +136,7 @@ huff_DECODE (HUFF_TBL * htbl) } -/* Figure 13.4.2.1.1: extend sign bit */ +/* Figure F.12: extend sign bit */ /* NB: on some compilers this will only work for s > 0 */ @@ -163,7 +157,7 @@ decode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) MEMZERO((void *) block, SIZEOF(JBLOCK)); - /* Section 13.4.2.1: decode the DC coefficient difference */ + /* Section F.2.2.1: decode the DC coefficient difference */ s = huff_DECODE(dctbl); if (s) { @@ -172,7 +166,7 @@ decode_one_block (JBLOCK block, HUFF_TBL *dctbl, HUFF_TBL *actbl) } block[0] = s; - /* Section 13.4.2.2: decode the AC coefficients */ + /* Section F.2.2.2: decode the AC coefficients */ for (k = 1; k < DCTSIZE2; k++) { r = huff_DECODE(actbl); diff --git a/jdmain.c b/jdmain.c index 3b60a9d8..380a96cd 100644 --- a/jdmain.c +++ b/jdmain.c @@ -1,7 +1,7 @@ /* * jdmain.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -24,6 +24,9 @@ #ifdef INCLUDES_ARE_ANSI #include /* to declare exit() */ #endif +#ifdef NEED_SIGNAL_CATCHER +#include /* to declare signal() */ +#endif #ifdef THINK_C #include /* command-line reader for Macintosh */ @@ -37,6 +40,18 @@ #define WRITE_BINARY "wb" #endif +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#ifdef VMS +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#else +#define EXIT_SUCCESS 0 +#endif +#endif + + #include "jversion.h" /* for version message */ @@ -117,18 +132,39 @@ d_ui_method_selection (decompress_info_ptr cinfo) } +/* + * Signal catcher to ensure that temporary files are removed before aborting. + * NB: for Amiga Manx C this is actually a global routine named _abort(); + * see -Dsignal_catcher=_abort in CFLAGS. Talk about bogus... + */ + +#ifdef NEED_SIGNAL_CATCHER + +static external_methods_ptr emethods; /* for access to free_all */ + +GLOBAL void +signal_catcher (int signum) +{ + emethods->trace_level = 0; /* turn off trace output */ + (*emethods->free_all) (); /* clean up memory allocation & temp files */ + exit(EXIT_FAILURE); +} + +#endif + + LOCAL void usage (char * progname) /* complain about bad command line */ { fprintf(stderr, "usage: %s ", progname); - fprintf(stderr, "[-G] [-P] [-R] [-T] [-b] [-g] [-q colors] [-2] [-D] [-d]"); + fprintf(stderr, "[-G] [-P] [-R] [-T] [-b] [-g] [-q colors] [-1] [-D] [-d] [-m mem]"); #ifdef TWO_FILE_COMMANDLINE fprintf(stderr, " inputfile outputfile\n"); #else fprintf(stderr, " [inputfile]\n"); #endif - exit(2); + exit(EXIT_FAILURE); } @@ -136,7 +172,7 @@ usage (char * progname) * The main program. */ -GLOBAL void +GLOBAL int main (int argc, char **argv) { struct decompress_info_struct cinfo; @@ -153,16 +189,25 @@ main (int argc, char **argv) cinfo.methods = &dc_methods; cinfo.emethods = &e_methods; jselerror(&e_methods); /* error/trace message routines */ - jselvirtmem(&e_methods); /* memory allocation routines */ + jselmemmgr(&e_methods); /* memory allocation routines */ dc_methods.d_ui_method_selection = d_ui_method_selection; + /* Now OK to enable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + emethods = &e_methods; + signal(SIGINT, signal_catcher); +#ifdef SIGTERM /* not all systems have SIGTERM */ + signal(SIGTERM, signal_catcher); +#endif +#endif + /* Set up default JPEG parameters. */ j_d_defaults(&cinfo, TRUE); requested_fmt = DEFAULT_FMT; /* set default output file format */ /* Scan command line options, adjust parameters */ - while ((c = egetopt(argc, argv, "GPRTbdgq:2D")) != EOF) + while ((c = egetopt(argc, argv, "GPRTbgq:1Dm:d")) != EOF) switch (c) { case 'G': /* GIF output format. */ requested_fmt = FMT_GIF; @@ -179,9 +224,6 @@ main (int argc, char **argv) case 'b': /* Enable cross-block smoothing. */ cinfo.do_block_smoothing = TRUE; break; - case 'd': /* Debugging. */ - e_methods.trace_level++; - break; case 'g': /* Force grayscale output. */ cinfo.out_color_space = CS_GRAYSCALE; break; @@ -195,12 +237,28 @@ main (int argc, char **argv) } cinfo.quantize_colors = TRUE; break; - case '2': /* Use two-pass quantization. */ - cinfo.two_pass_quantize = TRUE; + case '1': /* Use fast one-pass quantization. */ + cinfo.two_pass_quantize = FALSE; break; case 'D': /* Suppress dithering in color quantization. */ cinfo.use_dithering = FALSE; break; + case 'm': /* Maximum memory in Kb (or Mb with 'm'). */ + { long lval; + char ch = 'x'; + + if (optarg == NULL) + usage(argv[0]); + if (sscanf(optarg, "%ld%c", &lval, &ch) < 1) + usage(argv[0]); + if (ch == 'm' || ch == 'M') + lval *= 1000L; + e_methods.max_memory_to_use = lval * 1000L; + } + break; + case 'd': /* Debugging. */ + e_methods.trace_level++; + break; case '?': default: usage(argv[0]); @@ -222,11 +280,11 @@ main (int argc, char **argv) } if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); - exit(2); + exit(EXIT_FAILURE); } if ((cinfo.output_file = fopen(argv[optind+1], WRITE_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind+1]); - exit(2); + exit(EXIT_FAILURE); } #else /* not TWO_FILE_COMMANDLINE -- use Unix style */ @@ -241,7 +299,7 @@ main (int argc, char **argv) if (optind < argc) { if ((cinfo.input_file = fopen(argv[optind], READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open %s\n", argv[0], argv[optind]); - exit(2); + exit(EXIT_FAILURE); } } @@ -259,13 +317,7 @@ main (int argc, char **argv) /* Do it to it! */ jpeg_decompress(&cinfo); - /* Release memory. */ - j_d_free_defaults(&cinfo, TRUE); -#ifdef MEM_STATS - if (e_methods.trace_level > 0) /* Optional memory-usage statistics */ - j_mem_stats(); -#endif - /* All done. */ - exit(0); + exit(EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ } diff --git a/jdmaster.c b/jdmaster.c index 56938821..17513a40 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -1,7 +1,7 @@ /* * jdmaster.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -49,9 +49,15 @@ d_initial_method_selection (decompress_info_ptr cinfo) /* Gamma and color space conversion */ jseldcolor(cinfo); - /* Color quantization */ + /* Color quantization selection rules */ #ifdef QUANT_1PASS_SUPPORTED -#ifndef QUANT_2PASS_SUPPORTED +#ifdef QUANT_2PASS_SUPPORTED + /* We have both, check for conditions in which 1-pass should be used */ + if (cinfo->num_components != 3 || cinfo->jpeg_color_space != CS_YCbCr) + cinfo->two_pass_quantize = FALSE; /* 2-pass only handles YCbCr input */ + if (cinfo->out_color_space == CS_GRAYSCALE) + cinfo->two_pass_quantize = FALSE; /* Should use 1-pass for grayscale out */ +#else /* not QUANT_2PASS_SUPPORTED */ cinfo->two_pass_quantize = FALSE; /* only have 1-pass */ #endif #else /* not QUANT_1PASS_SUPPORTED */ @@ -121,16 +127,9 @@ initial_setup (decompress_info_ptr cinfo) GLOBAL void jpeg_decompress (decompress_info_ptr cinfo) { - short i; - - /* Initialize pointers as needed to mark stuff unallocated. */ - cinfo->comp_info = NULL; - for (i = 0; i < NUM_QUANT_TBLS; i++) - cinfo->quant_tbl_ptrs[i] = NULL; - for (i = 0; i < NUM_HUFF_TBLS; i++) { - cinfo->dc_huff_tbl_ptrs[i] = NULL; - cinfo->ac_huff_tbl_ptrs[i] = NULL; - } + /* Init pass counts to 0 --- total_passes is adjusted in method selection */ + cinfo->total_passes = 0; + cinfo->completed_passes = 0; /* Read the JPEG file header markers; everything up through the first SOS * marker is read now. NOTE: the user interface must have initialized the @@ -151,30 +150,24 @@ jpeg_decompress (decompress_info_ptr cinfo) d_initial_method_selection(cinfo); /* Initialize the output file & other modules as needed */ - /* (color_quant and entropy_decoder are inited by pipeline controller) */ + /* (modules needing per-scan init are called by pipeline controller) */ (*cinfo->methods->output_init) (cinfo); (*cinfo->methods->colorout_init) (cinfo); + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_init) (cinfo); /* And let the pipeline controller do the rest. */ (*cinfo->methods->d_pipeline_controller) (cinfo); /* Finish output file, release working storage, etc */ + if (cinfo->quantize_colors) + (*cinfo->methods->color_quant_term) (cinfo); (*cinfo->methods->colorout_term) (cinfo); (*cinfo->methods->output_term) (cinfo); (*cinfo->methods->read_file_trailer) (cinfo); - /* Release allocated storage for tables */ -#define FREE(ptr) if ((ptr) != NULL) \ - (*cinfo->emethods->free_small) ((void *) ptr) - - FREE(cinfo->comp_info); - for (i = 0; i < NUM_QUANT_TBLS; i++) - FREE(cinfo->quant_tbl_ptrs[i]); - for (i = 0; i < NUM_HUFF_TBLS; i++) { - FREE(cinfo->dc_huff_tbl_ptrs[i]); - FREE(cinfo->ac_huff_tbl_ptrs[i]); - } + (*cinfo->emethods->free_all) (); /* My, that was easy, wasn't it? */ } diff --git a/jdmcu.c b/jdmcu.c index 0d991708..4045f3df 100644 --- a/jdmcu.c +++ b/jdmcu.c @@ -1,12 +1,12 @@ /* * jdmcu.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * * This file contains MCU disassembly routines and quantization descaling. - * These routines are invoked via the disassemble_MCU and + * These routines are invoked via the disassemble_MCU, reverse_DCT, and * disassemble_init/term methods. */ @@ -35,10 +35,11 @@ static const short ZAG[DCTSIZE2] = { LOCAL void qdescale_zig (JBLOCK input, JBLOCKROW outputptr, QUANT_TBL_PTR quanttbl) { + const short * zagptr = ZAG; short i; - for (i = 0; i < DCTSIZE2; i++) { - (*outputptr)[ZAG[i]] = (*input++) * (*quanttbl++); + for (i = DCTSIZE2-1; i >= 0; i--) { + (*outputptr)[*zagptr++] = (*input++) * (*quanttbl++); } } @@ -107,6 +108,77 @@ disassemble_interleaved_MCU (decompress_info_ptr cinfo, } +/* + * Perform inverse DCT on each block in an MCU row's worth of data; + * output the results into a sample array starting at row start_row. + * NB: start_row can only be nonzero when dealing with a single-component + * scan; otherwise we'd have to pass different offsets for different + * components, since the heights of interleaved MCU rows can vary. + * But the pipeline controller logic is such that this is not necessary. + */ + +METHODDEF void +reverse_DCT (decompress_info_ptr cinfo, + JBLOCKIMAGE coeff_data, JSAMPIMAGE output_data, int start_row) +{ + DCTBLOCK block; + JBLOCKROW browptr; + JSAMPARRAY srowptr; + long blocksperrow, bi; + short numrows, ri; + short ci; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + /* calculate size of an MCU row in this component */ + blocksperrow = cinfo->cur_comp_info[ci]->subsampled_width / DCTSIZE; + numrows = cinfo->cur_comp_info[ci]->MCU_height; + /* iterate through all blocks in MCU row */ + for (ri = 0; ri < numrows; ri++) { + browptr = coeff_data[ci][ri]; + srowptr = output_data[ci] + (ri * DCTSIZE + start_row); + for (bi = 0; bi < blocksperrow; bi++) { + /* copy the data into a local DCTBLOCK. This allows for change of + * representation (if DCTELEM != JCOEF). On 80x86 machines it also + * brings the data back from FAR storage to NEAR storage. + */ + { register JCOEFPTR elemptr = browptr[bi]; + register DCTELEM *localblkptr = block; + register short elem = DCTSIZE2; + + while (--elem >= 0) + *localblkptr++ = (DCTELEM) *elemptr++; + } + + j_rev_dct(block); /* perform inverse DCT */ + + /* output the data into the sample array. + * Note change from signed to unsigned representation: + * DCT calculation works with values +-CENTERJSAMPLE, + * but sample arrays always hold 0..MAXJSAMPLE. + * Have to do explicit range-limiting because of quantization errors + * and so forth in the DCT/IDCT phase. + */ + { register JSAMPROW elemptr; + register DCTELEM *localblkptr = block; + register short elemr, elemc; + register DCTELEM temp; + + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = srowptr[elemr] + (bi * DCTSIZE); + for (elemc = 0; elemc < DCTSIZE; elemc++) { + temp = (*localblkptr++) + CENTERJSAMPLE; + if (temp < 0) temp = 0; + else if (temp > MAXJSAMPLE) temp = MAXJSAMPLE; + *elemptr++ = (JSAMPLE) temp; + } + } + } + } + } + } +} + + /* * Initialize for processing a scan. */ @@ -141,6 +213,7 @@ jseldmcu (decompress_info_ptr cinfo) cinfo->methods->disassemble_MCU = disassemble_noninterleaved_MCU; else cinfo->methods->disassemble_MCU = disassemble_interleaved_MCU; + cinfo->methods->reverse_DCT = reverse_DCT; cinfo->methods->disassemble_init = disassemble_init; cinfo->methods->disassemble_term = disassemble_term; } diff --git a/jdpipe.c b/jdpipe.c index cdfdf2d7..a6d7576c 100644 --- a/jdpipe.c +++ b/jdpipe.c @@ -1,33 +1,38 @@ /* * jdpipe.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * * This file contains decompression pipeline controllers. * These routines are invoked via the d_pipeline_controller method. * - * There are four basic pipeline controllers, one for each combination of: - * single-scan JPEG file (single component or fully interleaved) - * vs. multiple-scan JPEG file (noninterleaved or partially interleaved). + * There are two basic pipeline controllers. The simpler one handles a + * single-scan JPEG file (single component or fully interleaved) with no + * color quantization or 1-pass quantization. In this case, the file can + * be processed in one top-to-bottom pass. The more complex controller is + * used when 2-pass color quantization is requested and/or the JPEG file + * has multiple scans (noninterleaved or partially interleaved). In this + * case, the entire image must be buffered up in a "big" array. * - * 2-pass color quantization - * vs. no color quantization or 1-pass quantization. - * - * Note that these conditions determine the needs for "big" images: - * multiple scans imply a big image for recombining the color components; - * 2-pass color quantization needs a big image for saving the data for pass 2. - * - * All but the simplest controller (single-scan, no 2-pass quantization) can be - * compiled out through configuration options, if you need to make a minimal - * implementation. You should leave in multiple-scan support if at all - * possible, so that you can handle all legal JPEG files. + * If you need to make a minimal implementation, the more complex controller + * can be compiled out by disabling the appropriate configuration options. + * We don't recommend this, since then you can't handle all legal JPEG files. */ #include "jinclude.h" +#ifdef MULTISCAN_FILES_SUPPORTED /* wish we could assume ANSI's defined() */ +#define NEED_COMPLEX_CONTROLLER +#else +#ifdef QUANT_2PASS_SUPPORTED +#define NEED_COMPLEX_CONTROLLER +#endif +#endif + + /* * About the data structures: * @@ -62,15 +67,19 @@ * These variables are logically local to the pipeline controller, * but we make them static so that scan_big_image can use them * without having to pass them through the quantization routines. - * If you don't support 2-pass quantization, you could make them locals. */ static int rows_in_mem; /* # of sample rows in full-size buffers */ -/* Full-size image array holding desubsampled, color-converted data. */ -static big_sarray_ptr *fullsize_cnvt_image; -static JSAMPIMAGE fullsize_cnvt_ptrs; /* workspace for access_big_sarray() results */ -/* Work buffer for color quantization output (full size, only 1 component). */ -static JSAMPARRAY quantize_out; +/* Work buffer for data being passed to output module. */ +/* This has color_out_comps components if not quantizing, */ +/* but only one component when quantizing. */ +static JSAMPIMAGE output_workspace; + +#ifdef NEED_COMPLEX_CONTROLLER +/* Full-size image array holding desubsampled, but not color-processed data. */ +static big_sarray_ptr *fullsize_image; +static JSAMPIMAGE fullsize_ptrs; /* workspace for access_big_sarray() result */ +#endif /* @@ -154,74 +163,6 @@ noninterleaved_scan_setup (decompress_info_ptr cinfo) } -LOCAL void -reverse_DCT (decompress_info_ptr cinfo, - JBLOCKIMAGE coeff_data, JSAMPIMAGE output_data, - int start_row) -/* Perform inverse DCT on each block in an MCU row's worth of data; */ -/* output the results into a sample array starting at row start_row. */ -/* NB: start_row can only be nonzero when dealing with a single-component */ -/* scan; otherwise we'd have to provide for different offsets for different */ -/* components, since the heights of interleaved MCU rows can vary. */ -{ - DCTBLOCK block; - JBLOCKROW browptr; - JSAMPARRAY srowptr; - long blocksperrow, bi; - short numrows, ri; - short ci; - - for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - /* calc size of an MCU row in this component */ - blocksperrow = cinfo->cur_comp_info[ci]->subsampled_width / DCTSIZE; - numrows = cinfo->cur_comp_info[ci]->MCU_height; - /* iterate through all blocks in MCU row */ - for (ri = 0; ri < numrows; ri++) { - browptr = coeff_data[ci][ri]; - srowptr = output_data[ci] + (ri * DCTSIZE + start_row); - for (bi = 0; bi < blocksperrow; bi++) { - /* copy the data into a local DCTBLOCK. This allows for change of - * representation (if DCTELEM != JCOEF). On 80x86 machines it also - * brings the data back from FAR storage to NEAR storage. - */ - { register JCOEFPTR elemptr = browptr[bi]; - register DCTELEM *localblkptr = block; - register short elem = DCTSIZE2; - - while (--elem >= 0) - *localblkptr++ = (DCTELEM) *elemptr++; - } - - j_rev_dct(block); /* perform inverse DCT */ - - /* output the data into the sample array. - * Note change from signed to unsigned representation: - * DCT calculation works with values +-CENTERJSAMPLE, - * but sample arrays always hold 0..MAXJSAMPLE. - * Have to do explicit range-limiting because of quantization errors - * and so forth in the DCT/IDCT phase. - */ - { register JSAMPROW elemptr; - register DCTELEM *localblkptr = block; - register short elemr, elemc; - register DCTELEM temp; - - for (elemr = 0; elemr < DCTSIZE; elemr++) { - elemptr = srowptr[elemr] + (bi * DCTSIZE); - for (elemc = 0; elemc < DCTSIZE; elemc++) { - temp = (*localblkptr++) + CENTERJSAMPLE; - if (temp < 0) temp = 0; - else if (temp > MAXJSAMPLE) temp = MAXJSAMPLE; - *elemptr++ = (JSAMPLE) temp; - } - } - } - } - } - } -} - - LOCAL JSAMPIMAGE alloc_sampimage (decompress_info_ptr cinfo, @@ -240,19 +181,22 @@ alloc_sampimage (decompress_info_ptr cinfo, } +#if 0 /* this routine not currently needed */ + LOCAL void -free_sampimage (decompress_info_ptr cinfo, JSAMPIMAGE image, - int num_comps, long num_rows) +free_sampimage (decompress_info_ptr cinfo, JSAMPIMAGE image, int num_comps) /* Release a sample image created by alloc_sampimage */ { int ci; for (ci = 0; ci < num_comps; ci++) { - (*cinfo->emethods->free_small_sarray) (image[ci], num_rows); + (*cinfo->emethods->free_small_sarray) (image[ci]); } (*cinfo->emethods->free_small) ((void *) image); } +#endif + LOCAL JBLOCKIMAGE alloc_MCU_row (decompress_info_ptr cinfo) @@ -272,6 +216,8 @@ alloc_MCU_row (decompress_info_ptr cinfo) } +#ifdef NEED_COMPLEX_CONTROLLER /* not used by simple controller */ + LOCAL void free_MCU_row (decompress_info_ptr cinfo, JBLOCKIMAGE image) /* Release a coefficient block array created by alloc_MCU_row */ @@ -279,12 +225,13 @@ free_MCU_row (decompress_info_ptr cinfo, JBLOCKIMAGE image) int ci; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - (*cinfo->emethods->free_small_barray) - (image[ci], (long) cinfo->cur_comp_info[ci]->MCU_height); + (*cinfo->emethods->free_small_barray) (image[ci]); } (*cinfo->emethods->free_small) ((void *) image); } +#endif + LOCAL void alloc_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) @@ -321,17 +268,17 @@ alloc_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) } +#ifdef NEED_COMPLEX_CONTROLLER /* not used by simple controller */ + LOCAL void free_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) /* Release a sampling buffer created by alloc_sampling_buffer */ { - short ci, vs; + short ci; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - vs = cinfo->cur_comp_info[ci]->v_samp_factor; /* row group height */ /* Free the real storage */ - (*cinfo->emethods->free_small_sarray) - (subsampled_data[0][ci], (long) (vs * (DCTSIZE+2))); + (*cinfo->emethods->free_small_sarray) (subsampled_data[0][ci]); /* Free the scrambled-order pointers */ (*cinfo->emethods->free_small) ((void *) subsampled_data[1][ci]); } @@ -341,6 +288,8 @@ free_sampling_buffer (decompress_info_ptr cinfo, JSAMPIMAGE subsampled_data[2]) (*cinfo->emethods->free_small) ((void *) subsampled_data[1]); } +#endif + LOCAL void duplicate_row (JSAMPARRAY image_data, @@ -409,82 +358,62 @@ expand (decompress_info_ptr cinfo, LOCAL void -emit_1pass (decompress_info_ptr cinfo, int num_rows, - JSAMPIMAGE fullsize_data, JSAMPIMAGE color_data) -/* Do color conversion and output of num_rows full-size rows. */ -/* This is not used for 2-pass color quantization. */ +emit_1pass (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE fullsize_data, + JSAMPARRAY dummy) +/* Do color processing and output of num_rows full-size rows. */ +/* This is not used when doing 2-pass color quantization. */ +/* The dummy argument simply lets this be called via scan_big_image. */ { - (*cinfo->methods->color_convert) (cinfo, num_rows, - fullsize_data, color_data); - if (cinfo->quantize_colors) { - (*cinfo->methods->color_quantize) (cinfo, num_rows, - color_data, quantize_out); - - (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, - &quantize_out); + (*cinfo->methods->color_quantize) (cinfo, num_rows, fullsize_data, + output_workspace[0]); } else { - (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, - color_data); + (*cinfo->methods->color_convert) (cinfo, num_rows, cinfo->image_width, + fullsize_data, output_workspace); } + + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, output_workspace); } /* - * Support routines for 2-pass color quantization. + * Support routines for complex controller. */ -#ifdef QUANT_2PASS_SUPPORTED - -LOCAL void -emit_2pass (decompress_info_ptr cinfo, long top_row, int num_rows, - JSAMPIMAGE fullsize_data) -/* Do color conversion and output data to the quantization buffer image. */ -/* This is used only with 2-pass color quantization. */ -{ - short ci; - - /* Realign the big buffers */ - for (ci = 0; ci < cinfo->num_components; ci++) { - fullsize_cnvt_ptrs[ci] = (*cinfo->emethods->access_big_sarray) - (fullsize_cnvt_image[ci], top_row, TRUE); - } - - /* Do colorspace conversion */ - (*cinfo->methods->color_convert) (cinfo, num_rows, - fullsize_data, fullsize_cnvt_ptrs); - /* Let quantizer get first-pass peek at the data. */ - /* (Quantizer could change data if it wants to.) */ - (*cinfo->methods->color_quant_prescan) (cinfo, num_rows, fullsize_cnvt_ptrs); -} - +#ifdef NEED_COMPLEX_CONTROLLER METHODDEF void scan_big_image (decompress_info_ptr cinfo, quantize_method_ptr quantize_method) -/* This is the "iterator" routine used by the quantizer. */ +/* Apply quantize_method to entire image stored in fullsize_image[]. */ +/* This is the "iterator" routine used by the 2-pass color quantizer. */ +/* We also use it directly in some cases. */ { long pixel_rows_output; short ci; for (pixel_rows_output = 0; pixel_rows_output < cinfo->image_height; pixel_rows_output += rows_in_mem) { + (*cinfo->methods->progress_monitor) (cinfo, pixel_rows_output, + cinfo->image_height); /* Realign the big buffers */ for (ci = 0; ci < cinfo->num_components; ci++) { - fullsize_cnvt_ptrs[ci] = (*cinfo->emethods->access_big_sarray) - (fullsize_cnvt_image[ci], pixel_rows_output, FALSE); + fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) + (fullsize_image[ci], pixel_rows_output, FALSE); } /* Let the quantizer have its way with the data. - * Note that quantize_out is simply workspace for the quantizer; + * Note that output_workspace is simply workspace for the quantizer; * when it's ready to output, it must call put_pixel_rows itself. */ (*quantize_method) (cinfo, - (int) MIN(rows_in_mem, + (int) MIN((long) rows_in_mem, cinfo->image_height - pixel_rows_output), - fullsize_cnvt_ptrs, quantize_out); + fullsize_ptrs, output_workspace[0]); } + + cinfo->completed_passes++; } -#endif /* QUANT_2PASS_SUPPORTED */ +#endif /* NEED_COMPLEX_CONTROLLER */ /* @@ -587,7 +516,7 @@ get_smoothed_row (decompress_info_ptr cinfo, JBLOCKIMAGE coeff_data, */ METHODDEF void -single_dcontroller (decompress_info_ptr cinfo) +simple_dcontroller (decompress_info_ptr cinfo) { long fullsize_width; /* # of samples per row in full-size buffers */ long cur_mcu_row; /* counts # of MCU rows processed */ @@ -604,14 +533,14 @@ single_dcontroller (decompress_info_ptr cinfo) JSAMPIMAGE subsampled_data[2]; /* Work buffer for desubsampled data */ JSAMPIMAGE fullsize_data; - /* Work buffer for color conversion output (full size) */ - JSAMPIMAGE color_data; int whichss, ri; short i; - /* Initialize for 1-pass color quantization, if needed */ - if (cinfo->quantize_colors) - (*cinfo->methods->color_quant_init) (cinfo); + /* Compute dimensions of full-size pixel buffers */ + /* Note these are the same whether interleaved or not. */ + rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; + fullsize_width = jround_up(cinfo->image_width, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); /* Prepare for single scan containing all components */ if (cinfo->comps_in_scan == 1) { @@ -623,12 +552,7 @@ single_dcontroller (decompress_info_ptr cinfo) /* in an interleaved scan, one MCU row provides Vk block rows */ mcu_rows_per_loop = 1; } - - /* Compute dimensions of full-size pixel buffers */ - /* Note these are the same whether interleaved or not. */ - rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; - fullsize_width = jround_up(cinfo->image_width, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); + cinfo->total_passes++; /* Allocate working memory: */ /* coeff_data holds a single MCU row of coefficient blocks */ @@ -646,13 +570,9 @@ single_dcontroller (decompress_info_ptr cinfo) /* fullsize_data is sample data after unsubsampling */ fullsize_data = alloc_sampimage(cinfo, (int) cinfo->num_components, (long) rows_in_mem, fullsize_width); - /* color_data is the result of the colorspace conversion step */ - color_data = alloc_sampimage(cinfo, (int) cinfo->color_out_comps, - (long) rows_in_mem, fullsize_width); - /* if quantizing colors, also need a one-component output area for that. */ - if (cinfo->quantize_colors) - quantize_out = (*cinfo->emethods->alloc_small_sarray) - (fullsize_width, (long) rows_in_mem); + /* output_workspace is the color-processed data */ + output_workspace = alloc_sampimage(cinfo, (int) cinfo->final_out_comps, + (long) rows_in_mem, fullsize_width); /* Tell the memory manager to instantiate big arrays. * We don't need any big arrays in this controller, @@ -662,7 +582,8 @@ single_dcontroller (decompress_info_ptr cinfo) ((long) 0, /* no more small sarrays */ (long) 0, /* no more small barrays */ (long) 0); /* no more "medium" objects */ - /* NB: quantizer must get any such objects at color_quant_init time */ + /* NB: if quantizer needs any "medium" size objects, it must get them */ + /* at color_quant_init time */ /* Initialize to read scan data */ @@ -677,6 +598,9 @@ single_dcontroller (decompress_info_ptr cinfo) for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; cur_mcu_row += mcu_rows_per_loop) { + (*cinfo->methods->progress_monitor) (cinfo, cur_mcu_row, + cinfo->MCU_rows_in_scan); + whichss ^= 1; /* switch to other subsample buffer */ /* Obtain v_samp_factor block rows of each component in the scan. */ @@ -696,8 +620,9 @@ single_dcontroller (decompress_info_ptr cinfo) #endif (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); - reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], - ri * DCTSIZE); + (*cinfo->methods->reverse_DCT) (cinfo, coeff_data, + subsampled_data[whichss], + ri * DCTSIZE); } else { /* Need to pad out with copies of the last subsampled row. */ /* This can only happen if there is just one component. */ @@ -716,7 +641,7 @@ single_dcontroller (decompress_info_ptr cinfo) (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, (short) (DCTSIZE-1)); /* and dump the previous set's expanded data */ - emit_1pass (cinfo, rows_in_mem, fullsize_data, color_data); + emit_1pass (cinfo, rows_in_mem, fullsize_data, NULL); pixel_rows_output += rows_in_mem; /* Expand first row group of this set */ expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, @@ -743,273 +668,47 @@ single_dcontroller (decompress_info_ptr cinfo) (short) (DCTSIZE-1)); /* and dump the remaining data (may be less than full height) */ emit_1pass (cinfo, (int) (cinfo->image_height - pixel_rows_output), - fullsize_data, color_data); + fullsize_data, NULL); /* Clean up after the scan */ (*cinfo->methods->disassemble_term) (cinfo); (*cinfo->methods->unsubsample_term) (cinfo); (*cinfo->methods->entropy_decoder_term) (cinfo); (*cinfo->methods->read_scan_trailer) (cinfo); + cinfo->completed_passes++; /* Verify that we've seen the whole input file */ if ((*cinfo->methods->read_scan_header) (cinfo)) ERREXIT(cinfo->emethods, "Didn't expect more than one scan"); /* Release working memory */ - free_MCU_row(cinfo, coeff_data); -#ifdef BLOCK_SMOOTHING_SUPPORTED - if (cinfo->do_block_smoothing) { - free_MCU_row(cinfo, bsmooth[0]); - free_MCU_row(cinfo, bsmooth[1]); - free_MCU_row(cinfo, bsmooth[2]); - } -#endif - free_sampling_buffer(cinfo, subsampled_data); - free_sampimage(cinfo, fullsize_data, (int) cinfo->num_components, - (long) rows_in_mem); - free_sampimage(cinfo, color_data, (int) cinfo->color_out_comps, - (long) rows_in_mem); - if (cinfo->quantize_colors) - (*cinfo->emethods->free_small_sarray) - (quantize_out, (long) rows_in_mem); - - /* Close up shop */ - if (cinfo->quantize_colors) - (*cinfo->methods->color_quant_term) (cinfo); + /* (no work -- we let free_all release what's needful) */ } -/* - * Decompression pipeline controller used for single-scan files - * with 2-pass color quantization. - */ - -#ifdef QUANT_2PASS_SUPPORTED - -METHODDEF void -single_2quant_dcontroller (decompress_info_ptr cinfo) -{ - long fullsize_width; /* # of samples per row in full-size buffers */ - long cur_mcu_row; /* counts # of MCU rows processed */ - long pixel_rows_output; /* # of pixel rows actually emitted */ - int mcu_rows_per_loop; /* # of MCU rows processed per outer loop */ - /* Work buffer for dequantized coefficients (IDCT input) */ - JBLOCKIMAGE coeff_data; - /* Work buffer for cross-block smoothing input */ -#ifdef BLOCK_SMOOTHING_SUPPORTED - JBLOCKIMAGE bsmooth[3]; /* this is optional */ - int whichb; -#endif - /* Work buffer for subsampled image data (see comments at head of file) */ - JSAMPIMAGE subsampled_data[2]; - /* Work buffer for desubsampled data */ - JSAMPIMAGE fullsize_data; - int whichss, ri; - short ci, i; - - /* Initialize for 2-pass color quantization */ - (*cinfo->methods->color_quant_init) (cinfo); - - /* Prepare for single scan containing all components */ - if (cinfo->comps_in_scan == 1) { - noninterleaved_scan_setup(cinfo); - /* Need to read Vk MCU rows to obtain Vk block rows */ - mcu_rows_per_loop = cinfo->cur_comp_info[0]->v_samp_factor; - } else { - interleaved_scan_setup(cinfo); - /* in an interleaved scan, one MCU row provides Vk block rows */ - mcu_rows_per_loop = 1; - } - - /* Compute dimensions of full-size pixel buffers */ - /* Note these are the same whether interleaved or not. */ - rows_in_mem = cinfo->max_v_samp_factor * DCTSIZE; - fullsize_width = jround_up(cinfo->image_width, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); - - /* Allocate working memory: */ - /* coeff_data holds a single MCU row of coefficient blocks */ - coeff_data = alloc_MCU_row(cinfo); - /* if doing cross-block smoothing, need extra space for its input */ -#ifdef BLOCK_SMOOTHING_SUPPORTED - if (cinfo->do_block_smoothing) { - bsmooth[0] = alloc_MCU_row(cinfo); - bsmooth[1] = alloc_MCU_row(cinfo); - bsmooth[2] = alloc_MCU_row(cinfo); - } -#endif - /* subsampled_data is sample data before unsubsampling */ - alloc_sampling_buffer(cinfo, subsampled_data); - /* fullsize_data is sample data after unsubsampling */ - fullsize_data = alloc_sampimage(cinfo, (int) cinfo->num_components, - (long) rows_in_mem, fullsize_width); - /* Also need a one-component output area for color quantizer. */ - quantize_out = (*cinfo->emethods->alloc_small_sarray) - (fullsize_width, (long) rows_in_mem); - - /* Get a big image for quantizer input: desubsampled, color-converted data */ - fullsize_cnvt_image = (big_sarray_ptr *) (*cinfo->emethods->alloc_small) - (cinfo->num_components * SIZEOF(big_sarray_ptr)); - for (ci = 0; ci < cinfo->num_components; ci++) { - fullsize_cnvt_image[ci] = (*cinfo->emethods->request_big_sarray) - (fullsize_width, - jround_up(cinfo->image_height, (long) rows_in_mem), - (long) rows_in_mem); - } - /* Also get an area for pointers to currently accessible chunks */ - fullsize_cnvt_ptrs = (JSAMPIMAGE) (*cinfo->emethods->alloc_small) - (cinfo->num_components * SIZEOF(JSAMPARRAY)); - - /* Tell the memory manager to instantiate big arrays */ - (*cinfo->emethods->alloc_big_arrays) - ((long) 0, /* no more small sarrays */ - (long) 0, /* no more small barrays */ - (long) 0); /* no more "medium" objects */ - /* NB: quantizer must get any such objects at color_quant_init time */ - - /* Initialize to read scan data */ - - (*cinfo->methods->entropy_decoder_init) (cinfo); - (*cinfo->methods->unsubsample_init) (cinfo); - (*cinfo->methods->disassemble_init) (cinfo); - - /* Loop over scan's data: rows_in_mem pixel rows are processed per loop */ - - pixel_rows_output = 0; - whichss = 1; /* arrange to start with subsampled_data[0] */ - - for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; - cur_mcu_row += mcu_rows_per_loop) { - whichss ^= 1; /* switch to other subsample buffer */ - - /* Obtain v_samp_factor block rows of each component in the scan. */ - /* This is a single MCU row if interleaved, multiple MCU rows if not. */ - /* In the noninterleaved case there might be fewer than v_samp_factor */ - /* block rows remaining; if so, pad with copies of the last pixel row */ - /* so that unsubsampling doesn't have to treat it as a special case. */ - - for (ri = 0; ri < mcu_rows_per_loop; ri++) { - if (cur_mcu_row + ri < cinfo->MCU_rows_in_scan) { - /* OK to actually read an MCU row. */ -#ifdef BLOCK_SMOOTHING_SUPPORTED - if (cinfo->do_block_smoothing) - get_smoothed_row(cinfo, coeff_data, - bsmooth, &whichb, cur_mcu_row + ri); - else -#endif - (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); - - reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], - ri * DCTSIZE); - } else { - /* Need to pad out with copies of the last subsampled row. */ - /* This can only happen if there is just one component. */ - duplicate_row(subsampled_data[whichss][0], - cinfo->cur_comp_info[0]->subsampled_width, - ri * DCTSIZE - 1, DCTSIZE); - } - } - - /* Unsubsample the data */ - /* First time through is a special case */ - - if (cur_mcu_row) { - /* Expand last row group of previous set */ - expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, - (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, - (short) (DCTSIZE-1)); - /* and dump the previous set's expanded data */ - emit_2pass (cinfo, pixel_rows_output, rows_in_mem, fullsize_data); - pixel_rows_output += rows_in_mem; - /* Expand first row group of this set */ - expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, - (short) (DCTSIZE+1), (short) 0, (short) 1, - (short) 0); - } else { - /* Expand first row group with dummy above-context */ - expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, - (short) (-1), (short) 0, (short) 1, - (short) 0); - } - /* Expand second through next-to-last row groups of this set */ - for (i = 1; i <= DCTSIZE-2; i++) { - expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, - (short) (i-1), (short) i, (short) (i+1), - (short) i); - } - } /* end of outer loop */ - - /* Expand the last row group with dummy below-context */ - /* Note whichss points to last buffer side used */ - expand(cinfo, subsampled_data[whichss], fullsize_data, fullsize_width, - (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), - (short) (DCTSIZE-1)); - /* and dump the remaining data (may be less than full height) */ - emit_2pass (cinfo, pixel_rows_output, - (int) (cinfo->image_height - pixel_rows_output), - fullsize_data); - - /* Clean up after the scan */ - (*cinfo->methods->disassemble_term) (cinfo); - (*cinfo->methods->unsubsample_term) (cinfo); - (*cinfo->methods->entropy_decoder_term) (cinfo); - (*cinfo->methods->read_scan_trailer) (cinfo); - - /* Verify that we've seen the whole input file */ - if ((*cinfo->methods->read_scan_header) (cinfo)) - ERREXIT(cinfo->emethods, "Didn't expect more than one scan"); - - /* Now that we've collected the data, let the color quantizer do its thing */ - (*cinfo->methods->color_quant_doit) (cinfo, scan_big_image); - - /* Release working memory */ - free_MCU_row(cinfo, coeff_data); -#ifdef BLOCK_SMOOTHING_SUPPORTED - if (cinfo->do_block_smoothing) { - free_MCU_row(cinfo, bsmooth[0]); - free_MCU_row(cinfo, bsmooth[1]); - free_MCU_row(cinfo, bsmooth[2]); - } -#endif - free_sampling_buffer(cinfo, subsampled_data); - free_sampimage(cinfo, fullsize_data, (int) cinfo->num_components, - (long) rows_in_mem); - (*cinfo->emethods->free_small_sarray) - (quantize_out, (long) rows_in_mem); - for (ci = 0; ci < cinfo->num_components; ci++) { - (*cinfo->emethods->free_big_sarray) (fullsize_cnvt_image[ci]); - } - (*cinfo->emethods->free_small) ((void *) fullsize_cnvt_image); - (*cinfo->emethods->free_small) ((void *) fullsize_cnvt_ptrs); - - /* Close up shop */ - (*cinfo->methods->color_quant_term) (cinfo); -} - -#endif /* QUANT_2PASS_SUPPORTED */ - - /* * Decompression pipeline controller used for multiple-scan files - * without 2-pass color quantization. + * and/or 2-pass color quantization. * * The current implementation places the "big" buffer at the stage of - * desubsampled data. Buffering subsampled data instead would reduce the - * size of temp files (by about a factor of 2 in typical cases). However, - * the unsubsampling logic is dependent on the assumption that unsubsampling - * occurs during a scan, so it's much easier to do the enlargement as the - * JPEG file is read. This also simplifies life for the memory manager, - * which would otherwise have to deal with overlapping access_big_sarray() - * requests. - * - * At present it appears that most JPEG files will be single-scan, so - * it doesn't seem worthwhile to try to make this implementation smarter. + * desubsampled, non-color-processed data. This is the only place that + * makes sense when doing 2-pass quantization. For processing multiple-scan + * files without 2-pass quantization, it would be possible to develop another + * controller that buffers the subsampled data instead, thus reducing the size + * of the temp files (by about a factor of 2 in typical cases). However, + * our present unsubsampling logic is dependent on the assumption that + * unsubsampling occurs during a scan, so it's much easier to do the + * enlargement as the JPEG file is read. This also simplifies life for the + * memory manager, which would otherwise have to deal with overlapping + * access_big_sarray() requests. + * At present it appears that most JPEG files will be single-scan, + * so it doesn't seem worthwhile to worry about this optimization. */ -#ifdef MULTISCAN_FILES_SUPPORTED +#ifdef NEED_COMPLEX_CONTROLLER METHODDEF void -multi_dcontroller (decompress_info_ptr cinfo) +complex_dcontroller (decompress_info_ptr cinfo) { long fullsize_width; /* # of samples per row in full-size buffers */ long cur_mcu_row; /* counts # of MCU rows processed */ @@ -1024,17 +723,9 @@ multi_dcontroller (decompress_info_ptr cinfo) #endif /* Work buffer for subsampled image data (see comments at head of file) */ JSAMPIMAGE subsampled_data[2]; - /* Full-image buffer holding desubsampled, but not color-converted, data */ - big_sarray_ptr *fullsize_image; - JSAMPIMAGE fullsize_ptrs; /* workspace for access_big_sarray() results */ - /* Work buffer for color conversion output (full size) */ - JSAMPIMAGE color_data; int whichss, ri; short ci, i; - - /* Initialize for 1-pass color quantization, if needed */ - if (cinfo->quantize_colors) - (*cinfo->methods->color_quant_init) (cinfo); + boolean single_scan; /* Compute dimensions of full-size pixel buffers */ /* Note these are the same whether interleaved or not. */ @@ -1043,13 +734,9 @@ multi_dcontroller (decompress_info_ptr cinfo) (long) (cinfo->max_h_samp_factor * DCTSIZE)); /* Allocate all working memory that doesn't depend on scan info */ - /* color_data is the result of the colorspace conversion step */ - color_data = alloc_sampimage(cinfo, (int) cinfo->color_out_comps, - (long) rows_in_mem, fullsize_width); - /* if quantizing colors, also need a one-component output area for that. */ - if (cinfo->quantize_colors) - quantize_out = (*cinfo->emethods->alloc_small_sarray) - (fullsize_width, (long) rows_in_mem); + /* output_workspace is the color-processed data */ + output_workspace = alloc_sampimage(cinfo, (int) cinfo->final_out_comps, + (long) rows_in_mem, fullsize_width); /* Get a big image: fullsize_image is sample data after unsubsampling. */ fullsize_image = (big_sarray_ptr *) (*cinfo->emethods->alloc_small) @@ -1076,9 +763,34 @@ multi_dcontroller (decompress_info_ptr cinfo) * cinfo->num_components /* max components per scan */ * (cinfo->do_block_smoothing ? 4 : 1)),/* how many of these we need */ /* no extra "medium"-object space */ - /* NB: quantizer must get any such objects at color_quant_init time */ (long) 0); + /* NB: if quantizer needs any "medium" size objects, it must get them */ + /* at color_quant_init time */ + /* If file is single-scan, we can do color quantization prescan on-the-fly + * during the scan (we must be doing 2-pass quantization, else this method + * would not have been selected). If it is multiple scans, we have to make + * a separate pass after we've collected all the components. (We could save + * some I/O by doing CQ prescan during the last scan, but the extra logic + * doesn't seem worth the trouble.) + */ + + single_scan = (cinfo->comps_in_scan == cinfo->num_components); + + /* Account for passes needed (color quantizer adds its passes separately). + * If multiscan file, we guess that each component has its own scan, + * and increment completed_passes by the number of components in the scan. + */ + + if (single_scan) + cinfo->total_passes++; /* the single scan */ + else { + cinfo->total_passes += cinfo->num_components; /* guessed # of scans */ + if (cinfo->two_pass_quantize) + cinfo->total_passes++; /* account for separate CQ prescan pass */ + } + if (! cinfo->two_pass_quantize) + cinfo->total_passes++; /* count output pass unless quantizer does it */ /* Loop over scans in file */ @@ -1109,7 +821,7 @@ multi_dcontroller (decompress_info_ptr cinfo) /* subsampled_data is sample data before unsubsampling */ alloc_sampling_buffer(cinfo, subsampled_data); - /* line up the big buffers */ + /* line up the big buffers for components in this scan */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) (fullsize_image[cinfo->cur_comp_info[ci]->component_index], @@ -1129,6 +841,9 @@ multi_dcontroller (decompress_info_ptr cinfo) for (cur_mcu_row = 0; cur_mcu_row < cinfo->MCU_rows_in_scan; cur_mcu_row += mcu_rows_per_loop) { + (*cinfo->methods->progress_monitor) (cinfo, cur_mcu_row, + cinfo->MCU_rows_in_scan); + whichss ^= 1; /* switch to other subsample buffer */ /* Obtain v_samp_factor block rows of each component in the scan. */ @@ -1148,8 +863,9 @@ multi_dcontroller (decompress_info_ptr cinfo) #endif (*cinfo->methods->disassemble_MCU) (cinfo, coeff_data); - reverse_DCT(cinfo, coeff_data, subsampled_data[whichss], - ri * DCTSIZE); + (*cinfo->methods->reverse_DCT) (cinfo, coeff_data, + subsampled_data[whichss], + ri * DCTSIZE); } else { /* Need to pad out with copies of the last subsampled row. */ /* This can only happen if there is just one component. */ @@ -1167,6 +883,11 @@ multi_dcontroller (decompress_info_ptr cinfo) expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, (short) DCTSIZE, (short) (DCTSIZE+1), (short) 0, (short) (DCTSIZE-1)); + /* If single scan, can do color quantization prescan on-the-fly */ + if (single_scan) + (*cinfo->methods->color_quant_prescan) (cinfo, rows_in_mem, + fullsize_ptrs, + output_workspace[0]); /* Realign the big buffers */ pixel_rows_output += rows_in_mem; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { @@ -1190,19 +911,28 @@ multi_dcontroller (decompress_info_ptr cinfo) (short) (i-1), (short) i, (short) (i+1), (short) i); } - } /* end of outer loop */ + } /* end of loop over scan's data */ /* Expand the last row group with dummy below-context */ /* Note whichss points to last buffer side used */ expand(cinfo, subsampled_data[whichss], fullsize_ptrs, fullsize_width, (short) (DCTSIZE-2), (short) (DCTSIZE-1), (short) (-1), (short) (DCTSIZE-1)); + /* If single scan, finish on-the-fly color quantization prescan */ + if (single_scan) + (*cinfo->methods->color_quant_prescan) (cinfo, + (int) (cinfo->image_height - pixel_rows_output), + fullsize_ptrs, output_workspace[0]); /* Clean up after the scan */ (*cinfo->methods->disassemble_term) (cinfo); (*cinfo->methods->unsubsample_term) (cinfo); (*cinfo->methods->entropy_decoder_term) (cinfo); (*cinfo->methods->read_scan_trailer) (cinfo); + if (single_scan) + cinfo->completed_passes++; + else + cinfo->completed_passes += cinfo->comps_in_scan; /* Release scan-local working memory */ free_MCU_row(cinfo, coeff_data); @@ -1216,61 +946,32 @@ multi_dcontroller (decompress_info_ptr cinfo) free_sampling_buffer(cinfo, subsampled_data); /* Repeat if there is another scan */ - } while ((*cinfo->methods->read_scan_header) (cinfo)); + } while ((!single_scan) && (*cinfo->methods->read_scan_header) (cinfo)); - /* Now that we've collected all the data, color convert & output it. */ - - for (pixel_rows_output = 0; pixel_rows_output < cinfo->image_height; - pixel_rows_output += rows_in_mem) { - - /* realign the big buffers */ - for (ci = 0; ci < cinfo->num_components; ci++) { - fullsize_ptrs[ci] = (*cinfo->emethods->access_big_sarray) - (fullsize_image[ci], pixel_rows_output, FALSE); - } - - emit_1pass (cinfo, - (int) MIN((long) rows_in_mem, - cinfo->image_height - pixel_rows_output), - fullsize_ptrs, color_data); + if (single_scan) { + /* If we expected just one scan, make SURE there's just one */ + if ((*cinfo->methods->read_scan_header) (cinfo)) + ERREXIT(cinfo->emethods, "Didn't expect more than one scan"); + /* We did the CQ prescan on-the-fly, so we are all set. */ + } else { + /* For multiple-scan file, do the CQ prescan as a separate pass. */ + /* The main reason why prescan is passed the output_workspace is */ + /* so that we can use scan_big_image to call it... */ + if (cinfo->two_pass_quantize) + scan_big_image(cinfo, cinfo->methods->color_quant_prescan); } + /* Now that we've collected the data, do color processing and output */ + if (cinfo->two_pass_quantize) + (*cinfo->methods->color_quant_doit) (cinfo, scan_big_image); + else + scan_big_image(cinfo, emit_1pass); + /* Release working memory */ - free_sampimage(cinfo, color_data, (int) cinfo->color_out_comps, - (long) rows_in_mem); - if (cinfo->quantize_colors) - (*cinfo->emethods->free_small_sarray) - (quantize_out, (long) rows_in_mem); - for (ci = 0; ci < cinfo->num_components; ci++) { - (*cinfo->emethods->free_big_sarray) (fullsize_image[ci]); - } - (*cinfo->emethods->free_small) ((void *) fullsize_image); - (*cinfo->emethods->free_small) ((void *) fullsize_ptrs); - - /* Close up shop */ - if (cinfo->quantize_colors) - (*cinfo->methods->color_quant_term) (cinfo); + /* (no work -- we let free_all release what's needful) */ } -#endif /* MULTISCAN_FILES_SUPPORTED */ - - -/* - * Decompression pipeline controller used for multiple-scan files - * with 2-pass color quantization. - */ - -#ifdef MULTISCAN_FILES_SUPPORTED -#ifdef QUANT_2PASS_SUPPORTED - -METHODDEF void -multi_2quant_dcontroller (decompress_info_ptr cinfo) -{ - ERREXIT(cinfo->emethods, "Not implemented yet"); -} - -#endif /* QUANT_2PASS_SUPPORTED */ -#endif /* MULTISCAN_FILES_SUPPORTED */ +#endif /* NEED_COMPLEX_CONTROLLER */ /* @@ -1288,21 +989,18 @@ jseldpipeline (decompress_info_ptr cinfo) if (cinfo->comps_in_scan == cinfo->num_components) { /* It's a single-scan file */ -#ifdef QUANT_2PASS_SUPPORTED - if (cinfo->two_pass_quantize) - cinfo->methods->d_pipeline_controller = single_2quant_dcontroller; - else + if (cinfo->two_pass_quantize) { +#ifdef NEED_COMPLEX_CONTROLLER + cinfo->methods->d_pipeline_controller = complex_dcontroller; +#else + ERREXIT(cinfo->emethods, "2-pass quantization support was not compiled"); #endif - cinfo->methods->d_pipeline_controller = single_dcontroller; + } else + cinfo->methods->d_pipeline_controller = simple_dcontroller; } else { /* It's a multiple-scan file */ -#ifdef MULTISCAN_FILES_SUPPORTED -#ifdef QUANT_2PASS_SUPPORTED - if (cinfo->two_pass_quantize) - cinfo->methods->d_pipeline_controller = multi_2quant_dcontroller; - else -#endif - cinfo->methods->d_pipeline_controller = multi_dcontroller; +#ifdef NEED_COMPLEX_CONTROLLER + cinfo->methods->d_pipeline_controller = complex_dcontroller; #else ERREXIT(cinfo->emethods, "Multiple-scan support was not compiled"); #endif diff --git a/jdsample.c b/jdsample.c index 15dbf4f8..71fb4534 100644 --- a/jdsample.c +++ b/jdsample.c @@ -1,7 +1,7 @@ /* * jdsample.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,30 +26,33 @@ unsubsample_init (decompress_info_ptr cinfo) /* * Un-subsample pixel values of a single component. - * This version only handles integral sampling ratios. + * This version handles any integral sampling ratios. + * This is not used for typical JPEG files, so it need not be fast. */ METHODDEF void -unsubsample (decompress_info_ptr cinfo, int which_component, - long input_cols, int input_rows, - long output_cols, int output_rows, - JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, - JSAMPARRAY output_data) +int_unsubsample (decompress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) { jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; - short h_expand, v_expand, h, v; + register JSAMPROW inptr, outptr; + register JSAMPLE invalue; + register short h_expand, h; + short v_expand, v; int inrow, outrow; - long incol; - JSAMPROW inptr, outptr; - JSAMPLE invalue; + register long incol; - /* TEMP FOR DEBUGGING PIPELINE CONTROLLER */ +#ifdef DEBUG /* for debugging pipeline controller */ if (input_rows != compptr->v_samp_factor || output_rows != cinfo->max_v_samp_factor || (input_cols % compptr->h_samp_factor) != 0 || (output_cols % cinfo->max_h_samp_factor) != 0 || output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor) ERREXIT(cinfo->emethods, "Bogus unsubsample parameters"); +#endif h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; @@ -70,6 +73,85 @@ unsubsample (decompress_info_ptr cinfo, int which_component, } +/* + * Un-subsample pixel values of a single component. + * This version handles the extremely common case of + * horizontal expansion by 2 and any integral vertical expansion. + */ + +METHODDEF void +h2_unsubsample (decompress_info_ptr cinfo, int which_component, + long input_cols, int input_rows, + long output_cols, int output_rows, + JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, + JSAMPARRAY output_data) +{ + jpeg_component_info * compptr = cinfo->cur_comp_info[which_component]; + register JSAMPROW inptr, outptr; + register JSAMPLE invalue; + short v_expand, v; + int inrow, outrow; + register long incol; + +#ifdef DEBUG /* for debugging pipeline controller */ + if (input_rows != compptr->v_samp_factor || + output_rows != cinfo->max_v_samp_factor || + (input_cols % compptr->h_samp_factor) != 0 || + (output_cols % cinfo->max_h_samp_factor) != 0 || + output_cols*compptr->h_samp_factor != input_cols*cinfo->max_h_samp_factor) + ERREXIT(cinfo->emethods, "Bogus unsubsample parameters"); +#endif + + v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; + +/* The subsampled image width will always be a multiple of DCTSIZE, + * so we can unroll the inner loop. + */ + + outrow = 0; + for (inrow = 0; inrow < input_rows; inrow++) { + for (v = 0; v < v_expand; v++) { + inptr = input_data[inrow]; + outptr = output_data[outrow++]; +#if DCTSIZE == 8 + for (incol = 0; incol < input_cols; incol += DCTSIZE) { + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + } +#else /* nonstandard DCTSIZE */ + for (incol = 0; incol < input_cols; incol++) { + invalue = GETJSAMPLE(*inptr++); + *outptr++ = invalue; + *outptr++ = invalue; + } +#endif + } + } +} + + /* * Un-subsample pixel values of a single component. * This version handles the special case of a full-size component. @@ -82,8 +164,10 @@ fullsize_unsubsample (decompress_info_ptr cinfo, int which_component, JSAMPARRAY above, JSAMPARRAY input_data, JSAMPARRAY below, JSAMPARRAY output_data) { - if (input_cols != output_cols || input_rows != output_rows) /* DEBUG */ +#ifdef DEBUG /* for debugging pipeline controller */ + if (input_cols != output_cols || input_rows != output_rows) ERREXIT(cinfo->emethods, "Pipeline controller messed up"); +#endif jcopy_sample_rows(input_data, 0, output_data, 0, output_rows, output_cols); } @@ -121,9 +205,12 @@ jselunsubsample (decompress_info_ptr cinfo) if (compptr->h_samp_factor == cinfo->max_h_samp_factor && compptr->v_samp_factor == cinfo->max_v_samp_factor) cinfo->methods->unsubsample[ci] = fullsize_unsubsample; + else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) + cinfo->methods->unsubsample[ci] = h2_unsubsample; else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) - cinfo->methods->unsubsample[ci] = unsubsample; + cinfo->methods->unsubsample[ci] = int_unsubsample; else ERREXIT(cinfo->emethods, "Fractional subsampling not implemented yet"); } diff --git a/jerror.c b/jerror.c index f719dbcc..2302312c 100644 --- a/jerror.c +++ b/jerror.c @@ -1,7 +1,7 @@ /* * jerror.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -13,9 +13,9 @@ * The error_exit() routine should not return to its caller. Within a * larger application, you might want to have it do a longjmp() to return * control to the outer user interface routine. This should work since - * the portable JPEG code doesn't use setjmp/longjmp. However, this won't - * release allocated memory or close temp files --- some bookkeeping would - * need to be added to the memory manager module to make that work. + * the portable JPEG code doesn't use setjmp/longjmp. You should make sure + * that free_all is called either within error_exit or after the return to + * the outer-level routine. * * These routines are used by both the compression and decompression code. */ @@ -25,8 +25,12 @@ #include /* to declare exit() */ #endif +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif -static external_methods_ptr methods; /* saved for access to message_parm */ + +static external_methods_ptr methods; /* saved for access to message_parm, free_all */ METHODDEF void @@ -45,7 +49,8 @@ METHODDEF void error_exit (const char *msgtext) { trace_message(msgtext); - exit(1); + (*methods->free_all) (); /* clean up memory allocation */ + exit(EXIT_FAILURE); } @@ -58,7 +63,7 @@ error_exit (const char *msgtext) GLOBAL void jselerror (external_methods_ptr emethods) { - methods = emethods; /* save struct addr for msg parm access */ + methods = emethods; /* save struct addr for later access */ emethods->error_exit = error_exit; emethods->trace_message = trace_message; diff --git a/jfwddct.c b/jfwddct.c index 21d8448b..0ca0e783 100644 --- a/jfwddct.c +++ b/jfwddct.c @@ -1,7 +1,7 @@ /* * jfwddct.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,25 +16,12 @@ #include "jinclude.h" - -/* We assume that right shift corresponds to signed division by 2 with - * rounding towards minus infinity. This is correct for typical "arithmetic - * shift" instructions that shift in copies of the sign bit. But some - * C compilers implement >> with an unsigned shift. For these machines you - * must define RIGHT_SHIFT_IS_UNSIGNED. - * RIGHT_SHIFT provides a signed right shift of an INT32 quantity. - * It is only applied with constant shift counts. +/* + * This routine is specialized to the case DCTSIZE = 8. */ -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS INT32 shift_temp; -#define RIGHT_SHIFT(x,shft) \ - ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~0) << (32-(shft))) : \ - (shift_temp >> (shft))) -#else -#define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif @@ -138,74 +125,6 @@ #define OCOS_5_16 OSIN_3_16 -/* - * Perform a 1-dimensional DCT. - * Note that this code is specialized to the case DCTSIZE = 8. - */ - -INLINE -LOCAL void -fast_dct_8 (DCTELEM *in, int stride) -{ - /* many tmps have nonoverlapping lifetime -- flashy register colourers - * should be able to do this lot very well - */ - INT32 in0, in1, in2, in3, in4, in5, in6, in7; - INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 tmp14, tmp15, tmp16, tmp17; - INT32 tmp25, tmp26; - SHIFT_TEMPS - - in0 = in[ 0]; - in1 = in[stride ]; - in2 = in[stride*2]; - in3 = in[stride*3]; - in4 = in[stride*4]; - in5 = in[stride*5]; - in6 = in[stride*6]; - in7 = in[stride*7]; - - tmp0 = in7 + in0; - tmp1 = in6 + in1; - tmp2 = in5 + in2; - tmp3 = in4 + in3; - tmp4 = in3 - in4; - tmp5 = in2 - in5; - tmp6 = in1 - in6; - tmp7 = in0 - in7; - - tmp10 = tmp3 + tmp0; - tmp11 = tmp2 + tmp1; - tmp12 = tmp1 - tmp2; - tmp13 = tmp0 - tmp3; - - in[ 0] = (DCTELEM) UNFIXH((tmp10 + tmp11) * SIN_1_4); - in[stride*4] = (DCTELEM) UNFIXH((tmp10 - tmp11) * COS_1_4); - - in[stride*2] = (DCTELEM) UNFIXH(tmp13*COS_1_8 + tmp12*SIN_1_8); - in[stride*6] = (DCTELEM) UNFIXH(tmp13*SIN_1_8 - tmp12*COS_1_8); - - tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); - tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); - - OVERSHIFT(tmp4); - OVERSHIFT(tmp7); - - /* tmp4, tmp7, tmp15, tmp16 are overscaled by OVERSCALE */ - - tmp14 = tmp4 + tmp15; - tmp25 = tmp4 - tmp15; - tmp26 = tmp7 - tmp16; - tmp17 = tmp7 + tmp16; - - in[stride ] = (DCTELEM) UNFIXH(tmp17*OCOS_1_16 + tmp14*OSIN_1_16); - in[stride*7] = (DCTELEM) UNFIXH(tmp17*OCOS_7_16 - tmp14*OSIN_7_16); - in[stride*5] = (DCTELEM) UNFIXH(tmp26*OCOS_5_16 + tmp25*OSIN_5_16); - in[stride*3] = (DCTELEM) UNFIXH(tmp26*OCOS_3_16 - tmp25*OSIN_3_16); -} - - /* * Perform the forward DCT on one block of samples. * @@ -216,11 +135,74 @@ fast_dct_8 (DCTELEM *in, int stride) GLOBAL void j_fwd_dct (DCTBLOCK data) { - int i; - - for (i = 0; i < DCTSIZE; i++) - fast_dct_8(data+i*DCTSIZE, 1); + int pass, rowctr; + register DCTELEM *inptr, *outptr; + DCTBLOCK workspace; - for (i = 0; i < DCTSIZE; i++) - fast_dct_8(data+i, DCTSIZE); + /* Each iteration of the inner loop performs one 8-point 1-D DCT. + * It reads from a *row* of the input matrix and stores into a *column* + * of the output matrix. In the first pass, we read from the data[] array + * and store into the local workspace[]. In the second pass, we read from + * the workspace[] array and store into data[], thus performing the + * equivalent of a columnar DCT pass with no variable array indexing. + */ + + inptr = data; /* initialize pointers for first pass */ + outptr = workspace; + for (pass = 1; pass >= 0; pass--) { + for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { + /* many tmps have nonoverlapping lifetime -- flashy register colourers + * should be able to do this lot very well + */ + INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 tmp14, tmp15, tmp16, tmp17; + INT32 tmp25, tmp26; + SHIFT_TEMPS + + tmp0 = inptr[7] + inptr[0]; + tmp1 = inptr[6] + inptr[1]; + tmp2 = inptr[5] + inptr[2]; + tmp3 = inptr[4] + inptr[3]; + tmp4 = inptr[3] - inptr[4]; + tmp5 = inptr[2] - inptr[5]; + tmp6 = inptr[1] - inptr[6]; + tmp7 = inptr[0] - inptr[7]; + + tmp10 = tmp3 + tmp0; + tmp11 = tmp2 + tmp1; + tmp12 = tmp1 - tmp2; + tmp13 = tmp0 - tmp3; + + outptr[ 0] = (DCTELEM) UNFIXH((tmp10 + tmp11) * SIN_1_4); + outptr[DCTSIZE*4] = (DCTELEM) UNFIXH((tmp10 - tmp11) * COS_1_4); + + outptr[DCTSIZE*2] = (DCTELEM) UNFIXH(tmp13*COS_1_8 + tmp12*SIN_1_8); + outptr[DCTSIZE*6] = (DCTELEM) UNFIXH(tmp13*SIN_1_8 - tmp12*COS_1_8); + + tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4); + tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4); + + OVERSHIFT(tmp4); + OVERSHIFT(tmp7); + + /* tmp4, tmp7, tmp15, tmp16 are overscaled by OVERSCALE */ + + tmp14 = tmp4 + tmp15; + tmp25 = tmp4 - tmp15; + tmp26 = tmp7 - tmp16; + tmp17 = tmp7 + tmp16; + + outptr[DCTSIZE ] = (DCTELEM) UNFIXH(tmp17*OCOS_1_16 + tmp14*OSIN_1_16); + outptr[DCTSIZE*7] = (DCTELEM) UNFIXH(tmp17*OCOS_7_16 - tmp14*OSIN_7_16); + outptr[DCTSIZE*5] = (DCTELEM) UNFIXH(tmp26*OCOS_5_16 + tmp25*OSIN_5_16); + outptr[DCTSIZE*3] = (DCTELEM) UNFIXH(tmp26*OCOS_3_16 - tmp25*OSIN_3_16); + + inptr += DCTSIZE; /* advance inptr to next row */ + outptr++; /* advance outptr to next column */ + } + /* end of pass; in case it was pass 1, set up for pass 2 */ + inptr = workspace; + outptr = data; + } } diff --git a/jinclude.h b/jinclude.h index 779c61da..2786670b 100644 --- a/jinclude.h +++ b/jinclude.h @@ -1,7 +1,7 @@ /* * jinclude.h * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 @@ * Note that the core portable-JPEG files do not actually do any I/O * using the stdio library; only the user interface, error handler, * and file reading/writing modules invoke any stdio functions. - * (Well, we did cheat a bit in jvirtmem.c, but only if MEM_STATS is defined.) + * (Well, we did cheat a bit in jmemmgr.c, but only if MEM_STATS is defined.) */ #include @@ -67,9 +67,9 @@ * CAUTION: argument order is different from underlying functions! */ -#define FREAD(file,buf,sizeofbuf) \ +#define JFREAD(file,buf,sizeofbuf) \ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) -#define FWRITE(file,buf,sizeofbuf) \ +#define JFWRITE(file,buf,sizeofbuf) \ ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) /* diff --git a/jmemansi.c b/jmemansi.c new file mode 100644 index 00000000..22c7d050 --- /dev/null +++ b/jmemansi.c @@ -0,0 +1,157 @@ +/* + * jmemansi.c (jmemsys.c) + * + * Copyright (C) 1992, 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. + * + * This file provides a simple generic implementation of the system- + * dependent portion of the JPEG memory manager. This implementation + * assumes that you have the ANSI-standard library routine tmpfile(). + * Also, the problem of determining the amount of memory available + * is shoved onto the user. + */ + +#include "jinclude.h" +#include "jmemsys.h" + +#ifdef INCLUDES_ARE_ANSI +#include /* to declare malloc(), free() */ +#else +extern void * malloc PP((size_t size)); +extern void free PP((void *ptr)); +#endif + +#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ +#define SEEK_SET 0 /* if not, assume 0 is correct */ +#endif + + +static external_methods_ptr methods; /* saved for access to error_exit */ + +static long total_used; /* total memory requested so far */ + + +/* + * Memory allocation and freeing are controlled by the regular library + * routines malloc() and free(). + */ + +GLOBAL void * +jget_small (size_t sizeofobject) +{ + total_used += sizeofobject; + return (void *) malloc(sizeofobject); +} + +GLOBAL void +jfree_small (void * object) +{ + free(object); +} + +/* + * We assume NEED_FAR_POINTERS is not defined and so the separate entry points + * jget_large, jfree_large are not needed. + */ + + +/* + * This routine computes the total memory space available for allocation. + * It's impossible to do this in a portable way; our current solution is + * to make the user tell us (with a default value set at compile time). + * If you can actually get the available space, it's a good idea to subtract + * a slop factor of 5% or so. + */ + +#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ +#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ +#endif + +GLOBAL long +jmem_available (long min_bytes_needed, long max_bytes_needed) +{ + return methods->max_memory_to_use - total_used; +} + + +/* + * Backing store (temporary file) management. + * Backing store objects are only used when the value returned by + * jmem_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 (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(methods, "fseek failed on temporary file"); + if (JFREAD(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(methods, "fread failed on temporary file"); +} + + +METHODDEF void +write_backing_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(methods, "fseek failed on temporary file"); + if (JFWRITE(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(methods, "fwrite failed on temporary file --- out of disk space?"); +} + + +METHODDEF void +close_backing_store (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 temp_name[] at all; + * indeed, we can't even find out the actual name of the temp file. + */ + +GLOBAL void +jopen_backing_store (backing_store_ptr info, long total_bytes_needed) +{ + if ((info->temp_file = tmpfile()) == NULL) + ERREXIT(methods, "Failed to create temporary file"); + 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. Keep in mind that jmem_term may be called more than + * once. + */ + +GLOBAL void +jmem_init (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + emethods->max_memory_to_use = DEFAULT_MAX_MEM; + total_used = 0; +} + +GLOBAL void +jmem_term (void) +{ + /* no work */ +} diff --git a/jmemdos.c b/jmemdos.c new file mode 100644 index 00000000..f6839c96 --- /dev/null +++ b/jmemdos.c @@ -0,0 +1,608 @@ +/* + * jmemdos.c (jmemsys.c) + * + * Copyright (C) 1992, 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. + * + * This file provides an MS-DOS-compatible implementation of the system- + * dependent portion of the JPEG memory manager. Temporary data can be + * stored in extended or expanded memory as well as in regular DOS files. + * + * If you use this file, you must be sure that NEED_FAR_POINTERS is defined + * if you compile in a small-data memory model; it should NOT be defined if + * you use a large-data memory model. This file is not recommended if you + * are using a flat-memory-space 386 environment such as DJGCC or Watcom C. + * + * Based on code contributed by Ge' Weijers. + */ + +/* + * If you have both extended and expanded memory, you may want to change the + * order in which they are tried in jopen_backing_store. On a 286 machine + * expanded memory is usually faster, since extended memory access involves + * an expensive protected-mode-and-back switch. On 386 and better, extended + * memory is usually faster. As distributed, the code tries extended memory + * first (what? not everyone has a 386? :-). + * + * You can disable use of extended/expanded memory entirely by altering these + * definitions or overriding them from the Makefile (eg, -DEMS_SUPPORTED=0). + */ + +#ifndef XMS_SUPPORTED +#define XMS_SUPPORTED 1 +#endif +#ifndef EMS_SUPPORTED +#define EMS_SUPPORTED 1 +#endif + + +#include "jinclude.h" +#include "jmemsys.h" + +#ifdef INCLUDES_ARE_ANSI +#include /* to declare malloc(), free() */ +#else +extern void * malloc PP((size_t size)); +extern void free PP((void *ptr)); +#endif + +#ifdef NEED_FAR_POINTERS + +#ifdef __TURBOC__ +/* These definitions work for Borland C (Turbo C) */ +#include /* need farmalloc(), farfree() */ +#define far_malloc(x) farmalloc(x) +#define far_free(x) farfree(x) +#else +/* These definitions work for Microsoft C and compatible compilers */ +#include /* need _fmalloc(), _ffree() */ +#define far_malloc(x) _fmalloc(x) +#define far_free(x) _ffree(x) +#endif + +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#else +#define READ_BINARY "rb" +#endif + + +/* + * Declarations for assembly-language support routines (see jmemdosa.asm). + * + * The functions are declared "far" as are all 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. + */ + +typedef void far * XMSDRIVER; /* actually a pointer to code */ +typedef struct { /* registers for calling XMS driver */ + unsigned short ax, dx, bx; + void far * ds_si; + } XMScontext; +typedef struct { /* registers for calling EMS driver */ + unsigned short ax, dx, bx; + void far * ds_si; + } EMScontext; + +EXTERN short far jdos_open PP((short far * handle, char far * filename)); +EXTERN short far jdos_close PP((short handle)); +EXTERN short far jdos_seek PP((short handle, long offset)); +EXTERN short far jdos_read PP((short handle, void far * buffer, + unsigned short count)); +EXTERN short far jdos_write PP((short handle, void far * buffer, + unsigned short count)); +EXTERN void far jxms_getdriver PP((XMSDRIVER far *)); +EXTERN void far jxms_calldriver PP((XMSDRIVER, XMScontext far *)); +EXTERN short far jems_available PP((void)); +EXTERN void far jems_calldriver PP((EMScontext far *)); + + +static external_methods_ptr methods; /* saved for access to error_exit */ + +static long total_used; /* total FAR memory requested so far */ + + +/* + * Selection of a file name for a temporary file. + * This is highly system-dependent, and you may want to customize it. + */ + +static int next_file_num; /* to distinguish among several temp files */ + +LOCAL void +select_file_name (char * fname) +{ + const char * env; + char * ptr; + FILE * tfile; + + /* Keep generating file names till we find one that's not in use */ + for (;;) { + /* Get temp directory name from environment TMP or TEMP variable; + * if none, use "." + */ + if ((env = (const char *) getenv("TMP")) == NULL) + if ((env = (const char *) getenv("TEMP")) == NULL) + env = "."; + if (*env == '\0') /* null string means "." */ + env = "."; + ptr = fname; /* copy name to fname */ + while (*env != '\0') + *ptr++ = *env++; + if (ptr[-1] != '\\' && ptr[-1] != '/') + *ptr++ = '\\'; /* append backslash if not in env variable */ + /* Append a suitable file name */ + next_file_num++; /* advance counter */ + sprintf(ptr, "JPG%03d.TMP", next_file_num); + /* Probe to see if file name is already in use */ + if ((tfile = fopen(fname, READ_BINARY)) == NULL) + break; + fclose(tfile); /* oops, it's there; close tfile & try again */ + } +} + + +/* + * Near-memory allocation and freeing are controlled by the regular library + * routines malloc() and free(). + */ + +GLOBAL void * +jget_small (size_t sizeofobject) +{ + /* near data space is NOT counted in total_used */ +#ifndef NEED_FAR_POINTERS + total_used += sizeofobject; +#endif + return (void *) malloc(sizeofobject); +} + +GLOBAL void +jfree_small (void * object) +{ + free(object); +} + + +/* + * Far-memory allocation and freeing + */ + +#ifdef NEED_FAR_POINTERS + +GLOBAL void FAR * +jget_large (size_t sizeofobject) +{ + total_used += sizeofobject; + return (void FAR *) far_malloc(sizeofobject); +} + +GLOBAL void +jfree_large (void FAR * object) +{ + far_free(object); +} + +#endif + + +/* + * This routine computes the total memory space available for allocation. + * It's impossible to do this in a portable way; our current solution is + * to make the user tell us (with a default value set at compile time). + * If you can actually get the available space, it's a good idea to subtract + * a slop factor of 5% or so. + */ + +#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ +#define DEFAULT_MAX_MEM 300000L /* for total usage about 450K */ +#endif + +GLOBAL long +jmem_available (long min_bytes_needed, long max_bytes_needed) +{ + return methods->max_memory_to_use - total_used; +} + + +/* + * Backing store (temporary file) management. + * Backing store objects are only used when the value returned by + * jmem_available is less than the total space needed. You can dispense + * with these routines if you have plenty of virtual memory; see jmemnobs.c. + */ + +/* + * For MS-DOS we support three types of backing storage: + * 1. Conventional DOS files. We access these by direct DOS calls rather + * than via the stdio package. This provides a bit better performance, + * but the real reason is that the buffers to be read or written are FAR. + * The stdio library for small-data memory models can't cope with that. + * 2. Extended memory, accessed per the XMS V2.0 specification. + * 3. Expanded memory, accessed per the LIM/EMS 4.0 specification. + * You'll need copies of those specs to make sense of the related code. + * The specs are available by Internet FTP from SIMTEL20 and its various + * mirror sites; see microsoft/xms20.arc and info/limems41.zip. + */ + + +/* + * Access methods for a DOS file. + */ + + +METHODDEF void +read_file_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (jdos_seek(info->handle.file_handle, file_offset)) + ERREXIT(methods, "seek failed on temporary file"); + /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ + if (byte_count > 65535L) /* safety check */ + ERREXIT(methods, "MAX_ALLOC_CHUNK should be less than 64K"); + if (jdos_read(info->handle.file_handle, buffer_address, + (unsigned short) byte_count)) + ERREXIT(methods, "read failed on temporary file"); +} + + +METHODDEF void +write_file_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (jdos_seek(info->handle.file_handle, file_offset)) + ERREXIT(methods, "seek failed on temporary file"); + /* Since MAX_ALLOC_CHUNK is less than 64K, byte_count will be too. */ + if (byte_count > 65535L) /* safety check */ + ERREXIT(methods, "MAX_ALLOC_CHUNK should be less than 64K"); + if (jdos_write(info->handle.file_handle, buffer_address, + (unsigned short) byte_count)) + ERREXIT(methods, "write failed on temporary file --- out of disk space?"); +} + + +METHODDEF void +close_file_store (backing_store_ptr info) +{ + jdos_close(info->handle.file_handle); /* close the file */ + remove(info->temp_name); /* delete the file */ +/* If your system doesn't have remove(), try unlink() instead. + * remove() is the ANSI-standard name for this function, but + * unlink() was more common in pre-ANSI systems. + */ + TRACEMS1(methods, 1, "Closed DOS file %d", info->handle.file_handle); +} + + +LOCAL boolean +open_file_store (backing_store_ptr info, long total_bytes_needed) +{ + short handle; + char tracemsg[TEMP_NAME_LENGTH+40]; + + select_file_name(info->temp_name); + if (jdos_open((short far *) & handle, (char far *) info->temp_name)) + return FALSE; + info->handle.file_handle = handle; + info->read_backing_store = read_file_store; + info->write_backing_store = write_file_store; + info->close_backing_store = close_file_store; + /* hack to get around TRACEMS' inability to handle string parameters */ + sprintf(tracemsg, "Opened DOS file %d %s", handle, info->temp_name); + TRACEMS(methods, 1, tracemsg); + return TRUE; /* succeeded */ +} + + +/* + * Access methods for extended memory. + */ + +#if XMS_SUPPORTED + +static XMSDRIVER xms_driver; /* saved address of XMS driver */ + +typedef union { /* either long offset or real-mode pointer */ + long offset; + void far * ptr; + } XMSPTR; + +typedef struct { /* XMS move specification structure */ + long length; + XMSH src_handle; + XMSPTR src; + XMSH dst_handle; + XMSPTR dst; + } XMSspec; + +#define ODD(X) (((X) & 1L) != 0) + + +METHODDEF void +read_xms_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + XMScontext ctx; + XMSspec spec; + char endbuffer[2]; + + /* The XMS driver can't cope with an odd length, so handle the last byte + * specially if byte_count is odd. We don't expect this to be common. + */ + + spec.length = byte_count & (~ 1L); + spec.src_handle = info->handle.xms_handle; + spec.src.offset = file_offset; + spec.dst_handle = 0; + spec.dst.ptr = buffer_address; + + ctx.ds_si = (void far *) & spec; + ctx.ax = 0x0b00; /* EMB move */ + jxms_calldriver(xms_driver, (XMScontext far *) & ctx); + if (ctx.ax != 1) + ERREXIT(methods, "read from extended memory failed"); + + if (ODD(byte_count)) { + read_xms_store(info, (void FAR *) endbuffer, + file_offset + byte_count - 1L, 2L); + ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0]; + } +} + + +METHODDEF void +write_xms_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + XMScontext ctx; + XMSspec spec; + char endbuffer[2]; + + /* The XMS driver can't cope with an odd length, so handle the last byte + * specially if byte_count is odd. We don't expect this to be common. + */ + + spec.length = byte_count & (~ 1L); + spec.src_handle = 0; + spec.src.ptr = buffer_address; + spec.dst_handle = info->handle.xms_handle; + spec.dst.offset = file_offset; + + ctx.ds_si = (void far *) & spec; + ctx.ax = 0x0b00; /* EMB move */ + jxms_calldriver(xms_driver, (XMScontext far *) & ctx); + if (ctx.ax != 1) + ERREXIT(methods, "write to extended memory failed"); + + if (ODD(byte_count)) { + read_xms_store(info, (void FAR *) endbuffer, + file_offset + byte_count - 1L, 2L); + endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L]; + write_xms_store(info, (void FAR *) endbuffer, + file_offset + byte_count - 1L, 2L); + } +} + + +METHODDEF void +close_xms_store (backing_store_ptr info) +{ + XMScontext ctx; + + ctx.dx = info->handle.xms_handle; + ctx.ax = 0x0a00; + jxms_calldriver(xms_driver, (XMScontext far *) & ctx); + TRACEMS1(methods, 1, "Freed XMS handle %u", info->handle.xms_handle); + /* we ignore any error return from the driver */ +} + + +LOCAL boolean +open_xms_store (backing_store_ptr info, long total_bytes_needed) +{ + XMScontext ctx; + + /* Get address of XMS driver */ + jxms_getdriver((XMSDRIVER far *) & xms_driver); + if (xms_driver == NULL) + return FALSE; /* no driver to be had */ + + /* Get version number, must be >= 2.00 */ + ctx.ax = 0x0000; + jxms_calldriver(xms_driver, (XMScontext far *) & ctx); + if (ctx.ax < (unsigned short) 0x0200) + return FALSE; + + /* Try to get space (expressed in kilobytes) */ + ctx.dx = (unsigned short) ((total_bytes_needed + 1023L) >> 10); + ctx.ax = 0x0900; + jxms_calldriver(xms_driver, (XMScontext far *) & ctx); + if (ctx.ax != 1) + return FALSE; + + /* Succeeded, save the handle and away we go */ + info->handle.xms_handle = ctx.dx; + info->read_backing_store = read_xms_store; + info->write_backing_store = write_xms_store; + info->close_backing_store = close_xms_store; + TRACEMS1(methods, 1, "Obtained XMS handle %u", ctx.dx); + return TRUE; /* succeeded */ +} + +#endif /* XMS_SUPPORTED */ + + +/* + * Access methods for expanded memory. + */ + +#if EMS_SUPPORTED + +typedef union { /* either offset/page or real-mode pointer */ + struct { unsigned short offset, page; } ems; + void far * ptr; + } EMSPTR; + +typedef struct { /* EMS move specification structure */ + long length; + char src_type; /* 1 = EMS, 0 = conventional memory */ + EMSH src_handle; /* use 0 if conventional memory */ + EMSPTR src; + char dst_type; + EMSH dst_handle; + EMSPTR dst; + } EMSspec; + +#define EMSPAGESIZE 16384L /* gospel, see the EMS specs */ + +#define HIBYTE(W) (((W) >> 8) & 0xFF) +#define LOBYTE(W) ((W) & 0xFF) + + +METHODDEF void +read_ems_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + EMScontext ctx; + EMSspec spec; + + spec.length = byte_count; + spec.src_type = 1; + spec.src_handle = info->handle.ems_handle; + spec.src.ems.page = (unsigned short) (file_offset / EMSPAGESIZE); + spec.src.ems.offset = (unsigned short) (file_offset % EMSPAGESIZE); + spec.dst_type = 0; + spec.dst_handle = 0; + spec.dst.ptr = buffer_address; + + ctx.ds_si = (void far *) & spec; + ctx.ax = 0x5700; /* move memory region */ + jems_calldriver((EMScontext far *) & ctx); + if (HIBYTE(ctx.ax) != 0) + ERREXIT(methods, "read from expanded memory failed"); +} + + +METHODDEF void +write_ems_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + EMScontext ctx; + EMSspec spec; + + spec.length = byte_count; + spec.src_type = 0; + spec.src_handle = 0; + spec.src.ptr = buffer_address; + spec.dst_type = 1; + spec.dst_handle = info->handle.ems_handle; + spec.dst.ems.page = (unsigned short) (file_offset / EMSPAGESIZE); + spec.dst.ems.offset = (unsigned short) (file_offset % EMSPAGESIZE); + + ctx.ds_si = (void far *) & spec; + ctx.ax = 0x5700; /* move memory region */ + jems_calldriver((EMScontext far *) & ctx); + if (HIBYTE(ctx.ax) != 0) + ERREXIT(methods, "write to expanded memory failed"); +} + + +METHODDEF void +close_ems_store (backing_store_ptr info) +{ + EMScontext ctx; + + ctx.ax = 0x4500; + ctx.dx = info->handle.ems_handle; + jems_calldriver((EMScontext far *) & ctx); + TRACEMS1(methods, 1, "Freed EMS handle %u", info->handle.ems_handle); + /* we ignore any error return from the driver */ +} + + +LOCAL boolean +open_ems_store (backing_store_ptr info, long total_bytes_needed) +{ + EMScontext ctx; + + /* Is EMS driver there? */ + if (! jems_available()) + return FALSE; + + /* Get status, make sure EMS is OK */ + ctx.ax = 0x4000; + jems_calldriver((EMScontext far *) & ctx); + if (HIBYTE(ctx.ax) != 0) + return FALSE; + + /* Get version, must be >= 4.0 */ + ctx.ax = 0x4600; + jems_calldriver((EMScontext far *) & ctx); + if (HIBYTE(ctx.ax) != 0 || LOBYTE(ctx.ax) < 0x40) + return FALSE; + + /* Try to allocate requested space */ + ctx.ax = 0x4300; + ctx.bx = (unsigned short) ((total_bytes_needed + EMSPAGESIZE-1L) / EMSPAGESIZE); + jems_calldriver((EMScontext far *) & ctx); + if (HIBYTE(ctx.ax) != 0) + return FALSE; + + /* Succeeded, save the handle and away we go */ + info->handle.ems_handle = ctx.dx; + info->read_backing_store = read_ems_store; + info->write_backing_store = write_ems_store; + info->close_backing_store = close_ems_store; + TRACEMS1(methods, 1, "Obtained EMS handle %u", ctx.dx); + return TRUE; /* succeeded */ +} + +#endif /* EMS_SUPPORTED */ + + +/* + * Initial opening of a backing-store object. + */ + +GLOBAL void +jopen_backing_store (backing_store_ptr info, long total_bytes_needed) +{ + /* Try extended memory, then expanded memory, then regular file. */ +#if XMS_SUPPORTED + if (open_xms_store(info, total_bytes_needed)) + return; +#endif +#if EMS_SUPPORTED + if (open_ems_store(info, total_bytes_needed)) + return; +#endif + if (open_file_store(info, total_bytes_needed)) + return; + ERREXIT(methods, "Failed to create temporary file"); +} + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. Keep in mind that jmem_term may be called more than + * once. + */ + +GLOBAL void +jmem_init (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + emethods->max_memory_to_use = DEFAULT_MAX_MEM; + total_used = 0; + next_file_num = 0; +} + +GLOBAL void +jmem_term (void) +{ + /* no work */ +} diff --git a/jmemdos.h b/jmemdos.h new file mode 100644 index 00000000..f1249280 --- /dev/null +++ b/jmemdos.h @@ -0,0 +1,135 @@ +/* + * jmemdos.h (jmemsys.h) + * + * Copyright (C) 1992, 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. + * + * This include file defines the interface between the system-independent + * and system-dependent portions of the JPEG memory manager. (The system- + * independent portion is jmemmgr.c; there are several different versions + * of the system-dependent portion, and of this file for that matter.) + * + * This version is suitable for MS-DOS (80x86) implementations. + */ + + +/* + * These two functions are used to allocate and release small chunks of + * memory (typically the total amount requested through jget_small is + * no more than 20Kb or so). Behavior should be the same as for the + * standard library functions malloc and free; in particular, jget_small + * returns NULL on failure. On most systems, these ARE malloc and free. + * On an 80x86 machine using small-data memory model, these manage near heap. + */ + +EXTERN void * jget_small PP((size_t sizeofobject)); +EXTERN void jfree_small PP((void * object)); + +/* + * These two functions are used to allocate and release large chunks of + * memory (up to the total free space designated by jmem_available). + * The interface is the same as above, except that on an 80x86 machine, + * far pointers are used. On other systems these ARE the same as above. + */ + +#ifdef NEED_FAR_POINTERS /* typically not needed except on 80x86 */ +EXTERN void FAR * jget_large PP((size_t sizeofobject)); +EXTERN void jfree_large PP((void FAR * object)); +#else +#define jget_large(sizeofobject) jget_small(sizeofobject) +#define jfree_large(object) jfree_small(object) +#endif + +/* + * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may + * be requested in a single call on jget_large (and jget_small for that + * matter, but that case should never come into play). This macro is needed + * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. + * On machines with flat address spaces, any large constant may be used here. + */ + +#define MAX_ALLOC_CHUNK 65400L + +/* + * This routine computes the total space available for allocation by + * jget_large. If more space than this is needed, backing store will be used. + * NOTE: any memory already allocated must not be counted. + * + * There is a minimum space requirement, corresponding to the minimum + * feasible buffer sizes; jmemmgr.c will request that much space even if + * jmem_available returns zero. The maximum space needed, enough to hold + * all working storage in memory, is also passed in case it is useful. + * + * It is OK for jmem_available to underestimate the space available (that'll + * just lead to more backing-store access than is really necessary). + * However, an overestimate will lead to failure. Hence it's wise to subtract + * a slop factor from the true available space, especially if jget_small space + * comes from the same pool. 5% should be enough. + * + * On machines with lots of virtual memory, any large constant may be returned. + * Conversely, zero may be returned to always use the minimum amount of memory. + */ + +EXTERN long jmem_available PP((long min_bytes_needed, long max_bytes_needed)); + + +/* + * This structure holds whatever state is needed to access a single + * backing-store object. The read/write/close method pointers are called + * by jmemmgr.c to manipulate the backing-store object; all other fields + * are private to the system-dependent backing store routines. + */ + +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ + +typedef unsigned short XMSH; /* type of extended-memory handles */ +typedef unsigned short EMSH; /* type of expanded-memory handles */ + +typedef union { + short file_handle; /* DOS file handle if it's a temp file */ + XMSH xms_handle; /* handle if it's a chunk of XMS */ + EMSH ems_handle; /* handle if it's a chunk of EMS */ + } handle_union; + +typedef struct backing_store_struct * backing_store_ptr; + +typedef struct backing_store_struct { + /* Methods for reading/writing/closing this backing-store object */ + METHOD(void, read_backing_store, (backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + METHOD(void, write_backing_store, (backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + METHOD(void, close_backing_store, (backing_store_ptr info)); + /* Private fields for system-dependent backing-store management */ + /* For the MS-DOS environment, we need: */ + handle_union handle; /* reference to backing-store storage object */ + char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ + } backing_store_info; + +/* + * Initial opening of a backing-store object. This must fill in the + * read/write/close pointers in the object. The read/write routines + * may take an error exit if the specified maximum file size is exceeded. + * (If jmem_available always returns a large value, this routine can just + * take an error exit.) + */ + +EXTERN void jopen_backing_store PP((backing_store_ptr info, + long total_bytes_needed)); + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. The system methods struct address should be saved + * by jmem_init in case an error exit must be taken. jmem_term may assume + * that all requested memory has been freed and that all opened backing- + * store objects have been closed. + * NB: jmem_term may be called more than once, and must behave reasonably + * if that happens. + */ + +EXTERN void jmem_init PP((external_methods_ptr emethods)); +EXTERN void jmem_term PP((void)); diff --git a/jmemdosa.asm b/jmemdosa.asm new file mode 100644 index 00000000..ecd43729 --- /dev/null +++ b/jmemdosa.asm @@ -0,0 +1,379 @@ +; +; jmemdosa.asm +; +; Copyright (C) 1992, 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. +; +; This file contains low-level interface routines to support the MS-DOS +; backing store manager (jmemdos.c). Routines are provided to access disk +; files through direct DOS calls, and to access XMS and EMS drivers. +; +; This file should assemble with Microsoft's MASM or any compatible +; assembler (including Borland's Turbo Assembler). If you haven't got +; a compatible assembler, better fall back to jmemansi.c or jmemname.c. +; +; To minimize dependence on the C compiler's register usage conventions, +; we save and restore all 8086 registers, even though most compilers only +; require SI,DI,DS to be preserved. Also, we use only 16-bit-wide return +; values, which everybody returns in AX. +; +; Based on code contributed by Ge' Weijers. +; + +JMEMDOSA_TXT segment byte public 'CODE' + + assume cs:JMEMDOSA_TXT + + public _jdos_open + public _jdos_close + public _jdos_seek + public _jdos_read + public _jdos_write + public _jxms_getdriver + public _jxms_calldriver + public _jems_available + public _jems_calldriver + +; +; short far jdos_open (short far * handle, char far * filename) +; +; Create and open a temporary file +; +_jdos_open proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov cx,0 ; normal file attributes + lds dx,dword ptr [bp+10] ; get filename pointer + mov ah,3ch ; create file + int 21h + jc open_err ; if failed, return error code + lds bx,dword ptr [bp+6] ; get handle pointer + mov word ptr [bx],ax ; save the handle + xor ax,ax ; return zero for OK +open_err: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jdos_open endp + + +; +; short far jdos_close (short handle) +; +; Close the file handle +; +_jdos_close proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov bx,word ptr [bp+6] ; file handle + mov ah,3eh ; close file + int 21h + jc close_err ; if failed, return error code + xor ax,ax ; return zero for OK +close_err: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jdos_close endp + + +; +; short far jdos_seek (short handle, long offset) +; +; Set file position +; +_jdos_seek proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov bx,word ptr [bp+6] ; file handle + mov dx,word ptr [bp+8] ; LS offset + mov cx,word ptr [bp+10] ; MS offset + mov ax,4200h ; absolute seek + int 21h + jc seek_err ; if failed, return error code + xor ax,ax ; return zero for OK +seek_err: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jdos_seek endp + + +; +; short far jdos_read (short handle, void far * buffer, unsigned short count) +; +; Read from file +; +_jdos_read proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov bx,word ptr [bp+6] ; file handle + lds dx,dword ptr [bp+8] ; buffer address + mov cx,word ptr [bp+12] ; number of bytes + mov ah,3fh ; read file + int 21h + jc read_err ; if failed, return error code + cmp ax,word ptr [bp+12] ; make sure all bytes were read + je read_ok + mov ax,1 ; else return 1 for not OK + jmp short read_err +read_ok: xor ax,ax ; return zero for OK +read_err: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jdos_read endp + + +; +; short far jdos_write (short handle, void far * buffer, unsigned short count) +; +; Write to file +; +_jdos_write proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov bx,word ptr [bp+6] ; file handle + lds dx,dword ptr [bp+8] ; buffer address + mov cx,word ptr [bp+12] ; number of bytes + mov ah,40h ; write file + int 21h + jc write_err ; if failed, return error code + cmp ax,word ptr [bp+12] ; make sure all bytes written + je write_ok + mov ax,1 ; else return 1 for not OK + jmp short write_err +write_ok: xor ax,ax ; return zero for OK +write_err: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jdos_write endp + + +; +; void far jxms_getdriver (XMSDRIVER far *) +; +; Get the address of the XMS driver, or NULL if not available +; +_jxms_getdriver proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov ax,4300h ; call multiplex interrupt with + int 2fh ; a magic cookie, hex 4300 + cmp al,80h ; AL should contain hex 80 + je xmsavail + xor dx,dx ; no XMS driver available + xor ax,ax ; return a nil pointer + jmp short xmsavail_done +xmsavail: mov ax,4310h ; fetch driver address with + int 2fh ; another magic cookie + mov dx,es ; copy address to dx:ax + mov ax,bx +xmsavail_done: les bx,dword ptr [bp+6] ; get pointer to return value + mov word ptr es:[bx],ax + mov word ptr es:[bx+2],dx + pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jxms_getdriver endp + + +; +; void far jxms_calldriver (XMSDRIVER, XMScontext far *) +; +; The XMScontext structure contains values for the AX,DX,BX,SI,DS registers. +; These are loaded, the XMS call is performed, and the new values of the +; AX,DX,BX registers are written back to the context structure. +; +_jxms_calldriver proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + les bx,dword ptr [bp+10] ; get XMScontext pointer + mov ax,word ptr es:[bx] ; load registers + mov dx,word ptr es:[bx+2] + mov si,word ptr es:[bx+6] + mov ds,word ptr es:[bx+8] + mov bx,word ptr es:[bx+4] + call dword ptr [bp+6] ; call the driver + mov cx,bx ; save returned BX for a sec + les bx,dword ptr [bp+10] ; get XMScontext pointer + mov word ptr es:[bx],ax ; put back ax,dx,bx + mov word ptr es:[bx+2],dx + mov word ptr es:[bx+4],cx + pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jxms_calldriver endp + + +; +; short far jems_available (void) +; +; Have we got an EMS driver? (this comes straight from the EMS 4.0 specs) +; +_jems_available proc far + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + mov ax,3567h ; get interrupt vector 67h + int 21h + push cs + pop ds + mov di,000ah ; check offs 10 in returned seg + lea si,ASCII_device_name ; against literal string + mov cx,8 + cld + repe cmpsb + jne no_ems + mov ax,1 ; match, it's there + jmp short avail_done +no_ems: xor ax,ax ; it's not there +avail_done: pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + ret + +ASCII_device_name db "EMMXXXX0" + +_jems_available endp + + +; +; void far jems_calldriver (EMScontext far *) +; +; The EMScontext structure contains values for the AX,DX,BX,SI,DS registers. +; These are loaded, the EMS trap is performed, and the new values of the +; AX,DX,BX registers are written back to the context structure. +; +_jems_calldriver proc far + push bp ; linkage + mov bp,sp + push si ; save all registers for safety + push di + push bx + push cx + push dx + push es + push ds + les bx,dword ptr [bp+6] ; get EMScontext pointer + mov ax,word ptr es:[bx] ; load registers + mov dx,word ptr es:[bx+2] + mov si,word ptr es:[bx+6] + mov ds,word ptr es:[bx+8] + mov bx,word ptr es:[bx+4] + int 67h ; call the EMS driver + mov cx,bx ; save returned BX for a sec + les bx,dword ptr [bp+6] ; get EMScontext pointer + mov word ptr es:[bx],ax ; put back ax,dx,bx + mov word ptr es:[bx+2],dx + mov word ptr es:[bx+4],cx + pop ds ; restore registers and exit + pop es + pop dx + pop cx + pop bx + pop di + pop si + pop bp + ret +_jems_calldriver endp + +JMEMDOSA_TXT ends + + end diff --git a/jmemmgr.c b/jmemmgr.c new file mode 100644 index 00000000..614755f0 --- /dev/null +++ b/jmemmgr.c @@ -0,0 +1,1049 @@ +/* + * jmemmgr.c + * + * Copyright (C) 1991, 1992, 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. + * + * This file provides the standard system-independent memory management + * routines. This code is usable across a wide variety of machines; most + * of the system dependencies have been isolated in a separate file. + * The major functions provided here are: + * * bookkeeping to allow all allocated memory to be freed upon exit; + * * policy decisions about how to divide available memory among the + * various large arrays; + * * control logic for swapping virtual arrays between main memory and + * backing storage. + * The separate system-dependent file provides the actual backing-storage + * access code, and it contains the policy decision about how much total + * main memory to use. + * This file is system-dependent in the sense that some of its functions + * are unnecessary in some systems. For example, if there is enough virtual + * memory so that backing storage will never be used, much of the big-array + * control logic could be removed. (Of course, if you have that much memory + * then you shouldn't care about a little bit of unused code...) + * + * These routines are invoked via the methods alloc_small, free_small, + * alloc_medium, free_medium, alloc_small_sarray, free_small_sarray, + * alloc_small_barray, free_small_barray, request_big_sarray, + * request_big_barray, alloc_big_arrays, access_big_sarray, access_big_barray, + * free_big_sarray, free_big_barray, and free_all. + */ + +#define AM_MEMORY_MANAGER /* we define big_Xarray_control structs */ + +#include "jinclude.h" +#include "jmemsys.h" /* import the system-dependent declarations */ + + +/* + * On many systems it is not necessary to distinguish alloc_small from + * alloc_medium; the main case where they must be distinguished is when + * FAR pointers are distinct from regular pointers. However, you might + * want to keep them separate if you have different system-dependent logic + * for small and large memory requests (i.e., jget_small and jget_large + * do different things). + */ + +#ifdef NEED_FAR_POINTERS +#define NEED_ALLOC_MEDIUM /* flags alloc_medium really exists */ +#endif + + +/* + * Some important notes: + * The allocation routines provided here must never return NULL. + * They should exit to error_exit if unsuccessful. + * + * It's not a good idea to try to merge the sarray and barray routines, + * even though they are textually almost the same, because samples are + * usually stored as bytes while coefficients are shorts. Thus, in machines + * where byte pointers have a different representation from word pointers, + * the resulting machine code could not be the same. + */ + + +static external_methods_ptr methods; /* saved for access to error_exit */ + + +#ifdef MEM_STATS /* optional extra stuff for statistics */ + +/* These macros are the assumed overhead per block for malloc(). + * They don't have to be accurate, but the printed statistics will be + * off a little bit if they are not. + */ +#define MALLOC_OVERHEAD (SIZEOF(void *)) /* overhead for jget_small() */ +#define MALLOC_FAR_OVERHEAD (SIZEOF(void FAR *)) /* for jget_large() */ + +static long total_num_small = 0; /* total # of small objects alloced */ +static long total_bytes_small = 0; /* total bytes requested */ +static long cur_num_small = 0; /* # currently alloced */ +static long max_num_small = 0; /* max simultaneously alloced */ + +#ifdef NEED_ALLOC_MEDIUM +static long total_num_medium = 0; /* total # of medium objects alloced */ +static long total_bytes_medium = 0; /* total bytes requested */ +static long cur_num_medium = 0; /* # currently alloced */ +static long max_num_medium = 0; /* max simultaneously alloced */ +#endif + +static long total_num_sarray = 0; /* total # of sarray objects alloced */ +static long total_bytes_sarray = 0; /* total bytes requested */ +static long cur_num_sarray = 0; /* # currently alloced */ +static long max_num_sarray = 0; /* max simultaneously alloced */ + +static long total_num_barray = 0; /* total # of barray objects alloced */ +static long total_bytes_barray = 0; /* total bytes requested */ +static long cur_num_barray = 0; /* # currently alloced */ +static long max_num_barray = 0; /* max simultaneously alloced */ + + +LOCAL void +print_mem_stats (void) +{ + /* since this is only a debugging stub, we can cheat a little on the + * trace message mechanism... helpful 'cuz trace_message can't handle longs. + */ + fprintf(stderr, "total_num_small = %ld\n", total_num_small); + fprintf(stderr, "total_bytes_small = %ld\n", total_bytes_small); + if (cur_num_small) + fprintf(stderr, "cur_num_small = %ld\n", cur_num_small); + fprintf(stderr, "max_num_small = %ld\n", max_num_small); + +#ifdef NEED_ALLOC_MEDIUM + fprintf(stderr, "total_num_medium = %ld\n", total_num_medium); + fprintf(stderr, "total_bytes_medium = %ld\n", total_bytes_medium); + if (cur_num_medium) + fprintf(stderr, "cur_num_medium = %ld\n", cur_num_medium); + fprintf(stderr, "max_num_medium = %ld\n", max_num_medium); +#endif + + fprintf(stderr, "total_num_sarray = %ld\n", total_num_sarray); + fprintf(stderr, "total_bytes_sarray = %ld\n", total_bytes_sarray); + if (cur_num_sarray) + fprintf(stderr, "cur_num_sarray = %ld\n", cur_num_sarray); + fprintf(stderr, "max_num_sarray = %ld\n", max_num_sarray); + + fprintf(stderr, "total_num_barray = %ld\n", total_num_barray); + fprintf(stderr, "total_bytes_barray = %ld\n", total_bytes_barray); + if (cur_num_barray) + fprintf(stderr, "cur_num_barray = %ld\n", cur_num_barray); + fprintf(stderr, "max_num_barray = %ld\n", max_num_barray); +} + +#endif /* MEM_STATS */ + + +LOCAL void +out_of_memory (int which) +/* Report an out-of-memory error and stop execution */ +/* If we compiled MEM_STATS support, report alloc requests before dying */ +{ +#ifdef MEM_STATS + if (methods->trace_level <= 0) /* don't do it if free_all() will */ + print_mem_stats(); /* print optional memory usage statistics */ +#endif + ERREXIT1(methods, "Insufficient memory (case %d)", which); +} + + +/* + * Management of "small" objects. + * These are all-in-memory, and are in near-heap space on an 80x86. + */ + +typedef struct small_struct * small_ptr; + +typedef struct small_struct { + small_ptr next; /* next in list of allocated objects */ + } small_hdr; + +static small_ptr small_list; /* head of list */ + + +METHODDEF void * +alloc_small (size_t sizeofobject) +/* Allocate a "small" object */ +{ + small_ptr result; + + sizeofobject += SIZEOF(small_hdr); /* add space for header */ + +#ifdef MEM_STATS + total_num_small++; + total_bytes_small += sizeofobject + MALLOC_OVERHEAD; + cur_num_small++; + if (cur_num_small > max_num_small) max_num_small = cur_num_small; +#endif + + result = (small_ptr) jget_small(sizeofobject); + if (result == NULL) + out_of_memory(1); + + result->next = small_list; + small_list = result; + result++; /* advance past header */ + + return (void *) result; +} + + +METHODDEF void +free_small (void *ptr) +/* Free a "small" object */ +{ + small_ptr hdr; + small_ptr * llink; + + hdr = (small_ptr) ptr; + hdr--; /* point back to header */ + + /* Remove item from list -- linear search is fast enough */ + llink = &small_list; + while (*llink != hdr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_small request"); + llink = &( (*llink)->next ); + } + *llink = hdr->next; + + jfree_small((void *) hdr); + +#ifdef MEM_STATS + cur_num_small--; +#endif +} + + +/* + * Management of "medium-size" objects. + * These are just like small objects except they are in the FAR heap. + */ + +#ifdef NEED_ALLOC_MEDIUM + +typedef struct medium_struct FAR * medium_ptr; + +typedef struct medium_struct { + medium_ptr next; /* next in list of allocated objects */ + } medium_hdr; + +static medium_ptr medium_list; /* head of list */ + + +METHODDEF void FAR * +alloc_medium (size_t sizeofobject) +/* Allocate a "medium-size" object */ +{ + medium_ptr result; + + sizeofobject += SIZEOF(medium_hdr); /* add space for header */ + +#ifdef MEM_STATS + total_num_medium++; + total_bytes_medium += sizeofobject + MALLOC_FAR_OVERHEAD; + cur_num_medium++; + if (cur_num_medium > max_num_medium) max_num_medium = cur_num_medium; +#endif + + result = (medium_ptr) jget_large(sizeofobject); + if (result == NULL) + out_of_memory(2); + + result->next = medium_list; + medium_list = result; + result++; /* advance past header */ + + return (void FAR *) result; +} + + +METHODDEF void +free_medium (void FAR *ptr) +/* Free a "medium-size" object */ +{ + medium_ptr hdr; + medium_ptr FAR * llink; + + hdr = (medium_ptr) ptr; + hdr--; /* point back to header */ + + /* Remove item from list -- linear search is fast enough */ + llink = &medium_list; + while (*llink != hdr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_medium request"); + llink = &( (*llink)->next ); + } + *llink = hdr->next; + + jfree_large((void FAR *) hdr); + +#ifdef MEM_STATS + cur_num_medium--; +#endif +} + +#endif /* NEED_ALLOC_MEDIUM */ + + +/* + * Management of "small" (all-in-memory) 2-D sample arrays. + * The pointers are in near heap, the samples themselves in FAR heap. + * The header structure is adjacent to the row pointers. + * To minimize allocation overhead and to allow I/O of large contiguous + * blocks, we allocate the sample rows in groups of as many rows as possible + * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request. + * Note that the big-array control routines, later in this file, know about + * this chunking of rows ... and also how to get the rowsperchunk value! + */ + +typedef struct small_sarray_struct * small_sarray_ptr; + +typedef struct small_sarray_struct { + small_sarray_ptr next; /* next in list of allocated sarrays */ + long numrows; /* # of rows in this array */ + long rowsperchunk; /* max # of rows per allocation chunk */ + } small_sarray_hdr; + +static small_sarray_ptr small_sarray_list; /* head of list */ + + +METHODDEF JSAMPARRAY +alloc_small_sarray (long samplesperrow, long numrows) +/* Allocate a "small" (all-in-memory) 2-D sample array */ +{ + small_sarray_ptr hdr; + JSAMPARRAY result; + JSAMPROW workspace; + long rowsperchunk, currow, i; + +#ifdef MEM_STATS + total_num_sarray++; + cur_num_sarray++; + if (cur_num_sarray > max_num_sarray) max_num_sarray = cur_num_sarray; +#endif + + /* Calculate max # of rows allowed in one allocation chunk */ + rowsperchunk = MAX_ALLOC_CHUNK / (samplesperrow * SIZEOF(JSAMPLE)); + if (rowsperchunk <= 0) + ERREXIT(methods, "Image too wide for this implementation"); + + /* Get space for header and row pointers; this is always "near" on 80x86 */ + hdr = (small_sarray_ptr) alloc_small((size_t) (numrows * SIZEOF(JSAMPROW) + + SIZEOF(small_sarray_hdr))); + + result = (JSAMPARRAY) (hdr+1); /* advance past header */ + + /* Insert into list now so free_all does right thing if I fail */ + /* after allocating only some of the rows... */ + hdr->next = small_sarray_list; + hdr->numrows = 0; + hdr->rowsperchunk = rowsperchunk; + small_sarray_list = hdr; + + /* Get the rows themselves; on 80x86 these are "far" */ + currow = 0; + while (currow < numrows) { + rowsperchunk = MIN(rowsperchunk, numrows - currow); +#ifdef MEM_STATS + total_bytes_sarray += rowsperchunk * samplesperrow * SIZEOF(JSAMPLE) + + MALLOC_FAR_OVERHEAD; +#endif + workspace = (JSAMPROW) jget_large((size_t) (rowsperchunk * samplesperrow + * SIZEOF(JSAMPLE))); + if (workspace == NULL) + out_of_memory(3); + for (i = rowsperchunk; i > 0; i--) { + result[currow++] = workspace; + workspace += samplesperrow; + } + hdr->numrows = currow; + } + + return result; +} + + +METHODDEF void +free_small_sarray (JSAMPARRAY ptr) +/* Free a "small" (all-in-memory) 2-D sample array */ +{ + small_sarray_ptr hdr; + small_sarray_ptr * llink; + long i; + + hdr = (small_sarray_ptr) ptr; + hdr--; /* point back to header */ + + /* Remove item from list -- linear search is fast enough */ + llink = &small_sarray_list; + while (*llink != hdr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_small_sarray request"); + llink = &( (*llink)->next ); + } + *llink = hdr->next; + + /* Free the rows themselves; on 80x86 these are "far" */ + /* Note we only free the row-group headers! */ + for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) { + jfree_large((void FAR *) ptr[i]); + } + + /* Free header and row pointers */ + free_small((void *) hdr); + +#ifdef MEM_STATS + cur_num_sarray--; +#endif +} + + +/* + * Management of "small" (all-in-memory) 2-D coefficient-block arrays. + * This is essentially the same as the code for sample arrays, above. + */ + +typedef struct small_barray_struct * small_barray_ptr; + +typedef struct small_barray_struct { + small_barray_ptr next; /* next in list of allocated barrays */ + long numrows; /* # of rows in this array */ + long rowsperchunk; /* max # of rows per allocation chunk */ + } small_barray_hdr; + +static small_barray_ptr small_barray_list; /* head of list */ + + +METHODDEF JBLOCKARRAY +alloc_small_barray (long blocksperrow, long numrows) +/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */ +{ + small_barray_ptr hdr; + JBLOCKARRAY result; + JBLOCKROW workspace; + long rowsperchunk, currow, i; + +#ifdef MEM_STATS + total_num_barray++; + cur_num_barray++; + if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray; +#endif + + /* Calculate max # of rows allowed in one allocation chunk */ + rowsperchunk = MAX_ALLOC_CHUNK / (blocksperrow * SIZEOF(JBLOCK)); + if (rowsperchunk <= 0) + ERREXIT(methods, "Image too wide for this implementation"); + + /* Get space for header and row pointers; this is always "near" on 80x86 */ + hdr = (small_barray_ptr) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW) + + SIZEOF(small_barray_hdr))); + + result = (JBLOCKARRAY) (hdr+1); /* advance past header */ + + /* Insert into list now so free_all does right thing if I fail */ + /* after allocating only some of the rows... */ + hdr->next = small_barray_list; + hdr->numrows = 0; + hdr->rowsperchunk = rowsperchunk; + small_barray_list = hdr; + + /* Get the rows themselves; on 80x86 these are "far" */ + currow = 0; + while (currow < numrows) { + rowsperchunk = MIN(rowsperchunk, numrows - currow); +#ifdef MEM_STATS + total_bytes_barray += rowsperchunk * blocksperrow * SIZEOF(JBLOCK) + + MALLOC_FAR_OVERHEAD; +#endif + workspace = (JBLOCKROW) jget_large((size_t) (rowsperchunk * blocksperrow + * SIZEOF(JBLOCK))); + if (workspace == NULL) + out_of_memory(4); + for (i = rowsperchunk; i > 0; i--) { + result[currow++] = workspace; + workspace += blocksperrow; + } + hdr->numrows = currow; + } + + return result; +} + + +METHODDEF void +free_small_barray (JBLOCKARRAY ptr) +/* Free a "small" (all-in-memory) 2-D coefficient-block array */ +{ + small_barray_ptr hdr; + small_barray_ptr * llink; + long i; + + hdr = (small_barray_ptr) ptr; + hdr--; /* point back to header */ + + /* Remove item from list -- linear search is fast enough */ + llink = &small_barray_list; + while (*llink != hdr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_small_barray request"); + llink = &( (*llink)->next ); + } + *llink = hdr->next; + + /* Free the rows themselves; on 80x86 these are "far" */ + /* Note we only free the row-group headers! */ + for (i = 0; i < hdr->numrows; i += hdr->rowsperchunk) { + jfree_large((void FAR *) ptr[i]); + } + + /* Free header and row pointers */ + free_small((void *) hdr); + +#ifdef MEM_STATS + cur_num_barray--; +#endif +} + + + +/* + * About "big" array management: + * + * To allow machines with limited memory to handle large images, + * all processing in the JPEG system is done a few pixel or block rows + * at a time. The above "small" array routines are only used to allocate + * strip buffers (as wide as the image, but just a few rows high). + * In some cases multiple passes must be made over the data. In these + * cases the "big" array routines are used. The array is still accessed + * a strip at a time, but the memory manager must save the whole array + * for repeated accesses. The intended implementation is that there is + * a strip buffer in memory (as high as is possible given the desired memory + * limit), plus a backing file that holds the rest of the array. + * + * The request_big_array routines are told the total size of the image (in case + * it is useful to know the total file size that will be needed). They are + * also given the unit height, which is the number of rows that will be + * accessed at once; the in-memory buffer should be made a multiple of + * this height for best efficiency. + * + * The request routines create control blocks (and may open backing files), + * but they don't create the in-memory buffers. This is postponed until + * alloc_big_arrays is called. At that time the total amount of space needed + * is known (approximately, anyway), so free memory can be divided up fairly. + * + * The access_big_array routines are responsible for making a specific strip + * area accessible (after reading or writing the backing file, if necessary). + * Note that the access routines are told whether the caller intends to modify + * the accessed strip; during a read-only pass this saves having to rewrite + * data to disk. + * + * The typical access pattern is one top-to-bottom pass to write the data, + * followed by one or more read-only top-to-bottom passes. However, other + * access patterns may occur while reading. For example, translation of image + * formats that use bottom-to-top scan order will require bottom-to-top read + * passes. The memory manager need not support multiple write passes nor + * funny write orders (meaning that rearranging rows must be handled while + * reading data out of the big array, not while putting it in). + * + * In current usage, the access requests are always for nonoverlapping strips; + * that is, successive access start_row numbers always differ by exactly the + * unitheight. This allows fairly simple buffer dump/reload logic if the + * in-memory buffer is made a multiple of the unitheight. It would be + * possible to keep subsampled rather than fullsize data in the "big" arrays, + * thus reducing temp file size, if we supported overlapping strip access + * (access requests differing by less than the unitheight). At the moment + * I don't believe this is worth the extra complexity. + */ + + + +/* The control blocks for virtual arrays. + * System-dependent info for the associated backing store is hidden inside + * the backing_store_info struct. + */ + +struct big_sarray_control { + long rows_in_array; /* total virtual array height */ + long samplesperrow; /* width of array (and of memory buffer) */ + long unitheight; /* # of rows accessed by access_big_sarray() */ + JSAMPARRAY mem_buffer; /* the in-memory buffer */ + long rows_in_mem; /* height of memory buffer */ + long rowsperchunk; /* allocation chunk size in mem_buffer */ + long cur_start_row; /* first logical row # in the buffer */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + big_sarray_ptr next; /* link to next big sarray control block */ + backing_store_info b_s_info; /* System-dependent control info */ +}; + +static big_sarray_ptr big_sarray_list; /* head of list */ + +struct big_barray_control { + long rows_in_array; /* total virtual array height */ + long blocksperrow; /* width of array (and of memory buffer) */ + long unitheight; /* # of rows accessed by access_big_barray() */ + JBLOCKARRAY mem_buffer; /* the in-memory buffer */ + long rows_in_mem; /* height of memory buffer */ + long rowsperchunk; /* allocation chunk size in mem_buffer */ + long cur_start_row; /* first logical row # in the buffer */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + big_barray_ptr next; /* link to next big barray control block */ + backing_store_info b_s_info; /* System-dependent control info */ +}; + +static big_barray_ptr big_barray_list; /* head of list */ + + +METHODDEF big_sarray_ptr +request_big_sarray (long samplesperrow, long numrows, long unitheight) +/* Request a "big" (virtual-memory) 2-D sample array */ +{ + big_sarray_ptr result; + + /* get control block */ + result = (big_sarray_ptr) alloc_small(SIZEOF(struct big_sarray_control)); + + result->rows_in_array = numrows; + result->samplesperrow = samplesperrow; + result->unitheight = unitheight; + result->mem_buffer = NULL; /* marks array not yet realized */ + result->b_s_open = FALSE; /* no associated backing-store object */ + result->next = big_sarray_list; /* add to list of big arrays */ + big_sarray_list = result; + + return result; +} + + +METHODDEF big_barray_ptr +request_big_barray (long blocksperrow, long numrows, long unitheight) +/* Request a "big" (virtual-memory) 2-D coefficient-block array */ +{ + big_barray_ptr result; + + /* get control block */ + result = (big_barray_ptr) alloc_small(SIZEOF(struct big_barray_control)); + + result->rows_in_array = numrows; + result->blocksperrow = blocksperrow; + result->unitheight = unitheight; + result->mem_buffer = NULL; /* marks array not yet realized */ + result->b_s_open = FALSE; /* no associated backing-store object */ + result->next = big_barray_list; /* add to list of big arrays */ + big_barray_list = result; + + return result; +} + + +METHODDEF void +alloc_big_arrays (long extra_small_samples, long extra_small_blocks, + long extra_medium_space) +/* Allocate the in-memory buffers for any unrealized "big" arrays */ +/* 'extra' values are upper bounds for total future small-array requests */ +/* and far-heap requests */ +{ + long total_extra_space = extra_small_samples * SIZEOF(JSAMPLE) + + extra_small_blocks * SIZEOF(JBLOCK) + + extra_medium_space; + long space_per_unitheight, maximum_space, avail_mem; + long unitheights, max_unitheights; + big_sarray_ptr sptr; + big_barray_ptr bptr; + + /* Compute the minimum space needed (unitheight rows in each buffer) + * and the maximum space needed (full image height in each buffer). + * These may be of use to the system-dependent jmem_available routine. + */ + space_per_unitheight = 0; + maximum_space = total_extra_space; + for (sptr = big_sarray_list; sptr != NULL; sptr = sptr->next) { + if (sptr->mem_buffer == NULL) { /* if not realized yet */ + space_per_unitheight += sptr->unitheight * + sptr->samplesperrow * SIZEOF(JSAMPLE); + maximum_space += sptr->rows_in_array * + sptr->samplesperrow * SIZEOF(JSAMPLE); + } + } + for (bptr = big_barray_list; bptr != NULL; bptr = bptr->next) { + if (bptr->mem_buffer == NULL) { /* if not realized yet */ + space_per_unitheight += bptr->unitheight * + bptr->blocksperrow * SIZEOF(JBLOCK); + maximum_space += bptr->rows_in_array * + bptr->blocksperrow * SIZEOF(JBLOCK); + } + } + + if (space_per_unitheight <= 0) + return; /* no unrealized arrays, no work */ + + /* Determine amount of memory to actually use; this is system-dependent. */ + avail_mem = jmem_available(space_per_unitheight + total_extra_space, + maximum_space); + + /* If the maximum space needed is available, make all the buffers full + * height; otherwise parcel it out with the same number of unitheights + * in each buffer. + */ + if (avail_mem >= maximum_space) + max_unitheights = 1000000000L; + else { + max_unitheights = (avail_mem - total_extra_space) / space_per_unitheight; + /* If there doesn't seem to be enough space, try to get the minimum + * anyway. This allows a "stub" implementation of jmem_available(). + */ + if (max_unitheights <= 0) + max_unitheights = 1; + } + + /* Allocate the in-memory buffers and initialize backing store as needed. */ + + for (sptr = big_sarray_list; sptr != NULL; sptr = sptr->next) { + if (sptr->mem_buffer == NULL) { /* if not realized yet */ + unitheights = (sptr->rows_in_array + sptr->unitheight - 1L) + / sptr->unitheight; + if (unitheights <= max_unitheights) { + /* This buffer fits in memory */ + sptr->rows_in_mem = sptr->rows_in_array; + } else { + /* It doesn't fit in memory, create backing store. */ + sptr->rows_in_mem = max_unitheights * sptr->unitheight; + jopen_backing_store(& sptr->b_s_info, + sptr->rows_in_array + * sptr->samplesperrow * SIZEOF(JSAMPLE)); + sptr->b_s_open = TRUE; + } + sptr->mem_buffer = alloc_small_sarray(sptr->samplesperrow, + sptr->rows_in_mem); + /* Reach into the small_sarray header and get the rowsperchunk field. + * Yes, I know, this is horrible coding practice. + */ + sptr->rowsperchunk = + ((small_sarray_ptr) sptr->mem_buffer)[-1].rowsperchunk; + sptr->cur_start_row = 0; + sptr->dirty = FALSE; + } + } + + for (bptr = big_barray_list; bptr != NULL; bptr = bptr->next) { + if (bptr->mem_buffer == NULL) { /* if not realized yet */ + unitheights = (bptr->rows_in_array + bptr->unitheight - 1L) + / bptr->unitheight; + if (unitheights <= max_unitheights) { + /* This buffer fits in memory */ + bptr->rows_in_mem = bptr->rows_in_array; + } else { + /* It doesn't fit in memory, create backing store. */ + bptr->rows_in_mem = max_unitheights * bptr->unitheight; + jopen_backing_store(& bptr->b_s_info, + bptr->rows_in_array + * bptr->blocksperrow * SIZEOF(JBLOCK)); + bptr->b_s_open = TRUE; + } + bptr->mem_buffer = alloc_small_barray(bptr->blocksperrow, + bptr->rows_in_mem); + /* Reach into the small_barray header and get the rowsperchunk field. */ + bptr->rowsperchunk = + ((small_barray_ptr) bptr->mem_buffer)[-1].rowsperchunk; + bptr->cur_start_row = 0; + bptr->dirty = FALSE; + } + } +} + + +LOCAL void +do_sarray_io (big_sarray_ptr ptr, boolean writing) +/* Do backing store read or write of a "big" sample array */ +{ + long bytesperrow, file_offset, byte_count, rows, i; + + bytesperrow = ptr->samplesperrow * SIZEOF(JSAMPLE); + file_offset = ptr->cur_start_row * bytesperrow; + /* Loop to read or write each allocation chunk in mem_buffer */ + for (i = 0; i < ptr->rows_in_mem; i += ptr->rowsperchunk) { + /* One chunk, but check for short chunk at end of buffer */ + rows = MIN(ptr->rowsperchunk, ptr->rows_in_mem - i); + /* Transfer no more than fits in file */ + rows = MIN(rows, ptr->rows_in_array - (ptr->cur_start_row + i)); + if (rows <= 0) /* this chunk might be past end of file! */ + break; + byte_count = rows * bytesperrow; + if (writing) + (*ptr->b_s_info.write_backing_store) (& ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + else + (*ptr->b_s_info.read_backing_store) (& ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + file_offset += byte_count; + } +} + + +LOCAL void +do_barray_io (big_barray_ptr ptr, boolean writing) +/* Do backing store read or write of a "big" coefficient-block array */ +{ + long bytesperrow, file_offset, byte_count, rows, i; + + bytesperrow = ptr->blocksperrow * SIZEOF(JBLOCK); + file_offset = ptr->cur_start_row * bytesperrow; + /* Loop to read or write each allocation chunk in mem_buffer */ + for (i = 0; i < ptr->rows_in_mem; i += ptr->rowsperchunk) { + /* One chunk, but check for short chunk at end of buffer */ + rows = MIN(ptr->rowsperchunk, ptr->rows_in_mem - i); + /* Transfer no more than fits in file */ + rows = MIN(rows, ptr->rows_in_array - (ptr->cur_start_row + i)); + if (rows <= 0) /* this chunk might be past end of file! */ + break; + byte_count = rows * bytesperrow; + if (writing) + (*ptr->b_s_info.write_backing_store) (& ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + else + (*ptr->b_s_info.read_backing_store) (& ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + file_offset += byte_count; + } +} + + +METHODDEF JSAMPARRAY +access_big_sarray (big_sarray_ptr ptr, long start_row, boolean writable) +/* Access the part of a "big" sample array starting at start_row */ +/* and extending for ptr->unitheight rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + /* debugging check */ + if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_array || + ptr->mem_buffer == NULL) + ERREXIT(methods, "Bogus access_big_sarray request"); + + /* Make the desired part of the virtual array accessible */ + if (start_row < ptr->cur_start_row || + start_row+ptr->unitheight > ptr->cur_start_row+ptr->rows_in_mem) { + if (! ptr->b_s_open) + ERREXIT(methods, "Virtual array controller messed up"); + /* Flush old buffer contents if necessary */ + if (ptr->dirty) { + do_sarray_io(ptr, TRUE); + ptr->dirty = FALSE; + } + /* Decide what part of virtual array to access. + * Algorithm: if target address > current window, assume forward scan, + * load starting at target address. If target address < current window, + * assume backward scan, load so that target address is top of window. + * Note that when switching from forward write to forward read, will have + * start_row = 0, so the limiting case applies and we load from 0 anyway. + */ + if (start_row > ptr->cur_start_row) { + ptr->cur_start_row = start_row; + } else { + ptr->cur_start_row = start_row + ptr->unitheight - ptr->rows_in_mem; + if (ptr->cur_start_row < 0) + ptr->cur_start_row = 0; /* don't fall off front end of file */ + } + /* If reading, read in the selected part of the array. + * If we are writing, we need not pre-read the selected portion, + * since the access sequence constraints ensure it would be garbage. + */ + if (! writable) { + do_sarray_io(ptr, FALSE); + } + } + /* Flag the buffer dirty if caller will write in it */ + if (writable) + ptr->dirty = TRUE; + /* Return address of proper part of the buffer */ + return ptr->mem_buffer + (start_row - ptr->cur_start_row); +} + + +METHODDEF JBLOCKARRAY +access_big_barray (big_barray_ptr ptr, long start_row, boolean writable) +/* Access the part of a "big" coefficient-block array starting at start_row */ +/* and extending for ptr->unitheight rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + /* debugging check */ + if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_array || + ptr->mem_buffer == NULL) + ERREXIT(methods, "Bogus access_big_barray request"); + + /* Make the desired part of the virtual array accessible */ + if (start_row < ptr->cur_start_row || + start_row+ptr->unitheight > ptr->cur_start_row+ptr->rows_in_mem) { + if (! ptr->b_s_open) + ERREXIT(methods, "Virtual array controller messed up"); + /* Flush old buffer contents if necessary */ + if (ptr->dirty) { + do_barray_io(ptr, TRUE); + ptr->dirty = FALSE; + } + /* Decide what part of virtual array to access. + * Algorithm: if target address > current window, assume forward scan, + * load starting at target address. If target address < current window, + * assume backward scan, load so that target address is top of window. + * Note that when switching from forward write to forward read, will have + * start_row = 0, so the limiting case applies and we load from 0 anyway. + */ + if (start_row > ptr->cur_start_row) { + ptr->cur_start_row = start_row; + } else { + ptr->cur_start_row = start_row + ptr->unitheight - ptr->rows_in_mem; + if (ptr->cur_start_row < 0) + ptr->cur_start_row = 0; /* don't fall off front end of file */ + } + /* If reading, read in the selected part of the array. + * If we are writing, we need not pre-read the selected portion, + * since the access sequence constraints ensure it would be garbage. + */ + if (! writable) { + do_barray_io(ptr, FALSE); + } + } + /* Flag the buffer dirty if caller will write in it */ + if (writable) + ptr->dirty = TRUE; + /* Return address of proper part of the buffer */ + return ptr->mem_buffer + (start_row - ptr->cur_start_row); +} + + +METHODDEF void +free_big_sarray (big_sarray_ptr ptr) +/* Free a "big" (virtual-memory) 2-D sample array */ +{ + big_sarray_ptr * llink; + + /* Remove item from list -- linear search is fast enough */ + llink = &big_sarray_list; + while (*llink != ptr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_big_sarray request"); + llink = &( (*llink)->next ); + } + *llink = ptr->next; + + if (ptr->b_s_open) /* there may be no backing store */ + (*ptr->b_s_info.close_backing_store) (& ptr->b_s_info); + + if (ptr->mem_buffer != NULL) /* just in case never realized */ + free_small_sarray(ptr->mem_buffer); + + free_small((void *) ptr); /* free the control block too */ +} + + +METHODDEF void +free_big_barray (big_barray_ptr ptr) +/* Free a "big" (virtual-memory) 2-D coefficient-block array */ +{ + big_barray_ptr * llink; + + /* Remove item from list -- linear search is fast enough */ + llink = &big_barray_list; + while (*llink != ptr) { + if (*llink == NULL) + ERREXIT(methods, "Bogus free_big_barray request"); + llink = &( (*llink)->next ); + } + *llink = ptr->next; + + if (ptr->b_s_open) /* there may be no backing store */ + (*ptr->b_s_info.close_backing_store) (& ptr->b_s_info); + + if (ptr->mem_buffer != NULL) /* just in case never realized */ + free_small_barray(ptr->mem_buffer); + + free_small((void *) ptr); /* free the control block too */ +} + + +/* + * Cleanup: free anything that's been allocated since jselmemmgr(). + */ + +METHODDEF void +free_all (void) +{ + /* First free any open "big" arrays -- these may release small arrays */ + while (big_sarray_list != NULL) + free_big_sarray(big_sarray_list); + while (big_barray_list != NULL) + free_big_barray(big_barray_list); + /* Free any open small arrays -- these may release small objects */ + /* +1's are because we must pass a pointer to the data, not the header */ + while (small_sarray_list != NULL) + free_small_sarray((JSAMPARRAY) (small_sarray_list + 1)); + while (small_barray_list != NULL) + free_small_barray((JBLOCKARRAY) (small_barray_list + 1)); + /* Free any remaining small objects */ + while (small_list != NULL) + free_small((void *) (small_list + 1)); +#ifdef NEED_ALLOC_MEDIUM + while (medium_list != NULL) + free_medium((void FAR *) (medium_list + 1)); +#endif + + jmem_term(); /* system-dependent cleanup */ + +#ifdef MEM_STATS + if (methods->trace_level > 0) + print_mem_stats(); /* print optional memory usage statistics */ +#endif +} + + +/* + * The method selection routine for virtual memory systems. + * The system-dependent setup routine should call this routine + * to install the necessary method pointers in the supplied struct. + */ + +GLOBAL void +jselmemmgr (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + + emethods->alloc_small = alloc_small; + emethods->free_small = free_small; +#ifdef NEED_ALLOC_MEDIUM + emethods->alloc_medium = alloc_medium; + emethods->free_medium = free_medium; +#else + emethods->alloc_medium = alloc_small; + emethods->free_medium = free_small; +#endif + emethods->alloc_small_sarray = alloc_small_sarray; + emethods->free_small_sarray = free_small_sarray; + emethods->alloc_small_barray = alloc_small_barray; + emethods->free_small_barray = free_small_barray; + emethods->request_big_sarray = request_big_sarray; + emethods->request_big_barray = request_big_barray; + emethods->alloc_big_arrays = alloc_big_arrays; + emethods->access_big_sarray = access_big_sarray; + emethods->access_big_barray = access_big_barray; + emethods->free_big_sarray = free_big_sarray; + emethods->free_big_barray = free_big_barray; + emethods->free_all = free_all; + + /* Initialize list headers to empty */ + small_list = NULL; +#ifdef NEED_ALLOC_MEDIUM + medium_list = NULL; +#endif + small_sarray_list = NULL; + small_barray_list = NULL; + big_sarray_list = NULL; + big_barray_list = NULL; + + jmem_init(emethods); /* system-dependent initialization */ +} diff --git a/jmemname.c b/jmemname.c new file mode 100644 index 00000000..18e67114 --- /dev/null +++ b/jmemname.c @@ -0,0 +1,248 @@ +/* + * jmemname.c (jmemsys.c) + * + * Copyright (C) 1992, 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. + * + * This file provides a generic implementation of the system-dependent + * portion of the JPEG memory manager. This implementation assumes that + * you must explicitly construct a name for each temp file. + * Also, the problem of determining the amount of memory available + * is shoved onto the user. + */ + +#include "jinclude.h" +#include "jmemsys.h" + +#ifdef INCLUDES_ARE_ANSI +#include /* to declare malloc(), free() */ +#else +extern void * malloc PP((size_t size)); +extern void free PP((void *ptr)); +#endif + +#ifndef SEEK_SET /* pre-ANSI systems may not define this; */ +#define SEEK_SET 0 /* if not, assume 0 is correct */ +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define RW_BINARY "w+" +#else +#define READ_BINARY "rb" +#define RW_BINARY "w+b" +#endif + + +static external_methods_ptr methods; /* saved for access to error_exit */ + +static long total_used; /* total memory requested so far */ + + +/* + * Selection of a file name for a temporary file. + * This is system-dependent! + * + * The code as given is suitable for most Unix systems, and it is easily + * modified for most non-Unix systems. Some notes: + * 1. The temp file is created in the directory named by TEMP_DIRECTORY. + * The default value is /usr/tmp, which is the conventional place for + * creating large temp files on Unix. On other systems you'll probably + * want to change the file location. You can do this by editing the + * #define, or by defining TEMP_DIRECTORY in CFLAGS in the Makefile. + * For example, you might say + * CFLAGS= ... '-DTEMP_DIRECTORY="/tmp/"' + * Note that double quotes are needed in the text of the macro. + * With most make systems you have to put single quotes around the + * -D construct to preserve the double quotes. + * (Amiga SAS C has trouble with ":" and such in command-line options, + * so we've put in a special case for the preferred Amiga temp directory.) + * + * 2. If you need to change the file name as well as its location, + * you can override the TEMP_FILE_NAME macro. (Note that this is + * actually a printf format string; it must contain %s and %d.) + * Few people should need to do this. + * + * 3. mktemp() is used to ensure that multiple processes running + * simultaneously won't select the same file names. If your system + * doesn't have mktemp(), define NO_MKTEMP to do it the hard way. + * + * 4. You probably want to define NEED_SIGNAL_CATCHER so that jcmain/jdmain + * will cause the temp files to be removed if you stop the program early. + */ + +#ifndef TEMP_DIRECTORY /* so can override from Makefile */ +#ifdef AMIGA +#define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ +#else +#define TEMP_DIRECTORY "/usr/tmp/" /* recommended setting for Unix */ +#endif +#endif + +static int next_file_num; /* to distinguish among several temp files */ + +#ifdef NO_MKTEMP + +#ifndef TEMP_FILE_NAME /* so can override from Makefile */ +#define TEMP_FILE_NAME "%sJPG%03d.TMP" +#endif + +LOCAL void +select_file_name (char * fname) +{ + FILE * tfile; + + /* Keep generating file names till we find one that's not in use */ + for (;;) { + next_file_num++; /* advance counter */ + sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); + if ((tfile = fopen(fname, READ_BINARY)) == NULL) + break; + fclose(tfile); /* oops, it's there; close tfile & try again */ + } +} + +#else /* ! NO_MKTEMP */ + +/* Note that mktemp() requires the initial filename to end in six X's */ +#ifndef TEMP_FILE_NAME /* so can override from Makefile */ +#define TEMP_FILE_NAME "%sJPG%dXXXXXX" +#endif + +LOCAL void +select_file_name (char * fname) +{ + next_file_num++; /* advance counter */ + sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num); + mktemp(fname); /* make sure file name is unique */ + /* mktemp replaces the trailing XXXXXX with a unique string of characters */ +} + +#endif /* NO_MKTEMP */ + + +/* + * Memory allocation and freeing are controlled by the regular library + * routines malloc() and free(). + */ + +GLOBAL void * +jget_small (size_t sizeofobject) +{ + total_used += sizeofobject; + return (void *) malloc(sizeofobject); +} + +GLOBAL void +jfree_small (void * object) +{ + free(object); +} + +/* + * We assume NEED_FAR_POINTERS is not defined and so the separate entry points + * jget_large, jfree_large are not needed. + */ + + +/* + * This routine computes the total memory space available for allocation. + * It's impossible to do this in a portable way; our current solution is + * to make the user tell us (with a default value set at compile time). + * If you can actually get the available space, it's a good idea to subtract + * a slop factor of 5% or so. + */ + +#ifndef DEFAULT_MAX_MEM /* so can override from makefile */ +#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ +#endif + +GLOBAL long +jmem_available (long min_bytes_needed, long max_bytes_needed) +{ + return methods->max_memory_to_use - total_used; +} + + +/* + * Backing store (temporary file) management. + * Backing store objects are only used when the value returned by + * jmem_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 (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(methods, "fseek failed on temporary file"); + if (JFREAD(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(methods, "fread failed on temporary file"); +} + + +METHODDEF void +write_backing_store (backing_store_ptr info, void FAR * buffer_address, + long file_offset, long byte_count) +{ + if (fseek(info->temp_file, file_offset, SEEK_SET)) + ERREXIT(methods, "fseek failed on temporary file"); + if (JFWRITE(info->temp_file, buffer_address, byte_count) + != (size_t) byte_count) + ERREXIT(methods, "fwrite failed on temporary file --- out of disk space?"); +} + + +METHODDEF void +close_backing_store (backing_store_ptr info) +{ + fclose(info->temp_file); /* close the file */ + unlink(info->temp_name); /* delete the file */ +/* If your system doesn't have unlink(), use remove() instead. + * remove() is the ANSI-standard name for this function, but if + * your system was ANSI you'd be using jmemansi.c, right? + */ +} + + +GLOBAL void +jopen_backing_store (backing_store_ptr info, long total_bytes_needed) +{ + char tracemsg[TEMP_NAME_LENGTH+40]; + + select_file_name(info->temp_name); + if ((info->temp_file = fopen(info->temp_name, RW_BINARY)) == NULL) + ERREXIT(methods, "Failed to create temporary file"); + info->read_backing_store = read_backing_store; + info->write_backing_store = write_backing_store; + info->close_backing_store = close_backing_store; + /* hack to get around TRACEMS' inability to handle string parameters */ + sprintf(tracemsg, "Using temp file %s", info->temp_name); + TRACEMS(methods, 1, tracemsg); +} + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. Keep in mind that jmem_term may be called more than + * once. + */ + +GLOBAL void +jmem_init (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + emethods->max_memory_to_use = DEFAULT_MAX_MEM; + total_used = 0; + next_file_num = 0; +} + +GLOBAL void +jmem_term (void) +{ + /* no work */ +} diff --git a/jmemnobs.c b/jmemnobs.c new file mode 100644 index 00000000..05e24f69 --- /dev/null +++ b/jmemnobs.c @@ -0,0 +1,96 @@ +/* + * jmemnobs.c (jmemsys.c) + * + * Copyright (C) 1992, 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. + * + * This file provides a really simple implementation of the system- + * dependent portion of the JPEG memory manager. This implementation + * assumes that no backing-store files are needed: all required space + * can be obtained from malloc(). + * This is very portable in the sense that it'll compile on almost anything, + * but you'd better have lots of main memory (or virtual memory) if you want + * to process big images. + * Note that the max_memory_to_use option is ignored by this implementation. + */ + +#include "jinclude.h" +#include "jmemsys.h" + +#ifdef INCLUDES_ARE_ANSI +#include /* to declare malloc(), free() */ +#else +extern void * malloc PP((size_t size)); +extern void free PP((void *ptr)); +#endif + + +static external_methods_ptr methods; /* saved for access to error_exit */ + + +/* + * Memory allocation and freeing are controlled by the regular library + * routines malloc() and free(). + */ + +GLOBAL void * +jget_small (size_t sizeofobject) +{ + return (void *) malloc(sizeofobject); +} + +GLOBAL void +jfree_small (void * object) +{ + free(object); +} + +/* + * We assume NEED_FAR_POINTERS is not defined and so the separate entry points + * jget_large, jfree_large are not needed. + */ + + +/* + * This routine computes the total memory space available for allocation. + * Here we always say, "we got all you want bud!" + */ + +GLOBAL long +jmem_available (long min_bytes_needed, long max_bytes_needed) +{ + return max_bytes_needed; +} + + +/* + * Backing store (temporary file) management. + * This should never be called and we just error out. + */ + +GLOBAL void +jopen_backing_store (backing_store_ptr info, long total_bytes_needed) +{ + ERREXIT(methods, "Backing store not supported"); +} + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. Keep in mind that jmem_term may be called more than + * once. + */ + +GLOBAL void +jmem_init (external_methods_ptr emethods) +{ + methods = emethods; /* save struct addr for error exit access */ + emethods->max_memory_to_use = 0; +} + +GLOBAL void +jmem_term (void) +{ + /* no work */ +} diff --git a/jmemsys.h b/jmemsys.h new file mode 100644 index 00000000..1766a959 --- /dev/null +++ b/jmemsys.h @@ -0,0 +1,127 @@ +/* + * jmemsys.h + * + * Copyright (C) 1992, 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. + * + * This include file defines the interface between the system-independent + * and system-dependent portions of the JPEG memory manager. (The system- + * independent portion is jmemmgr.c; there are several different versions + * of the system-dependent portion, and of this file for that matter.) + * + * This is a "generic" skeleton that may need to be modified for particular + * systems. It should be usable as-is on the majority of non-MSDOS machines. + */ + + +/* + * These two functions are used to allocate and release small chunks of + * memory (typically the total amount requested through jget_small is + * no more than 20Kb or so). Behavior should be the same as for the + * standard library functions malloc and free; in particular, jget_small + * returns NULL on failure. On most systems, these ARE malloc and free. + * On an 80x86 machine using small-data memory model, these manage near heap. + */ + +EXTERN void * jget_small PP((size_t sizeofobject)); +EXTERN void jfree_small PP((void * object)); + +/* + * These two functions are used to allocate and release large chunks of + * memory (up to the total free space designated by jmem_available). + * The interface is the same as above, except that on an 80x86 machine, + * far pointers are used. On other systems these ARE the same as above. + */ + +#ifdef NEED_FAR_POINTERS /* typically not needed except on 80x86 */ +EXTERN void FAR * jget_large PP((size_t sizeofobject)); +EXTERN void jfree_large PP((void FAR * object)); +#else +#define jget_large(sizeofobject) jget_small(sizeofobject) +#define jfree_large(object) jfree_small(object) +#endif + +/* + * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may + * be requested in a single call on jget_large (and jget_small for that + * matter, but that case should never come into play). This macro is needed + * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. + * On machines with flat address spaces, any large constant may be used here. + */ + +#define MAX_ALLOC_CHUNK 1000000000L + +/* + * This routine computes the total space available for allocation by + * jget_large. If more space than this is needed, backing store will be used. + * NOTE: any memory already allocated must not be counted. + * + * There is a minimum space requirement, corresponding to the minimum + * feasible buffer sizes; jmemmgr.c will request that much space even if + * jmem_available returns zero. The maximum space needed, enough to hold + * all working storage in memory, is also passed in case it is useful. + * + * It is OK for jmem_available to underestimate the space available (that'll + * just lead to more backing-store access than is really necessary). + * However, an overestimate will lead to failure. Hence it's wise to subtract + * a slop factor from the true available space, especially if jget_small space + * comes from the same pool. 5% should be enough. + * + * On machines with lots of virtual memory, any large constant may be returned. + * Conversely, zero may be returned to always use the minimum amount of memory. + */ + +EXTERN long jmem_available PP((long min_bytes_needed, long max_bytes_needed)); + + +/* + * This structure holds whatever state is needed to access a single + * backing-store object. The read/write/close method pointers are called + * by jmemmgr.c to manipulate the backing-store object; all other fields + * are private to the system-dependent backing store routines. + */ + +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ + +typedef struct backing_store_struct * backing_store_ptr; + +typedef struct backing_store_struct { + /* Methods for reading/writing/closing this backing-store object */ + METHOD(void, read_backing_store, (backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + METHOD(void, write_backing_store, (backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + METHOD(void, close_backing_store, (backing_store_ptr info)); + /* Private fields for system-dependent backing-store management */ + /* For a typical implementation with temp files, we might need: */ + FILE * temp_file; /* stdio reference to temp file */ + char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ + } backing_store_info; + +/* + * Initial opening of a backing-store object. This must fill in the + * read/write/close pointers in the object. The read/write routines + * may take an error exit if the specified maximum file size is exceeded. + * (If jmem_available always returns a large value, this routine can just + * take an error exit.) + */ + +EXTERN void jopen_backing_store PP((backing_store_ptr info, + long total_bytes_needed)); + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. The system methods struct address should be saved + * by jmem_init in case an error exit must be taken. jmem_term may assume + * that all requested memory has been freed and that all opened backing- + * store objects have been closed. + * NB: jmem_term may be called more than once, and must behave reasonably + * if that happens. + */ + +EXTERN void jmem_init PP((external_methods_ptr emethods)); +EXTERN void jmem_term PP((void)); diff --git a/jpegdata.h b/jpegdata.h index 947a8af2..6a0fa0a4 100644 --- a/jpegdata.h +++ b/jpegdata.h @@ -1,7 +1,7 @@ /* * jpegdata.h * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -197,11 +197,13 @@ typedef struct { /* A Huffman coding table */ * coding and decoding. These fields should be considered private to the * Huffman compression & decompression modules. */ + /* encoding tables: */ UINT16 ehufco[256]; /* code for each symbol */ char ehufsi[256]; /* length of code for each symbol */ + /* decoding tables: (element [0] of each array is unused) */ UINT16 mincode[17]; /* smallest code of length k */ INT32 maxcode[18]; /* largest code of length k (-1 if none) */ - /* maxcode[17] is a sentinel to ensure huff_DECODE terminates */ + /* (maxcode[17] is a sentinel to ensure huff_DECODE terminates) */ short valptr[17]; /* huffval[] index of 1st symbol of length k */ } HUFF_TBL; @@ -280,6 +282,13 @@ struct compress_info_struct { short max_h_samp_factor; /* largest h_samp_factor */ short max_v_samp_factor; /* largest v_samp_factor */ +/* + * These fields may be useful for progress monitoring + */ + + int total_passes; /* number of passes expected */ + int completed_passes; /* number of passes completed so far */ + /* * These fields are valid during any one scan */ @@ -332,7 +341,7 @@ struct decompress_info_struct { /* the following are ignored if not quantize_colors: */ boolean two_pass_quantize; /* use two-pass color quantization? */ boolean use_dithering; /* want color dithering? */ - int desired_number_of_colors; /* number of colors to use */ + int desired_number_of_colors; /* max number of colors to use */ boolean do_block_smoothing; /* T = apply cross-block smoothing */ boolean do_pixel_smoothing; /* T = apply post-subsampling smoothing */ @@ -345,7 +354,8 @@ struct decompress_info_struct { * JGETC macro, below. * Note: the user interface is expected to allocate the input_buffer and * initialize bytes_in_buffer to 0. Also, for JFIF/raw-JPEG input, the UI - * actually supplies the read_jpeg_data method. + * actually supplies the read_jpeg_data method. This is all handled by + * j_d_defaults in a typical implementation. */ char * input_buffer; /* start of buffer (private to input code) */ char * next_input_byte; /* => next byte to read from buffer */ @@ -395,9 +405,26 @@ struct decompress_info_struct { short color_out_comps; /* # of color components output by color_convert */ /* (need not match num_components) */ - short final_out_comps; /* # of color components in output image */ + short final_out_comps; /* # of color components sent to put_pixel_rows */ /* (1 when quantizing colors, else same as color_out_comps) */ +/* + * When quantizing colors, the color quantizer leaves a pointer to the output + * colormap in these fields. The colormap is valid from the time put_color_map + * is called (must be before any put_pixel_rows calls) until shutdown (more + * specifically, until free_all is called to release memory). + */ + int actual_number_of_colors; /* actual number of entries */ + JSAMPARRAY colormap; /* NULL if not valid */ + /* map has color_out_comps rows * actual_number_of_colors columns */ + +/* + * These fields may be useful for progress monitoring + */ + + int total_passes; /* number of passes expected */ + int completed_passes; /* number of passes completed so far */ + /* * These fields are valid during any one scan */ @@ -455,7 +482,7 @@ typedef struct big_barray_control * big_barray_ptr; * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, * add -DINCOMPLETE_TYPES_BROKEN to CFLAGS in your Makefile. Then we will * pseudo-define the structs as containing a single "dummy" field. - * The memory manager(s) #define AM_MEMORY_MANAGER before including this file, + * The memory managers #define AM_MEMORY_MANAGER before including this file, * so that they can make their own definitions of the structs. */ @@ -526,21 +553,14 @@ struct external_methods_struct { /* error_exit if not successful. */ METHOD(void *, alloc_small, (size_t sizeofobject)); METHOD(void, free_small, (void *ptr)); -#ifdef NEED_FAR_POINTERS /* routines for getting far-heap space */ METHOD(void FAR *, alloc_medium, (size_t sizeofobject)); METHOD(void, free_medium, (void FAR *ptr)); -#else -#define alloc_medium alloc_small -#define free_medium free_small -#endif METHOD(JSAMPARRAY, alloc_small_sarray, (long samplesperrow, long numrows)); - METHOD(void, free_small_sarray, (JSAMPARRAY ptr, - long numrows)); + METHOD(void, free_small_sarray, (JSAMPARRAY ptr)); METHOD(JBLOCKARRAY, alloc_small_barray, (long blocksperrow, long numrows)); - METHOD(void, free_small_barray, (JBLOCKARRAY ptr, - long numrows)); + METHOD(void, free_small_barray, (JBLOCKARRAY ptr)); METHOD(big_sarray_ptr, request_big_sarray, (long samplesperrow, long numrows, long unitheight)); @@ -558,6 +578,9 @@ struct external_methods_struct { boolean writable)); METHOD(void, free_big_sarray, (big_sarray_ptr ptr)); METHOD(void, free_big_barray, (big_barray_ptr ptr)); + METHOD(void, free_all, (void)); + + long max_memory_to_use; /* maximum amount of memory to use */ }; /* Macros to simplify using the error and trace message stuff */ @@ -616,12 +639,15 @@ struct external_methods_struct { struct compress_methods_struct { /* Hook for user interface to get control after input_init */ METHOD(void, c_ui_method_selection, (compress_info_ptr cinfo)); + /* Hook for user interface to do progress monitoring */ + METHOD(void, progress_monitor, (compress_info_ptr cinfo, + long loopcounter, long looplimit)); /* Input image reading & conversion to standard form */ METHOD(void, input_init, (compress_info_ptr cinfo)); METHOD(void, get_input_row, (compress_info_ptr cinfo, JSAMPARRAY pixel_row)); METHOD(void, input_term, (compress_info_ptr cinfo)); - /* Gamma and color space conversion */ + /* Color space and gamma conversion */ METHOD(void, colorin_init, (compress_info_ptr cinfo)); METHOD(void, get_sample_rows, (compress_info_ptr cinfo, int rows_to_read, @@ -675,11 +701,10 @@ struct compress_methods_struct { struct decompress_methods_struct { /* Hook for user interface to get control after reading file header */ METHOD(void, d_ui_method_selection, (decompress_info_ptr cinfo)); + /* Hook for user interface to do progress monitoring */ + METHOD(void, progress_monitor, (decompress_info_ptr cinfo, + long loopcounter, long looplimit)); /* JPEG file scanning */ - /* Note: user interface supplies read_jpeg_data for JFIF/raw-JPEG - * reading. For file formats that require random access (eg, TIFF) - * the JPEG file header module will override the UI read_jpeg_data. - */ METHOD(void, read_file_header, (decompress_info_ptr cinfo)); METHOD(boolean, read_scan_header, (decompress_info_ptr cinfo)); METHOD(int, read_jpeg_data, (decompress_info_ptr cinfo)); @@ -691,9 +716,13 @@ struct decompress_methods_struct { JBLOCK *MCU_data)); METHOD(void, entropy_decoder_term, (decompress_info_ptr cinfo)); /* MCU disassembly: fetch MCUs from entropy_decode, build coef array */ + /* The reverse_DCT step is in the same module for symmetry reasons */ METHOD(void, disassemble_init, (decompress_info_ptr cinfo)); METHOD(void, disassemble_MCU, (decompress_info_ptr cinfo, JBLOCKIMAGE image_data)); + METHOD(void, reverse_DCT, (decompress_info_ptr cinfo, + JBLOCKIMAGE coeff_data, + JSAMPIMAGE output_data, int start_row)); METHOD(void, disassemble_term, (decompress_info_ptr cinfo)); /* Cross-block smoothing */ METHOD(void, smooth_coefficients, (decompress_info_ptr cinfo, @@ -707,10 +736,10 @@ struct decompress_methods_struct { METHOD(void, unsubsample_init, (decompress_info_ptr cinfo)); unsubsample_ptr unsubsample[MAX_COMPS_IN_SCAN]; METHOD(void, unsubsample_term, (decompress_info_ptr cinfo)); - /* Gamma and color space conversion */ + /* Color space and gamma conversion */ METHOD(void, colorout_init, (decompress_info_ptr cinfo)); METHOD(void, color_convert, (decompress_info_ptr cinfo, - int num_rows, + int num_rows, long num_cols, JSAMPIMAGE input_data, JSAMPIMAGE output_data)); METHOD(void, colorout_term, (decompress_info_ptr cinfo)); @@ -722,7 +751,8 @@ struct decompress_methods_struct { JSAMPARRAY output_data)); METHOD(void, color_quant_prescan, (decompress_info_ptr cinfo, int num_rows, - JSAMPIMAGE image_data)); + JSAMPIMAGE image_data, + JSAMPARRAY workspace)); METHOD(void, color_quant_doit, (decompress_info_ptr cinfo, quantize_caller_ptr source_method)); METHOD(void, color_quant_term, (decompress_info_ptr cinfo)); @@ -761,7 +791,6 @@ EXTERN void j_c_defaults PP((compress_info_ptr cinfo, int quality, EXTERN void j_monochrome_default PP((compress_info_ptr cinfo)); EXTERN void j_set_quality PP((compress_info_ptr cinfo, int quality, boolean force_baseline)); -EXTERN void j_c_free_defaults PP((compress_info_ptr cinfo)); /* main entry for decompression */ EXTERN void jpeg_decompress PP((decompress_info_ptr cinfo)); @@ -769,8 +798,6 @@ EXTERN void jpeg_decompress PP((decompress_info_ptr cinfo)); /* default parameter setup for decompression */ EXTERN void j_d_defaults PP((decompress_info_ptr cinfo, boolean standard_buffering)); -EXTERN void j_d_free_defaults PP((decompress_info_ptr cinfo, - boolean standard_buffering)); /* forward DCT */ EXTERN void j_fwd_dct PP((DCTBLOCK data)); @@ -822,13 +849,31 @@ EXTERN void jselwtarga PP((decompress_info_ptr cinfo)); /* jwrtarga.c */ /* method selection routines for system-dependent modules */ EXTERN void jselerror PP((external_methods_ptr emethods)); /* jerror.c */ -EXTERN void jselvirtmem PP((external_methods_ptr emethods)); /* jvirtmem.c */ +EXTERN void jselmemmgr PP((external_methods_ptr emethods)); /* jmemmgr.c */ -/* debugging hook in jvirtmem.c */ -#ifdef MEM_STATS -EXTERN void j_mem_stats PP((void)); + +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. + * It is only applied with constant shift counts. SHIFT_TEMPS must be + * included in the variables of any routine using RIGHT_SHIFT. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define SHIFT_TEMPS INT32 shift_temp; +#define RIGHT_SHIFT(x,shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ + (shift_temp >> (shft))) +#else +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif + /* Miscellaneous useful macros */ #undef MAX diff --git a/jquant1.c b/jquant1.c index ea01c239..8fdb2a3a 100644 --- a/jquant1.c +++ b/jquant1.c @@ -1,7 +1,7 @@ /* * jquant1.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,45 +16,88 @@ /* - * This implementation is a fairly dumb, quick-and-dirty quantizer; - * it's here mostly so that we can start working on colormapped output formats. + * The main purpose of 1-pass quantization is to provide a fast, if not very + * high quality, colormapped output capability. A 2-pass quantizer usually + * gives better visual quality; however, for quantized grayscale output this + * quantizer is perfectly adequate. Dithering is highly recommended with this + * quantizer, though you can turn it off if you really want to. * - * We quantize to a color map that is selected in advance of seeing the image; - * the map depends only on the requested number of colors (at least 8). - * The map consists of all combinations of Ncolors[j] color values for each - * component j; we choose Ncolors[] based on the requested # of colors. - * We always use 0 and MAXJSAMPLE in each color (hence the minimum 8 colors). - * Any additional color values are equally spaced between these limits. + * This implementation quantizes in the output colorspace. This has a couple + * of disadvantages: each pixel must be individually color-converted, and if + * the color conversion includes gamma correction then quantization is done in + * a nonlinear space, which is less desirable. The major advantage is that + * with the usual output color spaces (RGB, grayscale) an orthogonal grid of + * representative colors can be used, thus permitting the very simple and fast + * color lookup scheme used here. The standard JPEG colorspace (YCbCr) cannot + * be effectively handled this way, because only about a quarter of an + * orthogonal grid would fall within the gamut of realizable colors. Another + * advantage is that when the user wants quantized grayscale output from a + * color JPEG file, this quantizer can provide a high-quality result with no + * special hacking. * - * The result almost always needs dithering to look decent. + * The gamma-correction problem could be eliminated by adjusting the grid + * spacing to counteract the gamma correction applied by color_convert. + * At this writing, gamma correction is not implemented by jdcolor, so + * nothing is done here. + * + * In 1-pass quantization the colormap must be chosen in advance of seeing the + * image. We use a map consisting of all combinations of Ncolors[i] color + * values for the i'th component. The Ncolors[] values are chosen so that + * their product, the total number of colors, is no more than that requested. + * (In most cases, the product will be somewhat less.) + * + * Since the colormap is orthogonal, the representative value for each color + * component can be determined without considering the other components; + * then these indexes can be combined into a colormap index by a standard + * N-dimensional-array-subscript calculation. Most of the arithmetic involved + * can be precalculated and stored in the lookup table colorindex[]. + * colorindex[i][j] maps pixel value j in component i to the nearest + * representative value (grid plane) for that component; this index is + * multiplied by the array stride for component i, so that the + * index of the colormap entry closest to a given pixel value is just + * sum( colorindex[component-number][pixel-component-value] ) + * Aside from being fast, this scheme allows for variable spacing between + * representative values with no additional lookup cost. */ -#define MAX_COMPONENTS 4 /* max components I can handle */ -static int total_colors; /* Number of distinct output colors */ -static int Ncolors[MAX_COMPONENTS]; /* # of values alloced to each component */ -/* total_colors is the product of the Ncolors[] values */ +#define MAX_COMPONENTS 4 /* max components I can handle */ static JSAMPARRAY colormap; /* The actual color map */ /* colormap[i][j] = value of i'th color component for output pixel value j */ static JSAMPARRAY colorindex; /* Precomputed mapping for speed */ /* colorindex[i][j] = index of color closest to pixel value j in component i, - * premultiplied so that the correct mapped value for a pixel (r,g,b) is: - * colorindex[0][r] + colorindex[1][g] + colorindex[2][b] + * premultiplied as described above. Since colormap indexes must fit into + * JSAMPLEs, the entries of this array will too. + */ + +static JSAMPARRAY input_buffer; /* color conversion workspace */ +/* Since our input data is presented in the JPEG colorspace, we have to call + * color_convert to get it into the output colorspace. input_buffer is a + * one-row-high workspace for the result of color_convert. */ /* Declarations for Floyd-Steinberg dithering. - * Errors are accumulated into the arrays evenrowerrs[] and oddrowerrs[], - * each of which have #colors * (#columns + 2) entries (so that first/last - * pixels need not be special cases). These have resolutions of 1/16th of - * a pixel count. The error at a given pixel is propagated to its unprocessed - * neighbors using the standard F-S fractions, + * + * Errors are accumulated into the arrays evenrowerrs[] and oddrowerrs[]. + * These have resolutions of 1/16th of a pixel count. The error at a given + * pixel is propagated to its unprocessed neighbors using the standard F-S + * fractions, * ... (here) 7/16 * 3/16 5/16 1/16 * We work left-to-right on even rows, right-to-left on odd rows. * + * In each of the xxxrowerrs[] arrays, indexing is [component#][position]. + * We provide (#columns + 2) entries per component; the extra entry at each + * end saves us from special-casing the first and last pixels. + * In evenrowerrs[], the entries for a component are stored left-to-right, but + * in oddrowerrs[] they are stored right-to-left. This means we always + * process the current row's error entries in increasing order and the next + * row's error entries in decreasing order, regardless of whether we are + * working L-to-R or R-to-L in the pixel data! + * * Note: on a wide image, we might not have enough room in a PC's near data * segment to hold the error arrays; so they are allocated with alloc_medium. */ @@ -67,10 +110,157 @@ typedef INT32 FSERROR; /* may need more than 16 bits? */ typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ -static FSERRPTR evenrowerrs, oddrowerrs; /* current-row and next-row errors */ +static FSERRPTR evenrowerrs[MAX_COMPONENTS]; /* errors for even rows */ +static FSERRPTR oddrowerrs[MAX_COMPONENTS]; /* errors for odd rows */ static boolean on_odd_row; /* flag to remember which row we are on */ +/* + * Policy-making subroutines for color_quant_init: these routines determine + * the colormap to be used. The rest of the module only assumes that the + * colormap is orthogonal. + * + * * select_ncolors decides how to divvy up the available colors + * among the components. + * * output_value defines the set of representative values for a component. + * * largest_input_value defines the mapping from input values to + * representative values for a component. + * Note that the latter two routines may impose different policies for + * different components, though this is not currently done. + */ + + +LOCAL int +select_ncolors (decompress_info_ptr cinfo, int Ncolors[]) +/* Determine allocation of desired colors to components, */ +/* and fill in Ncolors[] array to indicate choice. */ +/* Return value is total number of colors (product of Ncolors[] values). */ +{ + int nc = cinfo->color_out_comps; /* number of color components */ + int max_colors = cinfo->desired_number_of_colors; + int total_colors, iroot, i; + long temp; + boolean changed; + + /* We can allocate at least the nc'th root of max_colors per component. */ + /* Compute floor(nc'th root of max_colors). */ + iroot = 1; + do { + iroot++; + temp = iroot; /* set temp = iroot ** nc */ + for (i = 1; i < nc; i++) + temp *= iroot; + } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */ + iroot--; /* now iroot = floor(root) */ + + /* Must have at least 2 color values per component */ + if (iroot < 2) + ERREXIT1(cinfo->emethods, "Cannot quantize to fewer than %d colors", + (int) temp); + + if (cinfo->out_color_space == CS_RGB && nc == 3) { + /* We provide a special policy for quantizing in RGB space. + * If 256 colors are requested, we allocate 8 red, 8 green, 4 blue levels; + * this corresponds to the common 3/3/2-bit scheme. For other totals, + * the counts are set so that the number of colors allocated to each + * component are roughly in the proportion R 3, G 4, B 2. + * For low color counts, it's easier to hardwire the optimal choices + * than try to tweak the algorithm to generate them. + */ + if (max_colors == 256) { + Ncolors[0] = 8; Ncolors[1] = 8; Ncolors[2] = 4; + return 256; + } + if (max_colors < 12) { + /* Fixed mapping for 8 colors */ + Ncolors[0] = Ncolors[1] = Ncolors[2] = 2; + } else if (max_colors < 18) { + /* Fixed mapping for 12 colors */ + Ncolors[0] = 2; Ncolors[1] = 3; Ncolors[2] = 2; + } else if (max_colors < 24) { + /* Fixed mapping for 18 colors */ + Ncolors[0] = 3; Ncolors[1] = 3; Ncolors[2] = 2; + } else if (max_colors < 27) { + /* Fixed mapping for 24 colors */ + Ncolors[0] = 3; Ncolors[1] = 4; Ncolors[2] = 2; + } else if (max_colors < 36) { + /* Fixed mapping for 27 colors */ + Ncolors[0] = 3; Ncolors[1] = 3; Ncolors[2] = 3; + } else { + /* these weights are readily derived with a little algebra */ + Ncolors[0] = (iroot * 266) >> 8; /* R weight is 1.0400 */ + Ncolors[1] = (iroot * 355) >> 8; /* G weight is 1.3867 */ + Ncolors[2] = (iroot * 177) >> 8; /* B weight is 0.6934 */ + } + total_colors = Ncolors[0] * Ncolors[1] * Ncolors[2]; + /* The above computation produces "floor" values, so we may be able to + * increment the count for one or more components without exceeding + * max_colors. We try in the order B, G, R. + */ + do { + changed = FALSE; + for (i = 2; i >= 0; i--) { + /* calculate new total_colors if Ncolors[i] is incremented */ + temp = total_colors / Ncolors[i]; + temp *= Ncolors[i]+1; /* done in long arith to avoid oflo */ + if (temp <= (long) max_colors) { + Ncolors[i]++; /* OK, apply the increment */ + total_colors = (int) temp; + changed = TRUE; + } + } + } while (changed); /* loop until no increment is possible */ + } else { + /* For any colorspace besides RGB, treat all the components equally. */ + + /* Initialize to iroot color values for each component */ + total_colors = 1; + for (i = 0; i < nc; i++) { + Ncolors[i] = iroot; + total_colors *= iroot; + } + /* We may be able to increment the count for one or more components without + * exceeding max_colors, though we know not all can be incremented. + */ + for (i = 0; i < nc; i++) { + /* calculate new total_colors if Ncolors[i] is incremented */ + temp = total_colors / Ncolors[i]; + temp *= Ncolors[i]+1; /* done in long arith to avoid oflo */ + if (temp > (long) max_colors) + break; /* won't fit, done */ + Ncolors[i]++; /* OK, apply the increment */ + total_colors = (int) temp; + } + } + + return total_colors; +} + + +LOCAL int +output_value (decompress_info_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 */ +{ + /* We always provide values 0 and MAXJSAMPLE for each component; + * any additional values are equally spaced between these limits. + * (Forcing the upper and lower values to the limits ensures that + * dithering can't produce a color outside the selected gamut.) + */ + return (j * MAXJSAMPLE + maxj/2) / maxj; +} + + +LOCAL int +largest_input_value (decompress_info_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 */ +{ + /* Breakpoints are halfway between values returned by output_value */ + return ((2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj); +} + + /* * Initialize for one-pass color quantization. */ @@ -78,37 +268,22 @@ static boolean on_odd_row; /* flag to remember which row we are on */ METHODDEF void color_quant_init (decompress_info_ptr cinfo) { - int max_colors = cinfo->desired_number_of_colors; - int i,j,k, ntc, nci, blksize, blkdist, ptr, val; + int total_colors; /* Number of distinct output colors */ + int Ncolors[MAX_COMPONENTS]; /* # of values alloced to each component */ + int i,j,k, nci, blksize, blkdist, ptr, val; - if (cinfo->color_out_comps > MAX_COMPONENTS) + /* Make sure my internal arrays won't overflow */ + if (cinfo->num_components > MAX_COMPONENTS || + cinfo->color_out_comps > MAX_COMPONENTS) ERREXIT1(cinfo->emethods, "Cannot quantize more than %d color components", MAX_COMPONENTS); - if (max_colors > (MAXJSAMPLE+1)) + /* Make sure colormap indexes can be represented by JSAMPLEs */ + if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1)) ERREXIT1(cinfo->emethods, "Cannot request more than %d quantized colors", - MAXJSAMPLE+1); + MAXJSAMPLE+1); - /* Initialize to 2 color values for each component */ - total_colors = 1; - for (i = 0; i < cinfo->color_out_comps; i++) { - Ncolors[i] = 2; - total_colors *= 2; - } - if (total_colors > max_colors) - ERREXIT1(cinfo->emethods, "Cannot quantize to fewer than %d colors", - total_colors); - - /* Increase the number of color values until requested limit is reached. */ - /* Note that for standard RGB color space, we will have at least as many */ - /* red values as green, and at least as many green values as blue. */ - i = 0; /* component index to increase next */ - /* test calculates ntc = new total_colors if Ncolors[i] is incremented */ - while ((ntc = (total_colors / Ncolors[i]) * (Ncolors[i]+1)) <= max_colors) { - Ncolors[i]++; /* OK, apply the increment */ - total_colors = ntc; - i++; /* advance to next component */ - if (i >= cinfo->color_out_comps) i = 0; - } + /* Select number of colors for each component */ + total_colors = select_ncolors(cinfo, Ncolors); /* Report selected color counts */ if (cinfo->color_out_comps == 3) @@ -136,7 +311,7 @@ color_quant_init (decompress_info_ptr cinfo) blksize = blkdist / nci; for (j = 0; j < nci; j++) { /* Compute j'th output value (out of nci) for component */ - val = (j * MAXJSAMPLE + (nci-1)/2) / (nci-1); + val = output_value(cinfo, i, j, nci-1); /* Fill in all colormap entries that have this value of this component */ for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { /* fill in blksize entries beginning at ptr */ @@ -147,31 +322,67 @@ color_quant_init (decompress_info_ptr cinfo) blkdist = blksize; /* blksize of this color is blkdist of next */ /* fill in colorindex entries for i'th color component */ + /* in loop, val = index of current output value, */ + /* and k = largest j that maps to current val */ + val = 0; + k = largest_input_value(cinfo, i, 0, nci-1); for (j = 0; j <= MAXJSAMPLE; j++) { - /* compute index of color closest to pixel value j */ - val = (j * (nci-1) + CENTERJSAMPLE) / MAXJSAMPLE; + while (j > k) /* advance val if past boundary */ + k = largest_input_value(cinfo, i, ++val, nci-1); /* premultiply so that no multiplication needed in main processing */ colorindex[i][j] = (JSAMPLE) (val * blksize); } } - /* Pass the colormap to the output module. Note that the output */ - /* module is allowed to save this pointer and use the map during */ - /* any put_pixel_rows call! */ + /* Pass the colormap to the output module. */ + /* NB: the output module may continue to use the colormap until shutdown. */ + cinfo->colormap = colormap; + cinfo->actual_number_of_colors = total_colors; (*cinfo->methods->put_color_map) (cinfo, total_colors, colormap); + /* Allocate workspace to hold one row of color-converted data */ + input_buffer = (*cinfo->emethods->alloc_small_sarray) + (cinfo->image_width, (long) cinfo->color_out_comps); + /* Allocate Floyd-Steinberg workspace if necessary */ if (cinfo->use_dithering) { - size_t arraysize = (cinfo->image_width + 2L) * cinfo->color_out_comps - * SIZEOF(FSERROR); + size_t arraysize = (size_t) ((cinfo->image_width + 2L) * SIZEOF(FSERROR)); - evenrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); - oddrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); - /* we only need to zero the forward contribution for current row. */ - jzero_far((void FAR *) evenrowerrs, arraysize); + for (i = 0; i < cinfo->color_out_comps; i++) { + evenrowerrs[i] = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + oddrowerrs[i] = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + /* we only need to zero the forward contribution for current row. */ + jzero_far((void FAR *) evenrowerrs[i], arraysize); + } on_odd_row = FALSE; } +} + +/* + * Subroutines for color conversion methods. + */ + +LOCAL void +do_color_conversion (decompress_info_ptr cinfo, JSAMPIMAGE input_data, int row) +/* Convert the indicated row of the input data into output colorspace */ +/* in input_buffer. This requires a little trickery since color_convert */ +/* expects to deal with 3-D arrays; fortunately we can fake it out */ +/* at fairly low cost. */ +{ + short ci; + JSAMPARRAY input_hack[MAX_COMPONENTS]; + JSAMPARRAY output_hack[MAX_COMPONENTS]; + + /* create JSAMPIMAGE pointing at specified row of input_data */ + for (ci = 0; ci < cinfo->num_components; ci++) + input_hack[ci] = input_data[ci] + row; + /* Create JSAMPIMAGE pointing at input_buffer */ + for (ci = 0; ci < cinfo->color_out_comps; ci++) + output_hack[ci] = &(input_buffer[ci]); + + (*cinfo->methods->color_convert) (cinfo, 1, cinfo->image_width, + input_hack, output_hack); } @@ -185,19 +396,22 @@ color_quantize (decompress_info_ptr cinfo, int num_rows, /* General case, no dithering */ { register int pixcode, ci; + register JSAMPROW ptrout; register long col; - register int row; - register long widthm1 = cinfo->image_width - 1; + int row; + long width = cinfo->image_width; register int nc = cinfo->color_out_comps; for (row = 0; row < num_rows; row++) { - for (col = widthm1; col >= 0; col--) { + do_color_conversion(cinfo, input_data, row); + ptrout = output_data[row]; + for (col = 0; col < width; col++) { pixcode = 0; for (ci = 0; ci < nc; ci++) { pixcode += GETJSAMPLE(colorindex[ci] - [GETJSAMPLE(input_data[ci][row][col])]); + [GETJSAMPLE(input_buffer[ci][col])]); } - output_data[row][col] = (JSAMPLE) pixcode; + *ptrout++ = (JSAMPLE) pixcode; } } } @@ -211,13 +425,14 @@ color_quantize3 (decompress_info_ptr cinfo, int num_rows, register int pixcode; register JSAMPROW ptr0, ptr1, ptr2, ptrout; register long col; - register int row; - register long width = cinfo->image_width; + int row; + long width = cinfo->image_width; for (row = 0; row < num_rows; row++) { - ptr0 = input_data[0][row]; - ptr1 = input_data[1][row]; - ptr2 = input_data[2][row]; + do_color_conversion(cinfo, input_data, row); + ptr0 = input_buffer[0]; + ptr1 = input_buffer[1]; + ptr2 = input_buffer[2]; ptrout = output_data[row]; for (col = width; col > 0; col--) { pixcode = GETJSAMPLE(colorindex[0][GETJSAMPLE(*ptr0++)]); @@ -234,86 +449,79 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE input_data, JSAMPARRAY output_data) /* General case, with Floyd-Steinberg dithering */ { - register int pixcode, ci; register FSERROR val; + FSERROR two_val; register FSERRPTR thisrowerr, nextrowerr; - register long col; - register int row; - register long width = cinfo->image_width; - register int nc = cinfo->color_out_comps; + register JSAMPROW input_ptr; + register JSAMPROW output_ptr; + JSAMPROW colorindex_ci; + JSAMPROW colormap_ci; + register int pixcode; + int dir; /* 1 for left-to-right, -1 for right-to-left */ + int ci; + int nc = cinfo->color_out_comps; + int row; + long col_counter; + long width = cinfo->image_width; for (row = 0; row < num_rows; row++) { - if (on_odd_row) { - /* work right to left in this row */ - thisrowerr = oddrowerrs + width*nc; - nextrowerr = evenrowerrs + width*nc; - for (ci = 0; ci < nc; ci++) /* need only initialize this one entry */ - nextrowerr[ci] = 0; - for (col = width - 1; col >= 0; col--) { - /* select the output pixel value */ - pixcode = 0; - for (ci = 0; ci < nc; ci++) { - /* compute pixel value + accumulated error */ - val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) - + thisrowerr[ci]; - if (val <= 0) val = 0; /* must watch for range overflow! */ - else { - val += 8; /* divide by 16 with proper rounding */ - val >>= 4; - if (val > MAXJSAMPLE) val = MAXJSAMPLE; - } - thisrowerr[ci] = val; /* save for error propagation */ - pixcode += GETJSAMPLE(colorindex[ci][val]); - } - output_data[row][col] = (JSAMPLE) pixcode; - /* propagate error to adjacent pixels */ - for (ci = 0; ci < nc; ci++) { - val = thisrowerr[ci] - (FSERROR) GETJSAMPLE(colormap[ci][pixcode]); - thisrowerr[ci-nc] += val * 7; - nextrowerr[ci+nc] += val * 3; - nextrowerr[ci ] += val * 5; - nextrowerr[ci-nc] = val; /* not +=, since not initialized yet */ - } - thisrowerr -= nc; /* advance error ptrs to next pixel entry */ - nextrowerr -= nc; + do_color_conversion(cinfo, input_data, row); + /* Initialize output values to 0 so can process components separately */ + jzero_far((void FAR *) output_data[row], + (size_t) (width * SIZEOF(JSAMPLE))); + for (ci = 0; ci < nc; ci++) { + if (on_odd_row) { + /* work right to left in this row */ + dir = -1; + input_ptr = input_buffer[ci] + (width-1); + output_ptr = output_data[row] + (width-1); + thisrowerr = oddrowerrs[ci] + 1; + nextrowerr = evenrowerrs[ci] + width; + } else { + /* work left to right in this row */ + dir = 1; + input_ptr = input_buffer[ci]; + output_ptr = output_data[row]; + thisrowerr = evenrowerrs[ci] + 1; + nextrowerr = oddrowerrs[ci] + width; } - on_odd_row = FALSE; - } else { - /* work left to right in this row */ - thisrowerr = evenrowerrs + nc; - nextrowerr = oddrowerrs + nc; - for (ci = 0; ci < nc; ci++) /* need only initialize this one entry */ - nextrowerr[ci] = 0; - for (col = 0; col < width; col++) { - /* select the output pixel value */ - pixcode = 0; - for (ci = 0; ci < nc; ci++) { - /* compute pixel value + accumulated error */ - val = (((FSERROR) GETJSAMPLE(input_data[ci][row][col])) << 4) - + thisrowerr[ci]; - if (val <= 0) val = 0; /* must watch for range overflow! */ - else { - val += 8; /* divide by 16 with proper rounding */ - val >>= 4; - if (val > MAXJSAMPLE) val = MAXJSAMPLE; - } - thisrowerr[ci] = val; /* save for error propagation */ - pixcode += GETJSAMPLE(colorindex[ci][val]); + colorindex_ci = colorindex[ci]; + colormap_ci = colormap[ci]; + *nextrowerr = 0; /* need only initialize this one entry */ + for (col_counter = width; col_counter > 0; col_counter--) { + /* Compute pixel value + accumulated error for this component */ + val = (((FSERROR) GETJSAMPLE(*input_ptr)) << 4) + *thisrowerr; + if (val < 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; } - output_data[row][col] = (JSAMPLE) pixcode; - /* propagate error to adjacent pixels */ - for (ci = 0; ci < nc; ci++) { - val = thisrowerr[ci] - (FSERROR) GETJSAMPLE(colormap[ci][pixcode]); - thisrowerr[ci+nc] += val * 7; - nextrowerr[ci-nc] += val * 3; - nextrowerr[ci ] += val * 5; - nextrowerr[ci+nc] = val; /* not +=, since not initialized yet */ - } - thisrowerr += nc; /* advance error ptrs to next pixel entry */ - nextrowerr += nc; + /* Select output value, accumulate into output code for this pixel */ + pixcode = GETJSAMPLE(*output_ptr); + pixcode += GETJSAMPLE(colorindex_ci[val]); + *output_ptr = (JSAMPLE) pixcode; + /* Compute actual representation error at this pixel */ + /* Note: we can do this even though we don't yet have the final */ + /* value of pixcode, because the colormap is orthogonal. */ + val -= (FSERROR) GETJSAMPLE(colormap_ci[pixcode]); + /* Propagate error to (same component of) adjacent pixels */ + /* Remember that nextrowerr entries are in reverse order! */ + two_val = val * 2; + nextrowerr[-1] = val; /* not +=, since not initialized yet */ + val += two_val; /* form error * 3 */ + nextrowerr[ 1] += val; + val += two_val; /* form error * 5 */ + nextrowerr[ 0] += val; + val += two_val; /* form error * 7 */ + thisrowerr[ 1] += val; + input_ptr += dir; /* advance input ptr to next column */ + output_ptr += dir; /* advance output ptr to next column */ + thisrowerr++; /* cur-row error ptr advances to right */ + nextrowerr--; /* next-row error ptr advances to left */ } - on_odd_row = TRUE; } + on_odd_row = (on_odd_row ? FALSE : TRUE); } } @@ -325,15 +533,9 @@ color_quantize_dither (decompress_info_ptr cinfo, int num_rows, METHODDEF void color_quant_term (decompress_info_ptr cinfo) { - /* We can't free the colormap until now, since output module may use it! */ - (*cinfo->emethods->free_small_sarray) - (colormap, (long) cinfo->color_out_comps); - (*cinfo->emethods->free_small_sarray) - (colorindex, (long) cinfo->color_out_comps); - if (cinfo->use_dithering) { - (*cinfo->emethods->free_medium) ((void FAR *) evenrowerrs); - (*cinfo->emethods->free_medium) ((void FAR *) oddrowerrs); - } + /* no work (we let free_all release the workspace) */ + /* Note that we *mustn't* free the colormap before free_all, */ + /* since output module may use it! */ } @@ -344,7 +546,7 @@ color_quant_term (decompress_info_ptr cinfo) METHODDEF void color_quant_prescan (decompress_info_ptr cinfo, int num_rows, - JSAMPIMAGE image_data) + JSAMPIMAGE image_data, JSAMPARRAY workspace) { ERREXIT(cinfo->emethods, "Should not get here!"); } diff --git a/jquant2.c b/jquant2.c index 2569b206..cf3eab16 100644 --- a/jquant2.c +++ b/jquant2.c @@ -1,7 +1,7 @@ /* * jquant2.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,47 +16,1070 @@ /* - * Initialize for two-pass color quantization. + * This module implements the well-known Heckbert paradigm for color + * quantization. Most of the ideas used here can be traced back to + * Heckbert's seminal paper + * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", + * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. + * + * In the first pass over the image, we accumulate a histogram showing the + * usage count of each possible color. (To keep the histogram to a reasonable + * size, we reduce the precision of the input; typical practice is to retain + * 5 or 6 bits per color, so that 8 or 4 different input values are counted + * in the same histogram cell.) Next, the color-selection step begins with a + * box representing the whole color space, and repeatedly splits the "largest" + * remaining box until we have as many boxes as desired colors. Then the mean + * color in each remaining box becomes one of the possible output colors. + * The second pass over the image maps each input pixel to the closest output + * color (optionally after applying a Floyd-Steinberg dithering correction). + * This mapping is logically trivial, but making it go fast enough requires + * considerable care. + * + * Heckbert-style quantizers vary a good deal in their policies for choosing + * the "largest" box and deciding where to cut it. The particular policies + * used here have proved out well in experimental comparisons, but better ones + * may yet be found. + * + * The most significant difference between this quantizer and others is that + * this one is intended to operate in YCbCr colorspace, rather than RGB space + * as is usually done. Actually we work in scaled YCbCr colorspace, where + * Y distances are inflated by a factor of 2 relative to Cb or Cr distances. + * The empirical evidence is that distances in this space correspond to + * perceptual color differences more closely than do distances in RGB space; + * and working in this space is inexpensive within a JPEG decompressor, since + * the input data is already in YCbCr form. (We could transform to an even + * more perceptually linear space such as Lab or Luv, but that is very slow + * and doesn't yield much better results than scaled YCbCr.) */ -METHODDEF void -color_quant_init (decompress_info_ptr cinfo) -{ - TRACEMS(cinfo->emethods, 1, "color_quant_init 2 pass"); -} +#define Y_SCALE 2 /* scale Y distances up by this much */ + +#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ + + +/* + * First we have the histogram data structure and routines for creating it. + * + * For work in YCbCr space, it is useful to keep more precision for Y than + * for Cb or Cr. We recommend keeping 6 bits for Y and 5 bits each for Cb/Cr. + * If you have plenty of memory and cycles, 6 bits all around gives marginally + * better results; if you are short of memory, 5 bits all around will save + * some space but degrade the results. + * To maintain a fully accurate histogram, we'd need to allocate a "long" + * (preferably unsigned long) for each cell. In practice this is overkill; + * we can get by with 16 bits per cell. Few of the cell counts will overflow, + * and clamping those that do overflow to the maximum value will give close- + * enough results. This reduces the recommended histogram size from 256Kb + * to 128Kb, which is a useful savings on PC-class machines. + * (In the second pass the histogram space is re-used for pixel mapping data; + * in that capacity, each cell must be able to store zero to the number of + * desired colors. 16 bits/cell is plenty for that too.) + * Since the JPEG code is intended to run in small memory model on 80x86 + * machines, we can't just allocate the histogram in one chunk. Instead + * of a true 3-D array, we use a row of pointers to 2-D arrays. Each + * pointer corresponds to a Y value (typically 2^6 = 64 pointers) and + * each 2-D array has 2^5^2 = 1024 or 2^6^2 = 4096 entries. Note that + * on 80x86 machines, the pointer row is in near memory but the actual + * arrays are in far memory (same arrangement as we use for image arrays). + */ + +#ifndef HIST_Y_BITS /* so you can override from Makefile */ +#define HIST_Y_BITS 6 /* bits of precision in Y histogram */ +#endif +#ifndef HIST_C_BITS /* so you can override from Makefile */ +#define HIST_C_BITS 5 /* bits of precision in Cb/Cr histogram */ +#endif + +#define HIST_Y_ELEMS (1<emethods, 2, "color_quant_prescan %d rows", num_rows); + register JSAMPROW ptr0, ptr1, ptr2; + register histptr histp; + register int c0, c1, c2; + int row; + long col; + long width = cinfo->image_width; + + for (row = 0; row < num_rows; row++) { + ptr0 = image_data[0][row]; + ptr1 = image_data[1][row]; + ptr2 = image_data[2][row]; + for (col = width; col > 0; col--) { + /* get pixel value and index into the histogram */ + c0 = GETJSAMPLE(*ptr0++) >> Y_SHIFT; + c1 = GETJSAMPLE(*ptr1++) >> C_SHIFT; + c2 = GETJSAMPLE(*ptr2++) >> C_SHIFT; + histp = & histogram[c0][c1][c2]; + /* increment, check for overflow and undo increment if so. */ + /* We assume unsigned representation here! */ + if (++(*histp) == 0) + (*histp)--; + } + } } /* - * This routine makes the final pass over the image data. + * Now we have the really interesting routines: selection of a colormap + * given the completed histogram. + * These routines work with a list of "boxes", each representing a rectangular + * subset of the input color space (to histogram precision). + */ + +typedef struct { + /* The bounds of the box (inclusive); expressed as histogram indexes */ + int c0min, c0max; + int c1min, c1max; + int c2min, c2max; + /* The number of nonzero histogram cells within this box */ + long colorcount; + } box; +typedef box * boxptr; + +static boxptr boxlist; /* array with room for desired # of boxes */ +static int numboxes; /* number of boxes currently in boxlist */ + +static JSAMPARRAY my_colormap; /* the finished colormap (in YCbCr space) */ + + +LOCAL boxptr +find_biggest_color_pop (void) +/* Find the splittable box with the largest color population */ +/* Returns NULL if no splittable boxes remain */ +{ + register boxptr boxp; + register int i; + register long max = 0; + boxptr which = NULL; + + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { + if (boxp->colorcount > max) { + if (boxp->c0max > boxp->c0min || boxp->c1max > boxp->c1min || + boxp->c2max > boxp->c2min) { + which = boxp; + max = boxp->colorcount; + } + } + } + return which; +} + + +LOCAL boxptr +find_biggest_volume (void) +/* Find the splittable box with the largest (scaled) volume */ +/* Returns NULL if no splittable boxes remain */ +{ + register boxptr boxp; + register int i; + register INT32 max = 0; + register INT32 norm, c0,c1,c2; + boxptr which = NULL; + + /* We use 2-norm rather than real volume here. + * Some care is needed since the differences are expressed in + * histogram-cell units; if HIST_Y_BITS != HIST_C_BITS, we have to + * adjust the scaling to get the proper scaled-YCbCr-space distance. + * This code won't work right if HIST_Y_BITS < HIST_C_BITS, + * but that shouldn't ever be true. + * Note norm > 0 iff box is splittable, so need not check separately. + */ + + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { + c0 = (boxp->c0max - boxp->c0min) * Y_SCALE; + c1 = (boxp->c1max - boxp->c1min) << (HIST_Y_BITS-HIST_C_BITS); + c2 = (boxp->c2max - boxp->c2min) << (HIST_Y_BITS-HIST_C_BITS); + norm = c0*c0 + c1*c1 + c2*c2; + if (norm > max) { + which = boxp; + max = norm; + } + } + return which; +} + + +LOCAL void +update_box (boxptr boxp) +/* Shrink the min/max bounds of a box to enclose only nonzero elements, */ +/* and recompute its population */ +{ + histptr histp; + int c0,c1,c2; + int c0min,c0max,c1min,c1max,c2min,c2max; + long ccount; + + c0min = boxp->c0min; c0max = boxp->c0max; + c1min = boxp->c1min; c1max = boxp->c1max; + c2min = boxp->c2min; c2max = boxp->c2max; + + if (c0max > c0min) + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0min = c0min = c0; + goto have_c0min; + } + } + have_c0min: + if (c0max > c0min) + for (c0 = c0max; c0 >= c0min; c0--) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0max = c0max = c0; + goto have_c0max; + } + } + have_c0max: + if (c1max > c1min) + for (c1 = c1min; c1 <= c1max; c1++) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1min = c1min = c1; + goto have_c1min; + } + } + have_c1min: + if (c1max > c1min) + for (c1 = c1max; c1 >= c1min; c1--) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1max = c1max = c1; + goto have_c1max; + } + } + have_c1max: + if (c2max > c2min) + for (c2 = c2min; c2 <= c2max; c2++) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C_ELEMS) + if (*histp != 0) { + boxp->c2min = c2min = c2; + goto have_c2min; + } + } + have_c2min: + if (c2max > c2min) + for (c2 = c2max; c2 >= c2min; c2--) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C_ELEMS) + if (*histp != 0) { + boxp->c2max = c2max = c2; + goto have_c2max; + } + } + have_c2max: + + /* Now scan remaining volume of box and compute population */ + ccount = 0; + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++, histp++) + if (*histp != 0) { + ccount++; + } + } + boxp->colorcount = ccount; +} + + +LOCAL void +median_cut (int desired_colors) +/* Repeatedly select and split the largest box until we have enough boxes */ +{ + int n,lb; + int c0,c1,c2,cmax; + register boxptr b1,b2; + + while (numboxes < desired_colors) { + /* Select box to split */ + /* Current algorithm: by population for first half, then by volume */ + if (numboxes*2 <= desired_colors) { + b1 = find_biggest_color_pop(); + } else { + b1 = find_biggest_volume(); + } + if (b1 == NULL) /* no splittable boxes left! */ + break; + b2 = &boxlist[numboxes]; /* where new box will go */ + /* Copy the color bounds to the new box. */ + b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; + b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; + /* Choose which axis to split the box on. + * Current algorithm: longest scaled axis. + * See notes in find_biggest_volume about scaling... + */ + c0 = (b1->c0max - b1->c0min) * Y_SCALE; + c1 = (b1->c1max - b1->c1min) << (HIST_Y_BITS-HIST_C_BITS); + c2 = (b1->c2max - b1->c2min) << (HIST_Y_BITS-HIST_C_BITS); + cmax = c0; n = 0; + if (c1 > cmax) { cmax = c1; n = 1; } + if (c2 > cmax) { n = 2; } + /* Choose split point along selected axis, and update box bounds. + * Current algorithm: split at halfway point. + * (Since the box has been shrunk to minimum volume, + * any split will produce two nonempty subboxes.) + * Note that lb value is max for lower box, so must be < old max. + */ + switch (n) { + case 0: + lb = (b1->c0max + b1->c0min) / 2; + b1->c0max = lb; + b2->c0min = lb+1; + break; + case 1: + lb = (b1->c1max + b1->c1min) / 2; + b1->c1max = lb; + b2->c1min = lb+1; + break; + case 2: + lb = (b1->c2max + b1->c2min) / 2; + b1->c2max = lb; + b2->c2min = lb+1; + break; + } + /* Update stats for boxes */ + update_box(b1); + update_box(b2); + numboxes++; + } +} + + +LOCAL void +compute_color (boxptr boxp, int icolor) +/* Compute representative color for a box, put it in my_colormap[icolor] */ +{ + /* Current algorithm: mean weighted by pixels (not colors) */ + /* Note it is important to get the rounding correct! */ + histptr histp; + int c0,c1,c2; + int c0min,c0max,c1min,c1max,c2min,c2max; + long count; + long total = 0; + long c0total = 0; + long c1total = 0; + long c2total = 0; + + c0min = boxp->c0min; c0max = boxp->c0max; + c1min = boxp->c1min; c1max = boxp->c1max; + c2min = boxp->c2min; c2max = boxp->c2max; + + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) { + if ((count = *histp++) != 0) { + total += count; + c0total += ((c0 << Y_SHIFT) + ((1<>1)) * count; + c1total += ((c1 << C_SHIFT) + ((1<>1)) * count; + c2total += ((c2 << C_SHIFT) + ((1<>1)) * count; + } + } + } + + my_colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); + my_colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); + my_colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); +} + + +LOCAL void +remap_colormap (decompress_info_ptr cinfo) +/* Remap the internal colormap to the output colorspace */ +{ + /* This requires a little trickery since color_convert expects to + * deal with 3-D arrays (a 2-D sample array for each component). + * We must promote the colormaps into one-row 3-D arrays. + */ + short ci; + JSAMPARRAY input_hack[3]; + JSAMPARRAY output_hack[10]; /* assume no more than 10 output components */ + + for (ci = 0; ci < 3; ci++) + input_hack[ci] = &(my_colormap[ci]); + for (ci = 0; ci < cinfo->color_out_comps; ci++) + output_hack[ci] = &(cinfo->colormap[ci]); + + (*cinfo->methods->color_convert) (cinfo, 1, + (long) cinfo->actual_number_of_colors, + input_hack, output_hack); +} + + +LOCAL void +select_colors (decompress_info_ptr cinfo) +/* Master routine for color selection */ +{ + int desired = cinfo->desired_number_of_colors; + int i; + + /* Allocate workspace for box list */ + boxlist = (boxptr) (*cinfo->emethods->alloc_small) (desired * SIZEOF(box)); + /* Initialize one box containing whole space */ + numboxes = 1; + boxlist[0].c0min = 0; + boxlist[0].c0max = MAXJSAMPLE >> Y_SHIFT; + boxlist[0].c1min = 0; + boxlist[0].c1max = MAXJSAMPLE >> C_SHIFT; + boxlist[0].c2min = 0; + boxlist[0].c2max = MAXJSAMPLE >> C_SHIFT; + /* Shrink it to actually-used volume and set its statistics */ + update_box(& boxlist[0]); + /* Perform median-cut to produce final box list */ + median_cut(desired); + /* Compute the representative color for each box, fill my_colormap[] */ + for (i = 0; i < numboxes; i++) + compute_color(& boxlist[i], i); + cinfo->actual_number_of_colors = numboxes; + /* Produce an output colormap in the desired output colorspace */ + remap_colormap(cinfo); + TRACEMS1(cinfo->emethods, 1, "Selected %d colors for quantization", + numboxes); + /* Done with the box list */ + (*cinfo->emethods->free_small) ((void *) boxlist); +} + + +/* + * These routines are concerned with the time-critical task of mapping input + * colors to the nearest color in the selected colormap. + * + * We re-use the histogram space as an "inverse color map", essentially a + * cache for the results of nearest-color searches. All colors within a + * histogram cell will be mapped to the same colormap entry, namely the one + * closest to the cell's center. This may not be quite the closest entry to + * the actual input color, but it's almost as good. A zero in the cache + * indicates we haven't found the nearest color for that cell yet; the array + * is cleared to zeroes before starting the mapping pass. When we find the + * nearest color for a cell, its colormap index plus one is recorded in the + * cache for future use. The pass2 scanning routines call fill_inverse_cmap + * when they need to use an unfilled entry in the cache. + * + * Our method of efficiently finding nearest colors is based on the "locally + * sorted search" idea described by Heckbert and on the incremental distance + * calculation described by Spencer W. Thomas in chapter III.1 of Graphics + * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that + * the distances from a given colormap entry to each cell of the histogram can + * be computed quickly using an incremental method: the differences between + * distances to adjacent cells themselves differ by a constant. This allows a + * fairly fast implementation of the "brute force" approach of computing the + * distance from every colormap entry to every histogram cell. Unfortunately, + * it needs a work array to hold the best-distance-so-far for each histogram + * cell (because the inner loop has to be over cells, not colormap entries). + * The work array elements have to be INT32s, so the work array would need + * 256Kb at our recommended precision. This is not feasible in DOS machines. + * Another disadvantage of the brute force approach is that it computes + * distances to every cell of the cubical histogram. When working with YCbCr + * input, only about a quarter of the cube represents realizable colors, so + * many of the cells will never be used and filling them is wasted effort. + * + * To get around these problems, we apply Thomas' method to compute the + * nearest colors for only the cells within a small subbox of the histogram. + * The work array need be only as big as the subbox, so the memory usage + * problem is solved. A subbox is processed only when some cell in it is + * referenced by the pass2 routines, so we will never bother with cells far + * outside the realizable color volume. An additional advantage of this + * approach is that we can apply Heckbert's locality criterion to quickly + * eliminate colormap entries that are far away from the subbox; typically + * three-fourths of the colormap entries are rejected by Heckbert's criterion, + * and we need not compute their distances to individual cells in the subbox. + * The speed of this approach is heavily influenced by the subbox size: too + * small means too much overhead, too big loses because Heckbert's criterion + * can't eliminate as many colormap entries. Empirically the best subbox + * size seems to be about 1/512th of the histogram (1/8th in each direction). + * + * Thomas' article also describes a refined method which is asymptotically + * faster than the brute-force method, but it is also far more complex and + * cannot efficiently be applied to small subboxes. It is therefore not + * useful for programs intended to be portable to DOS machines. On machines + * with plenty of memory, filling the whole histogram in one shot with Thomas' + * refined method might be faster than the present code --- but then again, + * it might not be any faster, and it's certainly more complicated. + */ + + +#ifndef BOX_Y_LOG /* so you can override from Makefile */ +#define BOX_Y_LOG (HIST_Y_BITS-3) /* log2(hist cells in update box, Y axis) */ +#endif +#ifndef BOX_C_LOG /* so you can override from Makefile */ +#define BOX_C_LOG (HIST_C_BITS-3) /* log2(hist cells in update box, C axes) */ +#endif + +#define BOX_Y_ELEMS (1<actual_number_of_colors; + int maxc0, maxc1, maxc2; + int centerc0, centerc1, centerc2; + int i, x, ncolors; + INT32 minmaxdist, min_dist, max_dist, tdist; + INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ + + /* Compute true coordinates of update box's upper corner and center. + * Actually we compute the coordinates of the center of the upper-corner + * histogram cell, which are the upper bounds of the volume we care about. + * Note that since ">>" rounds down, the "center" values may be closer to + * min than to max; hence comparisons to them must be "<=", not "<". + */ + maxc0 = minc0 + ((1 << BOX_Y_SHIFT) - (1 << Y_SHIFT)); + centerc0 = (minc0 + maxc0) >> 1; + maxc1 = minc1 + ((1 << BOX_C_SHIFT) - (1 << C_SHIFT)); + centerc1 = (minc1 + maxc1) >> 1; + maxc2 = minc2 + ((1 << BOX_C_SHIFT) - (1 << C_SHIFT)); + centerc2 = (minc2 + maxc2) >> 1; + + /* For each color in colormap, find: + * 1. its minimum squared-distance to any point in the update box + * (zero if color is within update box); + * 2. its maximum squared-distance to any point in the update box. + * Both of these can be found by considering only the corners of the box. + * We save the minimum distance for each color in mindist[]; + * only the smallest maximum distance is of interest. + * Note we have to scale Y to get correct distance in scaled space. + */ + minmaxdist = 0x7FFFFFFFL; + + for (i = 0; i < numcolors; i++) { + /* We compute the squared-c0-distance term, then add in the other two. */ + x = GETJSAMPLE(my_colormap[0][i]); + if (x < minc0) { + tdist = (x - minc0) * Y_SCALE; + min_dist = tdist*tdist; + tdist = (x - maxc0) * Y_SCALE; + max_dist = tdist*tdist; + } else if (x > maxc0) { + tdist = (x - maxc0) * Y_SCALE; + min_dist = tdist*tdist; + tdist = (x - minc0) * Y_SCALE; + max_dist = tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + min_dist = 0; + if (x <= centerc0) { + tdist = (x - maxc0) * Y_SCALE; + max_dist = tdist*tdist; + } else { + tdist = (x - minc0) * Y_SCALE; + max_dist = tdist*tdist; + } + } + + x = GETJSAMPLE(my_colormap[1][i]); + if (x < minc1) { + tdist = x - minc1; + min_dist += tdist*tdist; + tdist = x - maxc1; + max_dist += tdist*tdist; + } else if (x > maxc1) { + tdist = x - maxc1; + min_dist += tdist*tdist; + tdist = x - minc1; + max_dist += tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + if (x <= centerc1) { + tdist = x - maxc1; + max_dist += tdist*tdist; + } else { + tdist = x - minc1; + max_dist += tdist*tdist; + } + } + + x = GETJSAMPLE(my_colormap[2][i]); + if (x < minc2) { + tdist = x - minc2; + min_dist += tdist*tdist; + tdist = x - maxc2; + max_dist += tdist*tdist; + } else if (x > maxc2) { + tdist = x - maxc2; + min_dist += tdist*tdist; + tdist = x - minc2; + max_dist += tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + if (x <= centerc2) { + tdist = x - maxc2; + max_dist += tdist*tdist; + } else { + tdist = x - minc2; + max_dist += tdist*tdist; + } + } + + mindist[i] = min_dist; /* save away the results */ + if (max_dist < minmaxdist) + minmaxdist = max_dist; + } + + /* Now we know that no cell in the update box is more than minmaxdist + * away from some colormap entry. Therefore, only colors that are + * within minmaxdist of some part of the box need be considered. + */ + ncolors = 0; + for (i = 0; i < numcolors; i++) { + if (mindist[i] <= minmaxdist) + colorlist[ncolors++] = (JSAMPLE) i; + } + return ncolors; +} + + +LOCAL void +find_best_colors (decompress_info_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, + * given the list of candidate colors prepared by find_nearby_colors. + * Return the indexes of the closest entries in the bestcolor[] array. + * This routine uses Thomas' incremental distance calculation method to + * find the distance from a colormap entry to successive cells in the box. + */ +{ + int ic0, ic1, ic2; + int i, icolor; + register INT32 * bptr; /* pointer into bestdist[] array */ + JSAMPLE * cptr; /* pointer into bestcolor[] array */ + INT32 dist0, dist1; /* initial distance values */ + register INT32 dist2; /* current distance in inner loop */ + INT32 xx0, xx1; /* distance increments */ + register INT32 xx2; + INT32 inc0, inc1, inc2; /* initial values for increments */ + /* This array holds the distance to the nearest-so-far color for each cell */ + INT32 bestdist[BOX_Y_ELEMS * BOX_C_ELEMS * BOX_C_ELEMS]; + + /* Initialize best-distance for each cell of the update box */ + bptr = bestdist; + for (i = BOX_Y_ELEMS*BOX_C_ELEMS*BOX_C_ELEMS-1; i >= 0; i--) + *bptr++ = 0x7FFFFFFFL; + + /* For each color selected by find_nearby_colors, + * compute its distance to the center of each cell in the box. + * If that's less than best-so-far, update best distance and color number. + * Note we have to scale Y to get correct distance in scaled space. + */ + + /* Nominal steps between cell centers ("x" in Thomas article) */ +#define STEP_Y ((1 << Y_SHIFT) * Y_SCALE) +#define STEP_C (1 << C_SHIFT) + + for (i = 0; i < numcolors; i++) { + icolor = GETJSAMPLE(colorlist[i]); + /* Compute (square of) distance from minc0/c1/c2 to this color */ + inc0 = (minc0 - (int) GETJSAMPLE(my_colormap[0][icolor])) * Y_SCALE; + dist0 = inc0*inc0; + inc1 = minc1 - (int) GETJSAMPLE(my_colormap[1][icolor]); + dist0 += inc1*inc1; + inc2 = minc2 - (int) GETJSAMPLE(my_colormap[2][icolor]); + dist0 += inc2*inc2; + /* Form the initial difference increments */ + inc0 = inc0 * (2 * STEP_Y) + STEP_Y * STEP_Y; + inc1 = inc1 * (2 * STEP_C) + STEP_C * STEP_C; + inc2 = inc2 * (2 * STEP_C) + STEP_C * STEP_C; + /* Now loop over all cells in box, updating distance per Thomas method */ + bptr = bestdist; + cptr = bestcolor; + xx0 = inc0; + for (ic0 = BOX_Y_ELEMS-1; ic0 >= 0; ic0--) { + dist1 = dist0; + xx1 = inc1; + for (ic1 = BOX_C_ELEMS-1; ic1 >= 0; ic1--) { + dist2 = dist1; + xx2 = inc2; + for (ic2 = BOX_C_ELEMS-1; ic2 >= 0; ic2--) { + if (dist2 < *bptr) { + *bptr = dist2; + *cptr = (JSAMPLE) icolor; + } + dist2 += xx2; + xx2 += 2 * STEP_C * STEP_C; + bptr++; + cptr++; + } + dist1 += xx1; + xx1 += 2 * STEP_C * STEP_C; + } + dist0 += xx0; + xx0 += 2 * STEP_Y * STEP_Y; + } + } +} + + +LOCAL void +fill_inverse_cmap (decompress_info_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 */ +/* we can fill as many others as we wish.) */ +{ + int minc0, minc1, minc2; /* lower left corner of update box */ + int ic0, ic1, ic2; + register JSAMPLE * cptr; /* pointer into bestcolor[] array */ + register histptr cachep; /* pointer into main cache array */ + /* This array lists the candidate colormap indexes. */ + JSAMPLE colorlist[MAXNUMCOLORS]; + int numcolors; /* number of candidate colors */ + /* This array holds the actually closest colormap index for each cell. */ + JSAMPLE bestcolor[BOX_Y_ELEMS * BOX_C_ELEMS * BOX_C_ELEMS]; + + /* Convert cell coordinates to update box ID */ + c0 >>= BOX_Y_LOG; + c1 >>= BOX_C_LOG; + c2 >>= BOX_C_LOG; + + /* Compute true coordinates of update box's origin corner. + * Actually we compute the coordinates of the center of the corner + * histogram cell, which are the lower bounds of the volume we care about. + */ + minc0 = (c0 << BOX_Y_SHIFT) + ((1 << Y_SHIFT) >> 1); + minc1 = (c1 << BOX_C_SHIFT) + ((1 << C_SHIFT) >> 1); + minc2 = (c2 << BOX_C_SHIFT) + ((1 << C_SHIFT) >> 1); + + /* Determine which colormap entries are close enough to be candidates + * for the nearest entry to some cell in the update box. + */ + numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist); + + /* Determine the actually nearest colors. */ + find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, + bestcolor); + + /* Save the best color numbers (plus 1) in the main cache array */ + c0 <<= BOX_Y_LOG; /* convert ID back to base cell indexes */ + c1 <<= BOX_C_LOG; + c2 <<= BOX_C_LOG; + cptr = bestcolor; + for (ic0 = 0; ic0 < BOX_Y_ELEMS; ic0++) { + for (ic1 = 0; ic1 < BOX_C_ELEMS; ic1++) { + cachep = & histogram[c0+ic0][c1+ic1][c2]; + for (ic2 = 0; ic2 < BOX_C_ELEMS; ic2++) { + *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); + } + } + } +} + + +/* + * These routines perform second-pass scanning of the image: map each pixel to + * the proper colormap index, and output the indexes to the output file. + * * output_workspace is a one-component array of pixel dimensions at least * as large as the input image strip; it can be used to hold the converted * pixels' colormap indexes. */ METHODDEF void -final_pass (decompress_info_ptr cinfo, int num_rows, - JSAMPIMAGE image_data, JSAMPARRAY output_workspace) +pass2_nodither (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE image_data, JSAMPARRAY output_workspace) +/* This version performs no dithering */ { - TRACEMS1(cinfo->emethods, 2, "final_pass %d rows", num_rows); - /* for debug purposes, just emit input data */ - /* NB: this only works for PPM output */ - (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, image_data); + register JSAMPROW ptr0, ptr1, ptr2, outptr; + register histptr cachep; + register int c0, c1, c2; + int row; + long col; + long width = cinfo->image_width; + + /* Convert data to colormap indexes, which we save in output_workspace */ + for (row = 0; row < num_rows; row++) { + ptr0 = image_data[0][row]; + ptr1 = image_data[1][row]; + ptr2 = image_data[2][row]; + outptr = output_workspace[row]; + for (col = width; col > 0; col--) { + /* get pixel value and index into the cache */ + c0 = GETJSAMPLE(*ptr0++) >> Y_SHIFT; + c1 = GETJSAMPLE(*ptr1++) >> C_SHIFT; + c2 = GETJSAMPLE(*ptr2++) >> C_SHIFT; + cachep = & histogram[c0][c1][c2]; + /* If we have not seen this color before, find nearest colormap entry */ + /* and update the cache */ + if (*cachep == 0) + fill_inverse_cmap(cinfo, c0,c1,c2); + /* Now emit the colormap index for this cell */ + *outptr++ = (JSAMPLE) (*cachep - 1); + } + } + /* Emit converted rows to the output file */ + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, &output_workspace); +} + + +/* Declarations for Floyd-Steinberg dithering. + * + * Errors are accumulated into the arrays evenrowerrs[] and oddrowerrs[]. + * These have resolutions of 1/16th of a pixel count. The error at a given + * pixel is propagated to its unprocessed neighbors using the standard F-S + * fractions, + * ... (here) 7/16 + * 3/16 5/16 1/16 + * We work left-to-right on even rows, right-to-left on odd rows. + * + * Each of the arrays has (#columns + 2) entries; the extra entry + * at each end saves us from special-casing the first and last pixels. + * Each entry is three values long. + * In evenrowerrs[], the entries for a component are stored left-to-right, but + * in oddrowerrs[] they are stored right-to-left. This means we always + * process the current row's error entries in increasing order and the next + * row's error entries in decreasing order, regardless of whether we are + * working L-to-R or R-to-L in the pixel data! + * + * Note: on a wide image, we might not have enough room in a PC's near data + * segment to hold the error arrays; so they are allocated with alloc_medium. + */ + +#ifdef EIGHT_BIT_SAMPLES +typedef INT16 FSERROR; /* 16 bits should be enough */ +#else +typedef INT32 FSERROR; /* may need more than 16 bits? */ +#endif + +typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ + +static FSERRPTR evenrowerrs, oddrowerrs; /* current-row and next-row errors */ +static boolean on_odd_row; /* flag to remember which row we are on */ + + +METHODDEF void +pass2_dither (decompress_info_ptr cinfo, int num_rows, + JSAMPIMAGE image_data, JSAMPARRAY output_workspace) +/* This version performs Floyd-Steinberg dithering */ +{ + register FSERROR val; + register FSERRPTR thisrowerr, nextrowerr; + register FSERROR c0, c1, c2; + register int pixcode; + JSAMPROW ptr0, ptr1, ptr2, outptr; + histptr cachep; + int dir; + long col; + int row; + long width = cinfo->image_width; + + /* Convert data to colormap indexes, which we save in output_workspace */ + for (row = 0; row < num_rows; row++) { + ptr0 = image_data[0][row]; + ptr1 = image_data[1][row]; + ptr2 = image_data[2][row]; + outptr = output_workspace[row]; + if (on_odd_row) { + /* work right to left in this row */ + ptr0 += width - 1; + ptr1 += width - 1; + ptr2 += width - 1; + outptr += width - 1; + dir = -1; + thisrowerr = oddrowerrs + 3; + nextrowerr = evenrowerrs + width*3; + on_odd_row = FALSE; /* flip for next time */ + } else { + /* work left to right in this row */ + dir = 1; + thisrowerr = evenrowerrs + 3; + nextrowerr = oddrowerrs + width*3; + on_odd_row = TRUE; /* flip for next time */ + } + /* need only initialize this one entry in nextrowerr */ + nextrowerr[0] = nextrowerr[1] = nextrowerr[2] = 0; + for (col = width; col > 0; col--) { + /* Get this pixel's value and add accumulated errors */ + /* The errors are in units of 1/16th pixel value */ + val = (GETJSAMPLE(*ptr0) << 4) + thisrowerr[0]; + if (val <= 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; + } + c0 = val; + val = (GETJSAMPLE(*ptr1) << 4) + thisrowerr[1]; + if (val <= 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; + } + c1 = val; + val = (GETJSAMPLE(*ptr2) << 4) + thisrowerr[2]; + if (val <= 0) val = 0; /* must watch for range overflow! */ + else { + val += 8; /* divide by 16 with proper rounding */ + val >>= 4; + if (val > MAXJSAMPLE) val = MAXJSAMPLE; + } + c2 = val; + /* Index into the cache with adjusted value */ + cachep = & histogram[c0 >> Y_SHIFT][c1 >> C_SHIFT][c2 >> C_SHIFT]; + /* If we have not seen this color before, find nearest colormap */ + /* entry and update the cache */ + if (*cachep == 0) + fill_inverse_cmap(cinfo, c0 >> Y_SHIFT, c1 >> C_SHIFT, c2 >> C_SHIFT); + /* Now emit the colormap index for this cell */ + pixcode = *cachep - 1; + *outptr = (JSAMPLE) pixcode; + /* Compute representation error for this pixel */ + c0 -= (FSERROR) GETJSAMPLE(my_colormap[0][pixcode]); + c1 -= (FSERROR) GETJSAMPLE(my_colormap[1][pixcode]); + c2 -= (FSERROR) GETJSAMPLE(my_colormap[2][pixcode]); + /* Propagate error to adjacent pixels */ + /* Remember that nextrowerr entries are in reverse order! */ + val = c0 * 2; + nextrowerr[0-3] = c0; /* not +=, since not initialized yet */ + c0 += val; /* form error * 3 */ + nextrowerr[0+3] += c0; + c0 += val; /* form error * 5 */ + nextrowerr[0 ] += c0; + c0 += val; /* form error * 7 */ + thisrowerr[0+3] += c0; + val = c1 * 2; + nextrowerr[1-3] = c1; /* not +=, since not initialized yet */ + c1 += val; /* form error * 3 */ + nextrowerr[1+3] += c1; + c1 += val; /* form error * 5 */ + nextrowerr[1 ] += c1; + c1 += val; /* form error * 7 */ + thisrowerr[1+3] += c1; + val = c2 * 2; + nextrowerr[2-3] = c2; /* not +=, since not initialized yet */ + c2 += val; /* form error * 3 */ + nextrowerr[2+3] += c2; + c2 += val; /* form error * 5 */ + nextrowerr[2 ] += c2; + c2 += val; /* form error * 7 */ + thisrowerr[2+3] += c2; + /* Advance to next column */ + ptr0 += dir; + ptr1 += dir; + ptr2 += dir; + outptr += dir; + thisrowerr += 3; /* cur-row error ptr advances to right */ + nextrowerr -= 3; /* next-row error ptr advances to left */ + } + } + /* Emit converted rows to the output file */ + (*cinfo->methods->put_pixel_rows) (cinfo, num_rows, &output_workspace); +} + + +/* + * Initialize for two-pass color quantization. + */ + +METHODDEF void +color_quant_init (decompress_info_ptr cinfo) +{ + int i; + + /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */ + if (cinfo->desired_number_of_colors < 8) + ERREXIT(cinfo->emethods, "Cannot request less than 8 quantized colors"); + /* Make sure colormap indexes can be represented by JSAMPLEs */ + if (cinfo->desired_number_of_colors > MAXNUMCOLORS) + ERREXIT1(cinfo->emethods, "Cannot request more than %d quantized colors", + MAXNUMCOLORS); + + /* Allocate and zero the histogram */ + histogram = (hist3d) (*cinfo->emethods->alloc_small) + (HIST_Y_ELEMS * SIZEOF(hist2d)); + for (i = 0; i < HIST_Y_ELEMS; i++) { + histogram[i] = (hist2d) (*cinfo->emethods->alloc_medium) + (HIST_C_ELEMS*HIST_C_ELEMS * SIZEOF(histcell)); + jzero_far((void FAR *) histogram[i], + HIST_C_ELEMS*HIST_C_ELEMS * SIZEOF(histcell)); + } + + /* Allocate storage for the internal and external colormaps. */ + /* We do this now since it is FAR storage and may affect the memory */ + /* manager's space calculations. */ + my_colormap = (*cinfo->emethods->alloc_small_sarray) + ((long) cinfo->desired_number_of_colors, + (long) 3); + cinfo->colormap = (*cinfo->emethods->alloc_small_sarray) + ((long) cinfo->desired_number_of_colors, + (long) cinfo->color_out_comps); + + /* Allocate Floyd-Steinberg workspace if necessary */ + /* This isn't needed until pass 2, but again it is FAR storage. */ + if (cinfo->use_dithering) { + size_t arraysize = (size_t) ((cinfo->image_width + 2L) * 3L * SIZEOF(FSERROR)); + + evenrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + oddrowerrs = (FSERRPTR) (*cinfo->emethods->alloc_medium) (arraysize); + /* we only need to zero the forward contribution for current row. */ + jzero_far((void FAR *) evenrowerrs, arraysize); + on_odd_row = FALSE; + } + + /* Indicate number of passes needed, excluding the prescan pass. */ + cinfo->total_passes++; /* I always use one pass */ } @@ -73,8 +1096,24 @@ final_pass (decompress_info_ptr cinfo, int num_rows, METHODDEF void color_quant_doit (decompress_info_ptr cinfo, quantize_caller_ptr source_method) { - TRACEMS(cinfo->emethods, 1, "color_quant_doit 2 pass"); - (*source_method) (cinfo, final_pass); + int i; + + /* Select the representative colors */ + select_colors(cinfo); + /* Pass the external colormap to the output module. */ + /* NB: the output module may continue to use the colormap until shutdown. */ + (*cinfo->methods->put_color_map) (cinfo, cinfo->actual_number_of_colors, + cinfo->colormap); + /* Re-zero the histogram so pass 2 can use it as nearest-color cache */ + for (i = 0; i < HIST_Y_ELEMS; i++) { + jzero_far((void FAR *) histogram[i], + HIST_C_ELEMS*HIST_C_ELEMS * SIZEOF(histcell)); + } + /* Perform pass 2 */ + if (cinfo->use_dithering) + (*source_method) (cinfo, pass2_dither); + else + (*source_method) (cinfo, pass2_nodither); } @@ -85,7 +1124,9 @@ color_quant_doit (decompress_info_ptr cinfo, quantize_caller_ptr source_method) METHODDEF void color_quant_term (decompress_info_ptr cinfo) { - TRACEMS(cinfo->emethods, 1, "color_quant_term 2 pass"); + /* no work (we let free_all release the histogram/cache and colormaps) */ + /* Note that we *mustn't* free the external colormap before free_all, */ + /* since output module may use it! */ } @@ -110,7 +1151,9 @@ GLOBAL void jsel2quantize (decompress_info_ptr cinfo) { if (cinfo->two_pass_quantize) { - /* just one alternative for the moment */ + /* Make sure jdmaster didn't give me a case I can't handle */ + if (cinfo->num_components != 3 || cinfo->jpeg_color_space != CS_YCbCr) + ERREXIT(cinfo->emethods, "2-pass quantization only handles YCbCr input"); cinfo->methods->color_quant_init = color_quant_init; cinfo->methods->color_quant_prescan = color_quant_prescan; cinfo->methods->color_quant_doit = color_quant_doit; diff --git a/jrdgif.c b/jrdgif.c index 7b6bd6d4..f484da83 100644 --- a/jrdgif.c +++ b/jrdgif.c @@ -1,7 +1,7 @@ /* * jrdgif.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 @@ static JSAMPARRAY colormap; /* the colormap to use */ #define INTERLACE 0x40 /* mask for bit signifying interlaced image */ #define COLORMAPFLAG 0x80 /* mask for bit signifying colormap presence */ -#define ReadOK(file,buffer,len) (FREAD(file,buffer,len) == ((size_t) (len))) +#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) /* Static vars for GetCode and LZWReadByte */ @@ -459,6 +459,7 @@ input_init (compress_info_ptr cinfo) interlaced_image = (*cinfo->emethods->request_big_sarray) ((long) width, (long) height, 1L); cinfo->methods->get_input_row = load_interlaced_image; + cinfo->total_passes++; /* count file reading as separate pass */ } /* Return info about the image. */ @@ -466,7 +467,7 @@ input_init (compress_info_ptr cinfo) cinfo->in_color_space = CS_RGB; cinfo->image_width = width; cinfo->image_height = height; - cinfo->data_precision = 8; + cinfo->data_precision = 8; /* always, even if 12-bit JSAMPLEs */ } @@ -513,6 +514,7 @@ load_interlaced_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) /* Read the interlaced image into the big array we've created. */ for (row = 0; row < cinfo->image_height; row++) { + (*cinfo->methods->progress_monitor) (cinfo, row, cinfo->image_height); image_ptr = (*cinfo->emethods->access_big_sarray) (interlaced_image, row, TRUE); sptr = image_ptr[0]; @@ -522,6 +524,7 @@ load_interlaced_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) *sptr++ = (JSAMPLE) c; } } + cinfo->completed_passes++; /* Replace method pointer so subsequent calls don't come here. */ cinfo->methods->get_input_row = get_interlaced_row; @@ -590,14 +593,7 @@ get_interlaced_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) METHODDEF void input_term (compress_info_ptr cinfo) { - if (is_interlaced) { - (*cinfo->emethods->free_big_sarray) (interlaced_image); - } - (*cinfo->emethods->free_small_sarray) - (colormap, (long) NUMCOLORS); - (*cinfo->emethods->free_medium) ((void FAR *) symbol_head); - (*cinfo->emethods->free_medium) ((void FAR *) symbol_tail); - (*cinfo->emethods->free_medium) ((void FAR *) symbol_stack); + /* no work (we let free_all release the workspace) */ } diff --git a/jrdjfif.c b/jrdjfif.c index 0729b676..dc4b6468 100644 --- a/jrdjfif.c +++ b/jrdjfif.c @@ -1,23 +1,25 @@ /* * jrdjfif.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * * This file contains routines to decode standard JPEG file headers/markers. - * This will handle baseline and JFIF-convention JPEG files. + * This code will handle "raw JPEG" and JFIF-convention JPEG files. + * + * You can also use this module to decode a raw-JPEG or JFIF-standard data + * stream that is embedded within a larger file. To do that, you must + * position the file to the JPEG SOI marker (0xFF/0xD8) that begins the + * data sequence to be decoded. If nothing better is possible, you can scan + * the file until you see the SOI marker, then use JUNGETC to push it back. * * This module relies on the JGETC macro and the read_jpeg_data method (which * is provided by the user interface) to read from the JPEG data stream. - * Therefore, this module is NOT dependent on any particular assumption about - * the data source. This fact does not carry over to more complex JPEG file - * formats such as JPEG-in-TIFF; those format control modules may well need to - * assume stdio input. - * - * read_file_header assumes that reading begins at the JPEG SOI marker - * (although it will skip non-FF bytes looking for a JPEG marker). - * The user interface must position the data stream appropriately. + * Therefore, this module is not dependent on any particular assumption about + * the data source; it need not be a stdio stream at all. (This fact does + * NOT carry over to more complex JPEG file formats such as JPEG-in-TIFF; + * those format control modules may well need to assume stdio input.) * * These routines are invoked via the methods read_file_header, * read_scan_header, read_jpeg_data, read_scan_trailer, and read_file_trailer. @@ -100,9 +102,9 @@ read_jpeg_data (decompress_info_ptr cinfo) { cinfo->next_input_byte = cinfo->input_buffer + MIN_UNGET; - cinfo->bytes_in_buffer = (int) FREAD(cinfo->input_file, - cinfo->next_input_byte, - JPEG_BUF_SIZE); + cinfo->bytes_in_buffer = (int) JFREAD(cinfo->input_file, + cinfo->next_input_byte, + JPEG_BUF_SIZE); if (cinfo->bytes_in_buffer <= 0) ERREXIT(cinfo->emethods, "Unexpected EOF in JPEG file"); @@ -591,11 +593,15 @@ read_file_header (decompress_info_ptr cinfo) { int c; - /* Expect an SOI marker first */ - if (next_marker(cinfo) == M_SOI) - get_soi(cinfo); - else - ERREXIT(cinfo->emethods, "File does not start with JPEG SOI marker"); + /* Demand an SOI marker at the start of the file --- otherwise it's + * probably not a JPEG file at all. If the user interface wants to support + * nonstandard headers in front of the SOI, it must skip over them itself + * before calling jpeg_decompress(). + */ + if (JGETC(cinfo) != 0xFF || JGETC(cinfo) != M_SOI) + ERREXIT(cinfo->emethods, "Not a JPEG file"); + + get_soi(cinfo); /* OK, process SOI */ /* Process markers until SOF */ c = process_tables(cinfo); diff --git a/jrdppm.c b/jrdppm.c index f10e0f63..7f38048a 100644 --- a/jrdppm.c +++ b/jrdppm.c @@ -1,7 +1,7 @@ /* * jrdppm.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -301,8 +301,7 @@ input_init (compress_info_ptr cinfo) METHODDEF void input_term (compress_info_ptr cinfo) { - if (rescale != NULL) - (*cinfo->emethods->free_small) ((void *) rescale); + /* no work (we let free_all release the workspace) */ } diff --git a/jrdrle.c b/jrdrle.c index 0571d2cd..fe4779ba 100644 --- a/jrdrle.c +++ b/jrdrle.c @@ -1,7 +1,7 @@ /* * jrdrle.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -157,6 +157,8 @@ input_init (compress_info_ptr cinfo) cinfo->input_components = 3; break; } + + cinfo->total_passes++; /* count file reading as separate pass */ } @@ -282,6 +284,7 @@ load_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) case GRAYSCALE: case PSEUDOCOLOR: for (row = 0; row < cinfo->image_height; row++) { + (*cinfo->methods->progress_monitor) (cinfo, row, cinfo->image_height); /* * Read a row of the image directly into our big array. * Too bad this doesn't seem to return any indication of errors :-(. @@ -294,6 +297,7 @@ load_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) case TRUECOLOR: case DIRECTCOLOR: for (row = 0; row < cinfo->image_height; row++) { + (*cinfo->methods->progress_monitor) (cinfo, row, cinfo->image_height); /* * Read a row of the image directly into our big arrays. * Too bad this doesn't seem to return any indication of errors :-(. @@ -308,6 +312,7 @@ load_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) } break; } + cinfo->completed_passes++; /* Set up to call proper row-extraction routine in future */ switch (visual) { @@ -338,18 +343,7 @@ load_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) METHODDEF void input_term (compress_info_ptr cinfo) { - switch (visual) { - case GRAYSCALE: - case PSEUDOCOLOR: - (*cinfo->emethods->free_big_sarray) (image); - break; - case TRUECOLOR: - case DIRECTCOLOR: - (*cinfo->emethods->free_big_sarray) (red_channel); - (*cinfo->emethods->free_big_sarray) (green_channel); - (*cinfo->emethods->free_big_sarray) (blue_channel); - break; - } + /* no work (we let free_all release the workspace) */ } diff --git a/jrdtarga.c b/jrdtarga.c index b8aa0332..3e35223c 100644 --- a/jrdtarga.c +++ b/jrdtarga.c @@ -1,7 +1,7 @@ /* * jrdtarga.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -41,7 +41,7 @@ typedef char U_CHAR; #endif /* HAVE_UNSIGNED_CHAR */ -#define ReadOK(file,buffer,len) (FREAD(file,buffer,len) == ((size_t) (len))) +#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) static JSAMPARRAY colormap; /* Targa colormap (converted to my format) */ @@ -242,34 +242,14 @@ get_24bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) } } -METHODDEF void -get_32bit_row (compress_info_ptr cinfo, JSAMPARRAY pixel_row) -/* This version is for reading 32-bit pixels */ -/* Attribute bits are ignored for now */ -{ - register JSAMPROW ptr0, ptr1, ptr2; - register long col; - -/* NOTE: there seems to be considerable confusion over whether the order - * of the bytes in a 32-bit Targa file is A,B,G,R or B,G,R,A. - * On Lee Crocker's authority, we think the attribute byte comes first. - * Make ATTR_BYTE_FIRST be 0 if you have files in which it comes last. +/* + * Targa also defines a 32-bit pixel format with order B,G,R,A. + * We presently ignore the attribute byte, so the code for reading + * these pixels is identical to the 24-bit routine above. + * This works because the actual pixel length is only known to read_pixel. */ -#ifndef ATTR_BYTE_FIRST /* so you can say -DATTR_BYTE_FIRST=0 in Makefile */ -#define ATTR_BYTE_FIRST 1 /* must be 0 or 1 */ -#endif - - ptr0 = pixel_row[0]; - ptr1 = pixel_row[1]; - ptr2 = pixel_row[2]; - for (col = cinfo->image_width; col > 0; col--) { - (*read_pixel) (cinfo); /* Load next pixel into tga_pixel */ - /* convert ABGR (or BGRA) to RGB order */ - *ptr0++ = (JSAMPLE) UCH(tga_pixel[2+ATTR_BYTE_FIRST]); - *ptr1++ = (JSAMPLE) UCH(tga_pixel[1+ATTR_BYTE_FIRST]); - *ptr2++ = (JSAMPLE) UCH(tga_pixel[0+ATTR_BYTE_FIRST]); - } -} + +#define get_32bit_row get_24bit_row /* @@ -314,10 +294,13 @@ preload_image (compress_info_ptr cinfo, JSAMPARRAY pixel_row) /* Read the data into a virtual array in input-file row order */ for (row = 0; row < cinfo->image_height; row++) { + (*cinfo->methods->progress_monitor) (cinfo, row, cinfo->image_height); image_ptr = (*cinfo->emethods->access_big_sarray) (whole_image, row * cinfo->input_components, TRUE); (*get_pixel_row) (cinfo, image_ptr); } + cinfo->completed_passes++; + /* Set up to read from the virtual array in unscrambled order */ cinfo->methods->get_input_row = get_memory_row; current_row = 0; @@ -421,6 +404,7 @@ input_init (compress_info_ptr cinfo) ((long) width, (long) height * components, (long) components); cinfo->methods->get_input_row = preload_image; + cinfo->total_passes++; /* count file reading as separate pass */ } else { whole_image = NULL; cinfo->methods->get_input_row = get_pixel_row; @@ -457,10 +441,7 @@ input_init (compress_info_ptr cinfo) METHODDEF void input_term (compress_info_ptr cinfo) { - if (whole_image != NULL) - (*cinfo->emethods->free_big_sarray) (whole_image); - if (colormap != NULL) - (*cinfo->emethods->free_small_sarray) (colormap, 3L); + /* no work (we let free_all release the workspace) */ } diff --git a/jrevdct.c b/jrevdct.c index 7c6d83ff..949973b0 100644 --- a/jrevdct.c +++ b/jrevdct.c @@ -1,7 +1,7 @@ /* * jrevdct.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,25 +15,12 @@ #include "jinclude.h" - -/* We assume that right shift corresponds to signed division by 2 with - * rounding towards minus infinity. This is correct for typical "arithmetic - * shift" instructions that shift in copies of the sign bit. But some - * C compilers implement >> with an unsigned shift. For these machines you - * must define RIGHT_SHIFT_IS_UNSIGNED. - * RIGHT_SHIFT provides a signed right shift of an INT32 quantity. - * It is only applied with constant shift counts. +/* + * This routine is specialized to the case DCTSIZE = 8. */ -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS INT32 shift_temp; -#define RIGHT_SHIFT(x,shft) \ - ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~0) << (32-(shft))) : \ - (shift_temp >> (shft))) -#else -#define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ #endif @@ -137,78 +124,6 @@ #define OCOS_5_16 OSIN_3_16 -/* - * Perform a 1-dimensional inverse DCT. - * Note that this code is specialized to the case DCTSIZE = 8. - */ - -INLINE -LOCAL void -fast_idct_8 (DCTELEM *in, int stride) -{ - /* many tmps have nonoverlapping lifetime -- flashy register colourers - * should be able to do this lot very well - */ - INT32 in0, in1, in2, in3, in4, in5, in6, in7; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 tmp20, tmp21, tmp22, tmp23; - INT32 tmp30, tmp31; - INT32 tmp40, tmp41, tmp42, tmp43; - INT32 tmp50, tmp51, tmp52, tmp53; - SHIFT_TEMPS - - in0 = in[ 0]; - in1 = in[stride ]; - in2 = in[stride*2]; - in3 = in[stride*3]; - in4 = in[stride*4]; - in5 = in[stride*5]; - in6 = in[stride*6]; - in7 = in[stride*7]; - - /* These values are scaled by DCT_SCALE */ - - tmp10 = (in0 + in4) * COS_1_4; - tmp11 = (in0 - in4) * COS_1_4; - tmp12 = in2 * SIN_1_8 - in6 * COS_1_8; - tmp13 = in6 * SIN_1_8 + in2 * COS_1_8; - - tmp20 = tmp10 + tmp13; - tmp21 = tmp11 + tmp12; - tmp22 = tmp11 - tmp12; - tmp23 = tmp10 - tmp13; - - /* These values are scaled by OVERSCALE */ - - tmp30 = UNFIXO((in3 + in5) * COS_1_4); - tmp31 = UNFIXO((in3 - in5) * COS_1_4); - - OVERSHIFT(in1); - OVERSHIFT(in7); - - tmp40 = in1 + tmp30; - tmp41 = in7 + tmp31; - tmp42 = in1 - tmp30; - tmp43 = in7 - tmp31; - - /* And these are scaled by DCT_SCALE */ - - tmp50 = tmp40 * OCOS_1_16 + tmp41 * OSIN_1_16; - tmp51 = tmp40 * OSIN_1_16 - tmp41 * OCOS_1_16; - tmp52 = tmp42 * OCOS_5_16 + tmp43 * OSIN_5_16; - tmp53 = tmp42 * OSIN_5_16 - tmp43 * OCOS_5_16; - - in[ 0] = (DCTELEM) UNFIXH(tmp20 + tmp50); - in[stride ] = (DCTELEM) UNFIXH(tmp21 + tmp53); - in[stride*2] = (DCTELEM) UNFIXH(tmp22 + tmp52); - in[stride*3] = (DCTELEM) UNFIXH(tmp23 + tmp51); - in[stride*4] = (DCTELEM) UNFIXH(tmp23 - tmp51); - in[stride*5] = (DCTELEM) UNFIXH(tmp22 - tmp52); - in[stride*6] = (DCTELEM) UNFIXH(tmp21 - tmp53); - in[stride*7] = (DCTELEM) UNFIXH(tmp20 - tmp50); -} - - /* * Perform the inverse DCT on one block of coefficients. * @@ -219,11 +134,88 @@ fast_idct_8 (DCTELEM *in, int stride) GLOBAL void j_rev_dct (DCTBLOCK data) { - int i; - - for (i = 0; i < DCTSIZE; i++) - fast_idct_8(data+i*DCTSIZE, 1); - - for (i = 0; i < DCTSIZE; i++) - fast_idct_8(data+i, DCTSIZE); + int pass, rowctr; + register DCTELEM *inptr, *outptr; + DCTBLOCK workspace; + + /* Each iteration of the inner loop performs one 8-point 1-D IDCT. + * It reads from a *row* of the input matrix and stores into a *column* + * of the output matrix. In the first pass, we read from the data[] array + * and store into the local workspace[]. In the second pass, we read from + * the workspace[] array and store into data[], thus performing the + * equivalent of a columnar IDCT pass with no variable array indexing. + */ + + inptr = data; /* initialize pointers for first pass */ + outptr = workspace; + for (pass = 1; pass >= 0; pass--) { + for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { + /* many tmps have nonoverlapping lifetime -- flashy register colourers + * should be able to do this lot very well + */ + INT32 in0, in1, in2, in3, in4, in5, in6, in7; + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 tmp20, tmp21, tmp22, tmp23; + INT32 tmp30, tmp31; + INT32 tmp40, tmp41, tmp42, tmp43; + INT32 tmp50, tmp51, tmp52, tmp53; + SHIFT_TEMPS + + in0 = inptr[0]; + in1 = inptr[1]; + in2 = inptr[2]; + in3 = inptr[3]; + in4 = inptr[4]; + in5 = inptr[5]; + in6 = inptr[6]; + in7 = inptr[7]; + + /* These values are scaled by DCT_SCALE */ + + tmp10 = (in0 + in4) * COS_1_4; + tmp11 = (in0 - in4) * COS_1_4; + tmp12 = in2 * SIN_1_8 - in6 * COS_1_8; + tmp13 = in6 * SIN_1_8 + in2 * COS_1_8; + + tmp20 = tmp10 + tmp13; + tmp21 = tmp11 + tmp12; + tmp22 = tmp11 - tmp12; + tmp23 = tmp10 - tmp13; + + /* These values are scaled by OVERSCALE */ + + tmp30 = UNFIXO((in3 + in5) * COS_1_4); + tmp31 = UNFIXO((in3 - in5) * COS_1_4); + + OVERSHIFT(in1); + OVERSHIFT(in7); + + tmp40 = in1 + tmp30; + tmp41 = in7 + tmp31; + tmp42 = in1 - tmp30; + tmp43 = in7 - tmp31; + + /* And these are scaled by DCT_SCALE */ + + tmp50 = tmp40 * OCOS_1_16 + tmp41 * OSIN_1_16; + tmp51 = tmp40 * OSIN_1_16 - tmp41 * OCOS_1_16; + tmp52 = tmp42 * OCOS_5_16 + tmp43 * OSIN_5_16; + tmp53 = tmp42 * OSIN_5_16 - tmp43 * OCOS_5_16; + + outptr[ 0] = (DCTELEM) UNFIXH(tmp20 + tmp50); + outptr[DCTSIZE ] = (DCTELEM) UNFIXH(tmp21 + tmp53); + outptr[DCTSIZE*2] = (DCTELEM) UNFIXH(tmp22 + tmp52); + outptr[DCTSIZE*3] = (DCTELEM) UNFIXH(tmp23 + tmp51); + outptr[DCTSIZE*4] = (DCTELEM) UNFIXH(tmp23 - tmp51); + outptr[DCTSIZE*5] = (DCTELEM) UNFIXH(tmp22 - tmp52); + outptr[DCTSIZE*6] = (DCTELEM) UNFIXH(tmp21 - tmp53); + outptr[DCTSIZE*7] = (DCTELEM) UNFIXH(tmp20 - tmp50); + + inptr += DCTSIZE; /* advance inptr to next row */ + outptr++; /* advance outptr to next column */ + } + /* end of pass; in case it was pass 1, set up for pass 2 */ + inptr = workspace; + outptr = data; + } } diff --git a/jutils.c b/jutils.c index aebcaa95..74ac6b75 100644 --- a/jutils.c +++ b/jutils.c @@ -1,7 +1,7 @@ /* * jutils.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, #ifdef NEED_FAR_POINTERS register long count; #else - register size_t count = num_cols * SIZEOF(JSAMPLE); + register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); #endif register int row; @@ -69,14 +69,12 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, long num_blocks) */ #ifdef NEED_FAR_POINTERS register JCOEFPTR inptr, outptr; - register int i; register long count; - for (count = num_blocks; count > 0; count--) { - inptr = *input_row++; - outptr = *output_row++; - for (i = DCTSIZE2; i > 0; i--) - *outptr++ = *inptr++; + inptr = (JCOEFPTR) input_row; + outptr = (JCOEFPTR) output_row; + for (count = num_blocks * DCTSIZE2; count > 0; count--) { + *outptr++ = *inptr++; } #else memcpy((void *) output_row, (void *) input_row, diff --git a/jversion.h b/jversion.h index a9313854..91688ff3 100644 --- a/jversion.h +++ b/jversion.h @@ -1,7 +1,7 @@ /* * jversion.h * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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 "2 13-Dec-91" +#define JVERSION "3 17-Mar-92" -#define JCOPYRIGHT "Copyright (C) 1991, Thomas G. Lane" +#define JCOPYRIGHT "Copyright (C) 1992, Thomas G. Lane" diff --git a/jvirtmem.c b/jvirtmem.c deleted file mode 100644 index 6e1d332c..00000000 --- a/jvirtmem.c +++ /dev/null @@ -1,614 +0,0 @@ -/* - * jvirtmem.c - * - * Copyright (C) 1991, 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. - * - * This file provides the system-dependent memory allocation routines - * for the case where we can rely on virtual memory to handle large arrays. - * - * This includes some MS-DOS code just for trial purposes; "big" arrays will - * have to be handled with temp files on MS-DOS, so a real implementation of - * a DOS memory manager will probably be a separate file. (See additional - * comments about big arrays, below.) - * - * NB: allocation routines never return NULL. - * They should exit to error_exit if unsuccessful. - */ - -#define AM_MEMORY_MANAGER /* we define big_Xarray_control structs */ - -#include "jinclude.h" - -#ifdef INCLUDES_ARE_ANSI -#include /* to declare malloc(), free() */ -#else -extern void * malloc PP((size_t size)); -extern void free PP((void *ptr)); -#endif - - -/* Insert system-specific definitions of far_malloc, far_free here. */ - -#ifndef NEED_FAR_POINTERS /* Generic for non-braindamaged CPUs */ - -#define far_malloc(x) malloc(x) -#define far_free(x) free(x) - -#else /* NEED_FAR_POINTERS */ - -#ifdef __TURBOC__ -/* These definitions work for Turbo C */ -#include /* need farmalloc(), farfree() */ -#define far_malloc(x) farmalloc(x) -#define far_free(x) farfree(x) -#else -#ifdef MSDOS -/* These definitions work for Microsoft C and compatible compilers */ -#include /* need _fmalloc(), _ffree() */ -#define far_malloc(x) _fmalloc(x) -#define far_free(x) _ffree(x) -#endif -#endif - -#endif /* NEED_FAR_POINTERS */ - -/* - * When allocating 2-D arrays we can either ask malloc() for each row - * individually, or grab the whole space in one chunk. The latter is - * a lot faster on large arrays, but fails if malloc can't handle big - * requests, as is typically true on MS-DOS. - * We assume here that big malloc requests are safe whenever - * NEED_FAR_POINTERS is not defined, but you can change this if you are - * on a weird machine. - */ - -#ifndef NEED_FAR_POINTERS -#define BIG_MALLOCS_OK /* safe to ask far_malloc for > 64Kb */ -#endif - - -/* - * Some important notes: - * The array alloc/dealloc routines are not merely a convenience; - * on 80x86 machines the bottom-level pointers in an array are FAR - * and thus may not be allocatable by alloc_small. - * - * Also, it's not a good idea to try to merge the sarray and barray - * routines, even though they are textually almost the same, because - * samples are usually stored as bytes while coefficients are shorts. - * Thus, in machines where byte pointers have a different representation - * from word pointers, the resulting machine code could not be the same. - */ - - -static external_methods_ptr methods; /* saved for access to error_exit */ - - -#ifdef MEM_STATS /* optional extra stuff for statistics */ - -#define MALLOC_OVERHEAD (SIZEOF(char *)) /* assumed overhead per request */ -#define MALLOC_FAR_OVERHEAD (SIZEOF(char FAR *)) /* for "far" storage */ - -static long total_num_small = 0; /* total # of small objects alloced */ -static long total_bytes_small = 0; /* total bytes requested */ -static long cur_num_small = 0; /* # currently alloced */ -static long max_num_small = 0; /* max simultaneously alloced */ - -#ifdef NEED_FAR_POINTERS -static long total_num_medium = 0; /* total # of medium objects alloced */ -static long total_bytes_medium = 0; /* total bytes requested */ -static long cur_num_medium = 0; /* # currently alloced */ -static long max_num_medium = 0; /* max simultaneously alloced */ -#endif - -static long total_num_sarray = 0; /* total # of sarray objects alloced */ -static long total_bytes_sarray = 0; /* total bytes requested */ -static long cur_num_sarray = 0; /* # currently alloced */ -static long max_num_sarray = 0; /* max simultaneously alloced */ - -static long total_num_barray = 0; /* total # of barray objects alloced */ -static long total_bytes_barray = 0; /* total bytes requested */ -static long cur_num_barray = 0; /* # currently alloced */ -static long max_num_barray = 0; /* max simultaneously alloced */ - - -GLOBAL void -j_mem_stats (void) -{ - /* since this is only a debugging stub, we can cheat a little on the - * trace message mechanism... helps 'cuz trace can't handle longs. - */ - fprintf(stderr, "total_num_small = %ld\n", total_num_small); - fprintf(stderr, "total_bytes_small = %ld\n", total_bytes_small); - if (cur_num_small) - fprintf(stderr, "CUR_NUM_SMALL = %ld\n", cur_num_small); - fprintf(stderr, "max_num_small = %ld\n", max_num_small); - -#ifdef NEED_FAR_POINTERS - fprintf(stderr, "total_num_medium = %ld\n", total_num_medium); - fprintf(stderr, "total_bytes_medium = %ld\n", total_bytes_medium); - if (cur_num_medium) - fprintf(stderr, "CUR_NUM_MEDIUM = %ld\n", cur_num_medium); - fprintf(stderr, "max_num_medium = %ld\n", max_num_medium); -#endif - - fprintf(stderr, "total_num_sarray = %ld\n", total_num_sarray); - fprintf(stderr, "total_bytes_sarray = %ld\n", total_bytes_sarray); - if (cur_num_sarray) - fprintf(stderr, "CUR_NUM_SARRAY = %ld\n", cur_num_sarray); - fprintf(stderr, "max_num_sarray = %ld\n", max_num_sarray); - - fprintf(stderr, "total_num_barray = %ld\n", total_num_barray); - fprintf(stderr, "total_bytes_barray = %ld\n", total_bytes_barray); - if (cur_num_barray) - fprintf(stderr, "CUR_NUM_BARRAY = %ld\n", cur_num_barray); - fprintf(stderr, "max_num_barray = %ld\n", max_num_barray); -} - -#endif /* MEM_STATS */ - - -LOCAL void -out_of_memory (int which) -/* Report an out-of-memory error and stop execution */ -/* If we compiled MEM_STATS support, report alloc requests before dying */ -{ -#ifdef MEM_STATS - j_mem_stats(); -#endif - ERREXIT1(methods, "Insufficient memory (case %d)", which); -} - - - -METHODDEF void * -alloc_small (size_t sizeofobject) -/* Allocate a "small" (all-in-memory) object */ -{ - void * result; - -#ifdef MEM_STATS - total_num_small++; - total_bytes_small += sizeofobject + MALLOC_OVERHEAD; - cur_num_small++; - if (cur_num_small > max_num_small) max_num_small = cur_num_small; -#endif - - result = malloc(sizeofobject); - if (result == NULL) - out_of_memory(1); - return result; -} - - -METHODDEF void -free_small (void *ptr) -/* Free a "small" (all-in-memory) object */ -{ - free(ptr); - -#ifdef MEM_STATS - cur_num_small--; -#endif -} - - -#ifdef NEED_FAR_POINTERS - -METHODDEF void FAR * -alloc_medium (size_t sizeofobject) -/* Allocate a "medium" (all in memory, but in far heap) object */ -{ - void FAR * result; - -#ifdef MEM_STATS - total_num_medium++; - total_bytes_medium += sizeofobject + MALLOC_FAR_OVERHEAD; - cur_num_medium++; - if (cur_num_medium > max_num_medium) max_num_medium = cur_num_medium; -#endif - - result = far_malloc(sizeofobject); - if (result == NULL) - out_of_memory(2); - return result; -} - - -METHODDEF void -free_medium (void FAR *ptr) -/* Free a "medium" (all in memory, but in far heap) object */ -{ - far_free(ptr); - -#ifdef MEM_STATS - cur_num_medium--; -#endif -} - -#endif /* NEED_FAR_POINTERS */ - - -METHODDEF JSAMPARRAY -alloc_small_sarray (long samplesperrow, long numrows) -/* Allocate a "small" (all-in-memory) 2-D sample array */ -{ - JSAMPARRAY result; -#ifdef BIG_MALLOCS_OK - JSAMPROW workspace; -#endif - long i; - -#ifdef MEM_STATS - total_num_sarray++; -#ifdef BIG_MALLOCS_OK - total_bytes_sarray += numrows * samplesperrow * SIZEOF(JSAMPLE) - + MALLOC_FAR_OVERHEAD; -#else - total_bytes_sarray += (samplesperrow * SIZEOF(JSAMPLE) + MALLOC_FAR_OVERHEAD) - * numrows; -#endif - cur_num_sarray++; - if (cur_num_sarray > max_num_sarray) max_num_sarray = cur_num_sarray; -#endif - - /* Get space for row pointers; this is always "near" on 80x86 */ - result = (JSAMPARRAY) alloc_small((size_t) (numrows * SIZEOF(JSAMPROW))); - - /* Get the rows themselves; on 80x86 these are "far" */ - -#ifdef BIG_MALLOCS_OK - workspace = (JSAMPROW) far_malloc((size_t) - (numrows * samplesperrow * SIZEOF(JSAMPLE))); - if (workspace == NULL) - out_of_memory(3); - for (i = 0; i < numrows; i++) { - result[i] = workspace; - workspace += samplesperrow; - } -#else - for (i = 0; i < numrows; i++) { - result[i] = (JSAMPROW) far_malloc((size_t) - (samplesperrow * SIZEOF(JSAMPLE))); - if (result[i] == NULL) - out_of_memory(3); - } -#endif - - return result; -} - - -METHODDEF void -free_small_sarray (JSAMPARRAY ptr, long numrows) -/* Free a "small" (all-in-memory) 2-D sample array */ -{ - /* Free the rows themselves; on 80x86 these are "far" */ -#ifdef BIG_MALLOCS_OK - far_free((void FAR *) ptr[0]); -#else - long i; - - for (i = 0; i < numrows; i++) { - far_free((void FAR *) ptr[i]); - } -#endif - - /* Free space for row pointers; this is always "near" on 80x86 */ - free_small((void *) ptr); - -#ifdef MEM_STATS - cur_num_sarray--; -#endif -} - - -METHODDEF JBLOCKARRAY -alloc_small_barray (long blocksperrow, long numrows) -/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */ -{ - JBLOCKARRAY result; -#ifdef BIG_MALLOCS_OK - JBLOCKROW workspace; -#endif - long i; - -#ifdef MEM_STATS - total_num_barray++; -#ifdef BIG_MALLOCS_OK - total_bytes_barray += numrows * blocksperrow * SIZEOF(JBLOCK) - + MALLOC_FAR_OVERHEAD; -#else - total_bytes_barray += (blocksperrow * SIZEOF(JBLOCK) + MALLOC_FAR_OVERHEAD) - * numrows; -#endif - cur_num_barray++; - if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray; -#endif - - /* Get space for row pointers; this is always "near" on 80x86 */ - result = (JBLOCKARRAY) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW))); - - /* Get the rows themselves; on 80x86 these are "far" */ - -#ifdef BIG_MALLOCS_OK - workspace = (JBLOCKROW) far_malloc((size_t) - (numrows * blocksperrow * SIZEOF(JBLOCK))); - if (workspace == NULL) - out_of_memory(4); - for (i = 0; i < numrows; i++) { - result[i] = workspace; - workspace += blocksperrow; - } -#else - for (i = 0; i < numrows; i++) { - result[i] = (JBLOCKROW) far_malloc((size_t) - (blocksperrow * SIZEOF(JBLOCK))); - if (result[i] == NULL) - out_of_memory(4); - } -#endif - - return result; -} - - -METHODDEF void -free_small_barray (JBLOCKARRAY ptr, long numrows) -/* Free a "small" (all-in-memory) 2-D coefficient-block array */ -{ - /* Free the rows themselves; on 80x86 these are "far" */ -#ifdef BIG_MALLOCS_OK - far_free((void FAR *) ptr[0]); -#else - long i; - - for (i = 0; i < numrows; i++) { - far_free((void FAR *) ptr[i]); - } -#endif - - /* Free space for row pointers; this is always "near" on 80x86 */ - free_small((void *) ptr); - -#ifdef MEM_STATS - cur_num_barray--; -#endif -} - - - -/* - * About "big" array management: - * - * To allow machines with limited memory to handle large images, - * all processing in the JPEG system is done a few pixel or block rows - * at a time. The above "small" array routines are only used to allocate - * strip buffers (as wide as the image, but just a few rows high). - * In some cases multiple passes must be made over the data. In these - * cases the "big" array routines are used. The array is still accessed - * a strip at a time, but the memory manager must save the whole array - * for repeated accesses. The intended implementation is that there is - * a strip buffer in memory (as high as is possible given the desired memory - * limit), plus a backing file that holds the rest of the array. - * - * The request_big_array routines are told the total size of the image (in case - * it is useful to know the total file size that will be needed). They are - * also given the unit height, which is the number of rows that will be - * accessed at once; the in-memory buffer should usually be made a multiple of - * this height for best efficiency. - * - * The request routines create control blocks (and may open backing files), - * but they don't create the in-memory buffers. This is postponed until - * alloc_big_arrays is called. At that time the total amount of space needed - * is known (approximately, anyway), so free memory can be divided up fairly. - * - * The access_big_array routines are responsible for making a specific strip - * area accessible (after reading or writing the backing file, if necessary). - * Note that the access routines are told whether the caller intends to modify - * the accessed strip; during a read-only pass this saves having to rewrite - * data to disk. - * - * The typical access pattern is one top-to-bottom pass to write the data, - * followed by one or more read-only top-to-bottom passes. However, other - * access patterns may occur while reading. For example, translation of image - * formats that use bottom-to-top scan order will require bottom-to-top read - * passes. The memory manager need not support multiple write passes nor - * funny write orders (meaning that rearranging rows must be handled while - * reading data out of the big array, not while putting it in). - * - * In current usage, the access requests are always for nonoverlapping strips; - * that is, successive access start_row numbers always differ by exactly the - * unitheight. This allows fairly simple buffer dump/reload logic if the - * in-memory buffer is made a multiple of the unitheight. It would be - * possible to keep subsampled rather than fullsize data in the "big" arrays, - * thus reducing temp file size, if we supported overlapping strip access - * (access requests differing by less than the unitheight). At the moment - * I don't believe this is worth the extra complexity. - * - * This particular implementation doesn't use temp files; the whole of a big - * array is allocated in (virtual) memory, and any swapping is done behind the - * scenes by the operating system. - */ - - - -/* The control blocks for virtual arrays. - * These are pretty minimal in this implementation. - * Note: in this implementation we could realize big arrays - * at request time and make alloc_big_arrays a no-op; - * however, doing it separately keeps callers honest. - */ - -struct big_sarray_control { - JSAMPARRAY mem_buffer; /* memory buffer (the whole thing, here) */ - long rows_in_mem; /* Height of memory buffer */ - long samplesperrow; /* Width of memory buffer */ - long unitheight; /* # of rows accessed by access_big_sarray() */ - big_sarray_ptr next; /* list link for unrealized arrays */ -}; - -struct big_barray_control { - JBLOCKARRAY mem_buffer; /* memory buffer (the whole thing, here) */ - long rows_in_mem; /* Height of memory buffer */ - long blocksperrow; /* Width of memory buffer */ - long unitheight; /* # of rows accessed by access_big_barray() */ - big_barray_ptr next; /* list link for unrealized arrays */ -}; - - -/* Headers of lists of control blocks for unrealized big arrays */ -static big_sarray_ptr unalloced_sarrays; -static big_barray_ptr unalloced_barrays; - - -METHODDEF big_sarray_ptr -request_big_sarray (long samplesperrow, long numrows, long unitheight) -/* Request a "big" (virtual-memory) 2-D sample array */ -{ - big_sarray_ptr result; - - /* get control block */ - result = (big_sarray_ptr) alloc_small(SIZEOF(struct big_sarray_control)); - - result->mem_buffer = NULL; /* lets access routine spot premature access */ - result->rows_in_mem = numrows; - result->samplesperrow = samplesperrow; - result->unitheight = unitheight; - result->next = unalloced_sarrays; /* add to list of unallocated arrays */ - unalloced_sarrays = result; - - return result; -} - - -METHODDEF big_barray_ptr -request_big_barray (long blocksperrow, long numrows, long unitheight) -/* Request a "big" (virtual-memory) 2-D coefficient-block array */ -{ - big_barray_ptr result; - - /* get control block */ - result = (big_barray_ptr) alloc_small(SIZEOF(struct big_barray_control)); - - result->mem_buffer = NULL; /* lets access routine spot premature access */ - result->rows_in_mem = numrows; - result->blocksperrow = blocksperrow; - result->unitheight = unitheight; - result->next = unalloced_barrays; /* add to list of unallocated arrays */ - unalloced_barrays = result; - - return result; -} - - -METHODDEF void -alloc_big_arrays (long extra_small_samples, long extra_small_blocks, - long extra_medium_space) -/* Allocate the in-memory buffers for any unrealized "big" arrays */ -/* 'extra' values are upper bounds for total future small-array requests */ -/* and far-heap requests */ -{ - /* In this implementation we just malloc the whole arrays */ - /* and expect the system's virtual memory to worry about swapping them */ - big_sarray_ptr sptr; - big_barray_ptr bptr; - - for (sptr = unalloced_sarrays; sptr != NULL; sptr = sptr->next) { - sptr->mem_buffer = alloc_small_sarray(sptr->samplesperrow, - sptr->rows_in_mem); - } - - for (bptr = unalloced_barrays; bptr != NULL; bptr = bptr->next) { - bptr->mem_buffer = alloc_small_barray(bptr->blocksperrow, - bptr->rows_in_mem); - } - - unalloced_sarrays = NULL; /* reset for possible future cycles */ - unalloced_barrays = NULL; -} - - -METHODDEF JSAMPARRAY -access_big_sarray (big_sarray_ptr ptr, long start_row, boolean writable) -/* Access the part of a "big" sample array starting at start_row */ -/* and extending for ptr->unitheight rows. writable is true if */ -/* caller intends to modify the accessed area. */ -{ - /* debugging check */ - if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_mem || - ptr->mem_buffer == NULL) - ERREXIT(methods, "Bogus access_big_sarray request"); - - return ptr->mem_buffer + start_row; -} - - -METHODDEF JBLOCKARRAY -access_big_barray (big_barray_ptr ptr, long start_row, boolean writable) -/* Access the part of a "big" coefficient-block array starting at start_row */ -/* and extending for ptr->unitheight rows. writable is true if */ -/* caller intends to modify the accessed area. */ -{ - /* debugging check */ - if (start_row < 0 || start_row+ptr->unitheight > ptr->rows_in_mem || - ptr->mem_buffer == NULL) - ERREXIT(methods, "Bogus access_big_barray request"); - - return ptr->mem_buffer + start_row; -} - - -METHODDEF void -free_big_sarray (big_sarray_ptr ptr) -/* Free a "big" (virtual-memory) 2-D sample array */ -{ - free_small_sarray(ptr->mem_buffer, ptr->rows_in_mem); - free_small((void *) ptr); /* free the control block too */ -} - - -METHODDEF void -free_big_barray (big_barray_ptr ptr) -/* Free a "big" (virtual-memory) 2-D coefficient-block array */ -{ - free_small_barray(ptr->mem_buffer, ptr->rows_in_mem); - free_small((void *) ptr); /* free the control block too */ -} - - - -/* - * The method selection routine for virtual memory systems. - * The system-dependent setup routine should call this routine - * to install the necessary method pointers in the supplied struct. - */ - -GLOBAL void -jselvirtmem (external_methods_ptr emethods) -{ - methods = emethods; /* save struct addr for error exit access */ - - emethods->alloc_small = alloc_small; - emethods->free_small = free_small; -#ifdef NEED_FAR_POINTERS - emethods->alloc_medium = alloc_medium; - emethods->free_medium = free_medium; -#endif - emethods->alloc_small_sarray = alloc_small_sarray; - emethods->free_small_sarray = free_small_sarray; - emethods->alloc_small_barray = alloc_small_barray; - emethods->free_small_barray = free_small_barray; - emethods->request_big_sarray = request_big_sarray; - emethods->request_big_barray = request_big_barray; - emethods->alloc_big_arrays = alloc_big_arrays; - emethods->access_big_sarray = access_big_sarray; - emethods->access_big_barray = access_big_barray; - emethods->free_big_sarray = free_big_sarray; - emethods->free_big_barray = free_big_barray; - - unalloced_sarrays = NULL; /* make sure list headers are empty */ - unalloced_barrays = NULL; -} diff --git a/jwrgif.c b/jwrgif.c index 9423af2a..9250701a 100644 --- a/jwrgif.c +++ b/jwrgif.c @@ -1,7 +1,7 @@ /* * jwrgif.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -98,7 +98,7 @@ flush_packet (void) { if (bytesinpkt > 0) { /* never write zero-length packet */ packetbuf[0] = (char) bytesinpkt++; - if (FWRITE(dcinfo->output_file, packetbuf, bytesinpkt) + if (JFWRITE(dcinfo->output_file, packetbuf, bytesinpkt) != (size_t) bytesinpkt) ERREXIT(dcinfo->emethods, "Output file write error"); bytesinpkt = 0; @@ -106,14 +106,12 @@ flush_packet (void) } -LOCAL void -char_out (char c) /* Add a character to current packet; flush to disk if necessary */ -{ - packetbuf[++bytesinpkt] = c; - if (bytesinpkt >= 255) - flush_packet(); -} +#define CHAR_OUT(c) \ + { packetbuf[++bytesinpkt] = (char) (c); \ + if (bytesinpkt >= 255) \ + flush_packet(); \ + } /* Routine to convert variable-width codes into a byte stream */ @@ -127,14 +125,11 @@ output (code_int code) /* Emit a code of n_bits bits */ /* Uses cur_accum and cur_bits to reblock into 8-bit bytes */ { - if (cur_bits > 0) - cur_accum |= ((INT32) code << cur_bits); - else - cur_accum = code; + cur_accum |= ((INT32) code) << cur_bits; cur_bits += n_bits; while (cur_bits >= 8) { - char_out((char) (cur_accum & 0xFF)); + CHAR_OUT(cur_accum & 0xFF); cur_accum >>= 8; cur_bits -= 8; } @@ -270,7 +265,7 @@ compress_term (void) output(EOFCode); /* Flush the bit-packing buffer */ if (cur_bits > 0) { - char_out((char) (cur_accum & 0xFF)); + CHAR_OUT(cur_accum & 0xFF); } /* Flush the packet buffer */ flush_packet(); @@ -305,27 +300,15 @@ emit_header (int num_colors, JSAMPARRAY colormap) /* If colormap==NULL, synthesize a gray-scale colormap */ { int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; + int cshift = dcinfo->data_precision - 8; int i; if (num_colors > 256) ERREXIT(dcinfo->emethods, "GIF can only handle 256 colors"); /* Compute bits/pixel and related values */ - if (num_colors <= 2) - BitsPerPixel = 1; - else if (num_colors <= 4) - BitsPerPixel = 2; - else if (num_colors <= 8) - BitsPerPixel = 3; - else if (num_colors <= 16) - BitsPerPixel = 4; - else if (num_colors <= 32) - BitsPerPixel = 5; - else if (num_colors <= 64) - BitsPerPixel = 6; - else if (num_colors <= 128) - BitsPerPixel = 7; - else - BitsPerPixel = 8; + BitsPerPixel = 1; + while (num_colors > (1 << BitsPerPixel)) + BitsPerPixel++; ColorMapSize = 1 << BitsPerPixel; if (BitsPerPixel <= 1) InitCodeSize = 2; @@ -335,7 +318,7 @@ emit_header (int num_colors, JSAMPARRAY colormap) * Write the GIF header. * Note that we generate a plain GIF87 header for maximum compatibility. */ - (void) FWRITE(dcinfo->output_file, "GIF87a", 6); + (void) JFWRITE(dcinfo->output_file, "GIF87a", 6); /* Write the Logical Screen Descriptor */ put_word((UINT16) dcinfo->image_width); put_word((UINT16) dcinfo->image_height); @@ -346,17 +329,19 @@ emit_header (int num_colors, JSAMPARRAY colormap) putc(0, dcinfo->output_file); /* Background color index */ putc(0, dcinfo->output_file); /* Reserved in GIF87 (aspect ratio in GIF89) */ /* Write the Global Color Map */ + /* If the color map is more than 8 bits precision, */ + /* we reduce it to 8 bits by shifting */ for (i=0; i < ColorMapSize; i++) { if (i < num_colors) { if (colormap != NULL) { if (dcinfo->out_color_space == CS_RGB) { /* Normal case: RGB color map */ - putc(GETJSAMPLE(colormap[0][i]), dcinfo->output_file); - putc(GETJSAMPLE(colormap[1][i]), dcinfo->output_file); - putc(GETJSAMPLE(colormap[2][i]), dcinfo->output_file); + putc(GETJSAMPLE(colormap[0][i]) >> cshift, dcinfo->output_file); + putc(GETJSAMPLE(colormap[1][i]) >> cshift, dcinfo->output_file); + putc(GETJSAMPLE(colormap[2][i]) >> cshift, dcinfo->output_file); } else { /* Grayscale "color map": possible if quantizing grayscale image */ - put_3bytes(GETJSAMPLE(colormap[0][i])); + put_3bytes(GETJSAMPLE(colormap[0][i]) >> cshift); } } else { /* Create a gray-scale map of num_colors values, range 0..255 */ @@ -463,9 +448,7 @@ output_term (decompress_info_ptr cinfo) if (ferror(cinfo->output_file)) ERREXIT(cinfo->emethods, "Output file write error"); /* Free space */ - (*cinfo->emethods->free_medium) ((void FAR *) hash_code); - (*cinfo->emethods->free_medium) ((void FAR *) hash_prefix); - (*cinfo->emethods->free_medium) ((void FAR *) hash_suffix); + /* no work (we let free_all release the workspace) */ } diff --git a/jwrjfif.c b/jwrjfif.c index 28813554..08a9a9df 100644 --- a/jwrjfif.c +++ b/jwrjfif.c @@ -1,7 +1,7 @@ /* * jwrjfif.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -36,7 +36,7 @@ /* Write some bytes from a (char *) buffer */ #define WRITE_BYTES(cinfo,dataptr,datacount) \ - { if (FWRITE(cinfo->output_file, dataptr, datacount) \ + { if (JFWRITE(cinfo->output_file, dataptr, datacount) \ != (size_t) (datacount)) \ ERREXIT(cinfo->emethods, "Output file write error"); } @@ -165,6 +165,9 @@ emit_dht (compress_info_ptr cinfo, int index, boolean is_ac) } else { htbl = cinfo->dc_huff_tbl_ptrs[index]; } + + if (htbl == NULL) + ERREXIT1(cinfo->emethods, "Huffman table 0x%02x was not defined", index); if (! htbl->sent_table) { emit_marker(cinfo, M_DHT); diff --git a/jwrppm.c b/jwrppm.c index 7a5255c4..5c9a47d2 100644 --- a/jwrppm.c +++ b/jwrppm.c @@ -1,7 +1,7 @@ /* * jwrppm.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,9 +31,6 @@ #endif -static JSAMPARRAY color_map; /* saves color map passed by quantizer */ - - /* * Write the file header. */ @@ -104,10 +101,11 @@ put_demapped_rows (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE pixel_data) { register FILE * outfile = cinfo->output_file; + register JSAMPARRAY color_map = cinfo->colormap; register JSAMPROW ptr; register long col; - register long width = cinfo->image_width; - register int row; + long width = cinfo->image_width; + int row; if (cinfo->out_color_space == CS_GRAYSCALE) { for (row = 0; row < num_rows; row++) { @@ -141,7 +139,6 @@ put_demapped_rows (decompress_info_ptr cinfo, int num_rows, METHODDEF void put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) { - color_map = colormap; /* save for use in output */ cinfo->methods->put_pixel_rows = put_demapped_rows; } diff --git a/jwrrle.c b/jwrrle.c index f324758f..49afbcf9 100644 --- a/jwrrle.c +++ b/jwrrle.c @@ -1,7 +1,7 @@ /* * jwrrle.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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. * @@ -87,6 +87,8 @@ output_init (decompress_info_ptr cinfo) output_colormap = NULL; /* No output colormap as yet */ number_colors = 0; cur_output_row = 0; /* Start filling virtual arrays at row 0 */ + + cinfo->total_passes++; /* count file writing as separate pass */ } @@ -192,12 +194,15 @@ output_term (decompress_info_ptr cinfo) * and (b) we are not on a machine where FAR pointers differ from regular. */ for (row = cinfo->image_height-1; row >= 0; row--) { + (*cinfo->methods->progress_monitor) (cinfo, cinfo->image_height-row-1, + cinfo->image_height); for (ci = 0; ci < cinfo->final_out_comps; ci++) { output_rows[ci] = (rle_pixel *) *((*cinfo->emethods->access_big_sarray) (channels[ci], row, FALSE)); } rle_putrow(output_rows, (int) cinfo->image_width, &header); } + cinfo->completed_passes++; /* Emit file trailer */ rle_puteof(&header); @@ -206,11 +211,7 @@ output_term (decompress_info_ptr cinfo) ERREXIT(cinfo->emethods, "Output file write error"); /* Release memory */ - for (ci = 0; ci < cinfo->final_out_comps; ci++) { - (*cinfo->emethods->free_big_sarray) (channels[ci]); - } - if (output_colormap != NULL) - (*cinfo->emethods->free_small) ((void *) output_colormap); + /* no work (we let free_all release the workspace) */ } diff --git a/jwrtarga.c b/jwrtarga.c index 72259e77..ba263a69 100644 --- a/jwrtarga.c +++ b/jwrtarga.c @@ -1,7 +1,7 @@ /* * jwrtarga.c * - * Copyright (C) 1991, Thomas G. Lane. + * Copyright (C) 1991, 1992, 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,9 +32,6 @@ #endif -static JSAMPARRAY color_map; /* saves color map passed by quantizer */ - - LOCAL void write_header (decompress_info_ptr cinfo, int num_colors) /* Create and write a Targa header */ @@ -70,7 +67,7 @@ write_header (decompress_info_ptr cinfo, int num_colors) } } - if (FWRITE(cinfo->output_file, targaheader, 18) != (size_t) 18) + if (JFWRITE(cinfo->output_file, targaheader, 18) != (size_t) 18) ERREXIT(cinfo->emethods, "Could not write Targa header"); } @@ -148,10 +145,11 @@ put_demapped_rows (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE pixel_data) { register FILE * outfile = cinfo->output_file; + register JSAMPARRAY color_map = cinfo->colormap; register JSAMPROW ptr; register long col; - register long width = cinfo->image_width; - register int row; + long width = cinfo->image_width; + int row; for (row = 0; row < num_rows; row++) { ptr = pixel_data[0][row]; @@ -186,7 +184,6 @@ put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap) putc(GETJSAMPLE(colormap[0][i]), outfile); } } else { - color_map = colormap; /* save for use in output */ cinfo->methods->put_pixel_rows = put_demapped_rows; } } diff --git a/makcjpeg.cf b/makcjpeg.cf index 7c9d736d..58f6daa1 100644 --- a/makcjpeg.cf +++ b/makcjpeg.cf @@ -1,6 +1,6 @@ L jcmain.mix jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix L jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix -L jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix jutils.mix jvirtmem.mix -L jerror.mix +L jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix jutils.mix jerror.mix +L jmemmgr.mix jmemsys.mix jmemdosa.mix fa; b cjpeg,8K,48K, diff --git a/makcjpeg.lnk b/makcjpeg.lnk index 258f644b..9951bd84 100644 --- a/makcjpeg.lnk +++ b/makcjpeg.lnk @@ -15,8 +15,10 @@ jrdppm.obj + jrdrle.obj + jrdtarga.obj + jutils.obj + -jvirtmem.obj + -jerror.obj +jerror.obj + +jmemmgr.obj + +jmemsys.obj + +jmemdosa.obj cjpeg.exe /NOI nul.map diff --git a/makcjpeg.lst b/makcjpeg.lst index aa758b36..19fd9d36 100644 --- a/makcjpeg.lst +++ b/makcjpeg.lst @@ -1,4 +1,4 @@ jcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj jwrjfif.obj -jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj jutils.obj jvirtmem.obj -jerror.obj +jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj jutils.obj jerror.obj +jmemmgr.obj jmemsys.obj jmemdosa.obj diff --git a/makdjpeg.cf b/makdjpeg.cf index ea02876b..40c18301 100644 --- a/makdjpeg.cf +++ b/makdjpeg.cf @@ -1,6 +1,6 @@ L jdmain.mix jdmaster.mix jddeflts.mix jbsmooth.mix jdarith.mix jdcolor.mix L jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix L jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jwrrle.mix jwrtarga.mix -L jutils.mix jvirtmem.mix jerror.mix +L jutils.mix jerror.mix jmemmgr.mix jmemsys.mix jmemdosa.mix fa; b djpeg,8K,48K, diff --git a/makdjpeg.lnk b/makdjpeg.lnk index 7f909db0..44207d52 100644 --- a/makdjpeg.lnk +++ b/makdjpeg.lnk @@ -17,8 +17,10 @@ jwrppm.obj + jwrrle.obj + jwrtarga.obj + jutils.obj + -jvirtmem.obj + -jerror.obj +jerror.obj + +jmemmgr.obj + +jmemsys.obj + +jmemdosa.obj djpeg.exe /NOI nul.map diff --git a/makdjpeg.lst b/makdjpeg.lst index 9c9e7249..4f17e6d6 100644 --- a/makdjpeg.lst +++ b/makdjpeg.lst @@ -1,4 +1,4 @@ jdmain.obj jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj -jutils.obj jvirtmem.obj jerror.obj +jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj diff --git a/makefile.ansi b/makefile.ansi index 4b99f083..2159093b 100644 --- a/makefile.ansi +++ b/makefile.ansi @@ -26,33 +26,42 @@ LDFLAGS= LDLIBS= # miscellaneous OS-dependent stuff -LN= $(CC) # linker -RM= rm -f # file deletion command -AR= ar rc # library (.a) file creation command -AR2= ranlib # second step in .a creation (use "touch" if not needed) +# linker +LN= $(CC) +# file deletion command +RM= rm -f +# library (.a) file creation command +AR= ar rc +# second step in .a creation (use "touch" if not needed) +AR2= ranlib # source files (independently compilable files) SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.o jvirtmem.o jerror.o +COMOBJECTS= jutils.o jerror.o jmemmgr.o jmemsys.o # compression objectfiles CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ @@ -86,7 +95,7 @@ libjpeg.a: $(LIBOBJECTS) $(AR2) libjpeg.a clean: - $(RM) *.o cjpeg djpeg libjpeg.a core testout.ppm testout.jpg + $(RM) *.o cjpeg djpeg libjpeg.a core testout.* distribute: $(RM) jpegsrc.tar* @@ -94,10 +103,12 @@ distribute: compress -v jpegsrc.tar test: cjpeg djpeg - $(RM) testout.ppm testout.jpg + $(RM) testout.ppm testout.gif testout.jpg ./djpeg testorig.jpg >testout.ppm + ./djpeg -G testorig.jpg >testout.gif ./cjpeg testimg.ppm >testout.jpg cmp testimg.ppm testout.ppm + cmp testimg.gif testout.gif cmp testimg.jpg testout.jpg @@ -127,7 +138,7 @@ jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.o : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -138,3 +149,4 @@ jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.o : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h diff --git a/makefile.bcc b/makefile.bcc new file mode 100644 index 00000000..00b2d7d3 --- /dev/null +++ b/makefile.bcc @@ -0,0 +1,139 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is suitable for Borland C (Turbo C) on MS-DOS. +# It is set up for Borland C++, revision 3.0 or later. +# For older versions (pre-3.0), replace "-O2" with "-O -G -Z" in CFLAGS. +# If you have an even older version of Turbo C, you may be able to make it +# work by saying "CC= tcc" below. (Very early versions of Turbo C++, +# like 1.01, are so buggy that you may as well forget it.) +# Thanks to Tom Wright and Ge' Weijers for this file. + +# Read SETUP instructions before saying "make" !! + +# The name of your C compiler: +CC= bcc + +# You may need to adjust these cc options: +CFLAGS= -DHAVE_STDC -DINCLUDES_ARE_ANSI \ + -ms -DMSDOS -DINCOMPLETE_TYPES_BROKEN -w-par -O2 +# -DHAVE_STDC -DINCLUDES_ARE_ANSI enable ANSI-C features (we DON'T want -A) +# -ms selects small memory model for most efficient code +# -DMSDOS enables DOS-specific code +# -DINCOMPLETE_TYPES_BROKEN suppresses bogus warning about undefined structures +# -w-par suppresses warnings about unused function parameters +# -O2 enables full code optimization (for pre-3.0 Borland C++, use -O -G -Z) + +# Link-time cc options: +LDFLAGS= -ms +# memory model option here must match CFLAGS! + + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj +# compression objectfiles +CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj +COBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS) +# decompression objectfiles +DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \ + jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \ + jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \ + jwrrle.obj jwrtarga.obj +DOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.lib +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) + + +all: cjpeg.exe djpeg.exe + + +cjpeg.exe: $(COBJECTS) + $(CC) $(LDFLAGS) -ecjpeg.exe @makcjpeg.lst + +djpeg.exe: $(DOBJECTS) + $(CC) $(LDFLAGS) -edjpeg.exe @makdjpeg.lst + +.c.obj: + $(CC) $(CFLAGS) -c $< + +clean: + del *.obj + del cjpeg.exe + del djpeg.exe + del testout.* + +test: + del testout.* + djpeg testorig.jpg testout.ppm + djpeg -G testorig.jpg testout.gif + cjpeg testimg.ppm testout.jpg + fc testimg.ppm testout.ppm + fc testimg.gif testout.gif + fc testimg.jpg testout.jpg + + +jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h +jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h +jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h +jmemdosa.obj : jmemdosa.asm + tasm /mx jmemdosa.asm diff --git a/makefile.manx b/makefile.manx index bb89926e..428f3dce 100644 --- a/makefile.manx +++ b/makefile.manx @@ -1,7 +1,8 @@ # Makefile for Independent JPEG Group's software # This makefile is for Amiga systems using Manx Aztec C ver 5.x. -# Thanks to D.J. James for this version. +# Use jmemname.c as the system-dependent memory manager. +# Thanks to D.J. James (djjames@cup.portal.com) for this version. # Read SETUP instructions before saying "make" !! @@ -9,7 +10,8 @@ CC= cc # You may need to adjust these cc options: -CFLAGS= -MC -MD -DTWO_FILE_COMMANDLINE +CFLAGS= -MC -MD -sf -sn -sp -DAMIGA -DTWO_FILE_COMMANDLINE \ + -DNEED_SIGNAL_CATCHER -Dsignal_catcher=_abort # Link-time cc options: LDFLAGS= @@ -30,23 +32,28 @@ AR= lb SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.o jvirtmem.o jerror.o +COMOBJECTS= jutils.o jerror.o jmemmgr.o jmemsys.o # compression objectfiles CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ @@ -79,7 +86,7 @@ libjpeg.lib: $(LIBOBJECTS) $(AR) libjpeg.lib $(LIBOBJECTS) clean: - -$(RM) *.o cjpeg djpeg libjpeg.lib core testout.ppm testout.jpg + -$(RM) *.o cjpeg djpeg libjpeg.lib core testout.* distribute: -$(RM) jpegsrc.tar* @@ -87,10 +94,12 @@ distribute: compress -v jpegsrc.tar test: cjpeg djpeg - -$(RM) testout.ppm testout.jpg + -$(RM) testout.ppm testout.gif testout.jpg djpeg testorig.jpg testout.ppm + djpeg -G testorig.jpg testout.gif cjpeg testimg.ppm testout.jpg cmp testimg.ppm testout.ppm + cmp testimg.gif testout.gif cmp testimg.jpg testout.jpg @@ -120,7 +129,7 @@ jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.o : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -131,3 +140,4 @@ jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.o : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h diff --git a/makefile.mc5 b/makefile.mc5 index 31a6a9b4..62f95b82 100644 --- a/makefile.mc5 +++ b/makefile.mc5 @@ -25,23 +25,28 @@ LDFLAGS= /Fm /F 2000 # /F hhhh sets stack size (in hex) SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.obj jvirtmem.obj jerror.obj +COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj # compression objectfiles CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ @@ -63,6 +68,11 @@ LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) cl $(CFLAGS) /c $*.c lib libjpeg -+$*.obj; +# inference rule for assembly code +.asm.obj: + masm /mx $*; + lib libjpeg -+$*.obj; + jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h @@ -118,7 +128,7 @@ jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.obj : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h @@ -140,6 +150,9 @@ jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h + +jmemdosa.obj : jmemdosa.asm cjpeg.exe: $(COBJECTS) diff --git a/makefile.mc6 b/makefile.mc6 index 8007209c..2373e44b 100644 --- a/makefile.mc6 +++ b/makefile.mc6 @@ -8,39 +8,44 @@ # compiler flags. -D gives a #define to the sources: # -O default optimisation # -W3 warning level 3 -# -Za ANSI conformance, defines__STDC__ but undefines far +# -Za ANSI conformance, defines __STDC__ but undefines far # and near, so we DON'T use it. -# -D__STDC__ pretend we have full ANSI compliance. MSC is near -# enough anyway +# -DHAVE_STDC indicate we do have all the ANSI language features +# -DINCLUDES_ARE_ANSI and all the ANSI include files. # -DMSDOS we are on an MSDOS machine # -DMEM_STATS enable memory usage statistics (optional) # -c compile, don't link (implicit in inference rules) # You might also want to add -G2 if you have an 80286, etc. -CFLAGS = -c -O -W3 -D__STDC__ -DMSDOS +CFLAGS = -c -O -W3 -DHAVE_STDC -DINCLUDES_ARE_ANSI -DMSDOS # source files (independently compilable files) SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.obj jvirtmem.obj jerror.obj +COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj # compression objectfiles CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ @@ -86,7 +91,7 @@ jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.obj : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -97,6 +102,10 @@ jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h + +jmemdosa.obj : jmemdosa.asm + masm /mx $*; # use linker response files because file list > 128 chars @@ -106,3 +115,12 @@ cjpeg.exe: $(COBJECTS) djpeg.exe: $(DOBJECTS) link /STACK:8192 @makdjpeg.lnk + +test: + del testout.* + djpeg testorig.jpg testout.ppm + djpeg -G testorig.jpg testout.gif + cjpeg testimg.ppm testout.jpg + fc testimg.ppm testout.ppm + fc testimg.gif testout.gif + fc testimg.jpg testout.jpg diff --git a/makefile.mms b/makefile.mms new file mode 100644 index 00000000..75c84327 --- /dev/null +++ b/makefile.mms @@ -0,0 +1,134 @@ +# Makefile for Independent JPEG Group's software + +# This makefile is for use with MMS on VAX/VMS systems. +# Thanks to Rick Dyson (dyson@iowasp.physics.uiowa.edu) for his help. + +# Read SETUP instructions before saying "MMS" !! + +CFLAGS= $(CFLAGS) /NoDebug /Optimize /Define = (TWO_FILE_COMMANDLINE,HAVE_STDC,INCLUDES_ARE_ANSI) +OPT= Sys$Disk:[]MAKVMS.OPT + + +# source files (independently compilable files) +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ + jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ + jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm +# files included by source files +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c +# documentation, test, and support files +DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ + makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) +# objectfiles common to cjpeg and djpeg +COMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj +# compression objectfiles +CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ + jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ + jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj +COBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS) +# decompression objectfiles +DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \ + jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \ + jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \ + jwrrle.obj jwrtarga.obj +DOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS) +# These objectfiles are included in libjpeg.olb +LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) +# objectfile lists with commas --- what a crock +COBJLIST= jcmain.obj,jcmaster.obj,jcdeflts.obj,jcarith.obj,jccolor.obj,\ + jcexpand.obj,jchuff.obj,jcmcu.obj,jcpipe.obj,jcsample.obj,\ + jfwddct.obj,jwrjfif.obj,jrdgif.obj,jrdppm.obj,jrdrle.obj,\ + jrdtarga.obj,jutils.obj,jerror.obj,jmemmgr.obj,jmemsys.obj +DOBJLIST= jdmain.obj,jdmaster.obj,jddeflts.obj,jbsmooth.obj,jdarith.obj,\ + jdcolor.obj,jdhuff.obj,jdmcu.obj,jdpipe.obj,jdsample.obj,\ + jquant1.obj,jquant2.obj,jrevdct.obj,jrdjfif.obj,jwrgif.obj,\ + jwrppm.obj,jwrrle.obj,jwrtarga.obj,jutils.obj,jerror.obj,\ + jmemmgr.obj,jmemsys.obj +LIBOBJLIST= jcmaster.obj,jcdeflts.obj,jcarith.obj,jccolor.obj,jcexpand.obj,\ + jchuff.obj,jcmcu.obj,jcpipe.obj,jcsample.obj,jfwddct.obj,\ + jwrjfif.obj,jrdgif.obj,jrdppm.obj,jrdrle.obj,jrdtarga.obj,\ + jdmaster.obj,jddeflts.obj,jbsmooth.obj,jdarith.obj,jdcolor.obj,\ + jdhuff.obj,jdmcu.obj,jdpipe.obj,jdsample.obj,jquant1.obj,\ + jquant2.obj,jrevdct.obj,jrdjfif.obj,jwrgif.obj,jwrppm.obj,\ + jwrrle.obj,jwrtarga.obj,jutils.obj,jerror.obj,jmemmgr.obj,\ + jmemsys.obj + + +.first + @ Define Sys Sys$Library + +# By default, libjpeg.olb is not built unless you explicitly request it. +# You can add libjpeg.olb to the next line if you want it built by default. +ALL : cjpeg.exe djpeg.exe + @ Continue + +cjpeg.exe : $(COBJECTS) + $(LINK) $(LFLAGS) /Executable = cjpeg.exe $(COBJLIST),$(OPT)/Option + +djpeg.exe : $(DOBJECTS) + $(LINK) $(LFLAGS) /Executable = djpeg.exe $(DOBJLIST),$(OPT)/Option + +# libjpeg.olb is useful if you are including the JPEG software in a larger +# program; you'd include it in your link, rather than the individual modules. +libjpeg.olb : $(LIBOBJECTS) + Library /Create libjpeg.olb $(LIBOBJLIST) + +clean : + @- Set Protection = Owner:RWED *.*;-1 + @- Set Protection = Owner:RWED *.OBJ + - Purge /NoLog /NoConfirm *.* + - Delete /NoLog /NoConfirm *.OBJ; + + +jbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h +jcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h +jccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h +jcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h +jcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h +jchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h +jcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h +jcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h +jcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h +jcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h +jdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h +jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h +jddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h +jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h +jdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h +jdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h +jdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h +jdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h +jerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h +jquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h +jquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h +jfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h +jrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h +jutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h +jmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h +jrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h +jrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h +jrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h +jrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h +jrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h +jwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h +jwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h +jwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h +jwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h +jwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h diff --git a/makefile.pwc b/makefile.pwc index f89e8409..8d36310c 100644 --- a/makefile.pwc +++ b/makefile.pwc @@ -2,6 +2,9 @@ # This makefile is for Mix Software's Power C, v2.1.1 # and Dan Grayson's pd make 2.14 under MS-DOS. +# This file assumes that you have Microsoft's MASM or a compatible assembler +# to handle the jmemdosa.asm file. If not, you will need to use jmemname.c +# and go to a large-data memory model. # Thanks to Bob Hardy for this version. # Read SETUP instructions before saying "make" !! @@ -29,17 +32,21 @@ AR=merge # source files (independently compilable files) -SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules -MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) $(TESTFILES) +MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.mix jvirtmem.mix jerror.mix +COMOBJECTS= jutils.mix jerror.mix jmemmgr.mix jmemsys.mix jmemdosa.mix # compression objectfiles CLIBOBJECTS= jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix COBJECTS= jcmain.mix $(CLIBOBJECTS) $(COMOBJECTS) @@ -73,8 +80,10 @@ clean: test: @$(RM) testout.* +djpeg testorig.jpg testout.ppm + +djpeg -G testorig.jpg testout.gif +cjpeg testimg.ppm testout.jpg fc testimg.ppm testout.ppm + fc testimg.gif testout.gif fc testimg.jpg testout.jpg @@ -104,7 +113,7 @@ jquant2.mix : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.mix : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.mix : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.mix : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.mix : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.mix : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.mix : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.mix : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.mix : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -115,3 +124,7 @@ jwrgif.mix : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.mix : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.mix : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.mix : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.mix : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h +jmemdosa.mix : jmemdosa.asm + masm /mx jmemdosa; + mix jmemdosa.obj diff --git a/makefile.sas b/makefile.sas index 877edc53..7b0dd986 100644 --- a/makefile.sas +++ b/makefile.sas @@ -1,6 +1,7 @@ # Makefile for Independent JPEG Group's software # This makefile is for Amiga systems using SAS C 5.10b. +# Use jmemname.c as the system-dependent memory manager. # Contributed by Ed Hanway (sisd!jeh@uunet.uu.net). # Read SETUP instructions before saying "make" !! @@ -17,7 +18,9 @@ SUFFIX= #SUFFIX=.030 # You may need to adjust these cc options: -CFLAGS= -v -b -rr -O -j104 -D__STDC__ -DTWO_FILE_COMMANDLINE -DINCOMPLETE_TYPES_BROKEN $(ARCHFLAGS) +CFLAGS= -v -b -rr -O -j104 $(ARCHFLAGS) -DHAVE_STDC -DINCLUDES_ARE_ANSI \ + -DAMIGA -DTWO_FILE_COMMANDLINE -DINCOMPLETE_TYPES_BROKEN \ + -DNO_MKTEMP -DNEED_SIGNAL_CATCHER # -j104 disables warnings for mismatched const qualifiers # Link-time cc options: @@ -39,23 +42,28 @@ AR= oml SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.o jvirtmem.o jerror.o +COMOBJECTS= jutils.o jerror.o jmemmgr.o jmemsys.o # compression objectfiles CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ @@ -98,7 +106,7 @@ libjpeg.lib: $(LIBOBJECTS) $(AR) libjpeg.lib r $(LIBOBJECTS) clean: - -$(RM) *.o cjpeg djpeg cjpeg.030 djpeg.030 libjpeg.lib core testout.ppm testout.jpg + -$(RM) *.o cjpeg djpeg cjpeg.030 djpeg.030 libjpeg.lib core testout.* distribute: -$(RM) jpegsrc.tar* @@ -106,10 +114,12 @@ distribute: compress -v jpegsrc.tar test: cjpeg djpeg - -$(RM) testout.ppm testout.jpg + -$(RM) testout.ppm testout.gif testout.jpg djpeg testorig.jpg testout.ppm + djpeg -G testorig.jpg testout.gif cjpeg testimg.ppm testout.jpg cmp testimg.ppm testout.ppm + cmp testimg.gif testout.gif cmp testimg.jpg testout.jpg @@ -139,7 +149,7 @@ jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.o : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -150,3 +160,4 @@ jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.o : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h diff --git a/makefile.tc b/makefile.tc deleted file mode 100644 index 6c8eba0b..00000000 --- a/makefile.tc +++ /dev/null @@ -1,113 +0,0 @@ -# Makefile for Independent JPEG Group's software - -# This makefile is suitable for Borland C (Turbo C) on MS-DOS. -# It is set up for Borland C++ revision 2.0; if you have an older -# version of Turbo C, you need to say "CC= tc" below. -# Thanks to Tom Wright for this version. - -# Read SETUP instructions before saying "make" !! - -# The name of your C compiler: -CC= bcc - -# You may need to adjust these cc options: -CFLAGS= -c -ml -DINCOMPLETE_TYPES_BROKEN -# -DINCOMPLETE_TYPES_BROKEN suppresses warnings about undefined structures - -# Link-time cc options: -LDFLAGS= -ml - - -# source files (independently compilable files) -SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ - jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ - jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c -# files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c -# documentation, test, and support files -DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules -MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ - makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) -# objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.obj jvirtmem.obj jerror.obj -# compression objectfiles -CLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \ - jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \ - jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj -COBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS) -# decompression objectfiles -DLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \ - jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \ - jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \ - jwrrle.obj jwrtarga.obj -DOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS) -# These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) - - -all: cjpeg.exe djpeg.exe - - -cjpeg.exe: $(COBJECTS) - $(CC) $(LDFLAGS) -ecjpeg.exe @makcjpeg.lst - -djpeg.exe: $(DOBJECTS) - $(CC) $(LDFLAGS) -edjpeg.exe @makdjpeg.lst - -.c.obj: - $(CC) $(CFLAGS) $< - -test: - del testout.* - djpeg testorig.jpg testout.ppm - cjpeg testimg.ppm testout.jpg - fc testimg.ppm testout.ppm - fc testimg.jpg testout.jpg - - -jbsmooth.o : jbsmooth.c jinclude.h jconfig.h jpegdata.h -jcarith.o : jcarith.c jinclude.h jconfig.h jpegdata.h -jccolor.o : jccolor.c jinclude.h jconfig.h jpegdata.h -jcdeflts.o : jcdeflts.c jinclude.h jconfig.h jpegdata.h -jcexpand.o : jcexpand.c jinclude.h jconfig.h jpegdata.h -jchuff.o : jchuff.c jinclude.h jconfig.h jpegdata.h -jcmain.o : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c -jcmaster.o : jcmaster.c jinclude.h jconfig.h jpegdata.h -jcmcu.o : jcmcu.c jinclude.h jconfig.h jpegdata.h -jcpipe.o : jcpipe.c jinclude.h jconfig.h jpegdata.h -jcsample.o : jcsample.c jinclude.h jconfig.h jpegdata.h -jdarith.o : jdarith.c jinclude.h jconfig.h jpegdata.h -jdcolor.o : jdcolor.c jinclude.h jconfig.h jpegdata.h -jddeflts.o : jddeflts.c jinclude.h jconfig.h jpegdata.h -jdhuff.o : jdhuff.c jinclude.h jconfig.h jpegdata.h -jdmain.o : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c -jdmaster.o : jdmaster.c jinclude.h jconfig.h jpegdata.h -jdmcu.o : jdmcu.c jinclude.h jconfig.h jpegdata.h -jdpipe.o : jdpipe.c jinclude.h jconfig.h jpegdata.h -jdsample.o : jdsample.c jinclude.h jconfig.h jpegdata.h -jerror.o : jerror.c jinclude.h jconfig.h jpegdata.h -jquant1.o : jquant1.c jinclude.h jconfig.h jpegdata.h -jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h -jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h -jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h -jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h -jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h -jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h -jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h -jrdrle.o : jrdrle.c jinclude.h jconfig.h jpegdata.h -jrdtarga.o : jrdtarga.c jinclude.h jconfig.h jpegdata.h -jwrjfif.o : jwrjfif.c jinclude.h jconfig.h jpegdata.h -jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h -jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h -jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h -jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h diff --git a/makefile.unix b/makefile.unix index c0a131f0..701fc4f4 100644 --- a/makefile.unix +++ b/makefile.unix @@ -28,33 +28,42 @@ LDFLAGS= LDLIBS= # miscellaneous OS-dependent stuff -LN= $(CC) # linker -RM= rm -f # file deletion command -AR= ar rc # library (.a) file creation command -AR2= ranlib # second step in .a creation (use "touch" if not needed) +# linker +LN= $(CC) +# file deletion command +RM= rm -f +# library (.a) file creation command +AR= ar rc +# second step in .a creation (use "touch" if not needed) +AR2= ranlib # source files (independently compilable files) SOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \ jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \ jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \ - jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c \ - jvirtmem.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c \ - jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c + jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \ + jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \ + jwrppm.c jwrrle.c jwrtarga.c +# virtual source files (not present in distribution file) +VIRTSOURCES= jmemsys.c +# system-dependent implementations of source files +SYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \ + jmemdosa.asm # files included by source files -INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c +INCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c # documentation, test, and support files DOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules MAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \ - makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.tc \ + makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \ makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \ - makljpeg.cf -OTHERFILES= ansi2knr.c config.c -TESTFILES= testorig.jpg testimg.ppm testimg.jpg -DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(INCLUDES) $(OTHERFILES) \ - $(TESTFILES) + makljpeg.cf makefile.mms makefile.vms makvms.opt +OTHERFILES= ansi2knr.c ckconfig.c example.c +TESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg +DISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \ + $(OTHERFILES) $(TESTFILES) # objectfiles common to cjpeg and djpeg -COMOBJECTS= jutils.o jvirtmem.o jerror.o +COMOBJECTS= jutils.o jerror.o jmemmgr.o jmemsys.o # compression objectfiles CLIBOBJECTS= jcmaster.o jcdeflts.o jcarith.o jccolor.o jcexpand.o jchuff.o \ jcmcu.o jcpipe.o jcsample.o jfwddct.o jwrjfif.o jrdgif.o jrdppm.o \ @@ -101,7 +110,7 @@ libjpeg.a: ansi2knr $(LIBOBJECTS) $(AR2) libjpeg.a clean: - $(RM) *.o cjpeg djpeg libjpeg.a ansi2knr core tmpansi.* testout.ppm testout.jpg + $(RM) *.o cjpeg djpeg libjpeg.a ansi2knr core tmpansi.* testout.* distribute: $(RM) jpegsrc.tar* @@ -109,10 +118,12 @@ distribute: compress -v jpegsrc.tar test: cjpeg djpeg - $(RM) testout.ppm testout.jpg + $(RM) testout.ppm testout.gif testout.jpg ./djpeg testorig.jpg >testout.ppm + ./djpeg -G testorig.jpg >testout.gif ./cjpeg testimg.ppm >testout.jpg cmp testimg.ppm testout.ppm + cmp testimg.gif testout.gif cmp testimg.jpg testout.jpg @@ -142,7 +153,7 @@ jquant2.o : jquant2.c jinclude.h jconfig.h jpegdata.h jfwddct.o : jfwddct.c jinclude.h jconfig.h jpegdata.h jrevdct.o : jrevdct.c jinclude.h jconfig.h jpegdata.h jutils.o : jutils.c jinclude.h jconfig.h jpegdata.h -jvirtmem.o : jvirtmem.c jinclude.h jconfig.h jpegdata.h +jmemmgr.o : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h jrdjfif.o : jrdjfif.c jinclude.h jconfig.h jpegdata.h jrdgif.o : jrdgif.c jinclude.h jconfig.h jpegdata.h jrdppm.o : jrdppm.c jinclude.h jconfig.h jpegdata.h @@ -153,3 +164,4 @@ jwrgif.o : jwrgif.c jinclude.h jconfig.h jpegdata.h jwrppm.o : jwrppm.c jinclude.h jconfig.h jpegdata.h jwrrle.o : jwrrle.c jinclude.h jconfig.h jpegdata.h jwrtarga.o : jwrtarga.c jinclude.h jconfig.h jpegdata.h +jmemsys.o : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h diff --git a/makefile.vms b/makefile.vms new file mode 100644 index 00000000..460363f5 --- /dev/null +++ b/makefile.vms @@ -0,0 +1,64 @@ +$! Makefile for Independent JPEG Group's software +$! +$! This is a command procedure for use on VAX/VMS systems that do not have MMS. +$! It builds the JPEG software by brute force, recompiling everything whether +$! or not it is necessary. +$! Thanks to Rick Dyson (dyson@iowasp.physics.uiowa.edu) for his help. +$! +$! Read SETUP instructions before running this!! +$! +$ DoCompile := CC /NoDebug /Optimize /Define = (TWO_FILE_COMMANDLINE,HAVE_STDC,INCLUDES_ARE_ANSI) +$! +$ DoCompile jcmain.c +$ DoCompile jdmain.c +$ DoCompile jcmaster.c +$ DoCompile jcdeflts.c +$ DoCompile jcarith.c +$ DoCompile jccolor.c +$ DoCompile jcexpand.c +$ DoCompile jchuff.c +$ DoCompile jcmcu.c +$ DoCompile jcpipe.c +$ DoCompile jcsample.c +$ DoCompile jfwddct.c +$ DoCompile jwrjfif.c +$ DoCompile jrdgif.c +$ DoCompile jrdppm.c +$ DoCompile jrdrle.c +$ DoCompile jrdtarga.c +$ DoCompile jdmaster.c +$ DoCompile jddeflts.c +$ DoCompile jbsmooth.c +$ DoCompile jdarith.c +$ DoCompile jdcolor.c +$ DoCompile jdhuff.c +$ DoCompile jdmcu.c +$ DoCompile jdpipe.c +$ DoCompile jdsample.c +$ DoCompile jquant1.c +$ DoCompile jquant2.c +$ DoCompile jrevdct.c +$ DoCompile jrdjfif.c +$ DoCompile jwrgif.c +$ DoCompile jwrppm.c +$ DoCompile jwrrle.c +$ DoCompile jwrtarga.c +$ DoCompile jutils.c +$ DoCompile jerror.c +$ DoCompile jmemmgr.c +$ DoCompile jmemsys.c +$! +$ Library /Create libjpeg.olb jcmaster.obj,jcdeflts.obj,jcarith.obj, - + jccolor.obj,jcexpand.obj,jchuff.obj,jcmcu.obj,jcpipe.obj, - + jcsample.obj,jfwddct.obj,jwrjfif.obj,jrdgif.obj,jrdppm.obj, - + jrdrle.obj,jrdtarga.obj,jdmaster.obj,jddeflts.obj,jbsmooth.obj, - + jdarith.obj,jdcolor.obj,jdhuff.obj,jdmcu.obj,jdpipe.obj, - + jdsample.obj,jquant1.obj,jquant2.obj,jrevdct.obj,jrdjfif.obj, - + jwrgif.obj,jwrppm.obj,jwrrle.obj,jwrtarga.obj,jutils.obj, - + jerror.obj,jmemmgr.obj,jmemsys.obj +$! +$ Link /Executable = cjpeg.exe jcmain.obj,libjpeg.olb/Library,Sys$Disk:[]MAKVMS.OPT/Option +$! +$ Link /Executable = djpeg.exe jdmain.obj,libjpeg.olb/Library,Sys$Disk:[]MAKVMS.OPT/Option +$! +$ Exit diff --git a/makljpeg.cf b/makljpeg.cf index 176fcf30..23c24fa9 100644 --- a/makljpeg.cf +++ b/makljpeg.cf @@ -3,4 +3,5 @@ jcmcu.mix,jcpipe.mix,jcsample.mix,jfwddct.mix,jwrjfif.mix,jrdgif.mix jrdppm.mix,jrdrle.mix,jrdtarga.mix,jdmaster.mix,jddeflts.mix,jbsmooth.mix jdarith.mix,jdcolor.mix,jdhuff.mix,jdmcu.mix,jdpipe.mix,jdsample.mix jquant1.mix,jquant2.mix,jrevdct.mix,jrdjfif.mix,jwrgif.mix,jwrppm.mix -jwrrle.mix,jwrtarga.mix,jutils.mix,jvirtmem.mix,jerror.mix +jwrrle.mix,jwrtarga.mix,jutils.mix,jerror.mix,jmemmgr.mix,jmemsys.mix +jmemdosa.mix diff --git a/makvms.opt b/makvms.opt new file mode 100644 index 00000000..eafc4c91 --- /dev/null +++ b/makvms.opt @@ -0,0 +1,3 @@ +! a pointer to the VAX/VMS C Run-Time Shareable Library +! This file is needed by makefile.mms and makefile.vms +Sys$Library:VAXCRTL.EXE /Share diff --git a/testimg.gif b/testimg.gif new file mode 100644 index 0000000000000000000000000000000000000000..972681439dc5b64a5e3c4a3d2a73fe644bc4bf2c GIT binary patch literal 15754 zcmWlgd0foj_s8GwdC$Hz(`MSIeYBa9N}HMXQkl}Gl4+47nWz-uJzFy>Ox7e!3kG4L z$VZr|X^}7p@d*7a4`@V6{vGfeJ=)|VTrE9G{ zFUO}J@(vo?vhm$N&396>Cu%Dzqqc-$?c(%V7s?JlEm*gX$^Gxb+57d!e?A&Iv$5iQ z?6R#E-uG+agXz1rur@>y7T-I2q0*6)ZI^Ja=s-IxJg^{hIbd=$DP`*Lg^mQ?o9+C6 zH64F6mmjTMlWys|*WEvc>arm)a?espnt62p#%-w0`?W@BEuf5?VsI zE$JI%;R)(>>o=POUq86##?H2>oox>r&t6`YUu>}8OmyDcEA6W4nvU$M?D<~Lw@N?P z?P|poU(YoPXdp0pyFYjER z-Pf`$nA^SKz`qx|?&Sy;A?&XPhDqlJ4W@5`7w@0#Y`?WnJzlx%gtO-=iw>|73837xAIx-P#TZ1;P!mTQLrGTI;rv5#WOv!!7q3FW*^>*CHadZbMG7-D0YlGkacDrz*yxQ zuT#k7tC}0=?srZcxdU(bAaA)M?XF(LIp`BVy|GM}wERHWrUbP86}b6h*5=Jl8M7_t zpYKr!ZG2B8RaN^I7FxtztrR!<=FRR_URzfDTYdX=+R9Zl|5|30&^zjAtYG%&p>`kk zzjbv&kKB6+%T8u(hOMJUwx78puAVNI9Ee)E++e}c__do{IiGH*C(d*&25f$9t(_hE z_s6|UGh_G0j$cRzJasqzSw?Vrb?|J-T>shXBWKcOwXEV2yOadT`}=Ca(ZH11{^4qW z?u|`HW+nBr^_}bJAvp;D31#bPfuOvMvgrg2B#Dt^6mqGe zS;s4J0sfBv_XPku3;g@)^p`t*RN?IB9g0=W;Sx)u$zq>-a`uT>QtrUpV$t9c?)>36 z-1)_~&$_cYJ5O>D!7_dO4D`}V@5bwvXGNf?dv36g@AXOC5!d0obUPwWkOJ(EB%X+7 z$<6OW$4)h$-gz(mSe(%kQ$|_mel_&IuG#%uU)k>a&0tg!erNGSPV;t>@Mrz_Wv%Xc z?Y3D{p8_pkXyQ1{hB_Fo^(dPpM+_@6@yP}cNl$H#^% z2q+|oq%Dq`Tht;IJ$b+8C1)Z22vk z{wV$7<-A8L5=MjL94Bru!}J1%lsB_c$os*YKkri|;eH_FdTFS-mU}t2`<07vaU$at zhDYD;CR5%bKdnqK_CXxCear25kknKA;5d)IpWU&Ru5-}1L32eSky+;(&sIc+@wjj&%KTb%=Gid z(O_xSY+Nqoqc)enc4eOzt3H1+$tXoDLXk)-iD_Y2EwgrVi`v|J7uH_aMl>lkG0bb4 z6l^!0xt12axeI2!kk#Fv|$V1-mwkU1aYM5ao)|fRv&ac|-tL6enTTT^U z$gc?R(hqSsD7tauK>9LPusH8?J-Kox?}5>>9)0IGZ9DC(hnqjE=<7jNfo&!D?_
  • org.libjpegturbo.turbojpeg.TJ
  • org.libjpegturbo.turbojpeg.TJCompressor
  • org.libjpegturbo.turbojpeg.TJDecompressor -
  • org.libjpegturbo.turbojpeg.TJScalingFactor +
  • org.libjpegturbo.turbojpeg.TJScalingFactor
  • org.libjpegturbo.turbojpeg.YUVImage

    Interface Hierarchy diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index 1c12b10e..563b5796 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -97,7 +97,7 @@ Class Hierarchy
  • org.libjpegturbo.turbojpeg.TJ
  • org.libjpegturbo.turbojpeg.TJCompressor
  • org.libjpegturbo.turbojpeg.TJDecompressor -
  • org.libjpegturbo.turbojpeg.TJScalingFactor +
  • org.libjpegturbo.turbojpeg.TJScalingFactor
  • org.libjpegturbo.turbojpeg.YUVImage

    Interface Hierarchy diff --git a/java/org/libjpegturbo/turbojpeg/TJCompressor.java b/java/org/libjpegturbo/turbojpeg/TJCompressor.java index ed8d8e10..0debf53e 100644 --- a/java/org/libjpegturbo/turbojpeg/TJCompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJCompressor.java @@ -46,19 +46,9 @@ public class TJCompressor { init(); } - /** - * @deprecated Use - * {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead. - */ - @Deprecated - public TJCompressor(byte[] srcImage, int width, int pitch, int height, - int pixelFormat) throws Exception { - setSourceImage(srcImage, width, pitch, height, pixelFormat); - } - /** * Create a TurboJPEG compressor instance and associate the uncompressed - * source image stored in srcImage with the newly-created + * source image stored in srcImage with the newly created * instance. * * @param srcImage see {@link #setSourceImage} for description @@ -74,16 +64,26 @@ public class TJCompressor { * @param height see {@link #setSourceImage} for description * * @param pixelFormat pixel format of the source image (one of - * {@link TJ TJ.PF_*}) + * {@link TJ#PF_RGB TJ.PF_*}) */ public TJCompressor(byte[] srcImage, int x, int y, int width, int pitch, int height, int pixelFormat) throws Exception { setSourceImage(srcImage, x, y, width, pitch, height, pixelFormat); } + /** + * @deprecated Use + * {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead. + */ + @Deprecated + public TJCompressor(byte[] srcImage, int width, int pitch, int height, + int pixelFormat) throws Exception { + setSourceImage(srcImage, width, pitch, height, pixelFormat); + } + /** * Create a TurboJPEG compressor instance and associate the uncompressed - * source image stored in srcImage with the newly-created + * source image stored in srcImage with the newly created * instance. * * @param srcImage see @@ -107,34 +107,35 @@ public class TJCompressor { } /** - * Associate an uncompressed source image with this compressor instance. + * Associate an uncompressed RGB, grayscale, or CMYK source image with this + * compressor instance. * * @param srcImage image buffer containing RGB, grayscale, or CMYK pixels to - * be compressed + * be compressed or encoded * - * @param x x offset (in pixels) of the region from which the JPEG image - * should be compressed, relative to the start of srcImage. + * @param x x offset (in pixels) of the region in the source image from which + * the JPEG or YUV image should be compressed/encoded * - * @param y y offset (in pixels) of the region from which the JPEG image - * should be compressed, relative to the start of srcImage. + * @param y y offset (in pixels) of the region in the source image from which + * the JPEG or YUV image should be compressed/encoded * * @param width width (in pixels) of the region in the source image from - * which the JPEG image should be compressed. + * which the JPEG or YUV image should be compressed/encoded * * @param pitch bytes per line of the source image. Normally, this should be * width * TJ.pixelSize(pixelFormat) if the source image is * unpadded, but you can use this parameter to, for instance, specify that * the scanlines in the source image are padded to a 4-byte boundary or to - * compress a JPEG image from a region of a larger source image. You can - * also be clever and use this parameter to skip lines, etc. Setting this - * parameter to 0 is the equivalent of setting it to width * - * TJ.pixelSize(pixelFormat). + * compress/encode a JPEG or YUV image from a region of a larger source + * image. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * TJ.pixelSize(pixelFormat). * * @param height height (in pixels) of the region in the source image from - * which the JPEG image should be compressed. + * which the JPEG or YUV image should be compressed/encoded * * @param pixelFormat pixel format of the source image (one of - * {@link TJ TJ.PF_*}) + * {@link TJ#PF_RGB TJ.PF_*}) */ public void setSourceImage(byte[] srcImage, int x, int y, int width, int pitch, int height, int pixelFormat) @@ -154,7 +155,7 @@ public class TJCompressor { srcX = x; srcY = y; srcBufInt = null; - srcIsYUV = false; + srcYUVImage = null; } /** @@ -169,22 +170,25 @@ public class TJCompressor { } /** - * Associate an uncompressed source image with this compressor instance. + * Associate an uncompressed RGB or grayscale source image with this + * compressor instance. * * @param srcImage a BufferedImage instance containing RGB or - * grayscale pixels to be compressed + * grayscale pixels to be compressed or encoded * * @param x x offset (in pixels) of the region in the source image from which - * the JPEG image should be compressed + * the JPEG or YUV image should be compressed/encoded * * @param y y offset (in pixels) of the region in the source image from which - * the JPEG image should be compressed + * the JPEG or YUV image should be compressed/encoded * * @param width width (in pixels) of the region in the source image from - * which the JPEG image should be compressed (0 = compress the whole image) + * which the JPEG or YUV image should be compressed/encoded (0 = use the + * width of the source image) * * @param height height (in pixels) of the region in the source image from - * which the JPEG image should be compressed (0 = compress the whole image) + * which the JPEG or YUV image should be compressed/encoded (0 = use the + * height of the source image) */ public void setSourceImage(BufferedImage srcImage, int x, int y, int width, int height) throws Exception { @@ -248,42 +252,22 @@ public class TJCompressor { srcBuf = db.getData(); srcBufInt = null; } + srcYUVImage = null; } /** * Associate an uncompressed YUV planar source image with this compressor * instance. * - * @param srcImage image buffer containing a YUV planar image to be - * compressed. The Y, U (Cb), and V (Cr) image planes should be stored - * sequentially in the buffer, and the size of each plane is determined by - * the specified width, height, and padding, as well as the level of - * chrominance subsampling (specified using {@link #setSubsamp}.) If the - * chrominance components are subsampled along the horizontal dimension, then - * the width of the luminance plane should be padded to the nearest multiple - * of 2 (same goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) This is - * irrespective of any additional padding specified in the pad - * parameter. - * - * @param width width (in pixels) of the source image - * - * @param pad the line padding used in the source image. For instance, if - * each line in each plane of the YUV image is padded to the nearest multiple - * of 4 bytes, then pad should be set to 4. - * - * @param height height (in pixels) of the source image + * @param srcImage YUV planar image to be compressed */ - public void setSourceImageYUV(byte[] srcImage, int width, int pad, - int height) throws Exception { + public void setSourceImage(YUVImage srcImage) throws Exception { if (handle == 0) init(); - if (srcImage == null || width < 1 || pad < 1 || height < 1) - throw new Exception("Invalid argument in setSourceImageYUV()"); - srcBuf = srcImage; - srcWidth = width; - srcYUVPad = pad; - srcHeight = height; - srcIsYUV = true; + if (srcImage == null) + throw new Exception("Invalid argument in setSourceImage()"); + srcYUVImage = srcImage; + srcBuf = null; + srcBufInt = null; } /** @@ -296,12 +280,16 @@ public class TJCompressor { * sensitive to small changes in brightness than to small changes in color.) * This is called "chrominance subsampling". *

    - * NOTE: When compressing a YUV planar image into a JPEG image, this method - * also specifies the level of chrominance subsampling used in the source - * image. + * NOTE: This method has no effect when compressing a JPEG image from a YUV + * planar source. In that case, the level of chrominance subsampling in + * the JPEG image is determined by the source. Further, this method has no + * effect when encoding to a pre-allocated {@link YUVImage} instance. In + * that case, the level of chrominance subsampling is determined by the + * destination. * - * @param newSubsamp the new level of chrominance subsampling (one of - * {@link TJ TJ.SAMP_*}) + * @param newSubsamp the level of chrominance subsampling to use in + * subsequent compress/encode oeprations (one of + * {@link TJ#SAMP_444 TJ.SAMP_*}) */ public void setSubsamp(int newSubsamp) throws Exception { if (newSubsamp < 0 || newSubsamp >= TJ.NUMSAMP) @@ -327,23 +315,29 @@ public class TJCompressor { * * @param dstBuf buffer that will receive the JPEG image. Use * {@link TJ#bufSize} to determine the maximum size for this buffer based on - * the image width, height, and level of chrominance subsampling. + * the source image's width and height and the desired level of chrominance + * subsampling. * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public void compress(byte[] dstBuf, int flags) throws Exception { if (dstBuf == null || flags < 0) throw new Exception("Invalid argument in compress()"); - if (srcBuf == null && (srcBufInt == null || srcIsYUV)) + if (srcBuf == null && srcBufInt == null && srcYUVImage == null) throw new Exception(NO_ASSOC_ERROR); if (jpegQuality < 0) throw new Exception("JPEG Quality not set"); - if (subsamp < 0) + if (subsamp < 0 && srcYUVImage == null) throw new Exception("Subsampling level not set"); - if (srcIsYUV) - compressedSize = compressFromYUV(srcBuf, srcWidth, srcYUVPad, srcHeight, - subsamp, dstBuf, jpegQuality, flags); + if (srcYUVImage != null) + compressedSize = compressFromYUV(srcYUVImage.getBuf(), + srcYUVImage.getWidth(), + srcYUVImage.getPad(), + srcYUVImage.getHeight(), + srcYUVImage.getSubsamp(), + dstBuf, jpegQuality, flags); else if (srcBuf != null) { if (srcX >= 0 && srcY >= 0) compressedSize = compress(srcBuf, srcX, srcY, srcWidth, srcPitch, @@ -369,7 +363,8 @@ public class TJCompressor { * Compress the uncompressed source image associated with this compressor * instance and return a buffer containing a JPEG image. * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * * @return a buffer containing a JPEG image. The length of this buffer will * not be equal to the size of the JPEG image. Use {@link @@ -406,82 +401,100 @@ public class TJCompressor { return compress(flags); } - - /** - * Set the plane padding for subsequent YUV encode operations. - * - * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a - * power of 2.) The default padding is 4 bytes, which generates - * images suitable for direct video display. - */ - public void setYUVPad(int pad) throws Exception { - if(pad < 1 || ((pad & (pad - 1)) != 0)) - throw new Exception("Invalid argument in setYUVPad()"); - yuvPad = pad; - } - /** * Encode the uncompressed source image associated with this compressor - * instance and output a YUV planar image to the given destination buffer. - * This method uses the accelerated color conversion routines in TurboJPEG's - * underlying codec but does not execute any of the other steps in the JPEG - * compression process. The Y, U (Cb), and V (Cr) image planes are stored - * sequentially into the destination buffer, and the size of each plane is - * determined by the width and height of the source image, as well as the - * specified padding and level of chrominance subsampling. If the - * chrominance components are subsampled along the horizontal dimension, then - * the width of the luminance plane is padded to the nearest multiple of 2 in - * the output image (same goes for the height of the luminance plane, if the - * chrominance components are subsampled along the vertical dimension.) - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. + * instance into a YUV planar image and store it in the given + * YUVImage instance. This method uses the accelerated color + * conversion routines in TurboJPEG's underlying codec but does not execute + * any of the other steps in the JPEG compression process. Encoding + * CMYK source images to YUV is not supported. * - * @param dstBuf buffer that will receive the YUV planar image. Use - * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer - * based on the image width, height, and level of chrominance subsampling. + * @param dstImage {@link YUVImage} instance that will receive the YUV planar + * image * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ - public void encodeYUV(byte[] dstBuf, int flags) throws Exception { - if (dstBuf == null || flags < 0) - throw new Exception("Invalid argument in compress()"); + public void encodeYUV(YUVImage dstImage, int flags) throws Exception { + if (dstImage == null || flags < 0) + throw new Exception("Invalid argument in encodeYUV()"); if (srcBuf == null && srcBufInt == null) throw new Exception(NO_ASSOC_ERROR); - if (srcIsYUV) + if (srcYUVImage != null) throw new Exception("Source image is not correct type"); if (subsamp < 0) throw new Exception("Subsampling level not set"); + if (srcWidth != dstImage.getWidth() || srcHeight != dstImage.getHeight()) + throw new Exception("Destination image is the wrong size"); if (srcBufInt != null) { - encodeYUV(srcBufInt, srcWidth, srcStride, srcHeight, srcPixelFormat, - dstBuf, yuvPad, subsamp, flags); + encodeYUV(srcBufInt, srcX, srcY, srcWidth, srcStride, srcHeight, + srcPixelFormat, dstImage.getBuf(), dstImage.getPad(), + dstImage.getSubsamp(), flags); } else { - encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight, srcPixelFormat, dstBuf, - yuvPad, subsamp, flags); + encodeYUV(srcBuf, srcX, srcY, srcWidth, srcPitch, srcHeight, + srcPixelFormat, dstImage.getBuf(), dstImage.getPad(), + dstImage.getSubsamp(), flags); } - compressedSize = TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp); + compressedSize = dstImage.getSize(); + } + + /** + * @deprecated Use {@link #encodeYUV(YUVImage, int)} instead. + */ + @Deprecated + public void encodeYUV(byte[] dstBuf, int flags) throws Exception { + if(dstBuf == null) + throw new Exception("Invalid argument in encodeYUV()"); + if (srcWidth < 1 || srcHeight < 1) + throw new Exception(NO_ASSOC_ERROR); + if (subsamp < 0) + throw new Exception("Subsampling level not set"); + YUVImage yuvImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, subsamp); + encodeYUV(yuvImage, flags); } /** * Encode the uncompressed source image associated with this compressor - * instance and return a buffer containing a YUV planar image. See - * {@link #encodeYUV(byte[], int)} for more detail. + * instance into a YUV planar image and return a YUVImage + * instance containing the encoded image. This method uses the accelerated + * color conversion routines in TurboJPEG's underlying codec but does not + * execute any of the other steps in the JPEG compression process. Encoding + * CMYK source images to YUV is not supported. * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param pad the width of each line in each plane of the YUV image will be + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) * - * @return a buffer containing a YUV planar image + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} + * + * @return a YUV planar image */ + public YUVImage encodeYUV(int pad, int flags) throws Exception { + if (srcWidth < 1 || srcHeight < 1) + throw new Exception(NO_ASSOC_ERROR); + if (subsamp < 0) + throw new Exception("Subsampling level not set"); + if(pad < 1 || ((pad & (pad - 1)) != 0)) + throw new Exception("Invalid argument in encodeYUV()"); + YUVImage yuvImage = new YUVImage(srcWidth, pad, srcHeight, subsamp); + encodeYUV(yuvImage, flags); + return yuvImage; + } + + /** + * @deprecated Use {@link #encodeYUV(int, int)} instead. + */ + @Deprecated public byte[] encodeYUV(int flags) throws Exception { if (srcWidth < 1 || srcHeight < 1) throw new Exception(NO_ASSOC_ERROR); if (subsamp < 0) throw new Exception("Subsampling level not set"); - byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, yuvPad, srcHeight, subsamp)]; - encodeYUV(buf, flags); - return buf; + YUVImage yuvImage = new YUVImage(srcWidth, 4, srcHeight, subsamp); + encodeYUV(yuvImage, flags); + return yuvImage.getBuf(); } /** @@ -563,17 +576,17 @@ public class TJCompressor { int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags) throws Exception; // deprecated - private native void encodeYUV(byte[] srcBuf, int width, int pitch, - int height, int pixelFormat, byte[] dstBuf, int pad, int subsamp, - int flags) throws Exception; + private native void encodeYUV(byte[] srcBuf, int x, int y, int width, + int pitch, int height, int pixelFormat, byte[] dstBuf, int pad, + int subsamp, int flags) throws Exception; private native void encodeYUV(int[] srcBuf, int width, int stride, int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags) throws Exception; // deprecated - private native void encodeYUV(int[] srcBuf, int width, int pitch, - int height, int pixelFormat, byte[] dstBuf, int pad, int subsamp, - int flags) throws Exception; + private native void encodeYUV(int[] srcBuf, int x, int y, int width, + int pitch, int height, int pixelFormat, byte[] dstBuf, int pad, + int subsamp, int flags) throws Exception; static { TJLoader.load(); @@ -589,8 +602,7 @@ public class TJCompressor { private int srcPitch = 0; private int srcStride = 0; private int srcPixelFormat = -1; - private int srcYUVPad = -1; - private boolean srcIsYUV; + private YUVImage srcYUVImage = null; private int subsamp = -1; private int jpegQuality = -1; private int compressedSize = 0; diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java index d14a9892..83057212 100644 --- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2013 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2014 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -37,7 +37,7 @@ import java.nio.*; public class TJDecompressor { private static final String NO_ASSOC_ERROR = - "No JPEG image is associated with this instance"; + "No source image is associated with this instance"; /** * Create a TurboJPEG decompresssor instance. @@ -47,21 +47,21 @@ public class TJDecompressor { } /** - * Create a TurboJPEG decompressor instance and associate the JPEG image - * stored in jpegImage with the newly-created instance. + * Create a TurboJPEG decompressor instance and associate the JPEG source + * image stored in jpegImage with the newly created instance. * * @param jpegImage JPEG image buffer (size of the JPEG image is assumed to * be the length of the array) */ public TJDecompressor(byte[] jpegImage) throws Exception { init(); - setJPEGImage(jpegImage, jpegImage.length); + setSourceImage(jpegImage, jpegImage.length); } /** - * Create a TurboJPEG decompressor instance and associate the JPEG image - * of length imageSize bytes stored in jpegImage - * with the newly-created instance. + * Create a TurboJPEG decompressor instance and associate the JPEG source + * image of length imageSize bytes stored in + * jpegImage with the newly created instance. * * @param jpegImage JPEG image buffer * @@ -69,87 +69,150 @@ public class TJDecompressor { */ public TJDecompressor(byte[] jpegImage, int imageSize) throws Exception { init(); - setJPEGImage(jpegImage, imageSize); + setSourceImage(jpegImage, imageSize); + } + + /** + * Create a TurboJPEG decompressor instance and associate the YUV planar + * source image stored in yuvImage with the newly created + * instance. + * + * @param yuvImage {@link YUVImage} instance containing a YUV planar + * image to be decoded + */ + public TJDecompressor(YUVImage yuvImage) throws Exception { + init(); + setSourceImage(yuvImage); } /** * Associate the JPEG image of length imageSize bytes stored in - * jpegImage with this decompressor instance. This image will + * srcImage with this decompressor instance. This image will * be used as the source image for subsequent decompress operations. * - * @param jpegImage JPEG image buffer + * @param srcImage JPEG image buffer * * @param imageSize size of the JPEG image (in bytes) */ - public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception { - if (jpegImage == null || imageSize < 1) - throw new Exception("Invalid argument in setJPEGImage()"); - jpegBuf = jpegImage; + public void setSourceImage(byte[] srcImage, int imageSize) + throws Exception { + if (srcImage == null || imageSize < 1) + throw new Exception("Invalid argument in setSourceImage()"); + jpegBuf = srcImage; jpegBufSize = imageSize; decompressHeader(jpegBuf, jpegBufSize); + yuvImage = null; } /** - * Returns the width of the JPEG image associated with this decompressor - * instance. - * - * @return the width of the JPEG image associated with this decompressor - * instance + * @deprecated Use {@link #setSourceImage(byte[], int)} instead. */ - public int getWidth() throws Exception { - if (jpegWidth < 1) - throw new Exception(NO_ASSOC_ERROR); - return jpegWidth; + @Deprecated + public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception { + setSourceImage(jpegImage, imageSize); } /** - * Returns the height of the JPEG image associated with this decompressor - * instance. + * Associate the specified YUV planar source image with this decompressor + * instance. Subsequent decompress operations will decode this image into an + * RGB or grayscale destination image. * - * @return the height of the JPEG image associated with this decompressor - * instance + * @param srcImage {@link YUVImage} instance containing a YUV planar image to + * be decoded */ - public int getHeight() throws Exception { - if (jpegHeight < 1) - throw new Exception(NO_ASSOC_ERROR); - return jpegHeight; + public void setSourceImage(YUVImage srcImage) throws Exception { + if (srcImage == null) + throw new Exception("Invalid argument in setSourceImage()"); + yuvImage = srcImage; + jpegBuf = null; + jpegBufSize = 0; } - /** - * Returns the level of chrominance subsampling used in the JPEG image - * associated with this decompressor instance. See {@link TJ TJ.SAMP_*}. - * - * @return the level of chrominance subsampling used in the JPEG image - * associated with this decompressor instance - */ - public int getSubsamp() throws Exception { - if (jpegSubsamp < 0) - throw new Exception(NO_ASSOC_ERROR); - if (jpegSubsamp >= TJ.NUMSAMP) - throw new Exception("JPEG header information is invalid"); - return jpegSubsamp; - } /** - * Returns the colorspace used in the JPEG image associated with this - * decompressor instance. See {@link TJ TJ.CS_*}. + * Returns the width of the source image (JPEG or YUV) associated with this + * decompressor instance. * - * @return the colorspace used in the JPEG image associated with this + * @return the width of the source image (JPEG or YUV) associated with this * decompressor instance */ - public int getColorspace() throws Exception { - if (jpegColorspace < 0) + public int getWidth() throws Exception { + if (yuvImage != null) + return yuvImage.getWidth(); + if (srcWidth < 1) throw new Exception(NO_ASSOC_ERROR); - if (jpegColorspace >= TJ.NUMCS) - throw new Exception("JPEG header information is invalid"); - return jpegColorspace; + return srcWidth; } /** - * Returns the JPEG image buffer associated with this decompressor instance. + * Returns the height of the source image (JPEG or YUV) associated with this + * decompressor instance. * - * @return the JPEG image buffer associated with this decompressor instance + * @return the height of the source image (JPEG or YUV) associated with this + * decompressor instance */ + public int getHeight() throws Exception { + if (yuvImage != null) + return yuvImage.getHeight(); + if (srcHeight < 1) + throw new Exception(NO_ASSOC_ERROR); + return srcHeight; + } + + /** + * Returns the level of chrominance subsampling used in the source image + * (JPEG or YUV) associated with this decompressor instance. See + * {@link TJ#SAMP_444 TJ.SAMP_*}. + * + * @return the level of chrominance subsampling used in the source image + * (JPEG or YUV) associated with this decompressor instance + */ + public int getSubsamp() throws Exception { + if (yuvImage != null) + return yuvImage.getSubsamp(); + if (srcSubsamp < 0) + throw new Exception(NO_ASSOC_ERROR); + if (srcSubsamp >= TJ.NUMSAMP) + throw new Exception("JPEG header information is invalid"); + return srcSubsamp; + } + + /** + * Returns the colorspace used in the source image (JPEG or YUV) associated + * with this decompressor instance. See {@link TJ#CS_RGB TJ.CS_*}. If the + * source image is YUV, then this always returns {@link TJ#CS_YCbCr}. + * + * @return the colorspace used in the source image (JPEG or YUV) associated + * with this decompressor instance + */ + public int getColorspace() throws Exception { + if (yuvImage != null) + return TJ.CS_YCbCr; + if (srcColorspace < 0) + throw new Exception(NO_ASSOC_ERROR); + if (srcColorspace >= TJ.NUMCS) + throw new Exception("JPEG header information is invalid"); + return srcColorspace; + } + + /** + * Returns the source image buffer associated with this decompressor + * instance. + * + * @return the source image buffer associated with this decompressor instance + */ + public byte[] getSourceBuf() throws Exception { + if (yuvImage != null) + return yuvImage.getBuf(); + if (jpegBuf == null) + throw new Exception(NO_ASSOC_ERROR); + return jpegBuf; + } + + /** + * @deprecated Use {@link #getSourceBuf} instead. + */ + @Deprecated public byte[] getJPEGBuf() throws Exception { if (jpegBuf == null) throw new Exception(NO_ASSOC_ERROR); @@ -157,18 +220,29 @@ public class TJDecompressor { } /** - * Returns the size of the JPEG image (in bytes) associated with this + * Returns the size of the source image (in bytes) associated with this * decompressor instance. * - * @return the size of the JPEG image (in bytes) associated with this + * @return the size of the source image (in bytes) associated with this * decompressor instance */ - public int getJPEGSize() throws Exception { + public int getSourceSize() throws Exception { + if (yuvImage != null) + return yuvImage.getSize(); if (jpegBufSize < 1) throw new Exception(NO_ASSOC_ERROR); return jpegBufSize; } + /** + * @deprecated Use {@link #getSourceSize} instead. + */ + @Deprecated + public int getJPEGSize() throws Exception { + if (jpegBufSize < 1) + throw new Exception(NO_ASSOC_ERROR); + return jpegBufSize; + } /** * Returns the width of the largest scaled-down image that the TurboJPEG @@ -191,19 +265,19 @@ public class TJDecompressor { */ public int getScaledWidth(int desiredWidth, int desiredHeight) throws Exception { - if (jpegWidth < 1 || jpegHeight < 1) + if (srcWidth < 1 || srcHeight < 1) throw new Exception(NO_ASSOC_ERROR); if (desiredWidth < 0 || desiredHeight < 0) throw new Exception("Invalid argument in getScaledWidth()"); TJScalingFactor[] sf = TJ.getScalingFactors(); if (desiredWidth == 0) - desiredWidth = jpegWidth; + desiredWidth = srcWidth; if (desiredHeight == 0) - desiredHeight = jpegHeight; - int scaledWidth = jpegWidth, scaledHeight = jpegHeight; + desiredHeight = srcHeight; + int scaledWidth = srcWidth, scaledHeight = srcHeight; for (int i = 0; i < sf.length; i++) { - scaledWidth = sf[i].getScaled(jpegWidth); - scaledHeight = sf[i].getScaled(jpegHeight); + scaledWidth = sf[i].getScaled(srcWidth); + scaledHeight = sf[i].getScaled(srcHeight); if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight) break; } @@ -233,19 +307,19 @@ public class TJDecompressor { */ public int getScaledHeight(int desiredWidth, int desiredHeight) throws Exception { - if (jpegWidth < 1 || jpegHeight < 1) + if (srcWidth < 1 || srcHeight < 1) throw new Exception(NO_ASSOC_ERROR); if (desiredWidth < 0 || desiredHeight < 0) throw new Exception("Invalid argument in getScaledHeight()"); TJScalingFactor[] sf = TJ.getScalingFactors(); if (desiredWidth == 0) - desiredWidth = jpegWidth; + desiredWidth = srcWidth; if (desiredHeight == 0) - desiredHeight = jpegHeight; - int scaledWidth = jpegWidth, scaledHeight = jpegHeight; + desiredHeight = srcHeight; + int scaledWidth = srcWidth, scaledHeight = srcHeight; for (int i = 0; i < sf.length; i++) { - scaledWidth = sf[i].getScaled(jpegWidth); - scaledHeight = sf[i].getScaled(jpegHeight); + scaledWidth = sf[i].getScaled(srcWidth); + scaledHeight = sf[i].getScaled(srcHeight); if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight) break; } @@ -255,73 +329,90 @@ public class TJDecompressor { } /** - * Decompress the JPEG source image associated with this decompressor - * instance and output a decompressed image to the given destination buffer. + * Decompress the JPEG source image or decode the YUV source image associated + * with this decompressor instance and output a grayscale, RGB, or CMYK image + * to the given destination buffer. * - * @param dstBuf buffer that will receive the decompressed image. This - * buffer should normally be pitch * scaledHeight bytes in size, - * where scaledHeight can be determined by calling + * @param dstBuf buffer that will receive the decompressed/decoded image. + * If the source image is a JPEG image, then this buffer should normally be + * pitch * scaledHeight bytes in size, where + * scaledHeight can be determined by calling * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight) * with one of the scaling factors returned from {@link - * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However, - * the buffer may also be larger than the dimensions of the JPEG image, in - * which case the x, y, and pitch - * parameters can be used to specify the region into which the JPEG image - * should be decompressed. + * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the + * source image is a YUV image, then this buffer should normally be + * pitch * height bytes in size, where height is + * the height of the YUV image. However, the buffer may also be larger than + * the dimensions of the source image, in which case the x, + * y, and pitch parameters can be used to specify + * the region into which the source image should be decompressed/decoded. * - * @param x x offset (in pixels) of the region into which the JPEG image - * should be decompressed, relative to the start of dstBuf. + * @param x x offset (in pixels) of the region in the destination image into + * which the source image should be decompressed/decoded * - * @param y y offset (in pixels) of the region into which the JPEG image - * should be decompressed, relative to the start of dstBuf. + * @param y y offset (in pixels) of the region in the destination image into + * which the source image should be decompressed/decoded * - * @param desiredWidth desired width (in pixels) of the decompressed image - * (or image region.) If the desired image dimensions are different than the - * dimensions of the JPEG image being decompressed, then TurboJPEG will use - * scaling in the JPEG decompressor to generate the largest possible image - * that will fit within the desired dimensions. Setting this to 0 is the - * same as setting it to the width of the JPEG image (in other words, the - * width will not be considered when determining the scaled image size.) + * @param desiredWidth If the source image is a JPEG image, then this + * specifies the desired width (in pixels) of the decompressed image (or + * image region.) If the desired destination image dimensions are different + * than the source image dimensions, then TurboJPEG will use scaling in the + * JPEG decompressor to generate the largest possible image that will fit + * within the desired dimensions. Setting this to 0 is the same as setting + * it to the width of the JPEG image (in other words, the width will not be + * considered when determining the scaled image size.) This parameter is + * ignored if the source image is a YUV image. * * @param pitch bytes per line of the destination image. Normally, this * should be set to scaledWidth * TJ.pixelSize(pixelFormat) if - * the decompressed image is unpadded, but you can use this to, for instance, - * pad each line of the decompressed image to a 4-byte boundary or to - * decompress the JPEG image into a region of a larger image. NOTE: - * scaledWidth can be determined by calling + * the destination image is unpadded, but you can use this to, for instance, + * pad each line of the destination image to a 4-byte boundary or to + * decompress/decode the source image into a region of a larger image. NOTE: + * if the source image is a JPEG image, then scaledWidth can be + * determined by calling * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth) - * or by calling {@link #getScaledWidth}. Setting this parameter to - * 0 is the equivalent of setting it to scaledWidth * - * TJ.pixelSize(pixelFormat). + * or by calling {@link #getScaledWidth}. If the source image is a + * YUV image, then scaledWidth is the width of the YUV image. + * Setting this parameter to 0 is the equivalent of setting it to + * scaledWidth * TJ.pixelSize(pixelFormat). * - * @param desiredHeight desired height (in pixels) of the decompressed image - * (or image region.) If the desired image dimensions are different than the - * dimensions of the JPEG image being decompressed, then TurboJPEG will use - * scaling in the JPEG decompressor to generate the largest possible image - * that will fit within the desired dimensions. Setting this to 0 is the - * same as setting it to the height of the JPEG image (in other words, the - * height will not be considered when determining the scaled image size.) + * @param desiredHeight If the source image is a JPEG image, then this + * specifies the desired height (in pixels) of the decompressed image (or + * image region.) If the desired destination image dimensions are different + * than the source image dimensions, then TurboJPEG will use scaling in the + * JPEG decompressor to generate the largest possible image that will fit + * within the desired dimensions. Setting this to 0 is the same as setting + * it to the height of the JPEG image (in other words, the height will not be + * considered when determining the scaled image size.) This parameter is + * ignored if the source image is a YUV image. * - * @param pixelFormat pixel format of the decompressed image (one of - * {@link TJ TJ.PF_*}) + * @param pixelFormat pixel format of the decompressed/decoded image (one of + * {@link TJ#PF_RGB TJ.PF_*}) * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public void decompress(byte[] dstBuf, int x, int y, int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags) throws Exception { - if (jpegBuf == null) + if (jpegBuf == null && yuvImage == null) throw new Exception(NO_ASSOC_ERROR); - if (dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || pitch < 0 || - desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || - flags < 0) + if (dstBuf == null || x < 0 || y < 0 || pitch < 0 || + (yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) || + pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); - if (x > 0 || y > 0) - decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch, - desiredHeight, pixelFormat, flags); - else - decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch, - desiredHeight, pixelFormat, flags); + if (yuvImage != null) + decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), + dstBuf, x, y, yuvImage.getWidth(), pitch, yuvImage.getHeight(), + pixelFormat, flags); + else { + if (x > 0 || y > 0) + decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch, + desiredHeight, pixelFormat, flags); + else + decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch, + desiredHeight, pixelFormat, flags); + } } /** @@ -353,15 +444,17 @@ public class TJDecompressor { * for description * * @param pixelFormat pixel format of the decompressed image (one of - * {@link TJ TJ.PF_*}) + * {@link TJ#PF_RGB TJ.PF_*}) * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * * @return a buffer containing the decompressed image */ public byte[] decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags) throws Exception { - if (desiredWidth < 0 || pitch < 0 || desiredHeight < 0 || + if (pitch < 0 || + (yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); int pixelSize = TJ.getPixelSize(pixelFormat); @@ -376,22 +469,60 @@ public class TJDecompressor { /** * Decompress the JPEG source image associated with this decompressor - * instance and output a YUV planar image to the given destination buffer. - * This method performs JPEG decompression but leaves out the color - * conversion step, so a planar YUV image is generated instead of an RGB - * image. The padding of the planes in this image is the same as in the - * images generated by {@link TJCompressor#encodeYUV(byte[], int)}. Note - * that, if the width or height of the image is not an even multiple of the - * MCU block size (see {@link TJ#getMCUWidth} and {@link TJ#getMCUHeight}), - * then an intermediate buffer copy will be performed within TurboJPEG. - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. + * instance into a YUV planar image and store it in the given + * YUVImage instance. This method performs JPEG decompression + * but leaves out the color conversion step, so a planar YUV image is + * generated instead of an RGB or grayscale image. This method cannot be + * used to decompress JPEG source images with the CMYK or YCCK colorspace. * - * @param dstBuf buffer that will receive the YUV planar image. Use - * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer - * based on the image width, height, and level of chrominance subsampling. + * @param dstImage {@link YUVImage} instance that will receive the YUV planar + * image. The level of subsampling specified in this YUVImage + * instance must match that of the JPEG image, and the width and height + * specified in the YUVImage instance must match one of the + * scaled image sizes that TurboJPEG is capable of generating from the JPEG + * source image. + * + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} + */ + public void decompressToYUV(YUVImage dstImage, int flags) throws Exception { + if (jpegBuf == null) + throw new Exception(NO_ASSOC_ERROR); + if (dstImage == null || flags < 0) + throw new Exception("Invalid argument in decompressToYUV()"); + int scaledWidth = getScaledWidth(dstImage.getWidth(), + dstImage.getHeight()); + int scaledHeight = getScaledHeight(dstImage.getWidth(), + dstImage.getHeight()); + if (scaledWidth != dstImage.getWidth() || + scaledHeight != dstImage.getHeight()) + throw new Exception("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating."); + if (srcSubsamp != dstImage.getSubsamp()) + throw new Exception("YUVImage subsampling level does not match that of the JPEG image"); + + decompressToYUV(jpegBuf, jpegBufSize, dstImage.getBuf(), + dstImage.getWidth(), dstImage.getPad(), + dstImage.getHeight(), flags); + } + + /** + * @deprecated Use {@link #decompressToYUV(YUVImage, int)} instead. + */ + @Deprecated + public void decompressToYUV(byte[] dstBuf, int flags) throws Exception { + YUVImage dstImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, + srcSubsamp); + decompressToYUV(dstImage, flags); + } + + /** + * Decompress the JPEG source image associated with this decompressor + * instance into a YUV planar image and return a YUVImage + * instance containing the decompressed image. This method performs JPEG + * decompression but leaves out the color conversion step, so a planar YUV + * image is generated instead of an RGB or grayscale image. This method + * cannot be used to decompress JPEG source images with the CMYK or YCCK + * colorspace. * * @param desiredWidth desired width (in pixels) of the YUV image. If the * desired image dimensions are different than the dimensions of the JPEG @@ -413,60 +544,28 @@ public class TJDecompressor { * the height of the JPEG image (in other words, the height will not be * considered when determining the scaled image size.) * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} + * + * @return a YUV planar image */ - public void decompressToYUV(byte[] dstBuf, int desiredWidth, int pad, - int desiredHeight, int flags) throws Exception { - if (jpegBuf == null) - throw new Exception(NO_ASSOC_ERROR); - if (dstBuf == null || desiredWidth < 0 || pad < 1 || - ((pad & (pad - 1)) != 0) || desiredHeight < 0 || flags < 0) - throw new Exception("Invalid argument in decompressToYUV()"); - decompressToYUV(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pad, - desiredHeight, flags); - } - - /** - * @deprecated Use {@link #decompressToYUV(byte[], int, int, int, int)} - * instead. - */ - @Deprecated - public void decompressToYUV(byte[] dstBuf, int flags) throws Exception { - decompressToYUV(dstBuf, 0, 4, 0, flags); - } - - /** - * Decompress the JPEG source image associated with this decompressor - * instance and return a buffer containing a YUV planar image. See {@link - * #decompressToYUV(byte[], int, int, int, int)} for more detail. - * - * @param desiredWidth see - * {@link #decompressToYUV(byte[], int, int, int, int)} for description - * - * @param pad see {@link #decompressToYUV(byte[], int, int, int, int)} for - * description - * - * @param desiredHeight see {@link - * #decompressToYUV(byte[], int, int, int, int)} for description - * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} - * - * @return a buffer containing a YUV planar image - */ - public byte[] decompressToYUV(int desiredWidth, int pad, int desiredHeight, - int flags) throws Exception { + public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight, + int flags) throws Exception { if (flags < 0) throw new Exception("Invalid argument in decompressToYUV()"); - if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0) + if (srcWidth < 1 || srcHeight < 1 || srcSubsamp < 0) throw new Exception(NO_ASSOC_ERROR); - if (jpegSubsamp >= TJ.NUMSAMP) + if (srcSubsamp >= TJ.NUMSAMP) throw new Exception("JPEG header information is invalid"); + if (yuvImage != null) + throw new Exception("Source image is the wrong type"); + int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); int scaledHeight = getScaledHeight(desiredWidth, desiredHeight); - byte[] buf = new byte[TJ.bufSizeYUV(scaledWidth, pad, scaledHeight, - jpegSubsamp)]; - decompressToYUV(buf, desiredWidth, pad, desiredHeight, flags); - return buf; + YUVImage yuvImage = new YUVImage(scaledWidth, pad, scaledHeight, + srcSubsamp); + decompressToYUV(yuvImage, flags); + return yuvImage; } /** @@ -474,91 +573,126 @@ public class TJDecompressor { */ @Deprecated public byte[] decompressToYUV(int flags) throws Exception { - return decompressToYUV(0, 4, 0, flags); + YUVImage dstImage = new YUVImage(srcWidth, 4, srcHeight, srcSubsamp); + decompressToYUV(dstImage, flags); + return dstImage.getBuf(); } /** - * Decompress the JPEG source image associated with this decompressor - * instance and output a decompressed image to the given destination buffer. + * Decompress the JPEG source image or decode the YUV source image associated + * with this decompressor instance and output a grayscale, RGB, or CMYK image + * to the given destination buffer. * - * @param dstBuf buffer that will receive the decompressed image. This - * buffer should normally be stride * scaledHeight pixels in - * size, where scaledHeight can be determined by calling + * @param dstBuf buffer that will receive the decompressed/decoded image. + * If the source image is a JPEG image, then this buffer should normally be + * stride * scaledHeight pixels in size, where + * scaledHeight can be determined by calling * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight) * with one of the scaling factors returned from {@link - * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. However, - * the buffer may also be larger than the dimensions of the JPEG image, in - * which case the x, y, and stride - * parameters can be used to specify the region into which the JPEG image - * should be decompressed. + * TJ#getScalingFactors} or by calling {@link #getScaledHeight}. If the + * source image is a YUV image, then this buffer should normally be + * stride * height pixels in size, where height is + * the height of the YUV image. However, the buffer may also be larger than + * the dimensions of the JPEG image, in which case the x, + * y, and stride parameters can be used to specify + * the region into which the source image should be decompressed. * - * @param x x offset (in pixels) of the region into which the JPEG image - * should be decompressed, relative to the start of dstBuf. + * @param x x offset (in pixels) of the region in the destination image into + * which the source image should be decompressed/decoded * - * @param y y offset (in pixels) of the region into which the JPEG image - * should be decompressed, relative to the start of dstBuf. + * @param y y offset (in pixels) of the region in the destination image into + * which the source image should be decompressed/decoded * - * @param desiredWidth desired width (in pixels) of the decompressed image - * (or image region.) If the desired image dimensions are different than the - * dimensions of the JPEG image being decompressed, then TurboJPEG will use - * scaling in the JPEG decompressor to generate the largest possible image - * that will fit within the desired dimensions. Setting this to 0 is the - * same as setting it to the width of the JPEG image (in other words, the - * width will not be considered when determining the scaled image size.) + * @param desiredWidth If the source image is a JPEG image, then this + * specifies the desired width (in pixels) of the decompressed image (or + * image region.) If the desired destination image dimensions are different + * than the source image dimensions, then TurboJPEG will use scaling in the + * JPEG decompressor to generate the largest possible image that will fit + * within the desired dimensions. Setting this to 0 is the same as setting + * it to the width of the JPEG image (in other words, the width will not be + * considered when determining the scaled image size.) This parameter is + * ignored if the source image is a YUV image. * * @param stride pixels per line of the destination image. Normally, this * should be set to scaledWidth, but you can use this to, for * instance, decompress the JPEG image into a region of a larger image. - * NOTE: scaledWidth can be determined by calling + * NOTE: if the source image is a JPEG image, then scaledWidth + * can be determined by calling * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth) - * or by calling {@link #getScaledWidth}. Setting this parameter to - * 0 is the equivalent of setting it to scaledWidth. + * or by calling {@link #getScaledWidth}. If the source image is a + * YUV image, then scaledWidth is the width of the YUV image. + * Setting this parameter to 0 is the equivalent of setting it to + * scaledWidth. * - * @param desiredHeight desired height (in pixels) of the decompressed image - * (or image region.) If the desired image dimensions are different than the - * dimensions of the JPEG image being decompressed, then TurboJPEG will use - * scaling in the JPEG decompressor to generate the largest possible image - * that will fit within the desired dimensions. Setting this to 0 is the - * same as setting it to the height of the JPEG image (in other words, the - * height will not be considered when determining the scaled image size.) + * @param desiredHeight If the source image is a JPEG image, then this + * specifies the desired height (in pixels) of the decompressed image (or + * image region.) If the desired destination image dimensions are different + * than the source image dimensions, then TurboJPEG will use scaling in the + * JPEG decompressor to generate the largest possible image that will fit + * within the desired dimensions. Setting this to 0 is the same as setting + * it to the height of the JPEG image (in other words, the height will not be + * considered when determining the scaled image size.) This parameter is + * ignored if the source image is a YUV image. * * @param pixelFormat pixel format of the decompressed image (one of - * {@link TJ TJ.PF_*}) + * {@link TJ#PF_RGB TJ.PF_*}) * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public void decompress(int[] dstBuf, int x, int y, int desiredWidth, int stride, int desiredHeight, int pixelFormat, int flags) throws Exception { - if (jpegBuf == null) + if (jpegBuf == null && yuvImage == null) throw new Exception(NO_ASSOC_ERROR); - if (dstBuf == null || x < 0 || y < 0 || desiredWidth < 0 || stride < 0 || - desiredHeight < 0 || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || - flags < 0) + if (dstBuf == null || x < 0 || y < 0 || stride < 0 || + (yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) || + pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); - decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride, - desiredHeight, pixelFormat, flags); + if (yuvImage != null) + decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), + dstBuf, x, y, yuvImage.getWidth(), stride, + yuvImage.getHeight(), pixelFormat, flags); + else + decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride, + desiredHeight, pixelFormat, flags); } /** - * Decompress the JPEG source image associated with this decompressor - * instance and output a decompressed image to the given - * BufferedImage instance. + * Decompress the JPEG source image or decode the YUV source image associated + * with this decompressor instance and output a decompressed/decoded image to + * the given BufferedImage instance. * * @param dstImage a BufferedImage instance that will receive - * the decompressed image + * the decompressed/decoded image. If the source image is a JPEG image, then + * the width and height of the BufferedImage instance must match + * one of the scaled image sizes that TurboJPEG is capable of generating from + * the JPEG image. If the source image is a YUV image, then the width and + * height of the BufferedImage instance must match the width and + * height of the YUV image. * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public void decompress(BufferedImage dstImage, int flags) throws Exception { if (dstImage == null || flags < 0) throw new Exception("Invalid argument in decompress()"); int desiredWidth = dstImage.getWidth(); int desiredHeight = dstImage.getHeight(); - int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); - int scaledHeight = getScaledHeight(desiredWidth, desiredHeight); - if (scaledWidth != desiredWidth || scaledHeight != desiredHeight) - throw new Exception("BufferedImage dimensions do not match a scaled image size that TurboJPEG is capable of generating."); + int scaledWidth, scaledHeight; + + if (yuvImage != null) { + if (desiredWidth != yuvImage.getWidth() || + desiredHeight != yuvImage.getHeight()) + throw new Exception("BufferedImage dimensions do not match the dimensions of the source image."); + scaledWidth = yuvImage.getWidth(); + scaledHeight = yuvImage.getHeight(); + } else { + scaledWidth = getScaledWidth(desiredWidth, desiredHeight); + scaledHeight = getScaledHeight(desiredWidth, desiredHeight); + if (scaledWidth != desiredWidth || scaledHeight != desiredHeight) + throw new Exception("BufferedImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating."); + } int pixelFormat; boolean intPixels = false; if (byteOrder == null) byteOrder = ByteOrder.nativeOrder(); @@ -599,10 +733,16 @@ public class TJDecompressor { int stride = sm.getScanlineStride(); DataBufferInt db = (DataBufferInt)wr.getDataBuffer(); int[] buf = db.getData(); - if (jpegBuf == null) - throw new Exception(NO_ASSOC_ERROR); - decompress(jpegBuf, jpegBufSize, buf, scaledWidth, stride, scaledHeight, - pixelFormat, flags); + if (yuvImage != null) + decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), + buf, 0, 0, yuvImage.getWidth(), stride, yuvImage.getHeight(), + pixelFormat, flags); + else { + if (jpegBuf == null) + throw new Exception(NO_ASSOC_ERROR); + decompress(jpegBuf, jpegBufSize, buf, 0, 0, scaledWidth, stride, + scaledHeight, pixelFormat, flags); + } } else { ComponentSampleModel sm = (ComponentSampleModel)dstImage.getSampleModel(); @@ -612,14 +752,15 @@ public class TJDecompressor { int pitch = sm.getScanlineStride(); DataBufferByte db = (DataBufferByte)wr.getDataBuffer(); byte[] buf = db.getData(); - decompress(buf, scaledWidth, pitch, scaledHeight, pixelFormat, flags); + decompress(buf, 0, 0, scaledWidth, pitch, scaledHeight, pixelFormat, + flags); } } /** - * Decompress the JPEG source image associated with this decompressor - * instance and return a BufferedImage instance containing the - * decompressed image. + * Decompress the JPEG source image or decode the YUV source image associated + * with this decompressor instance and return a BufferedImage + * instance containing the decompressed/decoded image. * * @param desiredWidth see * {@link #decompress(byte[], int, int, int, int, int, int, int)} for @@ -629,19 +770,21 @@ public class TJDecompressor { * {@link #decompress(byte[], int, int, int, int, int, int, int)} for * description * - * @param bufferedImageType the image type of the newly-created - * BufferedImage instance (for instance, + * @param bufferedImageType the image type of the BufferedImage + * instance that will be created (for instance, * BufferedImage.TYPE_INT_RGB) * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * * @return a BufferedImage instance containing the - * decompressed image + * decompressed/decoded image */ public BufferedImage decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags) throws Exception { - if (desiredWidth < 0 || desiredHeight < 0 || flags < 0) + if ((yuvImage == null && (desiredWidth < 0 || desiredHeight < 0)) || + flags < 0) throw new Exception("Invalid argument in decompress()"); int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); int scaledHeight = getScaledHeight(desiredWidth, desiredHeight); @@ -696,6 +839,14 @@ public class TJDecompressor { private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf, int desiredWidth, int pad, int desiredheight, int flags) throws Exception; + private native void decodeYUV(byte[] srcBuf, int pad, int subsamp, + byte[] dstBuf, int x, int y, int width, int pitch, int height, + int pixelFormat, int flags) throws Exception; + + private native void decodeYUV(byte[] srcBuf, int pad, int subsamp, + int[] dstBuf, int x, int y, int width, int stride, int height, + int pixelFormat, int flags) throws Exception; + static { TJLoader.load(); } @@ -703,9 +854,10 @@ public class TJDecompressor { protected long handle = 0; protected byte[] jpegBuf = null; protected int jpegBufSize = 0; - protected int jpegWidth = 0; - protected int jpegHeight = 0; - protected int jpegSubsamp = -1; - protected int jpegColorspace = -1; + protected YUVImage yuvImage = null; + protected int srcWidth = 0; + protected int srcHeight = 0; + protected int srcSubsamp = -1; + protected int srcColorspace = -1; private ByteOrder byteOrder = null; }; diff --git a/java/org/libjpegturbo/turbojpeg/TJTransformer.java b/java/org/libjpegturbo/turbojpeg/TJTransformer.java index f84eaa12..ee1f6071 100644 --- a/java/org/libjpegturbo/turbojpeg/TJTransformer.java +++ b/java/org/libjpegturbo/turbojpeg/TJTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2011, 2013 D. R. Commander. All Rights Reserved. + * Copyright (C)2011, 2013-2014 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -42,20 +42,20 @@ public class TJTransformer extends TJDecompressor { /** * Create a TurboJPEG lossless transformer instance and associate the JPEG - * image stored in jpegImage with the newly-created instance. + * image stored in jpegImage with the newly created instance. * * @param jpegImage JPEG image buffer (size of the JPEG image is assumed to * be the length of the array) */ public TJTransformer(byte[] jpegImage) throws Exception { init(); - setJPEGImage(jpegImage, jpegImage.length); + setSourceImage(jpegImage, jpegImage.length); } /** * Create a TurboJPEG lossless transformer instance and associate the JPEG * image of length imageSize bytes stored in - * jpegImage with the newly-created instance. + * jpegImage with the newly created instance. * * @param jpegImage JPEG image buffer * @@ -63,7 +63,7 @@ public class TJTransformer extends TJDecompressor { */ public TJTransformer(byte[] jpegImage, int imageSize) throws Exception { init(); - setJPEGImage(jpegImage, imageSize); + setSourceImage(jpegImage, imageSize); } /** @@ -84,13 +84,14 @@ public class TJTransformer extends TJDecompressor { * receive a JPEG image that has been transformed using the parameters in * transforms[i]. Use {@link TJ#bufSize} to determine the * maximum size for each buffer based on the transformed or cropped width and - * height. + * height and the level of subsampling used in the source image. * * @param transforms an array of {@link TJTransform} instances, each of * which specifies the transform parameters and/or cropping region for the * corresponding transformed output image * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public void transform(byte[][] dstBufs, TJTransform[] transforms, int flags) throws Exception { @@ -112,20 +113,21 @@ public class TJTransformer extends TJDecompressor { * @return an array of {@link TJDecompressor} instances, each of * which has a transformed JPEG image associated with it * - * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*} + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} */ public TJDecompressor[] transform(TJTransform[] transforms, int flags) throws Exception { byte[][] dstBufs = new byte[transforms.length][]; - if (jpegWidth < 1 || jpegHeight < 1) + if (srcWidth < 1 || srcHeight < 1) throw new Exception("JPEG buffer not initialized"); for (int i = 0; i < transforms.length; i++) { - int w = jpegWidth, h = jpegHeight; + int w = srcWidth, h = srcHeight; if ((transforms[i].options & TJTransform.OPT_CROP) != 0) { if (transforms[i].width != 0) w = transforms[i].width; if (transforms[i].height != 0) h = transforms[i].height; } - dstBufs[i] = new byte[TJ.bufSize(w, h, jpegSubsamp)]; + dstBufs[i] = new byte[TJ.bufSize(w, h, srcSubsamp)]; } TJDecompressor[] tjd = new TJDecompressor[transforms.length]; transform(dstBufs, transforms, flags); @@ -135,11 +137,11 @@ public class TJTransformer extends TJDecompressor { } /** - * Returns an array containing the sizes of the transformed JPEG images from - * the most recent call to {@link #transform transform()}. + * Returns an array containing the sizes of the transformed JPEG images + * generated by the most recent transform operation. * - * @return an array containing the sizes of the transformed JPEG images from - * the most recent call to {@link #transform transform()} + * @return an array containing the sizes of the transformed JPEG images + * generated by the most recent transform operation */ public int[] getTransformedSizes() throws Exception { if (transformedSizes == null) diff --git a/java/org/libjpegturbo/turbojpeg/YUVImage.java b/java/org/libjpegturbo/turbojpeg/YUVImage.java new file mode 100644 index 00000000..67935936 --- /dev/null +++ b/java/org/libjpegturbo/turbojpeg/YUVImage.java @@ -0,0 +1,193 @@ +/* + * Copyright (C)2014 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +package org.libjpegturbo.turbojpeg; + +/** + * This class encapsulates a YUV planar image buffer and the metadata + * associated with it. The TurboJPEG API allows both the JPEG compression and + * decompression pipelines to be split into stages: YUV encode, compress from + * YUV, decompress to YUV, and YUV decode. A YUVImage instance + * serves as the destination image for YUV encode and decompress-to-YUV + * operations and as the source image for compress-from-YUV and YUV decode + * operations. + *

    + * Technically, the JPEG format uses the YCbCr colorspace (which technically is + * not a "colorspace" but rather a "color transform"), but per the convention + * of the digital video community, the TurboJPEG API uses "YUV" to refer to an + * image format consisting of Y, Cb, and Cr image planes. In this image + * format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same + * image buffer, and the size of each plane is determined by the image width, + * height, line padding, and level of chrominance subsampling. If the + * chrominance components are subsampled along the horizontal dimension, then + * the width of the luminance plane would be padded to the nearest multiple of + * 2 (same goes for the height of the luminance plane, if the chrominance + * components are subsampled along the vertical dimension.) For instance, if + * the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the + * luminance plane would be 36 x 35 bytes, and each of the chrominance planes + * would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 + * bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * each of the chrominance planes would be 20 x 35 bytes. + */ +public class YUVImage { + + private static final String NO_ASSOC_ERROR = + "No YUV buffer is associated with this instance"; + + /** + * Create a YUVImage instance with a new image buffer. + * + * @param width width (in pixels) of the YUV image + * + * @param pad Each line of each plane in the YUV image buffer will be padded + * to this number of bytes (must be a power of 2.) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling to be used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public YUVImage(int width, int pad, int height, int subsamp) + throws Exception { + setBuffer(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad, + height, subsamp); + } + + /** + * Create a YUVImage instance from an existing YUV planar image + * buffer. + * + * @param yuvImage image buffer that contains or will contain YUV planar + * image data. See {@link YUVImage above} for a description of the image + * format. You can use {@link TJ#bufSizeYUV} to determine the appropriate + * size for this buffer. + * + * @param width width (in pixels) of the YUV image + * + * @param pad the line padding used in the YUV image buffer. For + * instance, if each line in each plane of the buffer is padded to the + * nearest multiple of 4 bytes, then pad should be set to 4. + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public YUVImage(byte[] yuvImage, int width, int pad, int height, + int subsamp) throws Exception { + setBuffer(yuvImage, width, pad, height, subsamp); + } + + private void setBuffer(byte[] yuvImage, int width, int pad, int height, + int subsamp) throws Exception { + if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) || + height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP) + throw new Exception("Invalid argument in YUVImage()"); + if (yuvImage.length != TJ.bufSizeYUV(width, pad, height, subsamp)) + throw new Exception("YUV image buffer is the wrong size"); + yuvBuf = yuvImage; + yuvWidth = width; + yuvPad = pad; + yuvHeight = height; + yuvSubsamp = subsamp; + } + + /** + * Returns the width of the YUV image. + * + * @return the width of the YUV image + */ + public int getWidth() throws Exception { + if (yuvWidth < 1) + throw new Exception(NO_ASSOC_ERROR); + return yuvWidth; + } + + /** + * Returns the height of the YUV image. + * + * @return the height of the YUV image + */ + public int getHeight() throws Exception { + if (yuvHeight < 1) + throw new Exception(NO_ASSOC_ERROR); + return yuvHeight; + } + + /** + * Returns the line padding used in the YUV image buffer. + * + * @return the line padding used in the YUV image buffer + */ + public int getPad() throws Exception { + if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0)) + throw new Exception(NO_ASSOC_ERROR); + return yuvPad; + } + + /** + * Returns the level of chrominance subsampling used in the YUV image. See + * {@link TJ#SAMP_444 TJ.SAMP_*}. + * + * @return the level of chrominance subsampling used in the YUV image + */ + public int getSubsamp() throws Exception { + if (yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP) + throw new Exception(NO_ASSOC_ERROR); + return yuvSubsamp; + } + + /** + * Returns the YUV image buffer + * + * @return the YUV image buffer + */ + public byte[] getBuf() throws Exception { + if (yuvBuf == null) + throw new Exception(NO_ASSOC_ERROR); + return yuvBuf; + } + + /** + * Returns the size (in bytes) of the YUV image buffer + * + * @return the size (in bytes) of the YUV image buffer + */ + public int getSize() throws Exception { + if (yuvBuf == null) + throw new Exception(NO_ASSOC_ERROR); + return yuvBuf.length; + } + + protected long handle = 0; + protected byte[] yuvBuf = null; + protected int yuvPad = 0; + protected int yuvWidth = 0; + protected int yuvHeight = 0; + protected int yuvSubsamp = -1; +}; diff --git a/java/org_libjpegturbo_turbojpeg_TJCompressor.h b/java/org_libjpegturbo_turbojpeg_TJCompressor.h index 50070efa..edb23b4d 100644 --- a/java/org_libjpegturbo_turbojpeg_TJCompressor.h +++ b/java/org_libjpegturbo_turbojpeg_TJCompressor.h @@ -74,10 +74,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ /* * Class: org_libjpegturbo_turbojpeg_TJCompressor * Method: encodeYUV - * Signature: ([BIIII[BIII)V + * Signature: ([BIIIIII[BIII)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII - (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII + (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint); /* * Class: org_libjpegturbo_turbojpeg_TJCompressor @@ -90,10 +90,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ /* * Class: org_libjpegturbo_turbojpeg_TJCompressor * Method: encodeYUV - * Signature: ([IIIII[BIII)V + * Signature: ([IIIIIII[BIII)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII - (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII + (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint); #ifdef __cplusplus } diff --git a/java/org_libjpegturbo_turbojpeg_TJDecompressor.h b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h index 203f0048..1d8205c5 100644 --- a/java/org_libjpegturbo_turbojpeg_TJDecompressor.h +++ b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h @@ -79,6 +79,22 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII (JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint); +/* + * Class: org_libjpegturbo_turbojpeg_TJDecompressor + * Method: decodeYUV + * Signature: ([BII[BIIIIIII)V + */ +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII + (JNIEnv *, jobject, jbyteArray, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint); + +/* + * Class: org_libjpegturbo_turbojpeg_TJDecompressor + * Method: decodeYUV + * Signature: ([BII[IIIIIIII)V + */ +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII + (JNIEnv *, jobject, jbyteArray, jint, jint, jintArray, jint, jint, jint, jint, jint, jint, jint); + #ifdef __cplusplus } #endif diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index efe55902..e796cc15 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2013 D. R. Commander. All Rights Reserved. + * Copyright (C)2011-2014 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -250,12 +250,13 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom return (jint)jpegSize; } -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII - (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, - jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags) +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII + (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, + jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, + jint flags) { tjhandle handle=0; - jsize arraySize=0, yuvSize; + jsize arraySize=0, actualPitch, yuvSize; unsigned char *srcBuf=NULL, *dstBuf=NULL; gethandle(); @@ -266,7 +267,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) _throw("Mismatch between Java and C API"); - arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height; + actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; + arraySize=(y+height-1)*actualPitch + x+width; if((*env)->GetArrayLength(env, src)GetPrimitiveArrayCritical(env, src, 0)); bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - if(tjEncodeYUV3(handle, srcBuf, width, pitch, height, pf, dstBuf, pad, - subsamp, flags)==-1) + if(tjEncodeYUV3(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width, + pitch, height, pf, dstBuf, pad, subsamp, flags)==-1) { (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); @@ -297,16 +299,17 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII( - env, obj, src, width, pitch, height, pf, dst, 4, subsamp, flags); + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII( + env, obj, src, 0, 0, width, pitch, height, pf, dst, 4, subsamp, flags); } -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII - (JNIEnv *env, jobject obj, jintArray src, jint width, jint stride, - jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags) +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII + (JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width, + jint stride, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, + jint flags) { tjhandle handle=0; - jsize arraySize=0, yuvSize; + jsize arraySize=0, actualStride, yuvSize; unsigned char *srcBuf=NULL, *dstBuf=NULL; gethandle(); @@ -319,7 +322,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - arraySize=(stride==0)? width*height:stride*height; + actualStride=(stride==0)? width:stride; + arraySize=(y+height-1)*actualStride + x+width; if((*env)->GetArrayLength(env, src)GetPrimitiveArrayCritical(env, src, 0)); bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - if(tjEncodeYUV3(handle, srcBuf, width, stride*sizeof(jint), height, pf, - dstBuf, pad, subsamp, flags)==-1) + if(tjEncodeYUV3(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width, + stride*sizeof(jint), height, pf, dstBuf, pad, subsamp, flags)==-1) { (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); @@ -350,8 +354,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ (JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII( - env, obj, src, width, pitch, height, pf, dst, 4, subsamp, flags); + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII( + env, obj, src, 0, 0, width, pitch, height, pf, dst, 4, subsamp, flags); } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy @@ -435,13 +439,13 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress } (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); jpegBuf=NULL; - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); (*env)->SetIntField(env, obj, _fid, jpegSubsamp); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegColorspace", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcColorspace", "I")); (*env)->SetIntField(env, obj, _fid, jpegColorspace); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I")); (*env)->SetIntField(env, obj, _fid, width); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); (*env)->SetIntField(env, obj, _fid, height); bailout: @@ -562,11 +566,11 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if((*env)->GetArrayLength(env, src)GetFieldID(env, _cls, "jpegSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I")); jpegWidth=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth, @@ -601,6 +605,94 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress env, obj, src, jpegSize, dst, 0, 4, 0, flags); } +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII + (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, + jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, + jint pf, jint flags) +{ + tjhandle handle=0; + jsize arraySize=0, actualPitch; + unsigned char *srcBuf=NULL, *dstBuf=NULL; + + gethandle(); + + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in decodeYUV()"); + if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) + _throw("Mismatch between Java and C API"); + + arraySize=tjBufSizeYUV2(width, pad, height, subsamp); + if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); + bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + + if(tjDecodeYUV(handle, srcBuf, pad, subsamp, + &dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, + flags)==-1) + { + (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); + (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + dstBuf=srcBuf=NULL; + _throw(tjGetErrorStr()); + } + + bailout: + if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); + if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + return; +} + +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII + (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, + jintArray dst, jint x, jint y, jint width, jint stride, jint height, + jint pf, jint flags) +{ + tjhandle handle=0; + jsize arraySize=0, actualStride; + unsigned char *srcBuf=NULL, *dstBuf=NULL; + + gethandle(); + + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in decodeYUV()"); + if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) + _throw("Mismatch between Java and C API"); + if(tjPixelSize[pf]!=sizeof(jint)) + _throw("Pixel format must be 32-bit when decoding to an integer buffer."); + + arraySize=tjBufSizeYUV2(width, pad, height, subsamp); + if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); + bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + + if(tjDecodeYUV(handle, srcBuf, pad, subsamp, + &dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), + height, pf, flags)==-1) + { + (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); + (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + dstBuf=srcBuf=NULL; + _throw(tjGetErrorStr()); + } + + bailout: + if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); + if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + return; +} + JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init (JNIEnv *env, jobject obj) { @@ -698,11 +790,11 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf if((*env)->GetArrayLength(env, jsrcBuf)GetFieldID(env, _cls, "jpegWidth", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I")); jpegWidth=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid); n=(*env)->GetArrayLength(env, dstobjs); diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni index a1be1fd6..283e01f8 100755 --- a/turbojpeg-mapfile.jni +++ b/turbojpeg-mapfile.jni @@ -74,7 +74,9 @@ TURBOJPEG_1.4 tjEncodeYUV3; Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII; Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII; - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BIII; - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BIII; + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII; + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII; Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII; } TURBOJPEG_1.3; From a35cc3acf8837504a59a35fcc2c2f090b41b2396 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 16 Mar 2014 22:59:51 +0000 Subject: [PATCH 862/985] This should have been checked in with the previous commit. --- .../org/libjpegturbo/turbojpeg/YUVImage.html | 583 ++++++++++++++++++ 1 file changed, 583 insertions(+) create mode 100644 java/doc/org/libjpegturbo/turbojpeg/YUVImage.html diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html new file mode 100644 index 00000000..5edc6b09 --- /dev/null +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -0,0 +1,583 @@ + + + + + +YUVImage + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.libjpegturbo.turbojpeg +
    +Class YUVImage

    +
    +java.lang.Object
    +  extended by org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    +
    +
    public class YUVImage
    extends java.lang.Object
    + + +

    +This class encapsulates a YUV planar image buffer and the metadata + associated with it. The TurboJPEG API allows both the JPEG compression and + decompression pipelines to be split into stages: YUV encode, compress from + YUV, decompress to YUV, and YUV decode. A YUVImage instance + serves as the destination image for YUV encode and decompress-to-YUV + operations and as the source image for compress-from-YUV and YUV decode + operations. +

    + Technically, the JPEG format uses the YCbCr colorspace (which technically is + not a "colorspace" but rather a "color transform"), but per the convention + of the digital video community, the TurboJPEG API uses "YUV" to refer to an + image format consisting of Y, Cb, and Cr image planes. In this image + format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same + image buffer, and the size of each plane is determined by the image width, + height, line padding, and level of chrominance subsampling. If the + chrominance components are subsampled along the horizontal dimension, then + the width of the luminance plane would be padded to the nearest multiple of + 2 (same goes for the height of the luminance plane, if the chrominance + components are subsampled along the vertical dimension.) For instance, if + the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the + luminance plane would be 36 x 35 bytes, and each of the chrominance planes + would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 + bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + each of the chrominance planes would be 20 x 35 bytes. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +protected  longhandle + +
    +           
    +protected  byte[]yuvBuf + +
    +           
    +protected  intyuvHeight + +
    +           
    +protected  intyuvPad + +
    +           
    +protected  intyuvSubsamp + +
    +           
    +protected  intyuvWidth + +
    +           
    +  + + + + + + + + + + + + + +
    +Constructor Summary
    YUVImage(byte[] yuvImage, + int width, + int pad, + int height, + int subsamp) + +
    +          Create a YUVImage instance from an existing YUV planar image + buffer.
    YUVImage(int width, + int pad, + int height, + int subsamp) + +
    +          Create a YUVImage instance with a new image buffer.
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    + byte[]getBuf() + +
    +          Returns the YUV image buffer
    + intgetHeight() + +
    +          Returns the height of the YUV image.
    + intgetPad() + +
    +          Returns the line padding used in the YUV image buffer.
    + intgetSize() + +
    +          Returns the size (in bytes) of the YUV image buffer
    + intgetSubsamp() + +
    +          Returns the level of chrominance subsampling used in the YUV image.
    + intgetWidth() + +
    +          Returns the width of the YUV image.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +handle

    +
    +protected long handle
    +
    +
    +
    +
    +
    + +

    +yuvBuf

    +
    +protected byte[] yuvBuf
    +
    +
    +
    +
    +
    + +

    +yuvPad

    +
    +protected int yuvPad
    +
    +
    +
    +
    +
    + +

    +yuvWidth

    +
    +protected int yuvWidth
    +
    +
    +
    +
    +
    + +

    +yuvHeight

    +
    +protected int yuvHeight
    +
    +
    +
    +
    +
    + +

    +yuvSubsamp

    +
    +protected int yuvSubsamp
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +YUVImage

    +
    +public YUVImage(int width,
    +                int pad,
    +                int height,
    +                int subsamp)
    +         throws java.lang.Exception
    +
    +
    Create a YUVImage instance with a new image buffer. +

    +

    +
    Parameters:
    width - width (in pixels) of the YUV image
    pad - Each line of each plane in the YUV image buffer will be padded + to this number of bytes (must be a power of 2.)
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling to be used in the YUV + image (one of TJ.SAMP_*) +
    Throws: +
    java.lang.Exception
    +
    +
    + +

    +YUVImage

    +
    +public YUVImage(byte[] yuvImage,
    +                int width,
    +                int pad,
    +                int height,
    +                int subsamp)
    +         throws java.lang.Exception
    +
    +
    Create a YUVImage instance from an existing YUV planar image + buffer. +

    +

    +
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar + image data. See above for a description of the image + format. You can use TJ.bufSizeYUV(int, int, int, int) to determine the appropriate + size for this buffer.
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For + instance, if each line in each plane of the buffer is padded to the + nearest multiple of 4 bytes, then pad should be set to 4.
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*) +
    Throws: +
    java.lang.Exception
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getWidth

    +
    +public int getWidth()
    +             throws java.lang.Exception
    +
    +
    Returns the width of the YUV image. +

    +

    + +
    Returns:
    the width of the YUV image +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getHeight

    +
    +public int getHeight()
    +              throws java.lang.Exception
    +
    +
    Returns the height of the YUV image. +

    +

    + +
    Returns:
    the height of the YUV image +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getPad

    +
    +public int getPad()
    +           throws java.lang.Exception
    +
    +
    Returns the line padding used in the YUV image buffer. +

    +

    + +
    Returns:
    the line padding used in the YUV image buffer +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getSubsamp

    +
    +public int getSubsamp()
    +               throws java.lang.Exception
    +
    +
    Returns the level of chrominance subsampling used in the YUV image. See + TJ.SAMP_*. +

    +

    + +
    Returns:
    the level of chrominance subsampling used in the YUV image +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getBuf

    +
    +public byte[] getBuf()
    +              throws java.lang.Exception
    +
    +
    Returns the YUV image buffer +

    +

    + +
    Returns:
    the YUV image buffer +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getSize

    +
    +public int getSize()
    +            throws java.lang.Exception
    +
    +
    Returns the size (in bytes) of the YUV image buffer +

    +

    + +
    Returns:
    the size (in bytes) of the YUV image buffer +
    Throws: +
    java.lang.Exception
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + From 821a20d0e85e51307e79365ec32bc9d2eca91e31 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 16 Mar 2014 23:12:25 +0000 Subject: [PATCH 863/985] Generate the Java documentation using javadoc 7, to improve readability. --- java/doc/allclasses-frame.html | 64 +- java/doc/allclasses-noframe.html | 64 +- java/doc/constant-values.html | 913 +++---- java/doc/deprecated-list.html | 506 ++-- java/doc/help-doc.html | 385 ++- java/doc/index-all.html | 1604 ++++++----- java/doc/index.html | 44 +- java/doc/org/libjpegturbo/turbojpeg/TJ.html | 2322 ++++++++-------- .../libjpegturbo/turbojpeg/TJCompressor.html | 1718 ++++++------ .../turbojpeg/TJCustomFilter.html | 417 ++- .../turbojpeg/TJDecompressor.html | 2335 ++++++++--------- .../turbojpeg/TJScalingFactor.html | 650 +++-- .../libjpegturbo/turbojpeg/TJTransform.html | 1413 +++++----- .../libjpegturbo/turbojpeg/TJTransformer.html | 768 +++--- .../org/libjpegturbo/turbojpeg/YUVImage.html | 1026 ++++---- .../libjpegturbo/turbojpeg/package-frame.html | 78 +- .../turbojpeg/package-summary.html | 345 ++- .../libjpegturbo/turbojpeg/package-tree.html | 274 +- java/doc/overview-tree.html | 280 +- java/doc/resources/background.gif | Bin 0 -> 2313 bytes java/doc/resources/inherit.gif | Bin 57 -> 0 bytes java/doc/resources/tab.gif | Bin 0 -> 291 bytes java/doc/resources/titlebar.gif | Bin 0 -> 10701 bytes java/doc/resources/titlebar_end.gif | Bin 0 -> 849 bytes java/doc/serialized-form.html | 322 +-- java/doc/stylesheet.css | 501 +++- 26 files changed, 8007 insertions(+), 8022 deletions(-) create mode 100644 java/doc/resources/background.gif delete mode 100644 java/doc/resources/inherit.gif create mode 100644 java/doc/resources/tab.gif create mode 100644 java/doc/resources/titlebar.gif create mode 100644 java/doc/resources/titlebar_end.gif diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index 2183aa4e..509ea508 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -1,43 +1,23 @@ - - - - -All Classes - - - - - - - - - - -All Classes -
    - - - - - -
    TJ -
    -TJCompressor -
    -TJCustomFilter -
    -TJDecompressor -
    -TJScalingFactor -
    -TJTransform -
    -TJTransformer -
    -YUVImage -
    -
    - - - + + + +All Classes + + + +

    All Classes

    + + + diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html index 41ed55e6..3eac18fa 100644 --- a/java/doc/allclasses-noframe.html +++ b/java/doc/allclasses-noframe.html @@ -1,43 +1,23 @@ - - - - -All Classes - - - - - - - - - - -All Classes -
    - - - - - -
    TJ -
    -TJCompressor -
    -TJCustomFilter -
    -TJDecompressor -
    -TJScalingFactor -
    -TJTransform -
    -TJTransformer -
    -YUVImage -
    -
    - - - + + + +All Classes + + + +

    All Classes

    + + + diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html index 01f950f3..ec1b21d4 100644 --- a/java/doc/constant-values.html +++ b/java/doc/constant-values.html @@ -1,462 +1,479 @@ - - - - -Constant Field Values - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -Constant Field Values

    -
    -
    -Contents - - - - - - -
    -org.libjpegturbo.*
    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    org.libjpegturbo.turbojpeg.TJ
    -public static final intCS_CMYK3
    -public static final intCS_GRAY2
    -public static final intCS_RGB0
    -public static final intCS_YCbCr1
    -public static final intCS_YCCK4
    -public static final intFLAG_ACCURATEDCT4096
    -public static final intFLAG_BOTTOMUP2
    -public static final intFLAG_FASTDCT2048
    -public static final intFLAG_FASTUPSAMPLE256
    -public static final intFLAG_FORCEMMX8
    -public static final intFLAG_FORCESSE16
    -public static final intFLAG_FORCESSE232
    -public static final intFLAG_FORCESSE3128
    -public static final intNUMCS5
    -public static final intNUMPF12
    -public static final intNUMSAMP6
    -public static final intPF_ABGR9
    -public static final intPF_ARGB10
    -public static final intPF_BGR1
    -public static final intPF_BGRA8
    -public static final intPF_BGRX3
    -public static final intPF_CMYK11
    -public static final intPF_GRAY6
    -public static final intPF_RGB0
    -public static final intPF_RGBA7
    -public static final intPF_RGBX2
    -public static final intPF_XBGR4
    -public static final intPF_XRGB5
    -public static final intSAMP_4115
    -public static final intSAMP_4202
    -public static final intSAMP_4221
    -public static final intSAMP_4404
    -public static final intSAMP_4440
    -public static final intSAMP_GRAY3
    - -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    org.libjpegturbo.turbojpeg.TJTransform
    -public static final intNUMOP8
    -public static final intOP_HFLIP1
    -public static final intOP_NONE0
    -public static final intOP_ROT1806
    -public static final intOP_ROT2707
    -public static final intOP_ROT905
    -public static final intOP_TRANSPOSE3
    -public static final intOP_TRANSVERSE4
    -public static final intOP_VFLIP2
    -public static final intOPT_CROP4
    -public static final intOPT_GRAY8
    -public static final intOPT_NOOUTPUT16
    -public static final intOPT_PERFECT1
    -public static final intOPT_TRIM2
    - -

    - -

    -


    - - +
    +

    Constant Field Values

    +

    Contents

    + +
    +
    + + +

    org.libjpegturbo.*

    + +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index a0a67a6d..79fd7ed9 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -1,276 +1,258 @@ - - - - -Deprecated List - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -Deprecated API

    -
    -
    -Contents - - - - - - - - - - - - - - - - - - -
    -Deprecated Fields
    org.libjpegturbo.turbojpeg.TJ.FLAG_FORCEMMX -
    -           
    org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE -
    -           
    org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE2 -
    -           
    org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE3 -
    -           
    -  -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Deprecated Methods
    org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int) -
    -          Use TJ.bufSizeYUV(int, int, int, int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int) -
    -          Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.compress(byte[], int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int) -
    -          Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.compress(int) instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int) -
    -          Use - TJDecompressor.decompress(byte[], int, int, int, int, int, int, int) instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int) -
    -          Use TJDecompressor.decompressToYUV(YUVImage, int) instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(int) -
    -          Use TJDecompressor.decompressToYUV(int, int, int, int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int) -
    -          Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.encodeYUV(byte[], int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int) -
    -          Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.encodeYUV(int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int) -
    -          Use TJCompressor.encodeYUV(YUVImage, int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(int) -
    -          Use TJCompressor.encodeYUV(int, int) instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGBuf() -
    -          Use TJDecompressor.getSourceBuf() instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGSize() -
    -          Use TJDecompressor.getSourceSize() instead. 
    org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int) -
    -          Use TJDecompressor.setSourceImage(byte[], int) instead. 
    org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int) -
    -          Use - TJCompressor.setSourceImage(byte[], int, int, int, int, int, int) instead. 
    -  -

    - - - - - - - - -
    -Deprecated Constructors
    org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int) -
    -          Use - TJCompressor.TJCompressor(byte[], int, int, int, int, int, int) instead. 
    -  -

    -


    - - + +
    + + + + + + + + + + + +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html index b919d0aa..ce749a93 100644 --- a/java/doc/help-doc.html +++ b/java/doc/help-doc.html @@ -1,207 +1,206 @@ - - - - -API Help - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -How This API Document Is Organized

    -
    -This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

    -Package

    -
    - -

    -Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

      -
    • Interfaces (italic)
    • Classes
    • Enums
    • Exceptions
    • Errors
    • Annotation Types
    -
    -

    -Class/Interface

    -
    - -

    -Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

      -
    • Class inheritance diagram
    • Direct Subclasses
    • All Known Subinterfaces
    • All Known Implementing Classes
    • Class/interface declaration
    • Class/interface description -

      -

    • Nested Class Summary
    • Field Summary
    • Constructor Summary
    • Method Summary -

      -

    • Field Detail
    • Constructor Detail
    • Method Detail
    -Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
    - -

    -Annotation Type

    -
    - -

    -Each annotation type has its own separate page with the following sections:

      -
    • Annotation Type declaration
    • Annotation Type description
    • Required Element Summary
    • Optional Element Summary
    • Element Detail
    -
    - -

    -Enum

    -
    - -

    -Each enum has its own separate page with the following sections:

      -
    • Enum declaration
    • Enum description
    • Enum Constant Summary
    • Enum Constant Detail
    -
    -

    -Tree (Class Hierarchy)

    -
    -There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    -
    -

    -Deprecated API

    -
    -The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
    -

    -Index

    -
    -The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
    -

    -Prev/Next

    -These links take you to the next or previous class, interface, package, or related page.

    -Frames/No Frames

    -These links show and hide the HTML frames. All pages are available with or without frames. -

    -

    -Serialized Form

    -Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. -

    -

    -Constant Field Values

    -The Constant Field Values page lists the static final fields and their values. -

    - - -This help file applies to API documentation generated using the standard doclet. - -
    -


    - - +
    +

    How This API Document Is Organized

    +
    This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
    +
    +
    +
      +
    • +

      Package

      +

      Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

      +
        +
      • Interfaces (italic)
      • +
      • Classes
      • +
      • Enums
      • +
      • Exceptions
      • +
      • Errors
      • +
      • Annotation Types
      • +
      +
    • +
    • +

      Class/Interface

      +

      Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

      +
        +
      • Class inheritance diagram
      • +
      • Direct Subclasses
      • +
      • All Known Subinterfaces
      • +
      • All Known Implementing Classes
      • +
      • Class/interface declaration
      • +
      • Class/interface description
      • +
      +
        +
      • Nested Class Summary
      • +
      • Field Summary
      • +
      • Constructor Summary
      • +
      • Method Summary
      • +
      +
        +
      • Field Detail
      • +
      • Constructor Detail
      • +
      • Method Detail
      • +
      +

      Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

      +
    • +
    • +

      Annotation Type

      +

      Each annotation type has its own separate page with the following sections:

      +
        +
      • Annotation Type declaration
      • +
      • Annotation Type description
      • +
      • Required Element Summary
      • +
      • Optional Element Summary
      • +
      • Element Detail
      • +
      +
    • +
    • +

      Enum

      +

      Each enum has its own separate page with the following sections:

      +
        +
      • Enum declaration
      • +
      • Enum description
      • +
      • Enum Constant Summary
      • +
      • Enum Constant Detail
      • +
      +
    • +
    • +

      Tree (Class Hierarchy)

      +

      There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

      +
        +
      • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
      • +
      • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
      • +
      +
    • +
    • +

      Deprecated API

      +

      The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

      +
    • +
    • +

      Index

      +

      The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

      +
    • +
    • +

      Prev/Next

      +

      These links take you to the next or previous class, interface, package, or related page.

      +
    • +
    • +

      Frames/No Frames

      +

      These links show and hide the HTML frames. All pages are available with or without frames.

      +
    • +
    • +

      All Classes

      +

      The All Classes link shows all classes and interfaces except non-static nested types.

      +
    • +
    • +

      Serialized Form

      +

      Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

      +
    • +
    • +

      Constant Field Values

      +

      The Constant Field Values page lists the static final fields and their values.

      +
    • +
    +This help file applies to API documentation generated using the standard doclet.
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index df71bdee..c8a4f0c9 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -1,749 +1,919 @@ - - - - -Index - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -B C D E F G H I J N O P S T Y
    -

    -B

    -
    -
    bufSize(int, int, int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG - image with the given width, height, and level of chrominance subsampling. -
    bufSizeYUV(int, int, int, int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns the size of the buffer (in bytes) required to hold a YUV planar - image with the given width, height, and level of chrominance subsampling. -
    bufSizeYUV(int, int, int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Deprecated. Use TJ.bufSizeYUV(int, int, int, int) instead. -
    -
    -

    -C

    -
    -
    cf - -Variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Custom filter instance -
    close() - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Free the native structures associated with this compressor instance. -
    close() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Free the native structures associated with this decompressor instance. -
    compress(byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Compress the uncompressed source image associated with this compressor - instance and output a JPEG image to the given destination buffer. -
    compress(int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Compress the uncompressed source image associated with this compressor - instance and return a buffer containing a JPEG image. -
    compress(BufferedImage, byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.compress(byte[], int) instead. -
    compress(BufferedImage, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.compress(int) instead. -
    CS_CMYK - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    CMYK colorspace. -
    CS_GRAY - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Grayscale colorspace. -
    CS_RGB - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    RGB colorspace. -
    CS_YCbCr - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    YCbCr colorspace. -
    CS_YCCK - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    YCCK colorspace. -
    customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform) - -Method in interface org.libjpegturbo.turbojpeg.TJCustomFilter -
    A callback function that can be used to modify the DCT coefficients after +
    B C D E F G H I J N O P S T Y  + + +

    B

    +
    +
    bufSize(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG + image with the given width, height, and level of chrominance subsampling.
    +
    +
    bufSizeYUV(int, int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the size of the buffer (in bytes) required to hold a YUV planar + image with the given width, height, and level of chrominance subsampling.
    +
    +
    bufSizeYUV(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Deprecated. + +
    +
    +
    + + + +

    C

    +
    +
    cf - Variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Custom filter instance
    +
    +
    close() - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Free the native structures associated with this compressor instance.
    +
    +
    close() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Free the native structures associated with this decompressor instance.
    +
    +
    compress(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Compress the uncompressed source image associated with this compressor + instance and output a JPEG image to the given destination buffer.
    +
    +
    compress(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Compress the uncompressed source image associated with this compressor + instance and return a buffer containing a JPEG image.
    +
    +
    compress(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    compress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    CS_CMYK - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    CMYK colorspace.
    +
    +
    CS_GRAY - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Grayscale colorspace.
    +
    +
    CS_RGB - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    RGB colorspace.
    +
    +
    CS_YCbCr - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    YCbCr colorspace.
    +
    +
    CS_YCCK - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    YCCK colorspace.
    +
    +
    customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform) - Method in interface org.libjpegturbo.turbojpeg.TJCustomFilter
    +
    +
    A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new - JPEG image. -
    -
    -

    -D

    -
    -
    decompress(byte[], int, int, int, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image or decode the YUV source image associated + JPEG image.
    +
    +
    + + + +

    D

    +
    +
    decompress(byte[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer. -
    decompress(byte[], int, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use - TJDecompressor.decompress(byte[], int, int, int, int, int, int, int) instead. -
    decompress(int, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image associated with this decompressor - instance and return a buffer containing the decompressed image. -
    decompress(int[], int, int, int, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image or decode the YUV source image associated + to the given destination buffer. +
    +
    decompress(byte[], int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    + +
    +
    decompress(int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image associated with this decompressor + instance and return a buffer containing the decompressed image.
    +
    +
    decompress(int[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer. -
    decompress(BufferedImage, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image or decode the YUV source image associated + to the given destination buffer. +
    +
    decompress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to - the given BufferedImage instance. -
    decompress(int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image or decode the YUV source image associated + the given BufferedImage instance. +
    +
    decompress(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a BufferedImage - instance containing the decompressed/decoded image. -
    decompressToYUV(YUVImage, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image associated with this decompressor + instance containing the decompressed/decoded image. +
    +
    decompressToYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given - YUVImage instance. -
    decompressToYUV(byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use TJDecompressor.decompressToYUV(YUVImage, int) instead. -
    decompressToYUV(int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Decompress the JPEG source image associated with this decompressor + YUVImage instance. +
    +
    decompressToYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    + +
    +
    decompressToYUV(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and return a YUVImage - instance containing the decompressed image. -
    decompressToYUV(int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use TJDecompressor.decompressToYUV(int, int, int, int) instead. -
    -
    -

    -E

    -
    -
    encodeYUV(YUVImage, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Encode the uncompressed source image associated with this compressor + instance containing the decompressed image. +
    +
    decompressToYUV(int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    + +
    +
    + + + +

    E

    +
    +
    encodeYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given - YUVImage instance. -
    encodeYUV(byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use TJCompressor.encodeYUV(YUVImage, int) instead. -
    encodeYUV(int, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Encode the uncompressed source image associated with this compressor + YUVImage instance. +
    +
    encodeYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Deprecated. + +
    +
    +
    encodeYUV(int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Encode the uncompressed source image associated with this compressor instance into a YUV planar image and return a YUVImage - instance containing the encoded image. -
    encodeYUV(int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use TJCompressor.encodeYUV(int, int) instead. -
    encodeYUV(BufferedImage, byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.encodeYUV(byte[], int) instead. -
    encodeYUV(BufferedImage, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and - TJCompressor.encodeYUV(int) instead. -
    equals(TJScalingFactor) - -Method in class org.libjpegturbo.turbojpeg.TJScalingFactor -
    Returns true or false, depending on whether this instance and - other have the same numerator and denominator. -
    -
    -

    -F

    -
    -
    finalize() - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
      -
    finalize() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    FLAG_ACCURATEDCT - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Use the most accurate DCT/IDCT algorithm available in the underlying - codec. -
    FLAG_BOTTOMUP - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    The uncompressed source/destination image is stored in bottom-up (Windows, - OpenGL) order, not top-down (X11) order. -
    FLAG_FASTDCT - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Use the fastest DCT/IDCT algorithm available in the underlying codec. -
    FLAG_FASTUPSAMPLE - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    When decompressing an image that was compressed using chrominance + instance containing the encoded image. +
    +
    encodeYUV(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Deprecated. + +
    +
    +
    encodeYUV(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    encodeYUV(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    equals(TJScalingFactor) - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    +
    Returns true or false, depending on whether this instance and + other have the same numerator and denominator.
    +
    +
    + + + +

    F

    +
    +
    finalize() - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
     
    +
    finalize() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    FLAG_ACCURATEDCT - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Use the most accurate DCT/IDCT algorithm available in the underlying + codec.
    +
    +
    FLAG_BOTTOMUP - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    The uncompressed source/destination image is stored in bottom-up (Windows, + OpenGL) order, not top-down (X11) order.
    +
    +
    FLAG_FASTDCT - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Use the fastest DCT/IDCT algorithm available in the underlying codec.
    +
    +
    FLAG_FASTUPSAMPLE - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in - the underlying codec. -
    FLAG_FORCEMMX - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Deprecated.  -
    FLAG_FORCESSE - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Deprecated.  -
    FLAG_FORCESSE2 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Deprecated.  -
    FLAG_FORCESSE3 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Deprecated.  -
    -
    -

    -G

    -
    -
    getBlueOffset(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    For the given pixel format, returns the number of bytes that the blue - component is offset from the start of the pixel. -
    getBuf() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the YUV image buffer -
    getColorspace() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the colorspace used in the source image (JPEG or YUV) associated - with this decompressor instance. -
    getCompressedSize() - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Returns the size of the image (in bytes) generated by the most recent - compress/encode operation. -
    getDenom() - -Method in class org.libjpegturbo.turbojpeg.TJScalingFactor -
    Returns denominator -
    getGreenOffset(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    For the given pixel format, returns the number of bytes that the green - component is offset from the start of the pixel. -
    getHeight() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the height of the source image (JPEG or YUV) associated with this - decompressor instance. -
    getHeight() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the height of the YUV image. -
    getJPEGBuf() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use TJDecompressor.getSourceBuf() instead. -
    getJPEGSize() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use TJDecompressor.getSourceSize() instead. -
    getMCUHeight(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns the MCU block height for the given level of chrominance - subsampling. -
    getMCUWidth(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns the MCU block width for the given level of chrominance - subsampling. -
    getNum() - -Method in class org.libjpegturbo.turbojpeg.TJScalingFactor -
    Returns numerator -
    getPad() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the line padding used in the YUV image buffer. -
    getPixelSize(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns the pixel size (in bytes) for the given pixel format. -
    getRedOffset(int) - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    For the given pixel format, returns the number of bytes that the red - component is offset from the start of the pixel. -
    getScaled(int) - -Method in class org.libjpegturbo.turbojpeg.TJScalingFactor -
    Returns the scaled value of dimension. -
    getScaledHeight(int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the height of the largest scaled-down image that the TurboJPEG + the underlying codec. +
    +
    FLAG_FORCEMMX - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Deprecated.
    +
    +
    FLAG_FORCESSE - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Deprecated.
    +
    +
    FLAG_FORCESSE2 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Deprecated.
    +
    +
    FLAG_FORCESSE3 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Deprecated.
    +
    +
    + + + +

    G

    +
    +
    getBlueOffset(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    For the given pixel format, returns the number of bytes that the blue + component is offset from the start of the pixel.
    +
    +
    getBuf() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the YUV image buffer
    +
    +
    getColorspace() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the colorspace used in the source image (JPEG or YUV) associated + with this decompressor instance.
    +
    +
    getCompressedSize() - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Returns the size of the image (in bytes) generated by the most recent + compress/encode operation.
    +
    +
    getDenom() - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    +
    Returns denominator
    +
    +
    getGreenOffset(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    For the given pixel format, returns the number of bytes that the green + component is offset from the start of the pixel.
    +
    +
    getHeight() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the height of the source image (JPEG or YUV) associated with this + decompressor instance.
    +
    +
    getHeight() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the height of the YUV image.
    +
    +
    getJPEGBuf() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Deprecated. + +
    +
    +
    getJPEGSize() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Deprecated. + +
    +
    +
    getMCUHeight(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the MCU block height for the given level of chrominance + subsampling.
    +
    +
    getMCUWidth(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the MCU block width for the given level of chrominance + subsampling.
    +
    +
    getNum() - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    +
    Returns numerator
    +
    +
    getPad() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the line padding used in the YUV image buffer.
    +
    +
    getPixelSize(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the pixel size (in bytes) for the given pixel format.
    +
    +
    getRedOffset(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    For the given pixel format, returns the number of bytes that the red + component is offset from the start of the pixel.
    +
    +
    getScaled(int) - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    +
    Returns the scaled value of dimension.
    +
    +
    getScaledHeight(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height. -
    getScaledWidth(int, int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the width of the largest scaled-down image that the TurboJPEG + height. +
    +
    getScaledWidth(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height. -
    getScalingFactors() - -Static method in class org.libjpegturbo.turbojpeg.TJ -
    Returns a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports. -
    getSize() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the size (in bytes) of the YUV image buffer -
    getSourceBuf() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the source image buffer associated with this decompressor - instance. -
    getSourceSize() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the size of the source image (in bytes) associated with this - decompressor instance. -
    getSubsamp() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the level of chrominance subsampling used in the source image - (JPEG or YUV) associated with this decompressor instance. -
    getSubsamp() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the level of chrominance subsampling used in the YUV image. -
    getTransformedSizes() - -Method in class org.libjpegturbo.turbojpeg.TJTransformer -
    Returns an array containing the sizes of the transformed JPEG images - generated by the most recent transform operation. -
    getWidth() - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Returns the width of the source image (JPEG or YUV) associated with this - decompressor instance. -
    getWidth() - -Method in class org.libjpegturbo.turbojpeg.YUVImage -
    Returns the width of the YUV image. -
    -
    -

    -H

    -
    -
    handle - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    handle - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    -
    -

    -I

    -
    -
    isOne() - -Method in class org.libjpegturbo.turbojpeg.TJScalingFactor -
    Returns true or false, depending on whether this instance is equal to - 1/1. -
    -
    -

    -J

    -
    -
    jpegBuf - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    jpegBufSize - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    -
    -

    -N

    -
    -
    NUMCS - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    The number of JPEG colorspaces -
    NUMOP - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    The number of lossless transform operations -
    NUMPF - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    The number of pixel formats -
    NUMSAMP - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    The number of chrominance subsampling options -
    -
    -

    -O

    -
    -
    op - -Variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Transform operation (one of OP_*) -
    OP_HFLIP - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Flip (mirror) image horizontally. -
    OP_NONE - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Do not transform the position of the image pixels. -
    OP_ROT180 - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Rotate image 180 degrees. -
    OP_ROT270 - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Rotate image counter-clockwise by 90 degrees. -
    OP_ROT90 - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Rotate image clockwise by 90 degrees. -
    OP_TRANSPOSE - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Transpose image (flip/mirror along upper left to lower right axis). -
    OP_TRANSVERSE - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Transverse transpose image (flip/mirror along upper right to lower left - axis). -
    OP_VFLIP - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Flip (mirror) image vertically. -
    OPT_CROP - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    This option will enable lossless cropping. -
    OPT_GRAY - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    This option will discard the color data in the input image and produce - a grayscale output image. -
    OPT_NOOUTPUT - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this - particular transform. -
    OPT_PERFECT - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    This option will cause TJTransformer.transform() to throw an exception if the transform is not - perfect. -
    OPT_TRIM - -Static variable in class org.libjpegturbo.turbojpeg.TJTransform -
    This option will discard any partial MCU blocks that cannot be - transformed. -
    options - -Variable in class org.libjpegturbo.turbojpeg.TJTransform -
    Transform options (bitwise OR of one or more of OPT_*) -
    org.libjpegturbo.turbojpeg - package org.libjpegturbo.turbojpeg
     
    -
    -

    -P

    -
    -
    PF_ABGR - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    ABGR pixel format. -
    PF_ARGB - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    ARGB pixel format. -
    PF_BGR - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    BGR pixel format. -
    PF_BGRA - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    BGRA pixel format. -
    PF_BGRX - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    BGRX pixel format. -
    PF_CMYK - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    CMYK pixel format. -
    PF_GRAY - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Grayscale pixel format. -
    PF_RGB - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    RGB pixel format. -
    PF_RGBA - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    RGBA pixel format. -
    PF_RGBX - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    RGBX pixel format. -
    PF_XBGR - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    XBGR pixel format. -
    PF_XRGB - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    XRGB pixel format. -
    -
    -

    -S

    -
    -
    SAMP_411 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    4:1:1 chrominance subsampling. -
    SAMP_420 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    4:2:0 chrominance subsampling. -
    SAMP_422 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    4:2:2 chrominance subsampling. -
    SAMP_440 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    4:4:0 chrominance subsampling. -
    SAMP_444 - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    4:4:4 chrominance subsampling (no chrominance subsampling). -
    SAMP_GRAY - -Static variable in class org.libjpegturbo.turbojpeg.TJ -
    Grayscale. -
    setJPEGImage(byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Deprecated. Use TJDecompressor.setSourceImage(byte[], int) instead. -
    setJPEGQuality(int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Set the JPEG image quality level for subsequent compress operations. -
    setSourceImage(byte[], int, int, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Associate an uncompressed RGB, grayscale, or CMYK source image with this - compressor instance. -
    setSourceImage(byte[], int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.setSourceImage(byte[], int, int, int, int, int, int) instead. -
    setSourceImage(BufferedImage, int, int, int, int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Associate an uncompressed RGB or grayscale source image with this - compressor instance. -
    setSourceImage(YUVImage) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Associate an uncompressed YUV planar source image with this compressor - instance. -
    setSourceImage(byte[], int) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Associate the JPEG image of length imageSize bytes stored in - srcImage with this decompressor instance. -
    setSourceImage(YUVImage) - -Method in class org.libjpegturbo.turbojpeg.TJDecompressor -
    Associate the specified YUV planar source image with this decompressor - instance. -
    setSubsamp(int) - -Method in class org.libjpegturbo.turbojpeg.TJCompressor -
    Set the level of chrominance subsampling for subsequent compress/encode - operations. -
    srcColorspace - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    srcHeight - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    srcSubsamp - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    srcWidth - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    -
    -

    -T

    -
    -
    TJ - Class in org.libjpegturbo.turbojpeg
    TurboJPEG utility class (cannot be instantiated)
    TJ() - -Constructor for class org.libjpegturbo.turbojpeg.TJ -
      -
    TJCompressor - Class in org.libjpegturbo.turbojpeg
    TurboJPEG compressor
    TJCompressor() - -Constructor for class org.libjpegturbo.turbojpeg.TJCompressor -
    Create a TurboJPEG compressor instance. -
    TJCompressor(byte[], int, int, int, int, int, int) - -Constructor for class org.libjpegturbo.turbojpeg.TJCompressor -
    Create a TurboJPEG compressor instance and associate the uncompressed + height. +
    +
    getScalingFactors() - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns a list of fractional scaling factors that the JPEG decompressor in + this implementation of TurboJPEG supports.
    +
    +
    getSize() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the size (in bytes) of the YUV image buffer
    +
    +
    getSourceBuf() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the source image buffer associated with this decompressor + instance.
    +
    +
    getSourceSize() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the size of the source image (in bytes) associated with this + decompressor instance.
    +
    +
    getSubsamp() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the level of chrominance subsampling used in the source image + (JPEG or YUV) associated with this decompressor instance.
    +
    +
    getSubsamp() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the level of chrominance subsampling used in the YUV image.
    +
    +
    getTransformedSizes() - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Returns an array containing the sizes of the transformed JPEG images + generated by the most recent transform operation.
    +
    +
    getWidth() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Returns the width of the source image (JPEG or YUV) associated with this + decompressor instance.
    +
    +
    getWidth() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the width of the YUV image.
    +
    +
    + + + +

    H

    +
    +
    handle - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    handle - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    + + + +

    I

    +
    +
    isOne() - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    +
    Returns true or false, depending on whether this instance is equal to + 1/1.
    +
    +
    + + + +

    J

    +
    +
    jpegBuf - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    jpegBufSize - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    + + + +

    N

    +
    +
    NUMCS - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    The number of JPEG colorspaces
    +
    +
    NUMOP - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    The number of lossless transform operations
    +
    +
    NUMPF - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    The number of pixel formats
    +
    +
    NUMSAMP - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    The number of chrominance subsampling options
    +
    +
    + + + +

    O

    +
    +
    op - Variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Transform operation (one of OP_*)
    +
    +
    OP_HFLIP - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Flip (mirror) image horizontally.
    +
    +
    OP_NONE - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Do not transform the position of the image pixels.
    +
    +
    OP_ROT180 - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Rotate image 180 degrees.
    +
    +
    OP_ROT270 - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Rotate image counter-clockwise by 90 degrees.
    +
    +
    OP_ROT90 - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Rotate image clockwise by 90 degrees.
    +
    +
    OP_TRANSPOSE - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Transpose image (flip/mirror along upper left to lower right axis).
    +
    +
    OP_TRANSVERSE - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Transverse transpose image (flip/mirror along upper right to lower left + axis).
    +
    +
    OP_VFLIP - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Flip (mirror) image vertically.
    +
    +
    OPT_CROP - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    This option will enable lossless cropping.
    +
    +
    OPT_GRAY - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    This option will discard the color data in the input image and produce + a grayscale output image.
    +
    +
    OPT_NOOUTPUT - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this + particular transform.
    +
    +
    OPT_PERFECT - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    This option will cause TJTransformer.transform() to throw an exception if the transform is not + perfect.
    +
    +
    OPT_TRIM - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    This option will discard any partial MCU blocks that cannot be + transformed.
    +
    +
    options - Variable in class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Transform options (bitwise OR of one or more of OPT_*)
    +
    +
    org.libjpegturbo.turbojpeg - package org.libjpegturbo.turbojpeg
    +
     
    +
    + + + +

    P

    +
    +
    PF_ABGR - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    ABGR pixel format.
    +
    +
    PF_ARGB - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    ARGB pixel format.
    +
    +
    PF_BGR - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    BGR pixel format.
    +
    +
    PF_BGRA - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    BGRA pixel format.
    +
    +
    PF_BGRX - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    BGRX pixel format.
    +
    +
    PF_CMYK - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    CMYK pixel format.
    +
    +
    PF_GRAY - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Grayscale pixel format.
    +
    +
    PF_RGB - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    RGB pixel format.
    +
    +
    PF_RGBA - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    RGBA pixel format.
    +
    +
    PF_RGBX - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    RGBX pixel format.
    +
    +
    PF_XBGR - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    XBGR pixel format.
    +
    +
    PF_XRGB - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    XRGB pixel format.
    +
    +
    + + + +

    S

    +
    +
    SAMP_411 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    4:1:1 chrominance subsampling.
    +
    +
    SAMP_420 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    4:2:0 chrominance subsampling.
    +
    +
    SAMP_422 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    4:2:2 chrominance subsampling.
    +
    +
    SAMP_440 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    4:4:0 chrominance subsampling.
    +
    +
    SAMP_444 - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    4:4:4 chrominance subsampling (no chrominance subsampling).
    +
    +
    SAMP_GRAY - Static variable in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Grayscale.
    +
    +
    setJPEGImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Deprecated. + +
    +
    +
    setJPEGQuality(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Set the JPEG image quality level for subsequent compress operations.
    +
    +
    setSourceImage(byte[], int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Associate an uncompressed RGB, grayscale, or CMYK source image with this + compressor instance.
    +
    +
    setSourceImage(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    setSourceImage(BufferedImage, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Associate an uncompressed RGB or grayscale source image with this + compressor instance.
    +
    +
    setSourceImage(YUVImage) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Associate an uncompressed YUV planar source image with this compressor + instance.
    +
    +
    setSourceImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Associate the JPEG image of length imageSize bytes stored in + srcImage with this decompressor instance.
    +
    +
    setSourceImage(YUVImage) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Associate the specified YUV planar source image with this decompressor + instance.
    +
    +
    setSubsamp(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Set the level of chrominance subsampling for subsequent compress/encode + operations.
    +
    +
    srcColorspace - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    srcHeight - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    srcSubsamp - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    srcWidth - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    + + + +

    T

    +
    +
    TJ - Class in org.libjpegturbo.turbojpeg
    +
    +
    TurboJPEG utility class (cannot be instantiated)
    +
    +
    TJ() - Constructor for class org.libjpegturbo.turbojpeg.TJ
    +
     
    +
    TJCompressor - Class in org.libjpegturbo.turbojpeg
    +
    +
    TurboJPEG compressor
    +
    +
    TJCompressor() - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Create a TurboJPEG compressor instance.
    +
    +
    TJCompressor(byte[], int, int, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created - instance. -
    TJCompressor(byte[], int, int, int, int) - -Constructor for class org.libjpegturbo.turbojpeg.TJCompressor -
    Deprecated. Use - TJCompressor.TJCompressor(byte[], int, int, int, int, int, int) instead. -
    TJCompressor(BufferedImage, int, int, int, int) - -Constructor for class org.libjpegturbo.turbojpeg.TJCompressor -
    Create a TurboJPEG compressor instance and associate the uncompressed + instance. +
    +
    TJCompressor(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    + +
    +
    TJCompressor(BufferedImage, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created - instance. -
    TJCustomFilter - Interface in org.libjpegturbo.turbojpeg
    Custom filter callback interface
    TJDecompressor - Class in org.libjpegturbo.turbojpeg
    TurboJPEG decompressor
    TJDecompressor() - -Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor -
    Create a TurboJPEG decompresssor instance. -
    TJDecompressor(byte[]) - -Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor -
    Create a TurboJPEG decompressor instance and associate the JPEG source - image stored in jpegImage with the newly created instance. -
    TJDecompressor(byte[], int) - -Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor -
    Create a TurboJPEG decompressor instance and associate the JPEG source + instance. +
    +
    TJCustomFilter - Interface in org.libjpegturbo.turbojpeg
    +
    +
    Custom filter callback interface
    +
    +
    TJDecompressor - Class in org.libjpegturbo.turbojpeg
    +
    +
    TurboJPEG decompressor
    +
    +
    TJDecompressor() - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Create a TurboJPEG decompresssor instance.
    +
    +
    TJDecompressor(byte[]) - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Create a TurboJPEG decompressor instance and associate the JPEG source + image stored in jpegImage with the newly created instance.
    +
    +
    TJDecompressor(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Create a TurboJPEG decompressor instance and associate the JPEG source image of length imageSize bytes stored in - jpegImage with the newly created instance. -
    TJDecompressor(YUVImage) - -Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor -
    Create a TurboJPEG decompressor instance and associate the YUV planar + jpegImage with the newly created instance. +
    +
    TJDecompressor(YUVImage) - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Create a TurboJPEG decompressor instance and associate the YUV planar source image stored in yuvImage with the newly created - instance. -
    TJScalingFactor - Class in org.libjpegturbo.turbojpeg
    Fractional scaling factor
    TJScalingFactor(int, int) - -Constructor for class org.libjpegturbo.turbojpeg.TJScalingFactor -
      -
    TJTransform - Class in org.libjpegturbo.turbojpeg
    Lossless transform parameters
    TJTransform() - -Constructor for class org.libjpegturbo.turbojpeg.TJTransform -
    Create a new lossless transform instance. -
    TJTransform(int, int, int, int, int, int, TJCustomFilter) - -Constructor for class org.libjpegturbo.turbojpeg.TJTransform -
    Create a new lossless transform instance with the given parameters. -
    TJTransform(Rectangle, int, int, TJCustomFilter) - -Constructor for class org.libjpegturbo.turbojpeg.TJTransform -
    Create a new lossless transform instance with the given parameters. -
    TJTransformer - Class in org.libjpegturbo.turbojpeg
    TurboJPEG lossless transformer
    TJTransformer() - -Constructor for class org.libjpegturbo.turbojpeg.TJTransformer -
    Create a TurboJPEG lossless transformer instance. -
    TJTransformer(byte[]) - -Constructor for class org.libjpegturbo.turbojpeg.TJTransformer -
    Create a TurboJPEG lossless transformer instance and associate the JPEG - image stored in jpegImage with the newly created instance. -
    TJTransformer(byte[], int) - -Constructor for class org.libjpegturbo.turbojpeg.TJTransformer -
    Create a TurboJPEG lossless transformer instance and associate the JPEG + instance. +
    +
    TJScalingFactor - Class in org.libjpegturbo.turbojpeg
    +
    +
    Fractional scaling factor
    +
    +
    TJScalingFactor(int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
     
    +
    TJTransform - Class in org.libjpegturbo.turbojpeg
    +
    +
    Lossless transform parameters
    +
    +
    TJTransform() - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Create a new lossless transform instance.
    +
    +
    TJTransform(int, int, int, int, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Create a new lossless transform instance with the given parameters.
    +
    +
    TJTransform(Rectangle, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    +
    +
    Create a new lossless transform instance with the given parameters.
    +
    +
    TJTransformer - Class in org.libjpegturbo.turbojpeg
    +
    +
    TurboJPEG lossless transformer
    +
    +
    TJTransformer() - Constructor for class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Create a TurboJPEG lossless transformer instance.
    +
    +
    TJTransformer(byte[]) - Constructor for class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Create a TurboJPEG lossless transformer instance and associate the JPEG + image stored in jpegImage with the newly created instance.
    +
    +
    TJTransformer(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Create a TurboJPEG lossless transformer instance and associate the JPEG image of length imageSize bytes stored in - jpegImage with the newly created instance. -
    transform(byte[][], TJTransform[], int) - -Method in class org.libjpegturbo.turbojpeg.TJTransformer -
    Losslessly transform the JPEG image associated with this transformer + jpegImage with the newly created instance. +
    +
    transform(byte[][], TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Losslessly transform the JPEG image associated with this transformer instance into one or more JPEG images stored in the given destination - buffers. -
    transform(TJTransform[], int) - -Method in class org.libjpegturbo.turbojpeg.TJTransformer -
    Losslessly transform the JPEG image associated with this transformer - instance and return an array of TJDecompressor instances, each of - which has a transformed JPEG image associated with it. -
    -
    -

    -Y

    -
    -
    yuvBuf - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    yuvHeight - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    yuvImage - -Variable in class org.libjpegturbo.turbojpeg.TJDecompressor -
      -
    YUVImage - Class in org.libjpegturbo.turbojpeg
    This class encapsulates a YUV planar image buffer and the metadata - associated with it.
    YUVImage(int, int, int, int) - -Constructor for class org.libjpegturbo.turbojpeg.YUVImage -
    Create a YUVImage instance with a new image buffer. -
    YUVImage(byte[], int, int, int, int) - -Constructor for class org.libjpegturbo.turbojpeg.YUVImage -
    Create a YUVImage instance from an existing YUV planar image - buffer. -
    yuvPad - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    yuvSubsamp - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    yuvWidth - -Variable in class org.libjpegturbo.turbojpeg.YUVImage -
      -
    -
    -B C D E F G H I J N O P S T Y - + buffers. + +
    transform(TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    +
    +
    Losslessly transform the JPEG image associated with this transformer + instance and return an array of TJDecompressor instances, each of + which has a transformed JPEG image associated with it.
    +
    + + + + +

    Y

    +
    +
    yuvBuf - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    yuvHeight - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    yuvImage - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    YUVImage - Class in org.libjpegturbo.turbojpeg
    +
    +
    This class encapsulates a YUV planar image buffer and the metadata + associated with it.
    +
    +
    YUVImage(int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Create a YUVImage instance with a new image buffer.
    +
    +
    YUVImage(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Create a YUVImage instance from an existing YUV planar image + buffer.
    +
    +
    yuvPad - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    yuvSubsamp - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    yuvWidth - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    +B C D E F G H I J N O P S T Y  - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/index.html b/java/doc/index.html index 356cd1d9..25a639d4 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -1,11 +1,9 @@ - - - - -Generated Documentation (Untitled) - - - - - - - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to<A HREF="org/libjpegturbo/turbojpeg/package-summary.html">Non-frame version.</A> - - - + + + + + + +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<h2>Frame Alert</h2> +<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="org/libjpegturbo/turbojpeg/package-summary.html">Non-frame version</a>.</p> + + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJ.html b/java/doc/org/libjpegturbo/turbojpeg/TJ.html index bad022e1..ee22e763 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJ.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJ.html @@ -1,809 +1,712 @@ - - - - -TJ - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJ

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.TJ
    -
    -
    -
    -
    public final class TJ
    extends java.lang.Object
    - - -

    -TurboJPEG utility class (cannot be instantiated) -

    - -

    -


    - -

    +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJ

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • org.libjpegturbo.turbojpeg.TJ
      • +
      +
    • +
    +
    +
      +
    • +
      +
      +
      public final class TJ
      +extends java.lang.Object
      +
      TurboJPEG utility class (cannot be instantiated)
      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      -Field Summary
      -static intCS_CMYK - -
      -          CMYK colorspace.
      -static intCS_GRAY - -
      -          Grayscale colorspace.
      -static intCS_RGB - -
      -          RGB colorspace.
      -static intCS_YCbCr - -
      -          YCbCr colorspace.
      -static intCS_YCCK - -
      -          YCCK colorspace.
      -static intFLAG_ACCURATEDCT - -
      -          Use the most accurate DCT/IDCT algorithm available in the underlying - codec.
      -static intFLAG_BOTTOMUP - -
      -          The uncompressed source/destination image is stored in bottom-up (Windows, - OpenGL) order, not top-down (X11) order.
      -static intFLAG_FASTDCT - -
      -          Use the fastest DCT/IDCT algorithm available in the underlying codec.
      -static intFLAG_FASTUPSAMPLE - -
      -          When decompressing an image that was compressed using chrominance +
        +
      • + + +

        Field Summary

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Fields 
        Modifier and TypeField and Description
        static intCS_CMYK +
        CMYK colorspace.
        +
        static intCS_GRAY +
        Grayscale colorspace.
        +
        static intCS_RGB +
        RGB colorspace.
        +
        static intCS_YCbCr +
        YCbCr colorspace.
        +
        static intCS_YCCK +
        YCCK colorspace.
        +
        static intFLAG_ACCURATEDCT +
        Use the most accurate DCT/IDCT algorithm available in the underlying + codec.
        +
        static intFLAG_BOTTOMUP +
        The uncompressed source/destination image is stored in bottom-up (Windows, + OpenGL) order, not top-down (X11) order.
        +
        static intFLAG_FASTDCT +
        Use the fastest DCT/IDCT algorithm available in the underlying codec.
        +
        static intFLAG_FASTUPSAMPLE +
        When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in - the underlying codec.
        -static intFLAG_FORCEMMX - -
        -          Deprecated. 
        -static intFLAG_FORCESSE - -
        -          Deprecated. 
        -static intFLAG_FORCESSE2 - -
        -          Deprecated. 
        -static intFLAG_FORCESSE3 - -
        -          Deprecated. 
        -static intNUMCS - -
        -          The number of JPEG colorspaces
        -static intNUMPF - -
        -          The number of pixel formats
        -static intNUMSAMP - -
        -          The number of chrominance subsampling options
        -static intPF_ABGR - -
        -          ABGR pixel format.
        -static intPF_ARGB - -
        -          ARGB pixel format.
        -static intPF_BGR - -
        -          BGR pixel format.
        -static intPF_BGRA - -
        -          BGRA pixel format.
        -static intPF_BGRX - -
        -          BGRX pixel format.
        -static intPF_CMYK - -
        -          CMYK pixel format.
        -static intPF_GRAY - -
        -          Grayscale pixel format.
        -static intPF_RGB - -
        -          RGB pixel format.
        -static intPF_RGBA - -
        -          RGBA pixel format.
        -static intPF_RGBX - -
        -          RGBX pixel format.
        -static intPF_XBGR - -
        -          XBGR pixel format.
        -static intPF_XRGB - -
        -          XRGB pixel format.
        -static intSAMP_411 - -
        -          4:1:1 chrominance subsampling.
        -static intSAMP_420 - -
        -          4:2:0 chrominance subsampling.
        -static intSAMP_422 - -
        -          4:2:2 chrominance subsampling.
        -static intSAMP_440 - -
        -          4:4:0 chrominance subsampling.
        -static intSAMP_444 - -
        -          4:4:4 chrominance subsampling (no chrominance subsampling).
        -static intSAMP_GRAY - -
        -          Grayscale.
        -  + the underlying codec. +
      static intFLAG_FORCEMMX +
      Deprecated. 
      +
      static intFLAG_FORCESSE +
      Deprecated. 
      +
      static intFLAG_FORCESSE2 +
      Deprecated. 
      +
      static intFLAG_FORCESSE3 +
      Deprecated. 
      +
      static intNUMCS +
      The number of JPEG colorspaces
      +
      static intNUMPF +
      The number of pixel formats
      +
      static intNUMSAMP +
      The number of chrominance subsampling options
      +
      static intPF_ABGR +
      ABGR pixel format.
      +
      static intPF_ARGB +
      ARGB pixel format.
      +
      static intPF_BGR +
      BGR pixel format.
      +
      static intPF_BGRA +
      BGRA pixel format.
      +
      static intPF_BGRX +
      BGRX pixel format.
      +
      static intPF_CMYK +
      CMYK pixel format.
      +
      static intPF_GRAY +
      Grayscale pixel format.
      +
      static intPF_RGB +
      RGB pixel format.
      +
      static intPF_RGBA +
      RGBA pixel format.
      +
      static intPF_RGBX +
      RGBX pixel format.
      +
      static intPF_XBGR +
      XBGR pixel format.
      +
      static intPF_XRGB +
      XRGB pixel format.
      +
      static intSAMP_411 +
      4:1:1 chrominance subsampling.
      +
      static intSAMP_420 +
      4:2:0 chrominance subsampling.
      +
      static intSAMP_422 +
      4:2:2 chrominance subsampling.
      +
      static intSAMP_440 +
      4:4:0 chrominance subsampling.
      +
      static intSAMP_444 +
      4:4:4 chrominance subsampling (no chrominance subsampling).
      +
      static intSAMP_GRAY +
      Grayscale.
      +
      +
    • +
    - - - - - - - - - -
    -Constructor Summary
    TJ() - -
    -           
    -  +
      +
    • + + +

      Constructor Summary

      + + + + + + + + +
      Constructors 
      Constructor and Description
      TJ() 
      +
    • +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    -static intbufSize(int width, - int height, - int jpegSubsamp) - -
    -          Returns the maximum size of the buffer (in bytes) required to hold a JPEG - image with the given width, height, and level of chrominance subsampling.
    -static intbufSizeYUV(int width, - int height, - int subsamp) - -
    -          Deprecated. Use bufSizeYUV(int, int, int, int) instead.
    -static intbufSizeYUV(int width, - int pad, - int height, - int subsamp) - -
    -          Returns the size of the buffer (in bytes) required to hold a YUV planar - image with the given width, height, and level of chrominance subsampling.
    -static intgetBlueOffset(int pixelFormat) - -
    -          For the given pixel format, returns the number of bytes that the blue - component is offset from the start of the pixel.
    -static intgetGreenOffset(int pixelFormat) - -
    -          For the given pixel format, returns the number of bytes that the green - component is offset from the start of the pixel.
    -static intgetMCUHeight(int subsamp) - -
    -          Returns the MCU block height for the given level of chrominance - subsampling.
    -static intgetMCUWidth(int subsamp) - -
    -          Returns the MCU block width for the given level of chrominance - subsampling.
    -static intgetPixelSize(int pixelFormat) - -
    -          Returns the pixel size (in bytes) for the given pixel format.
    -static intgetRedOffset(int pixelFormat) - -
    -          For the given pixel format, returns the number of bytes that the red - component is offset from the start of the pixel.
    -static TJScalingFactor[]getScalingFactors() - -
    -          Returns a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - +

      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      static intbufSize(int width, + int height, + int jpegSubsamp) +
      Returns the maximum size of the buffer (in bytes) required to hold a JPEG + image with the given width, height, and level of chrominance subsampling.
      +
      static intbufSizeYUV(int width, + int height, + int subsamp) +
      Deprecated.  + +
      +
      static intbufSizeYUV(int width, + int pad, + int height, + int subsamp) +
      Returns the size of the buffer (in bytes) required to hold a YUV planar + image with the given width, height, and level of chrominance subsampling.
      +
      static intgetBlueOffset(int pixelFormat) +
      For the given pixel format, returns the number of bytes that the blue + component is offset from the start of the pixel.
      +
      static intgetGreenOffset(int pixelFormat) +
      For the given pixel format, returns the number of bytes that the green + component is offset from the start of the pixel.
      +
      static intgetMCUHeight(int subsamp) +
      Returns the MCU block height for the given level of chrominance + subsampling.
      +
      static intgetMCUWidth(int subsamp) +
      Returns the MCU block width for the given level of chrominance + subsampling.
      +
      static intgetPixelSize(int pixelFormat) +
      Returns the pixel size (in bytes) for the given pixel format.
      +
      static intgetRedOffset(int pixelFormat) +
      For the given pixel format, returns the number of bytes that the red + component is offset from the start of the pixel.
      +
      static TJScalingFactor[]getScalingFactors() +
      Returns a list of fractional scaling factors that the JPEG decompressor in + this implementation of TurboJPEG supports.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +

  • + + +
    +
      +
    • - - - - - - -
      -Field Detail
      - -

      -NUMSAMP

      -
      -public static final int NUMSAMP
      -
      -
      The number of chrominance subsampling options -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -SAMP_444

      -
      -public static final int SAMP_444
      -
      -
      4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG +
        +
      • + + +

        Field Detail

        + + + +
          +
        • +

          NUMSAMP

          +
          public static final int NUMSAMP
          +
          The number of chrominance subsampling options
          +
          See Also:
          Constant Field Values
          +
        • +
        + + + +
          +
        • +

          SAMP_444

          +
          public static final int SAMP_444
          +
          4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or YUV image will contain one chrominance component for every pixel in the - source image. -

          -

          -
          See Also:
          Constant Field Values
          -
      -
      - -

      -SAMP_422

      -
      -public static final int SAMP_422
      -
      -
      4:2:2 chrominance subsampling. The JPEG or YUV image will contain one - chrominance component for every 2x1 block of pixels in the source image. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -SAMP_420

      -
      -public static final int SAMP_420
      -
      -
      4:2:0 chrominance subsampling. The JPEG or YUV image will contain one - chrominance component for every 2x2 block of pixels in the source image. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -SAMP_GRAY

      -
      -public static final int SAMP_GRAY
      -
      -
      Grayscale. The JPEG or YUV image will contain no chrominance components. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -SAMP_440

      -
      -public static final int SAMP_440
      -
      -
      4:4:0 chrominance subsampling. The JPEG or YUV image will contain one + source image.
    +
    See Also:
    Constant Field Values
    +

  • + + + + +
      +
    • +

      SAMP_422

      +
      public static final int SAMP_422
      +
      4:2:2 chrominance subsampling. The JPEG or YUV image will contain one + chrominance component for every 2x1 block of pixels in the source image.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      SAMP_420

      +
      public static final int SAMP_420
      +
      4:2:0 chrominance subsampling. The JPEG or YUV image will contain one + chrominance component for every 2x2 block of pixels in the source image.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      SAMP_GRAY

      +
      public static final int SAMP_GRAY
      +
      Grayscale. The JPEG or YUV image will contain no chrominance components.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      SAMP_440

      +
      public static final int SAMP_440
      +
      4:4:0 chrominance subsampling. The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. - Note that 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -SAMP_411

      -
      -public static final int SAMP_411
      -
      -
      4:1:1 chrominance subsampling. The JPEG or YUV image will contain one + Note that 4:4:0 subsampling is not fully accelerated in libjpeg-turbo.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      SAMP_411

      +
      public static final int SAMP_411
      +
      4:1:1 chrominance subsampling. The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features. Note that 4:1:1 subsampling is not fully accelerated - in libjpeg-turbo. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -NUMPF

      -
      -public static final int NUMPF
      -
      -
      The number of pixel formats -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -PF_RGB

      -
      -public static final int PF_RGB
      -
      -
      RGB pixel format. The red, green, and blue components in the image are + in libjpeg-turbo.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      NUMPF

      +
      public static final int NUMPF
      +
      The number of pixel formats
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_RGB

      +
      public static final int PF_RGB
      +
      RGB pixel format. The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte - address within each pixel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_BGR

      -
      -public static final int PF_BGR
      -
      -
      BGR pixel format. The red, green, and blue components in the image are + address within each pixel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_BGR

      +
      public static final int PF_BGR
      +
      BGR pixel format. The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte - address within each pixel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_RGBX

      -
      -public static final int PF_RGBX
      -
      -
      RGBX pixel format. The red, green, and blue components in the image are + address within each pixel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_RGBX

      +
      public static final int PF_RGBX
      +
      RGBX pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. The X component is ignored when compressing - and undefined when decompressing. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_BGRX

      -
      -public static final int PF_BGRX
      -
      -
      BGRX pixel format. The red, green, and blue components in the image are + and undefined when decompressing.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_BGRX

      +
      public static final int PF_BGRX
      +
      BGRX pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. The X component is ignored when compressing - and undefined when decompressing. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_XBGR

      -
      -public static final int PF_XBGR
      -
      -
      XBGR pixel format. The red, green, and blue components in the image are + and undefined when decompressing.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_XBGR

      +
      public static final int PF_XBGR
      +
      XBGR pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. The X component is ignored when compressing - and undefined when decompressing. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_XRGB

      -
      -public static final int PF_XRGB
      -
      -
      XRGB pixel format. The red, green, and blue components in the image are + and undefined when decompressing.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_XRGB

      +
      public static final int PF_XRGB
      +
      XRGB pixel format. The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. The X component is ignored when compressing - and undefined when decompressing. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_GRAY

      -
      -public static final int PF_GRAY
      -
      -
      Grayscale pixel format. Each 1-byte pixel represents a luminance - (brightness) level from 0 to 255. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -PF_RGBA

      -
      -public static final int PF_RGBA
      -
      -
      RGBA pixel format. This is the same as PF_RGBX, except that when + and undefined when decompressing.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_GRAY

      +
      public static final int PF_GRAY
      +
      Grayscale pixel format. Each 1-byte pixel represents a luminance + (brightness) level from 0 to 255.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_RGBA

      +
      public static final int PF_RGBA
      +
      RGBA pixel format. This is the same as PF_RGBX, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be - interpreted as an opaque alpha channel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_BGRA

      -
      -public static final int PF_BGRA
      -
      -
      BGRA pixel format. This is the same as PF_BGRX, except that when + interpreted as an opaque alpha channel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_BGRA

      +
      public static final int PF_BGRA
      +
      BGRA pixel format. This is the same as PF_BGRX, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be - interpreted as an opaque alpha channel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_ABGR

      -
      -public static final int PF_ABGR
      -
      -
      ABGR pixel format. This is the same as PF_XBGR, except that when + interpreted as an opaque alpha channel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_ABGR

      +
      public static final int PF_ABGR
      +
      ABGR pixel format. This is the same as PF_XBGR, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be - interpreted as an opaque alpha channel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_ARGB

      -
      -public static final int PF_ARGB
      -
      -
      ARGB pixel format. This is the same as PF_XRGB, except that when + interpreted as an opaque alpha channel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_ARGB

      +
      public static final int PF_ARGB
      +
      ARGB pixel format. This is the same as PF_XRGB, except that when decompressing, the X byte is guaranteed to be 0xFF, which can be - interpreted as an opaque alpha channel. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -PF_CMYK

      -
      -public static final int PF_CMYK
      -
      -
      CMYK pixel format. Unlike RGB, which is an additive color model used + interpreted as an opaque alpha channel.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      PF_CMYK

      +
      public static final int PF_CMYK
      +
      CMYK pixel format. Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, @@ -814,48 +717,45 @@ public static final int PF_CMYK vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing - CMYK pixels into a YCCK JPEG image (see CS_YCCK) and - decompressing YCCK JPEG images into CMYK pixels. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -NUMCS

      -
      -public static final int NUMCS
      -
      -
      The number of JPEG colorspaces -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -CS_RGB

      -
      -public static final int CS_RGB
      -
      -
      RGB colorspace. When compressing the JPEG image, the R, G, and B + CMYK pixels into a YCCK JPEG image (see CS_YCCK) and + decompressing YCCK JPEG images into CMYK pixels.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      NUMCS

      +
      public static final int NUMCS
      +
      The number of JPEG colorspaces
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      CS_RGB

      +
      public static final int CS_RGB
      +
      RGB colorspace. When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to any of the extended RGB pixel formats or grayscale, but - they cannot be decompressed to YUV images. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -CS_YCbCr

      -
      -public static final int CS_YCbCr
      -
      -
      YCbCr colorspace. YCbCr is not an absolute colorspace but rather a + they cannot be decompressed to YUV images.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      CS_YCbCr

      +
      public static final int CS_YCbCr
      +
      YCbCr colorspace. YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) @@ -867,457 +767,435 @@ public static final int CS_YCbCr optionally subsampled for the purposes of reducing bandwidth or disk space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to any of the extended RGB pixel - formats or grayscale, or they can be decompressed to YUV planar images. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -CS_GRAY

      -
      -public static final int CS_GRAY
      -
      -
      Grayscale colorspace. The JPEG image retains only the luminance data (Y + formats or grayscale, or they can be decompressed to YUV planar images.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      CS_GRAY

      +
      public static final int CS_GRAY
      +
      Grayscale colorspace. The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed - to YUV planar images. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -CS_CMYK

      -
      -public static final int CS_CMYK
      -
      -
      CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K + to YUV planar images.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      CS_CMYK

      +
      public static final int CS_CMYK
      +
      CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can - only be decompressed to CMYK pixels. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -CS_YCCK

      -
      -public static final int CS_YCCK
      -
      -
      YCCK colorspace. YCCK (AKA "YCbCrK") is not an absolute colorspace but + only be decompressed to CMYK pixels.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      CS_YCCK

      +
      public static final int CS_YCCK
      +
      YCCK colorspace. YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and - decompressed to CMYK pixels. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -FLAG_BOTTOMUP

      -
      -public static final int FLAG_BOTTOMUP
      -
      -
      The uncompressed source/destination image is stored in bottom-up (Windows, - OpenGL) order, not top-down (X11) order. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -FLAG_FORCEMMX

      -
      -@Deprecated
      -public static final int FLAG_FORCEMMX
      -
      -
      Deprecated. 
      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -FLAG_FORCESSE

      -
      -@Deprecated
      -public static final int FLAG_FORCESSE
      -
      -
      Deprecated. 
      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -FLAG_FORCESSE2

      -
      -@Deprecated
      -public static final int FLAG_FORCESSE2
      -
      -
      Deprecated. 
      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -FLAG_FORCESSE3

      -
      -@Deprecated
      -public static final int FLAG_FORCESSE3
      -
      -
      Deprecated. 
      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -FLAG_FASTUPSAMPLE

      -
      -public static final int FLAG_FASTUPSAMPLE
      -
      -
      When decompressing an image that was compressed using chrominance + decompressed to CMYK pixels.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_BOTTOMUP

      +
      public static final int FLAG_BOTTOMUP
      +
      The uncompressed source/destination image is stored in bottom-up (Windows, + OpenGL) order, not top-down (X11) order.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FORCEMMX

      +
      @Deprecated
      +public static final int FLAG_FORCEMMX
      +
      Deprecated. 
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FORCESSE

      +
      @Deprecated
      +public static final int FLAG_FORCESSE
      +
      Deprecated. 
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FORCESSE2

      +
      @Deprecated
      +public static final int FLAG_FORCESSE2
      +
      Deprecated. 
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FORCESSE3

      +
      @Deprecated
      +public static final int FLAG_FORCESSE3
      +
      Deprecated. 
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FASTUPSAMPLE

      +
      public static final int FLAG_FASTUPSAMPLE
      +
      When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. The default is to use smooth upsampling, which creates a smooth transition between neighboring chrominance components in - order to reduce upsampling artifacts in the decompressed image. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -FLAG_FASTDCT

      -
      -public static final int FLAG_FASTDCT
      -
      -
      Use the fastest DCT/IDCT algorithm available in the underlying codec. The + order to reduce upsampling artifacts in the decompressed image.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_FASTDCT

      +
      public static final int FLAG_FASTDCT
      +
      Use the fastest DCT/IDCT algorithm available in the underlying codec. The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm - when decompressing, because this has been shown to have a larger effect. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -FLAG_ACCURATEDCT

      -
      -public static final int FLAG_ACCURATEDCT
      -
      -
      Use the most accurate DCT/IDCT algorithm available in the underlying + when decompressing, because this has been shown to have a larger effect.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      FLAG_ACCURATEDCT

      +
      public static final int FLAG_ACCURATEDCT
      +
      Use the most accurate DCT/IDCT algorithm available in the underlying codec. The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has - been shown to have a larger effect. -

      -

      -
      See Also:
      Constant Field Values
      - - + been shown to have a larger effect.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + - - - - - - -
    -Constructor Detail
    - -

    -TJ

    -
    -public TJ()
    -
    -
    - +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TJ

        +
        public TJ()
        +
      • +
      +
    • +
    - - - - - - -
    -Method Detail
    - -

    -getMCUWidth

    -
    -public static int getMCUWidth(int subsamp)
    -                       throws java.lang.Exception
    -
    -
    Returns the MCU block width for the given level of chrominance - subsampling. -

    -

    -
    Parameters:
    subsamp - the level of chrominance subsampling (one of - SAMP_*) -
    Returns:
    the MCU block width for the given level of chrominance subsampling -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getMCUHeight

    -
    -public static int getMCUHeight(int subsamp)
    -                        throws java.lang.Exception
    -
    -
    Returns the MCU block height for the given level of chrominance - subsampling. -

    -

    -
    Parameters:
    subsamp - the level of chrominance subsampling (one of - SAMP_*) -
    Returns:
    the MCU block height for the given level of chrominance - subsampling -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getPixelSize

    -
    -public static int getPixelSize(int pixelFormat)
    -                        throws java.lang.Exception
    -
    -
    Returns the pixel size (in bytes) for the given pixel format. -

    -

    -
    Parameters:
    pixelFormat - the pixel format (one of PF_*) -
    Returns:
    the pixel size (in bytes) for the given pixel format -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getRedOffset

    -
    -public static int getRedOffset(int pixelFormat)
    -                        throws java.lang.Exception
    -
    -
    For the given pixel format, returns the number of bytes that the red +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getMCUWidth

        +
        public static int getMCUWidth(int subsamp)
        +                       throws java.lang.Exception
        +
        Returns the MCU block width for the given level of chrominance + subsampling.
        +
        Parameters:
        subsamp - the level of chrominance subsampling (one of + SAMP_*)
        +
        Returns:
        the MCU block width for the given level of chrominance subsampling
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getMCUHeight

        +
        public static int getMCUHeight(int subsamp)
        +                        throws java.lang.Exception
        +
        Returns the MCU block height for the given level of chrominance + subsampling.
        +
        Parameters:
        subsamp - the level of chrominance subsampling (one of + SAMP_*)
        +
        Returns:
        the MCU block height for the given level of chrominance + subsampling
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getPixelSize

        +
        public static int getPixelSize(int pixelFormat)
        +                        throws java.lang.Exception
        +
        Returns the pixel size (in bytes) for the given pixel format.
        +
        Parameters:
        pixelFormat - the pixel format (one of PF_*)
        +
        Returns:
        the pixel size (in bytes) for the given pixel format
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getRedOffset

        +
        public static int getRedOffset(int pixelFormat)
        +                        throws java.lang.Exception
        +
        For the given pixel format, returns the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the red component will be - pixel[TJ.getRedOffset(TJ.PF_BGRX)]. -

        -

        -
        Parameters:
        pixelFormat - the pixel format (one of PF_*) -
        Returns:
        the red offset for the given pixel format -
        Throws: -
        java.lang.Exception
        -
        -
    -
    - -

    -getGreenOffset

    -
    -public static int getGreenOffset(int pixelFormat)
    -                          throws java.lang.Exception
    -
    -
    For the given pixel format, returns the number of bytes that the green + pixel[TJ.getRedOffset(TJ.PF_BGRX)]. +
    Parameters:
    pixelFormat - the pixel format (one of PF_*)
    +
    Returns:
    the red offset for the given pixel format
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      getGreenOffset

      +
      public static int getGreenOffset(int pixelFormat)
      +                          throws java.lang.Exception
      +
      For the given pixel format, returns the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the green component will be - pixel[TJ.getGreenOffset(TJ.PF_BGRX)]. -

      -

      -
      Parameters:
      pixelFormat - the pixel format (one of PF_*) -
      Returns:
      the green offset for the given pixel format -
      Throws: -
      java.lang.Exception
      -
      -
    -
    - -

    -getBlueOffset

    -
    -public static int getBlueOffset(int pixelFormat)
    -                         throws java.lang.Exception
    -
    -
    For the given pixel format, returns the number of bytes that the blue + pixel[TJ.getGreenOffset(TJ.PF_BGRX)]. +
    Parameters:
    pixelFormat - the pixel format (one of PF_*)
    +
    Returns:
    the green offset for the given pixel format
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      getBlueOffset

      +
      public static int getBlueOffset(int pixelFormat)
      +                         throws java.lang.Exception
      +
      For the given pixel format, returns the number of bytes that the blue component is offset from the start of the pixel. For instance, if a pixel of format TJ.PF_BGRX is stored in char pixel[], then the blue component will be - pixel[TJ.getBlueOffset(TJ.PF_BGRX)]. -

      -

      -
      Parameters:
      pixelFormat - the pixel format (one of PF_*) -
      Returns:
      the blue offset for the given pixel format -
      Throws: -
      java.lang.Exception
      -
      -
    -
    - -

    -bufSize

    -
    -public static int bufSize(int width,
    -                          int height,
    -                          int jpegSubsamp)
    -                   throws java.lang.Exception
    -
    -
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG - image with the given width, height, and level of chrominance subsampling. -

    -

    -
    Parameters:
    width - the width (in pixels) of the JPEG image
    height - the height (in pixels) of the JPEG image
    jpegSubsamp - the level of chrominance subsampling to be used when - generating the JPEG image (one of TJ.SAMP_*) -
    Returns:
    the maximum size of the buffer (in bytes) required to hold a JPEG - image with the given width, height, and level of chrominance subsampling -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -bufSizeYUV

    -
    -public static int bufSizeYUV(int width,
    -                             int pad,
    -                             int height,
    -                             int subsamp)
    -                      throws java.lang.Exception
    -
    -
    Returns the size of the buffer (in bytes) required to hold a YUV planar - image with the given width, height, and level of chrominance subsampling. -

    -

    -
    Parameters:
    width - the width (in pixels) of the YUV image
    pad - the width of each line in each plane of the image is padded to + pixel[TJ.getBlueOffset(TJ.PF_BGRX)]. +
    Parameters:
    pixelFormat - the pixel format (one of PF_*)
    +
    Returns:
    the blue offset for the given pixel format
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      bufSize

      +
      public static int bufSize(int width,
      +          int height,
      +          int jpegSubsamp)
      +                   throws java.lang.Exception
      +
      Returns the maximum size of the buffer (in bytes) required to hold a JPEG + image with the given width, height, and level of chrominance subsampling.
      +
      Parameters:
      width - the width (in pixels) of the JPEG image
      height - the height (in pixels) of the JPEG image
      jpegSubsamp - the level of chrominance subsampling to be used when + generating the JPEG image (one of TJ.SAMP_*)
      +
      Returns:
      the maximum size of the buffer (in bytes) required to hold a JPEG + image with the given width, height, and level of chrominance subsampling
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      bufSizeYUV

      +
      public static int bufSizeYUV(int width,
      +             int pad,
      +             int height,
      +             int subsamp)
      +                      throws java.lang.Exception
      +
      Returns the size of the buffer (in bytes) required to hold a YUV planar + image with the given width, height, and level of chrominance subsampling.
      +
      Parameters:
      width - the width (in pixels) of the YUV image
      pad - the width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of - 2.)
      height - the height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV - image (one of TJ.SAMP_*) -
      Returns:
      the size of the buffer (in bytes) required to hold a YUV planar - image with the given width, height, and level of chrominance subsampling -
      Throws: -
      java.lang.Exception
      -
    -
    -
    - -

    -bufSizeYUV

    -
    -@Deprecated
    -public static int bufSizeYUV(int width,
    -                                        int height,
    -                                        int subsamp)
    -                      throws java.lang.Exception
    -
    -
    Deprecated. Use bufSizeYUV(int, int, int, int) instead. -

    -

    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getScalingFactors

    -
    -public static TJScalingFactor[] getScalingFactors()
    -                                           throws java.lang.Exception
    -
    -
    Returns a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports. -

    -

    - -
    Returns:
    a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports -
    Throws: -
    java.lang.Exception
    -
    -
    + 2.)
    height - the height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
    +
    Returns:
    the size of the buffer (in bytes) required to hold a YUV planar + image with the given width, height, and level of chrominance subsampling
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      bufSizeYUV

      +
      @Deprecated
      +public static int bufSizeYUV(int width,
      +                        int height,
      +                        int subsamp)
      +                      throws java.lang.Exception
      +
      Deprecated. Use bufSizeYUV(int, int, int, int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getScalingFactors

      +
      public static TJScalingFactor[] getScalingFactors()
      +                                           throws java.lang.Exception
      +
      Returns a list of fractional scaling factors that the JPEG decompressor in + this implementation of TurboJPEG supports.
      +
      Returns:
      a list of fractional scaling factors that the JPEG decompressor in + this implementation of TurboJPEG supports
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + + + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html index 3c24544b..6c367a70 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html @@ -1,597 +1,558 @@ - - - - -TJCompressor - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJCompressor

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.TJCompressor
    -
    -
    -
    -
    public class TJCompressor
    extends java.lang.Object
    - - -

    -TurboJPEG compressor -

    - -

    -


    - -

    - +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJCompressor

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • org.libjpegturbo.turbojpeg.TJCompressor
      • +
      +
    • +
    +
    +
      +
    • +
      +
      +
      public class TJCompressor
      +extends java.lang.Object
      +
      TurboJPEG compressor
      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - - - + +
      -Constructor Summary
      TJCompressor() - -
      -          Create a TurboJPEG compressor instance.
      TJCompressor(java.awt.image.BufferedImage srcImage, - int x, - int y, - int width, - int height) - -
      -          Create a TurboJPEG compressor instance and associate the uncompressed +
        +
      • + + +

        Constructor Summary

        + + + + + + + + + + - - - - - - + + + + + + - -
        Constructors 
        Constructor and Description
        TJCompressor() +
        Create a TurboJPEG compressor instance.
        +
        TJCompressor(java.awt.image.BufferedImage srcImage, + int x, + int y, + int width, + int height) +
        Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created - instance.
        TJCompressor(byte[] srcImage, - int width, - int pitch, - int height, - int pixelFormat) - -
        -          Deprecated. Use - TJCompressor(byte[], int, int, int, int, int, int) instead.
        TJCompressor(byte[] srcImage, - int x, - int y, - int width, - int pitch, - int height, - int pixelFormat) - -
        -          Create a TurboJPEG compressor instance and associate the uncompressed + instance. +
        TJCompressor(byte[] srcImage, + int width, + int pitch, + int height, + int pixelFormat) + +
        TJCompressor(byte[] srcImage, + int x, + int y, + int width, + int pitch, + int height, + int pixelFormat) +
        Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created - instance.
        -  + instance. +
      +
    • +
    - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -Method Summary
    - voidclose() - -
    -          Free the native structures associated with this compressor instance.
    - voidcompress(java.awt.image.BufferedImage srcImage, +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidclose() +
      Free the native structures associated with this compressor instance.
      +
      voidcompress(java.awt.image.BufferedImage srcImage, + byte[] dstBuf, + int flags) + +
      byte[]compress(java.awt.image.BufferedImage srcImage, + int flags) + +
      voidcompress(byte[] dstBuf, + int flags) +
      Compress the uncompressed source image associated with this compressor + instance and output a JPEG image to the given destination buffer.
      +
      byte[]compress(int flags) +
      Compress the uncompressed source image associated with this compressor + instance and return a buffer containing a JPEG image.
      +
      voidencodeYUV(java.awt.image.BufferedImage srcImage, byte[] dstBuf, - int flags) - -
      -          Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - compress(byte[], int) instead.
      - byte[]compress(java.awt.image.BufferedImage srcImage, - int flags) - -
      -          Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - compress(int) instead.
      - voidcompress(byte[] dstBuf, - int flags) - -
      -          Compress the uncompressed source image associated with this compressor - instance and output a JPEG image to the given destination buffer.
      - byte[]compress(int flags) - -
      -          Compress the uncompressed source image associated with this compressor - instance and return a buffer containing a JPEG image.
      - voidencodeYUV(java.awt.image.BufferedImage srcImage, - byte[] dstBuf, - int flags) - -
      -          Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - encodeYUV(byte[], int) instead.
      - byte[]encodeYUV(java.awt.image.BufferedImage srcImage, - int flags) - -
      -          Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - encodeYUV(int) instead.
      - voidencodeYUV(byte[] dstBuf, - int flags) - -
      -          Deprecated. Use encodeYUV(YUVImage, int) instead.
      - byte[]encodeYUV(int flags) - -
      -          Deprecated. Use encodeYUV(int, int) instead.
      - YUVImageencodeYUV(int pad, - int flags) - -
      -          Encode the uncompressed source image associated with this compressor + int flags) + +
      byte[]encodeYUV(java.awt.image.BufferedImage srcImage, + int flags) + +
      voidencodeYUV(byte[] dstBuf, + int flags) +
      Deprecated.  + +
      +
      byte[]encodeYUV(int flags) +
      Deprecated.  +
      Use encodeYUV(int, int) instead.
      +
      +
      YUVImageencodeYUV(int pad, + int flags) +
      Encode the uncompressed source image associated with this compressor instance into a YUV planar image and return a YUVImage - instance containing the encoded image.
      - voidencodeYUV(YUVImage dstImage, - int flags) - -
      -          Encode the uncompressed source image associated with this compressor + instance containing the encoded image. +
      voidencodeYUV(YUVImage dstImage, + int flags) +
      Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given - YUVImage instance.
      -protected  voidfinalize() - -
      -           
      - intgetCompressedSize() - -
      -          Returns the size of the image (in bytes) generated by the most recent - compress/encode operation.
      - voidsetJPEGQuality(int quality) - -
      -          Set the JPEG image quality level for subsequent compress operations.
      - voidsetSourceImage(java.awt.image.BufferedImage srcImage, - int x, - int y, - int width, - int height) - -
      -          Associate an uncompressed RGB or grayscale source image with this - compressor instance.
      - voidsetSourceImage(byte[] srcImage, - int width, - int pitch, - int height, - int pixelFormat) - -
      -          Deprecated. Use - setSourceImage(byte[], int, int, int, int, int, int) instead.
      - voidsetSourceImage(byte[] srcImage, - int x, - int y, - int width, - int pitch, - int height, - int pixelFormat) - -
      -          Associate an uncompressed RGB, grayscale, or CMYK source image with this - compressor instance.
      - voidsetSourceImage(YUVImage srcImage) - -
      -          Associate an uncompressed YUV planar source image with this compressor - instance.
      - voidsetSubsamp(int newSubsamp) - -
      -          Set the level of chrominance subsampling for subsequent compress/encode - operations.
      - - - - - - - -
      Methods inherited from class java.lang.Object
      clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      -  -

      - + YUVImage instance. +

    protected voidfinalize() 
    intgetCompressedSize() +
    Returns the size of the image (in bytes) generated by the most recent + compress/encode operation.
    +
    voidsetJPEGQuality(int quality) +
    Set the JPEG image quality level for subsequent compress operations.
    +
    voidsetSourceImage(java.awt.image.BufferedImage srcImage, + int x, + int y, + int width, + int height) +
    Associate an uncompressed RGB or grayscale source image with this + compressor instance.
    +
    voidsetSourceImage(byte[] srcImage, + int width, + int pitch, + int height, + int pixelFormat) + +
    voidsetSourceImage(byte[] srcImage, + int x, + int y, + int width, + int pitch, + int height, + int pixelFormat) +
    Associate an uncompressed RGB, grayscale, or CMYK source image with this + compressor instance.
    +
    voidsetSourceImage(YUVImage srcImage) +
    Associate an uncompressed YUV planar source image with this compressor + instance.
    +
    voidsetSubsamp(int newSubsamp) +
    Set the level of chrominance subsampling for subsequent compress/encode + operations.
    +
    +
      +
    • + + +

      Methods inherited from class java.lang.Object

      +clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • +
    + + + + +
    +
    +
      +
    • - - - - - - -
      -Constructor Detail
      - -

      -TJCompressor

      -
      -public TJCompressor()
      -             throws java.lang.Exception
      -
      -
      Create a TurboJPEG compressor instance. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJCompressor

      -
      -public TJCompressor(byte[] srcImage,
      -                    int x,
      -                    int y,
      -                    int width,
      -                    int pitch,
      -                    int height,
      -                    int pixelFormat)
      -             throws java.lang.Exception
      -
      -
      Create a TurboJPEG compressor instance and associate the uncompressed +
      -
      - -

      -TJCompressor

      -
      -@Deprecated
      -public TJCompressor(byte[] srcImage,
      -                               int width,
      -                               int pitch,
      -                               int height,
      -                               int pixelFormat)
      -             throws java.lang.Exception
      -
      -
      Deprecated. Use - TJCompressor(byte[], int, int, int, int, int, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJCompressor

      -
      -public TJCompressor(java.awt.image.BufferedImage srcImage,
      -                    int x,
      -                    int y,
      -                    int width,
      -                    int height)
      -             throws java.lang.Exception
      -
      -
      Create a TurboJPEG compressor instance and associate the uncompressed + instance.
    +
    Parameters:
    srcImage - see setSourceImage(byte[], int, int, int, int, int, int) for description
    x - see setSourceImage(byte[], int, int, int, int, int, int) for description
    y - see setSourceImage(byte[], int, int, int, int, int, int) for description
    width - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pitch - see setSourceImage(byte[], int, int, int, int, int, int) for description
    height - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pixelFormat - pixel format of the source image (one of + TJ.PF_*)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      TJCompressor

      +
      @Deprecated
      +public TJCompressor(byte[] srcImage,
      +                       int width,
      +                       int pitch,
      +                       int height,
      +                       int pixelFormat)
      +             throws java.lang.Exception
      + +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + + + - - - - - - -
    -Method Detail
    - -

    -setSourceImage

    -
    -public void setSourceImage(byte[] srcImage,
    -                           int x,
    -                           int y,
    -                           int width,
    -                           int pitch,
    -                           int height,
    -                           int pixelFormat)
    -                    throws java.lang.Exception
    -
    -
    Associate an uncompressed RGB, grayscale, or CMYK source image with this - compressor instance. -

    -

    -
    Parameters:
    srcImage - image buffer containing RGB, grayscale, or CMYK pixels to - be compressed or encoded
    x - x offset (in pixels) of the region in the source image from which - the JPEG or YUV image should be compressed/encoded
    y - y offset (in pixels) of the region in the source image from which - the JPEG or YUV image should be compressed/encoded
    width - width (in pixels) of the region in the source image from - which the JPEG or YUV image should be compressed/encoded
    pitch - bytes per line of the source image. Normally, this should be +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setSourceImage

        +
        public void setSourceImage(byte[] srcImage,
        +                  int x,
        +                  int y,
        +                  int width,
        +                  int pitch,
        +                  int height,
        +                  int pixelFormat)
        +                    throws java.lang.Exception
        +
        Associate an uncompressed RGB, grayscale, or CMYK source image with this + compressor instance.
        +
        Parameters:
        srcImage - image buffer containing RGB, grayscale, or CMYK pixels to + be compressed or encoded
        x - x offset (in pixels) of the region in the source image from which + the JPEG or YUV image should be compressed/encoded
        y - y offset (in pixels) of the region in the source image from which + the JPEG or YUV image should be compressed/encoded
        width - width (in pixels) of the region in the source image from + which the JPEG or YUV image should be compressed/encoded
        pitch - bytes per line of the source image. Normally, this should be width * TJ.pixelSize(pixelFormat) if the source image is unpadded, but you can use this parameter to, for instance, specify that the scanlines in the source image are padded to a 4-byte boundary or to compress/encode a JPEG or YUV image from a region of a larger source image. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to - width * TJ.pixelSize(pixelFormat).
        height - height (in pixels) of the region in the source image from - which the JPEG or YUV image should be compressed/encoded
        pixelFormat - pixel format of the source image (one of - TJ.PF_*) -
        Throws: -
        java.lang.Exception
        -
    -
    -
    - -

    -setSourceImage

    -
    -@Deprecated
    -public void setSourceImage(byte[] srcImage,
    -                                      int width,
    -                                      int pitch,
    -                                      int height,
    -                                      int pixelFormat)
    -                    throws java.lang.Exception
    -
    -
    Deprecated. Use - setSourceImage(byte[], int, int, int, int, int, int) instead. -

    -

    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -setSourceImage

    -
    -public void setSourceImage(java.awt.image.BufferedImage srcImage,
    -                           int x,
    -                           int y,
    -                           int width,
    -                           int height)
    -                    throws java.lang.Exception
    -
    -
    Associate an uncompressed RGB or grayscale source image with this - compressor instance. -

    -

    -
    Parameters:
    srcImage - a BufferedImage instance containing RGB or - grayscale pixels to be compressed or encoded
    x - x offset (in pixels) of the region in the source image from which - the JPEG or YUV image should be compressed/encoded
    y - y offset (in pixels) of the region in the source image from which - the JPEG or YUV image should be compressed/encoded
    width - width (in pixels) of the region in the source image from + width * TJ.pixelSize(pixelFormat).
    height - height (in pixels) of the region in the source image from + which the JPEG or YUV image should be compressed/encoded
    pixelFormat - pixel format of the source image (one of + TJ.PF_*)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      setSourceImage

      +
      @Deprecated
      +public void setSourceImage(byte[] srcImage,
      +                             int width,
      +                             int pitch,
      +                             int height,
      +                             int pixelFormat)
      +                    throws java.lang.Exception
      + +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      setSourceImage

      +
      public void setSourceImage(java.awt.image.BufferedImage srcImage,
      +                  int x,
      +                  int y,
      +                  int width,
      +                  int height)
      +                    throws java.lang.Exception
      +
      Associate an uncompressed RGB or grayscale source image with this + compressor instance.
      +
      Parameters:
      srcImage - a BufferedImage instance containing RGB or + grayscale pixels to be compressed or encoded
      x - x offset (in pixels) of the region in the source image from which + the JPEG or YUV image should be compressed/encoded
      y - y offset (in pixels) of the region in the source image from which + the JPEG or YUV image should be compressed/encoded
      width - width (in pixels) of the region in the source image from which the JPEG or YUV image should be compressed/encoded (0 = use the - width of the source image)
      height - height (in pixels) of the region in the source image from + width of the source image)
      height - height (in pixels) of the region in the source image from which the JPEG or YUV image should be compressed/encoded (0 = use the - height of the source image) -
      Throws: -
      java.lang.Exception
      -
    -
    -
    - -

    -setSourceImage

    -
    -public void setSourceImage(YUVImage srcImage)
    -                    throws java.lang.Exception
    -
    -
    Associate an uncompressed YUV planar source image with this compressor - instance. -

    -

    -
    Parameters:
    srcImage - YUV planar image to be compressed -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -setSubsamp

    -
    -public void setSubsamp(int newSubsamp)
    -                throws java.lang.Exception
    -
    -
    Set the level of chrominance subsampling for subsequent compress/encode + height of the source image)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      setSourceImage

      +
      public void setSourceImage(YUVImage srcImage)
      +                    throws java.lang.Exception
      +
      Associate an uncompressed YUV planar source image with this compressor + instance.
      +
      Parameters:
      srcImage - YUV planar image to be compressed
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      setSubsamp

      +
      public void setSubsamp(int newSubsamp)
      +                throws java.lang.Exception
      +
      Set the level of chrominance subsampling for subsequent compress/encode operations. When pixels are converted from RGB to YCbCr (see - TJ.CS_YCbCr) or from CMYK to YCCK (see TJ.CS_YCCK) as part + TJ.CS_YCbCr) or from CMYK to YCCK (see TJ.CS_YCCK) as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more @@ -601,352 +562,319 @@ public void setSubsamp(int newSubsamp) NOTE: This method has no effect when compressing a JPEG image from a YUV planar source. In that case, the level of chrominance subsampling in the JPEG image is determined by the source. Further, this method has no - effect when encoding to a pre-allocated YUVImage instance. In + effect when encoding to a pre-allocated YUVImage instance. In that case, the level of chrominance subsampling is determined by the - destination. -

      -

      -
      Parameters:
      newSubsamp - the level of chrominance subsampling to use in + destination.
      +
      Parameters:
      newSubsamp - the level of chrominance subsampling to use in subsequent compress/encode oeprations (one of - TJ.SAMP_*) -
      Throws: -
      java.lang.Exception
      -
    -
    -
    - -

    -setJPEGQuality

    -
    -public void setJPEGQuality(int quality)
    -                    throws java.lang.Exception
    -
    -
    Set the JPEG image quality level for subsequent compress operations. -

    -

    -
    Parameters:
    quality - the new JPEG image quality level (1 to 100, 1 = worst, - 100 = best) -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -compress

    -
    -public void compress(byte[] dstBuf,
    -                     int flags)
    -              throws java.lang.Exception
    -
    -
    Compress the uncompressed source image associated with this compressor - instance and output a JPEG image to the given destination buffer. -

    -

    -
    Parameters:
    dstBuf - buffer that will receive the JPEG image. Use - TJ.bufSize(int, int, int) to determine the maximum size for this buffer based on + TJ.SAMP_*)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      setJPEGQuality

      +
      public void setJPEGQuality(int quality)
      +                    throws java.lang.Exception
      +
      Set the JPEG image quality level for subsequent compress operations.
      +
      Parameters:
      quality - the new JPEG image quality level (1 to 100, 1 = worst, + 100 = best)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      compress

      +
      public void compress(byte[] dstBuf,
      +            int flags)
      +              throws java.lang.Exception
      +
      Compress the uncompressed source image associated with this compressor + instance and output a JPEG image to the given destination buffer.
      +
      Parameters:
      dstBuf - buffer that will receive the JPEG image. Use + TJ.bufSize(int, int, int) to determine the maximum size for this buffer based on the source image's width and height and the desired level of chrominance - subsampling.
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      -
    -
    -
    - -

    -compress

    -
    -public byte[] compress(int flags)
    -                throws java.lang.Exception
    -
    -
    Compress the uncompressed source image associated with this compressor - instance and return a buffer containing a JPEG image. -

    -

    -
    Parameters:
    flags - the bitwise OR of one or more of - TJ.FLAG_* -
    Returns:
    a buffer containing a JPEG image. The length of this buffer will - not be equal to the size of the JPEG image. Use getCompressedSize() to obtain the size of the JPEG image. -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -compress

    -
    -@Deprecated
    -public void compress(java.awt.image.BufferedImage srcImage,
    -                                byte[] dstBuf,
    -                                int flags)
    -              throws java.lang.Exception
    -
    -
    Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - compress(byte[], int) instead. -

    -

    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -compress

    -
    -@Deprecated
    -public byte[] compress(java.awt.image.BufferedImage srcImage,
    -                                  int flags)
    -                throws java.lang.Exception
    -
    -
    Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - compress(int) instead. -

    -

    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -encodeYUV

    -
    -public void encodeYUV(YUVImage dstImage,
    -                      int flags)
    -               throws java.lang.Exception
    -
    -
    Encode the uncompressed source image associated with this compressor + subsampling.
    flags - the bitwise OR of one or more of + TJ.FLAG_*
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      compress

      +
      public byte[] compress(int flags)
      +                throws java.lang.Exception
      +
      Compress the uncompressed source image associated with this compressor + instance and return a buffer containing a JPEG image.
      +
      Parameters:
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Returns:
      a buffer containing a JPEG image. The length of this buffer will + not be equal to the size of the JPEG image. Use getCompressedSize() to obtain the size of the JPEG image.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + + + + + + + + +
      +
    • +

      encodeYUV

      +
      public void encodeYUV(YUVImage dstImage,
      +             int flags)
      +               throws java.lang.Exception
      +
      Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given YUVImage instance. This method uses the accelerated color conversion routines in TurboJPEG's underlying codec but does not execute any of the other steps in the JPEG compression process. Encoding - CMYK source images to YUV is not supported. -

      -

      -
      Parameters:
      dstImage - YUVImage instance that will receive the YUV planar - image
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      -
      - -
      - -

      -encodeYUV

      -
      -@Deprecated
      -public void encodeYUV(byte[] dstBuf,
      -                                 int flags)
      -               throws java.lang.Exception
      -
      -
      Deprecated. Use encodeYUV(YUVImage, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -encodeYUV

      -
      -public YUVImage encodeYUV(int pad,
      -                          int flags)
      -                   throws java.lang.Exception
      -
      -
      Encode the uncompressed source image associated with this compressor + CMYK source images to YUV is not supported.
      +
      Parameters:
      dstImage - YUVImage instance that will receive the YUV planar + image
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      encodeYUV

      +
      @Deprecated
      +public void encodeYUV(byte[] dstBuf,
      +                        int flags)
      +               throws java.lang.Exception
      +
      Deprecated. Use encodeYUV(YUVImage, int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      encodeYUV

      +
      public YUVImage encodeYUV(int pad,
      +                 int flags)
      +                   throws java.lang.Exception
      +
      Encode the uncompressed source image associated with this compressor instance into a YUV planar image and return a YUVImage instance containing the encoded image. This method uses the accelerated color conversion routines in TurboJPEG's underlying codec but does not execute any of the other steps in the JPEG compression process. Encoding - CMYK source images to YUV is not supported. -

      -

      -
      Parameters:
      pad - the width of each line in each plane of the YUV image will be + CMYK source images to YUV is not supported.
      +
      Parameters:
      pad - the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of - 2.)
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Returns:
      a YUV planar image -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -encodeYUV

      -
      -@Deprecated
      -public byte[] encodeYUV(int flags)
      -                 throws java.lang.Exception
      -
      -
      Deprecated. Use encodeYUV(int, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -encodeYUV

      -
      -@Deprecated
      -public void encodeYUV(java.awt.image.BufferedImage srcImage,
      -                                 byte[] dstBuf,
      -                                 int flags)
      -               throws java.lang.Exception
      -
      -
      Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - encodeYUV(byte[], int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -encodeYUV

      -
      -@Deprecated
      -public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,
      -                                   int flags)
      -                 throws java.lang.Exception
      -
      -
      Deprecated. Use - setSourceImage(BufferedImage, int, int, int, int) and - encodeYUV(int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getCompressedSize

      -
      -public int getCompressedSize()
      -
      -
      Returns the size of the image (in bytes) generated by the most recent - compress/encode operation. -

      -

      - -
      Returns:
      the size of the image (in bytes) generated by the most recent - compress/encode operation
      -
      -
      -
      - -

      -close

      -
      -public void close()
      -           throws java.lang.Exception
      -
      -
      Free the native structures associated with this compressor instance. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -finalize

      -
      -protected void finalize()
      -                 throws java.lang.Throwable
      -
      -
      -
      Overrides:
      finalize in class java.lang.Object
      -
      -
      - -
      Throws: -
      java.lang.Throwable
      -
      -
      + 2.)
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Returns:
      a YUV planar image
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      encodeYUV

      +
      @Deprecated
      +public byte[] encodeYUV(int flags)
      +                 throws java.lang.Exception
      +
      Deprecated. Use encodeYUV(int, int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + + + + + + + + +
      +
    • +

      getCompressedSize

      +
      public int getCompressedSize()
      +
      Returns the size of the image (in bytes) generated by the most recent + compress/encode operation.
      +
      Returns:
      the size of the image (in bytes) generated by the most recent + compress/encode operation
      +
    • +
    + + + +
      +
    • +

      close

      +
      public void close()
      +           throws java.lang.Exception
      +
      Free the native structures associated with this compressor instance.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      finalize

      +
      protected void finalize()
      +                 throws java.lang.Throwable
      +
      +
      Overrides:
      +
      finalize in class java.lang.Object
      +
      Throws:
      +
      java.lang.Throwable
      +
    • +
    + + + + +
    + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html index 3291c71f..bac519b9 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html @@ -1,238 +1,237 @@ - - - - -TJCustomFilter - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Interface TJCustomFilter

    -
    -
    -
    public interface TJCustomFilter
    - - -

    -Custom filter callback interface -

    - -

    -


    - -

    - +

    +
    org.libjpegturbo.turbojpeg
    +

    Interface TJCustomFilter

    +
    +
    +
    +
      +
    • +
      +
      +
      public interface TJCustomFilter
      +
      Custom filter callback interface
      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - + +
      -Method Summary
      - voidcustomFilter(java.nio.ShortBuffer coeffBuffer, - java.awt.Rectangle bufferRegion, - java.awt.Rectangle planeRegion, - int componentID, - int transformID, - TJTransform transform) - -
      -          A callback function that can be used to modify the DCT coefficients after +
        +
      • + + +

        Method Summary

        + + + + + + + + + - -
        Methods 
        Modifier and TypeMethod and Description
        voidcustomFilter(java.nio.ShortBuffer coeffBuffer, + java.awt.Rectangle bufferRegion, + java.awt.Rectangle planeRegion, + int componentID, + int transformID, + TJTransform transform) +
        A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new - JPEG image.
        -  -

        - + JPEG image. +

      +
    • +
    + + +
    +
    +
      +
    • - - - - - - -
      -Method Detail
      - -

      -customFilter

      -
      -void customFilter(java.nio.ShortBuffer coeffBuffer,
      -                  java.awt.Rectangle bufferRegion,
      -                  java.awt.Rectangle planeRegion,
      -                  int componentID,
      -                  int transformID,
      -                  TJTransform transform)
      -                  throws java.lang.Exception
      -
      -
      A callback function that can be used to modify the DCT coefficients after +
        +
      • + + +

        Method Detail

        + + + +
          +
        • +

          customFilter

          +
          void customFilter(java.nio.ShortBuffer coeffBuffer,
          +                java.awt.Rectangle bufferRegion,
          +                java.awt.Rectangle planeRegion,
          +                int componentID,
          +                int transformID,
          +                TJTransform transform)
          +                  throws java.lang.Exception
          +
          A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG image. This allows for custom filters or other transformations to be - applied in the frequency domain. -

          -

          -
          Parameters:
          coeffBuffer - a buffer containing transformed DCT coefficients. + applied in the frequency domain.
          +
          Parameters:
          coeffBuffer - a buffer containing transformed DCT coefficients. (NOTE: this buffer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of - the callback.)
          bufferRegion - rectangle containing the width and height of + the callback.)
          bufferRegion - rectangle containing the width and height of coeffBuffer as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient buffers and call the callback function once - for each buffer.
          planeRegion - rectangle containing the width and height of the - component plane to which coeffBuffer belongs
          componentID - ID number of the component plane to which + for each buffer.
          planeRegion - rectangle containing the width and height of the + component plane to which coeffBuffer belongs
          componentID - ID number of the component plane to which coeffBuffer belongs (Y, Cb, and Cr have, respectively, ID's - of 0, 1, and 2 in typical JPEG images.)
          transformID - ID number of the transformed image to which + of 0, 1, and 2 in typical JPEG images.)
          transformID - ID number of the transformed image to which coeffBuffer belongs. This is the same as the index of the - transform in the transforms array that was passed to TJTransformer.transform().
          transform - a TJTransform instance that specifies the - parameters and/or cropping region for this transform -
          Throws: -
          java.lang.Exception
          -
      -
      + transform in the transforms array that was passed to TJTransformer.transform().
      transform - a TJTransform instance that specifies the + parameters and/or cropping region for this transform
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + +
    +
    -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html index 01007b36..af6a9020 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html @@ -1,978 +1,862 @@ - - - - -TJDecompressor - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJDecompressor

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.TJDecompressor
    -
    -
    -
    Direct Known Subclasses:
    TJTransformer
    -
    -
    -
    -
    public class TJDecompressor
    extends java.lang.Object
    - - -

    -TurboJPEG decompressor -

    - -

    -


    - -

    +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJDecompressor

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • org.libjpegturbo.turbojpeg.TJDecompressor
      • +
      +
    • +
    +
    +
      +
    • +
      +
      Direct Known Subclasses:
      +
      TJTransformer
      +
      +
      +
      +
      public class TJDecompressor
      +extends java.lang.Object
      +
      TurboJPEG decompressor
      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Field Summary
      -protected  longhandle - -
      -           
      -protected  byte[]jpegBuf - -
      -           
      -protected  intjpegBufSize - -
      -           
      -protected  intsrcColorspace - -
      -           
      -protected  intsrcHeight - -
      -           
      -protected  intsrcSubsamp - -
      -           
      -protected  intsrcWidth - -
      -           
      -protected  YUVImageyuvImage - -
      -           
      -  + - - - - - - - - - - - - - - + +
      -Constructor Summary
      TJDecompressor() - -
      -          Create a TurboJPEG decompresssor instance.
      TJDecompressor(byte[] jpegImage) - -
      -          Create a TurboJPEG decompressor instance and associate the JPEG source - image stored in jpegImage with the newly created instance.
      TJDecompressor(byte[] jpegImage, - int imageSize) - -
      -          Create a TurboJPEG decompressor instance and associate the JPEG source +
        +
      • + + +

        Constructor Summary

        + + + + + + + + + + + + + - - - + + + - -
        Constructors 
        Constructor and Description
        TJDecompressor() +
        Create a TurboJPEG decompresssor instance.
        +
        TJDecompressor(byte[] jpegImage) +
        Create a TurboJPEG decompressor instance and associate the JPEG source + image stored in jpegImage with the newly created instance.
        +
        TJDecompressor(byte[] jpegImage, + int imageSize) +
        Create a TurboJPEG decompressor instance and associate the JPEG source image of length imageSize bytes stored in - jpegImage with the newly created instance.
        TJDecompressor(YUVImage yuvImage) - -
        -          Create a TurboJPEG decompressor instance and associate the YUV planar + jpegImage with the newly created instance. +
        TJDecompressor(YUVImage yuvImage) +
        Create a TurboJPEG decompressor instance and associate the YUV planar source image stored in yuvImage with the newly created - instance.
        -  + instance. +
      +
    • +
    - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -Method Summary
    - voidclose() - -
    -          Free the native structures associated with this decompressor instance.
    - voiddecompress(java.awt.image.BufferedImage dstImage, - int flags) - -
    -          Decompress the JPEG source image or decode the YUV source image associated +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidclose() +
      Free the native structures associated with this decompressor instance.
      +
      voiddecompress(java.awt.image.BufferedImage dstImage, + int flags) +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to - the given BufferedImage instance.
      - voiddecompress(byte[] dstBuf, - int desiredWidth, - int pitch, - int desiredHeight, - int pixelFormat, - int flags) - -
      -          Deprecated. Use - decompress(byte[], int, int, int, int, int, int, int) instead.
      - voiddecompress(byte[] dstBuf, - int x, - int y, - int desiredWidth, - int pitch, - int desiredHeight, - int pixelFormat, - int flags) - -
      -          Decompress the JPEG source image or decode the YUV source image associated + the given BufferedImage instance. +
      voiddecompress(byte[] dstBuf, + int desiredWidth, + int pitch, + int desiredHeight, + int pixelFormat, + int flags) + +
      voiddecompress(byte[] dstBuf, + int x, + int y, + int desiredWidth, + int pitch, + int desiredHeight, + int pixelFormat, + int flags) +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer.
      - voiddecompress(int[] dstBuf, - int x, - int y, - int desiredWidth, - int stride, - int desiredHeight, - int pixelFormat, - int flags) - -
      -          Decompress the JPEG source image or decode the YUV source image associated + to the given destination buffer. +
      voiddecompress(int[] dstBuf, + int x, + int y, + int desiredWidth, + int stride, + int desiredHeight, + int pixelFormat, + int flags) +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer.
      - java.awt.image.BufferedImagedecompress(int desiredWidth, - int desiredHeight, - int bufferedImageType, - int flags) - -
      -          Decompress the JPEG source image or decode the YUV source image associated + to the given destination buffer. +
      java.awt.image.BufferedImagedecompress(int desiredWidth, + int desiredHeight, + int bufferedImageType, + int flags) +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a BufferedImage - instance containing the decompressed/decoded image.
      - byte[]decompress(int desiredWidth, - int pitch, - int desiredHeight, - int pixelFormat, - int flags) - -
      -          Decompress the JPEG source image associated with this decompressor - instance and return a buffer containing the decompressed image.
      - voiddecompressToYUV(byte[] dstBuf, - int flags) - -
      -          Deprecated. Use decompressToYUV(YUVImage, int) instead.
      - byte[]decompressToYUV(int flags) - -
      -          Deprecated. Use decompressToYUV(int, int, int, int) instead.
      - YUVImagedecompressToYUV(int desiredWidth, - int pad, - int desiredHeight, - int flags) - -
      -          Decompress the JPEG source image associated with this decompressor + instance containing the decompressed/decoded image. +
      byte[]decompress(int desiredWidth, + int pitch, + int desiredHeight, + int pixelFormat, + int flags) +
      Decompress the JPEG source image associated with this decompressor + instance and return a buffer containing the decompressed image.
      +
      voiddecompressToYUV(byte[] dstBuf, + int flags) +
      Deprecated.  + +
      +
      byte[]decompressToYUV(int flags) +
      Deprecated.  + +
      +
      YUVImagedecompressToYUV(int desiredWidth, + int pad, + int desiredHeight, + int flags) +
      Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and return a YUVImage - instance containing the decompressed image.
      - voiddecompressToYUV(YUVImage dstImage, - int flags) - -
      -          Decompress the JPEG source image associated with this decompressor + instance containing the decompressed image. +
      voiddecompressToYUV(YUVImage dstImage, + int flags) +
      Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given - YUVImage instance.
      -protected  voidfinalize() - -
      -           
      - intgetColorspace() - -
      -          Returns the colorspace used in the source image (JPEG or YUV) associated - with this decompressor instance.
      - intgetHeight() - -
      -          Returns the height of the source image (JPEG or YUV) associated with this - decompressor instance.
      - byte[]getJPEGBuf() - -
      -          Deprecated. Use getSourceBuf() instead.
      - intgetJPEGSize() - -
      -          Deprecated. Use getSourceSize() instead.
      - intgetScaledHeight(int desiredWidth, - int desiredHeight) - -
      -          Returns the height of the largest scaled-down image that the TurboJPEG + YUVImage instance. +
      protected voidfinalize() 
      intgetColorspace() +
      Returns the colorspace used in the source image (JPEG or YUV) associated + with this decompressor instance.
      +
      intgetHeight() +
      Returns the height of the source image (JPEG or YUV) associated with this + decompressor instance.
      +
      byte[]getJPEGBuf() +
      Deprecated.  +
      Use getSourceBuf() instead.
      +
      +
      intgetJPEGSize() +
      Deprecated.  +
      Use getSourceSize() instead.
      +
      +
      intgetScaledHeight(int desiredWidth, + int desiredHeight) +
      Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height.
      - intgetScaledWidth(int desiredWidth, - int desiredHeight) - -
      -          Returns the width of the largest scaled-down image that the TurboJPEG + height. +
      intgetScaledWidth(int desiredWidth, + int desiredHeight) +
      Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height.
      - byte[]getSourceBuf() - -
      -          Returns the source image buffer associated with this decompressor - instance.
      - intgetSourceSize() - -
      -          Returns the size of the source image (in bytes) associated with this - decompressor instance.
      - intgetSubsamp() - -
      -          Returns the level of chrominance subsampling used in the source image - (JPEG or YUV) associated with this decompressor instance.
      - intgetWidth() - -
      -          Returns the width of the source image (JPEG or YUV) associated with this - decompressor instance.
      - voidsetJPEGImage(byte[] jpegImage, - int imageSize) - -
      -          Deprecated. Use setSourceImage(byte[], int) instead.
      - voidsetSourceImage(byte[] srcImage, - int imageSize) - -
      -          Associate the JPEG image of length imageSize bytes stored in - srcImage with this decompressor instance.
      - voidsetSourceImage(YUVImage srcImage) - -
      -          Associate the specified YUV planar source image with this decompressor - instance.
      - - - - - - - -
      Methods inherited from class java.lang.Object
      clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      -  -

      - + height. +

    byte[]getSourceBuf() +
    Returns the source image buffer associated with this decompressor + instance.
    +
    intgetSourceSize() +
    Returns the size of the source image (in bytes) associated with this + decompressor instance.
    +
    intgetSubsamp() +
    Returns the level of chrominance subsampling used in the source image + (JPEG or YUV) associated with this decompressor instance.
    +
    intgetWidth() +
    Returns the width of the source image (JPEG or YUV) associated with this + decompressor instance.
    +
    voidsetJPEGImage(byte[] jpegImage, + int imageSize) +
    Deprecated.  + +
    +
    voidsetSourceImage(byte[] srcImage, + int imageSize) +
    Associate the JPEG image of length imageSize bytes stored in + srcImage with this decompressor instance.
    +
    voidsetSourceImage(YUVImage srcImage) +
    Associate the specified YUV planar source image with this decompressor + instance.
    +
    +
      +
    • + + +

      Methods inherited from class java.lang.Object

      +clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • +
    + + + + +
    +
    +
      +
    • - - - - - - -
      -Field Detail
      - -

      -handle

      -
      -protected long handle
      -
      -
      -
      -
      -
      - -

      -jpegBuf

      -
      -protected byte[] jpegBuf
      -
      -
      -
      -
      -
      - -

      -jpegBufSize

      -
      -protected int jpegBufSize
      -
      -
      -
      -
      -
      - -

      -yuvImage

      -
      -protected YUVImage yuvImage
      -
      -
      -
      -
      -
      - -

      -srcWidth

      -
      -protected int srcWidth
      -
      -
      -
      -
      -
      - -

      -srcHeight

      -
      -protected int srcHeight
      -
      -
      -
      -
      -
      - -

      -srcSubsamp

      -
      -protected int srcSubsamp
      -
      -
      -
      -
      -
      - -

      -srcColorspace

      -
      -protected int srcColorspace
      -
      -
      -
      -
      - +
        +
      • + + +

        Field Detail

        + + + +
          +
        • +

          handle

          +
          protected long handle
          +
        • +
        + + + +
          +
        • +

          jpegBuf

          +
          protected byte[] jpegBuf
          +
        • +
        + + + +
          +
        • +

          jpegBufSize

          +
          protected int jpegBufSize
          +
        • +
        + + + +
          +
        • +

          yuvImage

          +
          protected YUVImage yuvImage
          +
        • +
        + + + +
          +
        • +

          srcWidth

          +
          protected int srcWidth
          +
        • +
        + + + +
          +
        • +

          srcHeight

          +
          protected int srcHeight
          +
        • +
        + + + +
          +
        • +

          srcSubsamp

          +
          protected int srcSubsamp
          +
        • +
        + + + +
          +
        • +

          srcColorspace

          +
          protected int srcColorspace
          +
        • +
        +
      • +
      - - - - - - -
      -Constructor Detail
      - -

      -TJDecompressor

      -
      -public TJDecompressor()
      -               throws java.lang.Exception
      -
      -
      Create a TurboJPEG decompresssor instance. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJDecompressor

      -
      -public TJDecompressor(byte[] jpegImage)
      -               throws java.lang.Exception
      -
      -
      Create a TurboJPEG decompressor instance and associate the JPEG source - image stored in jpegImage with the newly created instance. -

      -

      -
      Parameters:
      jpegImage - JPEG image buffer (size of the JPEG image is assumed to - be the length of the array) -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJDecompressor

      -
      -public TJDecompressor(byte[] jpegImage,
      -                      int imageSize)
      -               throws java.lang.Exception
      -
      -
      Create a TurboJPEG decompressor instance and associate the JPEG source +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          TJDecompressor

          +
          public TJDecompressor()
          +               throws java.lang.Exception
          +
          Create a TurboJPEG decompresssor instance.
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        + + + +
          +
        • +

          TJDecompressor

          +
          public TJDecompressor(byte[] jpegImage)
          +               throws java.lang.Exception
          +
          Create a TurboJPEG decompressor instance and associate the JPEG source + image stored in jpegImage with the newly created instance.
          +
          Parameters:
          jpegImage - JPEG image buffer (size of the JPEG image is assumed to + be the length of the array)
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        + + + +
          +
        • +

          TJDecompressor

          +
          public TJDecompressor(byte[] jpegImage,
          +              int imageSize)
          +               throws java.lang.Exception
          +
          Create a TurboJPEG decompressor instance and associate the JPEG source image of length imageSize bytes stored in - jpegImage with the newly created instance. -

          -

          -
          Parameters:
          jpegImage - JPEG image buffer
          imageSize - size of the JPEG image (in bytes) -
          Throws: -
          java.lang.Exception
          -
      -
      - -

      -TJDecompressor

      -
      -public TJDecompressor(YUVImage yuvImage)
      -               throws java.lang.Exception
      -
      -
      Create a TurboJPEG decompressor instance and associate the YUV planar + jpegImage with the newly created instance.
    +
    Parameters:
    jpegImage - JPEG image buffer
    imageSize - size of the JPEG image (in bytes)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      TJDecompressor

      +
      public TJDecompressor(YUVImage yuvImage)
      +               throws java.lang.Exception
      +
      Create a TurboJPEG decompressor instance and associate the YUV planar source image stored in yuvImage with the newly created - instance. -

      -

      -
      Parameters:
      yuvImage - YUVImage instance containing a YUV planar - image to be decoded -
      Throws: -
      java.lang.Exception
      - - + instance.
      +
      Parameters:
      yuvImage - YUVImage instance containing a YUV planar + image to be decoded
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + - - - - - - -
    -Method Detail
    - -

    -setSourceImage

    -
    -public void setSourceImage(byte[] srcImage,
    -                           int imageSize)
    -                    throws java.lang.Exception
    -
    -
    Associate the JPEG image of length imageSize bytes stored in +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        setSourceImage

        +
        public void setSourceImage(byte[] srcImage,
        +                  int imageSize)
        +                    throws java.lang.Exception
        +
        Associate the JPEG image of length imageSize bytes stored in srcImage with this decompressor instance. This image will - be used as the source image for subsequent decompress operations. -

        -

        -
        Parameters:
        srcImage - JPEG image buffer
        imageSize - size of the JPEG image (in bytes) -
        Throws: -
        java.lang.Exception
        -
        -
    -
    - -

    -setJPEGImage

    -
    -@Deprecated
    -public void setJPEGImage(byte[] jpegImage,
    -                                    int imageSize)
    -                  throws java.lang.Exception
    -
    -
    Deprecated. Use setSourceImage(byte[], int) instead. -

    -

    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -setSourceImage

    -
    -public void setSourceImage(YUVImage srcImage)
    -                    throws java.lang.Exception
    -
    -
    Associate the specified YUV planar source image with this decompressor + be used as the source image for subsequent decompress operations.
    +
    Parameters:
    srcImage - JPEG image buffer
    imageSize - size of the JPEG image (in bytes)
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      setJPEGImage

      +
      @Deprecated
      +public void setJPEGImage(byte[] jpegImage,
      +                           int imageSize)
      +                  throws java.lang.Exception
      +
      Deprecated. Use setSourceImage(byte[], int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      setSourceImage

      +
      public void setSourceImage(YUVImage srcImage)
      +                    throws java.lang.Exception
      +
      Associate the specified YUV planar source image with this decompressor instance. Subsequent decompress operations will decode this image into an - RGB or grayscale destination image. -

      -

      -
      Parameters:
      srcImage - YUVImage instance containing a YUV planar image to - be decoded -
      Throws: -
      java.lang.Exception
      -
      - -
      - -

      -getWidth

      -
      -public int getWidth()
      -             throws java.lang.Exception
      -
      -
      Returns the width of the source image (JPEG or YUV) associated with this - decompressor instance. -

      -

      - -
      Returns:
      the width of the source image (JPEG or YUV) associated with this - decompressor instance -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getHeight

      -
      -public int getHeight()
      -              throws java.lang.Exception
      -
      -
      Returns the height of the source image (JPEG or YUV) associated with this - decompressor instance. -

      -

      - -
      Returns:
      the height of the source image (JPEG or YUV) associated with this - decompressor instance -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getSubsamp

      -
      -public int getSubsamp()
      -               throws java.lang.Exception
      -
      -
      Returns the level of chrominance subsampling used in the source image + RGB or grayscale destination image.
      +
      Parameters:
      srcImage - YUVImage instance containing a YUV planar image to + be decoded
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getWidth

      +
      public int getWidth()
      +             throws java.lang.Exception
      +
      Returns the width of the source image (JPEG or YUV) associated with this + decompressor instance.
      +
      Returns:
      the width of the source image (JPEG or YUV) associated with this + decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getHeight

      +
      public int getHeight()
      +              throws java.lang.Exception
      +
      Returns the height of the source image (JPEG or YUV) associated with this + decompressor instance.
      +
      Returns:
      the height of the source image (JPEG or YUV) associated with this + decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getSubsamp

      +
      public int getSubsamp()
      +               throws java.lang.Exception
      +
      Returns the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance. See - TJ.SAMP_*. -

      -

      - -
      Returns:
      the level of chrominance subsampling used in the source image - (JPEG or YUV) associated with this decompressor instance -
      Throws: -
      java.lang.Exception
      -
      - -
      - -

      -getColorspace

      -
      -public int getColorspace()
      -                  throws java.lang.Exception
      -
      -
      Returns the colorspace used in the source image (JPEG or YUV) associated - with this decompressor instance. See TJ.CS_*. If the - source image is YUV, then this always returns TJ.CS_YCbCr. -

      -

      - -
      Returns:
      the colorspace used in the source image (JPEG or YUV) associated - with this decompressor instance -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getSourceBuf

      -
      -public byte[] getSourceBuf()
      -                    throws java.lang.Exception
      -
      -
      Returns the source image buffer associated with this decompressor - instance. -

      -

      - -
      Returns:
      the source image buffer associated with this decompressor instance -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getJPEGBuf

      -
      -@Deprecated
      -public byte[] getJPEGBuf()
      -                  throws java.lang.Exception
      -
      -
      Deprecated. Use getSourceBuf() instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getSourceSize

      -
      -public int getSourceSize()
      -                  throws java.lang.Exception
      -
      -
      Returns the size of the source image (in bytes) associated with this - decompressor instance. -

      -

      - -
      Returns:
      the size of the source image (in bytes) associated with this - decompressor instance -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getJPEGSize

      -
      -@Deprecated
      -public int getJPEGSize()
      -                throws java.lang.Exception
      -
      -
      Deprecated. Use getSourceSize() instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -getScaledWidth

      -
      -public int getScaledWidth(int desiredWidth,
      -                          int desiredHeight)
      -                   throws java.lang.Exception
      -
      -
      Returns the width of the largest scaled-down image that the TurboJPEG + TJ.SAMP_*.
      +
      Returns:
      the level of chrominance subsampling used in the source image + (JPEG or YUV) associated with this decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getColorspace

      +
      public int getColorspace()
      +                  throws java.lang.Exception
      +
      Returns the colorspace used in the source image (JPEG or YUV) associated + with this decompressor instance. See TJ.CS_*. If the + source image is YUV, then this always returns TJ.CS_YCbCr.
      +
      Returns:
      the colorspace used in the source image (JPEG or YUV) associated + with this decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getSourceBuf

      +
      public byte[] getSourceBuf()
      +                    throws java.lang.Exception
      +
      Returns the source image buffer associated with this decompressor + instance.
      +
      Returns:
      the source image buffer associated with this decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getJPEGBuf

      +
      @Deprecated
      +public byte[] getJPEGBuf()
      +                  throws java.lang.Exception
      +
      Deprecated. Use getSourceBuf() instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getSourceSize

      +
      public int getSourceSize()
      +                  throws java.lang.Exception
      +
      Returns the size of the source image (in bytes) associated with this + decompressor instance.
      +
      Returns:
      the size of the source image (in bytes) associated with this + decompressor instance
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getJPEGSize

      +
      @Deprecated
      +public int getJPEGSize()
      +                throws java.lang.Exception
      +
      Deprecated. Use getSourceSize() instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getScaledWidth

      +
      public int getScaledWidth(int desiredWidth,
      +                 int desiredHeight)
      +                   throws java.lang.Exception
      +
      Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height. -

      -

      -
      Parameters:
      desiredWidth - desired width (in pixels) of the decompressed image. + height.
      +
      Parameters:
      desiredWidth - desired width (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the - scaled image size.)
      desiredHeight - desired height (in pixels) of the decompressed image. + scaled image size.)
      desiredHeight - desired height (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining - the scaled image size.) -
      Returns:
      the width of the largest scaled-down image that the TurboJPEG + the scaled image size.)
      +
      Returns:
      the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -getScaledHeight

      -
      -public int getScaledHeight(int desiredWidth,
      -                           int desiredHeight)
      -                    throws java.lang.Exception
      -
      -
      Returns the height of the largest scaled-down image that the TurboJPEG + height
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getScaledHeight

      +
      public int getScaledHeight(int desiredWidth,
      +                  int desiredHeight)
      +                    throws java.lang.Exception
      +
      Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height. -

      -

      -
      Parameters:
      desiredWidth - desired width (in pixels) of the decompressed image. + height.
      +
      Parameters:
      desiredWidth - desired width (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the - scaled image size.)
      desiredHeight - desired height (in pixels) of the decompressed image. + scaled image size.)
      desiredHeight - desired height (in pixels) of the decompressed image. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining - the scaled image size.) -
      Returns:
      the height of the largest scaled-down image that the TurboJPEG + the scaled image size.)
      +
      Returns:
      the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompress

      -
      -public void decompress(byte[] dstBuf,
      -                       int x,
      -                       int y,
      -                       int desiredWidth,
      -                       int pitch,
      -                       int desiredHeight,
      -                       int pixelFormat,
      -                       int flags)
      -                throws java.lang.Exception
      -
      -
      Decompress the JPEG source image or decode the YUV source image associated + height
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompress

      +
      public void decompress(byte[] dstBuf,
      +              int x,
      +              int y,
      +              int desiredWidth,
      +              int pitch,
      +              int desiredHeight,
      +              int pixelFormat,
      +              int flags)
      +                throws java.lang.Exception
      +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer. -

      -

      -
      Parameters:
      dstBuf - buffer that will receive the decompressed/decoded image. + to the given destination buffer.
      +
      Parameters:
      dstBuf - buffer that will receive the decompressed/decoded image. If the source image is a JPEG image, then this buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling - scalingFactor.getScaled(jpegHeight) - with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the + scalingFactor.getScaled(jpegHeight) + with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the source image is a YUV image, then this buffer should normally be pitch * height bytes in size, where height is the height of the YUV image. However, the buffer may also be larger than the dimensions of the source image, in which case the x, y, and pitch parameters can be used to specify - the region into which the source image should be decompressed/decoded.
      x - x offset (in pixels) of the region in the destination image into - which the source image should be decompressed/decoded
      y - y offset (in pixels) of the region in the destination image into - which the source image should be decompressed/decoded
      desiredWidth - If the source image is a JPEG image, then this + the region into which the source image should be decompressed/decoded.
      x - x offset (in pixels) of the region in the destination image into + which the source image should be decompressed/decoded
      y - y offset (in pixels) of the region in the destination image into + which the source image should be decompressed/decoded
      desiredWidth - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the @@ -980,18 +864,18 @@ public void decompress(byte[] dstBuf, within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.) This parameter is - ignored if the source image is a YUV image.
      pitch - bytes per line of the destination image. Normally, this + ignored if the source image is a YUV image.
      pitch - bytes per line of the destination image. Normally, this should be set to scaledWidth * TJ.pixelSize(pixelFormat) if the destination image is unpadded, but you can use this to, for instance, pad each line of the destination image to a 4-byte boundary or to decompress/decode the source image into a region of a larger image. NOTE: if the source image is a JPEG image, then scaledWidth can be determined by calling - scalingFactor.getScaled(jpegWidth) - or by calling getScaledWidth(int, int). If the source image is a + scalingFactor.getScaled(jpegWidth) + or by calling getScaledWidth(int, int). If the source image is a YUV image, then scaledWidth is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to - scaledWidth * TJ.pixelSize(pixelFormat).
      desiredHeight - If the source image is a JPEG image, then this + scaledWidth * TJ.pixelSize(pixelFormat).
      desiredHeight - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the @@ -999,204 +883,187 @@ public void decompress(byte[] dstBuf, within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.) This parameter is - ignored if the source image is a YUV image.
      pixelFormat - pixel format of the decompressed/decoded image (one of - TJ.PF_*)
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompress

      -
      -@Deprecated
      -public void decompress(byte[] dstBuf,
      -                                  int desiredWidth,
      -                                  int pitch,
      -                                  int desiredHeight,
      -                                  int pixelFormat,
      -                                  int flags)
      -                throws java.lang.Exception
      -
      -
      Deprecated. Use - decompress(byte[], int, int, int, int, int, int, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -decompress

      -
      -public byte[] decompress(int desiredWidth,
      + ignored if the source image is a YUV image.
      pixelFormat - pixel format of the decompressed/decoded image (one of + TJ.PF_*)
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + + + + + + + + +
      +
    • +

      decompressToYUV

      +
      public void decompressToYUV(YUVImage dstImage,
      +                   int flags)
      +                     throws java.lang.Exception
      +
      Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given YUVImage instance. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB or grayscale image. This method cannot be - used to decompress JPEG source images with the CMYK or YCCK colorspace. -

      -

      -
      Parameters:
      dstImage - YUVImage instance that will receive the YUV planar + used to decompress JPEG source images with the CMYK or YCCK colorspace.
      +
      Parameters:
      dstImage - YUVImage instance that will receive the YUV planar image. The level of subsampling specified in this YUVImage instance must match that of the JPEG image, and the width and height specified in the YUVImage instance must match one of the scaled image sizes that TurboJPEG is capable of generating from the JPEG - source image.
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompressToYUV

      -
      -@Deprecated
      -public void decompressToYUV(byte[] dstBuf,
      -                                       int flags)
      -                     throws java.lang.Exception
      -
      -
      Deprecated. Use decompressToYUV(YUVImage, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -decompressToYUV

      -
      -public YUVImage decompressToYUV(int desiredWidth,
      -                                int pad,
      -                                int desiredHeight,
      -                                int flags)
      -                         throws java.lang.Exception
      -
      -
      Decompress the JPEG source image associated with this decompressor + source image.
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompressToYUV

      +
      @Deprecated
      +public void decompressToYUV(byte[] dstBuf,
      +                              int flags)
      +                     throws java.lang.Exception
      +
      Deprecated. Use decompressToYUV(YUVImage, int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompressToYUV

      +
      public YUVImage decompressToYUV(int desiredWidth,
      +                       int pad,
      +                       int desiredHeight,
      +                       int flags)
      +                         throws java.lang.Exception
      +
      Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and return a YUVImage instance containing the decompressed image. This method performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB or grayscale image. This method cannot be used to decompress JPEG source images with the CMYK or YCCK - colorspace. -

      -

      -
      Parameters:
      desiredWidth - desired width (in pixels) of the YUV image. If the + colorspace.
      +
      Parameters:
      desiredWidth - desired width (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be - considered when determining the scaled image size.)
      pad - the width of each line in each plane of the YUV image will be + considered when determining the scaled image size.)
      pad - the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of - 2.)
      desiredHeight - desired height (in pixels) of the YUV image. If the + 2.)
      desiredHeight - desired height (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be - considered when determining the scaled image size.)
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Returns:
      a YUV planar image -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompressToYUV

      -
      -@Deprecated
      -public byte[] decompressToYUV(int flags)
      -                       throws java.lang.Exception
      -
      -
      Deprecated. Use decompressToYUV(int, int, int, int) instead. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -decompress

      -
      -public void decompress(int[] dstBuf,
      -                       int x,
      -                       int y,
      -                       int desiredWidth,
      -                       int stride,
      -                       int desiredHeight,
      -                       int pixelFormat,
      -                       int flags)
      -                throws java.lang.Exception
      -
      -
      Decompress the JPEG source image or decode the YUV source image associated + considered when determining the scaled image size.)
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Returns:
      a YUV planar image
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompressToYUV

      +
      @Deprecated
      +public byte[] decompressToYUV(int flags)
      +                       throws java.lang.Exception
      +
      Deprecated. Use decompressToYUV(int, int, int, int) instead.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompress

      +
      public void decompress(int[] dstBuf,
      +              int x,
      +              int y,
      +              int desiredWidth,
      +              int stride,
      +              int desiredHeight,
      +              int pixelFormat,
      +              int flags)
      +                throws java.lang.Exception
      +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image - to the given destination buffer. -

      -

      -
      Parameters:
      dstBuf - buffer that will receive the decompressed/decoded image. + to the given destination buffer.
      +
      Parameters:
      dstBuf - buffer that will receive the decompressed/decoded image. If the source image is a JPEG image, then this buffer should normally be stride * scaledHeight pixels in size, where scaledHeight can be determined by calling - scalingFactor.getScaled(jpegHeight) - with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the + scalingFactor.getScaled(jpegHeight) + with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the source image is a YUV image, then this buffer should normally be stride * height pixels in size, where height is the height of the YUV image. However, the buffer may also be larger than the dimensions of the JPEG image, in which case the x, y, and stride parameters can be used to specify - the region into which the source image should be decompressed.
      x - x offset (in pixels) of the region in the destination image into - which the source image should be decompressed/decoded
      y - y offset (in pixels) of the region in the destination image into - which the source image should be decompressed/decoded
      desiredWidth - If the source image is a JPEG image, then this + the region into which the source image should be decompressed.
      x - x offset (in pixels) of the region in the destination image into + which the source image should be decompressed/decoded
      y - y offset (in pixels) of the region in the destination image into + which the source image should be decompressed/decoded
      desiredWidth - If the source image is a JPEG image, then this specifies the desired width (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the @@ -1204,16 +1071,16 @@ public void decompress(int[] dstBuf, within the desired dimensions. Setting this to 0 is the same as setting it to the width of the JPEG image (in other words, the width will not be considered when determining the scaled image size.) This parameter is - ignored if the source image is a YUV image.
      stride - pixels per line of the destination image. Normally, this + ignored if the source image is a YUV image.
      stride - pixels per line of the destination image. Normally, this should be set to scaledWidth, but you can use this to, for instance, decompress the JPEG image into a region of a larger image. NOTE: if the source image is a JPEG image, then scaledWidth can be determined by calling - scalingFactor.getScaled(jpegWidth) - or by calling getScaledWidth(int, int). If the source image is a + scalingFactor.getScaled(jpegWidth) + or by calling getScaledWidth(int, int). If the source image is a YUV image, then scaledWidth is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to - scaledWidth.
      desiredHeight - If the source image is a JPEG image, then this + scaledWidth.
      desiredHeight - If the source image is a JPEG image, then this specifies the desired height (in pixels) of the decompressed image (or image region.) If the desired destination image dimensions are different than the source image dimensions, then TurboJPEG will use scaling in the @@ -1221,161 +1088,157 @@ public void decompress(int[] dstBuf, within the desired dimensions. Setting this to 0 is the same as setting it to the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.) This parameter is - ignored if the source image is a YUV image.
      pixelFormat - pixel format of the decompressed image (one of - TJ.PF_*)
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompress

      -
      -public void decompress(java.awt.image.BufferedImage dstImage,
      -                       int flags)
      -                throws java.lang.Exception
      -
      -
      Decompress the JPEG source image or decode the YUV source image associated + ignored if the source image is a YUV image.
      pixelFormat - pixel format of the decompressed image (one of + TJ.PF_*)
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompress

      +
      public void decompress(java.awt.image.BufferedImage dstImage,
      +              int flags)
      +                throws java.lang.Exception
      +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to - the given BufferedImage instance. -

      -

      -
      Parameters:
      dstImage - a BufferedImage instance that will receive + the given BufferedImage instance.
      +
      Parameters:
      dstImage - a BufferedImage instance that will receive the decompressed/decoded image. If the source image is a JPEG image, then the width and height of the BufferedImage instance must match one of the scaled image sizes that TurboJPEG is capable of generating from the JPEG image. If the source image is a YUV image, then the width and height of the BufferedImage instance must match the width and - height of the YUV image.
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -decompress

      -
      -public java.awt.image.BufferedImage decompress(int desiredWidth,
      -                                               int desiredHeight,
      -                                               int bufferedImageType,
      -                                               int flags)
      -                                        throws java.lang.Exception
      -
      -
      Decompress the JPEG source image or decode the YUV source image associated + height of the YUV image.
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      decompress

      +
      public java.awt.image.BufferedImage decompress(int desiredWidth,
      +                                      int desiredHeight,
      +                                      int bufferedImageType,
      +                                      int flags)
      +                                        throws java.lang.Exception
      +
      Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a BufferedImage - instance containing the decompressed/decoded image. -

      -

      -
      Parameters:
      desiredWidth - see - decompress(byte[], int, int, int, int, int, int, int) for - description
      desiredHeight - see - decompress(byte[], int, int, int, int, int, int, int) for - description
      bufferedImageType - the image type of the BufferedImage + instance containing the decompressed/decoded image.
      +
      Parameters:
      desiredWidth - see + decompress(byte[], int, int, int, int, int, int, int) for + description
      desiredHeight - see + decompress(byte[], int, int, int, int, int, int, int) for + description
      bufferedImageType - the image type of the BufferedImage instance that will be created (for instance, - BufferedImage.TYPE_INT_RGB)
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Returns:
      a BufferedImage instance containing the - decompressed/decoded image -
      Throws: -
      java.lang.Exception
      - - -
      - -

      -close

      -
      -public void close()
      -           throws java.lang.Exception
      -
      -
      Free the native structures associated with this decompressor instance. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      -
      - -

      -finalize

      -
      -protected void finalize()
      -                 throws java.lang.Throwable
      -
      -
      -
      Overrides:
      finalize in class java.lang.Object
      -
      -
      - -
      Throws: -
      java.lang.Throwable
      -
      -
      + BufferedImage.TYPE_INT_RGB)
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Returns:
      a BufferedImage instance containing the + decompressed/decoded image
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      close

      +
      public void close()
      +           throws java.lang.Exception
      +
      Free the native structures associated with this decompressor instance.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      finalize

      +
      protected void finalize()
      +                 throws java.lang.Throwable
      +
      +
      Overrides:
      +
      finalize in class java.lang.Object
      +
      Throws:
      +
      java.lang.Throwable
      +
    • +
    + + + + + + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html index af29fc56..1b901477 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html @@ -1,356 +1,336 @@ - - - - -TJScalingFactor - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJScalingFactor

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.TJScalingFactor
    -
    -
    -
    -
    public class TJScalingFactor
    extends java.lang.Object
    - - -

    -Fractional scaling factor -

    - -

    -


    - -

    - +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJScalingFactor

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • org.libjpegturbo.turbojpeg.TJScalingFactor
      • +
      +
    • +
    +
    +
      +
    • +
      +
      +
      public class TJScalingFactor
      +extends java.lang.Object
      +
      Fractional scaling factor
      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - -
      -Constructor Summary
      TJScalingFactor(int num, - int denom) - -
      -           
      -  +
        +
      • + + +

        Constructor Summary

        + + + + + + + + +
        Constructors 
        Constructor and Description
        TJScalingFactor(int num, + int denom) 
        +
      • +
      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Method Summary
      - booleanequals(TJScalingFactor other) - -
      -          Returns true or false, depending on whether this instance and - other have the same numerator and denominator.
      - intgetDenom() - -
      -          Returns denominator
      - intgetNum() - -
      -          Returns numerator
      - intgetScaled(int dimension) - -
      -          Returns the scaled value of dimension.
      - booleanisOne() - -
      -          Returns true or false, depending on whether this instance is equal to - 1/1.
      - - - - - - - -
      Methods inherited from class java.lang.Object
      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      -  -

      - +

        +
      • + + +

        Method Summary

        + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Methods 
        Modifier and TypeMethod and Description
        booleanequals(TJScalingFactor other) +
        Returns true or false, depending on whether this instance and + other have the same numerator and denominator.
        +
        intgetDenom() +
        Returns denominator
        +
        intgetNum() +
        Returns numerator
        +
        intgetScaled(int dimension) +
        Returns the scaled value of dimension.
        +
        booleanisOne() +
        Returns true or false, depending on whether this instance is equal to + 1/1.
        +
        +
          +
        • + + +

          Methods inherited from class java.lang.Object

          +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        • +
        +
      • +
      +
    • +
    +
    +
    +
      +
    • - - - - - - -
      -Constructor Detail
      - -

      -TJScalingFactor

      -
      -public TJScalingFactor(int num,
      -                       int denom)
      -                throws java.lang.Exception
      -
      -
      - -
      Throws: -
      java.lang.Exception
      -
      - +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          TJScalingFactor

          +
          public TJScalingFactor(int num,
          +               int denom)
          +                throws java.lang.Exception
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        +
      • +
      - - - - - - -
      -Method Detail
      - -

      -getNum

      -
      -public int getNum()
      -
      -
      Returns numerator -

      -

      - -
      Returns:
      numerator
      -
      -
      -
      - -

      -getDenom

      -
      -public int getDenom()
      -
      -
      Returns denominator -

      -

      - -
      Returns:
      denominator
      -
      -
      -
      - -

      -getScaled

      -
      -public int getScaled(int dimension)
      -
      -
      Returns the scaled value of dimension. This function +
        +
      • + + +

        Method Detail

        + + + +
          +
        • +

          getNum

          +
          public int getNum()
          +
          Returns numerator
          +
          Returns:
          numerator
          +
        • +
        + + + +
          +
        • +

          getDenom

          +
          public int getDenom()
          +
          Returns denominator
          +
          Returns:
          denominator
          +
        • +
        + + + +
          +
        • +

          getScaled

          +
          public int getScaled(int dimension)
          +
          Returns the scaled value of dimension. This function performs the integer equivalent of - ceil(dimension * scalingFactor). -

          -

          - -
          Returns:
          the scaled value of dimension
          -
          -
      -
      - -

      -equals

      -
      -public boolean equals(TJScalingFactor other)
      -
      -
      Returns true or false, depending on whether this instance and - other have the same numerator and denominator. -

      -

      - -
      Returns:
      true or false, depending on whether this instance and - other have the same numerator and denominator
      -
      -
      -
      - -

      -isOne

      -
      -public boolean isOne()
      -
      -
      Returns true or false, depending on whether this instance is equal to - 1/1. -

      -

      - -
      Returns:
      true or false, depending on whether this instance is equal to - 1/1
      -
      -
      + ceil(dimension * scalingFactor).
    +
    Returns:
    the scaled value of dimension
    + + + + + +
      +
    • +

      equals

      +
      public boolean equals(TJScalingFactor other)
      +
      Returns true or false, depending on whether this instance and + other have the same numerator and denominator.
      +
      Returns:
      true or false, depending on whether this instance and + other have the same numerator and denominator
      +
    • +
    + + + +
      +
    • +

      isOne

      +
      public boolean isOne()
      +
      Returns true or false, depending on whether this instance is equal to + 1/1.
      +
      Returns:
      true or false, depending on whether this instance is equal to + 1/1
      +
    • +
    + + + + +
    + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html index 3a68c9f8..b4bd5cc7 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html @@ -1,767 +1,712 @@ - - - - -TJTransform - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJTransform

    -
    -java.lang.Object
    -  extended by java.awt.geom.RectangularShape
    -      extended by java.awt.geom.Rectangle2D
    -          extended by java.awt.Rectangle
    -              extended by org.libjpegturbo.turbojpeg.TJTransform
    -
    -
    -
    All Implemented Interfaces:
    java.awt.Shape, java.io.Serializable, java.lang.Cloneable
    -
    -
    -
    -
    public class TJTransform
    extends java.awt.Rectangle
    - - -

    -Lossless transform parameters -

    - -

    -

    -
    See Also:
    Serialized Form
    -
    - -

    +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJTransform

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • java.awt.geom.RectangularShape
      • +
      • +
          +
        • java.awt.geom.Rectangle2D
        • +
        • +
            +
          • java.awt.Rectangle
          • +
          • +
              +
            • org.libjpegturbo.turbojpeg.TJTransform
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
    +
      +
    • +
      +
      All Implemented Interfaces:
      +
      java.awt.Shape, java.io.Serializable, java.lang.Cloneable
      +
      +
      +
      +
      public class TJTransform
      +extends java.awt.Rectangle
      +
      Lossless transform parameters
      +
      See Also:
      Serialized Form
      +
    • +
    +
    +
    +
      +
    • - - - - - - -
      -Nested Class Summary
      - - - - - - - -
      Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
      java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
      -  +
        +
      • + + +

        Nested Class Summary

        +
          +
        • + + +

          Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D

          +java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
        • +
        +
      • +
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Field Summary
      - TJCustomFiltercf - -
      -          Custom filter instance
      -static intNUMOP - -
      -          The number of lossless transform operations
      - intop - -
      -          Transform operation (one of OP_*)
      -static intOP_HFLIP - -
      -          Flip (mirror) image horizontally.
      -static intOP_NONE - -
      -          Do not transform the position of the image pixels.
      -static intOP_ROT180 - -
      -          Rotate image 180 degrees.
      -static intOP_ROT270 - -
      -          Rotate image counter-clockwise by 90 degrees.
      -static intOP_ROT90 - -
      -          Rotate image clockwise by 90 degrees.
      -static intOP_TRANSPOSE - -
      -          Transpose image (flip/mirror along upper left to lower right axis).
      -static intOP_TRANSVERSE - -
      -          Transverse transpose image (flip/mirror along upper right to lower left - axis).
      -static intOP_VFLIP - -
      -          Flip (mirror) image vertically.
      -static intOPT_CROP - -
      -          This option will enable lossless cropping.
      -static intOPT_GRAY - -
      -          This option will discard the color data in the input image and produce - a grayscale output image.
      -static intOPT_NOOUTPUT - -
      -          This option will prevent TJTransformer.transform() from outputting a JPEG image for this - particular transform.
      -static intOPT_PERFECT - -
      -          This option will cause TJTransformer.transform() to throw an exception if the transform is not - perfect.
      -static intOPT_TRIM - -
      -          This option will discard any partial MCU blocks that cannot be - transformed.
      - intoptions - -
      -          Transform options (bitwise OR of one or more of OPT_*)
      - - - - - - - -
      Fields inherited from class java.awt.Rectangle
      height, width, x, y
      - - - - - - - -
      Fields inherited from class java.awt.geom.Rectangle2D
      OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
      -  +
        +
      • + + +

        Field Summary

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Fields 
        Modifier and TypeField and Description
        TJCustomFiltercf +
        Custom filter instance
        +
        static intNUMOP +
        The number of lossless transform operations
        +
        intop +
        Transform operation (one of OP_*)
        +
        static intOP_HFLIP +
        Flip (mirror) image horizontally.
        +
        static intOP_NONE +
        Do not transform the position of the image pixels.
        +
        static intOP_ROT180 +
        Rotate image 180 degrees.
        +
        static intOP_ROT270 +
        Rotate image counter-clockwise by 90 degrees.
        +
        static intOP_ROT90 +
        Rotate image clockwise by 90 degrees.
        +
        static intOP_TRANSPOSE +
        Transpose image (flip/mirror along upper left to lower right axis).
        +
        static intOP_TRANSVERSE +
        Transverse transpose image (flip/mirror along upper right to lower left + axis).
        +
        static intOP_VFLIP +
        Flip (mirror) image vertically.
        +
        static intOPT_CROP +
        This option will enable lossless cropping.
        +
        static intOPT_GRAY +
        This option will discard the color data in the input image and produce + a grayscale output image.
        +
        static intOPT_NOOUTPUT +
        This option will prevent TJTransformer.transform() from outputting a JPEG image for this + particular transform.
        +
        static intOPT_PERFECT +
        This option will cause TJTransformer.transform() to throw an exception if the transform is not + perfect.
        +
        static intOPT_TRIM +
        This option will discard any partial MCU blocks that cannot be + transformed.
        +
        intoptions +
        Transform options (bitwise OR of one or more of OPT_*)
        +
        +
          +
        • + + +

          Fields inherited from class java.awt.Rectangle

          +height, width, x, y
        • +
        +
          +
        • + + +

          Fields inherited from class java.awt.geom.Rectangle2D

          +OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
        • +
        +
      • +
      - - - - - - - - - - - - - - - -
      -Constructor Summary
      TJTransform() - -
      -          Create a new lossless transform instance.
      TJTransform(int x, - int y, - int w, - int h, - int op, - int options, - TJCustomFilter cf) - -
      -          Create a new lossless transform instance with the given parameters.
      TJTransform(java.awt.Rectangle r, - int op, - int options, - TJCustomFilter cf) - -
      -          Create a new lossless transform instance with the given parameters.
      -  +
        +
      • + + +

        Constructor Summary

        + + + + + + + + + + + + + + +
        Constructors 
        Constructor and Description
        TJTransform() +
        Create a new lossless transform instance.
        +
        TJTransform(int x, + int y, + int w, + int h, + int op, + int options, + TJCustomFilter cf) +
        Create a new lossless transform instance with the given parameters.
        +
        TJTransform(java.awt.Rectangle r, + int op, + int options, + TJCustomFilter cf) +
        Create a new lossless transform instance with the given parameters.
        +
        +
      • +
      - - - - - - -
      -Method Summary
      - - - - - - - -
      Methods inherited from class java.awt.Rectangle
      add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
      - - - - - - - -
      Methods inherited from class java.awt.geom.Rectangle2D
      add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
      - - - - - - - -
      Methods inherited from class java.awt.geom.RectangularShape
      clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
      - - - - - - - -
      Methods inherited from class java.lang.Object
      finalize, getClass, notify, notifyAll, wait, wait, wait
      - - - - - - - -
      Methods inherited from interface java.awt.Shape
      contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
      -  -

      - +

        +
      • + + +

        Method Summary

        +
          +
        • + + +

          Methods inherited from class java.awt.Rectangle

          +add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
        • +
        +
          +
        • + + +

          Methods inherited from class java.awt.geom.Rectangle2D

          +add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
        • +
        +
          +
        • + + +

          Methods inherited from class java.awt.geom.RectangularShape

          +clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
        • +
        +
          +
        • + + +

          Methods inherited from class java.lang.Object

          +finalize, getClass, notify, notifyAll, wait, wait, wait
        • +
        +
          +
        • + + +

          Methods inherited from interface java.awt.Shape

          +contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
        • +
        +
      • +
      +
    • +
    +
    +
    +
      +
    • - - - - - - -
      -Field Detail
      - -

      -NUMOP

      -
      -public static final int NUMOP
      -
      -
      The number of lossless transform operations -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -OP_NONE

      -
      -public static final int OP_NONE
      -
      -
      Do not transform the position of the image pixels. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -OP_HFLIP

      -
      -public static final int OP_HFLIP
      -
      -
      Flip (mirror) image horizontally. This transform is imperfect if there - are any partial MCU blocks on the right edge. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OP_VFLIP

      -
      -public static final int OP_VFLIP
      -
      -
      Flip (mirror) image vertically. This transform is imperfect if there are - any partial MCU blocks on the bottom edge. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OP_TRANSPOSE

      -
      -public static final int OP_TRANSPOSE
      -
      -
      Transpose image (flip/mirror along upper left to lower right axis). This - transform is always perfect. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OP_TRANSVERSE

      -
      -public static final int OP_TRANSVERSE
      -
      -
      Transverse transpose image (flip/mirror along upper right to lower left +
        +
      • + + +

        Field Detail

        + + + +
          +
        • +

          NUMOP

          +
          public static final int NUMOP
          +
          The number of lossless transform operations
          +
          See Also:
          Constant Field Values
          +
        • +
        + + + +
          +
        • +

          OP_NONE

          +
          public static final int OP_NONE
          +
          Do not transform the position of the image pixels.
          +
          See Also:
          Constant Field Values
          +
        • +
        + + + +
          +
        • +

          OP_HFLIP

          +
          public static final int OP_HFLIP
          +
          Flip (mirror) image horizontally. This transform is imperfect if there + are any partial MCU blocks on the right edge.
          +
          See Also:
          OPT_PERFECT, +Constant Field Values
          +
        • +
        + + + +
          +
        • +

          OP_VFLIP

          +
          public static final int OP_VFLIP
          +
          Flip (mirror) image vertically. This transform is imperfect if there are + any partial MCU blocks on the bottom edge.
          +
          See Also:
          OPT_PERFECT, +Constant Field Values
          +
        • +
        + + + +
          +
        • +

          OP_TRANSPOSE

          +
          public static final int OP_TRANSPOSE
          +
          Transpose image (flip/mirror along upper left to lower right axis). This + transform is always perfect.
          +
          See Also:
          OPT_PERFECT, +Constant Field Values
          +
        • +
        + + + +
          +
        • +

          OP_TRANSVERSE

          +
          public static final int OP_TRANSVERSE
          +
          Transverse transpose image (flip/mirror along upper right to lower left axis). This transform is imperfect if there are any partial MCU blocks in - the image. -

          -

          -
          See Also:
          OPT_PERFECT, -Constant Field Values
          -
      -
      - -

      -OP_ROT90

      -
      -public static final int OP_ROT90
      -
      -
      Rotate image clockwise by 90 degrees. This transform is imperfect if - there are any partial MCU blocks on the bottom edge. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OP_ROT180

      -
      -public static final int OP_ROT180
      -
      -
      Rotate image 180 degrees. This transform is imperfect if there are any - partial MCU blocks in the image. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OP_ROT270

      -
      -public static final int OP_ROT270
      -
      -
      Rotate image counter-clockwise by 90 degrees. This transform is imperfect - if there are any partial MCU blocks on the right edge. -

      -

      -
      See Also:
      OPT_PERFECT, -Constant Field Values
      -
      -
      - -

      -OPT_PERFECT

      -
      -public static final int OPT_PERFECT
      -
      -
      This option will cause TJTransformer.transform() to throw an exception if the transform is not + the image.
    +
    See Also:
    OPT_PERFECT, +Constant Field Values
    + + + + + +
      +
    • +

      OP_ROT90

      +
      public static final int OP_ROT90
      +
      Rotate image clockwise by 90 degrees. This transform is imperfect if + there are any partial MCU blocks on the bottom edge.
      +
      See Also:
      OPT_PERFECT, +Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OP_ROT180

      +
      public static final int OP_ROT180
      +
      Rotate image 180 degrees. This transform is imperfect if there are any + partial MCU blocks in the image.
      +
      See Also:
      OPT_PERFECT, +Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OP_ROT270

      +
      public static final int OP_ROT270
      +
      Rotate image counter-clockwise by 90 degrees. This transform is imperfect + if there are any partial MCU blocks on the right edge.
      +
      See Also:
      OPT_PERFECT, +Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OPT_PERFECT

      +
      public static final int OPT_PERFECT
      +
      This option will cause TJTransformer.transform() to throw an exception if the transform is not perfect. Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used. If the image's width or height - is not evenly divisible by the MCU block size (see TJ.getMCUWidth(int) - and TJ.getMCUHeight(int)), then there will be partial MCU blocks on the + is not evenly divisible by the MCU block size (see TJ.getMCUWidth(int) + and TJ.getMCUHeight(int)), then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which - will create odd-looking strips on the right or bottom edge of the image. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -OPT_TRIM

      -
      -public static final int OPT_TRIM
      -
      -
      This option will discard any partial MCU blocks that cannot be - transformed. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -OPT_CROP

      -
      -public static final int OPT_CROP
      -
      -
      This option will enable lossless cropping. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -OPT_GRAY

      -
      -public static final int OPT_GRAY
      -
      -
      This option will discard the color data in the input image and produce - a grayscale output image. -

      -

      -
      See Also:
      Constant Field Values
      -
      -
      - -

      -OPT_NOOUTPUT

      -
      -public static final int OPT_NOOUTPUT
      -
      -
      This option will prevent TJTransformer.transform() from outputting a JPEG image for this + will create odd-looking strips on the right or bottom edge of the image.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OPT_TRIM

      +
      public static final int OPT_TRIM
      +
      This option will discard any partial MCU blocks that cannot be + transformed.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OPT_CROP

      +
      public static final int OPT_CROP
      +
      This option will enable lossless cropping.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OPT_GRAY

      +
      public static final int OPT_GRAY
      +
      This option will discard the color data in the input image and produce + a grayscale output image.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      OPT_NOOUTPUT

      +
      public static final int OPT_NOOUTPUT
      +
      This option will prevent TJTransformer.transform() from outputting a JPEG image for this particular transform. This can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding - them. -

      -

      -
      See Also:
      Constant Field Values
      - -
      - -

      -op

      -
      -public int op
      -
      -
      Transform operation (one of OP_*) -

      -

      -
      -
      -
      - -

      -options

      -
      -public int options
      -
      -
      Transform options (bitwise OR of one or more of OPT_*) -

      -

      -
      -
      -
      - -

      -cf

      -
      -public TJCustomFilter cf
      -
      -
      Custom filter instance -

      -

      -
      -
      - + them.
      +
      See Also:
      Constant Field Values
      +
    • +
    + + + +
      +
    • +

      op

      +
      public int op
      +
      Transform operation (one of OP_*)
      +
    • +
    + + + +
      +
    • +

      options

      +
      public int options
      +
      Transform options (bitwise OR of one or more of OPT_*)
      +
    • +
    + + + + + + - - - - - - -
    -Constructor Detail
    - -

    -TJTransform

    -
    -public TJTransform()
    -
    -
    Create a new lossless transform instance. -

    -

    -
    - -

    -TJTransform

    -
    -public TJTransform(int x,
    -                   int y,
    -                   int w,
    -                   int h,
    -                   int op,
    -                   int options,
    -                   TJCustomFilter cf)
    -            throws java.lang.Exception
    -
    -
    Create a new lossless transform instance with the given parameters. -

    -

    -
    Parameters:
    x - the left boundary of the cropping region. This must be evenly - divisible by the MCU block width (see TJ.getMCUWidth(int))
    y - the upper boundary of the cropping region. This must be evenly - divisible by the MCU block height (see TJ.getMCUHeight(int))
    w - the width of the cropping region. Setting this to 0 is the +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        TJTransform

        +
        public TJTransform()
        +
        Create a new lossless transform instance.
        +
      • +
      + + + +
        +
      • +

        TJTransform

        +
        public TJTransform(int x,
        +           int y,
        +           int w,
        +           int h,
        +           int op,
        +           int options,
        +           TJCustomFilter cf)
        +            throws java.lang.Exception
        +
        Create a new lossless transform instance with the given parameters.
        +
        Parameters:
        x - the left boundary of the cropping region. This must be evenly + divisible by the MCU block width (see TJ.getMCUWidth(int))
        y - the upper boundary of the cropping region. This must be evenly + divisible by the MCU block height (see TJ.getMCUHeight(int))
        w - the width of the cropping region. Setting this to 0 is the equivalent of setting it to (width of the source JPEG image - - x).
        h - the height of the cropping region. Setting this to 0 is the + x).
        h - the height of the cropping region. Setting this to 0 is the equivalent of setting it to (height of the source JPEG image - - y).
        op - one of the transform operations (OP_*)
        options - the bitwise OR of one or more of the transform options - (OPT_*)
        cf - an instance of an object that implements the TJCustomFilter interface, or null if no custom filter is needed -
        Throws: -
        java.lang.Exception
        -
    -
    - -

    -TJTransform

    -
    -public TJTransform(java.awt.Rectangle r,
    -                   int op,
    -                   int options,
    -                   TJCustomFilter cf)
    -            throws java.lang.Exception
    -
    -
    Create a new lossless transform instance with the given parameters. -

    -

    -
    Parameters:
    r - a Rectangle instance that specifies the cropping - region. See TJTransform(int, int, int, int, int, int, TJCustomFilter) for more - detail.
    op - one of the transform operations (OP_*)
    options - the bitwise OR of one or more of the transform options - (OPT_*)
    cf - an instance of an object that implements the TJCustomFilter interface, or null if no custom filter is needed -
    Throws: -
    java.lang.Exception
    -
    + y).
    op - one of the transform operations (OP_*)
    options - the bitwise OR of one or more of the transform options + (OPT_*)
    cf - an instance of an object that implements the TJCustomFilter interface, or null if no custom filter is needed
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      TJTransform

      +
      public TJTransform(java.awt.Rectangle r,
      +           int op,
      +           int options,
      +           TJCustomFilter cf)
      +            throws java.lang.Exception
      +
      Create a new lossless transform instance with the given parameters.
      +
      Parameters:
      r - a Rectangle instance that specifies the cropping + region. See TJTransform(int, int, int, int, int, int, TJCustomFilter) for more + detail.
      op - one of the transform operations (OP_*)
      options - the bitwise OR of one or more of the transform options + (OPT_*)
      cf - an instance of an object that implements the TJCustomFilter interface, or null if no custom filter is needed
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + +
    + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html index 75fedf75..3be18ec6 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html @@ -1,301 +1,291 @@ - - - - -TJTransformer - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class TJTransformer

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.TJDecompressor
    -      extended by org.libjpegturbo.turbojpeg.TJTransformer
    -
    -
    -
    -
    public class TJTransformer
    extends TJDecompressor
    - - -

    -TurboJPEG lossless transformer -

    - -

    -


    - -

    +

    +
    org.libjpegturbo.turbojpeg
    +

    Class TJTransformer

    +
    +
    + +
    +
      +
    • +
      +
      +
      public class TJTransformer
      +extends TJDecompressor
      +
      TurboJPEG lossless transformer
      +
    • +
    +
    +
    +
      +
    • - - - - - - -
      -Field Summary
      - - - - - - - -
      Fields inherited from class org.libjpegturbo.turbojpeg.TJDecompressor
      handle, jpegBuf, jpegBufSize, srcColorspace, srcHeight, srcSubsamp, srcWidth, yuvImage
      -  + - - - - - - - - - - - - - - + +
      -Constructor Summary
      TJTransformer() - -
      -          Create a TurboJPEG lossless transformer instance.
      TJTransformer(byte[] jpegImage) - -
      -          Create a TurboJPEG lossless transformer instance and associate the JPEG - image stored in jpegImage with the newly created instance.
      TJTransformer(byte[] jpegImage, - int imageSize) - -
      -          Create a TurboJPEG lossless transformer instance and associate the JPEG +
        +
      • + + +

        Constructor Summary

        + + + + + + + + + + + + + - -
        Constructors 
        Constructor and Description
        TJTransformer() +
        Create a TurboJPEG lossless transformer instance.
        +
        TJTransformer(byte[] jpegImage) +
        Create a TurboJPEG lossless transformer instance and associate the JPEG + image stored in jpegImage with the newly created instance.
        +
        TJTransformer(byte[] jpegImage, + int imageSize) +
        Create a TurboJPEG lossless transformer instance and associate the JPEG image of length imageSize bytes stored in - jpegImage with the newly created instance.
        -  + jpegImage with the newly created instance. +
      +
    • +
    - - - - - - - - - - - - - + + + + + +
    -Method Summary
    - int[]getTransformedSizes() - -
    -          Returns an array containing the sizes of the transformed JPEG images - generated by the most recent transform operation.
    - voidtransform(byte[][] dstBufs, - TJTransform[] transforms, - int flags) - -
    -          Losslessly transform the JPEG image associated with this transformer +
    TJDecompressor[]transform(TJTransform[] transforms, + int flags) +
    Losslessly transform the JPEG image associated with this transformer + instance and return an array of TJDecompressor instances, each of + which has a transformed JPEG image associated with it.
    +
    + +
      +
    • + + +

      Methods inherited from class java.lang.Object

      +clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • +
    + + + + +
    +
    +
      +
    • - - - - - - -
      -Constructor Detail
      - -

      -TJTransformer

      -
      -public TJTransformer()
      -              throws java.lang.Exception
      -
      -
      Create a TurboJPEG lossless transformer instance. -

      -

      - -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJTransformer

      -
      -public TJTransformer(byte[] jpegImage)
      -              throws java.lang.Exception
      -
      -
      Create a TurboJPEG lossless transformer instance and associate the JPEG - image stored in jpegImage with the newly created instance. -

      -

      -
      Parameters:
      jpegImage - JPEG image buffer (size of the JPEG image is assumed to - be the length of the array) -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -TJTransformer

      -
      -public TJTransformer(byte[] jpegImage,
      -                     int imageSize)
      -              throws java.lang.Exception
      -
      -
      Create a TurboJPEG lossless transformer instance and associate the JPEG +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          TJTransformer

          +
          public TJTransformer()
          +              throws java.lang.Exception
          +
          Create a TurboJPEG lossless transformer instance.
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        + + + +
          +
        • +

          TJTransformer

          +
          public TJTransformer(byte[] jpegImage)
          +              throws java.lang.Exception
          +
          Create a TurboJPEG lossless transformer instance and associate the JPEG + image stored in jpegImage with the newly created instance.
          +
          Parameters:
          jpegImage - JPEG image buffer (size of the JPEG image is assumed to + be the length of the array)
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        + + + +
          +
        • +

          TJTransformer

          +
          public TJTransformer(byte[] jpegImage,
          +             int imageSize)
          +              throws java.lang.Exception
          +
          Create a TurboJPEG lossless transformer instance and associate the JPEG image of length imageSize bytes stored in - jpegImage with the newly created instance. -

          -

          -
          Parameters:
          jpegImage - JPEG image buffer
          imageSize - size of the JPEG image (in bytes) -
          Throws: -
          java.lang.Exception
          -
      - + jpegImage with the newly created instance.
    +
    Parameters:
    jpegImage - JPEG image buffer
    imageSize - size of the JPEG image (in bytes)
    +
    Throws:
    +
    java.lang.Exception
    + + + + - - - - - - -
    -Method Detail
    - -

    -transform

    -
    -public void transform(byte[][] dstBufs,
    -                      TJTransform[] transforms,
    -                      int flags)
    -               throws java.lang.Exception
    -
    -
    Losslessly transform the JPEG image associated with this transformer +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        transform

        +
        public void transform(byte[][] dstBufs,
        +             TJTransform[] transforms,
        +             int flags)
        +               throws java.lang.Exception
        +
        Losslessly transform the JPEG image associated with this transformer instance into one or more JPEG images stored in the given destination buffers. Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the @@ -306,123 +296,121 @@ public void transform(byte[][] dstBufs, size of the destination image. Thus, this method provides a means of generating multiple transformed images from the same source or of applying multiple transformations simultaneously, in order to eliminate the need to - read the source coefficients multiple times. -

        -

        -
        Parameters:
        dstBufs - an array of image buffers. dstbufs[i] will + read the source coefficients multiple times.
        +
        Parameters:
        dstBufs - an array of image buffers. dstbufs[i] will receive a JPEG image that has been transformed using the parameters in - transforms[i]. Use TJ.bufSize(int, int, int) to determine the + transforms[i]. Use TJ.bufSize(int, int, int) to determine the maximum size for each buffer based on the transformed or cropped width and - height and the level of subsampling used in the source image.
        transforms - an array of TJTransform instances, each of + height and the level of subsampling used in the source image.
        transforms - an array of TJTransform instances, each of which specifies the transform parameters and/or cropping region for the - corresponding transformed output image
        flags - the bitwise OR of one or more of - TJ.FLAG_* -
        Throws: -
        java.lang.Exception
        -
    -
    -
    - -

    -transform

    -
    -public TJDecompressor[] transform(TJTransform[] transforms,
    -                                  int flags)
    -                           throws java.lang.Exception
    -
    -
    Losslessly transform the JPEG image associated with this transformer - instance and return an array of TJDecompressor instances, each of - which has a transformed JPEG image associated with it. -

    -

    -
    Parameters:
    transforms - an array of TJTransform instances, each of + corresponding transformed output image
    flags - the bitwise OR of one or more of + TJ.FLAG_*
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      transform

      +
      public TJDecompressor[] transform(TJTransform[] transforms,
      +                         int flags)
      +                           throws java.lang.Exception
      +
      Losslessly transform the JPEG image associated with this transformer + instance and return an array of TJDecompressor instances, each of + which has a transformed JPEG image associated with it.
      +
      Parameters:
      transforms - an array of TJTransform instances, each of which specifies the transform parameters and/or cropping region for the - corresponding transformed output image
      flags - the bitwise OR of one or more of - TJ.FLAG_* -
      Returns:
      an array of TJDecompressor instances, each of - which has a transformed JPEG image associated with it -
      Throws: -
      java.lang.Exception
      -
    -
    -
    - -

    -getTransformedSizes

    -
    -public int[] getTransformedSizes()
    -                          throws java.lang.Exception
    -
    -
    Returns an array containing the sizes of the transformed JPEG images - generated by the most recent transform operation. -

    -

    - -
    Returns:
    an array containing the sizes of the transformed JPEG images - generated by the most recent transform operation -
    Throws: -
    java.lang.Exception
    -
    -
    + corresponding transformed output image
    flags - the bitwise OR of one or more of + TJ.FLAG_*
    +
    Returns:
    an array of TJDecompressor instances, each of + which has a transformed JPEG image associated with it
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      getTransformedSizes

      +
      public int[] getTransformedSizes()
      +                          throws java.lang.Exception
      +
      Returns an array containing the sizes of the transformed JPEG images + generated by the most recent transform operation.
      +
      Returns:
      an array containing the sizes of the transformed JPEG images + generated by the most recent transform operation
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + + +
    + -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html index 5edc6b09..8659aedc 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -1,103 +1,100 @@ - - - - -YUVImage - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    -

    - -org.libjpegturbo.turbojpeg -
    -Class YUVImage

    -
    -java.lang.Object
    -  extended by org.libjpegturbo.turbojpeg.YUVImage
    -
    -
    -
    -
    public class YUVImage
    extends java.lang.Object
    - - -

    -This class encapsulates a YUV planar image buffer and the metadata +

    +
    org.libjpegturbo.turbojpeg
    +

    Class YUVImage

    +
    +
    +
      +
    • java.lang.Object
    • +
    • +
        +
      • org.libjpegturbo.turbojpeg.YUVImage
      • +
      +
    • +
    +
    +
      +
    • +
      +
      +
      public class YUVImage
      +extends java.lang.Object
      +
      This class encapsulates a YUV planar image buffer and the metadata associated with it. The TurboJPEG API allows both the JPEG compression and decompression pipelines to be split into stages: YUV encode, compress from YUV, decompress to YUV, and YUV decode. A YUVImage instance @@ -120,464 +117,417 @@ This class encapsulates a YUV planar image buffer and the metadata luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and - each of the chrominance planes would be 20 x 35 bytes. -

      - -

      -


      - -

      + each of the chrominance planes would be 20 x 35 bytes.

      +
    • +
    +
    +
    +
      +
    • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Field Summary
      -protected  longhandle - -
      -           
      -protected  byte[]yuvBuf - -
      -           
      -protected  intyuvHeight - -
      -           
      -protected  intyuvPad - -
      -           
      -protected  intyuvSubsamp - -
      -           
      -protected  intyuvWidth - -
      -           
      -  +
        +
      • + + +

        Field Summary

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Fields 
        Modifier and TypeField and Description
        protected longhandle 
        protected byte[]yuvBuf 
        protected intyuvHeight 
        protected intyuvPad 
        protected intyuvSubsamp 
        protected intyuvWidth 
        +
      • +
      - - - - - - - - - - - - -
      -Constructor Summary
      YUVImage(byte[] yuvImage, - int width, - int pad, - int height, - int subsamp) - -
      -          Create a YUVImage instance from an existing YUV planar image - buffer.
      YUVImage(int width, - int pad, - int height, - int subsamp) - -
      -          Create a YUVImage instance with a new image buffer.
      -  +
        +
      • + + +

        Constructor Summary

        + + + + + + + + + + + +
        Constructors 
        Constructor and Description
        YUVImage(byte[] yuvImage, + int width, + int pad, + int height, + int subsamp) +
        Create a YUVImage instance from an existing YUV planar image + buffer.
        +
        YUVImage(int width, + int pad, + int height, + int subsamp) +
        Create a YUVImage instance with a new image buffer.
        +
        +
      • +
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Method Summary
      - byte[]getBuf() - -
      -          Returns the YUV image buffer
      - intgetHeight() - -
      -          Returns the height of the YUV image.
      - intgetPad() - -
      -          Returns the line padding used in the YUV image buffer.
      - intgetSize() - -
      -          Returns the size (in bytes) of the YUV image buffer
      - intgetSubsamp() - -
      -          Returns the level of chrominance subsampling used in the YUV image.
      - intgetWidth() - -
      -          Returns the width of the YUV image.
      - - - - - - - -
      Methods inherited from class java.lang.Object
      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      -  -

      - +

        +
      • + + +

        Method Summary

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Methods 
        Modifier and TypeMethod and Description
        byte[]getBuf() +
        Returns the YUV image buffer
        +
        intgetHeight() +
        Returns the height of the YUV image.
        +
        intgetPad() +
        Returns the line padding used in the YUV image buffer.
        +
        intgetSize() +
        Returns the size (in bytes) of the YUV image buffer
        +
        intgetSubsamp() +
        Returns the level of chrominance subsampling used in the YUV image.
        +
        intgetWidth() +
        Returns the width of the YUV image.
        +
        +
          +
        • + + +

          Methods inherited from class java.lang.Object

          +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        • +
        +
      • +
      +
    • +
    +
    +
    +
      +
    • - - - - - - -
      -Field Detail
      - -

      -handle

      -
      -protected long handle
      -
      -
      -
      -
      -
      - -

      -yuvBuf

      -
      -protected byte[] yuvBuf
      -
      -
      -
      -
      -
      - -

      -yuvPad

      -
      -protected int yuvPad
      -
      -
      -
      -
      -
      - -

      -yuvWidth

      -
      -protected int yuvWidth
      -
      -
      -
      -
      -
      - -

      -yuvHeight

      -
      -protected int yuvHeight
      -
      -
      -
      -
      -
      - -

      -yuvSubsamp

      -
      -protected int yuvSubsamp
      -
      -
      -
      -
      - +
        +
      • + + +

        Field Detail

        + + + +
          +
        • +

          handle

          +
          protected long handle
          +
        • +
        + + + +
          +
        • +

          yuvBuf

          +
          protected byte[] yuvBuf
          +
        • +
        + + + +
          +
        • +

          yuvPad

          +
          protected int yuvPad
          +
        • +
        + + + +
          +
        • +

          yuvWidth

          +
          protected int yuvWidth
          +
        • +
        + + + +
          +
        • +

          yuvHeight

          +
          protected int yuvHeight
          +
        • +
        + + + +
          +
        • +

          yuvSubsamp

          +
          protected int yuvSubsamp
          +
        • +
        +
      • +
      - - - - - - -
      -Constructor Detail
      - -

      -YUVImage

      -
      -public YUVImage(int width,
      -                int pad,
      -                int height,
      -                int subsamp)
      -         throws java.lang.Exception
      -
      -
      Create a YUVImage instance with a new image buffer. -

      -

      -
      Parameters:
      width - width (in pixels) of the YUV image
      pad - Each line of each plane in the YUV image buffer will be padded - to this number of bytes (must be a power of 2.)
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling to be used in the YUV - image (one of TJ.SAMP_*) -
      Throws: -
      java.lang.Exception
      -
      -
      - -

      -YUVImage

      -
      -public YUVImage(byte[] yuvImage,
      -                int width,
      -                int pad,
      -                int height,
      -                int subsamp)
      -         throws java.lang.Exception
      -
      -
      Create a YUVImage instance from an existing YUV planar image - buffer. -

      -

      -
      Parameters:
      yuvImage - image buffer that contains or will contain YUV planar - image data. See above for a description of the image - format. You can use TJ.bufSizeYUV(int, int, int, int) to determine the appropriate - size for this buffer.
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For +
        +
      • + + +

        Constructor Detail

        + + + +
          +
        • +

          YUVImage

          +
          public YUVImage(int width,
          +        int pad,
          +        int height,
          +        int subsamp)
          +         throws java.lang.Exception
          +
          Create a YUVImage instance with a new image buffer.
          +
          Parameters:
          width - width (in pixels) of the YUV image
          pad - Each line of each plane in the YUV image buffer will be padded + to this number of bytes (must be a power of 2.)
          height - height (in pixels) of the YUV image
          subsamp - the level of chrominance subsampling to be used in the YUV + image (one of TJ.SAMP_*)
          +
          Throws:
          +
          java.lang.Exception
          +
        • +
        + + + +
          +
        • +

          YUVImage

          +
          public YUVImage(byte[] yuvImage,
          +        int width,
          +        int pad,
          +        int height,
          +        int subsamp)
          +         throws java.lang.Exception
          +
          Create a YUVImage instance from an existing YUV planar image + buffer.
          +
          Parameters:
          yuvImage - image buffer that contains or will contain YUV planar + image data. See above for a description of the image + format. You can use TJ.bufSizeYUV(int, int, int, int) to determine the appropriate + size for this buffer.
          width - width (in pixels) of the YUV image
          pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the - nearest multiple of 4 bytes, then pad should be set to 4.
          height - height (in pixels) of the YUV image
          subsamp - the level of chrominance subsampling used in the YUV - image (one of TJ.SAMP_*) -
          Throws: -
          java.lang.Exception
          -
      - + nearest multiple of 4 bytes, then pad should be set to 4.
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + - - - - - - -
    -Method Detail
    - -

    -getWidth

    -
    -public int getWidth()
    -             throws java.lang.Exception
    -
    -
    Returns the width of the YUV image. -

    -

    - -
    Returns:
    the width of the YUV image -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getHeight

    -
    -public int getHeight()
    -              throws java.lang.Exception
    -
    -
    Returns the height of the YUV image. -

    -

    - -
    Returns:
    the height of the YUV image -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getPad

    -
    -public int getPad()
    -           throws java.lang.Exception
    -
    -
    Returns the line padding used in the YUV image buffer. -

    -

    - -
    Returns:
    the line padding used in the YUV image buffer -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getSubsamp

    -
    -public int getSubsamp()
    -               throws java.lang.Exception
    -
    -
    Returns the level of chrominance subsampling used in the YUV image. See - TJ.SAMP_*. -

    -

    - -
    Returns:
    the level of chrominance subsampling used in the YUV image -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getBuf

    -
    -public byte[] getBuf()
    -              throws java.lang.Exception
    -
    -
    Returns the YUV image buffer -

    -

    - -
    Returns:
    the YUV image buffer -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getSize

    -
    -public int getSize()
    -            throws java.lang.Exception
    -
    -
    Returns the size (in bytes) of the YUV image buffer -

    -

    - -
    Returns:
    the size (in bytes) of the YUV image buffer -
    Throws: -
    java.lang.Exception
    -
    -
    +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getWidth

        +
        public int getWidth()
        +             throws java.lang.Exception
        +
        Returns the width of the YUV image.
        +
        Returns:
        the width of the YUV image
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getHeight

        +
        public int getHeight()
        +              throws java.lang.Exception
        +
        Returns the height of the YUV image.
        +
        Returns:
        the height of the YUV image
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getPad

        +
        public int getPad()
        +           throws java.lang.Exception
        +
        Returns the line padding used in the YUV image buffer.
        +
        Returns:
        the line padding used in the YUV image buffer
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getSubsamp

        +
        public int getSubsamp()
        +               throws java.lang.Exception
        +
        Returns the level of chrominance subsampling used in the YUV image. See + TJ.SAMP_*.
        +
        Returns:
        the level of chrominance subsampling used in the YUV image
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getBuf

        +
        public byte[] getBuf()
        +              throws java.lang.Exception
        +
        Returns the YUV image buffer
        +
        Returns:
        the YUV image buffer
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      + + + +
        +
      • +

        getSize

        +
        public int getSize()
        +            throws java.lang.Exception
        +
        Returns the size (in bytes) of the YUV image buffer
        +
        Returns:
        the size (in bytes) of the YUV image buffer
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      +
    • +
    + + +
    +
    -
    - - - - - - - - - - - - - - - - - - -
    - -
    - + + +
    + + +
    + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-frame.html b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html index 215bdeac..7cb8fa0b 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/package-frame.html +++ b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html @@ -1,53 +1,27 @@ - - - - -org.libjpegturbo.turbojpeg - - - - - - - - - - -org.libjpegturbo.turbojpeg - - - - -
    -Interfaces  - -
    -TJCustomFilter
    - - - - - - -
    -Classes  - -
    -TJ -
    -TJCompressor -
    -TJDecompressor -
    -TJScalingFactor -
    -TJTransform -
    -TJTransformer -
    -YUVImage
    - - - - + + + +org.libjpegturbo.turbojpeg + + + +

    org.libjpegturbo.turbojpeg

    + + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html index 12c047b1..c5e2f7d8 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html +++ b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html @@ -1,190 +1,183 @@ - - - - -org.libjpegturbo.turbojpeg - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -

    -Package org.libjpegturbo.turbojpeg -

    - - - - - - - - - -
    -Interface Summary
    TJCustomFilterCustom filter callback interface
    -  - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Class Summary
    TJTurboJPEG utility class (cannot be instantiated)
    TJCompressorTurboJPEG compressor
    TJDecompressorTurboJPEG decompressor
    TJScalingFactorFractional scaling factor
    TJTransformLossless transform parameters
    TJTransformerTurboJPEG lossless transformer
    YUVImageThis class encapsulates a YUV planar image buffer and the metadata - associated with it.
    -  - -

    -

    -
    -
    - - +
    +

    Package org.libjpegturbo.turbojpeg

    +
    +
    +
      +
    • + + + + + + + + + + + + +
      Interface Summary 
      InterfaceDescription
      TJCustomFilter +
      Custom filter callback interface
      +
      +
    • +
    • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Class Summary 
      ClassDescription
      TJ +
      TurboJPEG utility class (cannot be instantiated)
      +
      TJCompressor +
      TurboJPEG compressor
      +
      TJDecompressor +
      TurboJPEG decompressor
      +
      TJScalingFactor +
      Fractional scaling factor
      +
      TJTransform +
      Lossless transform parameters
      +
      TJTransformer +
      TurboJPEG lossless transformer
      +
      YUVImage +
      This class encapsulates a YUV planar image buffer and the metadata + associated with it.
      +
      +
    • +
    +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-tree.html b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html index 59102783..1033ee56 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/package-tree.html +++ b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html @@ -1,159 +1,143 @@ - - - - -org.libjpegturbo.turbojpeg Class Hierarchy - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -Hierarchy For Package org.libjpegturbo.turbojpeg -

    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape) -
          -
        • java.awt.geom.Rectangle2D
            -
          • java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape) - -
          -
        -
      • org.libjpegturbo.turbojpeg.TJ
      • org.libjpegturbo.turbojpeg.TJCompressor
      • org.libjpegturbo.turbojpeg.TJDecompressor -
      • org.libjpegturbo.turbojpeg.TJScalingFactor
      • org.libjpegturbo.turbojpeg.YUVImage
      -
    -

    -Interface Hierarchy -

    - -
    - - +
    +

    Hierarchy For Package org.libjpegturbo.turbojpeg

    +
    +
    +

    Class Hierarchy

    +
      +
    • java.lang.Object +
        +
      • java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape) +
          +
        • java.awt.geom.Rectangle2D +
            +
          • java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape) + +
          • +
          +
        • +
        +
      • +
      • org.libjpegturbo.turbojpeg.TJ
      • +
      • org.libjpegturbo.turbojpeg.TJCompressor
      • +
      • org.libjpegturbo.turbojpeg.TJDecompressor + +
      • +
      • org.libjpegturbo.turbojpeg.TJScalingFactor
      • +
      • org.libjpegturbo.turbojpeg.YUVImage
      • +
      +
    • +
    +

    Interface Hierarchy

    + +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index 563b5796..eae18a13 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -1,161 +1,147 @@ - - - - -Class Hierarchy - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -Hierarchy For All Packages

    -
    -
    -
    Package Hierarchies:
    org.libjpegturbo.turbojpeg
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape) -
          -
        • java.awt.geom.Rectangle2D
            -
          • java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape) - -
          -
        -
      • org.libjpegturbo.turbojpeg.TJ
      • org.libjpegturbo.turbojpeg.TJCompressor
      • org.libjpegturbo.turbojpeg.TJDecompressor -
      • org.libjpegturbo.turbojpeg.TJScalingFactor
      • org.libjpegturbo.turbojpeg.YUVImage
      -
    -

    -Interface Hierarchy -

    - -
    - - +
    +

    Hierarchy For All Packages

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    +
      +
    • java.lang.Object +
        +
      • java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape) +
          +
        • java.awt.geom.Rectangle2D +
            +
          • java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape) + +
          • +
          +
        • +
        +
      • +
      • org.libjpegturbo.turbojpeg.TJ
      • +
      • org.libjpegturbo.turbojpeg.TJCompressor
      • +
      • org.libjpegturbo.turbojpeg.TJDecompressor + +
      • +
      • org.libjpegturbo.turbojpeg.TJScalingFactor
      • +
      • org.libjpegturbo.turbojpeg.YUVImage
      • +
      +
    • +
    +

    Interface Hierarchy

    + +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/resources/background.gif b/java/doc/resources/background.gif new file mode 100644 index 0000000000000000000000000000000000000000..f471940fde2f39ef8943a6af9569bcf986b1579b GIT binary patch literal 2313 zcmV+k3HJ6!Nk%w1VKM-40OkMy00030|NlK(aXwsfKV5S}VtGJbbVOr%L0@%CZH88Q zl{{NzcR^uxNo<2iYk@pjY)*5FJz8x~bc{)B zfk z+1T6M-s9WdW8dcJ-wO*3@9+W*5AY543-j^$^!EPz_4eHZ2#>)41`h@dc!2OAgN6$a zCS2I?;lqgx6IR4nkpTe;1RN0f=zxMq2O=q`94V5d$&e>Unta)^<;;^G3>e7yp=ZvW z6DIW3xpSvaogXF?_4%`@(V;s}NR^5J!3hrtJV@1QRV&r5S*L!zYE|rss${iFkg&!? zTN5V#)~=bmMorwgZsEpdOE)iExo+FO-8;8Kga{=HbSQCnF=E6W3?o*|ID%uwi5**> zJXy127Y9m+=HQ|PhXWi+xNwoWv}n_%Pq%(e+H~mGqhq5kv4Mo|-n~g|7!F*xZ{xv< zCpXS~dGg^IGK?4@J-T%b(XnUHFul6n<@2&4)zzyO2) z3Q8`i0+UKY*`$}e9mmp;tg*))`|PsK1|hAo%u0K$vDwm4gaSkm0j{`26k#qAKmbuhxZ#cquDR>B zD{s8+&TH-uNg$C#68QG}1HMBHfrP&L@@w$F_!itRzXdCN@V|LDAu%3!IDtq1#1UV7 z#1RxvT=B(DWbCoU5l=ia$Pp`Hgb_?Mp@hmtxZDI2N-)v#$}PXVvdm1d>@v(v`0TUJ zF)Pu89(q`zv=w^nVTIF3@3BYIPA}c`(@ZCAwbNBEt@PDUKe5CTR8aB66IE1!w%Amt zy+jpcn~k>GZpVFg+H6x{_uOksvBlq0OyT$6TyQZ37k(cOxZr|JEx1sGm<(M9gH z-~PMqyn|tT=))UN`|-FFFUA#KToK0fUOaz=7}Z~KeHhVC&%O27cTfHQ^WBU8z4p&T zp#>D|V}XShTD;Hx745Iz{`>K-Z$A|7!*Boo{mY;G21vjH8t{M!OrQc6$iN0V@PQDF zpadsK!3tXNf*8!81~qnXWuHZ)kytd=_y+ADWvw31ouV;CdZ#ya*(l7-A-C-Y^+iit8O zBy3*`Ls$|5Hn4m_^I^|C7{m7EFn|5vTk;|oywIgCc9Bb*=L+Y$)M>9GC<|HGs@6NB zHLY%03!dDf=eDRt2O6lVSFRcsuWZEwU?=z$CZ0W?#VJfdN>HG(l%oKpyiftJc|Y)xkjSJYCrQal-0PC~()T9xwF!Jf zVi1UA#3BBbh(i8r5&v#Pz!cF41KjbCc?4u2@@Q~oKLirt2TM30;y6b+zyX2`Yl9u; z`0$3;v0-YUp&7IIT!9-C*e{wE9>Kx3D)-;0v)C; KYxQGgum%9JOA&7X diff --git a/java/doc/resources/tab.gif b/java/doc/resources/tab.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a73a83be11dde2d0003b716ca778fafc6f34ad7 GIT binary patch literal 291 zcmZ?wbhEHbWM+_KxXJ(m|NsBLKh^ZZLaX-+EFVob+gGEtw?=DMmFBi`jWca}`|GrK zS84620CF`ibs3!R&_C0rf3ijIM6=$}M%|-Lx`!Hcc2;Oz>NdPT#q`cZlbij$jvbRk6R>8g*>}*b9E+WDwmpHAAxYzyT aU_pX{M6b8i>#Dq3onfZy}_nli%!Q$ZV%e&!tN2 zX3B0NWXQ443Eo1rUP86rLU>O>oTp%wt3Z{Tz&P*)Iraq^_@X;RtUFY!JxH|4U!>kw zxXwqo&R3Y=EsXaR!ng@y+y$%L1P3FZ4@N!j3m5MW74HcC->_JFuvlxLXiI=-OQ2|@ zpGc#>2-aN)<1RE9^`bB0`65VSK2>5m>CHs^YZCC)NX*NfbeT1%)Cxpu2_(6cCbLvjLY`hf1%*q}QO*%V4SfOu5Nqg~`-+(-76= za<`RA&(qDB^S!nIS^od5|Nk$KPXD8(qSB!f`M*{E?A^&yOW$08V^iNPK!%UNJ-@xmz>`pG2_%4I3QWk4UdtwP!GH$C%mo2K|$Ap=_)Y!#O($1@ohsUtR1k%wI*) z4*X&g==oWh`j{uP=HFm;Ye>0>UbDdtSp^~MaQ!L9I#)Ga?q}{@T#|qec*FkMLDenm zj^sCgk!^O^3o|vG!~2$$$7`C#4Ry zdQ!tui+J1*HyavK+4{`r+zvYHj9IsRt~@uEBOreWS8~2rXAR3!|7aTdr+x4|>@$Az z)b1t$gSB~6USxpfLmy^|_J_eNt*PI=ScO1SVH895N#`ef%IOh&o-2GIjK1s-JzkyZ z@r7O%hChz}kMHCM@Wqi^R-9t&%Fh^#9dVB0%ej@$=OjXA%XZdzCXf}c>SW26_z-Te z5b{}XWg&rELM=N*%aimp)k04t2c+`WAS>ZFIPWKvtyOI))HzpRA!T!b{tv?4NzF1v zNlP%#{&p@lFFEKvcroMAsI)mq?&`!e%l+-y&j9ZqhN}oG&dB=Pw09r+Q%m0cMujS# zs$a7!9VH`CC7k{!bV(J`rm%Jpj6&nLtWhPcy$onn$8G#ZdD9hxO<9k67Ya>K_7W~3 z&KYf14fq<{qHA7u6;>AOcomhdg?ianjr9uINt}*7w?g%z9{Q`(qRo@hDwSpGmxz&h&>%G%T(URL~=c>C{>y$K?+wLFp zy*M1@FTUKYV>8DeDIAIKM+!T5c-k&C4?Y~y^E zQCIc-=9~DiPtfVZB=_c3`qH3h|NXd^BcOQG`funSe)i5!NoA_r{b6PwzSDIXG+!(F z9CqJgo&~#7^VZHWj{u23q+NDCHn}GeWDC*(SW%{f4WMtP3l2jsO7*M)EX)#NLlsNnU4q@#jn0r#rsWsf^ngE0&ambG1f;Rj zfOk#_>1|25Z%?iI{0Yv8)DQfk>m1td?~}m0N%^k^u%EuUCc#ItmlY|epQ3YLWehYw zRU0qpPb#X&WU*UOU8et(s8x~WyYWYsgJCF+;U6@*nICY8)dk}IG+(#_Bz8zURd3HZ6qPE68U1%S{wL0 z;K{PDw2iRFIGG?(UiE9kT9?siuv4O{ z`dX2-eiXU3N)H2nT4V=AO^~J}sw+gr{&~qx%$$wlMv_JCWAMfcjYl}*Cfcf!adOY8 z8oLmJ{%49e+nLiVo#H9}wRk?UCzDz^>9TDxreVHzl~R*)?YU>Uu;J2eQ27O5`&X^8 z`94{)YWJQa#l0Fbz0N6B>j&8J;<%VuG6OYM9&QIdtueWjI3X;*dEtGiF@1AcvN4U> zG5SXIEXxB>)!mtQOztJLyeF78S*kLiU-!>PtQ_s~OMl~&y(hVVe$A5 zwo}E-DJ6${QP75?LsQ}Wl@MXwXMT4d>|?rD!g?jE>J^N*y;X}5FLe%d0_ zZ>eIBK6l@jkfw{p_YiDP;MS{jww{%j#?rk2z1J!HqE;Vd!TrCl_7UPef8;edI}wD6 zT&12Bxj&q}d4%$GHq+$~UYtWv`wI9k`89oKkCEK_E;-+O)(rhThjOM|kXDn{!W1Lo z`_?yQv=lp=-w()R<=0&c5%RWHY_fw@qb}uwFuPAGkl~@Kis}eE%MY@~6ZyWcF+llM zGyK`)(vn1F%%z=W7-Y=1$`w0Mv+-|#d};%JjCmw)Y1hOxwA|{}P%6LS4X`jQCGh`mR@=hGrr|cXa^Ipj;Mh)6mTqd1s_HmP0IxXT!w7YhoIHT>Hm#!;c@|L9OjV zsTlHE{Z;HWeM9^tPm-`|&nnl$%DRtNG1~?npUvgKPwKlaccEe4q!7YU3zykJnu6Sr z()LMXs_)^~u-ds7+wMff)RAJF?2?1H`_wDnt%MssYeB5;q~ojgVm6OHA6B>FG2erv z8&`|6<`=!EPKR^8Qlp5MiKwfxy4D`mN> ze$RKh_6*YJd4y0nnUZvwN%iY&^9xk@cM|5g#pZkc#N*(PH?^w&?ilTDMXFcd0`5!E zvgHS`=Lc|~1aO=L@L~eE*aP{90lc7qXY7GOs)3JH14T{(`K1D%tpvUT1-?F^1d4_S zJ#7yXkP3Q37bJlRQfv=mV-J3B8O*m5B%L3uW)S>|Jwy`|s6iK`sv0Z-3NcU(0knrG z5ChFXA@A9PUSdLI+(VU!!J1Mbw!~0VP^jZci2X|Nx0BF!24ObrAr>b=QtlyN4TAhn z!mQncJm~^m4MIafVLt_ewDUtO+e5w*!`(6A&H^F7i9s4t5&uBpNvh$nlTZjqTM5krNRRQ zqP)VR!|9@H>7qN_!+-)&_9s!^;gOvy5s~iEB&qP8{77&2NJMzZcsnJgSt_bYDzYU% zxQ#uuk3D*e7_*d5^?HW(^(WxICGf-mcmM((VStzIz%zFsm0;ZI3h=5OciJ#a%7I(IeGbFv+PP^?^sKBPrRBl<+qK^o%3fi=L9`la>-l4~p|hzAl~W zf=%(|NHgF7r5dJD+Cf08q-c(m;Epsldaz4cqHzTHT>)4xEe(cE0i~tf{Y0xs_1~Kv z+BYQ-TpEOch13;5YC9nHYEXhSv{ew=LV~nQL%UBQEgaDL2m?9u~v zEQmOvM=aB)Z$+eE38rs%AZR_)4>@2raqwH#Fji#xoLc&PS_TU^W8W(M0GqLdO~1yF z{sfHZ_sC#FX58(}d>RSkKZCz8%D7{cC3Z$Zh@52{31&V*W-@s~Z<8~aBeNcNW?e&O zsR(7fHOf}B&fsRqdZ(WK1e~s*o^uD6{YX9QJvqyWAqQXt*E>r$V94YK=X@8+{1cg> z*_i`a%alCJvbD~lCg&Q1Gk=|BzY)sejf9EHJ{s7lu4?ExCWR3jgTiET;exy{sW!Mg zuj*_YOf0@ScN~X0$7V6&KpL172rf|rA8?K<2+GelXw)NUk#@b4aT5MO%1ip4*ym}B-JI__S1R?CK z<4eW~bH;@H@tR55x}&JNSw_NvEPk)6E>XDt7*)4sgWuw+_vNZzmaS(tsi(57zcjA9 z@~XcHtzYq~IX|z*Md9mh>W~`sk3<^s7;EmyH4wcTdAo5NkUA2ofeG69{Gx7#i_*lt zQ7;N@xEo#nNRj&SbDHNnP0w#OE0{DZ$~7ySG%IN~zwd5Vu4&dnH>*OMb>&*VL^tbA zG;7y1t9dsYU$p3pw0x6mwGe6fjBYWsZ8e3q8f~-~cefgHxBangajI$kv(c*W-DZGp zbM$UgnP{_MYPXYX|6$u^deIhE(-xuGX2RVXqS+o~(iSV%;ZW1=Zqkut(r&xak^pT> zsp*I@X|-eOd^gb+sM(%3(E$|c47Y91mTU99Xe;4vFOTl5gmwVB+fvc3n2pwK?~Xd# zwrY{?CUj@~Msr?wXU0WKv2A$hq z`$V^gNq4(<*C=;4e4}$*uIC$5&uUHkM08J~N$>VV*VpdmLCuc!?!J9=-)VH;fo9)| zNN4m#^Kb9|`RF!^ZAT-z=bC8$do8~Tjc^o-aQjyc2(TW*d50E1#NW0pKb^~tf&OUlS+W}>0!m@!~1 z&TdSLhm`0u99c-z=oxYL8IFaGCDoFwFUP!1iJ%xF1UC4hhv*VR2451Pc0+kQGC)39C5 za81oV=$+xzZNYhn=RB-CTZ>Bevj)A3mi9|OS(dcy=N#Zm=Dza|z4Jd<=3IQ2CB>FiwH7{4Ej#+oa>M67 z!56)Km&2xJ|H7B;%~rJDuJ{rbZQiaX*e^$DEt~T$#h9(y#jg6>uX?boq!N}Q;EQth zYo1rjc15dETPw~*Ymu=lreoE9g^wb)ZcRe1yp1(Eo(rmqUYZXOU$BC_| zX{{&qE?E06wXm#v#cpKwE)jaydSaI`TkCCClr_lKMzPkyFT!R%VRn&sZSrchKx&4e~pJQcfViQxxl=T=7}#gYz7Pvoh`T#Jbab%2A2m zxh?A<`}A?8_GumBEcL;$x%gQb@PZ(If%ZE~D?ax#Km4a~+GV~!;Bb~qxxh@HHc|H6 zr%$^c9Dw~UQFWJv+81rCXS1vqqLfQ~-BtO63xCArGVA4T-}xPXYGHqB5h^+n5%$24 z(BROpi13J@*qFfR$oRMHel`=(zy zovs-UKHD3VkJ?hVeq!aA+8Fh4+NIlFhcC~UrR{4I#}K*u&z%68+P1*=q0B1r*2MY> z!9gYs*vlTO5v#8S>c#3goFmp>3iVKdU)NkjNV(s7tO4Wq?2M}o5Cj-*7;S=fEshOA zR*4$dm{ROvUamG%xL_tSW6}U$Nl=@91T;nC11o-iIVyVrfkd) zTCp;^tOy|_kuOFV$Nn=$AQJO9;&sZ&eDs^!r*m;Hw!)vpO1vcfj2EV{dJ?7ap0tq6 z$SwUVM*Vt+MS_`;bas-svPV|3POQi8G~?f^KOx4hg1He+Wd*s3Hl1{TfJS-+zv6vc zPoKiwr?7wECbub(IdB)9f_!kmUjBR*KY_z4E8_QA9xSr#G&@i5y^H`jB^I{|akh>W z%Cn3luOVY|8P>u>e^~#{$kmgX&-q>k{#pFbm2({(rtG<%nb0UCQ0%{Cy`F&~7}*we z@Of>ND_)V&XwN_+n~KjVorUQWZ*B6cld7ymQl{;rwlHl34K#}2YWxE+4CX@P&u6AfCda`&ZT1MOY69e-L@gNcAvwx8%1Z7lB4zc=_Cpt~&s ze%?;){1DB(PSK!^za967qF?lIjB~&06}Lf`cgh2qUiI^|$-VCTNE=hp&Ij}^A9&|* zQQrSqo3gn#_=z9j(y6f@T|OkJYv(fjwpz}$*U$|nLH2F zPNMuTS4g8 z*^hOlRh6~Mk}58;d477R>F^~aLO$dOXmhA*6zwIaHK()t2zKjo?j^NOJbh_=+71xg zO{Mgp7x?Z-1MKzoQ<+V2g#|e}|JawOPJZBL{o~PYdtWDX?jl##!Aiq|w>)vGJLipp zBK1xGhcvgSsQ;rn>+`>UmxlID{<~}7{y>SO^cyktN^Fsz!Z|B4?p*RKQG*8}SYBt{ zuFO{vJ?jgL{gUzYsnv(io}c0vlCp#*1vE?}KL^UZ&VF^TK+D;40CxX%j);%dCt;Z{ zAeMXC9JPWvKGwsCxx4w2iv_wNGG8l16AVI93rmc^c1>r(P||YE zpXa+=-&k995hfykL^J5S&vJF^ljR&`FE#ppNMM3%Omc!F)Mn{{&Ip#)JegbEJxud2 zn`wDVB~DMii5|H%m~51YeU1juNG3!+&?*uC#q@)z8q~`4yEL5I8}PtyA1IZ=52P$x zX)KhZt z7czUXBsy-8d`GVQ`90`wIh(Xt7v5j7h0t&ET~2M!Tb~4rN-xtK@8@mB*c(6QTwOS- z%9445_WY|cfm4?$nX$72&{~^mu}an^x^Da%=UU6YI;ur3+9L6I>raW5!=-Nzy(F2Z zwZlg7aM3NN5b{K|FB>s4R}|&Lr32_Ys{wwkECxo|rV@;5aHB25iUs7(6@dDpjN{Y%?C~UGp>*Q}K?)KKk64 zAn;@-dER}QG0L${jQ1cR75eM3-~ZTltTQ8%sm9x4Y`ve@ekMuvpA#Rh51@s6;6^&Q z!&M7^b%cea7FlZkPV9}@!bPBBfB&~XvGlE2T7V?IpM~OBmuK;OSt{~N`rL5c_I^de z9n*=@p|l;d`b_YIn8Aem1t7pp0=2-MCTIcJHlY z6x+mNLgi{JpwP)y(yzAFL2A#>bI&EwZE`PGvd*FQ!rx~6bUN&+Ij3)L;=595L#G;m8*^e?ap1`J5w7-q)*iUT_W9w8 z&xS-`i++HpWzY-a-)CWd0(pLW$A85P{Dy9r-=uPekNpN^yA}pJ7yWTZ>3iw4d6+IK zF%1XXkGcJm{0*vhSG5R1ySW;jctk9O==1-Mk?=Bl<{HE1p_@tx1s^+GoczYxj#B=i=kwQvEPrOt`<4W*pJw zbNjEqpr7B|Llc%m{V*QssV)im;pb00LUob=yFaU4`P_}ywU zt*QZl-bUsmh@L&zQaX4uHL&7YD(BOb9hH;;y;O-b-_O$4EFi1vCrMlz`dN|u?}HNO^aFQV{UZg_yy%nf>IXpulip!cR8|vNu7P*; zQye@}Qmj%(TB6`5E=c~w=LITF266XJ6X5xA7!OM1SE=~N*o3EP5Qqx!W<_+EMSLGo zqkC18AQ=0AK9=hgGQtrTovYc5^?Z^RLX?hlO-j&e1MXTTbfm>MS^=}!p>C>icUKdZ zBcNOb(6IJ!kq*e7N8Fx!!kPyn+2B2^2hd00+W^PUA&+S63jFE)bP5Tv+L5l~n(pu? zbeO|+K{{?pEow3?j0+dGVu)a6(0r{1Uj7{3 zxSsZ|BdMk>1-S}-;+`pk{Q5>H=tLRx+YqeenaSRsEX@gtPzz>j1A9g!C9kGtspY(- z%YL>NkVDE2z@}*;Q{=&5)yS;NupAmmibGUE4qte7aY6PcnXJgw>}ad(SW;@HtNurF ziV0_yHz=;Di%Tki6DW^tjkL`t%Ktct(ay zvuAOYoCu!Pm~@P5CIjk$bp`_iv{^l*Au{fB8mJK1>Macv?GL)**8*+JNvySIH5Y7i#1;!%NT!efc z;Z0*AOM&1VpR+6wIQxBM{xf`8T1V@#e<#QL}=YRwMkWG8%1(Fgj{iX)N zup{Txko(DqJWf=#Oi?Z!nra-?C{);TP`w|4>L+EKx1&P3swX<*#_50F!lD_$nQyuK??!UwA-{y)^QmMxoK1xIJ~uML{u;5!Z5tQyEL>;KaUd!_9FP zl2$QOI6V1`QdF|8gkdZsSpUqCjSBu(1H)r*vL#PEy)@Px>5TIk7_9o#Bj zzD&<1_k(ejk%qO6ak=GMmG5b7LTAA^KKq-Ey#z8(2wy2;Ot^oZI(MG@)~iY$RAnJt zu`ioyvR?Vws_tuK9hDqmel+)bP0kyxJV{7t=&3{b(@Hs1fs$9n45aq)IKknZa2H*7 z^P-ZDyOMdMj&-9{(-?dqo5I3Gy=K$!L%q>3^0N~o^2i0^_@^2nQv>S4B&=5_8^a^V zaY!NjyA5QgO&r#^CJcp&=!))MZ*CC&hvLEzWU*!IO=aYo{_yG+53H$XOAIQWnG`uD zLuuwTY6e8N^m5^AHQa}Y5Z#SdbEY;+x{oW?g;ie4CNYomRyQd2mv^L}T!>a5<*wTh>@>Qtwp~nejn`~DcZJI+QC-xU zoxz=5z0k%1;jBrGI%Th~FQElrAPr?E-Fv9|o09dPk=?>f)jFKL8PK|;w(cVDq>YWP zEfL7RGBv|<>f4IccND3wCi*V8`>#a$FPZu&a{V`W`me+Kuf_CJ)%IV%?5ByL^#3Q{ z&uBM5|34IKI>0_Tz{5OngXe#6w*N6;;5PH%9n%56%RaWA{wJ4%515Apdj`a62bp<> zM12OuV+QZ^55ATkViO(UWgg}%9C}kb^r~=BiDyWIXZWM&kb>Q?dd$#W`4KU|2#4qh zz;sZ>ZqS5h#Kdk$&1c9AHmDUdtmHE)CqH0RIAZEE;t(^+RXF+*FlJyk;?6Vn{&MsO zZ0HwY)b4Va!F1#s^N5$-s9(&mPa*Lu4>4SxXm~l|3?PR2jB1J!Q|(4#0i$lFME^-r zA~Q(2O+PHOdcVN((R8zqi>%+yx4PA5u&+jI zZ?)Fm8m-+`n!Bnrx0PvZE7!Q)Z+NTE@K(R!nO40sZF(n~bq_b_9H`UYU#q>pPJ3UC z_UeU>J7qcy%%`ks9)BNcS^GDOn z?oKkjHNoWO1e2?M#vd12e^_AscAnLnc~-CISiYWX`D%{k^H~<37unpMYJYdSv=Om2vbAM@`Qp{{SI=yP zj6WN*eEt0G$9EPX6FU%)-ho>hWTW!yzXBIo73<0umM-=@eG&niY^` zlG(|vuCl_x(X^Fob@=i{8+M5vWf7Bz=#aHGTNA;fZQyfbfueI8Z^639n`(DI%w^-^ zl`=@!u)r~Xf920-xd$Ab+S&PJY%K0H8a_J8uN3^_!K1_NV$*e#*Y*6|)XpiW=9H`*`Xx7W%v@7{XDma1?v0a%(K6rI&1!a YpWXKgmku8Vj|K)Vje`mzEKCg608Q#dYybcN literal 0 HcmV?d00001 diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html index 8ba0661b..bbe18053 100644 --- a/java/doc/serialized-form.html +++ b/java/doc/serialized-form.html @@ -1,200 +1,150 @@ - - - - -Serialized Form - - - - - - - - - - - -
    - - +//--> + + - - - - - - - - - - - - -
    - -
    - + + + + + - -
    -
    -

    -Serialized Form

    -
    -
    - - - - - -
    -Package org.libjpegturbo.turbojpeg
    - -

    - - - - - -
    -Class org.libjpegturbo.turbojpeg.TJTransform extends java.awt.Rectangle implements Serializable
    - -

    -serialVersionUID: -127367705761430371L - -

    - - - - - -
    -Serialized Fields
    - -

    -op

    -
    -int op
    -
    -
    Transform operation (one of OP_*) -

    -

    -
    -
    -
    -

    -options

    -
    -int options
    -
    -
    Transform options (bitwise OR of one or more of OPT_*) -

    -

    -
    -
    -
    -

    -cf

    -
    -TJCustomFilter cf
    -
    -
    Custom filter instance -

    -

    -
    -
    - -

    -


    - - +
    +

    Serialized Form

    +
    +
    +
      +
    • +

      Package org.libjpegturbo.turbojpeg

      +
        +
      • + + +

        Class org.libjpegturbo.turbojpeg.TJTransform extends java.awt.Rectangle implements Serializable

        +
        +
        serialVersionUID:
        +
        -127367705761430371L
        +
        +
          +
        • + + +

          Serialized Fields

          +
            +
          • +

            op

            +
            int op
            +
            Transform operation (one of OP_*)
            +
          • +
          • +

            options

            +
            int options
            +
            Transform options (bitwise OR of one or more of OPT_*)
            +
          • +
          • +

            cf

            +
            TJCustomFilter cf
            +
            Custom filter instance
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    +
    - - - - - - - - - - - - -
    - -
    - + + + + + - -
    - - - + + diff --git a/java/doc/stylesheet.css b/java/doc/stylesheet.css index 6ea9e516..0aeaa97f 100644 --- a/java/doc/stylesheet.css +++ b/java/doc/stylesheet.css @@ -1,29 +1,474 @@ /* Javadoc style sheet */ - -/* Define colors, fonts and other style attributes here to override the defaults */ - -/* Page background color */ -body { background-color: #FFFFFF; color:#000000 } - -/* Headings */ -h1 { font-size: 145% } - -/* Table colors */ -.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ -.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ - -/* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } -.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } -.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } - -/* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ -.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} - -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} - +/* +Overall document style +*/ +body { + background-color:#ffffff; + color:#353833; + font-family:Arial, Helvetica, sans-serif; + font-size:76%; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4c6b87; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4c6b87; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-size:1.3em; +} +h1 { + font-size:1.8em; +} +h2 { + font-size:1.5em; +} +h3 { + font-size:1.4em; +} +h4 { + font-size:1.3em; +} +h5 { + font-size:1.2em; +} +h6 { + font-size:1.1em; +} +ul { + list-style-type:disc; +} +code, tt { + font-size:1.2em; +} +dt code { + font-size:1.2em; +} +table tr td dt code { + font-size:1.2em; + vertical-align:top; +} +sup { + font-size:.6em; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:.8em; + z-index:200; + margin-top:-7px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + background-image:url(resources/titlebar.gif); + background-position:left top; + background-repeat:no-repeat; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-image:url(resources/background.gif); + background-repeat:repeat-x; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:1em; + margin:0; +} +.topNav { + background-image:url(resources/background.gif); + background-repeat:repeat-x; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; +} +.bottomNav { + margin-top:10px; + background-image:url(resources/background.gif); + background-repeat:repeat-x; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; +} +.subNav { + background-color:#dee3e9; + border-bottom:1px solid #9eadc0; + float:left; + width:100%; + overflow:hidden; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding:3px 6px; +} +ul.subNavList li{ + list-style:none; + float:left; + font-size:90%; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; +} +.navBarCell1Rev { + background-image:url(resources/tab.gif); + background-color:#a88834; + color:#FFFFFF; + margin: auto 5px; + border:1px solid #c9aa44; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader h1 { + font-size:1.3em; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 25px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:1.2em; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border-top:1px solid #9eadc0; + border-bottom:1px solid #9eadc0; + margin:0 0 6px -8px; + padding:2px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border-top:1px solid #9eadc0; + border-bottom:1px solid #9eadc0; + margin:0 0 6px -8px; + padding:2px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:1.0em; +} +.indexContainer h2 { + font-size:1.1em; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:1.1em; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:10px 0 10px 20px; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:25px; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #9eadc0; + background-color:#f9f9f9; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:1px solid #9eadc0; + border-top:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; + border-bottom:1px solid #9eadc0; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.contentContainer table, .classUseContainer table, .constantValuesContainer table { + border-bottom:1px solid #9eadc0; + width:100%; +} +.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { + width:100%; +} +.contentContainer .description table, .contentContainer .details table { + border-bottom:none; +} +.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ + vertical-align:top; + padding-right:20px; +} +.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, +.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, +.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, +.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { + padding-right:3px; +} +.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#FFFFFF; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + margin:0px; +} +caption a:link, caption a:hover, caption a:active, caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { + white-space:nowrap; + padding-top:8px; + padding-left:8px; + display:block; + float:left; + background-image:url(resources/titlebar.gif); + height:18px; +} +.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { + width:10px; + background-image:url(resources/titlebar_end.gif); + background-repeat:no-repeat; + background-position:top right; + position:relative; + float:left; +} +ul.blockList ul.blockList li.blockList table { + margin:0 0 12px 0px; + width:100%; +} +.tableSubHeadingColor { + background-color: #EEEEFF; +} +.altColor { + background-color:#eeeeef; +} +.rowColor { + background-color:#ffffff; +} +.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { + text-align:left; + padding:3px 3px 3px 7px; +} +th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { + background:#dee3e9; + border-top:1px solid #9eadc0; + border-bottom:1px solid #9eadc0; + text-align:left; + padding:3px 3px 3px 7px; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +td.colFirst, th.colFirst { + border-left:1px solid #9eadc0; + white-space:nowrap; +} +td.colLast, th.colLast { + border-right:1px solid #9eadc0; +} +td.colOne, th.colOne { + border-right:1px solid #9eadc0; + border-left:1px solid #9eadc0; +} +table.overviewSummary { + padding:0px; + margin-left:0px; +} +table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, +table.overviewSummary td.colOne, table.overviewSummary th.colOne { + width:25%; + vertical-align:middle; +} +table.packageSummary td.colFirst, table.overviewSummary th.colFirst { + width:25%; + vertical-align:middle; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:.9em; +} +.block { + display:block; + margin:3px 0 0 0; +} +.strong { + font-weight:bold; +} From b7d92501850e9274c3eb871b6df1c0e9aba245ac Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 17 Mar 2014 10:13:17 +0000 Subject: [PATCH 864/985] Move the garbage collection of the JPEG tiles into the decompression function to increase the chances that tiled decompression of large images will succeed without an OutOfMemoryError. --- java/TJBench.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java/TJBench.java b/java/TJBench.java index 7df0ce2d..e0ca1487 100644 --- a/java/TJBench.java +++ b/java/TJBench.java @@ -189,6 +189,9 @@ class TJBench { } tjd = null; + for (i = 0; i < jpegBuf.length; i++) + jpegBuf[i] = null; + jpegBuf = null; jpegSize = null; System.gc(); if (quiet != 0) @@ -430,11 +433,6 @@ class TJBench { decompTest(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual, fileName, tilew, tileh); - for (i = 0; i < ntilesw * ntilesh; i++) - jpegBuf[i] = null; - jpegBuf = null; jpegSize = null; - System.gc(); - if (tilew == w && tileh == h) break; } } From 5bfddde8fd915133e35b1052a1f5a16c62bc1ad4 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 17 Mar 2014 10:19:42 +0000 Subject: [PATCH 865/985] Fix an error that occurred when trying to use the lossless transform feature without specifying -quiet; formatting tweak --- java/TJBench.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/TJBench.java b/java/TJBench.java index e0ca1487..866a58f2 100644 --- a/java/TJBench.java +++ b/java/TJBench.java @@ -476,10 +476,10 @@ class TJBench { System.out.println("Format\tOrder\tCS\tSubsamp\tWidth Height\tPerf \tRatio\tPerf\n"); } else if (quiet == 0) { if (yuv == YUVDECODE) - System.out.format(">>>>> JPEG %s --> YUV <<<<<", + System.out.format(">>>>> JPEG %s --> YUV <<<<<\n", formatName(subsamp, cs)); else - System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<", + System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n", formatName(subsamp, cs), pixFormatStr[pf], (flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down"); } @@ -571,7 +571,7 @@ class TJBench { } else if (quiet == 0) { System.out.format("X--> Frame rate: %f fps\n", 1.0 / elapsed); - System.out.format(" Output image size: %lu bytes\n", + System.out.format(" Output image size: %d bytes\n", totalJpegSize); System.out.format(" Compression ratio: %f:1\n", (double)(w * h * ps) / (double)totalJpegSize); From 5e755737090459cf0a9cb83a20a42ff09a75460c Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 17 Mar 2014 10:40:10 +0000 Subject: [PATCH 866/985] formatting tweaks --- tjbench.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tjbench.c b/tjbench.c index 3c8f3463..b09cdaaf 100644 --- a/tjbench.c +++ b/tjbench.c @@ -706,12 +706,12 @@ void usage(char *progname) printf(" [options]\n\n"); printf("Options:\n\n"); printf("-alloc = Dynamically allocate JPEG image buffers\n"); - printf("-bmp = Generate output images in Windows Bitmap format (default=PPM)\n"); + printf("-bmp = Generate output images in Windows Bitmap format (default = PPM)\n"); printf("-bottomup = Test bottom-up compression/decompression\n"); printf("-tile = Test performance of the codec when the image is encoded as separate\n"); printf(" tiles of varying sizes.\n"); printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n"); - printf(" Test the specified color conversion path in the codec (default: BGR)\n"); + printf(" Test the specified color conversion path in the codec (default = BGR)\n"); printf("-fastupsample = Use the fastest chrominance upsampling algorithm available in\n"); printf(" the underlying codec\n"); printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying\n"); @@ -726,7 +726,7 @@ void usage(char *progname) printf("-yuv = Test YUV encoding/decoding functions\n"); printf("-yuvpad

    = If testing YUV encoding/decoding, this specifies the number of\n"); printf(" bytes to which each row of each plane in the intermediate YUV image is\n"); - printf(" padded (default=1)\n"); + printf(" padded (default = 1)\n"); printf("-scale M/N = Scale down the width/height of the decompressed JPEG image by a\n"); printf(" factor of M/N (M/N = "); for(i=0; i = Run each benchmark for at least seconds (default = 5.0)\n"); printf("-warmup = Execute each benchmark times to prime the cache before\n"); - printf(" taking performance measurements (default = 1.)\n"); + printf(" taking performance measurements (default = 1)\n"); printf("-componly = Stop after running compression tests. Do not test decompression.\n\n"); printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n"); printf("test will be performed for all quality values in the range.\n\n"); From c4f4d18352ba656ad060ff605535b743faeb272d Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 17 Mar 2014 11:14:52 +0000 Subject: [PATCH 867/985] Extend YUVImage class to allow reuse of the same buffer with different metadata; port TJBench changes that treat YUV encoding/decoding as an intermediate step of the JPEG compression/decompression pipeline rather than a separate test case; add YUV encode/decode tests to the Java version of tjbenchtest --- Makefile.am | 1 + java/TJBench.java | 562 +++++++++--------- java/doc/index-all.html | 5 + .../org/libjpegturbo/turbojpeg/YUVImage.html | 40 +- java/org/libjpegturbo/turbojpeg/YUVImage.java | 40 +- tjbenchtest.in | 2 +- tjbenchtest.java.in | 98 +-- 7 files changed, 404 insertions(+), 344 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0e0527a2..0636b287 100644 --- a/Makefile.am +++ b/Makefile.am @@ -330,6 +330,7 @@ tjtest: sh ./tjbenchtest -yuv if WITH_JAVA sh ./tjbenchtest.java + sh ./tjbenchtest.java -yuv endif diff --git a/java/TJBench.java b/java/TJBench.java index 866a58f2..617d312d 100644 --- a/java/TJBench.java +++ b/java/TJBench.java @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2013 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2014 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -34,12 +34,8 @@ import org.libjpegturbo.turbojpeg.*; class TJBench { - static final int YUVENCODE = 1; - static final int YUVDECODE = 2; - static final int YUVCOMPRESS = 3; - - static int flags = 0, yuv = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1; - static boolean compOnly, decompOnly, doTile; + static int flags = 0, quiet = 0, pf = TJ.PF_BGR, yuvpad = 1, warmup = 1; + static boolean compOnly, decompOnly, doTile, doYUV; static final String[] pixFormatStr = { "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY" @@ -134,17 +130,15 @@ class TJBench { /* Decompression test */ - static void decompTest(byte[] srcBuf, byte[][] jpegBuf, int[] jpegSize, - byte[] dstBuf, int w, int h, int subsamp, - int jpegQual, String fileName, int tilew, int tileh) - throws Exception { + static void decomp(byte[] srcBuf, byte[][] jpegBuf, int[] jpegSize, + byte[] dstBuf, int w, int h, int subsamp, int jpegQual, + String fileName, int tilew, int tileh) throws Exception { String qualStr = new String(""), sizeStr, tempStr; TJDecompressor tjd; - double start, elapsed; - int ps = TJ.getPixelSize(pf), i; + double elapsed, elapsedDecode; + int ps = TJ.getPixelSize(pf), i, iter = 0; int scaledw = sf.getScaled(w); int scaledh = sf.getScaled(h); - int yuvSize = TJ.bufSizeYUV(scaledw, yuvpad, scaledh, subsamp), bufsize; int pitch = scaledw * ps; YUVImage yuvImage = null; @@ -153,40 +147,52 @@ class TJBench { tjd = new TJDecompressor(); - int bufSize = (yuv == YUVDECODE ? yuvSize : pitch * scaledh); if (dstBuf == null) - dstBuf = new byte[bufSize]; + dstBuf = new byte[pitch * scaledh]; /* Set the destination buffer to gray so we know whether the decompressor attempted to write to it */ Arrays.fill(dstBuf, (byte)127); - /* Execute once to preload cache */ - tjd.setSourceImage(jpegBuf[0], jpegSize[0]); - if (yuv == YUVDECODE) { - yuvImage = new YUVImage(dstBuf, scaledw, yuvpad, scaledh, subsamp); - tjd.decompressToYUV(yuvImage, flags); + if (doYUV) { + int width = doTile ? tilew : scaledw; + int height = doTile ? tileh : scaledh; + yuvImage = new YUVImage(width, yuvpad, height, subsamp); + Arrays.fill(yuvImage.getBuf(), (byte)127); } - else - tjd.decompress(dstBuf, 0, 0, scaledw, pitch, scaledh, pf, flags); /* Benchmark */ - for (i = 0, start = getTime(); (elapsed = getTime() - start) < benchTime; - i++) { + iter -= warmup; + elapsed = elapsedDecode = 0.0; + while (true) { int tile = 0; - if (yuv == YUVDECODE) - tjd.decompressToYUV(yuvImage, flags); - else { - for (int y = 0; y < h; y += tileh) { - for (int x = 0; x < w; x += tilew, tile++) { - int width = doTile ? Math.min(tilew, w - x) : scaledw; - int height = doTile ? Math.min(tileh, h - y) : scaledh; - tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]); + double start = getTime(); + for (int y = 0; y < h; y += tileh) { + for (int x = 0; x < w; x += tilew, tile++) { + int width = doTile ? Math.min(tilew, w - x) : scaledw; + int height = doTile ? Math.min(tileh, h - y) : scaledh; + tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]); + if (doYUV) { + yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height, subsamp); + tjd.decompressToYUV(yuvImage, flags); + double startDecode = getTime(); + tjd.setSourceImage(yuvImage); + tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags); + if (iter >= 0) + elapsedDecode += getTime() - startDecode; + } else tjd.decompress(dstBuf, x, y, width, pitch, height, pf, flags); - } } } + iter++; + if (iter >= 1) { + elapsed += getTime() - start; + if (elapsed >= benchTime) + break; + } } + if(doYUV) + elapsed -= elapsedDecode; tjd = null; for (i = 0; i < jpegBuf.length; i++) @@ -194,14 +200,27 @@ class TJBench { jpegBuf = null; jpegSize = null; System.gc(); - if (quiet != 0) - System.out.println( - sigFig((double)(w * h) / 1000000. * (double)i / elapsed, 4)); - else { - System.out.format("D--> Frame rate: %f fps\n", - (double)i / elapsed); - System.out.format(" Dest. throughput: %f Megapixels/sec\n", - (double)(w * h) / 1000000. * (double)i / elapsed); + if (quiet != 0) { + System.out.format("%-6s%s", + sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4), + quiet == 2 ? "\n" : " "); + if (doYUV) + System.out.format("%s\n", + sigFig((double)(w * h) / 1000000. * (double)iter / elapsedDecode, 4)); + else if (quiet != 2) + System.out.print("\n"); + } else { + System.out.format("%s --> Frame rate: %f fps\n", + (doYUV ? "Decomp to YUV":"Decompress "), + (double)iter / elapsed); + System.out.format(" Throughput: %f Megapixels/sec\n", + (double)(w * h) / 1000000. * (double)iter / elapsed); + if (doYUV) { + System.out.format("YUV Decode --> Frame rate: %f fps\n", + (double)iter / elapsedDecode); + System.out.format(" Throughput: %f Megapixels/sec\n", + (double)(w * h) / 1000000. * (double)iter / elapsedDecode); + } } if (sf.getNum() != 1 || sf.getDenom() != 1) @@ -211,132 +230,57 @@ class TJBench { else sizeStr = new String("full"); if (decompOnly) - tempStr = new String(fileName + "_" + sizeStr + - (yuv != 0 ? ".yuv" : ".bmp")); + tempStr = new String(fileName + "_" + sizeStr + ".bmp"); else tempStr = new String(fileName + "_" + subName[subsamp] + qualStr + - "_" + sizeStr + (yuv != 0 ? ".yuv" : ".bmp")); + "_" + sizeStr + ".bmp"); - if (yuv == YUVDECODE) { - FileOutputStream fos = new FileOutputStream(tempStr); - fos.write(dstBuf, 0, yuvSize); - fos.close(); - } else { - saveImage(tempStr, dstBuf, scaledw, scaledh, pf); - int ndx = tempStr.indexOf('.'); - tempStr = new String(tempStr.substring(0, ndx) + "-err.bmp"); - if (srcBuf != null && sf.getNum() == 1 && sf.getDenom() == 1) { - if (quiet == 0) - System.out.println("Compression error written to " + tempStr + "."); - if (subsamp == TJ.SAMP_GRAY) { - for (int y = 0, index = 0; y < h; y++, index += pitch) { - for (int x = 0, index2 = index; x < w; x++, index2 += ps) { - int rindex = index2 + TJ.getRedOffset(pf); - int gindex = index2 + TJ.getGreenOffset(pf); - int bindex = index2 + TJ.getBlueOffset(pf); - int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 + - (double)(srcBuf[gindex] & 0xff) * 0.587 + - (double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5); - if (lum > 255) lum = 255; - if (lum < 0) lum = 0; - dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum); - dstBuf[gindex] = (byte)Math.abs((dstBuf[gindex] & 0xff) - lum); - dstBuf[bindex] = (byte)Math.abs((dstBuf[bindex] & 0xff) - lum); - } + saveImage(tempStr, dstBuf, scaledw, scaledh, pf); + int ndx = tempStr.indexOf('.'); + tempStr = new String(tempStr.substring(0, ndx) + "-err.bmp"); + if (srcBuf != null && sf.getNum() == 1 && sf.getDenom() == 1) { + if (quiet == 0) + System.out.println("Compression error written to " + tempStr + "."); + if (subsamp == TJ.SAMP_GRAY) { + for (int y = 0, index = 0; y < h; y++, index += pitch) { + for (int x = 0, index2 = index; x < w; x++, index2 += ps) { + int rindex = index2 + TJ.getRedOffset(pf); + int gindex = index2 + TJ.getGreenOffset(pf); + int bindex = index2 + TJ.getBlueOffset(pf); + int lum = (int)((double)(srcBuf[rindex] & 0xff) * 0.299 + + (double)(srcBuf[gindex] & 0xff) * 0.587 + + (double)(srcBuf[bindex] & 0xff) * 0.114 + 0.5); + if (lum > 255) lum = 255; + if (lum < 0) lum = 0; + dstBuf[rindex] = (byte)Math.abs((dstBuf[rindex] & 0xff) - lum); + dstBuf[gindex] = (byte)Math.abs((dstBuf[gindex] & 0xff) - lum); + dstBuf[bindex] = (byte)Math.abs((dstBuf[bindex] & 0xff) - lum); } - } else { - for (int y = 0; y < h; y++) - for (int x = 0; x < w * ps; x++) - dstBuf[pitch * y + x] = - (byte)Math.abs((dstBuf[pitch * y + x] & 0xff) - - (srcBuf[pitch * y + x] & 0xff)); } - saveImage(tempStr, dstBuf, w, h, pf); + } else { + for (int y = 0; y < h; y++) + for (int x = 0; x < w * ps; x++) + dstBuf[pitch * y + x] = + (byte)Math.abs((dstBuf[pitch * y + x] & 0xff) - + (srcBuf[pitch * y + x] & 0xff)); } + saveImage(tempStr, dstBuf, w, h, pf); } } - static void doTestYUV(byte[] srcBuf, int w, int h, int subsamp, - String fileName) throws Exception { - TJCompressor tjc; - byte[] dstBuf; - double start, elapsed; - int ps = TJ.getPixelSize(pf), i; - int yuvSize = 0; - YUVImage yuvImage; - - yuvSize = TJ.bufSizeYUV(w, yuvpad, h, subsamp); - dstBuf = new byte[yuvSize]; - - if (quiet == 0) - System.out.format(">>>>> %s (%s) <--> YUV %s <<<<<\n", - pixFormatStr[pf], - (flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down", - subNameLong[subsamp]); - - if (quiet == 1) - System.out.format("%s\t%s\t%s\tN/A\t", pixFormatStr[pf], - (flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD", - subNameLong[subsamp]); - - tjc = new TJCompressor(srcBuf, 0, 0, w, 0, h, pf); - tjc.setSubsamp(subsamp); - - /* Execute once to preload cache */ - yuvImage = new YUVImage(dstBuf, w, yuvpad, h, subsamp); - tjc.encodeYUV(yuvImage, flags); - - /* Benchmark */ - for (i = 0, start = getTime(); - (elapsed = getTime() - start) < benchTime; i++) - tjc.encodeYUV(yuvImage, flags); - - if (quiet == 1) - System.out.format("%-4d %-4d\t", w, h); - if (quiet != 0) { - System.out.format("%s%c%s%c", - sigFig((double)(w * h) / 1000000. * (double) i / elapsed, 4), - quiet == 2 ? '\n' : '\t', - sigFig((double)(w * h * ps) / (double)yuvSize, 4), - quiet == 2 ? '\n' : '\t'); - } else { - System.out.format("\n%s size: %d x %d\n", "Image", w, h); - System.out.format("C--> Frame rate: %f fps\n", - (double)i / elapsed); - System.out.format(" Output image size: %d bytes\n", yuvSize); - System.out.format(" Compression ratio: %f:1\n", - (double)(w * h * ps) / (double)yuvSize); - System.out.format(" Source throughput: %f Megapixels/sec\n", - (double)(w * h) / 1000000. * (double)i / elapsed); - System.out.format(" Output bit stream: %f Megabits/sec\n", - (double)yuvSize * 8. / 1000000. * (double)i / elapsed); - } - String tempStr = fileName + "_" + subName[subsamp] + ".yuv"; - FileOutputStream fos = new FileOutputStream(tempStr); - fos.write(dstBuf, 0, yuvSize); - fos.close(); - if (quiet == 0) - System.out.println("Reference image written to " + tempStr); - } - - - static void doTest(byte[] srcBuf, int w, int h, int subsamp, int jpegQual, - String fileName) throws Exception { + static void fullTest(byte[] srcBuf, int w, int h, int subsamp, int jpegQual, + String fileName) throws Exception { TJCompressor tjc; byte[] tmpBuf; byte[][] jpegBuf; int[] jpegSize; - double start, elapsed; - int totalJpegSize = 0, tilew, tileh, i; - int ps = (yuv == YUVCOMPRESS ? 3 : TJ.getPixelSize(pf)); + double start, elapsed, elapsedEncode; + int totalJpegSize = 0, tilew, tileh, i, iter; + int ps = TJ.getPixelSize(pf); int ntilesw = 1, ntilesh = 1, pitch = w * ps; - String pfStr = (yuv == YUVCOMPRESS ? "YUV" : pixFormatStr[pf]); - - if (yuv == YUVENCODE) { - doTestYUV(srcBuf, w, h, subsamp, fileName); - return; - } + String pfStr = pixFormatStr[pf]; + YUVImage yuvImage = null; tmpBuf = new byte[pitch * h]; @@ -361,62 +305,94 @@ class TJBench { /* Compression test */ if (quiet == 1) - System.out.format("%s\t%s\t%s\t%d\t", pfStr, + System.out.format("%-4s (%s) %-5s %-3d ", pfStr, (flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD", subNameLong[subsamp], jpegQual); - if (yuv != YUVCOMPRESS) - for (i = 0; i < h; i++) - System.arraycopy(srcBuf, w * ps * i, tmpBuf, pitch * i, w * ps); - if (yuv == YUVCOMPRESS) - tjc.setSourceImage(new YUVImage(srcBuf, tilew, yuvpad, tileh, - subsamp)); - else - tjc.setSourceImage(srcBuf, 0, 0, tilew, pitch, tileh, pf); + for (i = 0; i < h; i++) + System.arraycopy(srcBuf, w * ps * i, tmpBuf, pitch * i, w * ps); tjc.setJPEGQuality(jpegQual); tjc.setSubsamp(subsamp); - /* Execute once to preload cache */ - tjc.compress(jpegBuf[0], flags); + if (doYUV) { + yuvImage = new YUVImage(tilew, yuvpad, tileh, subsamp); + Arrays.fill(yuvImage.getBuf(), (byte)127); + } /* Benchmark */ - for (i = 0, start = getTime(); - (elapsed = getTime() - start) < benchTime; i++) { + iter = -warmup; + elapsed = elapsedEncode = 0.0; + while (true) { int tile = 0; totalJpegSize = 0; + start = getTime(); for (int y = 0; y < h; y += tileh) { for (int x = 0; x < w; x += tilew, tile++) { int width = Math.min(tilew, w - x); int height = Math.min(tileh, h - y); - if (yuv != YUVCOMPRESS) - tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf); + tjc.setSourceImage(srcBuf, x, y, width, pitch, height, pf); + if (doYUV) { + double startEncode = getTime(); + yuvImage.setBuf(yuvImage.getBuf(), width, yuvpad, height, + subsamp); + tjc.encodeYUV(yuvImage, flags); + if (iter >= 0) + elapsedEncode += getTime() - startEncode; + tjc.setSourceImage(yuvImage); + } tjc.compress(jpegBuf[tile], flags); jpegSize[tile] = tjc.getCompressedSize(); totalJpegSize += jpegSize[tile]; } } + iter++; + if (iter >= 1) { + elapsed += getTime() - start; + if (elapsed >= benchTime) + break; + } } + if (doYUV) + elapsed -= elapsedEncode; if (quiet == 1) - System.out.format("%-4d %-4d\t", tilew, tileh); + System.out.format("%-5d %-5d ", tilew, tileh); if (quiet != 0) { - System.out.format("%s%c%s%c", - sigFig((double)(w * h) / 1000000. * (double) i / elapsed, 4), - quiet == 2 ? '\n' : '\t', + if (doYUV) + System.out.format("%-6s%s", + sigFig((double)(w * h) / 1000000. * (double)iter / elapsedEncode, 4), + quiet == 2 ? "\n" : " "); + System.out.format("%-6s%s", + sigFig((double)(w * h) / 1000000. * (double)iter / elapsed, 4), + quiet == 2 ? "\n" : " "); + System.out.format("%-6s%s", sigFig((double)(w * h * ps) / (double)totalJpegSize, 4), - quiet == 2 ? '\n' : '\t'); + quiet == 2 ? "\n" : " "); } else { System.out.format("\n%s size: %d x %d\n", doTile ? "Tile" : "Image", tilew, tileh); - System.out.format("C--> Frame rate: %f fps\n", - (double)i / elapsed); - System.out.format(" Output image size: %d bytes\n", + if (doYUV) { + System.out.format("Encode YUV --> Frame rate: %f fps\n", + (double)iter / elapsedEncode); + System.out.format(" Output image size: %d bytes\n", + yuvImage.getSize()); + System.out.format(" Compression ratio: %f:1\n", + (double)(w * h * ps) / (double)yuvImage.getSize()); + System.out.format(" Throughput: %f Megapixels/sec\n", + (double)(w * h) / 1000000. * (double)iter / elapsedEncode); + System.out.format(" Output bit stream: %f Megabits/sec\n", + (double)yuvImage.getSize() * 8. / 1000000. * (double)iter / elapsedEncode); + } + System.out.format("%s --> Frame rate: %f fps\n", + doYUV ? "Comp from YUV" : "Compress ", + (double)iter / elapsed); + System.out.format(" Output image size: %d bytes\n", totalJpegSize); - System.out.format(" Compression ratio: %f:1\n", + System.out.format(" Compression ratio: %f:1\n", (double)(w * h * ps) / (double)totalJpegSize); - System.out.format(" Source throughput: %f Megapixels/sec\n", - (double)(w * h) / 1000000. * (double)i / elapsed); - System.out.format(" Output bit stream: %f Megabits/sec\n", - (double)totalJpegSize * 8. / 1000000. * (double)i / elapsed); + System.out.format(" Throughput: %f Megapixels/sec\n", + (double)(w * h) / 1000000. * (double)iter / elapsed); + System.out.format(" Output bit stream: %f Megabits/sec\n", + (double)totalJpegSize * 8. / 1000000. * (double)iter / elapsed); } if (tilew == w && tileh == h) { String tempStr = fileName + "_" + subName[subsamp] + "_" + "Q" + @@ -430,22 +406,22 @@ class TJBench { /* Decompression test */ if (!compOnly) - decompTest(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual, - fileName, tilew, tileh); + decomp(srcBuf, jpegBuf, jpegSize, tmpBuf, w, h, subsamp, jpegQual, + fileName, tilew, tileh); if (tilew == w && tileh == h) break; } } - static void doDecompTest(String fileName) throws Exception { + static void decompTest(String fileName) throws Exception { TJTransformer tjt; - byte[][] jpegBuf; + byte[][] jpegBuf = null; byte[] srcBuf; - int[] jpegSize; + int[] jpegSize = null; int totalJpegSize; int w = 0, h = 0, subsamp = -1, cs = -1, _w, _h, _tilew, _tileh, - _ntilesw, _ntilesh, _subsamp, x, y; + _ntilesw, _ntilesh, _subsamp, x, y, iter; int ntilesw = 1, ntilesh = 1; double start, elapsed; int ps = TJ.getPixelSize(pf), tile; @@ -470,19 +446,20 @@ class TJBench { if (quiet == 1) { System.out.println("All performance values in Mpixels/sec\n"); - System.out.format("Bitmap\tBitmap\tJPEG\tJPEG\t%s %s \tXform\tComp\tDecomp\n", + System.out.format("Bitmap JPEG JPEG %s %s Xform Comp Decomp ", (doTile ? "Tile " : "Image"), (doTile ? "Tile " : "Image")); - System.out.println("Format\tOrder\tCS\tSubsamp\tWidth Height\tPerf \tRatio\tPerf\n"); - } else if (quiet == 0) { - if (yuv == YUVDECODE) - System.out.format(">>>>> JPEG %s --> YUV <<<<<\n", - formatName(subsamp, cs)); - else - System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n", - formatName(subsamp, cs), pixFormatStr[pf], - (flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down"); - } + if (doYUV) + System.out.print("Decode"); + System.out.print("\n"); + System.out.print("Format CS Subsamp Width Height Perf Ratio Perf "); + if (doYUV) + System.out.print("Perf"); + System.out.println("\n"); + } else if (quiet == 0) + System.out.format(">>>>> JPEG %s --> %s (%s) <<<<<\n", + formatName(subsamp, cs), pixFormatStr[pf], + (flags & TJ.FLAG_BOTTOMUP) != 0 ? "Bottom-up" : "Top-down"); for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ; tilew *= 2, tileh *= 2) { @@ -502,10 +479,10 @@ class TJBench { sf.getScaled(_h)); System.out.println(""); } else if (quiet == 1) { - System.out.format("%s\t%s\t%s\t%s\t", pixFormatStr[pf], + System.out.format("%-4s (%s) %-5s %-5s ", pixFormatStr[pf], (flags & TJ.FLAG_BOTTOMUP) != 0 ? "BU" : "TD", csName[cs], subNameLong[subsamp]); - System.out.format("%-4d %-4d\t", tilew, tileh); + System.out.format("%-5d %-5d ", tilew, tileh); } _subsamp = subsamp; @@ -534,6 +511,16 @@ class TJBench { _ntilesw = (_w + _tilew - 1) / _tilew; _ntilesh = (_h + _tileh - 1) / _tileh; + if (xformOp == TJTransform.OP_TRANSPOSE || + xformOp == TJTransform.OP_TRANSVERSE || + xformOp == TJTransform.OP_ROT90 || + xformOp == TJTransform.OP_ROT270) { + if (_subsamp == TJ.SAMP_422) + _subsamp = TJ.SAMP_440; + else if (_subsamp == TJ.SAMP_440) + _subsamp = TJ.SAMP_422; + } + TJTransform[] t = new TJTransform[_ntilesw * _ntilesh]; jpegBuf = new byte[_ntilesw * _ntilesh][TJ.bufSize(_tilew, _tileh, subsamp)]; @@ -552,37 +539,45 @@ class TJBench { } } - start = getTime(); - tjt.transform(jpegBuf, t, flags); - jpegSize = tjt.getTransformedSizes(); - elapsed = getTime() - start; - + iter = -warmup; + elapsed = 0.; + while (true) { + start = getTime(); + tjt.transform(jpegBuf, t, flags); + jpegSize = tjt.getTransformedSizes(); + iter++; + if (iter >= 1) { + elapsed += getTime() - start; + if (elapsed >= benchTime) + break; + } + } t = null; for (tile = 0, totalJpegSize = 0; tile < _ntilesw * _ntilesh; tile++) totalJpegSize += jpegSize[tile]; if (quiet != 0) { - System.out.format("%s%c%s%c", + System.out.format("%-6s%s%-6s%s", sigFig((double)(w * h) / 1000000. / elapsed, 4), - quiet == 2 ? '\n' : '\t', + quiet == 2 ? "\n" : " ", sigFig((double)(w * h * ps) / (double)totalJpegSize, 4), - quiet == 2 ? '\n' : '\t'); + quiet == 2 ? "\n" : " "); } else if (quiet == 0) { - System.out.format("X--> Frame rate: %f fps\n", + System.out.format("Transform --> Frame rate: %f fps\n", 1.0 / elapsed); - System.out.format(" Output image size: %d bytes\n", + System.out.format(" Output image size: %d bytes\n", totalJpegSize); - System.out.format(" Compression ratio: %f:1\n", + System.out.format(" Compression ratio: %f:1\n", (double)(w * h * ps) / (double)totalJpegSize); - System.out.format(" Source throughput: %f Megapixels/sec\n", + System.out.format(" Throughput: %f Megapixels/sec\n", (double)(w * h) / 1000000. / elapsed); - System.out.format(" Output bit stream: %f Megabits/sec\n", + System.out.format(" Output bit stream: %f Megabits/sec\n", (double)totalJpegSize * 8. / 1000000. / elapsed); } } else { if (quiet == 1) - System.out.print("N/A\tN/A\t"); + System.out.print("N/A N/A "); jpegBuf = new byte[1][TJ.bufSize(_tilew, _tileh, subsamp)]; jpegSize = new int[1]; jpegSize[0] = srcSize; @@ -594,8 +589,8 @@ class TJBench { if (h == tileh) _tileh = _h; if ((xformOpt & TJTransform.OPT_NOOUTPUT) == 0) - decompTest(null, jpegBuf, jpegSize, null, _w, _h, _subsamp, 0, - fileName, _tilew, _tileh); + decomp(null, jpegBuf, jpegSize, null, _w, _h, _subsamp, 0, + fileName, _tilew, _tileh); else if (quiet == 1) System.out.println("N/A"); @@ -614,7 +609,7 @@ class TJBench { String className = new TJBench().getClass().getName(); System.out.println("\nUSAGE: java " + className); - System.out.println(" [options]\n"); + System.out.println(" [options]\n"); System.out.println(" java " + className); System.out.println(" [options]\n"); System.out.println("Options:\n"); @@ -623,29 +618,23 @@ class TJBench { System.out.println("-tile = Test performance of the codec when the image is encoded as separate"); System.out.println(" tiles of varying sizes."); System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb ="); - System.out.println(" Test the specified color conversion path in the codec (default: BGR)"); + System.out.println(" Test the specified color conversion path in the codec (default = BGR)"); System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in"); System.out.println(" the underlying codec"); System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying"); System.out.println(" codec"); System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the"); System.out.println(" underlying codec"); - System.out.println("-subsamp = if compressing a JPEG image from a YUV planar source image,"); - System.out.println(" this specifies the level of chrominance subsampling used in the source"); - System.out.println(" image. Otherwise, this specifies the level of chrominance subsampling"); - System.out.println(" to use in the JPEG destination image. = 444, 422, 440, 420, 411,"); - System.out.println(" or GRAY"); + System.out.println("-subsamp = When testing JPEG compression, this option specifies the level"); + System.out.println(" of chrominance subsampling to use ( = 444, 422, 440, 420, 411, or"); + System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in"); + System.out.println(" sequence."); System.out.println("-quiet = Output results in tabular rather than verbose format"); - System.out.println("-yuvencode = Encode RGB input as planar YUV rather than compressing as JPEG"); - System.out.println("-yuvdecode = Decode JPEG image to planar YUV rather than RGB"); - System.out.println("-yuvsize WxH = if compressing a JPEG image from a YUV planar source image, this"); - System.out.println(" specifies the width and height of the source image."); - System.out.println("-yuvpad

    = if compressing a JPEG image from a YUV planar source image, this"); - System.out.println(" specifies the number of bytes to which each row of each plane in the"); - System.out.println(" source image is padded. If decompressing a JPEG image to a YUV planar"); - System.out.println(" destination image, this specifies the row padding for each plane of the"); - System.out.println(" destination image. (default=1)"); - System.out.println("-scale M/N = scale down the width/height of the decompressed JPEG image by a"); + System.out.println("-yuv = Test YUV encoding/decoding functions"); + System.out.println("-yuvpad

    = If testing YUV encoding/decoding, this specifies the number of"); + System.out.println(" bytes to which each row of each plane in the intermediate YUV image is"); + System.out.println(" padded (default = 1)"); + System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a"); System.out.print (" factor of M/N (M/N = "); for (i = 0; i < nsf; i++) { System.out.format("%d/%d", scalingFactors[i].getNum(), @@ -668,7 +657,9 @@ class TJBench { System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression"); System.out.println(" test (can be combined with the other transforms above)"); System.out.println("-benchtime = Run each benchmark for at least seconds (default = 5.0)"); - System.out.println("-componly = Stop after running compression tests. Do not test decompression.\n"); + System.out.println("-warmup = Execute each benchmark times to prime the cache before"); + System.out.println(" taking performance measurements (default = 1)"); + System.out.println("-componly = Stop after running compression tests. Do not test decompression.\n"); System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate"); System.out.println("test will be performed for all quality values in the range.\n"); System.exit(1); @@ -689,25 +680,10 @@ class TJBench { String tempStr = argv[0].toLowerCase(); if (tempStr.endsWith(".jpg") || tempStr.endsWith(".jpeg")) decompOnly = true; - if (tempStr.endsWith(".yuv")) - yuv = YUVCOMPRESS; System.out.println(""); - if (argv.length > minArg) { - for (int i = minArg; i < argv.length; i++) { - if (argv[i].equalsIgnoreCase("-yuvencode")) { - System.out.println("Testing YUV planar encoding\n"); - yuv = YUVENCODE; maxQual = minQual = 100; - } - if (argv[i].equalsIgnoreCase("-yuvdecode")) { - System.out.println("Testing YUV planar decoding\n"); - yuv = YUVDECODE; - } - } - } - - if (!decompOnly && yuv != YUVENCODE) { + if (!decompOnly) { minArg = 2; if (argv.length < minArg) usage(); @@ -812,18 +788,9 @@ class TJBench { else usage(); } - if (argv[i].equalsIgnoreCase("-yuvsize") && i < argv.length - 1) { - int temp1 = 0, temp2 = 0; - Scanner scanner = new Scanner(argv[++i]).useDelimiter("x"); - try { - temp1 = scanner.nextInt(); - temp2 = scanner.nextInt(); - } catch(Exception e) {} - if (temp1 >= 1 && temp2 >= 1) { - w = temp1; - h = temp2; - } else - usage(); + if (argv[i].equalsIgnoreCase("-yuv")) { + System.out.println("Testing YUV planar encoding/decoding\n"); + doYUV = true; } if (argv[i].equalsIgnoreCase("-yuvpad") && i < argv.length - 1) { int temp = 0; @@ -850,6 +817,16 @@ class TJBench { } if (argv[i].equalsIgnoreCase("-componly")) compOnly = true; + if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) { + int temp = -1; + try { + temp = Integer.parseInt(argv[++i]); + } catch (NumberFormatException e) {} + if (temp >= 0) { + warmup = temp; + System.out.format("Warmup runs = %d\n\n", warmup); + } + } if (argv[i].equalsIgnoreCase("-?")) usage(); } @@ -864,67 +841,60 @@ class TJBench { doTile = false; } - if (yuv != 0 && doTile) { - System.out.println("Disabling tiled compression/decompression tests, because those tests do not"); - System.out.println("work when YUV encoding, compression, or decoding is enabled.\n"); - doTile = false; - } - if (!decompOnly) { - if(yuv == YUVCOMPRESS) { - if (w < 1 || h < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP) - throw new Exception("YUV image size and/or subsampling not specified"); - FileInputStream fis = new FileInputStream(argv[0]); - int srcSize = (int)fis.getChannel().size(); - if (srcSize != TJ.bufSizeYUV(w, yuvpad, h, subsamp)) - throw new Exception("YUV image file is the wrong size"); - srcBuf = new byte[srcSize]; - fis.read(srcBuf, 0, srcSize); - fis.close(); - } - else { - int[] width = new int[1], height = new int[1]; - srcBuf = loadImage(argv[0], width, height, pf); - w = width[0]; h = height[0]; - int index = -1; - if ((index = argv[0].indexOf('.')) >= 0) - argv[0] = argv[0].substring(0, index); - } + int[] width = new int[1], height = new int[1]; + srcBuf = loadImage(argv[0], width, height, pf); + w = width[0]; h = height[0]; + int index = -1; + if ((index = argv[0].indexOf('.')) >= 0) + argv[0] = argv[0].substring(0, index); } if (quiet == 1 && !decompOnly) { System.out.println("All performance values in Mpixels/sec\n"); - System.out.format("Bitmap\tBitmap\tJPEG\tJPEG\t%s %s \tComp\tComp\tDecomp\n", + System.out.format("Bitmap JPEG JPEG %s %s ", (doTile ? "Tile " : "Image"), (doTile ? "Tile " : "Image")); - System.out.println("Format\tOrder\tSubsamp\tQual\tWidth Height\tPerf \tRatio\tPerf\n"); + if (doYUV) + System.out.print("Encode "); + System.out.print("Comp Comp Decomp "); + if (doYUV) + System.out.print("Decode"); + System.out.print("\n"); + System.out.print("Format Subsamp Qual Width Height "); + if (doYUV) + System.out.print("Perf "); + System.out.print("Perf Ratio Perf "); + if (doYUV) + System.out.print("Perf"); + System.out.println("\n"); } if (decompOnly) { - doDecompTest(argv[0]); + decompTest(argv[0]); System.out.println(""); System.exit(retval); } System.gc(); - if (yuv == YUVCOMPRESS || (subsamp >= 0 && subsamp < TJ.NUMSAMP)) { + if (subsamp >= 0 && subsamp < TJ.NUMSAMP) { for (int i = maxQual; i >= minQual; i--) - doTest(srcBuf, w, h, subsamp, i, argv[0]); + fullTest(srcBuf, w, h, subsamp, i, argv[0]); System.out.println(""); } else { for (int i = maxQual; i >= minQual; i--) - doTest(srcBuf, w, h, TJ.SAMP_GRAY, i, argv[0]); + fullTest(srcBuf, w, h, TJ.SAMP_GRAY, i, argv[0]); System.out.println(""); System.gc(); for (int i = maxQual; i >= minQual; i--) - doTest(srcBuf, w, h, TJ.SAMP_420, i, argv[0]); + fullTest(srcBuf, w, h, TJ.SAMP_420, i, argv[0]); System.out.println(""); System.gc(); for (int i = maxQual; i >= minQual; i--) - doTest(srcBuf, w, h, TJ.SAMP_422, i, argv[0]); + fullTest(srcBuf, w, h, TJ.SAMP_422, i, argv[0]); System.out.println(""); System.gc(); for (int i = maxQual; i >= minQual; i--) - doTest(srcBuf, w, h, TJ.SAMP_444, i, argv[0]); + fullTest(srcBuf, w, h, TJ.SAMP_444, i, argv[0]); System.out.println(""); } diff --git a/java/doc/index-all.html b/java/doc/index-all.html index c8a4f0c9..fa92e3c9 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -662,6 +662,11 @@

    Grayscale.
    +
    setBuf(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Assign an existing YUV planar image buffer to this YUVImage + instance.
    +
    setJPEGImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Deprecated. diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html index 8659aedc..13e6160c 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -243,6 +243,17 @@ extends java.lang.Object
    Returns the width of the YUV image.
    + +void +setBuf(byte[] yuvImage, + int width, + int pad, + int height, + int subsamp) +
    Assign an existing YUV planar image buffer to this YUVImage + instance.
    + +
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar image data. See above for a description of the image - format. You can use TJ.bufSizeYUV(int, int, int, int) to determine the appropriate - size for this buffer.
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For + format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this + buffer.
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    @@ -379,6 +390,31 @@ extends java.lang.Object

    Method Detail

    + + + +
      +
    • +

      setBuf

      +
      public void setBuf(byte[] yuvImage,
      +          int width,
      +          int pad,
      +          int height,
      +          int subsamp)
      +            throws java.lang.Exception
      +
      Assign an existing YUV planar image buffer to this YUVImage + instance.
      +
      Parameters:
      yuvImage - image buffer that contains or will contain YUV planar + image data. See above for a description of the image + format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this + buffer.
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For + instance, if each line in each plane of the buffer is padded to the + nearest multiple of 4 bytes, then pad should be set to 4.
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    diff --git a/java/org/libjpegturbo/turbojpeg/YUVImage.java b/java/org/libjpegturbo/turbojpeg/YUVImage.java index 67935936..619b0c31 100644 --- a/java/org/libjpegturbo/turbojpeg/YUVImage.java +++ b/java/org/libjpegturbo/turbojpeg/YUVImage.java @@ -74,8 +74,8 @@ public class YUVImage { */ public YUVImage(int width, int pad, int height, int subsamp) throws Exception { - setBuffer(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad, - height, subsamp); + setBuf(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad, + height, subsamp); } /** @@ -84,8 +84,8 @@ public class YUVImage { * * @param yuvImage image buffer that contains or will contain YUV planar * image data. See {@link YUVImage above} for a description of the image - * format. You can use {@link TJ#bufSizeYUV} to determine the appropriate - * size for this buffer. + * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this + * buffer. * * @param width width (in pixels) of the YUV image * @@ -100,16 +100,36 @@ public class YUVImage { */ public YUVImage(byte[] yuvImage, int width, int pad, int height, int subsamp) throws Exception { - setBuffer(yuvImage, width, pad, height, subsamp); + setBuf(yuvImage, width, pad, height, subsamp); } - private void setBuffer(byte[] yuvImage, int width, int pad, int height, - int subsamp) throws Exception { + /** + * Assign an existing YUV planar image buffer to this YUVImage + * instance. + * + * @param yuvImage image buffer that contains or will contain YUV planar + * image data. See {@link YUVImage above} for a description of the image + * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this + * buffer. + * + * @param width width (in pixels) of the YUV image + * + * @param pad the line padding used in the YUV image buffer. For + * instance, if each line in each plane of the buffer is padded to the + * nearest multiple of 4 bytes, then pad should be set to 4. + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public void setBuf(byte[] yuvImage, int width, int pad, int height, + int subsamp) throws Exception { if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) || height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP) throw new Exception("Invalid argument in YUVImage()"); - if (yuvImage.length != TJ.bufSizeYUV(width, pad, height, subsamp)) - throw new Exception("YUV image buffer is the wrong size"); + if (yuvImage.length < TJ.bufSizeYUV(width, pad, height, subsamp)) + throw new Exception("YUV image buffer is not large enough"); yuvBuf = yuvImage; yuvWidth = width; yuvPad = pad; @@ -181,7 +201,7 @@ public class YUVImage { public int getSize() throws Exception { if (yuvBuf == null) throw new Exception(NO_ASSOC_ERROR); - return yuvBuf.length; + return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp); } protected long handle = 0; diff --git a/tjbenchtest.in b/tjbenchtest.in index 1ebd0b8f..5e08c9b3 100755 --- a/tjbenchtest.in +++ b/tjbenchtest.in @@ -159,7 +159,7 @@ for image in $IMAGES; do done for xform in hflip vflip transpose transverse rot90 rot180 rot270; do for samp in GRAY 444; do - runme $EXEDIR/djpeg -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg + runme $EXEDIR/djpeg -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do diff --git a/tjbenchtest.java.in b/tjbenchtest.java.in index ebff9c84..1869bca6 100755 --- a/tjbenchtest.java.in +++ b/tjbenchtest.java.in @@ -24,6 +24,9 @@ IMGDIR=@srcdir@/testimages OUTDIR=__tjbenchtest_java_output EXEDIR=. JAVA="@JAVA@ -cp java/turbojpeg.jar -Djava.library.path=.libs" +BMPARG= +NSARG= +YUVARG= if [ -d $OUTDIR ]; then rm -rf $OUTDIR @@ -32,33 +35,58 @@ mkdir -p $OUTDIR exec >$EXEDIR/tjbenchtest-java.log +if [ $# -gt 0 ]; then + if [ "$1" = "-yuv" ]; then + NSARG=-nosmooth + YUVARG=-yuv + +# NOTE: The combination of tjEncodeYUV*() and tjCompressFromYUV*() does not +# always produce bitwise-identical results to tjCompress*() if subsampling is +# enabled. In both cases, if the image width or height are not evenly +# divisible by the MCU width/height, then the bottom and/or right edge are +# expanded. However, the libjpeg code performs this expansion prior to +# downsampling, and TurboJPEG performs it in tjCompressFromYUV*(), which is +# after downsampling. Thus, the two will agree only if the width/height along +# each downsampled dimension is an odd number or is evenly divisible by the MCU +# width/height. This disagreement basically amounts to a round-off error, but +# there is no easy way around it, so for now, we just test the only image that +# works. (NOTE: nightshot_iso_100 does not suffer from the above issue, but +# it suffers from an unrelated problem whereby the combination of +# tjDecompressToYUV*() and tjDecodeYUV*() do not produce bitwise-identical +# results to tjDecompress*() if decompression scaling is enabled. This latter +# phenomenon is not yet fully understood but is also believed to be some sort +# of round-off error.) + IMAGES="vgl_6548_0026a.bmp" + fi +fi + # Standard tests for image in $IMAGES; do cp $IMGDIR/$image $OUTDIR basename=`basename $image .bmp` - $EXEDIR/cjpeg -quality 95 -dct fast -grayscale $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_GRAY_fast_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_420_fast_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_422_fast_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_444_fast_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct int -grayscale $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct int -sample 2x2 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_420_accurate_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct int -sample 2x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_422_accurate_cjpeg.jpg - $EXEDIR/cjpeg -quality 95 -dct int -sample 1x1 $IMGDIR/${basename}.bmp >$OUTDIR/${basename}_444_accurate_cjpeg.jpg + runme $EXEDIR/cjpeg -quality 95 -dct fast -grayscale -outfile $OUTDIR/${basename}_GRAY_fast_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct fast -sample 2x2 -outfile $OUTDIR/${basename}_420_fast_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct fast -sample 2x1 -outfile $OUTDIR/${basename}_422_fast_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct fast -sample 1x1 -outfile $OUTDIR/${basename}_444_fast_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct int -grayscale -outfile $OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct int -sample 2x2 -outfile $OUTDIR/${basename}_420_accurate_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct int -sample 2x1 -outfile $OUTDIR/${basename}_422_accurate_cjpeg.jpg $IMGDIR/${basename}.bmp + runme $EXEDIR/cjpeg -quality 95 -dct int -sample 1x1 -outfile $OUTDIR/${basename}_444_accurate_cjpeg.jpg $IMGDIR/${basename}.bmp for samp in GRAY 420 422 444; do - $EXEDIR/djpeg -rgb -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_djpeg.bmp - $EXEDIR/djpeg -dct fast -rgb -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_djpeg.bmp - $EXEDIR/djpeg -dct int -rgb -bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_djpeg.bmp + runme $EXEDIR/djpeg -rgb -bmp -outfile $OUTDIR/${basename}_${samp}_default_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dct fast -rgb -bmp -outfile $OUTDIR/${basename}_${samp}_fast_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dct int -rgb -bmp -outfile $OUTDIR/${basename}_${samp}_accurate_djpeg.bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg done for samp in 420 422; do - $EXEDIR/djpeg -nosmooth -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_default_nosmooth_djpeg.bmp - $EXEDIR/djpeg -dct fast -nosmooth -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.bmp - $EXEDIR/djpeg -dct int -nosmooth -bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg >$OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.bmp + runme $EXEDIR/djpeg -nosmooth -bmp -outfile $OUTDIR/${basename}_${samp}_default_nosmooth_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dct fast -nosmooth -bmp -outfile $OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $EXEDIR/djpeg -dct int -nosmooth -bmp -outfile $OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.bmp $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg done # Compression for dct in accurate fast; do - runme $JAVA TJBench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -${dct}dct + runme $JAVA TJBench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -warmup 0 -${dct}dct $YUVARG for samp in GRAY 420 422 444; do runme cmp $OUTDIR/${basename}_${samp}_Q95.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg done @@ -71,7 +99,7 @@ for image in $IMAGES; do fi # Tiled compression & decompression - runme $JAVA TJBench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 ${dctarg} + runme $JAVA TJBench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG for samp in GRAY 444; do for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do @@ -79,7 +107,7 @@ for image in $IMAGES; do rm $i done done - runme $JAVA TJBench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -fastupsample ${dctarg} + runme $JAVA TJBench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG for samp in 420 422; do for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do @@ -90,7 +118,7 @@ for image in $IMAGES; do # Tiled decompression for samp in GRAY 444; do - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -tile -quiet -benchtime 0.01 ${dctarg} + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do runme cmp -i 54:54 $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.bmp @@ -98,7 +126,7 @@ for image in $IMAGES; do done done for samp in 420 422; do - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -tile -quiet -benchtime 0.01 -fastupsample ${dctarg} + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do runme cmp $i -i 54:54 $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.bmp @@ -111,8 +139,8 @@ for image in $IMAGES; do for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do scalearg=`echo $scale | sed s@_@/@g` for samp in GRAY 420 422 444; do - $EXEDIR/djpeg -rgb -scale ${scalearg} -bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -scale ${scalearg} -quiet -benchtime 0.01 + runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG -bmp -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_Q95_${scale}.bmp $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp rm $OUTDIR/${basename}_${samp}_Q95_${scale}.bmp done @@ -120,18 +148,18 @@ for image in $IMAGES; do # Transforms for samp in GRAY 420 422 444; do - $EXEDIR/jpegtran -flip horizontal -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_hflip_jpegtran.jpg - $EXEDIR/jpegtran -flip vertical -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_vflip_jpegtran.jpg - $EXEDIR/jpegtran -transpose -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_transpose_jpegtran.jpg - $EXEDIR/jpegtran -transverse -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_transverse_jpegtran.jpg - $EXEDIR/jpegtran -rotate 90 -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_rot90_jpegtran.jpg - $EXEDIR/jpegtran -rotate 180 -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_rot180_jpegtran.jpg - $EXEDIR/jpegtran -rotate 270 -trim $OUTDIR/${basename}_${samp}_Q95.jpg >$OUTDIR/${basename}_${samp}_rot270_jpegtran.jpg + runme $EXEDIR/jpegtran -flip horizontal -trim -outfile $OUTDIR/${basename}_${samp}_hflip_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -flip vertical -trim -outfile $OUTDIR/${basename}_${samp}_vflip_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -transpose -trim -outfile $OUTDIR/${basename}_${samp}_transpose_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -transverse -trim -outfile $OUTDIR/${basename}_${samp}_transverse_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -rotate 90 -trim -outfile $OUTDIR/${basename}_${samp}_rot90_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -rotate 180 -trim -outfile $OUTDIR/${basename}_${samp}_rot180_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg + runme $EXEDIR/jpegtran -rotate 270 -trim -outfile $OUTDIR/${basename}_${samp}_rot270_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg done for xform in hflip vflip transpose transverse rot90 rot180 rot270; do for samp in GRAY 444; do - $EXEDIR/djpeg -rgb -bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 + runme $EXEDIR/djpeg -rgb -bmp -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 -warmup 0 $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do runme cmp -i 54:54 $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp @@ -139,8 +167,8 @@ for image in $IMAGES; do done done for samp in 420 422; do - $EXEDIR/djpeg -nosmooth -rgb -bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 -fastupsample + runme $EXEDIR/djpeg -nosmooth -rgb -bmp -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do runme cmp -i 54:54 $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.bmp @@ -152,7 +180,7 @@ for image in $IMAGES; do # Grayscale transform for xform in hflip vflip transpose transverse rot90 rot180 rot270; do for samp in GRAY 444 422 420; do - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 -grayscale + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -tile -quiet -benchtime 0.01 -warmup 0 -grayscale $YUVARG for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].bmp \ $OUTDIR/${basename}_${samp}_Q95_full.bmp; do runme cmp -i 54:54 $i $OUTDIR/${basename}_GRAY_${xform}_jpegtran.bmp @@ -166,8 +194,8 @@ for image in $IMAGES; do for samp in GRAY 444 422 420; do for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do scalearg=`echo $scale | sed s@_@/@g` - $EXEDIR/djpeg -rgb -scale ${scalearg} -bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp - runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -scale ${scalearg} -quiet -benchtime 0.01 + runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG -bmp -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg + runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_Q95_${scale}.bmp $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp rm $OUTDIR/${basename}_${samp}_Q95_${scale}.bmp done From 7bb4dbb81bad6bd1bac62f593cba8c158191f43c Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 21 Mar 2014 08:36:58 +0000 Subject: [PATCH 868/985] Enable silent build (can be overridden with 'make V=1') if the version of autotools being used is new enough. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index d0780c93..7ccd1b65 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,8 @@ AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) # Always build with prototypes AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + # Checks for programs. SAVED_CFLAGS=${CFLAGS} SAVED_CPPFLAGS=${CPPFLAGS} From 92c7ae89118f93276026fb6df1f0bfb040304fcc Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 21 Mar 2014 09:23:41 +0000 Subject: [PATCH 869/985] Fix compiler warning ("always_inline function might not be inlinable") when building with recent versions of GCC --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7ccd1b65..4173f25d 100644 --- a/configure.ac +++ b/configure.ac @@ -266,7 +266,7 @@ AC_SUBST(VERSION_SCRIPT_FLAG) AC_MSG_CHECKING(for inline) ljt_cv_inline="" AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; } -int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))", +int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))", AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; } int bar() { return foo();], ljt_cv_inline="__inline__", AC_TRY_COMPILE(, [} __inline int foo() { return 0; } From dd12a235c52e91b2bbddb427679ee8d531d65d72 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 21 Mar 2014 09:35:02 +0000 Subject: [PATCH 870/985] Fix compiler warning about unused function when building with the libjpeg v6b API/ABI --- transupp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transupp.c b/transupp.c index 70e8c498..a16b20a5 100644 --- a/transupp.c +++ b/transupp.c @@ -1176,6 +1176,7 @@ transpose_critical_parameters (j_compress_ptr dstinfo) * We try to adjust the Tags ExifImageWidth and ExifImageHeight if possible. */ +#if JPEG_LIB_VERSION >= 70 LOCAL(void) adjust_exif_parameters (JOCTET FAR * data, unsigned int length, JDIMENSION new_width, JDIMENSION new_height) @@ -1325,6 +1326,7 @@ adjust_exif_parameters (JOCTET FAR * data, unsigned int length, offset += 12; } while (--number_of_tags); } +#endif /* Adjust output image parameters as needed. From 67599a5dc61cbe40fb504a20fa940faa0b4ce28d Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 21 Mar 2014 11:01:00 +0000 Subject: [PATCH 871/985] RHEL 6 (and probably other platforms as well) sets _defaultdocdir=%{_datadir}/doc, which screws things up, since we're overriding _datadir. Since we intend _defaultdocdir to be /usr/share/doc, just be explicit about it. --- release/libjpeg-turbo.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/libjpeg-turbo.spec.in b/release/libjpeg-turbo.spec.in index 616618d5..23793cf5 100644 --- a/release/libjpeg-turbo.spec.in +++ b/release/libjpeg-turbo.spec.in @@ -8,7 +8,7 @@ %define _datadir %{__datadir} # Path under which docs should be installed -%define _docdir %{_defaultdocdir}/%{name}-%{version} +%define _docdir /usr/share/doc/%{name}-%{version} # Path under which headers should be installed %define _includedir %{__includedir} From d10edbc1eecd353185483f5630bf014bc38cb64e Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 22 Mar 2014 20:22:52 +0000 Subject: [PATCH 872/985] Fix 'make dist' --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 0636b287..c8c066dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -154,7 +154,7 @@ dist_example_DATA = example.c EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ - jccolext.c jdcolext.c jdmrgext.c + jccolext.c jdcolext.c jdmrgext.c jstdhuff.c dist-hook: rm -rf `find $(distdir) -name .svn` From 1cf34093b992ded3541e216b68905969cb63f2ce Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 22 Mar 2014 20:43:03 +0000 Subject: [PATCH 873/985] --- ChangeLog.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 25f673e8..fb148caa 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -65,6 +65,13 @@ source image, and added a unit test to check for this error. [6] The Java classes should now build properly under Visual Studio 2010 and later. +[7] Fixed an issue that prevented SRPMs generated using the in-tree packaging +tools from being rebuilt on certain newer Linux distributions. + +[8] Numerous minor fixes to eliminate compilation and build/packaging system +warnings, fix cosmetic issues, improve documentation clarity, and other general +source cleanup. + 1.3.0 ===== From 166227c3c7e2b2501f4ecd536e8b646dd00e0250 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 22 Mar 2014 20:51:38 +0000 Subject: [PATCH 874/985] Since we're now maintaining our own Cygwin pseudo-repository directories instead of recommending that users install these packages from a local source, it makes more sense to name the packages according to Cygwin specs, so they can be copied as-is into the pseudo-repository. --- release/makecygwinpkg.in | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/release/makecygwinpkg.in b/release/makecygwinpkg.in index 5a5338a7..f3035469 100755 --- a/release/makecygwinpkg.in +++ b/release/makecygwinpkg.in @@ -17,19 +17,15 @@ onexit() PACKAGE_NAME=@PKGNAME@ VERSION=@VERSION@ +BUILD=@BUILD@ SRCDIR=@abs_top_srcdir@ -RPMARCH=@RPMARCH@ -PLATFORM=cygwin PREFIX=%{__prefix} DOCDIR=%{__docdir} LIBDIR=%{__libdir} umask 022 -if [ "$RPMARCH" = "x86_64" ]; then - PLATFORM=cygwin64 -fi -rm -f $PACKAGE_NAME-$VERSION-$PLATFORM.tar.bz2 +rm -f $PACKAGE_NAME-$VERSION-$BUILD.tar.bz2 TMPDIR=`mktemp -d /tmp/ljtbuild.XXXXXX` __PWD=`pwd` make install DESTDIR=$TMPDIR/pkg docdir=/usr/share/doc/$PACKAGE_NAME-$VERSION \ @@ -39,7 +35,7 @@ if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$DOCDIR" = "/opt/libjpeg-turbo/doc" ]; ln -fs /usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/pkg$DOCDIR fi cd $TMPDIR/pkg -tar cfj ../$PACKAGE_NAME-$VERSION-$PLATFORM.tar.bz2 * +tar cfj ../$PACKAGE_NAME-$VERSION-$BUILD.tar.bz2 * cd $__PWD mv $TMPDIR/*.tar.bz2 . From 87768cc42cb0a6aa0d94a36a4c6cbcca15437b83 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 22 Mar 2014 23:03:03 +0000 Subject: [PATCH 875/985] Fix Windows build --- java/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 19127e30..f9f9e572 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -8,6 +8,7 @@ set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ org/libjpegturbo/turbojpeg/TJScalingFactor org/libjpegturbo/turbojpeg/TJTransform org/libjpegturbo/turbojpeg/TJTransformer + org/libjpegturbo/turbojpeg/YUVImage TJUnitTest TJExample TJBench) From fdc2954e7924b1bc528d0284f263bcada1c366cd Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 23 Mar 2014 15:21:20 +0000 Subject: [PATCH 876/985] Remove the sections about replacing libjpeg at run time and compile time. These were written before O/S distributions started shipping libjpeg-turbo, and they are either pedantic or no longer relevant. Also remove any text that assumes the use of our official project binaries. Notes specific to the official binaries have been moved into the project wiki. --- README-turbo.txt | 127 +---------------------------------------------- 1 file changed, 1 insertion(+), 126 deletions(-) diff --git a/README-turbo.txt b/README-turbo.txt index b81299f1..24e86ed2 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -81,131 +81,6 @@ JPEG images: There is no significant performance advantage to either API when both are used to perform similar operations. -====================== -Installation Directory -====================== - -This document assumes that libjpeg-turbo will be installed in the default -directory (/opt/libjpeg-turbo on Un*x and Mac systems and -c:\libjpeg-turbo[-gcc][64] on Windows systems. If your installation of -libjpeg-turbo resides in a different directory, then adjust the instructions -accordingly. - -============================= -Replacing libjpeg at Run Time -============================= - -Un*x ----- - -If a Un*x application is dynamically linked with libjpeg, then you can replace -libjpeg with libjpeg-turbo at run time by manipulating LD_LIBRARY_PATH. -For instance: - - [Using libjpeg] - > time cjpeg vgl_5674_0098.jpg - real 0m0.392s - user 0m0.074s - sys 0m0.020s - - [Using libjpeg-turbo] - > export LD_LIBRARY_PATH=/opt/libjpeg-turbo/{lib}:$LD_LIBRARY_PATH - > time cjpeg vgl_5674_0098.jpg - real 0m0.109s - user 0m0.029s - sys 0m0.010s - -({lib} = lib32 or lib64, depending on whether you wish to use the 32-bit or the -64-bit version of libjpeg-turbo.) - -System administrators can also replace the libjpeg symlinks in /usr/lib* with -links to the libjpeg-turbo dynamic library located in /opt/libjpeg-turbo/{lib}. -This will effectively accelerate every application that uses the libjpeg -dynamic library on the system. - -Windows -------- - -If a Windows application is dynamically linked with libjpeg, then you can -replace libjpeg with libjpeg-turbo at run time by backing up the application's -copy of jpeg62.dll, jpeg7.dll, or jpeg8.dll (assuming the application has its -own local copy of this library) and copying the corresponding DLL from -libjpeg-turbo into the application's install directory. The official -libjpeg-turbo binary packages only provide jpeg62.dll. If the application uses -jpeg7.dll or jpeg8.dll instead, then it will be necessary to build -libjpeg-turbo from source (see "libjpeg v7 and v8 API/ABI Emulation" below.) - -The following information is specific to the official libjpeg-turbo binary -packages for Visual C++: - --- jpeg62.dll requires the Visual C++ 2008 C run-time DLL (msvcr90.dll). -msvcr90.dll ships with more recent versions of Windows, but users of older -Windows releases can obtain it from the Visual C++ 2008 Redistributable -Package, which is available as a free download from Microsoft's web site. - --- Features of the libjpeg API that require passing a C run-time structure, -such as a file handle, from an application to the library will probably not -work with jpeg62.dll, unless the application is also built to use the Visual -C++ 2008 C run-time DLL. In particular, this affects jpeg_stdio_dest() and -jpeg_stdio_src(). - -Mac ---- - -Mac applications typically embed their own copies of the libjpeg dylib inside -the (hidden) application bundle, so it is not possible to globally replace -libjpeg on OS X systems. Replacing the application's version of the libjpeg -dylib would generally involve copying libjpeg.*.dylib from libjpeg-turbo into -the appropriate place in the application bundle and using install_name_tool to -repoint the libjpeg-turbo dylib to its new directory. This requires an -advanced knowledge of OS X and would not survive an upgrade or a re-install of -the application. Thus, it is not recommended for most users. - -======================================== -Using libjpeg-turbo in Your Own Programs -======================================== - -For the most part, libjpeg-turbo should work identically to libjpeg, so in -most cases, an application can be built against libjpeg and then run against -libjpeg-turbo. On Un*x systems and Cygwin, you can build against libjpeg-turbo -instead of libjpeg by setting - - CPATH=/opt/libjpeg-turbo/include - and - LIBRARY_PATH=/opt/libjpeg-turbo/{lib} - -({lib} = lib32 or lib64, depending on whether you are building a 32-bit or a -64-bit application.) - -If using MinGW, then set - - CPATH=/c/libjpeg-turbo-gcc[64]/include - and - LIBRARY_PATH=/c/libjpeg-turbo-gcc[64]/lib - -Building against libjpeg-turbo is useful, for instance, if you want to build an -application that leverages the libjpeg-turbo colorspace extensions (see below.) -On Un*x systems, you would still need to manipulate LD_LIBRARY_PATH or create -appropriate symlinks to use libjpeg-turbo at run time. On such systems, you -can pass -R /opt/libjpeg-turbo/{lib} to the linker to force the use of -libjpeg-turbo at run time rather than libjpeg (also useful if you want to -leverage the colorspace extensions), or you can link against the libjpeg-turbo -static library. - -To force a Un*x or MinGW application to link against the static version of -libjpeg-turbo, you can use the following linker options: - - -Wl,-Bstatic -ljpeg -Wl,-Bdynamic - -On OS X, simply add /opt/libjpeg-turbo/lib/libjpeg.a to the linker command -line. - -To build Visual C++ applications using libjpeg-turbo, add -c:\libjpeg-turbo[64]\include to the system or user INCLUDE environment -variable and c:\libjpeg-turbo[64]\lib to the system or user LIB environment -variable, and then link against either jpeg.lib (to use the DLL version of -libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.) - ===================== Colorspace Extensions ===================== @@ -265,7 +140,7 @@ compression and decompression structures. Unfortunately, due to the exposed nature of those structures, extending them also necessitated breaking backward ABI compatibility with previous libjpeg releases. Thus, programs that were built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is -based on the libjpeg v6b code base. Although libjpeg v7 and v8 are still not +based on the libjpeg v6b code base. Although libjpeg v7 and v8 are not as widely used as v6b, enough programs (including a few Linux distros) made the switch that there was a demand to emulate the libjpeg v7 and v8 ABIs in libjpeg-turbo. It should be noted, however, that this feature was added From aa411b107f4c1d0bfc9d249db436f8fee98d36df Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 23 Mar 2014 17:53:07 +0000 Subject: [PATCH 877/985] Migrate Mac packaging system to pkgbuild, since PackageMaker is no longer supported. --- ChangeLog.txt | 6 +++++ configure.ac | 2 -- release/Description.plist.in | 12 ---------- release/Distribution.xml | 24 ++++++++++++++++++++ release/Info.plist.in | 44 ------------------------------------ release/ReadMe.rtf | 13 ----------- release/ReadMe.txt | 5 ++++ release/makemacpkg.in | 22 ++++++++---------- 8 files changed, 45 insertions(+), 83 deletions(-) delete mode 100644 release/Description.plist.in create mode 100644 release/Distribution.xml delete mode 100755 release/Info.plist.in delete mode 100644 release/ReadMe.rtf create mode 100644 release/ReadMe.txt diff --git a/ChangeLog.txt b/ChangeLog.txt index fb148caa..4b3db1ee 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -33,6 +33,12 @@ successfully decompressed by libjpeg-turbo without additional work on the part of the application. An application can still override the Huffman tables, for instance to re-use tables from a previous frame of the same video. +[4] The Mac packaging system now uses pkgbuild and productbuild rather than +PackageMaker (which is obsolete and no longer supported.) This means that +OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, +although the packages produced can be installed on OS X 10.5 "Leopard" or +later. OS X 10.4 "Tiger" is no longer supported. + 1.3.1 ===== diff --git a/configure.ac b/configure.ac index 4173f25d..ff5cf668 100644 --- a/configure.ac +++ b/configure.ac @@ -530,8 +530,6 @@ AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.i AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in]) AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in]) AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in]) -AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in]) -AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in]) AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in]) if test "x$with_turbojpeg" != "xno"; then AC_CONFIG_FILES([tjbenchtest]) diff --git a/release/Description.plist.in b/release/Description.plist.in deleted file mode 100644 index 46a5bceb..00000000 --- a/release/Description.plist.in +++ /dev/null @@ -1,12 +0,0 @@ - - - - - IFPkgDescriptionDescription - A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs - IFPkgDescriptionTitle - @PACKAGE_NAME@ - IFPkgDescriptionVersion - @VERSION@ - - diff --git a/release/Distribution.xml b/release/Distribution.xml new file mode 100644 index 00000000..ee73ab00 --- /dev/null +++ b/release/Distribution.xml @@ -0,0 +1,24 @@ + + + libjpeg-turbo + + + + + + + + + + + + + + + libjpeg-turbo.pkg + diff --git a/release/Info.plist.in b/release/Info.plist.in deleted file mode 100755 index 05750791..00000000 --- a/release/Info.plist.in +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleGetInfoString - @VERSION@, The libjpeg-turbo Project - CFBundleIdentifier - com.libjpeg-turbo.libjpeg-turbo - CFBundleShortVersionString - @VERSION@ - IFMajorVersion - 1 - IFMinorVersion - @BUILD@ - IFPkgFlagAllowBackRev - - IFPkgFlagAuthorizationAction - AdminAuthorization - IFPkgFlagBackgroundAlignment - topleft - IFPkgFlagBackgroundScaling - none - IFPkgFlagDefaultLocation - / - IFPkgFlagFollowLinks - - IFPkgFlagInstallFat - - IFPkgFlagIsRequired - - IFPkgFlagOverwritePermissions - - IFPkgFlagRelocatable - - IFPkgFlagRestartAction - NoRestart - IFPkgFlagRootVolumeOnly - - IFPkgFlagUpdateInstalledLanguages - - IFPkgFormatVersion - 0.10000000149011612 - - diff --git a/release/ReadMe.rtf b/release/ReadMe.rtf deleted file mode 100644 index 2ae48780..00000000 --- a/release/ReadMe.rtf +++ /dev/null @@ -1,13 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\margl1440\margr1440\vieww26380\viewh15840\viewkind0 -\deftab720 -\pard\pardeftab720\ql\qnatural - -\f0\fs24 \cf0 libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as libjpeg, all else being equal. On other types of systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by virtue of its highly-optimized Huffman coding routines. In many cases, the performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.\ -\ -libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API. libjpeg-turbo also features colorspace extensions that allow it to compress from/decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java interface.\ -\ -libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.\ -} \ No newline at end of file diff --git a/release/ReadMe.txt b/release/ReadMe.txt new file mode 100644 index 00000000..b9f6ca57 --- /dev/null +++ b/release/ReadMe.txt @@ -0,0 +1,5 @@ +libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as libjpeg, all else being equal. On other types of systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by virtue of its highly-optimized Huffman coding routines. In many cases, the performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs. + +libjpeg-turbo implements both the traditional libjpeg API as well as the less powerful but more straightforward TurboJPEG API. libjpeg-turbo also features colorspace extensions that allow it to compress from/decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java interface. + +libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, and in early 2010, libjpeg-turbo spun off into an independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers. diff --git a/release/makemacpkg.in b/release/makemacpkg.in index 65abdefe..16c18deb 100644 --- a/release/makemacpkg.in +++ b/release/makemacpkg.in @@ -11,7 +11,7 @@ TMPDIR= onexit() { if [ ! "$TMPDIR" = "" ]; then - sudo rm -rf $TMPDIR + rm -rf $TMPDIR fi } @@ -78,7 +78,6 @@ while [ $# -gt 0 ]; do esac shift done -PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker if [ -f $PACKAGE_NAME-$VERSION.dmg ]; then rm -f $PACKAGE_NAME-$VERSION.dmg @@ -245,21 +244,20 @@ if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$LIBDIR" = "/opt/libjpeg-turbo/lib" ]; fi fi -chmod 1775 $PKGROOT/Library -chmod 775 $PKGROOT/Library/Documentation -mkdir -p $TMPDIR/pkg/Resources +mkdir -p $TMPDIR/pkg -cp pkgscripts/Description.plist $TMPDIR/pkg/ -cp pkgscripts/Info.plist $TMPDIR/pkg/ install -m 755 pkgscripts/uninstall $PKGROOT/$BINDIR/ -sudo chown -R root:admin $PKGROOT -cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.rtf $TMPDIR/pkg/Resources/ +find $PKGROOT -type f | while read file; do xattr -c $file; done + +cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.txt $TMPDIR/pkg/ mkdir $TMPDIR/dmg -$PACKAGEMAKER -build -v -p $TMPDIR/dmg/$PACKAGE_NAME.pkg \ - -f $PKGROOT -r $TMPDIR/pkg/Resources \ - -i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist +pkgbuild --root $PKGROOT --version $VERSION.$BUILD \ + --identifier com.libjpeg-turbo.libjpeg-turbo $TMPDIR/pkg/$PACKAGE_NAME.pkg +productbuild --distribution $SRCDIR/release/Distribution.xml \ + --package-path $TMPDIR/pkg/ --resources $TMPDIR/pkg/ \ + $TMPDIR/dmg/$PACKAGE_NAME.pkg hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \ -srcfolder "$TMPDIR/dmg" $TMPDIR/$PACKAGE_NAME-$VERSION.dmg cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg . From af1966457180ed0793d80f7022664bdeccb90ab1 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 23 Mar 2014 18:06:11 +0000 Subject: [PATCH 878/985] Remove any claims of support for OS X 10.4 "Tiger" (the packaging system overhaul produces packages that require Leopard or later, and I haven't been able to test Tiger for years anyhow.) Update TurboJPEG shared library version. --- BUILDING.txt | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index adf4eaab..d50ad428 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -50,12 +50,12 @@ Build Requirements is suggested that you install Apple GCC v4.2 through MacPorts. -- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is - required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red - Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and - later, it will be necessary to install the Java Developer Package, which can - be downloaded from http://developer.apple.com/downloads (Apple ID required.) - For systems that do not have a JDK installed, you can obtain the Oracle Java - Development Kit from http://www.java.com. + required. Some systems, such as Solaris 10 and later and Red Hat Enterprise + Linux 5 and later, have this pre-installed. On OS X 10.5 and later, it will + be necessary to install the Java Developer Package, which can be downloaded + from http://developer.apple.com/downloads (Apple ID required.) For systems + that do not have a JDK installed, you can obtain the Oracle Java Development + Kit from http://www.java.com. ================== @@ -113,8 +113,8 @@ This will generate the following files under .libs/ libturbojpeg.a Static link library for the TurboJPEG API - libturbojpeg.so.0.0.0 (Linux, Unix) - libturbojpeg.0.0.0.dylib (OS X) + libturbojpeg.so.0.1.0 (Linux, Unix) + libturbojpeg.0.1.0.dylib (OS X) cygturbojpeg-0.dll (Cygwin) Shared library for the TurboJPEG API @@ -243,12 +243,12 @@ to the configure command line. Add --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \ - CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ - -mmacosx-version-min=10.4 -O3' \ - LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ - -mmacosx-version-min=10.4' + CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -mmacosx-version-min=10.5 -O3' \ + LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -mmacosx-version-min=10.5' -to the configure command line. The OS X 10.4 SDK, and NASM 2.07 or later from +to the configure command line. The OS X 10.5 SDK, and NASM 2.07 or later from MacPorts, must be installed. @@ -258,12 +258,12 @@ MacPorts, must be installed. Add --host i686-apple-darwin \ - CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ - -mmacosx-version-min=10.4 -O3 -m32' \ - LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ - -mmacosx-version-min=10.4 -m32' + CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -mmacosx-version-min=10.5 -O3 -m32' \ + LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ + -mmacosx-version-min=10.5 -m32' -to the configure command line. The OS X 10.4 SDK must be installed. +to the configure command line. The OS X 10.5 SDK must be installed. 64-bit Library Build on 64-bit Solaris From 86612bf441f58e25471fd62df9ebb14ab34d1754 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 25 Mar 2014 05:27:16 +0000 Subject: [PATCH 879/985] Update build instructions to reflect the use of pkgbuild/productbuild --- BUILDING.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index d50ad428..7f1ea7af 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -712,11 +712,11 @@ make deb make dmg - Create Macintosh package/disk image. This requires the PackageMaker - application, which must be installed in /Developer/Applications/Utilities. - Note that PackageMaker is not included in recent releases of Xcode, but it - can be obtained by downloading the "Auxiliary Tools for Xcode" package from - http://developer.apple.com/downloads. + Create Macintosh package/disk image. This requires pkgbuild and + productbuild, which are installed by default on OS X 10.7 and later and which + can be obtained by installing Xcode 3.2.6 (with the "Unix Development" + option) on OS X 10.6. Packages built in this manner can be installed on OS X + 10.5 and later, but they must be built on OS X 10.6 or later. make udmg [BUILDDIR32={32-bit build directory}] From 5610bb1fec0ae821c8e86cc364964bbb74f8d49c Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 27 Mar 2014 03:35:21 +0000 Subject: [PATCH 880/985] Make iOS build instructions more generic and applicable to all versions of Xcode; modify iOS build procedure for Xcode 5.0 and later to fix a build issue with Xcode 5.1. --- BUILDING.txt | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 7f1ea7af..df26b1a2 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -339,24 +339,16 @@ Additional build requirements: Set the following shell variables for simplicity: - Xcode 3.2.x / iOS 4.3 SDK: + Xcode 4.2 and earlier: IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS4.3.sdk - IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 - - Xcode 4.5.x / iOS 6.0 SDK: + Xcode 4.3 and later: IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.0.sdk - IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 - Xcode 4.6.x / iOS 6.1 SDK: - IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.1.sdk - IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 + IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk - Xcode 5.0.x / iOS 7.0 SDK: - IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS7.0.sdk + Xcode 4.6.x and earlier: + IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 + Xcode 5.0.x and later: IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang ARM v6 only (up to and including iPhone 3G): @@ -364,17 +356,17 @@ Set the following shell variables for simplicity: IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp" ARM v7 only (iPhone 3GS-4S, iPad 1st-3rd Generation): - GCC: + Xcode 4.6.x and earlier: IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon" - Clang: - IOS_CFLAGS="-arch armv7 -no-integrated-as" + Xcode 5.0.x and later: + IOS_CFLAGS="-arch armv7" ARM v7s only (iPhone 5, iPad 4th Generation): [NOTE: Requires Xcode 4.5 or later] - GCC + Xcode 4.6.x and earlier: IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon" - Clang: - IOS_CFLAGS="-arch armv7s -no-integrated-as" + Xcode 5.0.x and later: + IOS_CFLAGS="-arch armv7s" Follow the procedure under "Building libjpeg-turbo" above, adding @@ -383,8 +375,16 @@ Follow the procedure under "Building libjpeg-turbo" above, adding CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" +to the configure command line. If using Xcode 5.0.x or later, also add + + CCASFLAGS="-no-integrated-as $IOS_CFLAGS" + to the configure command line. +NOTE: You can also add -miphoneos-version-min={version} to $IOS_CFLAGS above +in order to support older versions of iOS than the default version supported by +the SDK. + Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants into a universal library. From a60728cb34ec5ad186b3115d26576de90323afda Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 28 Mar 2014 18:33:25 +0000 Subject: [PATCH 881/985] Use clz/bsr instructions on ARM for bit counting rather than the lookup table (reduces memory footprint and can improve performance in some cases.) --- ChangeLog.txt | 9 +++++++++ jchuff.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4b3db1ee..36e8a5b6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -39,6 +39,15 @@ OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, although the packages produced can be installed on OS X 10.5 "Leopard" or later. OS X 10.4 "Tiger" is no longer supported. +[5] The Huffman encoder now uses clz and bsr instructions for bit counting on +ARM platforms rather than a lookup table. This reduces the memory footprint +by 64k, which may be important for some mobile applications. Out of four +Android devices that were tested, two demonstrated a small loss (~3-4% on +average) with ARMv6 code and a small gain (also ~3-4%) with ARMv7 code when +enabling this new feature, but the other two devices demonstrated a +significant performance gain across the board (~10-20%.) Actual mileage may +vary. + 1.3.1 ===== diff --git a/jchuff.c b/jchuff.c index 29bf3892..68e4e0e0 100644 --- a/jchuff.c +++ b/jchuff.c @@ -22,8 +22,36 @@ #include "jchuff.h" /* Declarations shared with jcphuff.c */ #include +/* + * NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be + * used for bit counting rather than the lookup table. This will reduce the + * memory footprint by 64k, which is important for some mobile applications + * that create many isolated instances of libjpeg-turbo (web browsers, for + * instance.) This may improve performance on some mobile platforms as well. + * This feature is enabled by default only on ARM processors, because some x86 + * chips have a slow implementation of bsr, and the use of clz/bsr cannot be + * shown to have a significant performance impact even on the x86 chips that + * have a fast implementation of it. When building for ARMv6, you can + * explicitly disable the use of clz/bsr by adding -mthumb to the compiler + * flags (this defines __thumb__). + */ + +/* NOTE: Both GCC and Clang define __GNUC__ */ +#if defined __GNUC__ && defined __arm__ +#if !defined __thumb__ || defined __thumb2__ +#define USE_CLZ_INTRINSIC +#endif +#endif + +#ifdef USE_CLZ_INTRINSIC +#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x)) +#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0) +#else static unsigned char jpeg_nbits_table[65536]; static int jpeg_nbits_table_init = 0; +#define JPEG_NBITS(x) (jpeg_nbits_table[x]) +#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x) +#endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) @@ -272,6 +300,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, dtbl->ehufsi[i] = huffsize[p]; } +#ifndef USE_CLZ_INTRINSIC if(!jpeg_nbits_table_init) { for(i = 0; i < 65536; i++) { int nbits = 0, temp = i; @@ -280,6 +309,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, } jpeg_nbits_table_init = 1; } +#endif } @@ -482,7 +512,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, temp2 += temp3; /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = jpeg_nbits_table[temp]; + nbits = JPEG_NBITS(temp); /* Emit the Huffman-coded symbol for the number of bits */ code = dctbl->ehufco[nbits]; @@ -516,7 +546,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, temp ^= temp3; \ temp -= temp3; \ temp2 += temp3; \ - nbits = jpeg_nbits_table[temp]; \ + nbits = JPEG_NBITS_NONZERO(temp); \ /* if run length > 15, must emit special run-length-16 codes (0xF0) */ \ while (r > 15) { \ EMIT_BITS(code_0xf0, size_0xf0) \ From 038cf66ab2b7f69ba818d3424e08a5be4cecd543 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 28 Mar 2014 18:50:30 +0000 Subject: [PATCH 882/985] Integrate a slightly modified version of Mozilla's patch for precomputing the bit-counting LUT. This is useful if the table needs to be shared among multiple processes, although the primary reason for doing that is reduced footprint on mobile devices, which are probably already covered by the clz intrinsic code. --- jchuff.c | 14 +- jpeg_nbits_table.h | 4098 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 4099 insertions(+), 13 deletions(-) create mode 100644 jpeg_nbits_table.h diff --git a/jchuff.c b/jchuff.c index 68e4e0e0..398d2a11 100644 --- a/jchuff.c +++ b/jchuff.c @@ -47,8 +47,7 @@ #define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x)) #define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0) #else -static unsigned char jpeg_nbits_table[65536]; -static int jpeg_nbits_table_init = 0; +#include "jpeg_nbits_table.h" #define JPEG_NBITS(x) (jpeg_nbits_table[x]) #define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x) #endif @@ -299,17 +298,6 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, dtbl->ehufco[i] = huffcode[p]; dtbl->ehufsi[i] = huffsize[p]; } - -#ifndef USE_CLZ_INTRINSIC - if(!jpeg_nbits_table_init) { - for(i = 0; i < 65536; i++) { - int nbits = 0, temp = i; - while (temp) {temp >>= 1; nbits++;} - jpeg_nbits_table[i] = nbits; - } - jpeg_nbits_table_init = 1; - } -#endif } diff --git a/jpeg_nbits_table.h b/jpeg_nbits_table.h new file mode 100644 index 00000000..fcf73878 --- /dev/null +++ b/jpeg_nbits_table.h @@ -0,0 +1,4098 @@ +static const unsigned char jpeg_nbits_table[65536] = { + 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; From 222279a4f04d96869ee1bcdf75c758485028a6c8 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 15 Apr 2014 03:07:44 +0000 Subject: [PATCH 883/985] wordsmithing --- ChangeLog.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 36e8a5b6..ed32eb9d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -42,11 +42,11 @@ later. OS X 10.4 "Tiger" is no longer supported. [5] The Huffman encoder now uses clz and bsr instructions for bit counting on ARM platforms rather than a lookup table. This reduces the memory footprint by 64k, which may be important for some mobile applications. Out of four -Android devices that were tested, two demonstrated a small loss (~3-4% on -average) with ARMv6 code and a small gain (also ~3-4%) with ARMv7 code when -enabling this new feature, but the other two devices demonstrated a -significant performance gain across the board (~10-20%.) Actual mileage may -vary. +Android devices that were tested, two demonstrated a small overall performance +loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with +ARMv7 code when enabling this new feature, but the other two devices +demonstrated a significant overall performance gain with both ARMv6 and ARMv7 +code (~10-20%.) Actual mileage may vary. 1.3.1 From 9e74f518bdd1affb59094b5e830e6da3d3d060b0 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 15 Apr 2014 03:41:31 +0000 Subject: [PATCH 884/985] wordsmithing --- configure.ac | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index ff5cf668..9bfbf428 100644 --- a/configure.ac +++ b/configure.ac @@ -520,10 +520,11 @@ AC_SUBST(DEBARCH) AC_SUBST(BUILD) AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number]) -# jconfig.h is the file we use, but we have another before that to -# fool autoheader. the reason is that we include this header in our -# API headers, which can screw things up for users of the lib. -# jconfig.h is a minimal version that allows this package to be built +# NOTE: autoheader automatically modifies the input file of the first +# invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent +# jconfig.h.in from being clobbered. config.h is used only internally, whereas +# jconfig.h contains macros that are relevant to external programs (macros that +# specify which features were built into the library.) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([jconfig.h]) AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in]) From 2dac0fbd0498ad4a3f8d46a97e7fcbc2f5adb36a Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 15 Apr 2014 03:42:40 +0000 Subject: [PATCH 885/985] Remove trailing spaces --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c8c066dc..63accbbc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -108,7 +108,7 @@ endif cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \ - rdppm.c rdswitch.c rdtarga.c + rdppm.c rdswitch.c rdtarga.c cjpeg_LDADD = libjpeg.la @@ -146,7 +146,7 @@ DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.txt \ docdir = $(datadir)/doc dist_doc_DATA = README README-turbo.txt libjpeg.txt structure.txt usage.txt \ - wizard.txt + wizard.txt exampledir = $(datadir)/doc dist_example_DATA = example.c From 2e3f284fa57d71e99ac05379f14eb98206c017b7 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 16 Apr 2014 23:29:38 +0000 Subject: [PATCH 886/985] Set the BUILD environment variable properly when building with MinGW implementations that lack a Unix shell (TDM-GCC, for instance); Only set CMP0022 if it is supported (older CMake implementations don't support it); Remove trailing spaces --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d80933e1..273d6846 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,15 @@ # cmake_minimum_required(VERSION 2.8.8) -cmake_policy(SET CMP0022 OLD) +# Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES +if(POLICY CMP0022) + cmake_policy(SET CMP0022 OLD) +endif() project(libjpeg-turbo C) set(VERSION 1.3.80) -if(MINGW OR CYGWIN) +if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) string(REGEX REPLACE "\n" "" BUILD ${BUILD}) elseif(WIN32) @@ -475,7 +478,7 @@ else() set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") endif() -STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) +STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) @@ -495,7 +498,7 @@ install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench ) install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt - ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt + ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt ${CMAKE_SOURCE_DIR}/wizard.txt DESTINATION doc) From e223a7ee9eb6b8da739c5466cd1fb0f0a41fa3d8 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 16 Apr 2014 23:32:58 +0000 Subject: [PATCH 887/985] Fix compiler warning ("always_inline function might not be inlinable") when building with recent versions of GCC; Unix EOL --- win/config.h.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win/config.h.in b/win/config.h.in index ff556c4e..2131bf52 100644 --- a/win/config.h.in +++ b/win/config.h.in @@ -1,10 +1,10 @@ -#define VERSION "@VERSION@" -#define BUILD "@BUILD@" -#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@" +#define VERSION "@VERSION@" +#define BUILD "@BUILD@" +#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@" #ifndef INLINE #if defined(__GNUC__) -#define INLINE __attribute__((always_inline)) +#define INLINE inline __attribute__((always_inline)) #elif defined(_MSC_VER) #define INLINE __forceinline #else From 378f4528ad397585ab8e05f9b7aa2d25a02f7786 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 16 Apr 2014 23:38:37 +0000 Subject: [PATCH 888/985] Fix warnings about unused variables when building with GCC 4.8.x --- tjbench.c | 8 ++++---- turbojpeg.c | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tjbench.c b/tjbench.c index b09cdaaf..ff09cb77 100644 --- a/tjbench.c +++ b/tjbench.c @@ -273,7 +273,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, } -void fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual, +int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual, char *filename) { char tempstr[1024], tempstr2[80]; @@ -470,11 +470,11 @@ void fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual, if(jpegsize) {free(jpegsize); jpegsize=NULL;} if(tmpbuf) {free(tmpbuf); tmpbuf=NULL;} if(handle) {tjDestroy(handle); handle=NULL;} - return; + return retval; } -void decompTest(char *filename) +int decompTest(char *filename) { FILE *file=NULL; tjhandle handle=NULL; unsigned char **jpegbuf=NULL, *srcbuf=NULL; @@ -693,7 +693,7 @@ void decompTest(char *filename) if(srcbuf) {free(srcbuf); srcbuf=NULL;} if(t) {free(t); t=NULL;} if(handle) {tjDestroy(handle); handle=NULL;} - return; + return retval; } diff --git a/turbojpeg.c b/turbojpeg.c index 5aee2e81..c8241329 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -122,6 +122,16 @@ static const tjscalingfactor sf[NUMSF]={ if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ return -1;} \ cinfo=&this->cinfo; dinfo=&this->dinfo; +#define getcinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_compress_ptr cinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + cinfo=&this->cinfo; +#define getdinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_decompress_ptr dinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + dinfo=&this->dinfo; static int getPixelFormat(int pixelSize, int flags) { @@ -605,7 +615,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle) + getcinstance(handle) if((this->init&COMPRESS)==0) _throw("tjCompress2(): Instance has not been initialized for compression"); @@ -710,7 +720,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle); + getcinstance(handle); for(i=0; iinit&DECOMPRESS)==0) _throw("tjDecompressHeader3(): Instance has not been initialized for decompression"); @@ -1131,7 +1141,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, unsigned char *_dstBuf=NULL; int _pitch=0; #endif - getinstance(handle); + getdinstance(handle); if((this->init&DECOMPRESS)==0) _throw("tjDecompress2(): Instance has not been initialized for decompression"); @@ -1303,7 +1313,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, JMETHOD(int, old_read_markers, (j_decompress_ptr)); JMETHOD(void, old_reset_marker_reader, (j_decompress_ptr)); - getinstance(handle); + getdinstance(handle); for(i=0; i Date: Thu, 17 Apr 2014 20:05:03 +0000 Subject: [PATCH 889/985] Update Windows build instructions --- BUILDING.txt | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index df26b1a2..e98a86a9 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -404,7 +404,7 @@ infer tagged configuration." Build Requirements ================== --- CMake (http://www.cmake.org) v2.6 or later +-- CMake (http://www.cmake.org) v2.8.8 or later -- Microsoft Visual C++ 2005 or later @@ -416,8 +416,9 @@ Build Requirements The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and everything necessary to build libjpeg-turbo. - * For 32-bit builds, you can also use Microsoft Visual C++ Express - Edition. Visual C++ Express Edition is a free download. + * You can also use Microsoft Visual Studio Express Edition, which is a free + download. (NOTE: versions prior to 2012 can only be used to build 32-bit + code.) * If you intend to build libjpeg-turbo from the command line, then add the appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH environment variables. This is generally accomplished by executing @@ -431,7 +432,11 @@ Build Requirements -- MinGW - GCC v4.1 or later recommended for best performance + MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or + tdm-gcc (http://tdm-gcc.tdragon.net/) recommended if building on a Windows + machine. Both distributions install a Start Menu link that can be used to + launch a command prompt with the appropriate compiler paths automatically + set. -- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for a 64-bit build) @@ -496,7 +501,7 @@ Choose the appropriate CMake generator option for your version of Visual Studio instance: cd {build_directory} - cmake -G "Visual Studio 9 2008" {source_directory} + cmake -G "Visual Studio 10" {source_directory} You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project ("Debug", "Release", etc.) to generate a full @@ -525,9 +530,12 @@ depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. MinGW ----- +NOTE: This assumes that you are building on a Windows machine. If you are +cross-compiling on a Linux/Unix machine, then see "Build Recipes" below. + cd {build_directory} - cmake -G "MSYS Makefiles" {source_directory} - make + cmake -G "MinGW Makefiles" {source_directory} + mingw32-make This will generate the following files under {build_directory} @@ -636,8 +644,8 @@ Build Recipes cd {build_directory} CC=/usr/bin/x86_64-w64-mingw32-gcc \ cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ - -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory} + -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \ + {source_directory} make This produces a 64-bit build of libjpeg-turbo that does not depend on @@ -651,8 +659,8 @@ mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. cd {build_directory} CC=/usr/bin/i686-w64-mingw32-gcc \ cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \ - -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory} + -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \ + {source_directory} make This produces a 32-bit build of libjpeg-turbo that does not depend on @@ -660,21 +668,6 @@ cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. -MinGW-w64 Build on Windows --------------------------- - -This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64 -toolchain (which is faster than the Cygwin version): - - cd {build_directory} - CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \ - cmake -G "MSYS Makefiles" \ - -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \ - -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \ - {source_directory} - make - - MinGW Build on Linux -------------------- From 2dc2bbde6699a62e0874d537fe029c23baaece0c Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 18 Apr 2014 07:49:29 +0000 Subject: [PATCH 890/985] Clarify how to do a 64-bit build using the Visual Studio IDE --- BUILDING.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BUILDING.txt b/BUILDING.txt index e98a86a9..1cb28770 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -503,6 +503,11 @@ instance: cd {build_directory} cmake -G "Visual Studio 10" {source_directory} +NOTE: Add "Win64" to the generator name (e.g. "Visual Studio 10 Win64") to +build a 64-bit version of libjpeg-turbo. Recent versions of CMake no longer +document that. A separate build directory must be used for 32-bit and 64-bit +builds. + You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project ("Debug", "Release", etc.) to generate a full build of libjpeg-turbo. From 682c2b69f9925af255e6bb5cd6d71ffb27563461 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 18 Apr 2014 07:57:48 +0000 Subject: [PATCH 891/985] Minor comment correction (we support the full range of IDCT scaling factors now.) --- jpeglib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jpeglib.h b/jpeglib.h index 91668ed1..7386a2ed 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -144,8 +144,8 @@ typedef struct { /* Size of a DCT block in samples. Always DCTSIZE for compression. * For decompression this is the size of the output from one DCT block, * reflecting any scaling we choose to apply during the IDCT step. - * Values of 1,2,4,8 are likely to be supported. Note that different - * components may receive different IDCT scalings. + * Values from 1 to 16 are supported. + * Note that different components may receive different IDCT scalings. */ #if JPEG_LIB_VERSION >= 70 int DCT_h_scaled_size; From faac204f30c65d9e01259a3faa55e0bb95ecb79c Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 20 Apr 2014 06:57:52 +0000 Subject: [PATCH 892/985] Work around an issue in Visual C++ 2010 and 2013 that was causing the 256-bit bitmap test in the regression tests to fail. More specifically, when optimization is enabled in these versions of Visual C++, the optimizer seems to get confused by the following code block: delta = cur0 * 2; cur0 += delta; /* form error * 3 */ errorptr[0] = (FSERROR) (bpreverr0 + cur0); cur0 += delta; /* form error * 5 */ bpreverr0 = belowerr0 + cur0; cur0 += delta; /* form error * 7 */ Each time cur0 is incremented by delta, the compiled code doubles the value of delta (WTF?!) Thus, by the time the end of the block is reached, cur0 is equal to 15 times its former self, not 7 times its former self as it should be. At any rate, it was a lot simpler to just refactor the code so that it uses multiplication. --- ChangeLog.txt | 6 ++++++ jquant2.c | 57 ++++++++++++++++++++++----------------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ed32eb9d..84842e50 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -48,6 +48,12 @@ ARMv7 code when enabling this new feature, but the other two devices demonstrated a significant overall performance gain with both ARMv6 and ARMv7 code (~10-20%.) Actual mileage may vary. +[6] Worked around an issue with Visual C++ 2010 and later that caused incorrect +pixels to be generated when decompressing a JPEG image to a 256-color bitmap, +if compiler optimization was enabled when libjpeg-turbo was built. This caused +the regression tests to fail when doing a release build under Visual C++ 2010 +and later. + 1.3.1 ===== diff --git a/jquant2.c b/jquant2.c index 9b060e57..47a1f90a 100644 --- a/jquant2.c +++ b/jquant2.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009, D. R. Commander. + * Copyright (C) 2009, 2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains 2-pass color quantization (color mapping) routines. @@ -43,7 +43,7 @@ * color space, and repeatedly splits the "largest" remaining box until we * have as many boxes as desired colors. Then the mean color in each * remaining box becomes one of the possible output colors. - * + * * The second pass over the image maps each input pixel to the closest output * color (optionally after applying a Floyd-Steinberg dithering correction). * This mapping is logically trivial, but making it go fast enough requires @@ -261,7 +261,7 @@ find_biggest_color_pop (boxptr boxlist, int numboxes) register int i; register long maxc = 0; boxptr which = NULL; - + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->colorcount > maxc && boxp->volume > 0) { which = boxp; @@ -281,7 +281,7 @@ find_biggest_volume (boxptr boxlist, int numboxes) register int i; register INT32 maxv = 0; boxptr which = NULL; - + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->volume > maxv) { which = boxp; @@ -304,11 +304,11 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) int c0min,c0max,c1min,c1max,c2min,c2max; INT32 dist0,dist1,dist2; long ccount; - + c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; - + if (c0max > c0min) for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { @@ -388,7 +388,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; - + /* Now scan remaining volume of box and compute population */ ccount = 0; for (c0 = c0min; c0 <= c0max; c0++) @@ -495,11 +495,11 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) long c0total = 0; long c1total = 0; long c2total = 0; - + c0min = boxp->c0min; c0max = boxp->c0max; c1min = boxp->c1min; c1max = boxp->c1max; c2min = boxp->c2min; c2max = boxp->c2max; - + for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; @@ -512,7 +512,7 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) } } } - + cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); @@ -781,17 +781,17 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, bptr = bestdist; for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) *bptr++ = 0x7FFFFFFFL; - + /* For each color selected by find_nearby_colors, * compute its distance to the center of each cell in the box. * If that's less than best-so-far, update best distance and color number. */ - + /* Nominal steps between cell centers ("x" in Thomas article) */ #define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) #define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) #define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) - + for (i = 0; i < numcolors; i++) { icolor = GETJSAMPLE(colorlist[i]); /* Compute (square of) distance from minc0/c1/c2 to this color */ @@ -865,7 +865,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); - + /* Determine which colormap entries are close enough to be candidates * for the nearest entry to some cell in the update box. */ @@ -1025,32 +1025,23 @@ pass2_fs_dither (j_decompress_ptr cinfo, * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ - { register LOCFSERROR bnexterr, delta; + { register LOCFSERROR bnexterr; bnexterr = cur0; /* Process component 0 */ - delta = cur0 * 2; - cur0 += delta; /* form error * 3 */ - errorptr[0] = (FSERROR) (bpreverr0 + cur0); - cur0 += delta; /* form error * 5 */ - bpreverr0 = belowerr0 + cur0; + errorptr[0] = (FSERROR) (bpreverr0 + cur0 * 3); + bpreverr0 = belowerr0 + cur0 * 5; belowerr0 = bnexterr; - cur0 += delta; /* form error * 7 */ + cur0 *= 7; bnexterr = cur1; /* Process component 1 */ - delta = cur1 * 2; - cur1 += delta; /* form error * 3 */ - errorptr[1] = (FSERROR) (bpreverr1 + cur1); - cur1 += delta; /* form error * 5 */ - bpreverr1 = belowerr1 + cur1; + errorptr[1] = (FSERROR) (bpreverr1 + cur1 * 3); + bpreverr1 = belowerr1 + cur1 * 5; belowerr1 = bnexterr; - cur1 += delta; /* form error * 7 */ + cur1 *= 7; bnexterr = cur2; /* Process component 2 */ - delta = cur2 * 2; - cur2 += delta; /* form error * 3 */ - errorptr[2] = (FSERROR) (bpreverr2 + cur2); - cur2 += delta; /* form error * 5 */ - bpreverr2 = belowerr2 + cur2; + errorptr[2] = (FSERROR) (bpreverr2 + cur2 * 3); + bpreverr2 = belowerr2 + cur2 * 5; belowerr2 = bnexterr; - cur2 += delta; /* form error * 7 */ + cur2 *= 7; } /* At this point curN contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the From 8c1d7c702eb9b89074de09447185fd316c9ac15e Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 20 Apr 2014 09:13:37 +0000 Subject: [PATCH 893/985] This patch accomplishes the following: -- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.) -- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed. -- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h. This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h. --- CMakeLists.txt | 2 +- cjpeg.c | 2 +- configure.ac | 16 +++++++++------- djpeg.c | 2 +- jccolor.c | 2 +- jconfig.h.in | 26 ++++++++++++++++---------- jconfigint.h.in | 11 +++++++++++ jdcolor.c | 2 +- jdmerge.c | 2 +- jpegtran.c | 4 ++-- win/{config.h.in => jconfigint.h.in} | 0 11 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 jconfigint.h.in rename win/{config.h.in => jconfigint.h.in} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 273d6846..a1258570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,7 +143,7 @@ endif() message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") configure_file(win/jconfig.h.in jconfig.h) -configure_file(win/config.h.in config.h) +configure_file(win/jconfigint.h.in jconfigint.h) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/cjpeg.c b/cjpeg.c index 0c23fe7e..7f038198 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -28,7 +28,7 @@ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include "jversion.h" /* for version message */ -#include "config.h" +#include "jconfigint.h" #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ diff --git a/configure.ac b/configure.ac index 9bfbf428..8c3093cc 100644 --- a/configure.ac +++ b/configure.ac @@ -97,9 +97,9 @@ fi # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) +AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h]) AC_CHECK_HEADER([sys/types.h], - AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h])) + AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include to get size_t.])) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -131,7 +131,8 @@ AC_TRY_RUN( exit(is_shifting_signed(-0x7F7E80B1L)); }], [AC_MSG_RESULT(no) - AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])], + AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, + [Define if your (broken) compiler shifts signed values as if they were unsigned.])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) @@ -143,12 +144,12 @@ AC_TRY_LINK( [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(short) AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, - [Define if you need short function names])]) + [Define if linker requires that the first 15 characters of global names be unique.])]) # Checks for library functions. AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, - [Define if you have BSD-like bzero and bcopy])]) + [Define if you have BSD-like bzero and bcopy in rather than memset/memcpy in .])]) AC_MSG_CHECKING([libjpeg API version]) AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)]) @@ -265,7 +266,7 @@ AC_SUBST(VERSION_SCRIPT_FLAG) # Check for non-broken inline under various spellings AC_MSG_CHECKING(for inline) ljt_cv_inline="" -AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; } +AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; } int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))", AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; } int bar() { return foo();], ljt_cv_inline="__inline__", @@ -518,7 +519,7 @@ AC_SUBST(RPMARCH) AC_SUBST(RPM_CONFIG_ARGS) AC_SUBST(DEBARCH) AC_SUBST(BUILD) -AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number]) +AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number]) # NOTE: autoheader automatically modifies the input file of the first # invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent @@ -527,6 +528,7 @@ AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number]) # specify which features were built into the library.) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([jconfig.h]) +AC_CONFIG_HEADERS([jconfigint.h]) AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in]) AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in]) AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in]) diff --git a/djpeg.c b/djpeg.c index 589c5805..c1abb139 100644 --- a/djpeg.c +++ b/djpeg.c @@ -27,7 +27,7 @@ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include "jversion.h" /* for version message */ -#include "config.h" +#include "jconfigint.h" #include /* to declare isprint() */ diff --git a/jccolor.c b/jccolor.c index 94b41840..83184855 100644 --- a/jccolor.c +++ b/jccolor.c @@ -15,7 +15,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jsimd.h" -#include "config.h" +#include "jconfigint.h" /* Private subobject */ diff --git a/jconfig.h.in b/jconfig.h.in index 6b80ce29..78023c17 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -12,10 +12,10 @@ /* Support arithmetic decoding */ #undef D_ARITH_CODING_SUPPORTED -/* Support in-memory source/destination managers */ -#undef MEM_SRCDST_SUPPORTED +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H -/* Compiler supports function prototypes. */ +/* Define if your compiler supports prototypes */ #undef HAVE_PROTOTYPES /* Define to 1 if you have the header file. */ @@ -24,25 +24,31 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Compiler supports 'unsigned char'. */ +/* Define to 1 if the system has the type `unsigned char'. */ #undef HAVE_UNSIGNED_CHAR -/* Compiler supports 'unsigned short'. */ +/* Define to 1 if the system has the type `unsigned short'. */ #undef HAVE_UNSIGNED_SHORT -/* Compiler does not support pointers to unspecified structures. */ +/* Compiler does not support pointers to undefined structures. */ #undef INCOMPLETE_TYPES_BROKEN -/* Compiler has rather than standard . */ +/* Support in-memory source/destination managers */ +#undef MEM_SRCDST_SUPPORTED + +/* Define if you have BSD-like bzero and bcopy in rather than + memset/memcpy in . */ #undef NEED_BSD_STRINGS -/* Linker requires that global names be unique in first 15 characters. */ +/* Define if linker requires that the first 15 characters of global names be + unique. */ #undef NEED_SHORT_EXTERNAL_NAMES -/* Need to include in order to obtain size_t. */ +/* Define if you need to include to get size_t. */ #undef NEED_SYS_TYPES_H -/* Broken compiler shifts signed values as an unsigned shift. */ +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ #undef RIGHT_SHIFT_IS_UNSIGNED /* Use accelerated SIMD routines. */ diff --git a/jconfigint.h.in b/jconfigint.h.in new file mode 100644 index 00000000..8f216eb6 --- /dev/null +++ b/jconfigint.h.in @@ -0,0 +1,11 @@ +/* libjpeg-turbo build number */ +#undef BUILD + +/* How to obtain function inlining. */ +#undef INLINE + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Version number of package */ +#undef VERSION diff --git a/jdcolor.c b/jdcolor.c index ccf90479..458addac 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -16,7 +16,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jsimd.h" -#include "config.h" +#include "jconfigint.h" /* Private subobject */ diff --git a/jdmerge.c b/jdmerge.c index 9830be2c..cb1aa0a3 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -39,7 +39,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jsimd.h" -#include "config.h" +#include "jconfigint.h" #ifdef UPSAMPLE_MERGING_SUPPORTED diff --git a/jpegtran.c b/jpegtran.c index 54c8eceb..5bfab483 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -16,7 +16,7 @@ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include "transupp.h" /* Support routines for jpegtran */ #include "jversion.h" /* for version message */ -#include "config.h" +#include "jconfigint.h" #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ @@ -375,7 +375,7 @@ main (int argc, char **argv) jvirt_barray_ptr * dst_coef_arrays; int file_index; /* We assume all-in-memory processing and can therefore use only a - * single file pointer for sequential input and output operation. + * single file pointer for sequential input and output operation. */ FILE * fp; diff --git a/win/config.h.in b/win/jconfigint.h.in similarity index 100% rename from win/config.h.in rename to win/jconfigint.h.in From 2732926d8d63aa8b378a4e2551451b9760ba3848 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 20 Apr 2014 09:23:01 +0000 Subject: [PATCH 894/985] Fix 'make dist' --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 63accbbc..32f48e67 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,8 @@ nodist_include_HEADERS = jconfig.h HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \ - jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h + jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h \ + jpeg_nbits_table.h libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \ jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ From 4c778664d0f112b7814eead1b7a480fe39907c08 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 20 Apr 2014 09:42:49 +0000 Subject: [PATCH 895/985] Fix crashes and bogus output in the CMYK and decode-to-YUV features that occurred if JCS_EXTENSIONS wasn't defined. --- turbojpeg.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/turbojpeg.c b/turbojpeg.c index c8241329..5ce1594c 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -634,7 +634,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, if(pitch==0) pitch=width*tjPixelSize[pixelFormat]; #ifndef JCS_EXTENSIONS - if(pixelFormat!=TJPF_GRAY) + if(pixelFormat!=TJPF_GRAY && pixelFormat!=TJPF_CMYK) { rgbBuf=(unsigned char *)malloc(width*height*RGB_PIXELSIZE); if(!rgbBuf) _throw("tjCompress2(): Memory allocation failure"); @@ -749,7 +749,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, if(pitch==0) pitch=width*tjPixelSize[pixelFormat]; #ifndef JCS_EXTENSIONS - if(pixelFormat!=TJPF_GRAY) + if(pixelFormat!=TJPF_GRAY && pixelFormat!=TJPF_CMYK) { rgbBuf=(unsigned char *)malloc(width*height*RGB_PIXELSIZE); if(!rgbBuf) _throw("tjEncodeYUV3(): Memory allocation failure"); @@ -1189,7 +1189,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat]; #ifndef JCS_EXTENSIONS - if(pixelFormat!=TJPF_GRAY && + if(pixelFormat!=TJPF_GRAY && pixelFormat!=TJPF_CMYK && (RGB_RED!=tjRedOffset[pixelFormat] || RGB_GREEN!=tjGreenOffset[pixelFormat] || RGB_BLUE!=tjBlueOffset[pixelFormat] || @@ -1309,6 +1309,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, jpeg_component_info *compptr; #ifndef JCS_EXTENSIONS unsigned char *rgbBuf=NULL; + unsigned char *_dstBuf=NULL; int _pitch=0; #endif JMETHOD(int, old_read_markers, (j_decompress_ptr)); JMETHOD(void, old_reset_marker_reader, (j_decompress_ptr)); @@ -1339,17 +1340,6 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, _throw("tjDecodeYUV(): Cannot decode YUV images into CMYK pixels."); if(pitch==0) pitch=width*tjPixelSize[pixelFormat]; - - #ifndef JCS_EXTENSIONS - if(pixelFormat!=TJPF_GRAY) - { - rgbBuf=(unsigned char *)malloc(width*height*RGB_PIXELSIZE); - if(!rgbBuf) _throw("tjDecodeYUV(): Memory allocation failure"); - srcBuf=toRGB(srcBuf, width, pitch, height, pixelFormat, rgbBuf); - pitch=width*RGB_PIXELSIZE; - } - #endif - dinfo->image_width=width; dinfo->image_height=height; @@ -1383,6 +1373,20 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat]; + #ifndef JCS_EXTENSIONS + if(pixelFormat!=TJPF_GRAY && pixelFormat!=TJPF_CMYK && + (RGB_RED!=tjRedOffset[pixelFormat] || + RGB_GREEN!=tjGreenOffset[pixelFormat] || + RGB_BLUE!=tjBlueOffset[pixelFormat] || + RGB_PIXELSIZE!=tjPixelSize[pixelFormat])) + { + rgbBuf=(unsigned char *)malloc(width*height*3); + if(!rgbBuf) _throw("tjDecodeYUV(): Memory allocation failure"); + _pitch=pitch; pitch=width*3; + _dstBuf=dstBuf; dstBuf=rgbBuf; + } + #endif + if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL) _throw("tjDecodeYUV(): Memory allocation failure"); for(i=0; iglobal_state>DSTATE_START) jpeg_abort_decompress(dinfo); #ifndef JCS_EXTENSIONS From a0908f87a52bb9a9c8dadb5654dd66763664c2d6 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 20 Apr 2014 19:11:52 +0000 Subject: [PATCH 896/985] We use __CHAR_UNSIGNED__ (automatically defined by the AC_C_CHAR_UNSIGNED macro) rather than CHAR_IS_UNSIGNED (defined by custom autoconf code in libjpeg that we didn't port over), although I doubt it matters on any of the platforms we support. --- jconfig.txt | 2 +- rdbmp.c | 2 +- rdppm.c | 2 +- rdtarga.c | 12 ++++++------ win/jconfig.h.in | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jconfig.txt b/jconfig.txt index b96d3124..dda62367 100644 --- a/jconfig.txt +++ b/jconfig.txt @@ -48,7 +48,7 @@ * If you're not sure, leaving it undefined will work at some cost in speed. * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal. */ -#undef CHAR_IS_UNSIGNED +#undef __CHAR_UNSIGNED__ /* Define this if your system has an ANSI-conforming file. */ diff --git a/rdbmp.c b/rdbmp.c index ba9f7280..7c2e0441 100644 --- a/rdbmp.c +++ b/rdbmp.c @@ -35,7 +35,7 @@ typedef unsigned char U_CHAR; #define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; #define UCH(x) ((int) (x)) #else diff --git a/rdppm.c b/rdppm.c index a7570227..0f3994d2 100644 --- a/rdppm.c +++ b/rdppm.c @@ -43,7 +43,7 @@ typedef unsigned char U_CHAR; #define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; #define UCH(x) ((int) (x)) #else diff --git a/rdtarga.c b/rdtarga.c index 4c2cd267..0ad4642e 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -28,7 +28,7 @@ typedef unsigned char U_CHAR; #define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ -#ifdef CHAR_IS_UNSIGNED +#ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; #define UCH(x) ((int) (x)) #else @@ -177,7 +177,7 @@ get_8bit_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) tga_source_ptr source = (tga_source_ptr) sinfo; register JSAMPROW ptr; register JDIMENSION col; - + ptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ @@ -215,7 +215,7 @@ get_16bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) register int t; register JSAMPROW ptr; register JDIMENSION col; - + ptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ @@ -242,7 +242,7 @@ get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) tga_source_ptr source = (tga_source_ptr) sinfo; register JSAMPROW ptr; register JDIMENSION col; - + ptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { (*source->read_pixel) (source); /* Load next pixel into tga_pixel */ @@ -365,7 +365,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) (UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */ interlace_type != 0) /* currently don't allow interlaced image */ ERREXIT(cinfo, JERR_TGA_BADPARMS); - + if (subtype > 8) { /* It's an RLE-coded file */ source->read_pixel = read_rle_pixel; @@ -440,7 +440,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) source->pub.buffer_height = 1; source->pub.get_pixel_rows = source->get_pixel_rows; } - + while (idlen--) /* Throw away ID field */ (void) read_byte(source); diff --git a/win/jconfig.h.in b/win/jconfig.h.in index ddcf97e0..516ca597 100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@ -12,7 +12,7 @@ #define HAVE_UNSIGNED_SHORT /* #define void char */ /* #define const */ -#undef CHAR_IS_UNSIGNED +#undef __CHAR_UNSIGNED__ #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS From 6fc85ff9608288592171f09748866b3052412303 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 5 May 2014 20:55:24 +0000 Subject: [PATCH 897/985] First pass at an Android makefile --- Android.mk | 276 +++++++++++++++++++++++++++++++++++++++++++ android/jconfig.h | 46 ++++++++ android/jconfigint.h | 2 + 3 files changed, 324 insertions(+) create mode 100644 Android.mk create mode 100644 android/jconfig.h create mode 100644 android/jconfigint.h diff --git a/Android.mk b/Android.mk new file mode 100644 index 00000000..ad4badc8 --- /dev/null +++ b/Android.mk @@ -0,0 +1,276 @@ +# Android makefile for libjpeg-turbo + +ifneq ($(TARGET_SIMULATOR), true) + +LOCAL_PATH := $(my-dir) +VERSION = 1.3.80 +BUILD := $(shell date +%Y%m%d) + +DEFINES = -DPACKAGE_NAME=\"libjpeg-turbo\" -DVERSION=\"$(VERSION)\" \ + -DBUILD=\"$(BUILD)\" + +# Default configuration (all of these can be overridden on the command line) +CFLAGS = -O3 +ifeq ($(strip $(TARGET_ARCH)), arm) +ifeq ($(TARGET_ARCH_VARIANT), armv7-a-neon) +WITH_SIMD = 1 +SIMD_ARCH = arm +endif +ifneq ($(findstring armv7-a, $(TARGET_ARCH_VARIANT)),) +CFLAGS += -fstrict-aliasing +endif +endif +WITH_TURBOJPEG = 1 +WITH_ARITH_ENC = 1 +WITH_ARITH_DEC = 1 +JPEG_LIB_VERSION = 62 +WITH_JPEG7 = 0 +WITH_JPEG8 = 0 +WITH_MEM_SRCDST = 1 + +# Define C macros based on configuration +ifeq ($(WITH_SIMD), 1) +DEFINES += -DWITH_SIMD +endif + +ifeq ($(WITH_ARITH_ENC), 1) +WITH_ARITH = 1 +DEFINES += -DC_ARITH_CODING_SUPPORTED +endif +ifeq ($(WITH_ARITH_DEC), 1) +WITH_ARITH = 1 +DEFINES += -DD_ARITH_CODING_SUPPORTED +endif + +ifeq ($(WITH_JPEG7), 1) +JPEG_LIB_VERSION = 70 +endif +ifeq ($(WITH_JPEG8), 1) +JPEG_LIB_VERSION = 80 +endif +DEFINES += -DJPEG_LIB_VERSION=$(JPEG_LIB_VERSION) + +ifeq ($(WITH_MEM_SRCDST), 1) +DEFINES += -DMEM_SRCDST_SUPPORTED +endif + +################################################## +### SIMD ### +################################################## + +include $(CLEAR_VARS) + +ifeq ($(WITH_SIMD), 1) + +ifeq ($(SIMD_ARCH), arm) +LOCAL_SRC_FILES = simd/jsimd_arm_neon.S simd/jsimd_arm.c +LOCAL_ARM_NEON := true +endif + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/simd $(LOCAL_PATH)/android + +LOCAL_MODULE = simd + +include $(BUILD_STATIC_LIBRARY) + +endif # WITH_SIMD + +################################################## +### libjpeg ### +################################################## + +include $(CLEAR_VARS) + +LIBJPEG_SRC_FILES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ + jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ + jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c \ + jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c + +ifneq ($(WITH_SIMD), 1) +LIBJPEG_SRC_FILES += jsimd_none.c +endif + +ifeq ($(WITH_ARITH), 1) +LIBJPEG_SRC_FILES += jaricom.c +endif +ifeq ($(WITH_ARITH_ENC), 1) +LIBJPEG_SRC_FILES += jcarith.c +endif +ifeq ($(WITH_ARITH_DEC), 1) +LIBJPEG_SRC_FILES += jdarith.c +endif + +LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +ifeq ($(WITH_SIMD), 1) +LOCAL_STATIC_LIBRARIES = libsimd +endif +LOCAL_MODULE = jpeg +include $(BUILD_SHARED_LIBRARY) + +################################################## +### libturbojpeg ### +################################################## + +ifeq ($(WITH_TURBOJPEG), 1) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} turbojpeg.c transupp.c jdatadst-tj.c \ + jdatasrc-tj.c turbojpeg-jni.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +ifeq ($(WITH_SIMD), 1) +LOCAL_STATIC_LIBRARIES = libsimd +endif +LOCAL_MODULE = turbojpeg +include $(BUILD_SHARED_LIBRARY) + +endif # WITH_TURBOJPEG + +###################################################### +### cjpeg ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = cdjpeg.c cjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c \ + rdtarga.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ + -DPPM_SUPPORTED -DTARGA_SUPPORTED + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = cjpeg +include $(BUILD_EXECUTABLE) + +###################################################### +### djpeg ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = cdjpeg.c djpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c \ + wrppm.c wrtarga.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ + -DPPM_SUPPORTED -DTARGA_SUPPORTED + +LOCAL_SHARED_LIBRARIES = libjpeg + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = djpeg +include $(BUILD_EXECUTABLE) + +###################################################### +### jpegtran ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = jpegtran.c rdswitch.c cdjpeg.c transupp.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = jpegtran +include $(BUILD_EXECUTABLE) + +###################################################### +### rdjpgcom ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = rdjpgcom.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = rdjpgcom +include $(BUILD_EXECUTABLE) + +###################################################### +### wrjpgcom ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = wrjpgcom.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = wrjpgcom +include $(BUILD_EXECUTABLE) + +###################################################### +### tjunittest ### +###################################################### + +ifeq ($(WITH_TURBOJPEG), 1) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = tjunittest.c tjutil.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libturbojpeg +LOCAL_MODULE = tjunittest +include $(BUILD_EXECUTABLE) + +###################################################### +### tjbench ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c wrppm.c + +LOCAL_CFLAGS = $(DEFINES) -DBMP_SUPPORTED -DPPM_SUPPORTED + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libturbojpeg +LOCAL_MODULE = tjbench +include $(BUILD_EXECUTABLE) + +endif # WITH_TURBOJPEG + +###################################################### +### md5cmp ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = md5/md5cmp.c md5/md5.c md5/md5hl.c + +LOCAL_MODULE = md5cmp +include $(BUILD_EXECUTABLE) + +endif # TARGET_SIMULATOR != true diff --git a/android/jconfig.h b/android/jconfig.h new file mode 100644 index 00000000..568d58a1 --- /dev/null +++ b/android/jconfig.h @@ -0,0 +1,46 @@ +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if your compiler supports prototypes */ +#define HAVE_PROTOTYPES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if the system has the type `unsigned char'. */ +#define HAVE_UNSIGNED_CHAR 1 + +/* Define to 1 if the system has the type `unsigned short'. */ +#define HAVE_UNSIGNED_SHORT 1 + +/* Compiler does not support pointers to undefined structures. */ +/* #undef INCOMPLETE_TYPES_BROKEN */ + +/* Define if you have BSD-like bzero and bcopy in rather than + memset/memcpy in . */ +/* #undef NEED_BSD_STRINGS */ + +/* Define if linker requires that the first 15 characters of global names be + unique. */ +/* #undef NEED_SHORT_EXTERNAL_NAMES */ + +/* Define if you need to include to get size_t. */ +#define NEED_SYS_TYPES_H 1 + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/android/jconfigint.h b/android/jconfigint.h new file mode 100644 index 00000000..a54554ea --- /dev/null +++ b/android/jconfigint.h @@ -0,0 +1,2 @@ +/* How to obtain function inlining. */ +#define INLINE inline __attribute__((always_inline)) From 1c6030799dd1566c2fc6e024612ea4cc2619a492 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 08:58:11 +0000 Subject: [PATCH 898/985] Redesign the libjpeg regression tests so that they fully cover all of the SIMD-accelerated algorithms (and most of the other ones as well) --- Makefile.am | 285 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 180 insertions(+), 105 deletions(-) diff --git a/Makefile.am b/Makefile.am index 32f48e67..bf4895f2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -163,40 +163,46 @@ dist-hook: SUBDIRS += md5 -MD5_JPEG_INT = 9a68f56bc76e466aa7e52f415d0f4a5f -MD5_JPEG_FAST = 0e1502e7fa421835e376a314fac2a39f -MD5_JPEG_FAST_100 = 7bf72a8e741d64eecb960c97323af77c -MD5_JPEG_FLOAT = d1623885ffafcd40c684af09e3d65cd5 -MD5_JPEG_FLOAT_NOSIMD = fb4884c35f8273f498cb32879de5c455 -MD5_JPEG_INT_GRAY = 72b51f894b8f4a10b3ee3066770aa38d -MD5_PPM_INT = d1ed0d11f076b842525271647716aeb8 -MD5_PPM_FAST = 048298a2d2410261c0533cb97bcfef23 -MD5_PPM_FLOAT = 7f5b446ee36b2630e06785b8d42af15f -MD5_PPM_FLOAT_NOSIMD = 64072f1dbdc5b3a187777788604971a5 -MD5_PPM_INT_2_1 = 9f9de8c0612f8d06869b960b05abf9c9 -MD5_PPM_INT_15_8 = b6875bc070720b899566cc06459b63b7 -MD5_PPM_INT_7_4 = 06a177eae05f164fac57f7a2c346ee87 -MD5_PPM_INT_13_8 = bc3452573c8152f6ae552939ee19f82f -MD5_PPM_INT_3_2 = f5a8b88a8a7f96016f04d259cf82ed67 -MD5_PPM_INT_11_8 = d8cc73c0aaacd4556569b59437ba00a5 -MD5_PPM_INT_5_4 = 32775dd9ad2ab90f4c5b219b53e0c86c -MD5_PPM_INT_9_8 = d25e61bc7eac0002f5b393aa223747b6 -MD5_PPM_INT_7_8 = ddb564b7c74a09494016d6cd7502a946 -MD5_PPM_INT_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646 -MD5_PPM_INT_5_8 = a3363274999da2366a024efae6d16c9b -MD5_PPM_INT_1_2 = e692a315cea26b988c8e8b29a5dbcd81 -MD5_PPM_INT_3_8 = 79eca9175652ced755155c90e785a996 -MD5_PPM_INT_1_4 = 79cd778f8bf1a117690052cacdd54eca -MD5_PPM_INT_1_8 = 391b3d4aca640c8567d6f8745eb2142f -MD5_PPM_FAST_1_2 = f30bcf6d32ccd44cbdd9aeaacbd9454f -MD5_BMP_256 = 4980185e3776e89bd931736e1cddeee6 -MD5_JPEG_ARI = e986fb0a637a8d833d96e8a6d6d84ea1 -MD5_PPM_ARI = 72b59a99bcf1de24c5b27d151bde2437 -MD5_JPEG_PROG = 1c4afddc05c0a43489ee54438a482d92 -MD5_JPEG_PROG_ARI = 0a8f1c8f66e113c3cf635df0a475a617 +MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b +MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291 +MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8 +MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa +MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d +MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade +MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294 +MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1 +MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d +MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed +MD5_PPM_GRAY_RGB_ISLOW = 116424ac07b79e5e801f00508eab48ec +MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 +if WITH_SIMD +MD5_JPEG_3x2_FLOAT_PROG = 343e3f8caf8af5986ebaf0bdc13b5c71 +MD5_PPM_3x2_FLOAT = 1a75f36e5904d6fc3a85a43da9ad89bb +else +MD5_JPEG_3x2_FLOAT_PROG = 9bca803d2042bd1eb03819e2bf92b3e5 +MD5_PPM_3x2_FLOAT = ef6a420e369440edd6b918a0cf54ba3f +endif +MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1 +MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617 +MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437 +MD5_JPEG_420_ISLOW = 9a68f56bc76e466aa7e52f415d0f4a5f +MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9 +MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7 +MD5_PPM_420M_ISLOW_13_8 = bc3452573c8152f6ae552939ee19f82f +MD5_PPM_420M_ISLOW_11_8 = d8cc73c0aaacd4556569b59437ba00a5 +MD5_PPM_420M_ISLOW_9_8 = d25e61bc7eac0002f5b393aa223747b6 +MD5_PPM_420M_ISLOW_7_8 = ddb564b7c74a09494016d6cd7502a946 +MD5_PPM_420M_ISLOW_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646 +MD5_PPM_420M_ISLOW_5_8 = a3363274999da2366a024efae6d16c9b +MD5_PPM_420M_ISLOW_1_2 = e692a315cea26b988c8e8b29a5dbcd81 +MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996 +MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca +MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f +MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6 MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d test: testclean all + if WITH_TURBOJPEG if WITH_JAVA $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest @@ -212,84 +218,153 @@ endif ./tjunittest -yuv -alloc ./tjunittest -yuv -noyuvpad endif - ./cjpeg -dct int -outfile testoutint.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_INT) testoutint.jpg - ./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_FAST) testoutfst.jpg - ./cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_FAST_100) testoutfst100.jpg - ./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testimages/testorig.ppm -if WITH_SSE_FLOAT_DCT - md5/md5cmp $(MD5_JPEG_FLOAT) testoutflt.jpg -else - md5/md5cmp $(MD5_JPEG_FLOAT_NOSIMD) testoutflt.jpg -endif - ./cjpeg -dct int -grayscale -outfile testoutgray.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_INT_GRAY) testoutgray.jpg - ./djpeg -dct int -fast -ppm -outfile testoutint.ppm $(srcdir)/testimages/testorig.jpg - md5/md5cmp $(MD5_PPM_INT) testoutint.ppm - ./djpeg -dct fast -ppm -outfile testoutfst.ppm $(srcdir)/testimages/testorig.jpg - md5/md5cmp $(MD5_PPM_FAST) testoutfst.ppm - ./djpeg -dct float -ppm -outfile testoutflt.ppm $(srcdir)/testimages/testorig.jpg -if WITH_SSE_FLOAT_DCT - md5/md5cmp $(MD5_PPM_FLOAT) testoutflt.ppm -else - md5/md5cmp $(MD5_PPM_FLOAT_NOSIMD) testoutflt.ppm -endif - ./djpeg -dct int -nosmooth -scale 2/1 -ppm -outfile testoutint2_1.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_2_1) testoutint2_1.ppm; - ./djpeg -dct int -nosmooth -scale 15/8 -ppm -outfile testoutint15_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_15_8) testoutint15_8.ppm; - ./djpeg -dct int -nosmooth -scale 7/4 -ppm -outfile testoutint7_4.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_7_4) testoutint7_4.ppm; - ./djpeg -dct int -nosmooth -scale 13/8 -ppm -outfile testoutint13_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_13_8) testoutint13_8.ppm; - ./djpeg -dct int -nosmooth -scale 3/2 -ppm -outfile testoutint3_2.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_3_2) testoutint3_2.ppm; - ./djpeg -dct int -nosmooth -scale 11/8 -ppm -outfile testoutint11_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_11_8) testoutint11_8.ppm; - ./djpeg -dct int -nosmooth -scale 5/4 -ppm -outfile testoutint5_4.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_5_4) testoutint5_4.ppm; - ./djpeg -dct int -nosmooth -scale 9/8 -ppm -outfile testoutint9_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_9_8) testoutint9_8.ppm; - ./djpeg -dct int -nosmooth -scale 7/8 -ppm -outfile testoutint7_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_7_8) testoutint7_8.ppm; - ./djpeg -dct int -nosmooth -scale 3/4 -ppm -outfile testoutint3_4.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_3_4) testoutint3_4.ppm; - ./djpeg -dct int -nosmooth -scale 5/8 -ppm -outfile testoutint5_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_5_8) testoutint5_8.ppm; - ./djpeg -dct int -nosmooth -scale 1/2 -ppm -outfile testoutint1_2.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_1_2) testoutint1_2.ppm; - ./djpeg -dct int -nosmooth -scale 3/8 -ppm -outfile testoutint3_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_3_8) testoutint3_8.ppm; - ./djpeg -dct int -nosmooth -scale 1/4 -ppm -outfile testoutint1_4.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_1_4) testoutint1_4.ppm; - ./djpeg -dct int -nosmooth -scale 1/8 -ppm -outfile testoutint1_8.ppm $(srcdir)/testimages/testorig.jpg; - md5/md5cmp $(MD5_PPM_INT_1_8) testoutint1_8.ppm; - ./djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm $(srcdir)/testimages/testorig.jpg - md5/md5cmp $(MD5_PPM_FAST_1_2) testoutfst1_2.ppm - ./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testimages/testorig.jpg - md5/md5cmp $(MD5_BMP_256) testout.bmp + +# These tests are carefully crafted to provide full coverage of as many of the +# underlying algorithms as possible (including all of the SIMD-accelerated +# ones.) + +# CC: null SAMP: fullsize FDCT: islow ENT: huff + ./cjpeg -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_RGB_ISLOW) testout_rgb_islow.jpg +# CC: null SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg + md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm + rm testout_rgb_islow.ppm + rm testout_rgb_islow.jpg + +# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff + ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_422_IFAST_OPT) testout_422_ifast_opt.jpg +# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff + ./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm + rm testout_422_ifast.ppm +# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -nosmooth -dct fast -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm + rm testout_422m_ifast.ppm + rm testout_422_ifast_opt.jpg + +# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff + ./cjpeg -sample 2x2 -dct fast -quality 100 -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg +# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff + ./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm + rm testout_420_q100_ifast.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff + ./djpeg -nosmooth -dct fast -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm + rm testout_420m_q100_ifast.ppm + rm testout_420_q100_ifast_prog.jpg + +# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff + ./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg +# CC: Gray->Gray SAMP: fullsize FDCT: islow ENT: huff + ./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg + md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm + rm testout_gray_islow.ppm +# CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff + ./djpeg -rgb -dct int -outfile testout_gray_rgb_islow.ppm testout_gray_islow.jpg + md5/md5cmp $(MD5_PPM_GRAY_RGB_ISLOW) testout_gray_rgb_islow.ppm + rm testout_gray_rgb_islow.ppm + rm testout_gray_islow.jpg + +# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow +# ENT: 2-pass huff + ./cjpeg -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg + rm testout_420s_ifast_opt.jpg + +# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff + ./cjpeg -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG) testout_3x2_float_prog.jpg +# CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff + ./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg + md5/md5cmp $(MD5_PPM_3x2_FLOAT) testout_3x2_float.ppm + rm testout_3x2_float.ppm + rm testout_3x2_float_prog.jpg + if WITH_ARITH_ENC - ./cjpeg -dct int -arithmetic -outfile testoutari.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_ARI) testoutari.jpg - ./jpegtran -arithmetic -outfile testouta.jpg $(srcdir)/testimages/testimgint.jpg - md5/md5cmp $(MD5_JPEG_ARI) testouta.jpg - ./cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_PROG_ARI) testoutpa.jpg +# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith + ./cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg + rm testout_420_islow_ari.jpg + ./jpegtran -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg + md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg + rm testout_420_islow_ari.jpg +# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith + ./cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm + md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg + rm testout_444_islow_progari.jpg endif if WITH_ARITH_DEC - ./djpeg -dct int -fast -ppm -outfile testoutari.ppm $(srcdir)/testimages/testimgari.jpg - md5/md5cmp $(MD5_PPM_ARI) testoutari.ppm - ./jpegtran -outfile testouta.jpg $(srcdir)/testimages/testimgari.jpg - md5/md5cmp $(MD5_JPEG_INT) testouta.jpg +# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith + ./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm + rm testout_420m_ifast_ari.ppm + ./jpegtran -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg + md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg + rm testout_420_islow.jpg endif - ./cjpeg -dct int -progressive -outfile testoutp.jpg $(srcdir)/testimages/testorig.ppm - md5/md5cmp $(MD5_JPEG_PROG) testoutp.jpg - ./jpegtran -outfile testoutt.jpg testoutp.jpg - md5/md5cmp $(MD5_JPEG_INT) testoutt.jpg - ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg $(srcdir)/testimages/testorig.jpg - md5/md5cmp $(MD5_JPEG_CROP) testoutcrop.jpg + +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 2/1 -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm + rm testout_420m_islow_2_1.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 15/8 -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm + rm testout_420m_islow_15_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 13/8 -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm + rm testout_420m_islow_13_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 11/8 -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm + rm testout_420m_islow_11_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 9/8 -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm + rm testout_420m_islow_9_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 7/8 -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm + rm testout_420m_islow_7_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 3/4 -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm + rm testout_420m_islow_3_4.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 5/8 -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm + rm testout_420m_islow_5_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 1/2 -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm + rm testout_420m_islow_1_2.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 3/8 -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm + rm testout_420m_islow_3_8.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 1/4 -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm + rm testout_420m_islow_1_4.ppm +# CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff + ./djpeg -dct int -nosmooth -scale 1/8 -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm + rm testout_420m_islow_1_8.ppm +# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + ./djpeg -dct int -bmp -colors 256 -outfile testout_420_islow_256.bmp $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp + rm testout_420_islow_256.bmp + + ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg + rm testout_crop.jpg testclean: From 361192b972559ad279dc25a3ff9c618f1ba25a4d Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 09:41:08 +0000 Subject: [PATCH 899/985] Phrasing. Boom. --- turbojpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/turbojpeg.c b/turbojpeg.c index 5ce1594c..648744cb 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1322,7 +1322,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, } if((this->init&DECOMPRESS)==0) - _throw("tjDecodeYUV(): Instance has not been initialized for compression"); + _throw("tjDecodeYUV(): Instance has not been initialized for decompression"); if(srcBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT || dstBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0 From 7824f700081778ead1667971c9f7cb4b331e45f6 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 09:53:21 +0000 Subject: [PATCH 900/985] SIMD-accelerated slow integer IDCT routine for MIPS DSPr2 --- jversion.h | 2 +- simd/jsimd.h | 6 +- simd/jsimd_mips.c | 34 ++++- simd/jsimd_mips_dspr2.S | 280 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 319 insertions(+), 3 deletions(-) diff --git a/jversion.h b/jversion.h index 032fef0e..e1c4f499 100644 --- a/jversion.h +++ b/jversion.h @@ -30,5 +30,5 @@ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ "Copyright (C) 2009-2014 D. R. Commander\n" \ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ - "Copyright (C) 2013 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ "Copyright (C) 2013 Linaro Limited" diff --git a/simd/jsimd.h b/simd/jsimd.h index f75aa9bb..6d4178be 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2011 D. R. Commander - * Copyright (C) 2013, MIPS Technologies, Inc., California + * Copyright (C) 2013-2014, MIPS Technologies, Inc., California * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -801,6 +801,10 @@ EXTERN(void) jsimd_idct_ifast_neon JPP((void * dct_table, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jsimd_idct_islow_mips_dspr2 JPP((void * dct_table, + JCOEFPTR coef_block, + int * output_buf, + JSAMPLE * output_col)); EXTERN(void) jsimd_idct_ifast_cols_mips_dspr2 JPP((JCOEF * inptr, IFAST_MULT_TYPE * quantptr, DCTELEM * wsptr, diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index 5b4f8933..e7b8c5e4 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2009-2011 D. R. Commander - * Copyright (C) 2013, MIPS Technologies, Inc., California + * Copyright (C) 2013-2014, MIPS Technologies, Inc., California * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -781,6 +781,23 @@ jsimd_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(int) jsimd_can_idct_islow (void) { + init_simd(); + + /* The code is optimised for these values only */ + if (DCTSIZE != 8) + return 0; + if (sizeof(JCOEF) != 2) + return 0; + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (sizeof(ISLOW_MULT_TYPE) != 2) + return 0; + + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + return 0; } @@ -820,6 +837,21 @@ jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { + if (simd_support & JSIMD_MIPS_DSPR2) { + int output[8] = { + (int)(output_buf[0] + output_col), + (int)(output_buf[1] + output_col), + (int)(output_buf[2] + output_col), + (int)(output_buf[3] + output_col), + (int)(output_buf[4] + output_col), + (int)(output_buf[5] + output_col), + (int)(output_buf[6] + output_col), + (int)(output_buf[7] + output_col), + }; + + jsimd_idct_islow_mips_dspr2(coef_block, compptr->dct_table, + output, IDCT_range_limit(cinfo)); + } } GLOBAL(void) diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index 198c3496..b685b7aa 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -964,6 +964,286 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_upsample_mips_dspr2) nop END(jsimd_h2v2_upsample_mips_dspr2) +/*****************************************************************************/ +LEAF_MIPS_DSPR2(jsimd_idct_islow_mips_dspr2) +/* + * a0 - coef_block + * a1 - compptr->dcttable + * a2 - output + * a3 - range_limit + */ + + SAVE_REGS_ON_STACK 32, s0, s1, s2, s3, s4, s5, s6, s7 + + addiu sp, sp, -256 + move v0, sp + addiu v1, zero, 8 // v1 = DCTSIZE = 8 +1: + lh s4, 32(a0) // s4 = inptr[16] + lh s5, 64(a0) // s5 = inptr[32] + lh s6, 96(a0) // s6 = inptr[48] + lh t1, 112(a0) // t1 = inptr[56] + lh t7, 16(a0) // t7 = inptr[8] + lh t5, 80(a0) // t5 = inptr[40] + lh t3, 48(a0) // t3 = inptr[24] + or s4, s4, t1 + or s4, s4, t3 + or s4, s4, t5 + or s4, s4, t7 + or s4, s4, s5 + or s4, s4, s6 + bnez s4, 2f + addiu v1, v1, -1 + lh s5, 0(a1) // quantptr[DCTSIZE*0] + lh s6, 0(a0) // inptr[DCTSIZE*0] + mul s5, s5, s6 // DEQUANTIZE(inptr[0], quantptr[0]) + sll s5, s5, 2 + sw s5, 0(v0) + sw s5, 32(v0) + sw s5, 64(v0) + sw s5, 96(v0) + sw s5, 128(v0) + sw s5, 160(v0) + sw s5, 192(v0) + b 3f + sw s5, 224(v0) +2: + lh t0, 112(a1) + lh t2, 48(a1) + lh t4, 80(a1) + lh t6, 16(a1) + mul t0, t0, t1 // DEQUANTIZE(inptr[DCTSIZE*7],quant[DCTSIZE*7]) + mul t1, t2, t3 // DEQUANTIZE(inptr[DCTSIZE*3],quant[DCTSIZE*3]) + mul t2, t4, t5 // DEQUANTIZE(inptr[DCTSIZE*5],quant[DCTSIZE*5]) + mul t3, t6, t7 // DEQUANTIZE(inptr[DCTSIZE*1],quant[DCTSIZE*1]) + lh t4, 32(a1) + lh t5, 32(a0) + lh t6, 96(a1) + lh t7, 96(a0) + addu s0, t0, t1 // z3 = tmp0 + tmp2 + addu s1, t1, t2 // z2 = tmp1 + tmp2 + addu s2, t2, t3 // z4 = tmp1 + tmp3 + addu s3, s0, s2 // z3 + z4 + addiu t9, zero, 9633 // FIX_1_175875602 + mul s3, s3, t9 // z5 = MULTIPLY(z3 + z4, FIX_1_175875602) + addu t8, t0, t3 // z1 = tmp0 + tmp3 + addiu t9, zero, 2446 // FIX_0_298631336 + mul t0, t0, t9 // tmp0 = MULTIPLY(tmp0, FIX_0_298631336) + addiu t9, zero, 16819 // FIX_2_053119869 + mul t2, t2, t9 // tmp1 = MULTIPLY(tmp1, FIX_2_053119869) + addiu t9, zero, 25172 // FIX_3_072711026 + mul t1, t1, t9 // tmp2 = MULTIPLY(tmp2, FIX_3_072711026) + addiu t9, zero, 12299 // FIX_1_501321110 + mul t3, t3, t9 // tmp3 = MULTIPLY(tmp3, FIX_1_501321110) + addiu t9, zero, 16069 // FIX_1_961570560 + mul s0, s0, t9 // -z3 = MULTIPLY(z3, FIX_1_961570560) + addiu t9, zero, 3196 // FIX_0_390180644 + mul s2, s2, t9 // -z4 = MULTIPLY(z4, FIX_0_390180644) + addiu t9, zero, 7373 // FIX_0_899976223 + mul t8, t8, t9 // -z1 = MULTIPLY(z1, FIX_0_899976223) + addiu t9, zero, 20995 // FIX_2_562915447 + mul s1, s1, t9 // -z2 = MULTIPLY(z2, FIX_2_562915447) + subu s0, s3, s0 // z3 += z5 + addu t0, t0, s0 // tmp0 += z3 + addu t1, t1, s0 // tmp2 += z3 + subu s2, s3, s2 // z4 += z5 + addu t2, t2, s2 // tmp1 += z4 + addu t3, t3, s2 // tmp3 += z4 + subu t0, t0, t8 // tmp0 += z1 + subu t1, t1, s1 // tmp2 += z2 + subu t2, t2, s1 // tmp1 += z2 + subu t3, t3, t8 // tmp3 += z1 + mul s0, t4, t5 // DEQUANTIZE(inptr[DCTSIZE*2],quant[DCTSIZE*2]) + addiu t9, zero, 6270 // FIX_0_765366865 + mul s1, t6, t7 // DEQUANTIZE(inptr[DCTSIZE*6],quant[DCTSIZE*6]) + lh t4, 0(a1) + lh t5, 0(a0) + lh t6, 64(a1) + lh t7, 64(a0) + mul s2, t9, s0 // MULTIPLY(z2, FIX_0_765366865) + mul t5, t4, t5 // DEQUANTIZE(inptr[DCTSIZE*0],quant[DCTSIZE*0]) + mul t6, t6, t7 // DEQUANTIZE(inptr[DCTSIZE*4],quant[DCTSIZE*4]) + addiu t9, zero, 4433 // FIX_0_541196100 + addu s3, s0, s1 // z2 + z3 + mul s3, s3, t9 // z1 = MULTIPLY(z2 + z3, FIX_0_541196100) + addiu t9, zero, 15137 // FIX_1_847759065 + mul t8, s1, t9 // MULTIPLY(z3, FIX_1_847759065) + addu t4, t5, t6 + subu t5, t5, t6 + sll t4, t4, 13 // tmp0 = (z2 + z3) << CONST_BITS + sll t5, t5, 13 // tmp1 = (z2 - z3) << CONST_BITS + addu t7, s3, s2 // tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865) + subu t6, s3, t8 // tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065) + addu s0, t4, t7 + subu s1, t4, t7 + addu s2, t5, t6 + subu s3, t5, t6 + addu t4, s0, t3 + subu s0, s0, t3 + addu t3, s2, t1 + subu s2, s2, t1 + addu t1, s3, t2 + subu s3, s3, t2 + addu t2, s1, t0 + subu s1, s1, t0 + shra_r.w t4, t4, 11 + shra_r.w t3, t3, 11 + shra_r.w t1, t1, 11 + shra_r.w t2, t2, 11 + shra_r.w s1, s1, 11 + shra_r.w s3, s3, 11 + shra_r.w s2, s2, 11 + shra_r.w s0, s0, 11 + sw t4, 0(v0) + sw t3, 32(v0) + sw t1, 64(v0) + sw t2, 96(v0) + sw s1, 128(v0) + sw s3, 160(v0) + sw s2, 192(v0) + sw s0, 224(v0) +3: + addiu a1, a1, 2 + addiu a0, a0, 2 + bgtz v1, 1b + addiu v0, v0, 4 + move v0, sp + addiu v1, zero, 8 +4: + lw t0, 8(v0) // z2 = (INT32) wsptr[2] + lw t1, 24(v0) // z3 = (INT32) wsptr[6] + lw t2, 0(v0) // (INT32) wsptr[0] + lw t3, 16(v0) // (INT32) wsptr[4] + lw s4, 4(v0) // (INT32) wsptr[1] + lw s5, 12(v0) // (INT32) wsptr[3] + lw s6, 20(v0) // (INT32) wsptr[5] + lw s7, 28(v0) // (INT32) wsptr[7] + or s4, s4, t0 + or s4, s4, t1 + or s4, s4, t3 + or s4, s4, s7 + or s4, s4, s5 + or s4, s4, s6 + bnez s4, 5f + addiu v1, v1, -1 + shra_r.w s5, t2, 5 + andi s5, s5, 0x3ff + lbux s5, s5(a3) + lw s1, 0(a2) + replv.qb s5, s5 + usw s5, 0(s1) + usw s5, 4(s1) + b 6f + nop +5: + addu t4, t0, t1 // z2 + z3 + addiu t8, zero, 4433 // FIX_0_541196100 + mul t5, t4, t8 // z1 = MULTIPLY(z2 + z3, FIX_0_541196100) + addiu t8, zero, 15137 // FIX_1_847759065 + mul t1, t1, t8 // MULTIPLY(z3, FIX_1_847759065) + addiu t8, zero, 6270 // FIX_0_765366865 + mul t0, t0, t8 // MULTIPLY(z2, FIX_0_765366865) + addu t4, t2, t3 // (INT32) wsptr[0] + (INT32) wsptr[4] + subu t2, t2, t3 // (INT32) wsptr[0] - (INT32) wsptr[4] + sll t4, t4, 13 // tmp0 = ((wsptr[0] + wsptr[4]) << CONST_BITS + sll t2, t2, 13 // tmp1 = ((wsptr[0] - wsptr[4]) << CONST_BITS + subu t1, t5, t1 // tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065) + subu t3, t2, t1 // tmp12 = tmp1 - tmp2 + addu t2, t2, t1 // tmp11 = tmp1 + tmp2 + addu t5, t5, t0 // tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865) + subu t1, t4, t5 // tmp13 = tmp0 - tmp3 + addu t0, t4, t5 // tmp10 = tmp0 + tmp3 + lw t4, 28(v0) // tmp0 = (INT32) wsptr[7] + lw t6, 12(v0) // tmp2 = (INT32) wsptr[3] + lw t5, 20(v0) // tmp1 = (INT32) wsptr[5] + lw t7, 4(v0) // tmp3 = (INT32) wsptr[1] + addu s0, t4, t6 // z3 = tmp0 + tmp2 + addiu t8, zero, 9633 // FIX_1_175875602 + addu s1, t5, t7 // z4 = tmp1 + tmp3 + addu s2, s0, s1 // z3 + z4 + mul s2, s2, t8 // z5 = MULTIPLY(z3 + z4, FIX_1_175875602) + addu s3, t4, t7 // z1 = tmp0 + tmp3 + addu t9, t5, t6 // z2 = tmp1 + tmp2 + addiu t8, zero, 16069 // FIX_1_961570560 + mul s0, s0, t8 // -z3 = MULTIPLY(z3, FIX_1_961570560) + addiu t8, zero, 3196 // FIX_0_390180644 + mul s1, s1, t8 // -z4 = MULTIPLY(z4, FIX_0_390180644) + addiu t8, zero, 2446 // FIX_0_298631336 + mul t4, t4, t8 // tmp0 = MULTIPLY(tmp0, FIX_0_298631336) + addiu t8, zero, 7373 // FIX_0_899976223 + mul s3, s3, t8 // -z1 = MULTIPLY(z1, FIX_0_899976223) + addiu t8, zero, 16819 // FIX_2_053119869 + mul t5, t5, t8 // tmp1 = MULTIPLY(tmp1, FIX_2_053119869) + addiu t8, zero, 20995 // FIX_2_562915447 + mul t9, t9, t8 // -z2 = MULTIPLY(z2, FIX_2_562915447) + addiu t8, zero, 25172 // FIX_3_072711026 + mul t6, t6, t8 // tmp2 = MULTIPLY(tmp2, FIX_3_072711026) + addiu t8, zero, 12299 // FIX_1_501321110 + mul t7, t7, t8 // tmp3 = MULTIPLY(tmp3, FIX_1_501321110) + subu s0, s2, s0 // z3 += z5 + subu s1, s2, s1 // z4 += z5 + addu t4, t4, s0 + subu t4, t4, s3 // tmp0 + addu t5, t5, s1 + subu t5, t5, t9 // tmp1 + addu t6, t6, s0 + subu t6, t6, t9 // tmp2 + addu t7, t7, s1 + subu t7, t7, s3 // tmp3 + addu s0, t0, t7 + subu t0, t0, t7 + addu t7, t2, t6 + subu t2, t2, t6 + addu t6, t3, t5 + subu t3, t3, t5 + addu t5, t1, t4 + subu t1, t1, t4 + shra_r.w s0, s0, 18 + shra_r.w t7, t7, 18 + shra_r.w t6, t6, 18 + shra_r.w t5, t5, 18 + shra_r.w t1, t1, 18 + shra_r.w t3, t3, 18 + shra_r.w t2, t2, 18 + shra_r.w t0, t0, 18 + andi s0, s0, 0x3ff + andi t7, t7, 0x3ff + andi t6, t6, 0x3ff + andi t5, t5, 0x3ff + andi t1, t1, 0x3ff + andi t3, t3, 0x3ff + andi t2, t2, 0x3ff + andi t0, t0, 0x3ff + lw s1, 0(a2) + lbux s0, s0(a3) + lbux t7, t7(a3) + lbux t6, t6(a3) + lbux t5, t5(a3) + lbux t1, t1(a3) + lbux t3, t3(a3) + lbux t2, t2(a3) + lbux t0, t0(a3) + sb s0, 0(s1) + sb t7, 1(s1) + sb t6, 2(s1) + sb t5, 3(s1) + sb t1, 4(s1) + sb t3, 5(s1) + sb t2, 6(s1) + sb t0, 7(s1) +6: + addiu v0, v0, 32 + bgtz v1, 4b + addiu a2, a2, 4 + addiu sp, sp, 256 + + RESTORE_REGS_FROM_STACK 32, s0, s1, s2, s3, s4, s5, s6, s7 + + j ra + nop + +END(jsimd_idct_islow_mips_dspr2) + /*****************************************************************************/ LEAF_MIPS_DSPR2(jsimd_idct_ifast_cols_mips_dspr2) /* From 3b784478672512c368fabc6c85529dcb468cd166 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 20:53:25 +0000 Subject: [PATCH 901/985] Wordsmithing --- BUILDING.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 1cb28770..d40c2709 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -325,11 +325,9 @@ supported. Building libjpeg-turbo for iOS ------------------------------ -iOS platforms, such as the iPhone and iPad, also use ARM processors, some of -which support NEON instructions. Additional steps are required to build -libjpeg-turbo for these platforms. The steps below assume iOS SDK v4.3. If -you are using a different SDK version, then you will need to modify the -examples accordingly. +iOS platforms, such as the iPhone and iPad, use ARM processors, some of which +support NEON instructions. Additional steps are required in order to build +libjpeg-turbo for these platforms. Additional build requirements: @@ -503,10 +501,10 @@ instance: cd {build_directory} cmake -G "Visual Studio 10" {source_directory} -NOTE: Add "Win64" to the generator name (e.g. "Visual Studio 10 Win64") to -build a 64-bit version of libjpeg-turbo. Recent versions of CMake no longer -document that. A separate build directory must be used for 32-bit and 64-bit -builds. +NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10 +Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake +no longer document that. A separate build directory must be used for 32-bit +and 64-bit builds. You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project ("Debug", "Release", etc.) to generate a full From 43e9cee4b29b36fb9853249dee334f8dd5cd3dbe Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 21:03:35 +0000 Subject: [PATCH 902/985] Replace our custom version of Android.mk with instructions on how to build a libjpeg-turbo SDK for Android using autotools. Upon consulting with AOSP, it appears that Android.mk isn't really necessary except when building libjpeg-turbo for use by the Android platform itself, and it makes more sense for them to maintain the makefile for that purpose rather than for it to be upstreamed. ndk-build has serious limitations that prevent it from being used to generate static libjpeg-turbo libraries (mainly, it isn't possible to combine pre-built objects from one module into a static library for another module, which is necessary because the SIMD extensions sometimes have to be built with different CFLAGS than the rest of the code.) In general, it's just better not to introduce a new build system. --- Android.mk | 276 ------------------------------------------- BUILDING.txt | 41 ++++++- android/jconfig.h | 46 -------- android/jconfigint.h | 2 - 4 files changed, 40 insertions(+), 325 deletions(-) delete mode 100644 Android.mk delete mode 100644 android/jconfig.h delete mode 100644 android/jconfigint.h diff --git a/Android.mk b/Android.mk deleted file mode 100644 index ad4badc8..00000000 --- a/Android.mk +++ /dev/null @@ -1,276 +0,0 @@ -# Android makefile for libjpeg-turbo - -ifneq ($(TARGET_SIMULATOR), true) - -LOCAL_PATH := $(my-dir) -VERSION = 1.3.80 -BUILD := $(shell date +%Y%m%d) - -DEFINES = -DPACKAGE_NAME=\"libjpeg-turbo\" -DVERSION=\"$(VERSION)\" \ - -DBUILD=\"$(BUILD)\" - -# Default configuration (all of these can be overridden on the command line) -CFLAGS = -O3 -ifeq ($(strip $(TARGET_ARCH)), arm) -ifeq ($(TARGET_ARCH_VARIANT), armv7-a-neon) -WITH_SIMD = 1 -SIMD_ARCH = arm -endif -ifneq ($(findstring armv7-a, $(TARGET_ARCH_VARIANT)),) -CFLAGS += -fstrict-aliasing -endif -endif -WITH_TURBOJPEG = 1 -WITH_ARITH_ENC = 1 -WITH_ARITH_DEC = 1 -JPEG_LIB_VERSION = 62 -WITH_JPEG7 = 0 -WITH_JPEG8 = 0 -WITH_MEM_SRCDST = 1 - -# Define C macros based on configuration -ifeq ($(WITH_SIMD), 1) -DEFINES += -DWITH_SIMD -endif - -ifeq ($(WITH_ARITH_ENC), 1) -WITH_ARITH = 1 -DEFINES += -DC_ARITH_CODING_SUPPORTED -endif -ifeq ($(WITH_ARITH_DEC), 1) -WITH_ARITH = 1 -DEFINES += -DD_ARITH_CODING_SUPPORTED -endif - -ifeq ($(WITH_JPEG7), 1) -JPEG_LIB_VERSION = 70 -endif -ifeq ($(WITH_JPEG8), 1) -JPEG_LIB_VERSION = 80 -endif -DEFINES += -DJPEG_LIB_VERSION=$(JPEG_LIB_VERSION) - -ifeq ($(WITH_MEM_SRCDST), 1) -DEFINES += -DMEM_SRCDST_SUPPORTED -endif - -################################################## -### SIMD ### -################################################## - -include $(CLEAR_VARS) - -ifeq ($(WITH_SIMD), 1) - -ifeq ($(SIMD_ARCH), arm) -LOCAL_SRC_FILES = simd/jsimd_arm_neon.S simd/jsimd_arm.c -LOCAL_ARM_NEON := true -endif - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/simd $(LOCAL_PATH)/android - -LOCAL_MODULE = simd - -include $(BUILD_STATIC_LIBRARY) - -endif # WITH_SIMD - -################################################## -### libjpeg ### -################################################## - -include $(CLEAR_VARS) - -LIBJPEG_SRC_FILES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ - jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c \ - jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.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 jmemnobs.c - -ifneq ($(WITH_SIMD), 1) -LIBJPEG_SRC_FILES += jsimd_none.c -endif - -ifeq ($(WITH_ARITH), 1) -LIBJPEG_SRC_FILES += jaricom.c -endif -ifeq ($(WITH_ARITH_ENC), 1) -LIBJPEG_SRC_FILES += jcarith.c -endif -ifeq ($(WITH_ARITH_DEC), 1) -LIBJPEG_SRC_FILES += jdarith.c -endif - -LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -ifeq ($(WITH_SIMD), 1) -LOCAL_STATIC_LIBRARIES = libsimd -endif -LOCAL_MODULE = jpeg -include $(BUILD_SHARED_LIBRARY) - -################################################## -### libturbojpeg ### -################################################## - -ifeq ($(WITH_TURBOJPEG), 1) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} turbojpeg.c transupp.c jdatadst-tj.c \ - jdatasrc-tj.c turbojpeg-jni.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -ifeq ($(WITH_SIMD), 1) -LOCAL_STATIC_LIBRARIES = libsimd -endif -LOCAL_MODULE = turbojpeg -include $(BUILD_SHARED_LIBRARY) - -endif # WITH_TURBOJPEG - -###################################################### -### cjpeg ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = cdjpeg.c cjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c \ - rdtarga.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ - -DPPM_SUPPORTED -DTARGA_SUPPORTED - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = cjpeg -include $(BUILD_EXECUTABLE) - -###################################################### -### djpeg ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = cdjpeg.c djpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c \ - wrppm.c wrtarga.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ - -DPPM_SUPPORTED -DTARGA_SUPPORTED - -LOCAL_SHARED_LIBRARIES = libjpeg - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = djpeg -include $(BUILD_EXECUTABLE) - -###################################################### -### jpegtran ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = jpegtran.c rdswitch.c cdjpeg.c transupp.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = jpegtran -include $(BUILD_EXECUTABLE) - -###################################################### -### rdjpgcom ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = rdjpgcom.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = rdjpgcom -include $(BUILD_EXECUTABLE) - -###################################################### -### wrjpgcom ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = wrjpgcom.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = wrjpgcom -include $(BUILD_EXECUTABLE) - -###################################################### -### tjunittest ### -###################################################### - -ifeq ($(WITH_TURBOJPEG), 1) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = tjunittest.c tjutil.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libturbojpeg -LOCAL_MODULE = tjunittest -include $(BUILD_EXECUTABLE) - -###################################################### -### tjbench ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c wrppm.c - -LOCAL_CFLAGS = $(DEFINES) -DBMP_SUPPORTED -DPPM_SUPPORTED - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libturbojpeg -LOCAL_MODULE = tjbench -include $(BUILD_EXECUTABLE) - -endif # WITH_TURBOJPEG - -###################################################### -### md5cmp ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = md5/md5cmp.c md5/md5.c md5/md5hl.c - -LOCAL_MODULE = md5cmp -include $(BUILD_EXECUTABLE) - -endif # TARGET_SIMULATOR != true diff --git a/BUILDING.txt b/BUILDING.txt index d40c2709..13835a1f 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -319,7 +319,7 @@ This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate JPEG compression/decompression by approximately 2-4x on ARMv7 and later platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the build system will automatically include the NEON SIMD routines, if they are -supported. +supported. Build instructions for other ARM-based platforms follow. Building libjpeg-turbo for iOS @@ -393,6 +393,45 @@ described above. Otherwise, you may get a libtool error such as "unable to infer tagged configuration." +Building libjpeg-turbo for Android +---------------------------------- + +Building libjpeg-turbo for Android platforms requires the Android NDK +(https://developer.android.com/tools/sdk/ndk) and autotools. The following is +a general recipe script that can be modified for your specific needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk} + BUILD_PLATFORM={the platform name for the NDK package you installed-- + for example, "windows-x86" or "linux-x86_64"} + TOOLCHAIN_VERSION={"4.6", "4.8", etc. This corresponds to a toolchain + directory under ${NDK_PATH}/toolchains/.} + ANDROID_VERSION={The minimum version of Android to support-- for example, + "9", "19", etc.} + + HOST=arm-linux-androideabi + TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM} + SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm + ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include" + ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \ + -fstrict-aliasing --sysroot=${SYSROOT}" + export CPP=${TOOLCHAIN}/bin/${HOST}-cpp + export AR=${TOOLCHAIN}/bin/${HOST}-ar + export AS=${TOOLCHAIN}/bin/${HOST}-as + export NM=${TOOLCHAIN}/bin/${HOST}-nm + export CC=${TOOLCHAIN}/bin/${HOST}-gcc + export LD=${TOOLCHAIN}/bin/${HOST}-ld + export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib + export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump + export STRIP=${TOOLCHAIN}/bin/${HOST}-strip + cd {build_directory} + sh {source_directory}/configure --host=${HOST} \ + CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3" \ + CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \ + LDFLAGS="${ANDROID_CFLAGS}" --with-simd ${1+"$@"} + make + + ******************************************************************************* ** Building on Windows (Visual C++ or MinGW) ******************************************************************************* diff --git a/android/jconfig.h b/android/jconfig.h deleted file mode 100644 index 568d58a1..00000000 --- a/android/jconfig.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if your compiler supports prototypes */ -#define HAVE_PROTOTYPES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if the system has the type `unsigned char'. */ -#define HAVE_UNSIGNED_CHAR 1 - -/* Define to 1 if the system has the type `unsigned short'. */ -#define HAVE_UNSIGNED_SHORT 1 - -/* Compiler does not support pointers to undefined structures. */ -/* #undef INCOMPLETE_TYPES_BROKEN */ - -/* Define if you have BSD-like bzero and bcopy in rather than - memset/memcpy in . */ -/* #undef NEED_BSD_STRINGS */ - -/* Define if linker requires that the first 15 characters of global names be - unique. */ -/* #undef NEED_SHORT_EXTERNAL_NAMES */ - -/* Define if you need to include to get size_t. */ -#define NEED_SYS_TYPES_H 1 - -/* Define if your (broken) compiler shifts signed values as if they were - unsigned. */ -/* #undef RIGHT_SHIFT_IS_UNSIGNED */ - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -/* # undef __CHAR_UNSIGNED__ */ -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/android/jconfigint.h b/android/jconfigint.h deleted file mode 100644 index a54554ea..00000000 --- a/android/jconfigint.h +++ /dev/null @@ -1,2 +0,0 @@ -/* How to obtain function inlining. */ -#define INLINE inline __attribute__((always_inline)) From 943adfb1fef18e0284d4697346555d0ee6e49688 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 22:44:46 +0000 Subject: [PATCH 903/985] Redesign the libjpeg regression tests so that they fully cover all of the SIMD-accelerated algorithms (and most of the other ones as well) --- CMakeLists.txt | 440 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 288 insertions(+), 152 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1258570..8d7c9b7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,164 +283,300 @@ endif() enable_testing() -set(MD5_JPEG_INT 9a68f56bc76e466aa7e52f415d0f4a5f) -set(MD5_JPEG_FAST 0e1502e7fa421835e376a314fac2a39f) -set(MD5_JPEG_FAST_100 7bf72a8e741d64eecb960c97323af77c) -set(MD5_JPEG_FLOAT d1623885ffafcd40c684af09e3d65cd5) -set(MD5_JPEG_FLOAT_NOSIMD fb4884c35f8273f498cb32879de5c455) -set(MD5_JPEG_INT_GRAY 72b51f894b8f4a10b3ee3066770aa38d) -set(MD5_PPM_INT d1ed0d11f076b842525271647716aeb8) -set(MD5_PPM_FAST 048298a2d2410261c0533cb97bcfef23) -set(MD5_PPM_FLOAT 7f5b446ee36b2630e06785b8d42af15f) -set(MD5_PPM_FLOAT_NOSIMD 64072f1dbdc5b3a187777788604971a5) -set(MD5_PPM_INT_2_1 9f9de8c0612f8d06869b960b05abf9c9) -set(MD5_PPM_INT_15_8 b6875bc070720b899566cc06459b63b7) -set(MD5_PPM_INT_7_4 06a177eae05f164fac57f7a2c346ee87) -set(MD5_PPM_INT_13_8 bc3452573c8152f6ae552939ee19f82f) -set(MD5_PPM_INT_3_2 f5a8b88a8a7f96016f04d259cf82ed67) -set(MD5_PPM_INT_11_8 d8cc73c0aaacd4556569b59437ba00a5) -set(MD5_PPM_INT_5_4 32775dd9ad2ab90f4c5b219b53e0c86c) -set(MD5_PPM_INT_9_8 d25e61bc7eac0002f5b393aa223747b6) -set(MD5_PPM_INT_7_8 ddb564b7c74a09494016d6cd7502a946) -set(MD5_PPM_INT_3_4 8ed8e68808c3fbc4ea764fc9d2968646) -set(MD5_PPM_INT_5_8 a3363274999da2366a024efae6d16c9b) -set(MD5_PPM_INT_1_2 e692a315cea26b988c8e8b29a5dbcd81) -set(MD5_PPM_INT_3_8 79eca9175652ced755155c90e785a996) -set(MD5_PPM_INT_1_4 79cd778f8bf1a117690052cacdd54eca) -set(MD5_PPM_INT_1_8 391b3d4aca640c8567d6f8745eb2142f) -set(MD5_PPM_FAST_1_2 f30bcf6d32ccd44cbdd9aeaacbd9454f) -set(MD5_BMP_256 4980185e3776e89bd931736e1cddeee6) -set(MD5_JPEG_ARI e986fb0a637a8d833d96e8a6d6d84ea1) -set(MD5_PPM_ARI 72b59a99bcf1de24c5b27d151bde2437) -set(MD5_JPEG_PROG 1c4afddc05c0a43489ee54438a482d92) -set(MD5_JPEG_PROG_ARI 0a8f1c8f66e113c3cf635df0a475a617) +set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) +set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) +set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) +set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) +set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) +set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) +set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) +set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) +set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) +set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) +set(MD5_PPM_GRAY_RGB_ISLOW 116424ac07b79e5e801f00508eab48ec) +set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) +if(WITH_SIMD) +set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) +set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) +else() +set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) +set(MD5_PPM_3x2_FLOAT ef6a420e369440edd6b918a0cf54ba3f) +endif() +set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) +set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) +set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) +set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) +set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) +set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) +set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) +set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) +set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) +set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) +set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) +set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) +set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) +set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) +set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) +set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) +set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) if(WITH_JAVA) -add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest) -add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv) -add_test(TJUnitTest-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv -noyuvpad) -add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi) -add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv) -add_test(TJUnitTest-bi-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv -noyuvpad) + add_test(TJUnitTest + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest) + add_test(TJUnitTest-yuv + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -yuv) + add_test(TJUnitTest-yuv-nopad + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -yuv -noyuvpad) + add_test(TJUnitTest-bi + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi) + add_test(TJUnitTest-bi-yuv + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -yuv) + add_test(TJUnitTest-bi-yuv-nopad + ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar + -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} + TJUnitTest -bi -yuv -noyuvpad) endif() -add_test(tjunittest tjunittest) -add_test(tjunittest-alloc tjunittest -alloc) -add_test(tjunittest-yuv tjunittest -yuv) -add_test(tjunittest-yuv-alloc tjunittest -yuv -alloc) -add_test(tjunittest-yuv-nopad tjunittest -yuv -noyuvpad) -add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -if(WITH_SIMD) -add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -else() -add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -add_test(cjpeg-int-gray sharedlib/cjpeg -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -if(WITH_SIMD) -add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -else() -add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) -string(REGEX REPLACE "_" "/" scalearg ${scale}) -add_test(djpeg-int-${scale} sharedlib/djpeg -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endforeach() -add_test(djpeg-fast-1_2 sharedlib/djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg) -add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -if(WITH_ARITH_ENC) -add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) -add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) -add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-prog-ari sharedlib/cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) -endif() -if(WITH_ARITH_DEC) -add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(jpegtran-fromari sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(tjunittest-static tjunittest-static) -add_test(tjunittest-static-alloc tjunittest-static -alloc) -add_test(tjunittest-static-yuv tjunittest-static -yuv) -add_test(tjunittest-static-yuv-alloc tjunittest-static -yuv -alloc) -add_test(tjunittest-static-yuv-nopad tjunittest-static -yuv -noyuvpad) -add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -if(WITH_SIMD) -add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -else() -add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -add_test(cjpeg-static-int-gray cjpeg-static -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -if(WITH_SIMD) -add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -else() -add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) -string(REGEX REPLACE "_" "/" scalearg ${scale}) -add_test(djpeg-static-int-${scale} djpeg-static -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-static-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) +foreach(libtype shared static) + if(libtype STREQUAL "shared") + set(dir sharedlib/) + else() + set(dir "") + set(suffix -static) + endif() + add_test(tjunittest${suffix} tjunittest${suffix}) + add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) + add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) + add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) + add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) + + # These tests are carefully chosen to provide full coverage of as many of the + # underlying algorithms as possible (including all of the SIMD-accelerated + # ones.) + + # CC: null SAMP: fullsize FDCT: islow ENT: huff + add_test(cjpeg${suffix}-rgb-islow + ${dir}cjpeg${suffix} -rgb -dct int -outfile testout_rgb_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-rgb-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_RGB_ISLOW} -DFILE=testout_rgb_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: null SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow + ${dir}djpeg${suffix} -dct int -ppm -outfile testout_rgb_islow.ppm + testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff + add_test(cjpeg${suffix}-422-ifast-opt + ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt + -outfile testout_422_ifast_opt.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-422-ifast-opt-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_422_IFAST_OPT} + -DFILE=testout_422_ifast_opt.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422-ifast + ${dir}djpeg${suffix} -dct fast -outfile testout_422_ifast.ppm + testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422-ifast-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422_IFAST} -DFILE=testout_422_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast + ${dir}djpeg${suffix} -nosmooth -dct fast -outfile testout_422m_ifast.ppm + testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff + add_test(cjpeg${suffix}-420-q100-ifast-prog + ${dir}cjpeg${suffix} -sample 2x2 -dct fast -quality 100 -prog + -outfile testout_420_q100_ifast_prog.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_IFAST_Q100_PROG} + -DFILE=testout_420_q100_ifast_prog.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff + add_test(djpeg${suffix}-420-q100-ifast-prog + ${dir}djpeg${suffix} -dct fast -outfile testout_420_q100_ifast.ppm + testout_420_q100_ifast_prog.jpg) + add_test(djpeg${suffix}-420-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_Q100_IFAST} + -DFILE=testout_420_q100_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff + add_test(djpeg${suffix}-420m-q100-ifast-prog + ${dir}djpeg${suffix} -nosmooth -dct fast + -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) + add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} + -DFILE=testout_420m_q100_ifast.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff + add_test(cjpeg${suffix}-gray-islow + ${dir}cjpeg${suffix} -gray -dct int -outfile testout_gray_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-gray-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} + -DFILE=testout_gray_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->Gray SAMP: fullsize FDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow + ${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm + testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} + -DFILE=testout_gray_islow.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-rgb-islow + ${dir}djpeg${suffix} -rgb -dct int -outfile testout_gray_rgb_islow.ppm + testout_gray_islow.jpg) + add_test(cjpeg${suffix}-gray-rgb-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_RGB_ISLOW} + -DFILE=testout_gray_rgb_islow.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow + # ENT: 2-pass huff + add_test(cjpeg${suffix}-420s-ifast-opt + ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt -outfile + testout_420s_ifast_opt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420s-ifast-opt-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420S_IFAST_OPT} + -DFILE=testout_420s_ifast_opt.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff + add_test(cjpeg${suffix}-3x2-float-prog + ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog + -outfile testout_3x2_float_prog.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-3x2-float-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_3x2_FLOAT_PROG} + -DFILE=testout_3x2_float_prog.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff + add_test(djpeg${suffix}-3x2-float-prog + ${dir}djpeg${suffix} -dct float -outfile testout_3x2_float.ppm + testout_3x2_float_prog.jpg) + add_test(djpeg${suffix}-3x2-float-prog-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_3x2_FLOAT} -DFILE=testout_3x2_float.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + if(WITH_ARITH_ENC) + # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith + add_test(cjpeg${suffix}-420-islow-ari + ${dir}cjpeg${suffix} -dct int -arithmetic + -outfile testout_420_islow_ari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-420-islow-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} + -DFILE=testout_420_islow_ari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + add_test(jpegtran${suffix}-420-islow-ari + ${dir}jpegtran${suffix} -arithmetic + -outfile testout_420_islow_ari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) + add_test(jpegtran${suffix}-420-islow-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} + -DFILE=testout_420_islow_ari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith + add_test(cjpeg${suffix}-444-islow-progari + ${dir}cjpeg${suffix} -dct int -progressive -arithmetic -sample 1x1 + -outfile testout_444_islow_progari.jpg + ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) + add_test(cjpeg${suffix}-444-islow-progari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_444_ISLOW_PROGARI} + -DFILE=testout_444_islow_progari.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() + if(WITH_ARITH_DEC) + # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith + add_test(cjpeg${suffix}-420m-ifast-ari + ${dir}djpeg${suffix} -fast -ppm -outfile testout_420m_ifast_ari.ppm + ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + add_test(cjpeg${suffix}-420m-ifast-ari-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_IFAST_ARI} + -DFILE=testout_420m_ifast_ari.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + add_test(jpegtran${suffix}-420-islow + ${dir}jpegtran${suffix} -outfile testout_420_islow.jpg + ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) + add_test(jpegtran${suffix}-420-islow-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW} + -DFILE=testout_420_islow.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() + + # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff + # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff + # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff + # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff + # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff + # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow + # ENT: huff + # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow + # ENT: huff + # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow + # ENT: huff + # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow + # ENT: huff + # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow + # ENT: huff + # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow + # ENT: huff + # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow + # ENT: huff + foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) + string(REGEX REPLACE "_" "/" scalearg ${scale}) + add_test(djpeg${suffix}-420m-islow-${scale} + ${dir}djpeg${suffix} -dct int -nosmooth -scale ${scalearg} -ppm + -outfile testout_420m_islow_${scale}.ppm + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420m-islow-${scale}-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} + -DFILE=testout_420m_islow_${scale}.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endforeach() + + # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-256 + ${dir}djpeg${suffix} -dct int -bmp -colors 256 + -outfile testout_420_islow_256.bmp + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420-islow-256-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} + -DFILE=testout_420_islow_256.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + + add_test(jpegtran${suffix}-crop + ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect + -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(jpegtran${suffix}-crop-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endforeach() -add_test(djpeg-static-fast-1_2 djpeg-static -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-static-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg) -add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -if(WITH_ARITH_ENC) -add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) -add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) -add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(cjpeg-static-prog-ari cjpeg-static -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -add_test(cjpeg-static-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) -endif() -if(WITH_ARITH_DEC) -add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -add_test(jpegtran-static-fromari jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) -endif() -add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) -add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) From e77bd79dc221a2e98f254d4fae3219c8073e2230 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 6 May 2014 22:49:02 +0000 Subject: [PATCH 904/985] Shared the rm commands to reduce as much output noise as possible --- Makefile.am | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index bf4895f2..f6f8e70e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -229,8 +229,7 @@ endif # CC: null SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm - rm testout_rgb_islow.ppm - rm testout_rgb_islow.jpg + rm testout_rgb_islow.ppm testout_rgb_islow.jpg # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm @@ -242,8 +241,7 @@ endif # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff ./djpeg -nosmooth -dct fast -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm - rm testout_422m_ifast.ppm - rm testout_422_ifast_opt.jpg + rm testout_422m_ifast.ppm testout_422_ifast_opt.jpg # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff ./cjpeg -sample 2x2 -dct fast -quality 100 -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm @@ -255,8 +253,7 @@ endif # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff ./djpeg -nosmooth -dct fast -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm - rm testout_420m_q100_ifast.ppm - rm testout_420_q100_ifast_prog.jpg + rm testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff ./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm @@ -268,8 +265,7 @@ endif # CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff ./djpeg -rgb -dct int -outfile testout_gray_rgb_islow.ppm testout_gray_islow.jpg md5/md5cmp $(MD5_PPM_GRAY_RGB_ISLOW) testout_gray_rgb_islow.ppm - rm testout_gray_rgb_islow.ppm - rm testout_gray_islow.jpg + rm testout_gray_rgb_islow.ppm testout_gray_islow.jpg # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff @@ -283,8 +279,7 @@ endif # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff ./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg md5/md5cmp $(MD5_PPM_3x2_FLOAT) testout_3x2_float.ppm - rm testout_3x2_float.ppm - rm testout_3x2_float_prog.jpg + rm testout_3x2_float.ppm testout_3x2_float_prog.jpg if WITH_ARITH_ENC # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith From f017a5de0f3547427e3b079fb5d555424533b186 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 7 May 2014 06:02:57 +0000 Subject: [PATCH 905/985] Fix regression that caused 'make test' to fail with non-x86 SIMD code. The round-off error in the SIMD float DCT/IDCT routines only exists in the SSE and SSE2 implementations. --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index f6f8e70e..f14ddbf7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,7 +175,10 @@ MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed MD5_PPM_GRAY_RGB_ISLOW = 116424ac07b79e5e801f00508eab48ec MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 -if WITH_SIMD +# The SSE/SSE2 DCT/IDCT implementation has always produced a slight round-off +# error relative to the C code, so in this case, we just test for regression +# rather than verifying that the output matches libjpeg. +if WITH_SSE_FLOAT_DCT MD5_JPEG_3x2_FLOAT_PROG = 343e3f8caf8af5986ebaf0bdc13b5c71 MD5_PPM_3x2_FLOAT = 1a75f36e5904d6fc3a85a43da9ad89bb else From ef1c66701a91eaaa3896ec812ee1d54fb8ff0625 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 9 May 2014 14:45:55 +0000 Subject: [PATCH 906/985] Fix an error in the MIPS DSPr2 fancy upsampling routine --- simd/jsimd_mips_dspr2.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index b685b7aa..96aafd4d 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -522,8 +522,8 @@ LEAF_MIPS_DSPR2(jsimd_h2v1_fancy_upsample_mips_dspr2) beqz a0, 3f sll t0, a0, 2 lw s1, 0(a3) - addu s0, s1, t0 li s3, 0x10001 + addu s0, s1, t0 0: addiu t8, a1, -2 srl t9, t8, 2 @@ -574,8 +574,9 @@ LEAF_MIPS_DSPR2(jsimd_h2v1_fancy_upsample_mips_dspr2) addiu t7, 4 11: andi t8, 3 - beqz t8, 3f + beqz t8, 22f addiu t7, 1 + 2: lbu t0, 0(t7) addiu t7, 1 @@ -595,6 +596,7 @@ LEAF_MIPS_DSPR2(jsimd_h2v1_fancy_upsample_mips_dspr2) bgtz t8, 2b addiu s2, 2 +22: lbu t0, 0(t7) lbu t2, -1(t7) sll t1, t0, 1 From e45363d7c22eb7a503ed50121300fe75c0e2ea36 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 9 May 2014 18:00:32 +0000 Subject: [PATCH 907/985] Convert tabs to spaces in the libjpeg code and the SIMD code (TurboJPEG retains the use of tabs for historical reasons. They were annoying in the libjpeg code primarily because they were not consistently used and because they were used to format as well as indent the code. In the case of TurboJPEG, tabs are used just to indent the code, so even if the editor assumes a different tab width, the code will still be readable.) --- cderror.h | 10 +- cdjpeg.c | 40 +- cdjpeg.h | 100 +-- cjpeg.c | 174 ++--- coderules.txt | 28 +- djpeg.c | 198 +++--- example.c | 36 +- jcapimin.c | 36 +- jcapistd.c | 6 +- jcarith.c | 346 +++++----- jccoefct.c | 178 ++--- jccolext.c | 16 +- jccolor.c | 90 +-- jcdctmgr.c | 168 ++--- jchuff.c | 202 +++--- jchuff.h | 14 +- jcinit.c | 2 +- jcmainct.c | 108 ++-- jcmarker.c | 130 ++-- jcmaster.c | 146 ++--- jcomapi.c | 8 +- jconfig.txt | 14 +- jcparam.c | 36 +- jcphuff.c | 152 ++--- jcprepct.c | 128 ++-- jcsample.c | 132 ++-- jctrans.c | 106 +-- jdapimin.c | 54 +- jdapistd.c | 56 +- jdarith.c | 298 ++++----- jdatadst-tj.c | 20 +- jdatadst.c | 28 +- jdatasrc-tj.c | 8 +- jdatasrc.c | 26 +- jdcoefct.c | 378 +++++------ jdcolext.c | 4 +- jdcolor.c | 106 +-- jdct.h | 104 +-- jddctmgr.c | 186 +++--- jdhuff.c | 138 ++-- jdhuff.h | 100 +-- jdinput.c | 74 +-- jdmainct.c | 100 +-- jdmarker.c | 324 +++++----- jdmaster.c | 62 +- jdmerge.c | 86 +-- jdphuff.c | 266 ++++---- jdpostct.c | 116 ++-- jdsample.c | 136 ++-- jdtrans.c | 18 +- jerror.c | 36 +- jerror.h | 74 +-- jfdctflt.c | 42 +- jfdctfst.c | 50 +- jfdctint.c | 88 +-- jidctflt.c | 62 +- jidctfst.c | 100 +-- jidctint.c | 784 +++++++++++----------- jidctred.c | 200 +++--- jinclude.h | 14 +- jmemmgr.c | 324 +++++----- jmemnobs.c | 10 +- jmemsys.h | 72 +-- jmorecfg.h | 60 +- jpegint.h | 260 ++++---- jpeglib.h | 676 +++++++++---------- jpegtran.c | 162 ++--- jquant1.c | 256 ++++---- jquant2.c | 320 ++++----- jstdhuff.c | 2 +- jutils.c | 22 +- jversion.h | 20 +- libjpeg.txt | 1022 ++++++++++++++--------------- rdbmp.c | 64 +- rdcolmap.c | 50 +- rdgif.c | 4 +- rdjpgcom.c | 164 ++--- rdppm.c | 46 +- rdrle.c | 18 +- rdswitch.c | 98 +-- rdtarga.c | 60 +- simd/jcclrmmx.asm | 702 ++++++++++---------- simd/jcclrss2-64.asm | 700 ++++++++++---------- simd/jcclrss2.asm | 746 ++++++++++----------- simd/jccolmmx.asm | 44 +- simd/jccolss2-64.asm | 44 +- simd/jccolss2.asm | 44 +- simd/jcgrammx.asm | 30 +- simd/jcgrass2-64.asm | 30 +- simd/jcgrass2.asm | 30 +- simd/jcgrymmx.asm | 494 +++++++------- simd/jcgryss2-64.asm | 492 +++++++------- simd/jcgryss2.asm | 538 +++++++-------- simd/jcqnt3dn.asm | 308 ++++----- simd/jcqntmmx.asm | 364 +++++------ simd/jcqnts2f-64.asm | 166 ++--- simd/jcqnts2f.asm | 206 +++--- simd/jcqnts2i-64.asm | 214 +++--- simd/jcqnts2i.asm | 254 ++++---- simd/jcqntsse.asm | 270 ++++---- simd/jcsammmx.asm | 414 ++++++------ simd/jcsamss2-64.asm | 386 +++++------ simd/jcsamss2.asm | 454 ++++++------- simd/jdclrmmx.asm | 590 ++++++++--------- simd/jdclrss2-64.asm | 648 +++++++++---------- simd/jdclrss2.asm | 692 ++++++++++---------- simd/jdcolmmx.asm | 38 +- simd/jdcolss2-64.asm | 38 +- simd/jdcolss2.asm | 38 +- simd/jdct.inc | 10 +- simd/jdmermmx.asm | 38 +- simd/jdmerss2-64.asm | 38 +- simd/jdmerss2.asm | 38 +- simd/jdmrgmmx.asm | 652 +++++++++---------- simd/jdmrgss2-64.asm | 768 +++++++++++----------- simd/jdmrgss2.asm | 754 ++++++++++----------- simd/jdsammmx.asm | 1006 ++++++++++++++-------------- simd/jdsamss2-64.asm | 862 ++++++++++++------------ simd/jdsamss2.asm | 998 ++++++++++++++-------------- simd/jf3dnflt.asm | 436 ++++++------- simd/jfmmxfst.asm | 542 ++++++++-------- simd/jfmmxint.asm | 950 +++++++++++++-------------- simd/jfss2fst-64.asm | 536 +++++++-------- simd/jfss2fst.asm | 560 ++++++++-------- simd/jfss2int-64.asm | 1124 ++++++++++++++++---------------- simd/jfss2int.asm | 1152 ++++++++++++++++----------------- simd/jfsseflt-64.asm | 488 +++++++------- simd/jfsseflt.asm | 514 +++++++-------- simd/ji3dnflt.asm | 646 +++++++++--------- simd/jimmxfst.asm | 716 ++++++++++---------- simd/jimmxint.asm | 1320 ++++++++++++++++++------------------- simd/jimmxred.asm | 1030 ++++++++++++++--------------- simd/jiss2flt-64.asm | 686 ++++++++++---------- simd/jiss2flt.asm | 720 ++++++++++----------- simd/jiss2fst-64.asm | 688 ++++++++++---------- simd/jiss2fst.asm | 716 ++++++++++---------- simd/jiss2int-64.asm | 1300 ++++++++++++++++++------------------- simd/jiss2int.asm | 1330 +++++++++++++++++++------------------- simd/jiss2red-64.asm | 786 +++++++++++----------- simd/jiss2red.asm | 836 ++++++++++++------------ simd/jisseflt.asm | 844 ++++++++++++------------ simd/jsimd_arm_neon_64.S | 20 +- simd/jsimdcpu.asm | 114 ++-- simd/jsimdext.inc | 236 +++---- structure.txt | 50 +- transupp.c | 934 +++++++++++++------------- transupp.h | 104 +-- usage.txt | 384 +++++------ wizard.txt | 126 ++-- wrbmp.c | 84 +-- wrgif.c | 74 +-- wrjpgcom.c | 176 ++--- wrppm.c | 40 +- wrrle.c | 26 +- wrtarga.c | 42 +- 155 files changed, 22460 insertions(+), 22460 deletions(-) diff --git a/cderror.h b/cderror.h index e19c475c..6ccb37c3 100644 --- a/cderror.h +++ b/cderror.h @@ -33,7 +33,7 @@ typedef enum { -#define JMESSAGE(code,string) code , +#define JMESSAGE(code,string) code , #endif /* JMAKE_ENUM_LIST */ @@ -62,7 +62,7 @@ JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") JMESSAGE(JERR_GIF_NOT, "Not a GIF file") JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") JMESSAGE(JTRC_GIF_BADVERSION, - "Warning: unexpected GIF version number '%c%c%c'") + "Warning: unexpected GIF version number '%c%c%c'") JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") @@ -110,13 +110,13 @@ JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") #endif /* TARGA_SUPPORTED */ JMESSAGE(JERR_BAD_CMAP_FILE, - "Color map file is invalid or of unsupported format") + "Color map file is invalid or of unsupported format") JMESSAGE(JERR_TOO_MANY_COLORS, - "Output file format cannot handle %d colormap entries") + "Output file format cannot handle %d colormap entries") JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") #ifdef TARGA_SUPPORTED JMESSAGE(JERR_UNKNOWN_FORMAT, - "Unrecognized input file format --- perhaps you need -targa") + "Unrecognized input file format --- perhaps you need -targa") #else JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") #endif diff --git a/cdjpeg.c b/cdjpeg.c index b6250ff9..17f1de7d 100644 --- a/cdjpeg.c +++ b/cdjpeg.c @@ -9,15 +9,15 @@ * programs (cjpeg, djpeg, jpegtran). */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include /* to declare isupper(), tolower() */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include /* to declare isupper(), tolower() */ #ifdef NEED_SIGNAL_CATCHER -#include /* to declare signal() */ +#include /* to declare signal() */ #endif #ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ +#include /* to declare setmode()'s parameter macros */ /* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ +#include /* to declare setmode() */ #endif @@ -31,13 +31,13 @@ static j_common_ptr sig_cinfo; -void /* must be global for Manx C */ +void /* must be global for Manx C */ signal_catcher (int signum) { if (sig_cinfo != NULL) { if (sig_cinfo->err != NULL) /* turn off trace output */ sig_cinfo->err->trace_level = 0; - jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ + jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ } exit(EXIT_FAILURE); } @@ -47,10 +47,10 @@ GLOBAL(void) enable_signal_catcher (j_common_ptr cinfo) { sig_cinfo = cinfo; -#ifdef SIGINT /* not all systems have SIGINT */ +#ifdef SIGINT /* not all systems have SIGINT */ signal(SIGINT, signal_catcher); #endif -#ifdef SIGTERM /* not all systems have SIGTERM */ +#ifdef SIGTERM /* not all systems have SIGTERM */ signal(SIGTERM, signal_catcher); #endif } @@ -75,8 +75,8 @@ progress_monitor (j_common_ptr cinfo) prog->percent_done = percent_done; if (total_passes > 1) { fprintf(stderr, "\rPass %d/%d: %3d%% ", - prog->pub.completed_passes + prog->completed_extra_passes + 1, - total_passes, percent_done); + prog->pub.completed_passes + prog->completed_extra_passes + 1, + total_passes, percent_done); } else { fprintf(stderr, "\r %3d%% ", percent_done); } @@ -126,17 +126,17 @@ keymatch (char * arg, const char * keyword, int minchars) while ((ca = *arg++) != '\0') { if ((ck = *keyword++) == '\0') - return FALSE; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ + return FALSE; /* arg longer than keyword, no good */ + if (isupper(ca)) /* force arg to lcase (assume ck is already) */ ca = tolower(ca); if (ca != ck) - return FALSE; /* no good */ - nmatched++; /* count matched characters */ + return FALSE; /* no good */ + nmatched++; /* count matched characters */ } /* reached end of argument; fail if it's too short for unique abbrev */ if (nmatched < minchars) return FALSE; - return TRUE; /* A-OK */ + return TRUE; /* A-OK */ } @@ -150,10 +150,10 @@ read_stdin (void) { FILE * input_file = stdin; -#ifdef USE_SETMODE /* need to hack file mode? */ +#ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdin), O_BINARY); #endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdin\n"); exit(EXIT_FAILURE); @@ -168,10 +168,10 @@ write_stdout (void) { FILE * output_file = stdout; -#ifdef USE_SETMODE /* need to hack file mode? */ +#ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdout), O_BINARY); #endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdout\n"); exit(EXIT_FAILURE); diff --git a/cdjpeg.h b/cdjpeg.h index ed024ac3..0a8f197d 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -9,12 +9,12 @@ * cjpeg and djpeg. It is NOT used by the core JPEG library. */ -#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ -#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ +#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ +#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ #include "jinclude.h" #include "jpeglib.h" -#include "jerror.h" /* get library error codes too */ -#include "cderror.h" /* get application-specific error codes */ +#include "jerror.h" /* get library error codes too */ +#include "cderror.h" /* get application-specific error codes */ /* @@ -25,11 +25,11 @@ typedef struct cjpeg_source_struct * cjpeg_source_ptr; struct cjpeg_source_struct { JMETHOD(void, start_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + cjpeg_source_ptr sinfo)); JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + cjpeg_source_ptr sinfo)); JMETHOD(void, finish_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + cjpeg_source_ptr sinfo)); FILE *input_file; @@ -49,14 +49,14 @@ struct djpeg_dest_struct { * The color map will be ready at this time, if one is needed. */ JMETHOD(void, start_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); + djpeg_dest_ptr dinfo)); /* Emit the specified number of pixel rows from the buffer. */ JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); + djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied)); /* Finish up at the end of the image. */ JMETHOD(void, finish_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); + djpeg_dest_ptr dinfo)); /* Target file spec; filled in by djpeg.c after object is created. */ FILE * output_file; @@ -79,9 +79,9 @@ struct djpeg_dest_struct { */ struct cdjpeg_progress_mgr { - struct jpeg_progress_mgr pub; /* fields known to JPEG library */ - int completed_extra_passes; /* extra passes completed */ - int total_extra_passes; /* total extra */ + struct jpeg_progress_mgr pub; /* fields known to JPEG library */ + int completed_extra_passes; /* extra passes completed */ + int total_extra_passes; /* total extra */ /* last printed percentage stored here to avoid multiple printouts */ int percent_done; }; @@ -92,34 +92,34 @@ typedef struct cdjpeg_progress_mgr * cd_progress_ptr; /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_read_bmp jIRdBMP -#define jinit_write_bmp jIWrBMP -#define jinit_read_gif jIRdGIF -#define jinit_write_gif jIWrGIF -#define jinit_read_ppm jIRdPPM -#define jinit_write_ppm jIWrPPM -#define jinit_read_rle jIRdRLE -#define jinit_write_rle jIWrRLE -#define jinit_read_targa jIRdTarga -#define jinit_write_targa jIWrTarga -#define read_quant_tables RdQTables -#define read_scan_script RdScnScript +#define jinit_read_bmp jIRdBMP +#define jinit_write_bmp jIWrBMP +#define jinit_read_gif jIRdGIF +#define jinit_write_gif jIWrGIF +#define jinit_read_ppm jIRdPPM +#define jinit_write_ppm jIWrPPM +#define jinit_read_rle jIRdRLE +#define jinit_write_rle jIWrRLE +#define jinit_read_targa jIRdTarga +#define jinit_write_targa jIWrTarga +#define read_quant_tables RdQTables +#define read_scan_script RdScnScript #define set_quality_ratings SetQRates -#define set_quant_slots SetQSlots -#define set_sample_factors SetSFacts -#define read_color_map RdCMap -#define enable_signal_catcher EnSigCatcher -#define start_progress_monitor StProgMon -#define end_progress_monitor EnProgMon -#define read_stdin RdStdin -#define write_stdout WrStdout +#define set_quant_slots SetQSlots +#define set_sample_factors SetSFacts +#define read_color_map RdCMap +#define enable_signal_catcher EnSigCatcher +#define start_progress_monitor StProgMon +#define end_progress_monitor EnProgMon +#define read_stdin RdStdin +#define write_stdout WrStdout #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* 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)); + 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)); @@ -132,10 +132,10 @@ 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, - boolean force_baseline)); + boolean force_baseline)); EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg, - boolean force_baseline)); + boolean force_baseline)); EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); @@ -147,7 +147,7 @@ EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, - cd_progress_ptr progress)); + 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)); @@ -155,32 +155,32 @@ EXTERN(FILE *) write_stdout JPP((void)); /* miscellaneous useful macros */ -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" #endif #endif -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS #ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ #else #define EXIT_SUCCESS 0 #endif #endif #ifndef EXIT_WARNING #ifdef VMS -#define EXIT_WARNING 1 /* VMS is very nonstandard */ +#define EXIT_WARNING 1 /* VMS is very nonstandard */ #else #define EXIT_WARNING 2 #endif diff --git a/cjpeg.c b/cjpeg.c index 7f038198..4429c49d 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -13,8 +13,8 @@ * * Two different command line styles are permitted, depending on the * compile-time switch TWO_FILE_COMMANDLINE: - * cjpeg [options] inputfile outputfile - * cjpeg [options] [inputfile] + * cjpeg [options] inputfile outputfile + * cjpeg [options] [inputfile] * In the second style, output is always to standard output, which you'd * normally redirect to a file or pipe to some other program. Input is * either from a named file or from standard input (typically redirected). @@ -22,28 +22,28 @@ * don't support pipes. Also, you MUST use the first style if your system * doesn't do binary I/O to stdin/stdout. * To simplify script writing, the "-outfile" switch is provided. The syntax - * cjpeg [options] -outfile outputfile inputfile + * cjpeg [options] -outfile outputfile inputfile * works regardless of which command line style is used. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "jversion.h" /* for version message */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "jversion.h" /* for version message */ #include "jconfigint.h" -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ #include /* Metrowerks needs this */ -#include /* ... and this */ +#include /* ... and this */ #endif #ifdef THINK_C -#include /* Think declares it here */ +#include /* Think declares it here */ #endif #endif /* Create the add-on message string table. */ -#define JMESSAGE(code,string) string , +#define JMESSAGE(code,string) string , static const char * const cdjpeg_message_table[] = { #include "cderror.h" @@ -77,7 +77,7 @@ static const char * const cdjpeg_message_table[] = { * seldom-used ID field), so we provide a switch to force Targa input mode. */ -static boolean is_targa; /* records user -targa switch */ +static boolean is_targa; /* records user -targa switch */ LOCAL(cjpeg_source_ptr) @@ -124,7 +124,7 @@ select_file_type (j_compress_ptr cinfo, FILE * infile) break; } - return NULL; /* suppress compiler warnings */ + return NULL; /* suppress compiler warnings */ } @@ -137,8 +137,8 @@ select_file_type (j_compress_ptr cinfo, FILE * infile) */ -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ boolean memdst; /* for -memdst switch */ @@ -172,15 +172,15 @@ usage (void) #endif #ifdef DCT_ISLOW_SUPPORTED fprintf(stderr, " -dct int Use integer DCT method%s\n", - (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); #endif #ifdef DCT_IFAST_SUPPORTED fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", - (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); #endif #ifdef DCT_FLOAT_SUPPORTED fprintf(stderr, " -dct float Use floating-point DCT method%s\n", - (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); #endif fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); #ifdef INPUT_SMOOTHING_SUPPORTED @@ -206,7 +206,7 @@ usage (void) LOCAL(int) parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) + int last_file_arg_seen, boolean for_real) /* Parse optional switches. * Returns argv[] index of first file-name argument (== argc if none). * Any file names with indexes <= last_file_arg_seen are ignored; @@ -220,15 +220,15 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, char * arg; boolean force_baseline; boolean simple_progressive; - char * qualityarg = NULL; /* saves -quality parm if any */ - char * qtablefile = NULL; /* saves -qtables filename if any */ - char * qslotsarg = NULL; /* saves -qslots parm if any */ - char * samplearg = NULL; /* saves -sample parm if any */ - char * scansarg = NULL; /* saves -scans parm if any */ + char * qualityarg = NULL; /* saves -quality parm if any */ + char * qtablefile = NULL; /* saves -qtables filename if any */ + char * qslotsarg = NULL; /* saves -qslots parm if any */ + char * samplearg = NULL; /* saves -sample parm if any */ + char * scansarg = NULL; /* saves -scans parm if any */ /* Set up default JPEG parameters. */ - force_baseline = FALSE; /* by default, allow 16-bit quantizers */ + force_baseline = FALSE; /* by default, allow 16-bit quantizers */ simple_progressive = FALSE; is_targa = FALSE; outfilename = NULL; @@ -242,12 +242,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, if (*arg != '-') { /* Not a switch, must be a file name argument */ if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ } - break; /* else done parsing switches */ + break; /* else done parsing switches */ } - arg++; /* advance past switch marker character */ + arg++; /* advance past switch marker character */ if (keymatch(arg, "arithmetic", 1)) { /* Use arithmetic coding. */ @@ -255,7 +255,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, cinfo->arith_code = TRUE; #else fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", - progname); + progname); exit(EXIT_FAILURE); #endif @@ -265,16 +265,16 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "dct", 2)) { /* Select DCT algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "int", 1)) { - cinfo->dct_method = JDCT_ISLOW; + cinfo->dct_method = JDCT_ISLOW; } else if (keymatch(argv[argn], "fast", 2)) { - cinfo->dct_method = JDCT_IFAST; + cinfo->dct_method = JDCT_IFAST; } else if (keymatch(argv[argn], "float", 2)) { - cinfo->dct_method = JDCT_FLOAT; + cinfo->dct_method = JDCT_FLOAT; } else - usage(); + usage(); } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { /* Enable debug printouts. */ @@ -282,12 +282,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, static boolean printed_version = FALSE; if (! printed_version) { - fprintf(stderr, "%s version %s (build %s)\n", - PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); - fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", - JVERSION); - printed_version = TRUE; + fprintf(stderr, "%s version %s (build %s)\n", + PACKAGE_NAME, VERSION, BUILD); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", + JVERSION); + printed_version = TRUE; } cinfo->err->trace_level++; @@ -304,12 +304,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, long lval; char ch = 'x'; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); + usage(); if (ch == 'm' || ch == 'M') - lval *= 1000L; + lval *= 1000L; cinfo->mem->max_memory_to_use = lval * 1000L; } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { @@ -318,15 +318,15 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, cinfo->optimize_coding = TRUE; #else fprintf(stderr, "%s: sorry, entropy optimization was not compiled in\n", - progname); + progname); exit(EXIT_FAILURE); #endif } else if (keymatch(arg, "outfile", 4)) { /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ } else if (keymatch(arg, "progressive", 1)) { /* Select simple progressive mode. */ @@ -335,7 +335,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, /* We must postpone execution until num_components is known. */ #else fprintf(stderr, "%s: sorry, progressive output was not compiled in\n", - progname); + progname); exit(EXIT_FAILURE); #endif @@ -351,14 +351,14 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "quality", 1)) { /* Quality ratings (quantization table scaling factors). */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); qualityarg = argv[argn]; } else if (keymatch(arg, "qslots", 2)) { /* Quantization table slot numbers. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); qslotsarg = argv[argn]; /* Must delay setting qslots until after we have processed any * colorspace-determining switches, since jpeg_set_colorspace sets @@ -367,8 +367,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "qtables", 2)) { /* Quantization tables fetched from file. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); qtablefile = argv[argn]; /* We postpone actually reading the file in case -quality comes later. */ @@ -377,24 +377,24 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, long lval; char ch = 'x'; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); + usage(); if (lval < 0 || lval > 65535L) - usage(); + usage(); if (ch == 'b' || ch == 'B') { - cinfo->restart_interval = (unsigned int) lval; - cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ + cinfo->restart_interval = (unsigned int) lval; + cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ } else { - cinfo->restart_in_rows = (int) lval; - /* restart_interval will be computed during startup */ + cinfo->restart_in_rows = (int) lval; + /* restart_interval will be computed during startup */ } } else if (keymatch(arg, "sample", 2)) { /* Set sampling factors. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); samplearg = argv[argn]; /* Must delay setting sample factors until after we have processed any * colorspace-determining switches, since jpeg_set_colorspace sets @@ -404,13 +404,13 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "scans", 4)) { /* Set scan script. */ #ifdef C_MULTISCAN_FILES_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); scansarg = argv[argn]; /* We must postpone reading the file in case -progressive appears. */ #else fprintf(stderr, "%s: sorry, multi-scan output was not compiled in\n", - progname); + progname); exit(EXIT_FAILURE); #endif @@ -418,12 +418,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, /* Set input smoothing factor. */ int val; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%d", &val) != 1) - usage(); + usage(); if (val < 0 || val > 100) - usage(); + usage(); cinfo->smoothing_factor = val; } else if (keymatch(arg, "targa", 1)) { @@ -431,7 +431,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, is_targa = TRUE; } else { - usage(); /* bogus switch */ + usage(); /* bogus switch */ } } @@ -441,35 +441,35 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, /* Set quantization tables for selected quality. */ /* Some or all may be overridden if -qtables is present. */ - if (qualityarg != NULL) /* process -quality if it was present */ + if (qualityarg != NULL) /* process -quality if it was present */ if (! set_quality_ratings(cinfo, qualityarg, force_baseline)) - usage(); + usage(); - if (qtablefile != NULL) /* process -qtables if it was present */ + if (qtablefile != NULL) /* process -qtables if it was present */ if (! read_quant_tables(cinfo, qtablefile, force_baseline)) - usage(); + usage(); - if (qslotsarg != NULL) /* process -qslots if it was present */ + if (qslotsarg != NULL) /* process -qslots if it was present */ if (! set_quant_slots(cinfo, qslotsarg)) - usage(); + usage(); - if (samplearg != NULL) /* process -sample if it was present */ + if (samplearg != NULL) /* process -sample if it was present */ if (! set_sample_factors(cinfo, samplearg)) - usage(); + usage(); #ifdef C_PROGRESSIVE_SUPPORTED - if (simple_progressive) /* process -progressive; -scans can override */ + if (simple_progressive) /* process -progressive; -scans can override */ jpeg_simple_progression(cinfo); #endif #ifdef C_MULTISCAN_FILES_SUPPORTED - if (scansarg != NULL) /* process -scans if it was present */ + if (scansarg != NULL) /* process -scans if it was present */ if (! read_scan_script(cinfo, scansarg)) - usage(); + usage(); #endif } - return argn; /* return index of next arg (file name) */ + return argn; /* return index of next arg (file name) */ } @@ -500,7 +500,7 @@ main (int argc, char **argv) progname = argv[0]; if (progname == NULL || progname[0] == 0) - progname = "cjpeg"; /* in case C library doesn't provide it */ + progname = "cjpeg"; /* in case C library doesn't provide it */ /* Initialize the JPEG compression object with default error handling. */ cinfo.err = jpeg_std_error(&jerr); @@ -637,5 +637,5 @@ main (int argc, char **argv) /* All done. */ exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ + return 0; /* suppress no-return-value warnings */ } diff --git a/coderules.txt b/coderules.txt index 357929fb..ea8fcc08 100644 --- a/coderules.txt +++ b/coderules.txt @@ -21,11 +21,11 @@ Block comments should be laid out thusly: */ We indent statements in K&R style, e.g., - if (test) { - then-part; - } else { - else-part; - } + if (test) { + then-part; + } else { + else-part; + } with two spaces per indentation level. (This indentation convention is handled automatically by GNU Emacs and many other text editors.) @@ -57,16 +57,16 @@ 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 - #ifdef HAVE_PROTOTYPES - #define JMETHOD(type,methodname,arglist) type (*methodname) arglist - #else - #define JMETHOD(type,methodname,arglist) type (*methodname) () - #endif + #ifdef HAVE_PROTOTYPES + #define JMETHOD(type,methodname,arglist) type (*methodname) arglist + #else + #define JMETHOD(type,methodname,arglist) type (*methodname) () + #endif which is used like this: - struct function_pointers { - JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp)); - JMETHOD(void, term_entropy_encoder, (void)); - }; + struct function_pointers { + JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp)); + JMETHOD(void, term_entropy_encoder, (void)); + }; Note the set of parentheses surrounding the parameter list. A similar solution is used for forward and external function declarations diff --git a/djpeg.c b/djpeg.c index c1abb139..7a2eaa07 100644 --- a/djpeg.c +++ b/djpeg.c @@ -12,8 +12,8 @@ * * Two different command line styles are permitted, depending on the * compile-time switch TWO_FILE_COMMANDLINE: - * djpeg [options] inputfile outputfile - * djpeg [options] [inputfile] + * djpeg [options] inputfile outputfile + * djpeg [options] [inputfile] * In the second style, output is always to standard output, which you'd * normally redirect to a file or pipe to some other program. Input is * either from a named file or from standard input (typically redirected). @@ -21,30 +21,30 @@ * don't support pipes. Also, you MUST use the first style if your system * doesn't do binary I/O to stdin/stdout. * To simplify script writing, the "-outfile" switch is provided. The syntax - * djpeg [options] -outfile outputfile inputfile + * djpeg [options] -outfile outputfile inputfile * works regardless of which command line style is used. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "jversion.h" /* for version message */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "jversion.h" /* for version message */ #include "jconfigint.h" -#include /* to declare isprint() */ +#include /* to declare isprint() */ -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ #include /* Metrowerks needs this */ -#include /* ... and this */ +#include /* ... and this */ #endif #ifdef THINK_C -#include /* Think declares it here */ +#include /* Think declares it here */ #endif #endif /* Create the add-on message string table. */ -#define JMESSAGE(code,string) string , +#define JMESSAGE(code,string) string , static const char * const cdjpeg_message_table[] = { #include "cderror.h" @@ -60,17 +60,17 @@ static const char * const cdjpeg_message_table[] = { */ typedef enum { - FMT_BMP, /* BMP format (Windows flavor) */ - FMT_GIF, /* GIF format */ - FMT_OS2, /* BMP format (OS/2 flavor) */ - FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ - FMT_RLE, /* RLE format */ - FMT_TARGA, /* Targa format */ - FMT_TIFF /* TIFF format */ + FMT_BMP, /* BMP format (Windows flavor) */ + FMT_GIF, /* GIF format */ + FMT_OS2, /* BMP format (OS/2 flavor) */ + FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ + FMT_RLE, /* RLE format */ + FMT_TARGA, /* Targa format */ + FMT_TIFF /* TIFF format */ } IMAGE_FORMATS; -#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ -#define DEFAULT_FMT FMT_PPM +#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ +#define DEFAULT_FMT FMT_PPM #endif static IMAGE_FORMATS requested_fmt; @@ -85,8 +85,8 @@ static IMAGE_FORMATS requested_fmt; */ -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ boolean memsrc; /* for -memsrc switch */ #define INPUT_BUF_SIZE 4096 @@ -112,40 +112,40 @@ usage (void) #endif #ifdef BMP_SUPPORTED fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n", - (DEFAULT_FMT == FMT_BMP ? " (default)" : "")); + (DEFAULT_FMT == FMT_BMP ? " (default)" : "")); #endif #ifdef GIF_SUPPORTED fprintf(stderr, " -gif Select GIF output format%s\n", - (DEFAULT_FMT == FMT_GIF ? " (default)" : "")); + (DEFAULT_FMT == FMT_GIF ? " (default)" : "")); #endif #ifdef BMP_SUPPORTED fprintf(stderr, " -os2 Select BMP output format (OS/2 style)%s\n", - (DEFAULT_FMT == FMT_OS2 ? " (default)" : "")); + (DEFAULT_FMT == FMT_OS2 ? " (default)" : "")); #endif #ifdef PPM_SUPPORTED fprintf(stderr, " -pnm Select PBMPLUS (PPM/PGM) output format%s\n", - (DEFAULT_FMT == FMT_PPM ? " (default)" : "")); + (DEFAULT_FMT == FMT_PPM ? " (default)" : "")); #endif #ifdef RLE_SUPPORTED fprintf(stderr, " -rle Select Utah RLE output format%s\n", - (DEFAULT_FMT == FMT_RLE ? " (default)" : "")); + (DEFAULT_FMT == FMT_RLE ? " (default)" : "")); #endif #ifdef TARGA_SUPPORTED fprintf(stderr, " -targa Select Targa output format%s\n", - (DEFAULT_FMT == FMT_TARGA ? " (default)" : "")); + (DEFAULT_FMT == FMT_TARGA ? " (default)" : "")); #endif fprintf(stderr, "Switches for advanced users:\n"); #ifdef DCT_ISLOW_SUPPORTED fprintf(stderr, " -dct int Use integer DCT method%s\n", - (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); #endif #ifdef DCT_IFAST_SUPPORTED fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", - (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); #endif #ifdef DCT_FLOAT_SUPPORTED fprintf(stderr, " -dct float Use floating-point DCT method%s\n", - (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); + (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); #endif fprintf(stderr, " -dither fs Use F-S dithering (default)\n"); fprintf(stderr, " -dither none Don't use dithering in quantization\n"); @@ -170,7 +170,7 @@ usage (void) LOCAL(int) parse_switches (j_decompress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) + int last_file_arg_seen, boolean for_real) /* Parse optional switches. * Returns argv[] index of first file-name argument (== argc if none). * Any file names with indexes <= last_file_arg_seen are ignored; @@ -184,7 +184,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, char * arg; /* Set up default JPEG parameters. */ - requested_fmt = DEFAULT_FMT; /* set default output file format */ + requested_fmt = DEFAULT_FMT; /* set default output file format */ outfilename = NULL; memsrc = FALSE; cinfo->err->trace_level = 0; @@ -196,54 +196,54 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, if (*arg != '-') { /* Not a switch, must be a file name argument */ if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ } - break; /* else done parsing switches */ + break; /* else done parsing switches */ } - arg++; /* advance past switch marker character */ + arg++; /* advance past switch marker character */ if (keymatch(arg, "bmp", 1)) { /* BMP output format. */ requested_fmt = FMT_BMP; } else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) || - keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) { + keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) { /* Do color quantization. */ int val; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%d", &val) != 1) - usage(); + usage(); cinfo->desired_number_of_colors = val; cinfo->quantize_colors = TRUE; } else if (keymatch(arg, "dct", 2)) { /* Select IDCT algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "int", 1)) { - cinfo->dct_method = JDCT_ISLOW; + cinfo->dct_method = JDCT_ISLOW; } else if (keymatch(argv[argn], "fast", 2)) { - cinfo->dct_method = JDCT_IFAST; + cinfo->dct_method = JDCT_IFAST; } else if (keymatch(argv[argn], "float", 2)) { - cinfo->dct_method = JDCT_FLOAT; + cinfo->dct_method = JDCT_FLOAT; } else - usage(); + usage(); } else if (keymatch(arg, "dither", 2)) { /* Select dithering algorithm. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "fs", 2)) { - cinfo->dither_mode = JDITHER_FS; + cinfo->dither_mode = JDITHER_FS; } else if (keymatch(argv[argn], "none", 2)) { - cinfo->dither_mode = JDITHER_NONE; + cinfo->dither_mode = JDITHER_NONE; } else if (keymatch(argv[argn], "ordered", 2)) { - cinfo->dither_mode = JDITHER_ORDERED; + cinfo->dither_mode = JDITHER_ORDERED; } else - usage(); + usage(); } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { /* Enable debug printouts. */ @@ -251,12 +251,12 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, static boolean printed_version = FALSE; if (! printed_version) { - fprintf(stderr, "%s version %s (build %s)\n", - PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); - fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", - JVERSION); - printed_version = TRUE; + fprintf(stderr, "%s version %s (build %s)\n", + PACKAGE_NAME, VERSION, BUILD); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", + JVERSION); + printed_version = TRUE; } cinfo->err->trace_level++; @@ -265,7 +265,7 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, cinfo->two_pass_quantize = FALSE; cinfo->dither_mode = JDITHER_ORDERED; if (! cinfo->quantize_colors) /* don't override an earlier -colors */ - cinfo->desired_number_of_colors = 216; + cinfo->desired_number_of_colors = 216; cinfo->dct_method = JDCT_FASTEST; cinfo->do_fancy_upsampling = FALSE; @@ -283,21 +283,21 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "map", 3)) { /* Quantize to a color map taken from an input file. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - if (for_real) { /* too expensive to do twice! */ -#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ - FILE * mapfile; + if (++argn >= argc) /* advance to next argument */ + usage(); + if (for_real) { /* too expensive to do twice! */ +#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ + FILE * mapfile; - if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - read_color_map(cinfo, mapfile); - fclose(mapfile); - cinfo->quantize_colors = TRUE; + if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); + exit(EXIT_FAILURE); + } + read_color_map(cinfo, mapfile); + fclose(mapfile); + cinfo->quantize_colors = TRUE; #else - ERREXIT(cinfo, JERR_NOT_COMPILED); + ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } @@ -306,12 +306,12 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, long lval; char ch = 'x'; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); + usage(); if (ch == 'm' || ch == 'M') - lval *= 1000L; + lval *= 1000L; cinfo->mem->max_memory_to_use = lval * 1000L; } else if (keymatch(arg, "nosmooth", 3)) { @@ -328,9 +328,9 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "outfile", 4)) { /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ } else if (keymatch(arg, "memsrc", 2)) { /* Use in-memory source manager */ @@ -352,22 +352,22 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, } else if (keymatch(arg, "scale", 1)) { /* Scale the output image by a fraction M/N. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%d/%d", - &cinfo->scale_num, &cinfo->scale_denom) != 2) - usage(); + &cinfo->scale_num, &cinfo->scale_denom) != 2) + usage(); } else if (keymatch(arg, "targa", 1)) { /* Targa output format. */ requested_fmt = FMT_TARGA; } else { - usage(); /* bogus switch */ + usage(); /* bogus switch */ } } - return argn; /* return index of next arg (file name) */ + return argn; /* return index of next arg (file name) */ } @@ -403,14 +403,14 @@ print_text_marker (j_decompress_ptr cinfo) length = jpeg_getc(cinfo) << 8; length += jpeg_getc(cinfo); - length -= 2; /* discount the length word itself */ + length -= 2; /* discount the length word itself */ if (traceit) { if (cinfo->unread_marker == JPEG_COM) fprintf(stderr, "Comment, length %ld:\n", (long) length); - else /* assume it is an APPn otherwise */ + else /* assume it is an APPn otherwise */ fprintf(stderr, "APP%d, length %ld:\n", - cinfo->unread_marker - JPEG_APP0, (long) length); + cinfo->unread_marker - JPEG_APP0, (long) length); } while (--length >= 0) { @@ -422,16 +422,16 @@ print_text_marker (j_decompress_ptr cinfo) * Newlines in CR, CR/LF, or LF form will be printed as one newline. */ if (ch == '\r') { - fprintf(stderr, "\n"); + fprintf(stderr, "\n"); } else if (ch == '\n') { - if (lastch != '\r') - fprintf(stderr, "\n"); + if (lastch != '\r') + fprintf(stderr, "\n"); } else if (ch == '\\') { - fprintf(stderr, "\\\\"); + fprintf(stderr, "\\\\"); } else if (isprint(ch)) { - putc(ch, stderr); + putc(ch, stderr); } else { - fprintf(stderr, "\\%03o", ch); + fprintf(stderr, "\\%03o", ch); } lastch = ch; } @@ -471,7 +471,7 @@ main (int argc, char **argv) progname = argv[0]; if (progname == NULL || progname[0] == 0) - progname = "djpeg"; /* in case C library doesn't provide it */ + progname = "djpeg"; /* in case C library doesn't provide it */ /* Initialize the JPEG decompression object with default error handling. */ cinfo.err = jpeg_std_error(&jerr); @@ -510,14 +510,14 @@ main (int argc, char **argv) if (outfilename == NULL) { if (file_index != argc-2) { fprintf(stderr, "%s: must name one input and one output file\n", - progname); + progname); usage(); } outfilename = argv[file_index+1]; } else { if (file_index != argc-1) { fprintf(stderr, "%s: must name one input and one output file\n", - progname); + progname); usage(); } } @@ -634,7 +634,7 @@ main (int argc, char **argv) /* Process data */ while (cinfo.output_scanline < cinfo.output_height) { num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, - dest_mgr->buffer_height); + dest_mgr->buffer_height); (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); } @@ -668,5 +668,5 @@ main (int argc, char **argv) /* All done. */ exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ + return 0; /* suppress no-return-value warnings */ } diff --git a/example.c b/example.c index 1d6f6cc3..0a65a6cc 100644 --- a/example.c +++ b/example.c @@ -6,7 +6,7 @@ * conjunction with the documentation file libjpeg.txt. * * This code will not do anything useful as-is, but it may be helpful as a - * skeleton for constructing routines that call the JPEG library. + * skeleton for constructing routines that call the JPEG library. * * We present these routines in the same coding style used in the JPEG code * (ANSI function definitions, etc); but you are of course free to code your @@ -58,9 +58,9 @@ * RGB color and is described by: */ -extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */ -extern int image_height; /* Number of rows in image */ -extern int image_width; /* Number of columns in image */ +extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */ +extern int image_height; /* Number of rows in image */ +extern int image_width; /* Number of columns in image */ /* @@ -88,9 +88,9 @@ write_JPEG_file (char * filename, int quality) */ struct jpeg_error_mgr jerr; /* More stuff */ - FILE * outfile; /* target file */ - JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ - int row_stride; /* physical row width in image buffer */ + FILE * outfile; /* target file */ + JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ + int row_stride; /* physical row width in image buffer */ /* Step 1: allocate and initialize JPEG compression object */ @@ -122,10 +122,10 @@ write_JPEG_file (char * filename, int quality) /* First we supply a description of the input image. * Four fields of the cinfo struct must be filled in: */ - cinfo.image_width = image_width; /* image width and height, in pixels */ + cinfo.image_width = image_width; /* image width and height, in pixels */ cinfo.image_height = image_height; - cinfo.input_components = 3; /* # of color components per pixel */ - cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ + cinfo.input_components = 3; /* # of color components per pixel */ + cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ /* Now use the library's routine to set default compression parameters. * (You must set at least cinfo.in_color_space before calling this, * since the defaults depend on the source color space.) @@ -151,7 +151,7 @@ write_JPEG_file (char * filename, int quality) * To keep things simple, we pass one scanline per call; you can pass * more if you wish, though. */ - row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ + row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ while (cinfo.next_scanline < cinfo.image_height) { /* jpeg_write_scanlines expects an array of pointers to scanlines. @@ -248,9 +248,9 @@ write_JPEG_file (char * filename, int quality) */ struct my_error_mgr { - struct jpeg_error_mgr pub; /* "public" fields */ + struct jpeg_error_mgr pub; /* "public" fields */ - jmp_buf setjmp_buffer; /* for return to caller */ + jmp_buf setjmp_buffer; /* for return to caller */ }; typedef struct my_error_mgr * my_error_ptr; @@ -293,9 +293,9 @@ read_JPEG_file (char * filename) */ struct my_error_mgr jerr; /* More stuff */ - FILE * infile; /* source file */ - JSAMPARRAY buffer; /* Output row buffer */ - int row_stride; /* physical row width in output buffer */ + FILE * infile; /* source file */ + JSAMPARRAY buffer; /* Output row buffer */ + int row_stride; /* physical row width in output buffer */ /* In this example we want to open the input file before doing anything else, * so that the setjmp() error recovery below can assume the file is open. @@ -356,12 +356,12 @@ read_JPEG_file (char * filename) * output image dimensions available, as well as the output colormap * if we asked for color quantization. * In this example, we need to make an output work buffer of the right size. - */ + */ /* JSAMPLEs per row in output buffer */ row_stride = cinfo.output_width * cinfo.output_components; /* Make a one-row-high sample array that will go away when done with image */ buffer = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); + ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); /* Step 6: while (scan lines remain to be read) */ /* jpeg_read_scanlines(...); */ diff --git a/jcapimin.c b/jcapimin.c index 20ba9e99..601bb71d 100644 --- a/jcapimin.c +++ b/jcapimin.c @@ -33,12 +33,12 @@ 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 */ + 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); + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set @@ -85,7 +85,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) cinfo->script_space = NULL; - cinfo->input_gamma = 1.0; /* in case application forgets */ + cinfo->input_gamma = 1.0; /* in case application forgets */ /* OK, I'm ready */ cinfo->global_state = CSTATE_START; @@ -173,15 +173,15 @@ jpeg_finish_compress (j_compress_ptr cinfo) (*cinfo->master->prepare_for_pass) (cinfo); for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) iMCU_row; - cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + cinfo->progress->pass_counter = (long) iMCU_row; + cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* We bypass the main controller and invoke coef controller directly; * all work is being done from the coefficient buffer. */ if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) - ERREXIT(cinfo, JERR_CANT_SUSPEND); + ERREXIT(cinfo, JERR_CANT_SUSPEND); } (*cinfo->master->finish_pass) (cinfo); } @@ -202,7 +202,7 @@ jpeg_finish_compress (j_compress_ptr cinfo) GLOBAL(void) jpeg_write_marker (j_compress_ptr cinfo, int marker, - const JOCTET *dataptr, unsigned int datalen) + const JOCTET *dataptr, unsigned int datalen) { JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); @@ -213,7 +213,7 @@ jpeg_write_marker (j_compress_ptr cinfo, int marker, ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); - write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ + write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ while (datalen--) { (*write_marker_byte) (cinfo, *dataptr); dataptr++; @@ -248,14 +248,14 @@ jpeg_write_m_byte (j_compress_ptr cinfo, int val) * To produce a pair of files containing abbreviated tables and abbreviated * image data, one would proceed as follows: * - * initialize JPEG object - * set JPEG parameters - * set destination to table file - * jpeg_write_tables(cinfo); - * set destination to image file - * jpeg_start_compress(cinfo, FALSE); - * write data... - * jpeg_finish_compress(cinfo); + * initialize JPEG object + * set JPEG parameters + * set destination to table file + * jpeg_write_tables(cinfo); + * set destination to image file + * jpeg_start_compress(cinfo, FALSE); + * write data... + * jpeg_finish_compress(cinfo); * * jpeg_write_tables has the side effect of marking all tables written * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress diff --git a/jcapistd.c b/jcapistd.c index c0320b1b..167f0205 100644 --- a/jcapistd.c +++ b/jcapistd.c @@ -41,7 +41,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (write_all_tables) - jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ + jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ /* (Re)initialize error mgr and destination modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); @@ -75,7 +75,7 @@ jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) GLOBAL(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, - JDIMENSION num_lines) + JDIMENSION num_lines) { JDIMENSION row_ctr, rows_left; @@ -118,7 +118,7 @@ jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, GLOBAL(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION num_lines) + JDIMENSION num_lines) { JDIMENSION lines_per_iMCU_row; diff --git a/jcarith.c b/jcarith.c index a9ca1c33..e8bb281c 100644 --- a/jcarith.c +++ b/jcarith.c @@ -34,8 +34,8 @@ typedef struct { int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ int dc_context[MAX_COMPS_IN_SCAN]; /* context index for DC conditioning */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - int next_restart_num; /* next restart number to write (0-7) */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to statistics areas (these workspaces have image lifespan) */ unsigned char * dc_stats[NUM_ARITH_TBLS]; @@ -101,14 +101,14 @@ typedef arith_entropy_encoder * arith_entropy_ptr; */ #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS int ishift_temp; +#define ISHIFT_TEMPS int ishift_temp; #define IRIGHT_SHIFT(x,shft) \ - ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ - (ishift_temp >> (shft))) + ((ishift_temp = (x)) < 0 ? \ + (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ + (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif @@ -149,11 +149,11 @@ finish_pass (j_compress_ptr cinfo) /* One final overflow has to be handled */ if (e->buffer >= 0) { if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); + do emit_byte(0x00, cinfo); + while (--e->zc); emit_byte(e->buffer + 1, cinfo); if (e->buffer + 1 == 0xFF) - emit_byte(0x00, cinfo); + emit_byte(0x00, cinfo); } e->zc += e->sc; /* carry-over converts stacked 0xFF bytes to 0x00 */ e->sc = 0; @@ -162,17 +162,17 @@ finish_pass (j_compress_ptr cinfo) ++e->zc; else if (e->buffer >= 0) { if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); + do emit_byte(0x00, cinfo); + while (--e->zc); emit_byte(e->buffer, cinfo); } if (e->sc) { if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); + do emit_byte(0x00, cinfo); + while (--e->zc); do { - emit_byte(0xFF, cinfo); - emit_byte(0x00, cinfo); + emit_byte(0xFF, cinfo); + emit_byte(0x00, cinfo); } while (--e->sc); } } @@ -187,7 +187,7 @@ finish_pass (j_compress_ptr cinfo) if (e->c & 0x7F800L) { emit_byte((e->c >> 11) & 0xFF, cinfo); if (((e->c >> 11) & 0xFF) == 0xFF) - emit_byte(0x00, cinfo); + emit_byte(0x00, cinfo); } } } @@ -216,7 +216,7 @@ finish_pass (j_compress_ptr cinfo) */ LOCAL(void) -arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) +arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) { register arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy; register unsigned char nl, nm; @@ -227,9 +227,9 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) * Qe values and probability estimation state machine */ sv = *st; - qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ - nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ - nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ + qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ + nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ + nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ /* Encode & estimation procedures per sections D.1.4 & D.1.5 */ e->a -= qe; @@ -243,7 +243,7 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) e->c += e->a; e->a = qe; } - *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ + *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ } else { /* Encode the more probable symbol */ if (e->a >= 0x8000L) @@ -255,7 +255,7 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) e->c += e->a; e->a = qe; } - *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ + *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ } /* Renormalization & data output per section D.1.6 */ @@ -266,43 +266,43 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val) /* Another byte is ready for output */ temp = e->c >> 19; if (temp > 0xFF) { - /* Handle overflow over all stacked 0xFF bytes */ - if (e->buffer >= 0) { - if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); - emit_byte(e->buffer + 1, cinfo); - if (e->buffer + 1 == 0xFF) - emit_byte(0x00, cinfo); - } - e->zc += e->sc; /* carry-over converts stacked 0xFF bytes to 0x00 */ - e->sc = 0; - /* Note: The 3 spacer bits in the C register guarantee - * that the new buffer byte can't be 0xFF here - * (see page 160 in the P&M JPEG book). */ - e->buffer = temp & 0xFF; /* new output byte, might overflow later */ + /* Handle overflow over all stacked 0xFF bytes */ + if (e->buffer >= 0) { + if (e->zc) + do emit_byte(0x00, cinfo); + while (--e->zc); + emit_byte(e->buffer + 1, cinfo); + if (e->buffer + 1 == 0xFF) + emit_byte(0x00, cinfo); + } + e->zc += e->sc; /* carry-over converts stacked 0xFF bytes to 0x00 */ + e->sc = 0; + /* Note: The 3 spacer bits in the C register guarantee + * that the new buffer byte can't be 0xFF here + * (see page 160 in the P&M JPEG book). */ + e->buffer = temp & 0xFF; /* new output byte, might overflow later */ } else if (temp == 0xFF) { - ++e->sc; /* stack 0xFF byte (which might overflow later) */ + ++e->sc; /* stack 0xFF byte (which might overflow later) */ } else { - /* Output all stacked 0xFF bytes, they will not overflow any more */ - if (e->buffer == 0) - ++e->zc; - else if (e->buffer >= 0) { - if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); - emit_byte(e->buffer, cinfo); - } - if (e->sc) { - if (e->zc) - do emit_byte(0x00, cinfo); - while (--e->zc); - do { - emit_byte(0xFF, cinfo); - emit_byte(0x00, cinfo); - } while (--e->sc); - } - e->buffer = temp & 0xFF; /* new output byte (can still overflow) */ + /* Output all stacked 0xFF bytes, they will not overflow any more */ + if (e->buffer == 0) + ++e->zc; + else if (e->buffer >= 0) { + if (e->zc) + do emit_byte(0x00, cinfo); + while (--e->zc); + emit_byte(e->buffer, cinfo); + } + if (e->sc) { + if (e->zc) + do emit_byte(0x00, cinfo); + while (--e->zc); + do { + emit_byte(0xFF, cinfo); + emit_byte(0x00, cinfo); + } while (--e->sc); + } + e->buffer = temp & 0xFF; /* new output byte (can still overflow) */ } e->c &= 0x7FFFFL; e->ct += 8; @@ -398,45 +398,45 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.4: Encode_DC_DIFF */ if ((v = m - entropy->last_dc_val[ci]) == 0) { arith_encode(cinfo, st, 0); - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ } else { entropy->last_dc_val[ci] = m; arith_encode(cinfo, st, 1); /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if (v > 0) { - arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ - st += 2; /* Table F.4: SP = S0 + 2 */ - entropy->dc_context[ci] = 4; /* small positive diff category */ + arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ + st += 2; /* Table F.4: SP = S0 + 2 */ + entropy->dc_context[ci] = 4; /* small positive diff category */ } else { - v = -v; - arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ - st += 3; /* Table F.4: SN = S0 + 3 */ - entropy->dc_context[ci] = 8; /* small negative diff category */ + v = -v; + arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ + st += 3; /* Table F.4: SN = S0 + 3 */ + entropy->dc_context[ci] = 8; /* small negative diff category */ } /* Figure F.8: Encoding the magnitude category of v */ m = 0; if (v -= 1) { - arith_encode(cinfo, st, 1); - m = 1; - v2 = v; - st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ - while (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st += 1; - } + arith_encode(cinfo, st, 1); + m = 1; + v2 = v; + st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ + while (v2 >>= 1) { + arith_encode(cinfo, st, 1); + m <<= 1; + st += 1; + } } arith_encode(cinfo, st, 0); /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) - entropy->dc_context[ci] += 8; /* large diff category */ + entropy->dc_context[ci] += 8; /* large diff category */ /* Figure F.9: Encoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - arith_encode(cinfo, st, (m & v) ? 1 : 0); + arith_encode(cinfo, st, (m & v) ? 1 : 0); } } @@ -491,21 +491,21 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.5: Encode_AC_Coefficients */ for (k = cinfo->Ss; k <= ke; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); - arith_encode(cinfo, st, 0); /* EOB decision */ + arith_encode(cinfo, st, 0); /* EOB decision */ for (;;) { if ((v = (*block)[jpeg_natural_order[k]]) >= 0) { - if (v >>= cinfo->Al) { - arith_encode(cinfo, st + 1, 1); - arith_encode(cinfo, entropy->fixed_bin, 0); - break; - } + if (v >>= cinfo->Al) { + arith_encode(cinfo, st + 1, 1); + arith_encode(cinfo, entropy->fixed_bin, 0); + break; + } } else { - v = -v; - if (v >>= cinfo->Al) { - arith_encode(cinfo, st + 1, 1); - arith_encode(cinfo, entropy->fixed_bin, 1); - break; - } + v = -v; + if (v >>= cinfo->Al) { + arith_encode(cinfo, st + 1, 1); + arith_encode(cinfo, entropy->fixed_bin, 1); + break; + } } arith_encode(cinfo, st + 1, 0); st += 3; k++; } @@ -517,15 +517,15 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) m = 1; v2 = v; if (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st = entropy->ac_stats[tbl] + - (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); - while (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st += 1; - } + arith_encode(cinfo, st, 1); + m <<= 1; + st = entropy->ac_stats[tbl] + + (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); + while (v2 >>= 1) { + arith_encode(cinfo, st, 1); + m <<= 1; + st += 1; + } } } arith_encode(cinfo, st, 0); @@ -566,7 +566,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - st = entropy->fixed_bin; /* use fixed probability estimation */ + st = entropy->fixed_bin; /* use fixed probability estimation */ Al = cinfo->Al; /* Encode the MCU data blocks */ @@ -635,29 +635,29 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) for (k = cinfo->Ss; k <= ke; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); if (k > kex) - arith_encode(cinfo, st, 0); /* EOB decision */ + arith_encode(cinfo, st, 0); /* EOB decision */ for (;;) { if ((v = (*block)[jpeg_natural_order[k]]) >= 0) { - if (v >>= cinfo->Al) { - if (v >> 1) /* previously nonzero coef */ - arith_encode(cinfo, st + 2, (v & 1)); - else { /* newly nonzero coef */ - arith_encode(cinfo, st + 1, 1); - arith_encode(cinfo, entropy->fixed_bin, 0); - } - break; - } + if (v >>= cinfo->Al) { + if (v >> 1) /* previously nonzero coef */ + arith_encode(cinfo, st + 2, (v & 1)); + else { /* newly nonzero coef */ + arith_encode(cinfo, st + 1, 1); + arith_encode(cinfo, entropy->fixed_bin, 0); + } + break; + } } else { - v = -v; - if (v >>= cinfo->Al) { - if (v >> 1) /* previously nonzero coef */ - arith_encode(cinfo, st + 2, (v & 1)); - else { /* newly nonzero coef */ - arith_encode(cinfo, st + 1, 1); - arith_encode(cinfo, entropy->fixed_bin, 1); - } - break; - } + v = -v; + if (v >>= cinfo->Al) { + if (v >> 1) /* previously nonzero coef */ + arith_encode(cinfo, st + 2, (v & 1)); + else { /* newly nonzero coef */ + arith_encode(cinfo, st + 1, 1); + arith_encode(cinfo, entropy->fixed_bin, 1); + } + break; + } } arith_encode(cinfo, st + 1, 0); st += 3; k++; } @@ -713,45 +713,45 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.4: Encode_DC_DIFF */ if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) { arith_encode(cinfo, st, 0); - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ } else { entropy->last_dc_val[ci] = (*block)[0]; arith_encode(cinfo, st, 1); /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if (v > 0) { - arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ - st += 2; /* Table F.4: SP = S0 + 2 */ - entropy->dc_context[ci] = 4; /* small positive diff category */ + arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */ + st += 2; /* Table F.4: SP = S0 + 2 */ + entropy->dc_context[ci] = 4; /* small positive diff category */ } else { - v = -v; - arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ - st += 3; /* Table F.4: SN = S0 + 3 */ - entropy->dc_context[ci] = 8; /* small negative diff category */ + v = -v; + arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */ + st += 3; /* Table F.4: SN = S0 + 3 */ + entropy->dc_context[ci] = 8; /* small negative diff category */ } /* Figure F.8: Encoding the magnitude category of v */ m = 0; if (v -= 1) { - arith_encode(cinfo, st, 1); - m = 1; - v2 = v; - st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ - while (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st += 1; - } + arith_encode(cinfo, st, 1); + m = 1; + v2 = v; + st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ + while (v2 >>= 1) { + arith_encode(cinfo, st, 1); + m <<= 1; + st += 1; + } } arith_encode(cinfo, st, 0); /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) - entropy->dc_context[ci] += 8; /* large diff category */ + entropy->dc_context[ci] += 8; /* large diff category */ /* Figure F.9: Encoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - arith_encode(cinfo, st, (m & v) ? 1 : 0); + arith_encode(cinfo, st, (m & v) ? 1 : 0); } /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */ @@ -765,43 +765,43 @@ encode_mcu (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.5: Encode_AC_Coefficients */ for (k = 1; k <= ke; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); - arith_encode(cinfo, st, 0); /* EOB decision */ + arith_encode(cinfo, st, 0); /* EOB decision */ while ((v = (*block)[jpeg_natural_order[k]]) == 0) { - arith_encode(cinfo, st + 1, 0); st += 3; k++; + arith_encode(cinfo, st + 1, 0); st += 3; k++; } arith_encode(cinfo, st + 1, 1); /* Figure F.6: Encoding nonzero value v */ /* Figure F.7: Encoding the sign of v */ if (v > 0) { - arith_encode(cinfo, entropy->fixed_bin, 0); + arith_encode(cinfo, entropy->fixed_bin, 0); } else { - v = -v; - arith_encode(cinfo, entropy->fixed_bin, 1); + v = -v; + arith_encode(cinfo, entropy->fixed_bin, 1); } st += 2; /* Figure F.8: Encoding the magnitude category of v */ m = 0; if (v -= 1) { - arith_encode(cinfo, st, 1); - m = 1; - v2 = v; - if (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st = entropy->ac_stats[tbl] + - (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); - while (v2 >>= 1) { - arith_encode(cinfo, st, 1); - m <<= 1; - st += 1; - } - } + arith_encode(cinfo, st, 1); + m = 1; + v2 = v; + if (v2 >>= 1) { + arith_encode(cinfo, st, 1); + m <<= 1; + st = entropy->ac_stats[tbl] + + (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); + while (v2 >>= 1) { + arith_encode(cinfo, st, 1); + m <<= 1; + st += 1; + } + } } arith_encode(cinfo, st, 0); /* Figure F.9: Encoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - arith_encode(cinfo, st, (m & v) ? 1 : 0); + arith_encode(cinfo, st, (m & v) ? 1 : 0); } /* Encode EOB decision only if k <= DCTSIZE2 - 1 */ if (k <= DCTSIZE2 - 1) { @@ -838,14 +838,14 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics) if (cinfo->progressive_mode) { if (cinfo->Ah == 0) { if (cinfo->Ss == 0) - entropy->pub.encode_mcu = encode_mcu_DC_first; + entropy->pub.encode_mcu = encode_mcu_DC_first; else - entropy->pub.encode_mcu = encode_mcu_AC_first; + entropy->pub.encode_mcu = encode_mcu_AC_first; } else { if (cinfo->Ss == 0) - entropy->pub.encode_mcu = encode_mcu_DC_refine; + entropy->pub.encode_mcu = encode_mcu_DC_refine; else - entropy->pub.encode_mcu = encode_mcu_AC_refine; + entropy->pub.encode_mcu = encode_mcu_AC_refine; } } else entropy->pub.encode_mcu = encode_mcu; @@ -857,10 +857,10 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics) if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) { tbl = compptr->dc_tbl_no; if (tbl < 0 || tbl >= NUM_ARITH_TBLS) - ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); + ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); if (entropy->dc_stats[tbl] == NULL) - entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS); + entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS); MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS); /* Initialize DC predictions to 0 */ entropy->last_dc_val[ci] = 0; @@ -870,15 +870,15 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics) if (cinfo->progressive_mode == 0 || cinfo->Se) { tbl = compptr->ac_tbl_no; if (tbl < 0 || tbl >= NUM_ARITH_TBLS) - ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); + ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); if (entropy->ac_stats[tbl] == NULL) - entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS); + entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS); MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS); #ifdef CALCULATE_SPECTRAL_CONDITIONING if (cinfo->progressive_mode) - /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */ - cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4); + /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */ + cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4); #endif } } @@ -909,7 +909,7 @@ jinit_arith_encoder (j_compress_ptr cinfo) entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(arith_entropy_encoder)); + SIZEOF(arith_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass; entropy->pub.finish_pass = finish_pass; diff --git a/jccoefct.c b/jccoefct.c index 1963ddb6..ffc9b7ec 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -34,10 +34,10 @@ typedef struct { struct jpeg_c_coef_controller pub; /* public fields */ - JDIMENSION iMCU_row_num; /* iMCU row # within image */ - JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ + JDIMENSION iMCU_row_num; /* iMCU row # within image */ + JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* For single-pass compression, it's sufficient to buffer just one MCU * (although this may prove a bit slow in practice). We allocate a @@ -143,7 +143,7 @@ METHODDEF(boolean) compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, bi, ci, yindex, yoffset, blockcnt; @@ -154,7 +154,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col; - MCU_col_num++) { + MCU_col_num++) { /* Determine where data comes from in input_buf and do the DCT thing. * Each call on forward_DCT processes a horizontal row of DCT blocks * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks @@ -166,46 +166,46 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) */ blkn = 0; for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - xpos = MCU_col_num * compptr->MCU_sample_width; - ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (coef->iMCU_row_num < last_iMCU_row || - yoffset+yindex < compptr->last_row_height) { - (*cinfo->fdct->forward_DCT) (cinfo, compptr, - input_buf[compptr->component_index], - coef->MCU_buffer[blkn], - ypos, xpos, (JDIMENSION) blockcnt); - if (blockcnt < compptr->MCU_width) { - /* Create some dummy blocks at the right edge of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], - (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); - for (bi = blockcnt; bi < compptr->MCU_width; bi++) { - coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; - } - } - } else { - /* Create a row of dummy blocks at the bottom of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn], - compptr->MCU_width * SIZEOF(JBLOCK)); - for (bi = 0; bi < compptr->MCU_width; bi++) { - coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; - } - } - blkn += compptr->MCU_width; - ypos += DCTSIZE; - } + compptr = cinfo->cur_comp_info[ci]; + blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + xpos = MCU_col_num * compptr->MCU_sample_width; + ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (coef->iMCU_row_num < last_iMCU_row || + yoffset+yindex < compptr->last_row_height) { + (*cinfo->fdct->forward_DCT) (cinfo, compptr, + input_buf[compptr->component_index], + coef->MCU_buffer[blkn], + ypos, xpos, (JDIMENSION) blockcnt); + if (blockcnt < compptr->MCU_width) { + /* Create some dummy blocks at the right edge of the image. */ + jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], + (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); + for (bi = blockcnt; bi < compptr->MCU_width; bi++) { + coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; + } + } + } else { + /* Create a row of dummy blocks at the bottom of the image. */ + jzero_far((void FAR *) coef->MCU_buffer[blkn], + compptr->MCU_width * SIZEOF(JBLOCK)); + for (bi = 0; bi < compptr->MCU_width; bi++) { + coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; + } + } + blkn += compptr->MCU_width; + ypos += DCTSIZE; + } } /* Try to write the MCU. In event of a suspension failure, we will * re-DCT the MCU on restart (a bit inefficient, could be fixed...) */ if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ @@ -280,17 +280,17 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) for (block_row = 0; block_row < block_rows; block_row++) { thisblockrow = buffer[block_row]; (*cinfo->fdct->forward_DCT) (cinfo, compptr, - input_buf[ci], thisblockrow, - (JDIMENSION) (block_row * DCTSIZE), - (JDIMENSION) 0, blocks_across); + input_buf[ci], thisblockrow, + (JDIMENSION) (block_row * DCTSIZE), + (JDIMENSION) 0, blocks_across); if (ndummy > 0) { - /* Create dummy blocks at the right edge of the image. */ - thisblockrow += blocks_across; /* => first dummy block */ - jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); - lastDC = thisblockrow[-1][0]; - for (bi = 0; bi < ndummy; bi++) { - thisblockrow[bi][0] = lastDC; - } + /* Create dummy blocks at the right edge of the image. */ + thisblockrow += blocks_across; /* => first dummy block */ + jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); + lastDC = thisblockrow[-1][0]; + for (bi = 0; bi < ndummy; bi++) { + thisblockrow[bi][0] = lastDC; + } } } /* If at end of image, create dummy block rows as needed. @@ -299,22 +299,22 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) * This squeezes a few more bytes out of the resulting file... */ if (coef->iMCU_row_num == last_iMCU_row) { - blocks_across += ndummy; /* include lower right corner */ + blocks_across += ndummy; /* include lower right corner */ MCUs_across = blocks_across / h_samp_factor; for (block_row = block_rows; block_row < compptr->v_samp_factor; - block_row++) { - thisblockrow = buffer[block_row]; - lastblockrow = buffer[block_row-1]; - jzero_far((void FAR *) thisblockrow, - (size_t) (blocks_across * SIZEOF(JBLOCK))); - for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { - lastDC = lastblockrow[h_samp_factor-1][0]; - for (bi = 0; bi < h_samp_factor; bi++) { - thisblockrow[bi][0] = lastDC; - } - thisblockrow += h_samp_factor; /* advance to next MCU in row */ - lastblockrow += h_samp_factor; - } + block_row++) { + thisblockrow = buffer[block_row]; + lastblockrow = buffer[block_row-1]; + jzero_far((void FAR *) thisblockrow, + (size_t) (blocks_across * SIZEOF(JBLOCK))); + for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { + lastDC = lastblockrow[h_samp_factor-1][0]; + for (bi = 0; bi < h_samp_factor; bi++) { + thisblockrow[bi][0] = lastDC; + } + thisblockrow += h_samp_factor; /* advance to next MCU in row */ + lastblockrow += h_samp_factor; + } } } } @@ -341,7 +341,7 @@ METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION MCU_col_num; /* index of current MCU within row */ int blkn, ci, xindex, yindex, yoffset; JDIMENSION start_col; JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; @@ -364,25 +364,25 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { + MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ + blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < compptr->MCU_width; xindex++) { - coef->MCU_buffer[blkn++] = buffer_ptr++; - } - } + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < compptr->MCU_width; xindex++) { + coef->MCU_buffer[blkn++] = buffer_ptr++; + } + } } /* Try to write the MCU. */ if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ @@ -408,7 +408,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + SIZEOF(my_coef_controller)); cinfo->coef = (struct jpeg_c_coef_controller *) coef; coef->pub.start_pass = start_pass_coef; @@ -421,14 +421,14 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) compptr->v_samp_factor); + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) compptr->v_samp_factor); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); @@ -440,7 +440,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } diff --git a/jccolext.c b/jccolext.c index dda3beb8..2c6b7acf 100644 --- a/jccolext.c +++ b/jccolext.c @@ -58,16 +58,16 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo, */ /* Y */ outptr0[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); /* Cb */ outptr1[col] = (JSAMPLE) - ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) - >> SCALEBITS); + ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) + >> SCALEBITS); /* Cr */ outptr2[col] = (JSAMPLE) - ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) - >> SCALEBITS); + ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) + >> SCALEBITS); } } } @@ -108,8 +108,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo, inptr += RGB_PIXELSIZE; /* Y */ outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); } } } diff --git a/jccolor.c b/jccolor.c index 83184855..fe9422a9 100644 --- a/jccolor.c +++ b/jccolor.c @@ -24,7 +24,7 @@ typedef struct { struct jpeg_color_converter pub; /* public fields */ /* Private state for RGB->YCC conversion */ - INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ + INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ } my_color_converter; typedef my_color_converter * my_cconvert_ptr; @@ -36,9 +36,9 @@ typedef my_color_converter * my_cconvert_ptr; * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore - * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and @@ -60,10 +60,10 @@ typedef my_color_converter * my_cconvert_ptr; * in the tables to save adding them separately in the inner loop. */ -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L< Y section */ -#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ -#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ -#define R_CB_OFF (3*(MAXJSAMPLE+1)) -#define G_CB_OFF (4*(MAXJSAMPLE+1)) -#define B_CB_OFF (5*(MAXJSAMPLE+1)) -#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */ -#define G_CR_OFF (6*(MAXJSAMPLE+1)) -#define B_CR_OFF (7*(MAXJSAMPLE+1)) -#define TABLE_SIZE (8*(MAXJSAMPLE+1)) +#define R_Y_OFF 0 /* offset to R => Y section */ +#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ +#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ +#define R_CB_OFF (3*(MAXJSAMPLE+1)) +#define G_CB_OFF (4*(MAXJSAMPLE+1)) +#define B_CB_OFF (5*(MAXJSAMPLE+1)) +#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */ +#define G_CR_OFF (6*(MAXJSAMPLE+1)) +#define B_CR_OFF (7*(MAXJSAMPLE+1)) +#define TABLE_SIZE (8*(MAXJSAMPLE+1)) /* Include inline routines for colorspace extensions */ @@ -202,7 +202,7 @@ rgb_ycc_start (j_compress_ptr cinfo) /* Allocate and fill in the conversion tables. */ cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(INT32))); + (TABLE_SIZE * SIZEOF(INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; @@ -230,8 +230,8 @@ rgb_ycc_start (j_compress_ptr cinfo) METHODDEF(void) rgb_ycc_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { switch (cinfo->in_color_space) { case JCS_EXT_RGB: @@ -279,8 +279,8 @@ rgb_ycc_convert (j_compress_ptr cinfo, METHODDEF(void) rgb_gray_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { switch (cinfo->in_color_space) { case JCS_EXT_RGB: @@ -325,8 +325,8 @@ rgb_gray_convert (j_compress_ptr cinfo, METHODDEF(void) rgb_rgb_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { switch (cinfo->in_color_space) { case JCS_EXT_RGB: @@ -375,8 +375,8 @@ rgb_rgb_convert (j_compress_ptr cinfo, METHODDEF(void) cmyk_ycck_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; @@ -398,7 +398,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo, g = MAXJSAMPLE - GETJSAMPLE(inptr[1]); b = MAXJSAMPLE - GETJSAMPLE(inptr[2]); /* K passes through as-is */ - outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */ + outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */ inptr += 4; /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations * must be too; we do not need an explicit range-limiting operation. @@ -407,16 +407,16 @@ cmyk_ycck_convert (j_compress_ptr cinfo, */ /* Y */ outptr0[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); /* Cb */ outptr1[col] = (JSAMPLE) - ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) - >> SCALEBITS); + ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) + >> SCALEBITS); /* Cr */ outptr2[col] = (JSAMPLE) - ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) - >> SCALEBITS); + ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) + >> SCALEBITS); } } } @@ -430,8 +430,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo, METHODDEF(void) grayscale_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { register JSAMPROW inptr; register JSAMPROW outptr; @@ -444,7 +444,7 @@ grayscale_convert (j_compress_ptr cinfo, outptr = output_buf[0][output_row]; output_row++; for (col = 0; col < num_cols; col++) { - outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */ + outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */ inptr += instride; } } @@ -459,8 +459,8 @@ grayscale_convert (j_compress_ptr cinfo, METHODDEF(void) null_convert (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows) + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) { register JSAMPROW inptr; register JSAMPROW outptr; @@ -475,8 +475,8 @@ null_convert (j_compress_ptr cinfo, inptr = *input_buf; outptr = output_buf[ci][output_row]; for (col = 0; col < num_cols; col++) { - outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ - inptr += nc; + outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ + inptr += nc; } } input_buf++; @@ -507,7 +507,7 @@ jinit_color_converter (j_compress_ptr cinfo) cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_converter)); + SIZEOF(my_color_converter)); cinfo->cconvert = (struct jpeg_color_converter *) cconvert; /* set start_pass to null method until we find out differently */ cconvert->pub.start_pass = null_method; @@ -545,7 +545,7 @@ jinit_color_converter (j_compress_ptr cinfo) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; - default: /* JCS_UNKNOWN can be anything */ + default: /* JCS_UNKNOWN can be anything */ if (cinfo->input_components < 1) ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); break; @@ -652,9 +652,9 @@ jinit_color_converter (j_compress_ptr cinfo) ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; - default: /* allow null conversion of JCS_UNKNOWN */ + default: /* allow null conversion of JCS_UNKNOWN */ if (cinfo->jpeg_color_space != cinfo->in_color_space || - cinfo->num_components != cinfo->input_components) + cinfo->num_components != cinfo->input_components) ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); cconvert->pub.color_convert = null_convert; break; diff --git a/jcdctmgr.c b/jcdctmgr.c index 3234a01a..bf40ff76 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -18,7 +18,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #include "jsimddct.h" @@ -44,7 +44,7 @@ typedef JMETHOD(void, float_quantize_method_ptr, METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *); typedef struct { - struct jpeg_forward_dct pub; /* public fields */ + struct jpeg_forward_dct pub; /* public fields */ /* Pointer to the DCT routine actually in use */ forward_DCT_method_ptr dct; @@ -147,7 +147,7 @@ flss (UINT16 val) * * In order to allow SIMD implementations we also tweak the values to * allow the same calculation to be made at all times: - * + * * dctbl[0] = f rounded to nearest integer * dctbl[1] = divisor / 2 (+ 1 if fractional part of f < 0.5) * dctbl[2] = 1 << ((word size) * 2 - r) @@ -221,7 +221,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) qtblno = compptr->quant_tbl_no; /* Make sure specified quantization table is present */ if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || - cinfo->quant_tbl_ptrs[qtblno] == NULL) + cinfo->quant_tbl_ptrs[qtblno] == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); qtbl = cinfo->quant_tbl_ptrs[qtblno]; /* Compute divisors for this quant table */ @@ -233,91 +233,91 @@ start_pass_fdctmgr (j_compress_ptr cinfo) * coefficients multiplied by 8 (to counteract scaling). */ if (fdct->divisors[qtblno] == NULL) { - fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); + fdct->divisors[qtblno] = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { - if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]) - && fdct->quantize == jsimd_quantize) - fdct->quantize = quantize; + if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]) + && fdct->quantize == jsimd_quantize) + fdct->quantize = quantize; } break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: { - /* For AA&N IDCT method, divisors are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * We apply a further scale factor of 8. - */ + /* For AA&N IDCT method, divisors are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * We apply a further scale factor of 8. + */ #define CONST_BITS 14 - static const INT16 aanscales[DCTSIZE2] = { - /* 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, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 - }; - SHIFT_TEMPS + static const INT16 aanscales[DCTSIZE2] = { + /* 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, + 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, + 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, + 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 + }; + SHIFT_TEMPS - if (fdct->divisors[qtblno] == NULL) { - fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); - } - dtbl = fdct->divisors[qtblno]; - for (i = 0; i < DCTSIZE2; i++) { - if(!compute_reciprocal( - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], - (INT32) aanscales[i]), - CONST_BITS-3), &dtbl[i]) - && fdct->quantize == jsimd_quantize) - fdct->quantize = quantize; - } + if (fdct->divisors[qtblno] == NULL) { + fdct->divisors[qtblno] = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); + } + dtbl = fdct->divisors[qtblno]; + for (i = 0; i < DCTSIZE2; i++) { + if(!compute_reciprocal( + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-3), &dtbl[i]) + && fdct->quantize == jsimd_quantize) + fdct->quantize = quantize; + } } break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: { - /* For float AA&N IDCT method, divisors are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - * We apply a further scale factor of 8. - * What's actually stored is 1/divisor so that the inner loop can - * use a multiplication rather than a division. - */ - FAST_FLOAT * fdtbl; - int row, col; - static const double aanscalefactor[DCTSIZE] = { - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - }; + /* For float AA&N IDCT method, divisors are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * We apply a further scale factor of 8. + * What's actually stored is 1/divisor so that the inner loop can + * use a multiplication rather than a division. + */ + FAST_FLOAT * fdtbl; + int row, col; + static const double aanscalefactor[DCTSIZE] = { + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + }; - if (fdct->float_divisors[qtblno] == NULL) { - fdct->float_divisors[qtblno] = (FAST_FLOAT *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(FAST_FLOAT)); - } - fdtbl = fdct->float_divisors[qtblno]; - i = 0; - for (row = 0; row < DCTSIZE; row++) { - for (col = 0; col < DCTSIZE; col++) { - fdtbl[i] = (FAST_FLOAT) - (1.0 / (((double) qtbl->quantval[i] * - aanscalefactor[row] * aanscalefactor[col] * 8.0))); - i++; - } - } + if (fdct->float_divisors[qtblno] == NULL) { + fdct->float_divisors[qtblno] = (FAST_FLOAT *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + DCTSIZE2 * SIZEOF(FAST_FLOAT)); + } + fdtbl = fdct->float_divisors[qtblno]; + i = 0; + for (row = 0; row < DCTSIZE; row++) { + for (col = 0; col < DCTSIZE; col++) { + fdtbl[i] = (FAST_FLOAT) + (1.0 / (((double) qtbl->quantval[i] * + aanscalefactor[row] * aanscalefactor[col] * 8.0))); + i++; + } + } } break; #endif @@ -344,7 +344,7 @@ convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace) for (elemr = 0; elemr < DCTSIZE; elemr++) { elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ +#if DCTSIZE == 8 /* unroll the inner loop */ *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; @@ -410,9 +410,9 @@ quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) METHODDEF(void) forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks) + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks) /* This version is used for integer DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ @@ -427,7 +427,7 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, quantize_method_ptr do_quantize = fdct->quantize; workspace = fdct->workspace; - sample_data += start_row; /* fold in the vertical offset once */ + sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ @@ -455,7 +455,7 @@ convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * works workspaceptr = workspace; for (elemr = 0; elemr < DCTSIZE; elemr++) { elemptr = sample_data[elemr] + start_col; -#if DCTSIZE == 8 /* unroll the inner loop */ +#if DCTSIZE == 8 /* unroll the inner loop */ *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); @@ -500,9 +500,9 @@ quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspa 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, - JDIMENSION num_blocks) + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks) /* This version is used for floating-point DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ @@ -518,7 +518,7 @@ forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, float_quantize_method_ptr do_quantize = fdct->float_quantize; workspace = fdct->float_workspace; - sample_data += start_row; /* fold in the vertical offset once */ + sample_data += start_row; /* fold in the vertical offset once */ for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { /* Load data into workspace, applying unsigned->signed conversion */ @@ -547,7 +547,7 @@ jinit_forward_dct (j_compress_ptr cinfo) fdct = (my_fdct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_fdct_controller)); + SIZEOF(my_fdct_controller)); cinfo->fdct = (struct jpeg_forward_dct *) fdct; fdct->pub.start_pass = start_pass_fdctmgr; @@ -626,12 +626,12 @@ jinit_forward_dct (j_compress_ptr cinfo) if (cinfo->dct_method == JDCT_FLOAT) fdct->float_workspace = (FAST_FLOAT *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(FAST_FLOAT) * DCTSIZE2); + SIZEOF(FAST_FLOAT) * DCTSIZE2); else #endif fdct->workspace = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(DCTELEM) * DCTSIZE2); + SIZEOF(DCTELEM) * DCTSIZE2); /* Mark divisor tables unallocated */ for (i = 0; i < NUM_QUANT_TBLS; i++) { diff --git a/jchuff.c b/jchuff.c index 398d2a11..b205cf98 100644 --- a/jchuff.c +++ b/jchuff.c @@ -19,7 +19,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jchuff.h" /* Declarations shared with jcphuff.c */ +#include "jchuff.h" /* Declarations shared with jcphuff.c */ #include /* @@ -64,8 +64,8 @@ */ typedef struct { - size_t put_buffer; /* current bit-accumulation buffer */ - int put_bits; /* # of bits now in it */ + size_t put_buffer; /* current bit-accumulation buffer */ + int put_bits; /* # of bits now in it */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; @@ -79,12 +79,12 @@ typedef struct { #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ - ((dest).put_buffer = (src).put_buffer, \ - (dest).put_bits = (src).put_bits, \ - (dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) + ((dest).put_buffer = (src).put_buffer, \ + (dest).put_bits = (src).put_bits, \ + (dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif @@ -92,17 +92,17 @@ typedef struct { typedef struct { struct jpeg_entropy_encoder pub; /* public fields */ - savable_state saved; /* Bit buffer & DC state at start of MCU */ + savable_state saved; /* Bit buffer & DC state at start of MCU */ /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - int next_restart_num; /* next restart number to write (0-7) */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to derived tables (these workspaces have image lifespan) */ c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; -#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ +#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ long * dc_count_ptrs[NUM_HUFF_TBLS]; long * ac_count_ptrs[NUM_HUFF_TBLS]; #endif @@ -115,20 +115,20 @@ typedef huff_entropy_encoder * huff_entropy_ptr; */ typedef struct { - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - savable_state cur; /* Current bit buffer & DC state */ - j_compress_ptr cinfo; /* dump_buffer needs access to this */ + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + savable_state cur; /* Current bit buffer & DC state */ + j_compress_ptr cinfo; /* dump_buffer needs access to this */ } working_state; /* Forward declarations */ METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); + 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)); + JBLOCKROW *MCU_data)); METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); #endif @@ -167,29 +167,29 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) /* Check for invalid table indexes */ /* (make_c_derived_tbl does this in the other path) */ if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); if (actbl < 0 || actbl >= NUM_HUFF_TBLS) - ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl); + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl); /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->dc_count_ptrs[dctbl] == NULL) - entropy->dc_count_ptrs[dctbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); + entropy->dc_count_ptrs[dctbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long)); if (entropy->ac_count_ptrs[actbl] == NULL) - entropy->ac_count_ptrs[actbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); + entropy->ac_count_ptrs[actbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long)); #endif } else { /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl, - & entropy->dc_derived_tbls[dctbl]); + & entropy->dc_derived_tbls[dctbl]); jpeg_make_c_derived_tbl(cinfo, FALSE, actbl, - & entropy->ac_derived_tbls[actbl]); + & entropy->ac_derived_tbls[actbl]); } /* Initialize DC predictions to 0 */ entropy->saved.last_dc_val[ci] = 0; @@ -214,7 +214,7 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) GLOBAL(void) jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, - c_derived_tbl ** pdtbl) + c_derived_tbl ** pdtbl) { JHUFF_TBL *htbl; c_derived_tbl *dtbl; @@ -239,22 +239,22 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, if (*pdtbl == NULL) *pdtbl = (c_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(c_derived_tbl)); + SIZEOF(c_derived_tbl)); dtbl = *pdtbl; - + /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; for (l = 1; l <= 16; l++) { i = (int) htbl->bits[l]; - if (i < 0 || p + i > 256) /* protect against table overrun */ + if (i < 0 || p + i > 256) /* protect against table overrun */ ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i--) huffsize[p++] = (char) l; } huffsize[p] = 0; lastp = p; - + /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ @@ -274,7 +274,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, code <<= 1; si++; } - + /* Figure C.3: generate encoding tables */ /* These are code and size indexed by symbol value */ @@ -305,10 +305,10 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, /* Emit a byte, taking 'action' if must suspend. */ #define emit_byte(state,val,action) \ - { *(state)->next_output_byte++ = (JOCTET) (val); \ - if (--(state)->free_in_buffer == 0) \ - if (! dump_buffer(state)) \ - { action; } } + { *(state)->next_output_byte++ = (JOCTET) (val); \ + if (--(state)->free_in_buffer == 0) \ + if (! dump_buffer(state)) \ + { action; } } LOCAL(boolean) @@ -456,7 +456,7 @@ flush_bits (working_state * state) PUT_BITS(0x7F, 7) while (put_bits >= 8) EMIT_BYTE() - state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ + state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ state->cur.put_bits = 0; STORE_BUFFER() @@ -468,7 +468,7 @@ flush_bits (working_state * state) LOCAL(boolean) encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, - c_derived_tbl *dctbl, c_derived_tbl *actbl) + c_derived_tbl *dctbl, c_derived_tbl *actbl) { int temp, temp2, temp3; int nbits; @@ -483,7 +483,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, LOAD_BUFFER() /* Encode the DC coefficient difference per section F.1.2.1 */ - + temp = temp2 = block[0] - last_dc_val; /* This is a well-known technique for obtaining the absolute value without a @@ -517,8 +517,8 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, CHECKBUF15() /* Encode the AC coefficients per section F.1.2.2 */ - - r = 0; /* r = run length of zeros */ + + r = 0; /* r = run length of zeros */ /* Manually unroll the k loop to eliminate the counter variable. This * improves performance greatly on systems with a limited number of @@ -624,7 +624,7 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! emit_restart(&state, entropy->next_restart_num)) - return FALSE; + return FALSE; } /* Encode the MCU data blocks */ @@ -632,9 +632,9 @@ encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; if (! encode_one_block(&state, - MCU_data[blkn][0], state.cur.last_dc_val[ci], - entropy->dc_derived_tbls[compptr->dc_tbl_no], - entropy->ac_derived_tbls[compptr->ac_tbl_no])) + MCU_data[blkn][0], state.cur.last_dc_val[ci], + entropy->dc_derived_tbls[compptr->dc_tbl_no], + entropy->ac_derived_tbls[compptr->ac_tbl_no])) return FALSE; /* Update last_dc_val */ state.cur.last_dc_val[ci] = MCU_data[blkn][0][0]; @@ -704,18 +704,18 @@ finish_pass_huff (j_compress_ptr cinfo) LOCAL(void) htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, - long dc_counts[], long ac_counts[]) + long dc_counts[], long ac_counts[]) { register int temp; register int nbits; register int k, r; - + /* Encode the DC coefficient difference per section F.1.2.1 */ - + temp = block[0] - last_dc_val; if (temp < 0) temp = -temp; - + /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { @@ -730,36 +730,36 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, /* Count the Huffman symbol for the number of bits */ dc_counts[nbits]++; - + /* Encode the AC coefficients per section F.1.2.2 */ - - r = 0; /* r = run length of zeros */ - + + r = 0; /* r = run length of zeros */ + for (k = 1; k < DCTSIZE2; k++) { if ((temp = block[jpeg_natural_order[k]]) == 0) { r++; } else { /* if run length > 15, must emit special run-length-16 codes (0xF0) */ while (r > 15) { - ac_counts[0xF0]++; - r -= 16; + ac_counts[0xF0]++; + r -= 16; } - + /* Find the number of bits needed for the magnitude of the coefficient */ if (temp < 0) - temp = -temp; - + temp = -temp; + /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ + nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) - nbits++; + nbits++; /* Check for out-of-range coefficient values */ if (nbits > MAX_COEF_BITS) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); - + ERREXIT(cinfo, JERR_BAD_DCT_COEF); + /* Count Huffman symbol for run length / number of bits */ ac_counts[(r << 4) + nbits]++; - + r = 0; } } @@ -787,7 +787,7 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) if (entropy->restarts_to_go == 0) { /* Re-initialize DC predictions to 0 */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) - entropy->saved.last_dc_val[ci] = 0; + entropy->saved.last_dc_val[ci] = 0; /* Update restart state */ entropy->restarts_to_go = cinfo->restart_interval; } @@ -798,8 +798,8 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) ci = cinfo->MCU_membership[blkn]; compptr = cinfo->cur_comp_info[ci]; htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci], - entropy->dc_count_ptrs[compptr->dc_tbl_no], - entropy->ac_count_ptrs[compptr->ac_tbl_no]); + entropy->dc_count_ptrs[compptr->dc_tbl_no], + entropy->ac_count_ptrs[compptr->ac_tbl_no]); entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0]; } @@ -838,10 +838,10 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) GLOBAL(void) jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) { -#define MAX_CLEN 32 /* assumed maximum initial code length */ - UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ - int codesize[257]; /* codesize[k] = code length of symbol k */ - int others[257]; /* next symbol in current branch of tree */ +#define MAX_CLEN 32 /* assumed maximum initial code length */ + UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ + int codesize[257]; /* codesize[k] = code length of symbol k */ + int others[257]; /* next symbol in current branch of tree */ int c1, c2; int p, i, j; long v; @@ -851,9 +851,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) MEMZERO(bits, SIZEOF(bits)); MEMZERO(codesize, SIZEOF(codesize)); for (i = 0; i < 257; i++) - others[i] = -1; /* init links to empty */ - - freq[256] = 1; /* make sure 256 has a nonzero count */ + others[i] = -1; /* init links to empty */ + + freq[256] = 1; /* make sure 256 has a nonzero count */ /* Including the pseudo-symbol 256 in the Huffman procedure guarantees * that no real symbol is given code-value of all ones, because 256 * will be placed last in the largest codeword category. @@ -868,8 +868,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) v = 1000000000L; for (i = 0; i <= 256; i++) { if (freq[i] && freq[i] <= v) { - v = freq[i]; - c1 = i; + v = freq[i]; + c1 = i; } } @@ -879,15 +879,15 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) v = 1000000000L; for (i = 0; i <= 256; i++) { if (freq[i] && freq[i] <= v && i != c1) { - v = freq[i]; - c2 = i; + v = freq[i]; + c2 = i; } } /* Done if we've merged everything into one frequency */ if (c2 < 0) break; - + /* Else merge the two counts/trees */ freq[c1] += freq[c2]; freq[c2] = 0; @@ -898,9 +898,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) c1 = others[c1]; codesize[c1]++; } - - others[c1] = c2; /* chain c2 onto c1's tree branch */ - + + others[c1] = c2; /* chain c2 onto c1's tree branch */ + /* Increment the codesize of everything in c2's tree branch */ codesize[c2]++; while (others[c2] >= 0) { @@ -915,7 +915,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) /* The JPEG standard seems to think that this can't happen, */ /* but I'm paranoid... */ if (codesize[i] > MAX_CLEN) - ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW); + ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW); bits[codesize[i]]++; } @@ -931,28 +931,28 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) * shortest nonzero BITS entry is converted into a prefix for two code words * one bit longer. */ - + for (i = MAX_CLEN; i > 16; i--) { while (bits[i] > 0) { - j = i - 2; /* find length of new prefix to be used */ + j = i - 2; /* find length of new prefix to be used */ while (bits[j] == 0) - j--; - - bits[i] -= 2; /* remove two symbols */ - bits[i-1]++; /* one goes in this length */ - bits[j+1] += 2; /* two new symbols in this length */ - bits[j]--; /* symbol of this length is now a prefix */ + j--; + + bits[i] -= 2; /* remove two symbols */ + bits[i-1]++; /* one goes in this length */ + bits[j+1] += 2; /* two new symbols in this length */ + bits[j]--; /* symbol of this length is now a prefix */ } } /* Remove the count for the pseudo-symbol 256 from the largest codelength */ - while (bits[i] == 0) /* find largest codelength still in use */ + while (bits[i] == 0) /* find largest codelength still in use */ i--; bits[i]--; - + /* Return final symbol counts (only for lengths 0..16) */ MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); - + /* Return a list of the symbols sorted by code length */ /* It's not real clear to me why we don't need to consider the codelength * changes made above, but the JPEG spec seems to think this works. @@ -961,8 +961,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) for (i = 1; i <= MAX_CLEN; i++) { for (j = 0; j <= 255; j++) { if (codesize[j] == i) { - htbl->huffval[p] = (UINT8) j; - p++; + htbl->huffval[p] = (UINT8) j; + p++; } } } @@ -999,14 +999,14 @@ finish_pass_gather (j_compress_ptr cinfo) if (! did_dc[dctbl]) { htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); did_dc[dctbl] = TRUE; } if (! did_ac[actbl]) { htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); did_ac[actbl] = TRUE; } @@ -1029,7 +1029,7 @@ jinit_huff_encoder (j_compress_ptr cinfo) entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_encoder)); + SIZEOF(huff_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass_huff; diff --git a/jchuff.h b/jchuff.h index a9599fc1..a1a5280d 100644 --- a/jchuff.h +++ b/jchuff.h @@ -25,23 +25,23 @@ /* Derived data constructed for each Huffman table */ typedef struct { - unsigned int ehufco[256]; /* code for each symbol */ - char ehufsi[256]; /* length of code for each symbol */ + unsigned int ehufco[256]; /* code for each symbol */ + char ehufsi[256]; /* length of code for each symbol */ /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ } c_derived_tbl; /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_c_derived_tbl jMkCDerived -#define jpeg_gen_optimal_table jGenOptTbl +#define jpeg_make_c_derived_tbl jMkCDerived +#define jpeg_gen_optimal_table jGenOptTbl #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, boolean isDC, int tblno, - c_derived_tbl ** pdtbl)); + JPP((j_compress_ptr cinfo, boolean isDC, int tblno, + 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[])); + JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); diff --git a/jcinit.c b/jcinit.c index de0ade2a..347cf6da 100644 --- a/jcinit.c +++ b/jcinit.c @@ -60,7 +60,7 @@ jinit_compress_master (j_compress_ptr cinfo) /* Need a full-image coefficient buffer in any multi-pass mode. */ jinit_c_coef_controller(cinfo, - (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); + (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); jinit_marker_writer(cinfo); diff --git a/jcmainct.c b/jcmainct.c index 5b7ff21d..5a0549a1 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -28,10 +28,10 @@ typedef struct { struct jpeg_c_main_controller pub; /* public fields */ - JDIMENSION cur_iMCU_row; /* number of current iMCU row */ - JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ - boolean suspended; /* remember if we suspended output */ - J_BUF_MODE pass_mode; /* current operating mode */ + JDIMENSION cur_iMCU_row; /* number of current iMCU row */ + JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ + boolean suspended; /* remember if we suspended output */ + J_BUF_MODE pass_mode; /* current operating mode */ /* If using just a strip buffer, this points to the entire set of buffers * (we allocate one for each component). In the full-image case, this @@ -52,12 +52,12 @@ typedef my_main_controller * my_main_ptr; /* Forward declarations */ METHODDEF(void) process_data_simple_main - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); + 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 - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); + JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); #endif @@ -74,10 +74,10 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) if (cinfo->raw_data_in) return; - main_ptr->cur_iMCU_row = 0; /* initialize counters */ + main_ptr->cur_iMCU_row = 0; /* initialize counters */ main_ptr->rowgroup_ctr = 0; main_ptr->suspended = FALSE; - main_ptr->pass_mode = pass_mode; /* save mode for use by process_data */ + main_ptr->pass_mode = pass_mode; /* save mode for use by process_data */ switch (pass_mode) { case JBUF_PASS_THRU: @@ -111,8 +111,8 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) METHODDEF(void) process_data_simple_main (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail) + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) { my_main_ptr main_ptr = (my_main_ptr) cinfo->main; @@ -120,9 +120,9 @@ process_data_simple_main (j_compress_ptr cinfo, /* Read input data if we haven't filled the main buffer yet */ if (main_ptr->rowgroup_ctr < DCTSIZE) (*cinfo->prep->pre_process_data) (cinfo, - input_buf, in_row_ctr, in_rows_avail, - main_ptr->buffer, &main_ptr->rowgroup_ctr, - (JDIMENSION) DCTSIZE); + input_buf, in_row_ctr, in_rows_avail, + main_ptr->buffer, &main_ptr->rowgroup_ctr, + (JDIMENSION) DCTSIZE); /* If we don't have a full iMCU row buffered, return to application for * more data. Note that preprocessor will always pad to fill the iMCU row @@ -140,8 +140,8 @@ process_data_simple_main (j_compress_ptr cinfo, * think we were done. */ if (! main_ptr->suspended) { - (*in_row_ctr)--; - main_ptr->suspended = TRUE; + (*in_row_ctr)--; + main_ptr->suspended = TRUE; } return; } @@ -167,8 +167,8 @@ process_data_simple_main (j_compress_ptr cinfo, METHODDEF(void) process_data_buffer_main (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail) + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) { my_main_ptr main_ptr = (my_main_ptr) cinfo->main; int ci; @@ -179,16 +179,16 @@ process_data_buffer_main (j_compress_ptr cinfo, /* Realign the virtual buffers if at the start of an iMCU row. */ if (main_ptr->rowgroup_ctr == 0) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, main_ptr->whole_image[ci], - main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); + ci++, compptr++) { + main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, main_ptr->whole_image[ci], + main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); } /* In a read pass, pretend we just read some source data. */ if (! writing) { - *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; - main_ptr->rowgroup_ctr = DCTSIZE; + *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; + main_ptr->rowgroup_ctr = DCTSIZE; } } @@ -196,35 +196,35 @@ process_data_buffer_main (j_compress_ptr cinfo, /* Note: preprocessor will pad if necessary to fill the last iMCU row. */ if (writing) { (*cinfo->prep->pre_process_data) (cinfo, - input_buf, in_row_ctr, in_rows_avail, - main_ptr->buffer, &main_ptr->rowgroup_ctr, - (JDIMENSION) DCTSIZE); + input_buf, in_row_ctr, in_rows_avail, + main_ptr->buffer, &main_ptr->rowgroup_ctr, + (JDIMENSION) DCTSIZE); /* Return to application if we need more data to fill the iMCU row. */ if (main_ptr->rowgroup_ctr < DCTSIZE) - return; + return; } /* Emit data, unless this is a sink-only pass. */ if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) { if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) { - /* If compressor did not consume the whole row, then we must need to - * suspend processing and return to the application. In this situation - * we pretend we didn't yet consume the last input row; otherwise, if - * it happened to be the last row of the image, the application would - * think we were done. - */ - if (! main_ptr->suspended) { - (*in_row_ctr)--; - main_ptr->suspended = TRUE; - } - return; + /* If compressor did not consume the whole row, then we must need to + * suspend processing and return to the application. In this situation + * we pretend we didn't yet consume the last input row; otherwise, if + * it happened to be the last row of the image, the application would + * think we were done. + */ + if (! main_ptr->suspended) { + (*in_row_ctr)--; + main_ptr->suspended = TRUE; + } + return; } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ if (main_ptr->suspended) { - (*in_row_ctr)++; - main_ptr->suspended = FALSE; + (*in_row_ctr)++; + main_ptr->suspended = FALSE; } } @@ -250,7 +250,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); + SIZEOF(my_main_controller)); cinfo->main = (struct jpeg_c_main_controller *) main_ptr; main_ptr->pub.start_pass = start_pass_main; @@ -266,13 +266,13 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) /* Allocate a full-image virtual array for each component */ /* Note we pad the bottom to a multiple of the iMCU height */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - compptr->width_in_blocks * DCTSIZE, - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor) * DCTSIZE, - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + compptr->width_in_blocks * DCTSIZE, + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor) * DCTSIZE, + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); @@ -283,11 +283,11 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) #endif /* Allocate a strip buffer for each component */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - compptr->width_in_blocks * DCTSIZE, - (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * DCTSIZE, + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); } } } diff --git a/jcmarker.c b/jcmarker.c index 4fbece4b..62aeb59e 100644 --- a/jcmarker.c +++ b/jcmarker.c @@ -17,7 +17,7 @@ #include "jpegcomp.h" -typedef enum { /* JPEG marker codes */ +typedef enum { /* JPEG marker codes */ M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, @@ -173,7 +173,7 @@ emit_dqt (j_compress_ptr cinfo, int index) /* The table entries must be emitted in zigzag order. */ unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; if (prec) - emit_byte(cinfo, (int) (qval >> 8)); + emit_byte(cinfo, (int) (qval >> 8)); emit_byte(cinfo, (int) (qval & 0xFF)); } @@ -190,33 +190,33 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) { JHUFF_TBL * htbl; int length, i; - + if (is_ac) { htbl = cinfo->ac_huff_tbl_ptrs[index]; - index += 0x10; /* output index has AC bit set */ + index += 0x10; /* output index has AC bit set */ } else { htbl = cinfo->dc_huff_tbl_ptrs[index]; } if (htbl == NULL) ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); - + if (! htbl->sent_table) { emit_marker(cinfo, M_DHT); - + length = 0; for (i = 1; i <= 16; i++) length += htbl->bits[i]; - + emit_2bytes(cinfo, length + 2 + 1 + 16); emit_byte(cinfo, index); - + for (i = 1; i <= 16; i++) emit_byte(cinfo, htbl->bits[i]); - + for (i = 0; i < length; i++) emit_byte(cinfo, htbl->huffval[i]); - + htbl->sent_table = TRUE; } } @@ -258,12 +258,12 @@ emit_dac (j_compress_ptr cinfo) for (i = 0; i < NUM_ARITH_TBLS; i++) { if (dc_in_use[i]) { - emit_byte(cinfo, i); - emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); + emit_byte(cinfo, i); + emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); } if (ac_in_use[i]) { - emit_byte(cinfo, i + 0x10); - emit_byte(cinfo, cinfo->arith_ac_K[i]); + emit_byte(cinfo, i + 0x10); + emit_byte(cinfo, cinfo->arith_ac_K[i]); } } } @@ -276,8 +276,8 @@ emit_dri (j_compress_ptr cinfo) /* Emit a DRI marker */ { emit_marker(cinfo, M_DRI); - - emit_2bytes(cinfo, 4); /* fixed length */ + + emit_2bytes(cinfo, 4); /* fixed length */ emit_2bytes(cinfo, (int) cinfo->restart_interval); } @@ -289,9 +289,9 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) { int ci; jpeg_component_info *compptr; - + emit_marker(cinfo, code); - + emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ /* Make sure image isn't bigger than SOF field can handle */ @@ -320,13 +320,13 @@ emit_sos (j_compress_ptr cinfo) { int i, td, ta; jpeg_component_info *compptr; - + emit_marker(cinfo, M_SOS); - + emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ - + emit_byte(cinfo, cinfo->comps_in_scan); - + for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; emit_byte(cinfo, compptr->component_id); @@ -354,22 +354,22 @@ emit_jfif_app0 (j_compress_ptr cinfo) /* Emit a JFIF-compliant APP0 marker */ { /* - * Length of APP0 block (2 bytes) - * Block ID (4 bytes - ASCII "JFIF") - * Zero byte (1 byte to terminate the ID string) - * Version Major, Minor (2 bytes - major first) - * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) - * Xdpu (2 bytes - dots per unit horizontal) - * Ydpu (2 bytes - dots per unit vertical) - * Thumbnail X size (1 byte) - * Thumbnail Y size (1 byte) + * Length of APP0 block (2 bytes) + * Block ID (4 bytes - ASCII "JFIF") + * Zero byte (1 byte to terminate the ID string) + * Version Major, Minor (2 bytes - major first) + * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) + * Xdpu (2 bytes - dots per unit horizontal) + * Ydpu (2 bytes - dots per unit vertical) + * Thumbnail X size (1 byte) + * Thumbnail Y size (1 byte) */ - + emit_marker(cinfo, M_APP0); - + emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ - emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ + emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ emit_byte(cinfo, 0x46); emit_byte(cinfo, 0x49); emit_byte(cinfo, 0x46); @@ -379,7 +379,7 @@ emit_jfif_app0 (j_compress_ptr cinfo) emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ emit_2bytes(cinfo, (int) cinfo->X_density); emit_2bytes(cinfo, (int) cinfo->Y_density); - emit_byte(cinfo, 0); /* No thumbnail image */ + emit_byte(cinfo, 0); /* No thumbnail image */ emit_byte(cinfo, 0); } @@ -389,12 +389,12 @@ emit_adobe_app14 (j_compress_ptr cinfo) /* Emit an Adobe APP14 marker */ { /* - * Length of APP14 block (2 bytes) - * Block ID (5 bytes - ASCII "Adobe") - * Version Number (2 bytes - currently 100) - * Flags0 (2 bytes - currently 0) - * Flags1 (2 bytes - currently 0) - * Color transform (1 byte) + * Length of APP14 block (2 bytes) + * Block ID (5 bytes - ASCII "Adobe") + * Version Number (2 bytes - currently 100) + * Flags0 (2 bytes - currently 0) + * Flags1 (2 bytes - currently 0) + * Color transform (1 byte) * * Although Adobe TN 5116 mentions Version = 101, all the Adobe files * now in circulation seem to use Version = 100, so that's what we write. @@ -403,28 +403,28 @@ emit_adobe_app14 (j_compress_ptr cinfo) * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with * whether the encoder performed a transformation, which is pretty useless. */ - + emit_marker(cinfo, M_APP14); - + emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ - emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ + emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ emit_byte(cinfo, 0x64); emit_byte(cinfo, 0x6F); emit_byte(cinfo, 0x62); emit_byte(cinfo, 0x65); - emit_2bytes(cinfo, 100); /* Version */ - emit_2bytes(cinfo, 0); /* Flags0 */ - emit_2bytes(cinfo, 0); /* Flags1 */ + emit_2bytes(cinfo, 100); /* Version */ + emit_2bytes(cinfo, 0); /* Flags0 */ + emit_2bytes(cinfo, 0); /* Flags1 */ switch (cinfo->jpeg_color_space) { case JCS_YCbCr: - emit_byte(cinfo, 1); /* Color transform = 1 */ + emit_byte(cinfo, 1); /* Color transform = 1 */ break; case JCS_YCCK: - emit_byte(cinfo, 2); /* Color transform = 2 */ + emit_byte(cinfo, 2); /* Color transform = 2 */ break; default: - emit_byte(cinfo, 0); /* Color transform = 0 */ + emit_byte(cinfo, 0); /* Color transform = 0 */ break; } } @@ -442,12 +442,12 @@ METHODDEF(void) write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen) /* Emit an arbitrary marker header */ { - if (datalen > (unsigned int) 65533) /* safety check */ + if (datalen > (unsigned int) 65533) /* safety check */ ERREXIT(cinfo, JERR_BAD_LENGTH); emit_marker(cinfo, (JPEG_MARKER) marker); - emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ + emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ } METHODDEF(void) @@ -474,12 +474,12 @@ write_file_header (j_compress_ptr cinfo) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - emit_marker(cinfo, M_SOI); /* first the SOI */ + emit_marker(cinfo, M_SOI); /* first the SOI */ /* SOI is defined to reset restart interval to 0 */ marker->last_restart_interval = 0; - if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ + if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ emit_jfif_app0(cinfo); if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ emit_adobe_app14(cinfo); @@ -500,7 +500,7 @@ write_frame_header (j_compress_ptr cinfo) int ci, prec; boolean is_baseline; jpeg_component_info *compptr; - + /* Emit DQT for each quantization table. * Note that emit_dqt() suppresses any duplicate tables. */ @@ -520,9 +520,9 @@ write_frame_header (j_compress_ptr cinfo) } else { is_baseline = TRUE; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1) - is_baseline = FALSE; + is_baseline = FALSE; } if (prec && is_baseline) { is_baseline = FALSE; @@ -539,11 +539,11 @@ write_frame_header (j_compress_ptr cinfo) emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */ } else { if (cinfo->progressive_mode) - emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ + emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ else if (is_baseline) - emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ + emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ else - emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ + emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ } } @@ -575,10 +575,10 @@ write_scan_header (j_compress_ptr cinfo) compptr = cinfo->cur_comp_info[i]; /* DC needs no table for refinement scan */ if (cinfo->Ss == 0 && cinfo->Ah == 0) - emit_dht(cinfo, compptr->dc_tbl_no, FALSE); + emit_dht(cinfo, compptr->dc_tbl_no, FALSE); /* AC needs no table when not present */ if (cinfo->Se) - emit_dht(cinfo, compptr->ac_tbl_no, TRUE); + emit_dht(cinfo, compptr->ac_tbl_no, TRUE); } } @@ -627,9 +627,9 @@ write_tables_only (j_compress_ptr cinfo) if (! cinfo->arith_code) { for (i = 0; i < NUM_HUFF_TBLS; i++) { if (cinfo->dc_huff_tbl_ptrs[i] != NULL) - emit_dht(cinfo, i, FALSE); + emit_dht(cinfo, i, FALSE); if (cinfo->ac_huff_tbl_ptrs[i] != NULL) - emit_dht(cinfo, i, TRUE); + emit_dht(cinfo, i, TRUE); } } @@ -649,7 +649,7 @@ jinit_marker_writer (j_compress_ptr cinfo) /* Create the subobject */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_marker_writer)); + SIZEOF(my_marker_writer)); cinfo->marker = (struct jpeg_marker_writer *) marker; /* Initialize method pointers */ marker->pub.write_file_header = write_file_header; diff --git a/jcmaster.c b/jcmaster.c index dca03156..cf51c1ea 100644 --- a/jcmaster.c +++ b/jcmaster.c @@ -10,7 +10,7 @@ * * This file contains master control logic for the JPEG compressor. * These routines are concerned with parameter validation, initial setup, - * and inter-pass control (determining the number of passes and the work + * and inter-pass control (determining the number of passes and the work * to be done in each pass). */ @@ -23,20 +23,20 @@ /* Private state */ typedef enum { - main_pass, /* input data, also do first output step */ - huff_opt_pass, /* Huffman code optimization pass */ - output_pass /* data output pass */ + main_pass, /* input data, also do first output step */ + huff_opt_pass, /* Huffman code optimization pass */ + output_pass /* data output pass */ } c_pass_type; typedef struct { - struct jpeg_comp_master pub; /* public fields */ + struct jpeg_comp_master pub; /* public fields */ - c_pass_type pass_type; /* the type of the current pass */ + c_pass_type pass_type; /* the type of the current pass */ - int pass_number; /* # of passes completed */ - int total_passes; /* total # of passes needed */ + int pass_number; /* # of passes completed */ + int total_passes; /* total # of passes needed */ - int scan_number; /* current index in scan_info[] */ + int scan_number; /* current index in scan_info[] */ } my_comp_master; typedef my_comp_master * my_master_ptr; @@ -105,7 +105,7 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) /* Check that number of components won't exceed internal array sizes */ if (cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); + MAX_COMPONENTS); /* Compute maximum sampling factors; check factor validity */ cinfo->max_h_samp_factor = 1; @@ -113,12 +113,12 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || - compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) ERREXIT(cinfo, JERR_BAD_SAMPLING); cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, - compptr->h_samp_factor); + compptr->h_samp_factor); cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, - compptr->v_samp_factor); + compptr->v_samp_factor); } /* Compute dimensions of components */ @@ -135,17 +135,17 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) /* Size in DCT blocks */ compptr->width_in_blocks = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); + (long) (cinfo->max_h_samp_factor * DCTSIZE)); compptr->height_in_blocks = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, - (long) (cinfo->max_v_samp_factor * DCTSIZE)); + (long) (cinfo->max_v_samp_factor * DCTSIZE)); /* Size in samples */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, - (long) cinfo->max_h_samp_factor); + (long) cinfo->max_h_samp_factor); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, - (long) cinfo->max_v_samp_factor); + (long) cinfo->max_v_samp_factor); /* Mark component needed (this flag isn't actually used for compression) */ compptr->component_needed = TRUE; } @@ -155,7 +155,7 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) */ cinfo->total_iMCU_rows = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); + (long) (cinfo->max_v_samp_factor*DCTSIZE)); } @@ -188,15 +188,15 @@ validate_script (j_compress_ptr cinfo) #ifdef C_PROGRESSIVE_SUPPORTED cinfo->progressive_mode = TRUE; last_bitpos_ptr = & last_bitpos[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) for (coefi = 0; coefi < DCTSIZE2; coefi++) - *last_bitpos_ptr++ = -1; + *last_bitpos_ptr++ = -1; #else ERREXIT(cinfo, JERR_NOT_COMPILED); #endif } else { cinfo->progressive_mode = FALSE; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) component_sent[ci] = FALSE; } @@ -208,10 +208,10 @@ validate_script (j_compress_ptr cinfo) for (ci = 0; ci < ncomps; ci++) { thisi = scanptr->component_index[ci]; if (thisi < 0 || thisi >= cinfo->num_components) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); /* Components must appear in SOF order within each scan */ if (ci > 0 && thisi <= scanptr->component_index[ci-1]) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); } /* Validate progression parameters */ Ss = scanptr->Ss; @@ -233,43 +233,43 @@ validate_script (j_compress_ptr cinfo) #define MAX_AH_AL 13 #endif if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || - Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); if (Ss == 0) { - if (Se != 0) /* DC and AC together not OK */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + if (Se != 0) /* DC and AC together not OK */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } else { - if (ncomps != 1) /* AC scans must be for only one component */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + if (ncomps != 1) /* AC scans must be for only one component */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } for (ci = 0; ci < ncomps; ci++) { - last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; - if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - for (coefi = Ss; coefi <= Se; coefi++) { - if (last_bitpos_ptr[coefi] < 0) { - /* first scan of this coefficient */ - if (Ah != 0) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } else { - /* not first scan */ - if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); - } - last_bitpos_ptr[coefi] = Al; - } + last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; + if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + for (coefi = Ss; coefi <= Se; coefi++) { + if (last_bitpos_ptr[coefi] < 0) { + /* first scan of this coefficient */ + if (Ah != 0) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } else { + /* not first scan */ + if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } + last_bitpos_ptr[coefi] = Al; + } } #endif } else { /* For sequential JPEG, all progression parameters must be these: */ if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) - ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); /* Make sure components are not sent twice */ for (ci = 0; ci < ncomps; ci++) { - thisi = scanptr->component_index[ci]; - if (component_sent[thisi]) - ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); - component_sent[thisi] = TRUE; + thisi = scanptr->component_index[ci]; + if (component_sent[thisi]) + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + component_sent[thisi] = TRUE; } } } @@ -284,13 +284,13 @@ validate_script (j_compress_ptr cinfo) */ for (ci = 0; ci < cinfo->num_components; ci++) { if (last_bitpos[ci][0] < 0) - ERREXIT(cinfo, JERR_MISSING_DATA); + ERREXIT(cinfo, JERR_MISSING_DATA); } #endif } else { for (ci = 0; ci < cinfo->num_components; ci++) { if (! component_sent[ci]) - ERREXIT(cinfo, JERR_MISSING_DATA); + ERREXIT(cinfo, JERR_MISSING_DATA); } } } @@ -313,7 +313,7 @@ select_scan_parameters (j_compress_ptr cinfo) cinfo->comps_in_scan = scanptr->comps_in_scan; for (ci = 0; ci < scanptr->comps_in_scan; ci++) { cinfo->cur_comp_info[ci] = - &cinfo->comp_info[scanptr->component_index[ci]]; + &cinfo->comp_info[scanptr->component_index[ci]]; } cinfo->Ss = scanptr->Ss; cinfo->Se = scanptr->Se; @@ -326,7 +326,7 @@ select_scan_parameters (j_compress_ptr cinfo) /* Prepare for single sequential-JPEG scan containing all components */ if (cinfo->num_components > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPS_IN_SCAN); + MAX_COMPS_IN_SCAN); cinfo->comps_in_scan = cinfo->num_components; for (ci = 0; ci < cinfo->num_components; ci++) { cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; @@ -346,16 +346,16 @@ per_scan_setup (j_compress_ptr cinfo) { int ci, mcublks, tmp; jpeg_component_info *compptr; - + if (cinfo->comps_in_scan == 1) { - + /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - + /* For noninterleaved scan, always one block per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; @@ -368,28 +368,28 @@ per_scan_setup (j_compress_ptr cinfo) tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; - + /* Prepare array describing MCU composition */ cinfo->blocks_in_MCU = 1; cinfo->MCU_membership[0] = 0; - + } else { - + /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, - MAX_COMPS_IN_SCAN); - + MAX_COMPS_IN_SCAN); + /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_width, - (long) (cinfo->max_h_samp_factor*DCTSIZE)); + (long) (cinfo->max_h_samp_factor*DCTSIZE)); cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->_jpeg_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); - + (long) (cinfo->max_v_samp_factor*DCTSIZE)); + cinfo->blocks_in_MCU = 0; - + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ @@ -407,12 +407,12 @@ per_scan_setup (j_compress_ptr cinfo) /* Prepare array describing MCU composition */ mcublks = compptr->MCU_blocks; if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU) - ERREXIT(cinfo, JERR_BAD_MCU_SIZE); + ERREXIT(cinfo, JERR_BAD_MCU_SIZE); while (mcublks-- > 0) { - cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; } } - + } /* Convert restart specified in rows to actual MCU count. */ @@ -452,8 +452,8 @@ prepare_for_pass (j_compress_ptr cinfo) (*cinfo->fdct->start_pass) (cinfo); (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding); (*cinfo->coef->start_pass) (cinfo, - (master->total_passes > 1 ? - JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); + (master->total_passes > 1 ? + JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); if (cinfo->optimize_coding) { /* No immediate data output; postpone writing frame/scan headers */ @@ -581,7 +581,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_comp_master)); + SIZEOF(my_comp_master)); cinfo->master = (struct jpeg_comp_master *) master; master->pub.prepare_for_pass = prepare_for_pass; master->pub.pass_startup = pass_startup; @@ -602,7 +602,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) cinfo->num_scans = 1; } - if (cinfo->progressive_mode && !cinfo->arith_code) /* TEMPORARY HACK ??? */ + if (cinfo->progressive_mode && !cinfo->arith_code) /* TEMPORARY HACK ??? */ cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ /* Initialize my private state */ diff --git a/jcomapi.c b/jcomapi.c index 9b1fa756..4ca20428 100644 --- a/jcomapi.c +++ b/jcomapi.c @@ -72,8 +72,8 @@ jpeg_destroy (j_common_ptr cinfo) /* NB: mem pointer is NULL if memory mgr failed to initialize. */ if (cinfo->mem != NULL) (*cinfo->mem->self_destruct) (cinfo); - cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ - cinfo->global_state = 0; /* mark it destroyed */ + cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ + cinfo->global_state = 0; /* mark it destroyed */ } @@ -89,7 +89,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo) tbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); - tbl->sent_table = FALSE; /* make sure this is false in any new table */ + tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } @@ -101,6 +101,6 @@ jpeg_alloc_huff_table (j_common_ptr cinfo) tbl = (JHUFF_TBL *) (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); - tbl->sent_table = FALSE; /* make sure this is false in any new table */ + tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } diff --git a/jconfig.txt b/jconfig.txt index dda62367..ba829ad2 100644 --- a/jconfig.txt +++ b/jconfig.txt @@ -94,10 +94,10 @@ /* Define "boolean" as unsigned char, not int, on Windows systems. */ #ifdef _WIN32 -#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ typedef unsigned char boolean; #endif -#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ #endif @@ -130,11 +130,11 @@ typedef unsigned char boolean; /* These defines indicate which image (non-JPEG) file formats are allowed. */ -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -#undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef RLE_SUPPORTED /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ /* Define this if you want to name both input and output files on the command * line, rather than using stdout and optionally stdin. You MUST do this if diff --git a/jcparam.c b/jcparam.c index f4e5eec8..ba81108c 100644 --- a/jcparam.c +++ b/jcparam.c @@ -25,8 +25,8 @@ GLOBAL(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, boolean force_baseline) + const unsigned int *basic_table, + int scale_factor, boolean force_baseline) /* Define a quantization table equal to the basic_table times * a scale factor (given as a percentage). * If force_baseline is TRUE, the computed quantization table entries @@ -55,7 +55,7 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, if (temp <= 0L) temp = 1L; if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */ if (force_baseline && temp > 255L) - temp = 255L; /* limit to baseline range if requested */ + temp = 255L; /* limit to baseline range if requested */ (*qtblptr)->quantval[i] = (UINT16) temp; } @@ -100,16 +100,16 @@ jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) { /* Set up two quantization tables using the specified scaling */ jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, - cinfo->q_scale_factor[0], force_baseline); + cinfo->q_scale_factor[0], force_baseline); jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, - cinfo->q_scale_factor[1], force_baseline); + cinfo->q_scale_factor[1], force_baseline); } #endif GLOBAL(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - boolean force_baseline) + boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables * and a straight percentage-scaling quality scale. In most cases it's better * to use jpeg_set_quality (below); this entry point is provided for @@ -118,9 +118,9 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, { /* Set up two quantization tables using the specified scaling */ jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, - scale_factor, force_baseline); + scale_factor, force_baseline); jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, - scale_factor, force_baseline); + scale_factor, force_baseline); } @@ -192,12 +192,12 @@ jpeg_set_defaults (j_compress_ptr cinfo) if (cinfo->comp_info == NULL) cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - MAX_COMPONENTS * SIZEOF(jpeg_component_info)); + MAX_COMPONENTS * SIZEOF(jpeg_component_info)); /* Initialize everything not dependent on the color space */ #if JPEG_LIB_VERSION >= 70 - cinfo->scale_num = 1; /* 1:1 scaling */ + cinfo->scale_num = 1; /* 1:1 scaling */ cinfo->scale_denom = 1; #endif cinfo->data_precision = BITS_IN_JSAMPLE; @@ -262,8 +262,8 @@ jpeg_set_defaults (j_compress_ptr cinfo) */ cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */ cinfo->JFIF_minor_version = 1; - cinfo->density_unit = 0; /* Pixel size is unknown by default */ - cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ + cinfo->density_unit = 0; /* Pixel size is unknown by default */ + cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ cinfo->Y_density = 1; /* Choose JPEG colorspace based on input space, set defaults accordingly */ @@ -389,7 +389,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) cinfo->num_components = cinfo->input_components; if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); + MAX_COMPONENTS); for (ci = 0; ci < cinfo->num_components; ci++) { SET_COMP(ci, ci, 1,1, 0, 0,0); } @@ -404,7 +404,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) LOCAL(jpeg_scan_info *) fill_a_scan (jpeg_scan_info * scanptr, int ci, - int Ss, int Se, int Ah, int Al) + int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for specified component */ { scanptr->comps_in_scan = 1; @@ -419,7 +419,7 @@ fill_a_scan (jpeg_scan_info * scanptr, int ci, LOCAL(jpeg_scan_info *) fill_scans (jpeg_scan_info * scanptr, int ncomps, - int Ss, int Se, int Ah, int Al) + int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for each component */ { int ci; @@ -482,9 +482,9 @@ jpeg_simple_progression (j_compress_ptr cinfo) } else { /* All-purpose script for other color spaces. */ if (ncomps > MAX_COMPS_IN_SCAN) - nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ + nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ else - nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ + nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ } /* Allocate space for script. @@ -498,7 +498,7 @@ jpeg_simple_progression (j_compress_ptr cinfo) cinfo->script_space_size = MAX(nscans, 10); cinfo->script_space = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - cinfo->script_space_size * SIZEOF(jpeg_scan_info)); + cinfo->script_space_size * SIZEOF(jpeg_scan_info)); } scanptr = cinfo->script_space; cinfo->scan_info = scanptr; diff --git a/jcphuff.c b/jcphuff.c index 31028717..b764b650 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -15,7 +15,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jchuff.h" /* Declarations shared with jchuff.c */ +#include "jchuff.h" /* Declarations shared with jchuff.c */ #ifdef C_PROGRESSIVE_SUPPORTED @@ -30,24 +30,24 @@ typedef struct { /* Bit-level coding status. * next_output_byte/free_in_buffer are local copies of cinfo->dest fields. */ - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - INT32 put_buffer; /* current bit-accumulation buffer */ - int put_bits; /* # of bits now in it */ - j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + INT32 put_buffer; /* current bit-accumulation buffer */ + int put_bits; /* # of bits now in it */ + j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ /* Coding status for DC components */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ /* Coding status for AC components */ - int ac_tbl_no; /* the table number of the single component */ - unsigned int EOBRUN; /* run length of EOBs */ - unsigned int BE; /* # of buffered correction bits before MCU */ - char * bit_buffer; /* buffer for correction bits (1 per char) */ + int ac_tbl_no; /* the table number of the single component */ + unsigned int EOBRUN; /* run length of EOBs */ + unsigned int BE; /* # of buffered correction bits before MCU */ + char * bit_buffer; /* buffer for correction bits (1 per char) */ /* packing correction bits tightly would save some space but cost time... */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ - int next_restart_num; /* next restart number to write (0-7) */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + int next_restart_num; /* next restart number to write (0-7) */ /* Pointers to derived tables (these workspaces have image lifespan). * Since any one scan codes only DC or only AC, we only need one set @@ -67,7 +67,7 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr; * The minimum safe size is 64 bits. */ -#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ +#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. * We assume that int right shift is unsigned if INT32 right shift is, @@ -75,25 +75,25 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr; */ #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS int ishift_temp; +#define ISHIFT_TEMPS int ishift_temp; #define IRIGHT_SHIFT(x,shft) \ - ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ - (ishift_temp >> (shft))) + ((ishift_temp = (x)) < 0 ? \ + (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ + (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif /* Forward declarations */ METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo)); METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); @@ -104,7 +104,7 @@ METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); METHODDEF(void) start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; boolean is_DC_band; int ci, tbl; @@ -130,9 +130,9 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) entropy->pub.encode_mcu = encode_mcu_AC_refine; /* AC refinement needs a correction bit buffer */ if (entropy->bit_buffer == NULL) - entropy->bit_buffer = (char *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - MAX_CORR_BITS * SIZEOF(char)); + entropy->bit_buffer = (char *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + MAX_CORR_BITS * SIZEOF(char)); } } if (gather_statistics) @@ -149,8 +149,8 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) entropy->last_dc_val[ci] = 0; /* Get table index */ if (is_DC_band) { - if (cinfo->Ah != 0) /* DC refinement needs no table */ - continue; + if (cinfo->Ah != 0) /* DC refinement needs no table */ + continue; tbl = compptr->dc_tbl_no; } else { entropy->ac_tbl_no = tbl = compptr->ac_tbl_no; @@ -163,15 +163,15 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) /* Allocate and zero the statistics tables */ /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->count_ptrs[tbl] == NULL) - entropy->count_ptrs[tbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); + entropy->count_ptrs[tbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long)); } else { /* Compute derived values for Huffman table */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl, - & entropy->derived_tbls[tbl]); + & entropy->derived_tbls[tbl]); } } @@ -196,9 +196,9 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) /* Emit a byte */ #define emit_byte(entropy,val) \ - { *(entropy)->next_output_byte++ = (JOCTET) (val); \ - if (--(entropy)->free_in_buffer == 0) \ - dump_buffer(entropy); } + { *(entropy)->next_output_byte++ = (JOCTET) (val); \ + if (--(entropy)->free_in_buffer == 0) \ + dump_buffer(entropy); } LOCAL(void) @@ -236,21 +236,21 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); if (entropy->gather_statistics) - return; /* do nothing if we're only getting stats */ + return; /* do nothing if we're only getting stats */ put_buffer &= (((INT32) 1)<put_buffer; /* and merge with old buffer contents */ while (put_bits >= 8) { int c = (int) ((put_buffer >> 16) & 0xFF); - + emit_byte(entropy, c); - if (c == 0xFF) { /* need to stuff a zero byte? */ + if (c == 0xFF) { /* need to stuff a zero byte? */ emit_byte(entropy, 0); } put_buffer <<= 8; @@ -293,10 +293,10 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) LOCAL(void) emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, - unsigned int nbits) + unsigned int nbits) { if (entropy->gather_statistics) - return; /* no real work */ + return; /* no real work */ while (nbits > 0) { emit_bits(entropy, (unsigned int) (*bufstart), 1); @@ -315,7 +315,7 @@ emit_eobrun (phuff_entropy_ptr entropy) { register int temp, nbits; - if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ + if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ temp = entropy->EOBRUN; nbits = 0; while ((temp >>= 1)) @@ -409,12 +409,12 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Encode the DC coefficient difference per section G.1.2.1 */ temp2 = temp; if (temp < 0) { - temp = -temp; /* temp is abs value of input */ + temp = -temp; /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ temp2--; } - + /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; while (temp) { @@ -426,13 +426,13 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) */ if (nbits > MAX_COEF_BITS+1) ERREXIT(cinfo, JERR_BAD_DCT_COEF); - + /* Count/emit the Huffman-coded symbol for the number of bits */ emit_symbol(entropy, compptr->dc_tbl_no, nbits); - + /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ + if (nbits) /* emit_bits rejects calls with size 0 */ emit_bits(entropy, (unsigned int) temp2, nbits); } @@ -481,9 +481,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) block = MCU_data[0]; /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ - - r = 0; /* r = run length of zeros */ - + + r = 0; /* r = run length of zeros */ + for (k = cinfo->Ss; k <= Se; k++) { if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { r++; @@ -495,12 +495,12 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * interwoven with finding the abs value (temp) and output bits (temp2). */ if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - temp >>= Al; /* apply the point transform */ + temp = -temp; /* temp is abs value of input */ + temp >>= Al; /* apply the point transform */ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ temp2 = ~temp; } else { - temp >>= Al; /* apply the point transform */ + temp >>= Al; /* apply the point transform */ temp2 = temp; } /* Watch out for case that nonzero coef is zero after point transform */ @@ -519,7 +519,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) } /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ + nbits = 1; /* there must be at least one 1 bit */ while ((temp >>= 1)) nbits++; /* Check for out-of-range coefficient values */ @@ -533,13 +533,13 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* or the complement of its magnitude, if negative. */ emit_bits(entropy, (unsigned int) temp2, nbits); - r = 0; /* reset zero run length */ + r = 0; /* reset zero run length */ } - if (r > 0) { /* If there are trailing zeroes, */ - entropy->EOBRUN++; /* count an EOB */ + if (r > 0) { /* If there are trailing zeroes, */ + entropy->EOBRUN++; /* count an EOB */ if (entropy->EOBRUN == 0x7FFF) - emit_eobrun(entropy); /* force it out to avoid overflow */ + emit_eobrun(entropy); /* force it out to avoid overflow */ } cinfo->dest->next_output_byte = entropy->next_output_byte; @@ -648,17 +648,17 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) * in C, we shift after obtaining the absolute value. */ if (temp < 0) - temp = -temp; /* temp is abs value of input */ - temp >>= Al; /* apply the point transform */ - absvalues[k] = temp; /* save abs value for main pass */ + temp = -temp; /* temp is abs value of input */ + temp >>= Al; /* apply the point transform */ + absvalues[k] = temp; /* save abs value for main pass */ if (temp == 1) - EOB = k; /* EOB = index of last newly-nonzero coef */ + EOB = k; /* EOB = index of last newly-nonzero coef */ } /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ - - r = 0; /* r = run length of zeros */ - BR = 0; /* BR = count of buffered bits added now */ + + r = 0; /* r = run length of zeros */ + BR = 0; /* BR = count of buffered bits added now */ BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ for (k = cinfo->Ss; k <= Se; k++) { @@ -705,12 +705,12 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) emit_buffered_bits(entropy, BR_buffer, BR); BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ BR = 0; - r = 0; /* reset zero run length */ + r = 0; /* reset zero run length */ } - if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ - entropy->EOBRUN++; /* count an EOB */ - entropy->BE += BR; /* concat my correction bits to older ones */ + if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ + entropy->EOBRUN++; /* count an EOB */ + entropy->BE += BR; /* concat my correction bits to older ones */ /* We force out the EOB if we risk either: * 1. overflow of the EOB counter; * 2. overflow of the correction bit buffer during the next MCU. @@ -742,7 +742,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; entropy->next_output_byte = cinfo->dest->next_output_byte; @@ -784,8 +784,8 @@ finish_pass_gather_phuff (j_compress_ptr cinfo) for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; if (is_DC_band) { - if (cinfo->Ah != 0) /* DC refinement needs no table */ - continue; + if (cinfo->Ah != 0) /* DC refinement needs no table */ + continue; tbl = compptr->dc_tbl_no; } else { tbl = compptr->ac_tbl_no; @@ -816,7 +816,7 @@ jinit_phuff_encoder (j_compress_ptr cinfo) entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_encoder)); + SIZEOF(phuff_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass_phuff; @@ -825,7 +825,7 @@ jinit_phuff_encoder (j_compress_ptr cinfo) entropy->derived_tbls[i] = NULL; entropy->count_ptrs[i] = NULL; } - entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ + entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ } #endif /* C_PROGRESSIVE_SUPPORTED */ diff --git a/jcprepct.c b/jcprepct.c index fa93333d..785ff887 100644 --- a/jcprepct.c +++ b/jcprepct.c @@ -58,12 +58,12 @@ typedef struct { */ JSAMPARRAY color_buf[MAX_COMPONENTS]; - JDIMENSION rows_to_go; /* counts rows remaining in source image */ - int next_buf_row; /* index of next row to store in color_buf */ + JDIMENSION rows_to_go; /* counts rows remaining in source image */ + int next_buf_row; /* index of next row to store in color_buf */ -#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */ - int this_row_group; /* starting row index of group to process */ - int next_buf_stop; /* downsample when we reach this index */ +#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */ + int this_row_group; /* starting row index of group to process */ + int next_buf_stop; /* downsample when we reach this index */ #endif } my_prep_controller; @@ -104,13 +104,13 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) LOCAL(void) expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, - int input_rows, int output_rows) + int input_rows, int output_rows) { register int row; for (row = input_rows; row < output_rows; row++) { jcopy_sample_rows(image_data, input_rows-1, image_data, row, - 1, num_cols); + 1, num_cols); } } @@ -126,10 +126,10 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, METHODDEF(void) pre_process_data (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail) + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; int numrows, ci; @@ -137,32 +137,32 @@ pre_process_data (j_compress_ptr cinfo, jpeg_component_info * compptr; while (*in_row_ctr < in_rows_avail && - *out_row_group_ctr < out_row_groups_avail) { + *out_row_group_ctr < out_row_groups_avail) { /* Do color conversion to fill the conversion buffer. */ inrows = in_rows_avail - *in_row_ctr; numrows = cinfo->max_v_samp_factor - prep->next_buf_row; numrows = (int) MIN((JDIMENSION) numrows, inrows); (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, - prep->color_buf, - (JDIMENSION) prep->next_buf_row, - numrows); + prep->color_buf, + (JDIMENSION) prep->next_buf_row, + numrows); *in_row_ctr += numrows; prep->next_buf_row += numrows; prep->rows_to_go -= numrows; /* If at bottom of image, pad to fill the conversion buffer. */ if (prep->rows_to_go == 0 && - prep->next_buf_row < cinfo->max_v_samp_factor) { + prep->next_buf_row < cinfo->max_v_samp_factor) { for (ci = 0; ci < cinfo->num_components; ci++) { - expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, - prep->next_buf_row, cinfo->max_v_samp_factor); + expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, + prep->next_buf_row, cinfo->max_v_samp_factor); } prep->next_buf_row = cinfo->max_v_samp_factor; } /* If we've filled the conversion buffer, empty it. */ if (prep->next_buf_row == cinfo->max_v_samp_factor) { (*cinfo->downsample->downsample) (cinfo, - prep->color_buf, (JDIMENSION) 0, - output_buf, *out_row_group_ctr); + prep->color_buf, (JDIMENSION) 0, + output_buf, *out_row_group_ctr); prep->next_buf_row = 0; (*out_row_group_ctr)++; } @@ -170,16 +170,16 @@ pre_process_data (j_compress_ptr cinfo, * 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) { + *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)); + 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 */ + break; /* can exit outer loop without test */ } } } @@ -193,10 +193,10 @@ pre_process_data (j_compress_ptr cinfo, METHODDEF(void) pre_process_context (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail) + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail) { my_prep_ptr prep = (my_prep_ptr) cinfo->prep; int numrows, ci; @@ -210,19 +210,19 @@ pre_process_context (j_compress_ptr cinfo, numrows = prep->next_buf_stop - prep->next_buf_row; numrows = (int) MIN((JDIMENSION) numrows, inrows); (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, - prep->color_buf, - (JDIMENSION) prep->next_buf_row, - numrows); + prep->color_buf, + (JDIMENSION) prep->next_buf_row, + numrows); /* Pad at top of image, if first time through */ if (prep->rows_to_go == cinfo->image_height) { - for (ci = 0; ci < cinfo->num_components; ci++) { - int row; - for (row = 1; row <= cinfo->max_v_samp_factor; row++) { - jcopy_sample_rows(prep->color_buf[ci], 0, - prep->color_buf[ci], -row, - 1, cinfo->image_width); - } - } + for (ci = 0; ci < cinfo->num_components; ci++) { + int row; + for (row = 1; row <= cinfo->max_v_samp_factor; row++) { + jcopy_sample_rows(prep->color_buf[ci], 0, + prep->color_buf[ci], -row, + 1, cinfo->image_width); + } + } } *in_row_ctr += numrows; prep->next_buf_row += numrows; @@ -230,29 +230,29 @@ pre_process_context (j_compress_ptr cinfo, } else { /* Return for more data, unless we are at the bottom of the image. */ if (prep->rows_to_go != 0) - break; + break; /* 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; + 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; } } /* If we've gotten enough data, downsample a row group. */ if (prep->next_buf_row == prep->next_buf_stop) { (*cinfo->downsample->downsample) (cinfo, - prep->color_buf, - (JDIMENSION) prep->this_row_group, - output_buf, *out_row_group_ctr); + prep->color_buf, + (JDIMENSION) prep->this_row_group, + output_buf, *out_row_group_ctr); (*out_row_group_ctr)++; /* Advance pointers with wraparound as necessary. */ prep->this_row_group += cinfo->max_v_samp_factor; if (prep->this_row_group >= buf_height) - prep->this_row_group = 0; + prep->this_row_group = 0; if (prep->next_buf_row >= buf_height) - prep->next_buf_row = 0; + prep->next_buf_row = 0; prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor; } } @@ -277,8 +277,8 @@ create_context_buffer (j_compress_ptr cinfo) */ fake_buffer = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (cinfo->num_components * 5 * rgroup_height) * - SIZEOF(JSAMPROW)); + (cinfo->num_components * 5 * rgroup_height) * + SIZEOF(JSAMPROW)); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { @@ -289,11 +289,11 @@ create_context_buffer (j_compress_ptr cinfo) true_buffer = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * - cinfo->max_h_samp_factor) / compptr->h_samp_factor), + cinfo->max_h_samp_factor) / compptr->h_samp_factor), (JDIMENSION) (3 * rgroup_height)); /* Copy true buffer row pointers into the middle of the fake row array */ MEMCOPY(fake_buffer + rgroup_height, true_buffer, - 3 * rgroup_height * SIZEOF(JSAMPROW)); + 3 * rgroup_height * SIZEOF(JSAMPROW)); /* Fill in the above and below wraparound pointers */ for (i = 0; i < rgroup_height; i++) { fake_buffer[i] = true_buffer[2 * rgroup_height + i]; @@ -318,12 +318,12 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) int ci; jpeg_component_info * compptr; - if (need_full_buffer) /* safety check */ + if (need_full_buffer) /* safety check */ ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); prep = (my_prep_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_prep_controller)); + SIZEOF(my_prep_controller)); cinfo->prep = (struct jpeg_c_prep_controller *) prep; prep->pub.start_pass = start_pass_prep; @@ -343,12 +343,12 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) /* No context, just make it tall enough for one row group */ prep->pub.pre_process_data = pre_process_data; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * - cinfo->max_h_samp_factor) / compptr->h_samp_factor), - (JDIMENSION) cinfo->max_v_samp_factor); + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * + cinfo->max_h_samp_factor) / compptr->h_samp_factor), + (JDIMENSION) cinfo->max_v_samp_factor); } } } diff --git a/jcsample.c b/jcsample.c index eea376f9..4662bee3 100644 --- a/jcsample.c +++ b/jcsample.c @@ -54,13 +54,13 @@ /* Pointer to routine to downsample a single component */ typedef JMETHOD(void, downsample1_ptr, - (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data)); /* Private subobject */ typedef struct { - struct jpeg_downsampler pub; /* public fields */ + struct jpeg_downsampler pub; /* public fields */ /* Downsampling method pointers, one per component */ downsample1_ptr methods[MAX_COMPONENTS]; @@ -87,7 +87,7 @@ start_pass_downsample (j_compress_ptr cinfo) LOCAL(void) expand_right_edge (JSAMPARRAY image_data, int num_rows, - JDIMENSION input_cols, JDIMENSION output_cols) + JDIMENSION input_cols, JDIMENSION output_cols) { register JSAMPROW ptr; register JSAMPLE pixval; @@ -98,9 +98,9 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows, if (numcols > 0) { for (row = 0; row < num_rows; row++) { ptr = image_data[row] + input_cols; - pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ + pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ for (count = numcols; count > 0; count--) - *ptr++ = pixval; + *ptr++ = pixval; } } } @@ -114,8 +114,8 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows, METHODDEF(void) sep_downsample (j_compress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_index, - JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) + JSAMPIMAGE input_buf, JDIMENSION in_row_index, + JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) { my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; int ci; @@ -140,10 +140,10 @@ sep_downsample (j_compress_ptr cinfo, METHODDEF(void) int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; - JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ + JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; JSAMPROW inptr, outptr; INT32 outvalue; @@ -158,19 +158,19 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * h_expand); + cinfo->image_width, output_cols * h_expand); inrow = 0; for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; for (outcol = 0, outcol_h = 0; outcol < output_cols; - outcol++, outcol_h += h_expand) { + outcol++, outcol_h += h_expand) { outvalue = 0; for (v = 0; v < v_expand; v++) { - inptr = input_data[inrow+v] + outcol_h; - for (h = 0; h < h_expand; h++) { - outvalue += (INT32) GETJSAMPLE(*inptr++); - } + inptr = input_data[inrow+v] + outcol_h; + for (h = 0; h < h_expand; h++) { + outvalue += (INT32) GETJSAMPLE(*inptr++); + } } *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); } @@ -187,14 +187,14 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { /* Copy the data */ jcopy_sample_rows(input_data, 0, output_data, 0, - cinfo->max_v_samp_factor, cinfo->image_width); + cinfo->max_v_samp_factor, cinfo->image_width); /* Edge-expand */ expand_right_edge(output_data, cinfo->max_v_samp_factor, - cinfo->image_width, compptr->width_in_blocks * DCTSIZE); + cinfo->image_width, compptr->width_in_blocks * DCTSIZE); } @@ -212,7 +212,7 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { int outrow; JDIMENSION outcol; @@ -225,16 +225,16 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * 2); + cinfo->image_width, output_cols * 2); for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr = input_data[outrow]; - bias = 0; /* bias = 0,1,0,1,... for successive samples */ + bias = 0; /* bias = 0,1,0,1,... for successive samples */ for (outcol = 0; outcol < output_cols; outcol++) { *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) - + bias) >> 1); - bias ^= 1; /* 0=>1, 1=>0 */ + + bias) >> 1); + bias ^= 1; /* 0=>1, 1=>0 */ inptr += 2; } } @@ -249,7 +249,7 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow; JDIMENSION outcol; @@ -262,19 +262,19 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * efficient. */ expand_right_edge(input_data, cinfo->max_v_samp_factor, - cinfo->image_width, output_cols * 2); + cinfo->image_width, output_cols * 2); inrow = 0; for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr0 = input_data[inrow]; inptr1 = input_data[inrow+1]; - bias = 1; /* bias = 1,2,1,2,... for successive samples */ + bias = 1; /* bias = 1,2,1,2,... for successive samples */ for (outcol = 0; outcol < output_cols; outcol++) { *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) - + bias) >> 2); - bias ^= 3; /* 1=>2, 2=>1 */ + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + + bias) >> 2); + bias ^= 3; /* 1=>2, 2=>1 */ inptr0 += 2; inptr1 += 2; } inrow += 2; @@ -292,7 +292,7 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { int inrow, outrow; JDIMENSION colctr; @@ -305,7 +305,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, * efficient. */ expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, - cinfo->image_width, output_cols * 2); + cinfo->image_width, output_cols * 2); /* We don't bother to form the individual "smoothed" input pixel values; * we can directly compute the output which is the average of the four @@ -333,14 +333,14 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, /* Special case for first column: pretend column -1 is same as column 0 */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); neighsum += neighsum; neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; @@ -348,17 +348,17 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, for (colctr = output_cols - 2; colctr > 0; colctr--) { /* sum of pixels directly mapped to this output element */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); /* sum of edge-neighbor pixels */ neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + - GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); /* The edge-neighbors count twice as much as corner-neighbors */ neighsum += neighsum; /* Add in the corner-neighbors */ neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + - GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); /* form final output scaled up by 2^16 */ membersum = membersum * memberscale + neighsum * neighscale; /* round, descale and output it */ @@ -368,14 +368,14 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, /* Special case for last column */ membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + - GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + - GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); neighsum += neighsum; neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + - GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); membersum = membersum * memberscale + neighsum * neighscale; *outptr = (JSAMPLE) ((membersum + 32768) >> 16); @@ -392,7 +392,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data) + JSAMPARRAY input_data, JSAMPARRAY output_data) { int outrow; JDIMENSION colctr; @@ -406,7 +406,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, * efficient. */ expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, - cinfo->image_width, output_cols); + cinfo->image_width, output_cols); /* Each of the eight neighbor pixels contributes a fraction SF to the * smoothed pixel, while the main pixel contributes (1-8*SF). In order @@ -425,10 +425,10 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, /* Special case for first column */ colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + - GETJSAMPLE(*inptr); + GETJSAMPLE(*inptr); membersum = GETJSAMPLE(*inptr++); nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + - GETJSAMPLE(*inptr); + GETJSAMPLE(*inptr); neighsum = colsum + (colsum - membersum) + nextcolsum; membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); @@ -438,7 +438,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, membersum = GETJSAMPLE(*inptr++); above_ptr++; below_ptr++; nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + - GETJSAMPLE(*inptr); + GETJSAMPLE(*inptr); neighsum = lastcolsum + (colsum - membersum) + nextcolsum; membersum = membersum * memberscale + neighsum * neighscale; *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); @@ -472,7 +472,7 @@ jinit_downsampler (j_compress_ptr cinfo) downsample = (my_downsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_downsampler)); + SIZEOF(my_downsampler)); cinfo->downsample = (struct jpeg_downsampler *) downsample; downsample->pub.start_pass = start_pass_downsample; downsample->pub.downsample = sep_downsample; @@ -485,35 +485,35 @@ jinit_downsampler (j_compress_ptr cinfo) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor == cinfo->max_h_samp_factor && - compptr->v_samp_factor == cinfo->max_v_samp_factor) { + compptr->v_samp_factor == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { - downsample->methods[ci] = fullsize_smooth_downsample; - downsample->pub.need_context_rows = TRUE; + downsample->methods[ci] = fullsize_smooth_downsample; + downsample->pub.need_context_rows = TRUE; } else #endif - downsample->methods[ci] = fullsize_downsample; + downsample->methods[ci] = fullsize_downsample; } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && - compptr->v_samp_factor == cinfo->max_v_samp_factor) { + compptr->v_samp_factor == cinfo->max_v_samp_factor) { smoothok = FALSE; if (jsimd_can_h2v1_downsample()) downsample->methods[ci] = jsimd_h2v1_downsample; else downsample->methods[ci] = h2v1_downsample; } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && - compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { + compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { - downsample->methods[ci] = h2v2_smooth_downsample; - downsample->pub.need_context_rows = TRUE; + downsample->methods[ci] = h2v2_smooth_downsample; + downsample->pub.need_context_rows = TRUE; } else #endif - if (jsimd_can_h2v2_downsample()) - downsample->methods[ci] = jsimd_h2v2_downsample; - else - downsample->methods[ci] = h2v2_downsample; + if (jsimd_can_h2v2_downsample()) + downsample->methods[ci] = jsimd_h2v2_downsample; + else + downsample->methods[ci] = h2v2_downsample; } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && - (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { smoothok = FALSE; downsample->methods[ci] = int_downsample; } else diff --git a/jctrans.c b/jctrans.c index 916e872f..c3532939 100644 --- a/jctrans.c +++ b/jctrans.c @@ -18,9 +18,9 @@ /* Forward declarations */ LOCAL(void) transencode_master_selection - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); + JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); LOCAL(void) transencode_coef_controller - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); + JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); /* @@ -48,7 +48,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) /* Perform master selection of active modules */ transencode_master_selection(cinfo, coef_arrays); /* Wait for jpeg_finish_compress() call */ - cinfo->next_scanline = 0; /* so jpeg_write_marker works */ + cinfo->next_scanline = 0; /* so jpeg_write_marker works */ cinfo->global_state = CSTATE_WRCOEFS; } @@ -62,7 +62,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) GLOBAL(void) jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo) + j_compress_ptr dstinfo) { JQUANT_TBL ** qtblptr; jpeg_component_info *incomp, *outcomp; @@ -96,10 +96,10 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, if (srcinfo->quant_tbl_ptrs[tblno] != NULL) { qtblptr = & dstinfo->quant_tbl_ptrs[tblno]; if (*qtblptr == NULL) - *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); + *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); MEMCOPY((*qtblptr)->quantval, - srcinfo->quant_tbl_ptrs[tblno]->quantval, - SIZEOF((*qtblptr)->quantval)); + srcinfo->quant_tbl_ptrs[tblno]->quantval, + SIZEOF((*qtblptr)->quantval)); (*qtblptr)->sent_table = FALSE; } } @@ -109,7 +109,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, dstinfo->num_components = srcinfo->num_components; if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS) ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components, - MAX_COMPONENTS); + MAX_COMPONENTS); for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info; ci < dstinfo->num_components; ci++, incomp++, outcomp++) { outcomp->component_id = incomp->component_id; @@ -122,14 +122,14 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, */ tblno = outcomp->quant_tbl_no; if (tblno < 0 || tblno >= NUM_QUANT_TBLS || - srcinfo->quant_tbl_ptrs[tblno] == NULL) + srcinfo->quant_tbl_ptrs[tblno] == NULL) ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno); slot_quant = srcinfo->quant_tbl_ptrs[tblno]; c_quant = incomp->quant_table; if (c_quant != NULL) { for (coefi = 0; coefi < DCTSIZE2; coefi++) { - if (c_quant->quantval[coefi] != slot_quant->quantval[coefi]) - ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno); + if (c_quant->quantval[coefi] != slot_quant->quantval[coefi]) + ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno); } } /* Note: we do not copy the source's Huffman table assignments; @@ -163,7 +163,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, LOCAL(void) transencode_master_selection (j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays) + jvirt_barray_ptr * coef_arrays) { /* Although we don't actually use input_components for transcoding, * jcmaster.c's initial_setup will complain if input_components is 0. @@ -219,10 +219,10 @@ transencode_master_selection (j_compress_ptr cinfo, typedef struct { struct jpeg_c_coef_controller pub; /* public fields */ - JDIMENSION iMCU_row_num; /* iMCU row # within image */ - JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ + JDIMENSION iMCU_row_num; /* iMCU row # within image */ + JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* Virtual block array for each component. */ jvirt_barray_ptr * whole_image; @@ -289,7 +289,7 @@ METHODDEF(boolean) compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, ci, xindex, yindex, yoffset, blockcnt; @@ -312,44 +312,44 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { + MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ + blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (coef->iMCU_row_num < last_iMCU_row || - yindex+yoffset < compptr->last_row_height) { - /* Fill in pointers to real blocks in this row */ - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < blockcnt; xindex++) - MCU_buffer[blkn++] = buffer_ptr++; - } else { - /* At bottom of image, need a whole row of dummy blocks */ - xindex = 0; - } - /* Fill in any dummy blocks needed in this row. - * Dummy blocks are filled in the same way as in jccoefct.c: - * all zeroes in the AC entries, DC entries equal to previous - * block's DC value. The init routine has already zeroed the - * AC entries, so we need only set the DC entries correctly. - */ - for (; xindex < compptr->MCU_width; xindex++) { - MCU_buffer[blkn] = coef->dummy_buffer[blkn]; - MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; - blkn++; - } - } + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (coef->iMCU_row_num < last_iMCU_row || + yindex+yoffset < compptr->last_row_height) { + /* Fill in pointers to real blocks in this row */ + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < blockcnt; xindex++) + MCU_buffer[blkn++] = buffer_ptr++; + } else { + /* At bottom of image, need a whole row of dummy blocks */ + xindex = 0; + } + /* Fill in any dummy blocks needed in this row. + * Dummy blocks are filled in the same way as in jccoefct.c: + * all zeroes in the AC entries, DC entries equal to previous + * block's DC value. The init routine has already zeroed the + * AC entries, so we need only set the DC entries correctly. + */ + for (; xindex < compptr->MCU_width; xindex++) { + MCU_buffer[blkn] = coef->dummy_buffer[blkn]; + MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; + blkn++; + } + } } /* Try to write the MCU. */ if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->mcu_ctr = MCU_col_num; - return FALSE; + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; } } /* Completed an MCU row, but perhaps not an iMCU row */ @@ -372,7 +372,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) LOCAL(void) transencode_coef_controller (j_compress_ptr cinfo, - jvirt_barray_ptr * coef_arrays) + jvirt_barray_ptr * coef_arrays) { my_coef_ptr coef; JBLOCKROW buffer; @@ -380,7 +380,7 @@ transencode_coef_controller (j_compress_ptr cinfo, coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + SIZEOF(my_coef_controller)); cinfo->coef = (struct jpeg_c_coef_controller *) coef; coef->pub.start_pass = start_pass_coef; coef->pub.compress_data = compress_output; @@ -391,7 +391,7 @@ transencode_coef_controller (j_compress_ptr cinfo, /* Allocate and pre-zero space for dummy DCT blocks. */ buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->dummy_buffer[i] = buffer + i; diff --git a/jdapimin.c b/jdapimin.c index cadb59fc..db53fdce 100644 --- a/jdapimin.c +++ b/jdapimin.c @@ -32,12 +32,12 @@ 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 */ + 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); + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set @@ -121,22 +121,22 @@ default_decompress_parms (j_decompress_ptr cinfo) cinfo->jpeg_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE; break; - + case 3: if (cinfo->saw_JFIF_marker) { cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ } else if (cinfo->saw_Adobe_marker) { switch (cinfo->Adobe_transform) { case 0: - cinfo->jpeg_color_space = JCS_RGB; - break; + cinfo->jpeg_color_space = JCS_RGB; + break; case 1: - cinfo->jpeg_color_space = JCS_YCbCr; - break; + cinfo->jpeg_color_space = JCS_YCbCr; + break; default: - WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); - cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ - break; + WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); + cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ + break; } } else { /* Saw no special markers, try to guess from the component IDs */ @@ -145,31 +145,31 @@ default_decompress_parms (j_decompress_ptr cinfo) int cid2 = cinfo->comp_info[2].component_id; if (cid0 == 1 && cid1 == 2 && cid2 == 3) - cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ + cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ else if (cid0 == 82 && cid1 == 71 && cid2 == 66) - cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ + cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ else { - TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); - cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ + TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); + cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ } } /* Always guess RGB is proper output colorspace. */ cinfo->out_color_space = JCS_RGB; break; - + case 4: if (cinfo->saw_Adobe_marker) { switch (cinfo->Adobe_transform) { case 0: - cinfo->jpeg_color_space = JCS_CMYK; - break; + cinfo->jpeg_color_space = JCS_CMYK; + break; case 2: - cinfo->jpeg_color_space = JCS_YCCK; - break; + cinfo->jpeg_color_space = JCS_YCCK; + break; default: - WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); - cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ - break; + WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); + cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ + break; } } else { /* No special markers, assume straight CMYK. */ @@ -177,7 +177,7 @@ default_decompress_parms (j_decompress_ptr cinfo) } cinfo->out_color_space = JCS_CMYK; break; - + default: cinfo->jpeg_color_space = JCS_UNKNOWN; cinfo->out_color_space = JCS_UNKNOWN; @@ -185,7 +185,7 @@ default_decompress_parms (j_decompress_ptr cinfo) } /* Set defaults for other decompression parameters. */ - cinfo->scale_num = 1; /* 1:1 scaling */ + cinfo->scale_num = 1; /* 1:1 scaling */ cinfo->scale_denom = 1; cinfo->output_gamma = 1.0; cinfo->buffered_image = FALSE; @@ -253,7 +253,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) retcode = JPEG_HEADER_OK; break; case JPEG_REACHED_EOI: - if (require_image) /* Complain if application wanted an image */ + if (require_image) /* Complain if application wanted an image */ ERREXIT(cinfo, JERR_NO_IMAGE); /* Reset to start state; it would be safer to require the application to * call jpeg_abort, but we can't change it now for compatibility reasons. @@ -385,7 +385,7 @@ jpeg_finish_decompress (j_decompress_ptr cinfo) /* Read until EOI */ while (! cinfo->inputctl->eoi_reached) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) - return FALSE; /* Suspend, come back later */ + return FALSE; /* Suspend, come back later */ } /* Do final cleanup */ (*cinfo->src->term_source) (cinfo); diff --git a/jdapistd.c b/jdapistd.c index a50fda52..f4ac50d1 100644 --- a/jdapistd.c +++ b/jdapistd.c @@ -55,24 +55,24 @@ jpeg_start_decompress (j_decompress_ptr cinfo) if (cinfo->inputctl->has_multiple_scans) { #ifdef D_MULTISCAN_FILES_SUPPORTED for (;;) { - int retcode; - /* Call progress monitor hook if present */ - if (cinfo->progress != NULL) - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); - /* Absorb some more input */ - retcode = (*cinfo->inputctl->consume_input) (cinfo); - if (retcode == JPEG_SUSPENDED) - return FALSE; - if (retcode == JPEG_REACHED_EOI) - break; - /* Advance progress counter if appropriate */ - if (cinfo->progress != NULL && - (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { - if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { - /* jdmaster underestimated number of scans; ratchet up one scan */ - cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; - } - } + int retcode; + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + /* Absorb some more input */ + retcode = (*cinfo->inputctl->consume_input) (cinfo); + if (retcode == JPEG_SUSPENDED) + return FALSE; + if (retcode == JPEG_REACHED_EOI) + break; + /* Advance progress counter if appropriate */ + if (cinfo->progress != NULL && + (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { + if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { + /* jdmaster underestimated number of scans; ratchet up one scan */ + cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; + } + } } #else ERREXIT(cinfo, JERR_NOT_COMPILED); @@ -111,16 +111,16 @@ output_pass_setup (j_decompress_ptr cinfo) JDIMENSION last_scanline; /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->output_scanline; - cinfo->progress->pass_limit = (long) cinfo->output_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + cinfo->progress->pass_counter = (long) cinfo->output_scanline; + cinfo->progress->pass_limit = (long) cinfo->output_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Process some data */ last_scanline = cinfo->output_scanline; (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, - &cinfo->output_scanline, (JDIMENSION) 0); + &cinfo->output_scanline, (JDIMENSION) 0); if (cinfo->output_scanline == last_scanline) - return FALSE; /* No progress made, must suspend */ + return FALSE; /* No progress made, must suspend */ } /* Finish up dummy pass, and set up for another one */ (*cinfo->master->finish_output_pass) (cinfo); @@ -153,7 +153,7 @@ output_pass_setup (j_decompress_ptr cinfo) GLOBAL(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, - JDIMENSION max_lines) + JDIMENSION max_lines) { JDIMENSION row_ctr; @@ -186,7 +186,7 @@ jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, GLOBAL(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION max_lines) + JDIMENSION max_lines) { JDIMENSION lines_per_iMCU_row; @@ -211,7 +211,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, /* Decompress directly into user's buffer. */ if (! (*cinfo->coef->decompress_data) (cinfo, data)) - return 0; /* suspension forced, can do nothing more */ + return 0; /* suspension forced, can do nothing more */ /* OK, we processed one iMCU row. */ cinfo->output_scanline += lines_per_iMCU_row; @@ -267,9 +267,9 @@ jpeg_finish_output (j_decompress_ptr cinfo) } /* Read markers looking for SOS or EOI */ while (cinfo->input_scan_number <= cinfo->output_scan_number && - ! cinfo->inputctl->eoi_reached) { + ! cinfo->inputctl->eoi_reached) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) - return FALSE; /* Suspend, come back later */ + return FALSE; /* Suspend, come back later */ } cinfo->global_state = DSTATE_BUFIMAGE; return TRUE; diff --git a/jdarith.c b/jdarith.c index d5567339..b945d64d 100644 --- a/jdarith.c +++ b/jdarith.c @@ -32,7 +32,7 @@ typedef struct { int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ int dc_context[MAX_COMPS_IN_SCAN]; /* context index for DC conditioning */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ /* Pointers to statistics areas (these workspaces have image lifespan) */ unsigned char * dc_stats[NUM_ARITH_TBLS]; @@ -115,32 +115,32 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st) if (--e->ct < 0) { /* Need to fetch next data byte */ if (cinfo->unread_marker) - data = 0; /* stuff zero data */ + data = 0; /* stuff zero data */ else { - data = get_byte(cinfo); /* read next input byte */ - if (data == 0xFF) { /* zero stuff or marker code */ - do data = get_byte(cinfo); - while (data == 0xFF); /* swallow extra 0xFF bytes */ - if (data == 0) - data = 0xFF; /* discard stuffed zero byte */ - else { - /* Note: Different from the Huffman decoder, hitting - * a marker while processing the compressed data - * segment is legal in arithmetic coding. - * The convention is to supply zero data - * then until decoding is complete. - */ - cinfo->unread_marker = data; - data = 0; - } - } + data = get_byte(cinfo); /* read next input byte */ + if (data == 0xFF) { /* zero stuff or marker code */ + do data = get_byte(cinfo); + while (data == 0xFF); /* swallow extra 0xFF bytes */ + if (data == 0) + data = 0xFF; /* discard stuffed zero byte */ + else { + /* Note: Different from the Huffman decoder, hitting + * a marker while processing the compressed data + * segment is legal in arithmetic coding. + * The convention is to supply zero data + * then until decoding is complete. + */ + cinfo->unread_marker = data; + data = 0; + } + } } e->c = (e->c << 8) | data; /* insert data into C register */ - if ((e->ct += 8) < 0) /* update bit shift counter */ - /* Need more initial bytes */ - if (++e->ct == 0) - /* Got 2 initial bytes -> re-init A and exit loop */ - e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */ + if ((e->ct += 8) < 0) /* update bit shift counter */ + /* Need more initial bytes */ + if (++e->ct == 0) + /* Got 2 initial bytes -> re-init A and exit loop */ + e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */ } e->a <<= 1; } @@ -149,9 +149,9 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st) * Qe values and probability estimation state machine */ sv = *st; - qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ - nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ - nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ + qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ + nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ + nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ /* Decode & estimation procedures per sections D.2.4 & D.2.5 */ temp = e->a - qe; @@ -162,19 +162,19 @@ arith_decode (j_decompress_ptr cinfo, unsigned char *st) /* Conditional LPS (less probable symbol) exchange */ if (e->a < qe) { e->a = qe; - *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ + *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ } else { e->a = qe; - *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ - sv ^= 0x80; /* Exchange LPS/MPS */ + *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ + sv ^= 0x80; /* Exchange LPS/MPS */ } } else if (e->a < 0x8000L) { /* Conditional MPS (more probable symbol) exchange */ if (e->a < qe) { - *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ - sv ^= 0x80; /* Exchange LPS/MPS */ + *st = (sv & 0x80) ^ nl; /* Estimate_after_LPS */ + sv ^= 0x80; /* Exchange LPS/MPS */ } else { - *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ + *st = (sv & 0x80) ^ nm; /* Estimate_after_MPS */ } } @@ -214,7 +214,7 @@ process_restart (j_decompress_ptr cinfo) /* Reset arithmetic decoding variables */ entropy->c = 0; entropy->a = 0; - entropy->ct = -16; /* force reading 2 initial bytes to fill C */ + entropy->ct = -16; /* force reading 2 initial bytes to fill C */ /* Reset restart counter */ entropy->restarts_to_go = cinfo->restart_interval; @@ -253,7 +253,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - if (entropy->ct == -1) return TRUE; /* if error do nothing */ + if (entropy->ct == -1) return TRUE; /* if error do nothing */ /* Outer loop handles each block in the MCU */ @@ -277,28 +277,28 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) st += 2; st += sign; /* Figure F.23: Decoding the magnitude category of v */ if ((m = arith_decode(cinfo, st)) != 0) { - st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ - while (arith_decode(cinfo, st)) { - if ((m <<= 1) == 0x8000) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* magnitude overflow */ - return TRUE; - } - st += 1; - } + st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ + while (arith_decode(cinfo, st)) { + if ((m <<= 1) == 0x8000) { + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* magnitude overflow */ + return TRUE; + } + st += 1; + } } /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) - entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */ + entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */ else - entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */ + entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */ v = m; /* Figure F.24: Decoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - if (arith_decode(cinfo, st)) v |= m; + if (arith_decode(cinfo, st)) v |= m; v += 1; if (sign) v = -v; entropy->last_dc_val[ci] += v; } @@ -332,7 +332,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - if (entropy->ct == -1) return TRUE; /* if error do nothing */ + if (entropy->ct == -1) return TRUE; /* if error do nothing */ /* There is always only one block per MCU */ block = MCU_data[0]; @@ -343,13 +343,13 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.20: Decode_AC_coefficients */ for (k = cinfo->Ss; k <= cinfo->Se; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); - if (arith_decode(cinfo, st)) break; /* EOB flag */ + if (arith_decode(cinfo, st)) break; /* EOB flag */ while (arith_decode(cinfo, st + 1) == 0) { st += 3; k++; if (k > cinfo->Se) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* spectral overflow */ - return TRUE; + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* spectral overflow */ + return TRUE; } } /* Figure F.21: Decoding nonzero value v */ @@ -359,17 +359,17 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.23: Decoding the magnitude category of v */ if ((m = arith_decode(cinfo, st)) != 0) { if (arith_decode(cinfo, st)) { - m <<= 1; - st = entropy->ac_stats[tbl] + - (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); - while (arith_decode(cinfo, st)) { - if ((m <<= 1) == 0x8000) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* magnitude overflow */ - return TRUE; - } - st += 1; - } + m <<= 1; + st = entropy->ac_stats[tbl] + + (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); + while (arith_decode(cinfo, st)) { + if ((m <<= 1) == 0x8000) { + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* magnitude overflow */ + return TRUE; + } + st += 1; + } } } v = m; @@ -404,8 +404,8 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - st = entropy->fixed_bin; /* use fixed probability estimation */ - p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + st = entropy->fixed_bin; /* use fixed probability estimation */ + p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ /* Outer loop handles each block in the MCU */ @@ -440,14 +440,14 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - if (entropy->ct == -1) return TRUE; /* if error do nothing */ + if (entropy->ct == -1) return TRUE; /* if error do nothing */ /* There is always only one block per MCU */ block = MCU_data[0]; tbl = cinfo->cur_comp_info[0]->ac_tbl_no; - p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ - m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ + p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ /* Establish EOBx (previous stage end-of-block) index */ for (kex = cinfo->Se; kex > 0; kex--) @@ -456,30 +456,30 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) for (k = cinfo->Ss; k <= cinfo->Se; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); if (k > kex) - if (arith_decode(cinfo, st)) break; /* EOB flag */ + if (arith_decode(cinfo, st)) break; /* EOB flag */ for (;;) { thiscoef = *block + jpeg_natural_order[k]; - if (*thiscoef) { /* previously nonzero coef */ - if (arith_decode(cinfo, st + 2)) { - if (*thiscoef < 0) - *thiscoef += m1; - else - *thiscoef += p1; - } - break; + if (*thiscoef) { /* previously nonzero coef */ + if (arith_decode(cinfo, st + 2)) { + if (*thiscoef < 0) + *thiscoef += m1; + else + *thiscoef += p1; + } + break; } - if (arith_decode(cinfo, st + 1)) { /* newly nonzero coef */ - if (arith_decode(cinfo, entropy->fixed_bin)) - *thiscoef = m1; - else - *thiscoef = p1; - break; + if (arith_decode(cinfo, st + 1)) { /* newly nonzero coef */ + if (arith_decode(cinfo, entropy->fixed_bin)) + *thiscoef = m1; + else + *thiscoef = p1; + break; } st += 3; k++; if (k > cinfo->Se) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* spectral overflow */ - return TRUE; + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* spectral overflow */ + return TRUE; } } } @@ -509,7 +509,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) entropy->restarts_to_go--; } - if (entropy->ct == -1) return TRUE; /* if error do nothing */ + if (entropy->ct == -1) return TRUE; /* if error do nothing */ /* Outer loop handles each block in the MCU */ @@ -535,28 +535,28 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) st += 2; st += sign; /* Figure F.23: Decoding the magnitude category of v */ if ((m = arith_decode(cinfo, st)) != 0) { - st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ - while (arith_decode(cinfo, st)) { - if ((m <<= 1) == 0x8000) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* magnitude overflow */ - return TRUE; - } - st += 1; - } + st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */ + while (arith_decode(cinfo, st)) { + if ((m <<= 1) == 0x8000) { + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* magnitude overflow */ + return TRUE; + } + st += 1; + } } /* Section F.1.4.4.1.2: Establish dc_context conditioning category */ if (m < (int) ((1L << cinfo->arith_dc_L[tbl]) >> 1)) - entropy->dc_context[ci] = 0; /* zero diff category */ + entropy->dc_context[ci] = 0; /* zero diff category */ else if (m > (int) ((1L << cinfo->arith_dc_U[tbl]) >> 1)) - entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */ + entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */ else - entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */ + entropy->dc_context[ci] = 4 + (sign * 4); /* small diff category */ v = m; /* Figure F.24: Decoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - if (arith_decode(cinfo, st)) v |= m; + if (arith_decode(cinfo, st)) v |= m; v += 1; if (sign) v = -v; entropy->last_dc_val[ci] += v; } @@ -570,14 +570,14 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Figure F.20: Decode_AC_coefficients */ for (k = 1; k <= DCTSIZE2 - 1; k++) { st = entropy->ac_stats[tbl] + 3 * (k - 1); - if (arith_decode(cinfo, st)) break; /* EOB flag */ + if (arith_decode(cinfo, st)) break; /* EOB flag */ while (arith_decode(cinfo, st + 1) == 0) { - st += 3; k++; - if (k > DCTSIZE2 - 1) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* spectral overflow */ - return TRUE; - } + st += 3; k++; + if (k > DCTSIZE2 - 1) { + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* spectral overflow */ + return TRUE; + } } /* Figure F.21: Decoding nonzero value v */ /* Figure F.22: Decoding the sign of v */ @@ -585,25 +585,25 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) st += 2; /* Figure F.23: Decoding the magnitude category of v */ if ((m = arith_decode(cinfo, st)) != 0) { - if (arith_decode(cinfo, st)) { - m <<= 1; - st = entropy->ac_stats[tbl] + - (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); - while (arith_decode(cinfo, st)) { - if ((m <<= 1) == 0x8000) { - WARNMS(cinfo, JWRN_ARITH_BAD_CODE); - entropy->ct = -1; /* magnitude overflow */ - return TRUE; - } - st += 1; - } - } + if (arith_decode(cinfo, st)) { + m <<= 1; + st = entropy->ac_stats[tbl] + + (k <= cinfo->arith_ac_K[tbl] ? 189 : 217); + while (arith_decode(cinfo, st)) { + if ((m <<= 1) == 0x8000) { + WARNMS(cinfo, JWRN_ARITH_BAD_CODE); + entropy->ct = -1; /* magnitude overflow */ + return TRUE; + } + st += 1; + } + } } v = m; /* Figure F.24: Decoding the magnitude bit pattern of v */ st += 14; while (m >>= 1) - if (arith_decode(cinfo, st)) v |= m; + if (arith_decode(cinfo, st)) v |= m; v += 1; if (sign) v = -v; (*block)[jpeg_natural_order[k]] = (JCOEF) v; } @@ -628,24 +628,24 @@ start_pass (j_decompress_ptr cinfo) /* Validate progressive scan parameters */ if (cinfo->Ss == 0) { if (cinfo->Se != 0) - goto bad; + goto bad; } else { /* need not check Ss/Se < 0 since they came from unsigned bytes */ if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1) - goto bad; + goto bad; /* AC scans may have only one component */ if (cinfo->comps_in_scan != 1) - goto bad; + goto bad; } if (cinfo->Ah != 0) { /* Successive approximation refinement scan: must have Al = Ah-1. */ if (cinfo->Ah-1 != cinfo->Al) - goto bad; + goto bad; } - if (cinfo->Al > 13) { /* need not check for < 0 */ + if (cinfo->Al > 13) { /* need not check for < 0 */ bad: ERREXIT4(cinfo, JERR_BAD_PROGRESSION, - cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); + cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); } /* Update progression status, and verify that scan order is legal. * Note that inter-scan inconsistencies are treated as warnings @@ -655,32 +655,32 @@ start_pass (j_decompress_ptr cinfo) int coefi, cindex = cinfo->cur_comp_info[ci]->component_index; int *coef_bit_ptr = & cinfo->coef_bits[cindex][0]; if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */ - WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); + WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { - int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; - if (cinfo->Ah != expected) - WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); - coef_bit_ptr[coefi] = cinfo->Al; + int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; + if (cinfo->Ah != expected) + WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); + coef_bit_ptr[coefi] = cinfo->Al; } } /* Select MCU decoding routine */ if (cinfo->Ah == 0) { if (cinfo->Ss == 0) - entropy->pub.decode_mcu = decode_mcu_DC_first; + entropy->pub.decode_mcu = decode_mcu_DC_first; else - entropy->pub.decode_mcu = decode_mcu_AC_first; + entropy->pub.decode_mcu = decode_mcu_AC_first; } else { if (cinfo->Ss == 0) - entropy->pub.decode_mcu = decode_mcu_DC_refine; + entropy->pub.decode_mcu = decode_mcu_DC_refine; else - entropy->pub.decode_mcu = decode_mcu_AC_refine; + entropy->pub.decode_mcu = decode_mcu_AC_refine; } } else { /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. * This ought to be an error condition, but we make it a warning. */ if (cinfo->Ss != 0 || cinfo->Ah != 0 || cinfo->Al != 0 || - (cinfo->Se < DCTSIZE2 && cinfo->Se != DCTSIZE2 - 1)) + (cinfo->Se < DCTSIZE2 && cinfo->Se != DCTSIZE2 - 1)) WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); /* Select MCU decoding routine */ entropy->pub.decode_mcu = decode_mcu; @@ -692,10 +692,10 @@ start_pass (j_decompress_ptr cinfo) if (! cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) { tbl = compptr->dc_tbl_no; if (tbl < 0 || tbl >= NUM_ARITH_TBLS) - ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); + ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); if (entropy->dc_stats[tbl] == NULL) - entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS); + entropy->dc_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, DC_STAT_BINS); MEMZERO(entropy->dc_stats[tbl], DC_STAT_BINS); /* Initialize DC predictions to 0 */ entropy->last_dc_val[ci] = 0; @@ -704,10 +704,10 @@ start_pass (j_decompress_ptr cinfo) if (! cinfo->progressive_mode || cinfo->Ss) { tbl = compptr->ac_tbl_no; if (tbl < 0 || tbl >= NUM_ARITH_TBLS) - ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); + ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl); if (entropy->ac_stats[tbl] == NULL) - entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS); + entropy->ac_stats[tbl] = (unsigned char *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, AC_STAT_BINS); MEMZERO(entropy->ac_stats[tbl], AC_STAT_BINS); } } @@ -715,7 +715,7 @@ start_pass (j_decompress_ptr cinfo) /* Initialize arithmetic decoding variables */ entropy->c = 0; entropy->a = 0; - entropy->ct = -16; /* force reading 2 initial bytes to fill C */ + entropy->ct = -16; /* force reading 2 initial bytes to fill C */ /* Initialize restart counter */ entropy->restarts_to_go = cinfo->restart_interval; @@ -734,7 +734,7 @@ jinit_arith_decoder (j_decompress_ptr cinfo) entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(arith_entropy_decoder)); + SIZEOF(arith_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass; @@ -752,10 +752,10 @@ jinit_arith_decoder (j_decompress_ptr cinfo) int *coef_bit_ptr, ci; cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components*DCTSIZE2*SIZEOF(int)); + cinfo->num_components*DCTSIZE2*SIZEOF(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) - *coef_bit_ptr++ = -1; + *coef_bit_ptr++ = -1; } } diff --git a/jdatadst-tj.c b/jdatadst-tj.c index a8bf2401..95d98235 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -22,13 +22,13 @@ #include "jpeglib.h" #include "jerror.h" -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ +#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ extern void * malloc JPP((size_t size)); extern void free JPP((void *ptr)); #endif -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ +#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ /* Expanded data destination object for memory output */ @@ -36,10 +36,10 @@ extern void free JPP((void *ptr)); typedef struct { struct jpeg_destination_mgr pub; /* public fields */ - unsigned char ** outbuffer; /* target buffer */ + unsigned char ** outbuffer; /* target buffer */ unsigned long * outsize; - unsigned char * newbuffer; /* newly allocated buffer */ - JOCTET * buffer; /* start of buffer */ + unsigned char * newbuffer; /* newly allocated buffer */ + JOCTET * buffer; /* start of buffer */ size_t bufsize; boolean alloc; } my_mem_destination_mgr; @@ -147,21 +147,21 @@ term_mem_destination (j_compress_ptr cinfo) GLOBAL(void) jpeg_mem_dest_tj (j_compress_ptr cinfo, - unsigned char ** outbuffer, unsigned long * outsize, - boolean alloc) + unsigned char ** outbuffer, unsigned long * outsize, + boolean alloc) { my_mem_dest_ptr dest; - if (outbuffer == NULL || outsize == NULL) /* sanity check */ + if (outbuffer == NULL || outsize == NULL) /* sanity check */ ERREXIT(cinfo, JERR_BUFFER_SIZE); /* The destination object is made permanent so that multiple JPEG images * can be written to the same buffer without re-executing jpeg_mem_dest. */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_mem_destination_mgr)); + SIZEOF(my_mem_destination_mgr)); dest = (my_mem_dest_ptr) cinfo->dest; dest->newbuffer = NULL; } diff --git a/jdatadst.c b/jdatadst.c index 1b89fabe..3fbc449b 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -22,7 +22,7 @@ #include "jpeglib.h" #include "jerror.h" -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ +#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ extern void * malloc JPP((size_t size)); extern void free JPP((void *ptr)); #endif @@ -33,13 +33,13 @@ extern void free JPP((void *ptr)); typedef struct { struct jpeg_destination_mgr pub; /* public fields */ - FILE * outfile; /* target stream */ - JOCTET * buffer; /* start of buffer */ + FILE * outfile; /* target stream */ + JOCTET * buffer; /* start of buffer */ } my_destination_mgr; typedef my_destination_mgr * my_dest_ptr; -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ +#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) @@ -48,10 +48,10 @@ typedef my_destination_mgr * my_dest_ptr; typedef struct { struct jpeg_destination_mgr pub; /* public fields */ - unsigned char ** outbuffer; /* target buffer */ + unsigned char ** outbuffer; /* target buffer */ unsigned long * outsize; - unsigned char * newbuffer; /* newly allocated buffer */ - JOCTET * buffer; /* start of buffer */ + unsigned char * newbuffer; /* newly allocated buffer */ + JOCTET * buffer; /* start of buffer */ size_t bufsize; } my_mem_destination_mgr; @@ -72,7 +72,7 @@ init_destination (j_compress_ptr cinfo) /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); + OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; @@ -213,10 +213,10 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) * manager serially with the same JPEG object, because their private object * sizes may be different. Caveat programmer. */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_destination_mgr)); + SIZEOF(my_destination_mgr)); } dest = (my_dest_ptr) cinfo->dest; @@ -241,20 +241,20 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) GLOBAL(void) jpeg_mem_dest (j_compress_ptr cinfo, - unsigned char ** outbuffer, unsigned long * outsize) + unsigned char ** outbuffer, unsigned long * outsize) { my_mem_dest_ptr dest; - if (outbuffer == NULL || outsize == NULL) /* sanity check */ + if (outbuffer == NULL || outsize == NULL) /* sanity check */ ERREXIT(cinfo, JERR_BUFFER_SIZE); /* The destination object is made permanent so that multiple JPEG images * can be written to the same buffer without re-executing jpeg_mem_dest. */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_mem_destination_mgr)); + SIZEOF(my_mem_destination_mgr)); } dest = (my_mem_dest_ptr) cinfo->dest; diff --git a/jdatasrc-tj.c b/jdatasrc-tj.c index 259c6de9..f023a8bf 100644 --- a/jdatasrc-tj.c +++ b/jdatasrc-tj.c @@ -157,21 +157,21 @@ term_source (j_decompress_ptr cinfo) GLOBAL(void) jpeg_mem_src_tj (j_decompress_ptr cinfo, - unsigned char * inbuffer, unsigned long insize) + unsigned char * inbuffer, unsigned long insize) { struct jpeg_source_mgr * src; - if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ + if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); /* The source object is made permanent so that a series of JPEG images * can be read from the same buffer by calling jpeg_mem_src only before * the first one. */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ + if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(struct jpeg_source_mgr)); + SIZEOF(struct jpeg_source_mgr)); } src = cinfo->src; diff --git a/jdatasrc.c b/jdatasrc.c index 1e9c8ad2..5b4c17df 100644 --- a/jdatasrc.c +++ b/jdatasrc.c @@ -26,16 +26,16 @@ /* Expanded data source object for stdio input */ typedef struct { - struct jpeg_source_mgr pub; /* public fields */ + struct jpeg_source_mgr pub; /* public fields */ - FILE * infile; /* source stream */ - JOCTET * buffer; /* start of buffer */ - boolean start_of_file; /* have we gotten any data yet? */ + FILE * infile; /* source stream */ + JOCTET * buffer; /* start of buffer */ + boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; -#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ +#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ /* @@ -106,7 +106,7 @@ fill_input_buffer (j_decompress_ptr cinfo) nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); if (nbytes <= 0) { - if (src->start_of_file) /* Treat empty input file as fatal error */ + if (src->start_of_file) /* Treat empty input file as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); WARNMS(cinfo, JWRN_JPEG_EOF); /* Insert a fake EOI marker */ @@ -224,14 +224,14 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ + if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_source_mgr)); + SIZEOF(my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - INPUT_BUF_SIZE * SIZEOF(JOCTET)); + INPUT_BUF_SIZE * SIZEOF(JOCTET)); } src = (my_src_ptr) cinfo->src; @@ -254,21 +254,21 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) GLOBAL(void) jpeg_mem_src (j_decompress_ptr cinfo, - unsigned char * inbuffer, unsigned long insize) + unsigned char * inbuffer, unsigned long insize) { struct jpeg_source_mgr * src; - if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ + if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); /* The source object is made permanent so that a series of JPEG images * can be read from the same buffer by calling jpeg_mem_src only before * the first one. */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ + if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(struct jpeg_source_mgr)); + SIZEOF(struct jpeg_source_mgr)); } src = cinfo->src; diff --git a/jdcoefct.c b/jdcoefct.c index d38db6c3..1d18a744 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -33,9 +33,9 @@ typedef struct { /* These variables keep track of the current location of the input side. */ /* cinfo->input_iMCU_row is also used for this. */ - JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ - int MCU_vert_offset; /* counts MCU rows within iMCU row */ - int MCU_rows_per_iMCU_row; /* number of such rows needed */ + JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* The output side's location is represented by cinfo->output_iMCU_row. */ @@ -61,7 +61,7 @@ typedef struct { #ifdef BLOCK_SMOOTHING_SUPPORTED /* When doing block smoothing, we latch coefficient Al values here */ int * coef_bits_latch; -#define SAVED_COEFS 6 /* we save coef_bits[0..5] */ +#define SAVED_COEFS 6 /* we save coef_bits[0..5] */ #endif } my_coef_controller; @@ -69,15 +69,15 @@ typedef my_coef_controller * my_coef_ptr; /* Forward declarations */ METHODDEF(int) decompress_onepass - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #ifdef D_MULTISCAN_FILES_SUPPORTED METHODDEF(int) decompress_data - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + 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 - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); #endif @@ -153,7 +153,7 @@ METHODDEF(int) decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int blkn, ci, xindex, yindex, yoffset, useful_width; @@ -166,49 +166,49 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; - MCU_col_num++) { + MCU_col_num++) { /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ jzero_far((void FAR *) coef->MCU_buffer[0], - (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); + (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->MCU_ctr = MCU_col_num; - return JPEG_SUSPENDED; + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->MCU_ctr = MCU_col_num; + return JPEG_SUSPENDED; } /* Determine where data should go in output_buf and do the IDCT thing. * We skip dummy blocks at the right and bottom edges (but blkn gets * incremented past them!). Note the inner loop relies on having * allocated the MCU_buffer[] blocks sequentially. */ - blkn = 0; /* index of current DCT block within MCU */ + blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - /* Don't bother to IDCT an uninteresting component. */ - if (! compptr->component_needed) { - blkn += compptr->MCU_blocks; - continue; - } - inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; - useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width - : compptr->last_col_width; - output_ptr = output_buf[compptr->component_index] + - yoffset * compptr->_DCT_scaled_size; - start_col = MCU_col_num * compptr->MCU_sample_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - if (cinfo->input_iMCU_row < last_iMCU_row || - yoffset+yindex < compptr->last_row_height) { - output_col = start_col; - for (xindex = 0; xindex < useful_width; xindex++) { - (*inverse_DCT) (cinfo, compptr, - (JCOEFPTR) coef->MCU_buffer[blkn+xindex], - output_ptr, output_col); - output_col += compptr->_DCT_scaled_size; - } - } - blkn += compptr->MCU_width; - output_ptr += compptr->_DCT_scaled_size; - } + compptr = cinfo->cur_comp_info[ci]; + /* Don't bother to IDCT an uninteresting component. */ + if (! compptr->component_needed) { + blkn += compptr->MCU_blocks; + continue; + } + inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; + useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + output_ptr = output_buf[compptr->component_index] + + yoffset * compptr->_DCT_scaled_size; + start_col = MCU_col_num * compptr->MCU_sample_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (cinfo->input_iMCU_row < last_iMCU_row || + yoffset+yindex < compptr->last_row_height) { + output_col = start_col; + for (xindex = 0; xindex < useful_width; xindex++) { + (*inverse_DCT) (cinfo, compptr, + (JCOEFPTR) coef->MCU_buffer[blkn+xindex], + output_ptr, output_col); + output_col += compptr->_DCT_scaled_size; + } + } + blkn += compptr->MCU_width; + output_ptr += compptr->_DCT_scaled_size; + } } } /* Completed an MCU row, but perhaps not an iMCU row */ @@ -233,7 +233,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) METHODDEF(int) dummy_consume_data (j_decompress_ptr cinfo) { - return JPEG_SUSPENDED; /* Always indicate nothing was done */ + return JPEG_SUSPENDED; /* Always indicate nothing was done */ } @@ -250,7 +250,7 @@ METHODDEF(int) consume_data (j_decompress_ptr cinfo) { my_coef_ptr coef = (my_coef_ptr) cinfo->coef; - JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION MCU_col_num; /* index of current MCU within row */ int blkn, ci, xindex, yindex, yoffset; JDIMENSION start_col; JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; @@ -274,25 +274,25 @@ consume_data (j_decompress_ptr cinfo) for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; yoffset++) { for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; - MCU_col_num++) { + MCU_col_num++) { /* Construct list of pointers to DCT blocks belonging to this MCU */ - blkn = 0; /* index of current DCT block within MCU */ + blkn = 0; /* index of current DCT block within MCU */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) { - compptr = cinfo->cur_comp_info[ci]; - start_col = MCU_col_num * compptr->MCU_width; - for (yindex = 0; yindex < compptr->MCU_height; yindex++) { - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; - for (xindex = 0; xindex < compptr->MCU_width; xindex++) { - coef->MCU_buffer[blkn++] = buffer_ptr++; - } - } + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < compptr->MCU_width; xindex++) { + coef->MCU_buffer[blkn++] = buffer_ptr++; + } + } } /* Try to fetch the MCU. */ if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { - /* Suspension forced; update state counters and exit */ - coef->MCU_vert_offset = yoffset; - coef->MCU_ctr = MCU_col_num; - return JPEG_SUSPENDED; + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->MCU_ctr = MCU_col_num; + return JPEG_SUSPENDED; } } /* Completed an MCU row, but perhaps not an iMCU row */ @@ -333,8 +333,8 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number < cinfo->output_scan_number || - (cinfo->input_scan_number == cinfo->output_scan_number && - cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { + (cinfo->input_scan_number == cinfo->output_scan_number && + cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED; } @@ -365,10 +365,10 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) buffer_ptr = buffer[block_row]; output_col = 0; for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { - (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, - output_ptr, output_col); - buffer_ptr++; - output_col += compptr->_DCT_scaled_size; + (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, + output_ptr, output_col); + buffer_ptr++; + output_col += compptr->_DCT_scaled_size; } output_ptr += compptr->_DCT_scaled_size; } @@ -425,8 +425,8 @@ smoothing_ok (j_decompress_ptr cinfo) if (coef->coef_bits_latch == NULL) coef->coef_bits_latch = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * - (SAVED_COEFS * SIZEOF(int))); + cinfo->num_components * + (SAVED_COEFS * SIZEOF(int))); coef_bits_latch = coef->coef_bits_latch; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; @@ -436,11 +436,11 @@ smoothing_ok (j_decompress_ptr cinfo) return FALSE; /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ 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) + 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]; @@ -450,7 +450,7 @@ smoothing_ok (j_decompress_ptr cinfo) for (coefi = 1; coefi <= 5; coefi++) { coef_bits_latch[coefi] = coef_bits[coefi]; if (coef_bits[coefi] != 0) - smoothing_useful = TRUE; + smoothing_useful = TRUE; } coef_bits_latch += SAVED_COEFS; } @@ -489,7 +489,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) /* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number <= cinfo->output_scan_number && - ! cinfo->inputctl->eoi_reached) { + ! cinfo->inputctl->eoi_reached) { if (cinfo->input_scan_number == cinfo->output_scan_number) { /* If input is working on current scan, we ordinarily want it to * have completed the current row. But if input scan is DC, @@ -498,7 +498,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) */ JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) - break; + break; } if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED; @@ -526,15 +526,15 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) if (cinfo->output_iMCU_row > 0) { access_rows += compptr->v_samp_factor; /* prior iMCU row too */ buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, - (JDIMENSION) access_rows, FALSE); - buffer += compptr->v_samp_factor; /* point to current iMCU row */ + ((j_common_ptr) cinfo, coef->whole_image[ci], + (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, + (JDIMENSION) access_rows, FALSE); + buffer += compptr->v_samp_factor; /* point to current iMCU row */ first_row = FALSE; } else { buffer = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[ci], - (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); + ((j_common_ptr) cinfo, coef->whole_image[ci], + (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); first_row = TRUE; } /* Fetch component-dependent info */ @@ -552,13 +552,13 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) for (block_row = 0; block_row < block_rows; block_row++) { buffer_ptr = buffer[block_row]; if (first_row && block_row == 0) - prev_block_row = buffer_ptr; + prev_block_row = buffer_ptr; else - prev_block_row = buffer[block_row-1]; + prev_block_row = buffer[block_row-1]; if (last_row && block_row == block_rows-1) - next_block_row = buffer_ptr; + next_block_row = buffer_ptr; else - next_block_row = buffer[block_row+1]; + next_block_row = buffer[block_row+1]; /* We fetch the surrounding DC values using a sliding-register approach. * Initialize all nine here so as to do the right thing on narrow pics. */ @@ -568,102 +568,102 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) output_col = 0; last_block_column = compptr->width_in_blocks - 1; for (block_num = 0; block_num <= last_block_column; block_num++) { - /* Fetch current DCT block into workspace so we can modify it. */ - jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); - /* Update DC values */ - if (block_num < last_block_column) { - DC3 = (int) prev_block_row[1][0]; - DC6 = (int) buffer_ptr[1][0]; - DC9 = (int) next_block_row[1][0]; - } - /* Compute coefficient estimates per K.8. - * An estimate is applied only if coefficient is still zero, - * and is not known to be fully accurate. - */ - /* AC01 */ - if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { - num = 36 * Q00 * (DC4 - DC6); - if (num >= 0) { - pred = (int) (((Q01<<7) + num) / (Q01<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q10<<7) + num) / (Q10<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q20<<7) + num) / (Q20<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q11<<7) + num) / (Q11<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { - pred = (int) (((Q02<<7) + num) / (Q02<<8)); - if (Al > 0 && pred >= (1< 0 && pred >= (1<_DCT_scaled_size; + /* Fetch current DCT block into workspace so we can modify it. */ + jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); + /* Update DC values */ + if (block_num < last_block_column) { + DC3 = (int) prev_block_row[1][0]; + DC6 = (int) buffer_ptr[1][0]; + DC9 = (int) next_block_row[1][0]; + } + /* Compute coefficient estimates per K.8. + * An estimate is applied only if coefficient is still zero, + * and is not known to be fully accurate. + */ + /* AC01 */ + if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { + num = 36 * Q00 * (DC4 - DC6); + if (num >= 0) { + pred = (int) (((Q01<<7) + num) / (Q01<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q10<<7) + num) / (Q10<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q20<<7) + num) / (Q20<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q11<<7) + num) / (Q11<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q02<<7) + num) / (Q02<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<_DCT_scaled_size; } output_ptr += compptr->_DCT_scaled_size; } @@ -688,7 +688,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + SIZEOF(my_coef_controller)); cinfo->coef = (struct jpeg_d_coef_controller *) coef; coef->pub.start_input_pass = start_input_pass; coef->pub.start_output_pass = start_output_pass; @@ -706,20 +706,20 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) jpeg_component_info *compptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { access_rows = compptr->v_samp_factor; #ifdef BLOCK_SMOOTHING_SUPPORTED /* If block smoothing could be used, need a bigger window */ if (cinfo->progressive_mode) - access_rows *= 3; + access_rows *= 3; #endif coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, - (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, - (long) compptr->v_samp_factor), - (JDIMENSION) access_rows); + ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) access_rows); } coef->pub.consume_data = consume_data; coef->pub.decompress_data = decompress_data; @@ -734,7 +734,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } diff --git a/jdcolext.c b/jdcolext.c index 6e9e31a9..f72cab0c 100644 --- a/jdcolext.c +++ b/jdcolext.c @@ -58,8 +58,8 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo, /* Range-limiting is essential due to noise introduced by DCT losses. */ outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; outptr[RGB_GREEN] = range_limit[y + - ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], - SCALEBITS))]; + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; /* Set unused byte to 0xFF so it can be interpreted as an opaque */ /* alpha channel value */ diff --git a/jdcolor.c b/jdcolor.c index 458addac..8dae08df 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -25,13 +25,13 @@ typedef struct { struct jpeg_color_deconverter pub; /* public fields */ /* Private state for YCC->RGB conversion */ - int * Cr_r_tab; /* => table for Cr to R conversion */ - int * Cb_b_tab; /* => table for Cb to B conversion */ - INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + int * Cr_r_tab; /* => table for Cr to R conversion */ + int * Cb_b_tab; /* => table for Cb to B conversion */ + INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + INT32 * Cb_g_tab; /* => table for Cb to G conversion */ /* Private state for RGB->Y conversion */ - INT32 * rgb_y_tab; /* => table for RGB to Y conversion */ + INT32 * rgb_y_tab; /* => table for RGB to Y conversion */ } my_color_deconverter; typedef my_color_deconverter * my_cconvert_ptr; @@ -45,11 +45,11 @@ typedef my_color_deconverter * my_cconvert_ptr; * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore * - * R = Y + 1.40200 * Cr - * G = Y - 0.34414 * Cb - 0.71414 * Cr - * B = Y + 1.77200 * Cb + * R = Y + 1.40200 * Cr + * G = Y - 0.34414 * Cb - 0.71414 * Cr + * B = Y + 1.77200 * Cb * - * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * * where Cb and Cr represent the incoming values less CENTERJSAMPLE. * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) @@ -71,9 +71,9 @@ typedef my_color_deconverter * my_cconvert_ptr; * together before rounding. */ -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L<Y conversion and divide it up into * three parts, instead of doing three alloc_small requests. This lets us @@ -82,10 +82,10 @@ typedef my_color_deconverter * my_cconvert_ptr; * anyway). */ -#define R_Y_OFF 0 /* offset to R => Y section */ -#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ -#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ -#define TABLE_SIZE (3*(MAXJSAMPLE+1)) +#define R_Y_OFF 0 /* offset to R => Y section */ +#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ +#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ +#define TABLE_SIZE (3*(MAXJSAMPLE+1)) /* Include inline routines for colorspace extensions */ @@ -215,26 +215,26 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * SIZEOF(int)); cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * SIZEOF(int)); cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(INT32)); cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.40200 * x */ cconvert->Cr_r_tab[i] = (int) - RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); + RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); /* Cb=>B value is nearest int to 1.77200 * x */ cconvert->Cb_b_tab[i] = (int) - RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); + RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); /* Cr=>G value is scaled-up -0.71414 * x */ cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x; /* Cb=>G value is scaled-up -0.34414 * x */ @@ -250,8 +250,8 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) METHODDEF(void) ycc_rgb_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { switch (cinfo->out_color_space) { case JCS_EXT_RGB: @@ -307,7 +307,7 @@ build_rgb_y_table (j_decompress_ptr cinfo) /* Allocate and fill in the conversion tables. */ cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(INT32))); + (TABLE_SIZE * SIZEOF(INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_y_tab[i+R_Y_OFF] = FIX(0.29900) * i; @@ -323,8 +323,8 @@ build_rgb_y_table (j_decompress_ptr cinfo) METHODDEF(void) rgb_gray_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; @@ -346,8 +346,8 @@ rgb_gray_convert (j_decompress_ptr cinfo, b = GETJSAMPLE(inptr2[col]); /* Y */ outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); } } } @@ -360,8 +360,8 @@ rgb_gray_convert (j_decompress_ptr cinfo, METHODDEF(void) null_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { register JSAMPROW inptr, outptr; register JDIMENSION count; @@ -374,8 +374,8 @@ null_convert (j_decompress_ptr cinfo, inptr = input_buf[ci][input_row]; outptr = output_buf[0] + ci; for (count = num_cols; count > 0; count--) { - *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ - outptr += num_components; + *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ + outptr += num_components; } } input_row++; @@ -392,11 +392,11 @@ null_convert (j_decompress_ptr cinfo, METHODDEF(void) grayscale_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, - num_rows, cinfo->output_width); + num_rows, cinfo->output_width); } @@ -406,8 +406,8 @@ grayscale_convert (j_decompress_ptr cinfo, METHODDEF(void) gray_rgb_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { switch (cinfo->out_color_space) { case JCS_EXT_RGB: @@ -452,8 +452,8 @@ gray_rgb_convert (j_decompress_ptr cinfo, METHODDEF(void) rgb_rgb_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { switch (cinfo->out_color_space) { case JCS_EXT_RGB: @@ -501,8 +501,8 @@ rgb_rgb_convert (j_decompress_ptr cinfo, METHODDEF(void) ycck_cmyk_convert (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows) + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int y, cb, cr; @@ -530,13 +530,13 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, cb = GETJSAMPLE(inptr1[col]); cr = GETJSAMPLE(inptr2[col]); /* Range-limiting is essential due to noise introduced by DCT losses. */ - outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ - outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ - ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], - SCALEBITS)))]; - outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */ + outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ + outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)))]; + outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */ /* K passes through unchanged */ - outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */ + outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */ outptr += 4; } } @@ -566,7 +566,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_deconverter)); + SIZEOF(my_color_deconverter)); cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; cconvert->pub.start_pass = start_pass_dcolor; @@ -589,7 +589,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; - default: /* JCS_UNKNOWN can be anything */ + default: /* JCS_UNKNOWN can be anything */ if (cinfo->num_components < 1) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); break; @@ -604,11 +604,11 @@ jinit_color_deconverter (j_decompress_ptr cinfo) case JCS_GRAYSCALE: cinfo->out_color_components = 1; if (cinfo->jpeg_color_space == JCS_GRAYSCALE || - cinfo->jpeg_color_space == JCS_YCbCr) { + cinfo->jpeg_color_space == JCS_YCbCr) { cconvert->pub.color_convert = grayscale_convert; /* For color->grayscale conversion, only the Y (0) component is needed */ for (ci = 1; ci < cinfo->num_components; ci++) - cinfo->comp_info[ci].component_needed = FALSE; + cinfo->comp_info[ci].component_needed = FALSE; } else if (cinfo->jpeg_color_space == JCS_RGB) { cconvert->pub.color_convert = rgb_gray_convert; build_rgb_y_table(cinfo); @@ -665,7 +665,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) if (cinfo->out_color_space == cinfo->jpeg_color_space) { cinfo->out_color_components = cinfo->num_components; cconvert->pub.color_convert = null_convert; - } else /* unsupported non-null conversion */ + } else /* unsupported non-null conversion */ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; } diff --git a/jdct.h b/jdct.h index 36374484..310f2ca5 100644 --- a/jdct.h +++ b/jdct.h @@ -8,7 +8,7 @@ * This include file contains common declarations for the forward and * inverse DCT modules. These declarations are private to the DCT managers * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. - * The individual DCT algorithms are kept in separate files to ease + * The individual DCT algorithms are kept in separate files to ease * machine-dependent tuning (e.g., assembly coding). */ @@ -29,7 +29,7 @@ #if BITS_IN_JSAMPLE == 8 #ifndef WITH_SIMD -typedef int DCTELEM; /* 16 or 32 bits is fine */ +typedef int DCTELEM; /* 16 or 32 bits is fine */ typedef unsigned int UDCTELEM; typedef unsigned long long UDCTELEM2; #else @@ -38,7 +38,7 @@ typedef unsigned short UDCTELEM; typedef unsigned int UDCTELEM2; #endif #else -typedef INT32 DCTELEM; /* must have 32 bits */ +typedef INT32 DCTELEM; /* must have 32 bits */ typedef UINT32 UDCTELEM; typedef unsigned long long UDCTELEM2; #endif @@ -64,10 +64,10 @@ typedef unsigned long long UDCTELEM2; typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ #if BITS_IN_JSAMPLE == 8 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ -#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ +#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ #else -typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ -#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ +typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ +#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ #endif typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ @@ -89,27 +89,27 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_fdct_islow jFDislow -#define jpeg_fdct_ifast jFDifast -#define jpeg_fdct_float jFDfloat -#define jpeg_idct_islow jRDislow -#define jpeg_idct_ifast jRDifast -#define jpeg_idct_float jRDfloat -#define jpeg_idct_7x7 jRD7x7 -#define jpeg_idct_6x6 jRD6x6 -#define jpeg_idct_5x5 jRD5x5 -#define jpeg_idct_4x4 jRD4x4 -#define jpeg_idct_3x3 jRD3x3 -#define jpeg_idct_2x2 jRD2x2 -#define jpeg_idct_1x1 jRD1x1 -#define jpeg_idct_9x9 jRD9x9 -#define jpeg_idct_10x10 jRD10x10 -#define jpeg_idct_11x11 jRD11x11 -#define jpeg_idct_12x12 jRD12x12 -#define jpeg_idct_13x13 jRD13x13 -#define jpeg_idct_14x14 jRD14x14 -#define jpeg_idct_15x15 jRD15x15 -#define jpeg_idct_16x16 jRD16x16 +#define jpeg_fdct_islow jFDislow +#define jpeg_fdct_ifast jFDifast +#define jpeg_fdct_float jFDfloat +#define jpeg_idct_islow jRDislow +#define jpeg_idct_ifast jRDifast +#define jpeg_idct_float jRDfloat +#define jpeg_idct_7x7 jRD7x7 +#define jpeg_idct_6x6 jRD6x6 +#define jpeg_idct_5x5 jRD5x5 +#define jpeg_idct_4x4 jRD4x4 +#define jpeg_idct_3x3 jRD3x3 +#define jpeg_idct_2x2 jRD2x2 +#define jpeg_idct_1x1 jRD1x1 +#define jpeg_idct_9x9 jRD9x9 +#define jpeg_idct_10x10 jRD10x10 +#define jpeg_idct_11x11 jRD11x11 +#define jpeg_idct_12x12 jRD12x12 +#define jpeg_idct_13x13 jRD13x13 +#define jpeg_idct_14x14 jRD14x14 +#define jpeg_idct_15x15 jRD15x15 +#define jpeg_idct_16x16 jRD16x16 #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Extern declarations for the forward and inverse DCT routines. */ @@ -120,58 +120,58 @@ EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); EXTERN(void) jpeg_idct_islow JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_ifast JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_float JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_7x7 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_6x6 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_5x5 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_4x4 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_3x3 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_2x2 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_1x1 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_9x9 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_10x10 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_11x11 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_12x12 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_13x13 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_14x14 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_15x15 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); EXTERN(void) jpeg_idct_16x16 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); /* @@ -184,7 +184,7 @@ EXTERN(void) jpeg_idct_16x16 * and may differ from one module to the next. */ -#define ONE ((INT32) 1) +#define ONE ((INT32) 1) #define CONST_SCALE (ONE << CONST_BITS) /* Convert a positive real constant to an integer scaled by CONST_SCALE. @@ -192,7 +192,7 @@ EXTERN(void) jpeg_idct_16x16 * thus causing a lot of useless floating-point operations at run time. */ -#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) +#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) /* Descale and correctly round an INT32 value that's scaled by N bits. * We assume RIGHT_SHIFT rounds towards minus infinity, so adding @@ -210,23 +210,23 @@ EXTERN(void) jpeg_idct_16x16 * correct combination of casts. */ -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) #endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ +#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const))) #endif -#ifndef MULTIPLY16C16 /* default definition */ +#ifndef MULTIPLY16C16 /* default definition */ #define MULTIPLY16C16(var,const) ((var) * (const)) #endif /* Same except both inputs are variables. */ -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) #endif -#ifndef MULTIPLY16V16 /* default definition */ +#ifndef MULTIPLY16V16 /* default definition */ #define MULTIPLY16V16(var1,var2) ((var1) * (var2)) #endif diff --git a/jddctmgr.c b/jddctmgr.c index 88b47073..bcc4f556 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -22,7 +22,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #include "jsimddct.h" #include "jpegcomp.h" @@ -47,7 +47,7 @@ /* Private subobject for this module */ typedef struct { - struct jpeg_inverse_dct pub; /* public fields */ + struct jpeg_inverse_dct pub; /* public fields */ /* This array contains the IDCT method code that each multiplier table * is currently set up for, or -1 if it's not yet set up. @@ -108,29 +108,29 @@ start_pass (j_decompress_ptr cinfo) #ifdef IDCT_SCALING_SUPPORTED case 1: method_ptr = jpeg_idct_1x1; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ + method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 2: if (jsimd_can_idct_2x2()) method_ptr = jsimd_idct_2x2; else method_ptr = jpeg_idct_2x2; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ + method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 3: method_ptr = jpeg_idct_3x3; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 4: if (jsimd_can_idct_4x4()) method_ptr = jsimd_idct_4x4; else method_ptr = jpeg_idct_4x4; - method = JDCT_ISLOW; /* jidctred uses islow-style table */ + method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 5: method_ptr = jpeg_idct_5x5; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 6: #if defined(__mips__) @@ -139,58 +139,58 @@ start_pass (j_decompress_ptr cinfo) else #endif method_ptr = jpeg_idct_6x6; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 7: method_ptr = jpeg_idct_7x7; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; #endif case DCTSIZE: switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: - if (jsimd_can_idct_islow()) - method_ptr = jsimd_idct_islow; - else - method_ptr = jpeg_idct_islow; - method = JDCT_ISLOW; - break; + if (jsimd_can_idct_islow()) + method_ptr = jsimd_idct_islow; + else + method_ptr = jpeg_idct_islow; + method = JDCT_ISLOW; + break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: - if (jsimd_can_idct_ifast()) - method_ptr = jsimd_idct_ifast; - else - method_ptr = jpeg_idct_ifast; - method = JDCT_IFAST; - break; + if (jsimd_can_idct_ifast()) + method_ptr = jsimd_idct_ifast; + else + method_ptr = jpeg_idct_ifast; + method = JDCT_IFAST; + break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: - if (jsimd_can_idct_float()) - method_ptr = jsimd_idct_float; - else - method_ptr = jpeg_idct_float; - method = JDCT_FLOAT; - break; + if (jsimd_can_idct_float()) + method_ptr = jsimd_idct_float; + else + method_ptr = jpeg_idct_float; + method = JDCT_FLOAT; + break; #endif default: - ERREXIT(cinfo, JERR_NOT_COMPILED); - break; + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; } break; case 9: method_ptr = jpeg_idct_9x9; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 10: method_ptr = jpeg_idct_10x10; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 11: method_ptr = jpeg_idct_11x11; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 12: #if defined(__mips__) @@ -199,23 +199,23 @@ start_pass (j_decompress_ptr cinfo) else #endif method_ptr = jpeg_idct_12x12; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 13: method_ptr = jpeg_idct_13x13; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 14: method_ptr = jpeg_idct_14x14; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 15: method_ptr = jpeg_idct_15x15; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; case 16: method_ptr = jpeg_idct_16x16; - method = JDCT_ISLOW; /* jidctint uses islow-style table */ + method = JDCT_ISLOW; /* jidctint uses islow-style table */ break; default: ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size); @@ -232,81 +232,81 @@ start_pass (j_decompress_ptr cinfo) if (! compptr->component_needed || idct->cur_method[ci] == method) continue; qtbl = compptr->quant_table; - if (qtbl == NULL) /* happens if no data yet for component */ + if (qtbl == NULL) /* happens if no data yet for component */ continue; idct->cur_method[ci] = method; switch (method) { #ifdef PROVIDE_ISLOW_TABLES case JDCT_ISLOW: { - /* For LL&M IDCT method, multipliers are equal to raw quantization - * 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[i]; - } + /* For LL&M IDCT method, multipliers are equal to raw quantization + * 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[i]; + } } break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: { - /* For AA&N IDCT method, multipliers are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * 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. - */ - IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; + /* For AA&N IDCT method, multipliers are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * 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. + */ + IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; #define CONST_BITS 14 - static const INT16 aanscales[DCTSIZE2] = { - /* 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, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 - }; - SHIFT_TEMPS + static const INT16 aanscales[DCTSIZE2] = { + /* 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, + 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, + 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, + 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 + }; + SHIFT_TEMPS - for (i = 0; i < DCTSIZE2; i++) { - ifmtbl[i] = (IFAST_MULT_TYPE) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], - (INT32) aanscales[i]), - CONST_BITS-IFAST_SCALE_BITS); - } + for (i = 0; i < DCTSIZE2; i++) { + ifmtbl[i] = (IFAST_MULT_TYPE) + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-IFAST_SCALE_BITS); + } } break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: { - /* For float AA&N IDCT method, multipliers are equal to quantization - * coefficients scaled by scalefactor[row]*scalefactor[col], where - * scalefactor[0] = 1 - * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 - */ - FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; - int row, col; - static const double aanscalefactor[DCTSIZE] = { - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - }; + /* For float AA&N IDCT method, multipliers are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + */ + FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; + int row, col; + static const double aanscalefactor[DCTSIZE] = { + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + }; - i = 0; - for (row = 0; row < DCTSIZE; row++) { - for (col = 0; col < DCTSIZE; col++) { - fmtbl[i] = (FLOAT_MULT_TYPE) - ((double) qtbl->quantval[i] * - aanscalefactor[row] * aanscalefactor[col]); - i++; - } - } + i = 0; + for (row = 0; row < DCTSIZE; row++) { + for (col = 0; col < DCTSIZE; col++) { + fmtbl[i] = (FLOAT_MULT_TYPE) + ((double) qtbl->quantval[i] * + aanscalefactor[row] * aanscalefactor[col]); + i++; + } + } } break; #endif @@ -331,7 +331,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo) idct = (my_idct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_idct_controller)); + SIZEOF(my_idct_controller)); cinfo->idct = (struct jpeg_inverse_dct *) idct; idct->pub.start_pass = start_pass; @@ -340,7 +340,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo) /* Allocate and pre-zero a multiplier table for each component */ compptr->dct_table = (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(multiplier_table)); + SIZEOF(multiplier_table)); MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); /* Mark multiplier table not yet set up for any method */ idct->cur_method[ci] = -1; diff --git a/jdhuff.c b/jdhuff.c index d21d3992..db2b5eac 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -19,7 +19,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdhuff.h" /* Declarations shared with jdphuff.c */ +#include "jdhuff.h" /* Declarations shared with jdphuff.c */ #include "jpegcomp.h" #include "jstdhuff.c" @@ -45,10 +45,10 @@ typedef struct { #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ - ((dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) + ((dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif @@ -59,11 +59,11 @@ typedef struct { /* These fields are loaded into local variables at start of each MCU. * In case of suspension, we exit WITHOUT updating them. */ - bitread_perm_state bitstate; /* Bit buffer at start of MCU */ - savable_state saved; /* Other state at start of MCU */ + bitread_perm_state bitstate; /* Bit buffer at start of MCU */ + savable_state saved; /* Other state at start of MCU */ /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ /* Pointers to derived tables (these workspaces have image lifespan) */ d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; @@ -108,9 +108,9 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) /* Compute derived values for Huffman tables */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, - & entropy->dc_derived_tbls[dctbl]); + & entropy->dc_derived_tbls[dctbl]); jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, - & entropy->ac_derived_tbls[actbl]); + & entropy->ac_derived_tbls[actbl]); /* Initialize DC predictions to 0 */ entropy->saved.last_dc_val[ci] = 0; } @@ -151,7 +151,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) GLOBAL(void) jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, - d_derived_tbl ** pdtbl) + d_derived_tbl ** pdtbl) { JHUFF_TBL *htbl; d_derived_tbl *dtbl; @@ -177,26 +177,26 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, if (*pdtbl == NULL) *pdtbl = (d_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(d_derived_tbl)); + SIZEOF(d_derived_tbl)); dtbl = *pdtbl; - dtbl->pub = htbl; /* fill in back link */ - + dtbl->pub = htbl; /* fill in back link */ + /* Figure C.1: make table of Huffman code length for each symbol */ p = 0; for (l = 1; l <= 16; l++) { i = (int) htbl->bits[l]; - if (i < 0 || p + i > 256) /* protect against table overrun */ + if (i < 0 || p + i > 256) /* protect against table overrun */ ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i--) huffsize[p++] = (char) l; } huffsize[p] = 0; numsymbols = p; - + /* Figure C.2: generate the codes themselves */ /* We also validate that the counts represent a legal Huffman code tree. */ - + code = 0; si = huffsize[0]; p = 0; @@ -226,7 +226,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, p += htbl->bits[l]; dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ } else { - dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ + dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ } } dtbl->valoffset[17] = 0; @@ -249,8 +249,8 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* Generate left-justified code followed by all possible bit sequences */ lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { - dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p]; - lookbits++; + dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p]; + lookbits++; } } } @@ -265,7 +265,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, for (i = 0; i < numsymbols; i++) { int sym = htbl->huffval[i]; if (sym < 0 || sym > 15) - ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); } } } @@ -287,7 +287,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, */ #ifdef SLOW_SHIFT_32 -#define MIN_GET_BITS 15 /* minimum allowable value */ +#define MIN_GET_BITS 15 /* minimum allowable value */ #else #define MIN_GET_BITS (BIT_BUF_SIZE-7) #endif @@ -295,8 +295,8 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, GLOBAL(boolean) jpeg_fill_bit_buffer (bitread_working_state * state, - register bit_buf_type get_buffer, register int bits_left, - int nbits) + register bit_buf_type get_buffer, register int bits_left, + int nbits) /* Load up the bit buffer to a depth of at least nbits */ { /* Copy heavily used state fields into locals (hopefully registers) */ @@ -308,54 +308,54 @@ jpeg_fill_bit_buffer (bitread_working_state * state, /* (It is assumed that no request will be for more than that many bits.) */ /* We fail to do so only if we hit a marker or are forced to suspend. */ - if (cinfo->unread_marker == 0) { /* cannot advance past a marker */ + if (cinfo->unread_marker == 0) { /* cannot advance past a marker */ while (bits_left < MIN_GET_BITS) { register int c; /* Attempt to read a byte */ if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) - return FALSE; - next_input_byte = cinfo->src->next_input_byte; - bytes_in_buffer = cinfo->src->bytes_in_buffer; + if (! (*cinfo->src->fill_input_buffer) (cinfo)) + return FALSE; + next_input_byte = cinfo->src->next_input_byte; + bytes_in_buffer = cinfo->src->bytes_in_buffer; } bytes_in_buffer--; c = GETJOCTET(*next_input_byte++); /* If it's 0xFF, check and discard stuffed zero byte */ if (c == 0xFF) { - /* Loop here to discard any padding FF's on terminating marker, - * so that we can save a valid unread_marker value. NOTE: we will - * accept multiple FF's followed by a 0 as meaning a single FF data - * byte. This data pattern is not valid according to the standard. - */ - do { - if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) - return FALSE; - next_input_byte = cinfo->src->next_input_byte; - bytes_in_buffer = cinfo->src->bytes_in_buffer; - } - bytes_in_buffer--; - c = GETJOCTET(*next_input_byte++); - } while (c == 0xFF); + /* Loop here to discard any padding FF's on terminating marker, + * so that we can save a valid unread_marker value. NOTE: we will + * accept multiple FF's followed by a 0 as meaning a single FF data + * byte. This data pattern is not valid according to the standard. + */ + do { + if (bytes_in_buffer == 0) { + if (! (*cinfo->src->fill_input_buffer) (cinfo)) + return FALSE; + next_input_byte = cinfo->src->next_input_byte; + bytes_in_buffer = cinfo->src->bytes_in_buffer; + } + bytes_in_buffer--; + c = GETJOCTET(*next_input_byte++); + } while (c == 0xFF); - if (c == 0) { - /* Found FF/00, which represents an FF data byte */ - c = 0xFF; - } else { - /* Oops, it's actually a marker indicating end of compressed data. - * Save the marker code for later use. - * Fine point: it might appear that we should save the marker into - * bitread working state, not straight into permanent state. But - * once we have hit a marker, we cannot need to suspend within the - * current MCU, because we will read no more bytes from the data - * source. So it is OK to update permanent state right away. - */ - cinfo->unread_marker = c; - /* See if we need to insert some fake zero bits. */ - goto no_more_bytes; - } + if (c == 0) { + /* Found FF/00, which represents an FF data byte */ + c = 0xFF; + } else { + /* Oops, it's actually a marker indicating end of compressed data. + * Save the marker code for later use. + * Fine point: it might appear that we should save the marker into + * bitread working state, not straight into permanent state. But + * once we have hit a marker, we cannot need to suspend within the + * current MCU, because we will read no more bytes from the data + * source. So it is OK to update permanent state right away. + */ + cinfo->unread_marker = c; + /* See if we need to insert some fake zero bits. */ + goto no_more_bytes; + } } /* OK, load c into get_buffer */ @@ -375,8 +375,8 @@ jpeg_fill_bit_buffer (bitread_working_state * state, * appears per data segment. */ if (! cinfo->entropy->insufficient_data) { - WARNMS(cinfo, JWRN_HIT_MARKER); - cinfo->entropy->insufficient_data = TRUE; + WARNMS(cinfo, JWRN_HIT_MARKER); + cinfo->entropy->insufficient_data = TRUE; } /* Fill the buffer with zero bits */ get_buffer <<= MIN_GET_BITS - bits_left; @@ -445,8 +445,8 @@ jpeg_fill_bit_buffer (bitread_working_state * state, 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) + register bit_buf_type get_buffer, register int bits_left, + d_derived_tbl * htbl, int min_bits) { register int l = min_bits; register INT32 code; @@ -475,7 +475,7 @@ jpeg_huff_decode (bitread_working_state * state, if (l > 16) { WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE); - return 0; /* fake a zero as the safest result */ + return 0; /* fake a zero as the safest result */ } return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ]; @@ -595,7 +595,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) r = s >> 4; s &= 15; - + if (s) { k += r; CHECK_BIT_BUFFER(br_state, s, return FALSE); @@ -684,7 +684,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) HUFF_DECODE_FAST(s, l, actbl); r = s >> 4; s &= 15; - + if (s) { k += r; FILL_BIT_BUFFER_FAST @@ -756,7 +756,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) - return FALSE; + return FALSE; usefast = 0; } @@ -804,7 +804,7 @@ jinit_huff_decoder (j_decompress_ptr cinfo) entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_decoder)); + SIZEOF(huff_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass_huff_decoder; entropy->pub.decode_mcu = decode_mcu; diff --git a/jdhuff.h b/jdhuff.h index 22014360..8d2c6545 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -15,21 +15,21 @@ /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_d_derived_tbl jMkDDerived -#define jpeg_fill_bit_buffer jFilBitBuf -#define jpeg_huff_decode jHufDecode +#define jpeg_make_d_derived_tbl jMkDDerived +#define jpeg_fill_bit_buffer jFilBitBuf +#define jpeg_huff_decode jHufDecode #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Derived data constructed for each Huffman table */ -#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ +#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ typedef struct { /* Basic tables: (element [0] of each array is unused) */ - INT32 maxcode[18]; /* largest code of length k (-1 if none) */ + INT32 maxcode[18]; /* largest code of length k (-1 if none) */ /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ - INT32 valoffset[18]; /* huffval[] offset for codes of length k */ + INT32 valoffset[18]; /* huffval[] offset for codes of length k */ /* valoffset[k] = huffval[] index of 1st symbol of code length k, less * the smallest code of length k; so given a code of length k, the * corresponding symbol is huffval[code + valoffset[k]] @@ -53,8 +53,8 @@ typedef struct { /* Expand a Huffman table definition into the derived format */ EXTERN(void) jpeg_make_d_derived_tbl - JPP((j_decompress_ptr cinfo, boolean isDC, int tblno, - d_derived_tbl ** pdtbl)); + JPP((j_decompress_ptr cinfo, boolean isDC, int tblno, + d_derived_tbl ** pdtbl)); /* @@ -77,13 +77,13 @@ EXTERN(void) jpeg_make_d_derived_tbl #if __WORDSIZE == 64 || defined(_WIN64) -typedef size_t bit_buf_type; /* type of bit-extraction buffer */ -#define BIT_BUF_SIZE 64 /* size of buffer in bits */ +typedef size_t bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 64 /* size of buffer in bits */ #else -typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ -#define BIT_BUF_SIZE 32 /* size of buffer in bits */ +typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ +#define BIT_BUF_SIZE 32 /* size of buffer in bits */ #endif @@ -94,43 +94,43 @@ typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ * because not all machines measure sizeof in 8-bit bytes. */ -typedef struct { /* Bitreading state saved across MCUs */ - bit_buf_type get_buffer; /* current bit-extraction buffer */ - int bits_left; /* # of unused bits in it */ +typedef struct { /* Bitreading state saved across MCUs */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ } bitread_perm_state; -typedef struct { /* Bitreading working state within an MCU */ +typedef struct { /* Bitreading working state within an MCU */ /* Current data source location */ /* We need a copy, rather than munging the original, in case of suspension */ const JOCTET * next_input_byte; /* => next byte to read from source */ - size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ /* Bit input buffer --- note these values are kept in register variables, * not in this struct, inside the inner loops. */ - bit_buf_type get_buffer; /* current bit-extraction buffer */ - int bits_left; /* # of unused bits in it */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ /* Pointer needed by jpeg_fill_bit_buffer. */ - j_decompress_ptr cinfo; /* back link to decompress master record */ + j_decompress_ptr cinfo; /* back link to decompress master record */ } bitread_working_state; /* Macros to declare and load/save bitread local variables. */ #define BITREAD_STATE_VARS \ - register bit_buf_type get_buffer; \ - register int bits_left; \ - bitread_working_state br_state + register bit_buf_type get_buffer; \ + register int bits_left; \ + bitread_working_state br_state #define BITREAD_LOAD_STATE(cinfop,permstate) \ - br_state.cinfo = cinfop; \ - br_state.next_input_byte = cinfop->src->next_input_byte; \ - br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ - get_buffer = permstate.get_buffer; \ - bits_left = permstate.bits_left; + br_state.cinfo = cinfop; \ + br_state.next_input_byte = cinfop->src->next_input_byte; \ + br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ + get_buffer = permstate.get_buffer; \ + bits_left = permstate.bits_left; #define BITREAD_SAVE_STATE(cinfop,permstate) \ - cinfop->src->next_input_byte = br_state.next_input_byte; \ - cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ - permstate.get_buffer = get_buffer; \ - permstate.bits_left = bits_left + cinfop->src->next_input_byte = br_state.next_input_byte; \ + cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ + permstate.get_buffer = get_buffer; \ + permstate.bits_left = bits_left /* * These macros provide the in-line portion of bit fetching. @@ -138,37 +138,37 @@ typedef struct { /* Bitreading working state within an MCU */ * before using GET_BITS, PEEK_BITS, or DROP_BITS. * The variables get_buffer and bits_left are assumed to be locals, * but the state struct might not be (jpeg_huff_decode needs this). - * CHECK_BIT_BUFFER(state,n,action); - * Ensure there are N bits in get_buffer; if suspend, take action. + * CHECK_BIT_BUFFER(state,n,action); + * Ensure there are N bits in get_buffer; if suspend, take action. * val = GET_BITS(n); - * Fetch next N bits. + * Fetch next N bits. * val = PEEK_BITS(n); - * Fetch next N bits without removing them from the buffer. - * DROP_BITS(n); - * Discard next N bits. + * Fetch next N bits without removing them from the buffer. + * DROP_BITS(n); + * Discard next N bits. * The value N should be a simple variable, not an expression, because it * is evaluated multiple times. */ #define CHECK_BIT_BUFFER(state,nbits,action) \ - { if (bits_left < (nbits)) { \ - if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ - { action; } \ - get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } + { if (bits_left < (nbits)) { \ + if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ + { action; } \ + get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } #define GET_BITS(nbits) \ - (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1)) + (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1)) #define PEEK_BITS(nbits) \ - (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1)) + (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1)) #define DROP_BITS(nbits) \ - (bits_left -= (nbits)) + (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)); + JPP((bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, int nbits)); /* @@ -204,7 +204,7 @@ EXTERN(boolean) jpeg_fill_bit_buffer } else { \ slowlabel: \ if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ - { failaction; } \ + { failaction; } \ get_buffer = state.get_buffer; bits_left = state.bits_left; \ } \ } @@ -231,5 +231,5 @@ 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)); + 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 e7ba33f7..4afb0742 100644 --- a/jdinput.c +++ b/jdinput.c @@ -24,7 +24,7 @@ typedef struct { struct jpeg_input_controller pub; /* public fields */ - boolean inheaders; /* TRUE until first SOS is reached */ + boolean inheaders; /* TRUE until first SOS is reached */ } my_input_controller; typedef my_input_controller * my_inputctl_ptr; @@ -57,7 +57,7 @@ initial_setup (j_decompress_ptr cinfo) /* Check that number of components won't exceed internal array sizes */ if (cinfo->num_components > MAX_COMPONENTS) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, - MAX_COMPONENTS); + MAX_COMPONENTS); /* Compute maximum sampling factors; check factor validity */ cinfo->max_h_samp_factor = 1; @@ -65,12 +65,12 @@ initial_setup (j_decompress_ptr cinfo) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || - compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) ERREXIT(cinfo, JERR_BAD_SAMPLING); cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, - compptr->h_samp_factor); + compptr->h_samp_factor); cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, - compptr->v_samp_factor); + compptr->v_samp_factor); } #if JPEG_LIB_VERSION >=80 @@ -100,10 +100,10 @@ initial_setup (j_decompress_ptr cinfo) /* Size in DCT blocks */ compptr->width_in_blocks = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); + (long) (cinfo->max_h_samp_factor * DCTSIZE)); compptr->height_in_blocks = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) (cinfo->max_v_samp_factor * DCTSIZE)); + (long) (cinfo->max_v_samp_factor * DCTSIZE)); /* downsampled_width and downsampled_height will also be overridden by * jdmaster.c if we are doing full decompression. The transcoder library * doesn't use these values, but the calling application might. @@ -111,10 +111,10 @@ initial_setup (j_decompress_ptr cinfo) /* Size in samples */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, - (long) cinfo->max_h_samp_factor); + (long) cinfo->max_h_samp_factor); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, - (long) cinfo->max_v_samp_factor); + (long) cinfo->max_v_samp_factor); /* Mark component needed, until color conversion says otherwise */ compptr->component_needed = TRUE; /* Mark no quantization table yet saved for component */ @@ -124,7 +124,7 @@ initial_setup (j_decompress_ptr cinfo) /* Compute number of fully interleaved MCU rows. */ cinfo->total_iMCU_rows = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); + (long) (cinfo->max_v_samp_factor*DCTSIZE)); /* Decide whether file contains multiple scans */ if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode) @@ -141,16 +141,16 @@ per_scan_setup (j_decompress_ptr cinfo) { int ci, mcublks, tmp; jpeg_component_info *compptr; - + if (cinfo->comps_in_scan == 1) { - + /* Noninterleaved (single-component) scan */ compptr = cinfo->cur_comp_info[0]; - + /* Overall image size in MCUs */ cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks; - + /* For noninterleaved scan, always one block per MCU */ compptr->MCU_width = 1; compptr->MCU_height = 1; @@ -163,28 +163,28 @@ per_scan_setup (j_decompress_ptr cinfo) tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; - + /* Prepare array describing MCU composition */ cinfo->blocks_in_MCU = 1; cinfo->MCU_membership[0] = 0; - + } else { - + /* Interleaved (multi-component) scan */ if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, - MAX_COMPS_IN_SCAN); - + MAX_COMPS_IN_SCAN); + /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) jdiv_round_up((long) cinfo->image_width, - (long) (cinfo->max_h_samp_factor*DCTSIZE)); + (long) (cinfo->max_h_samp_factor*DCTSIZE)); cinfo->MCU_rows_in_scan = (JDIMENSION) jdiv_round_up((long) cinfo->image_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); - + (long) (cinfo->max_v_samp_factor*DCTSIZE)); + cinfo->blocks_in_MCU = 0; - + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; /* Sampling factors give # of blocks of component in each MCU */ @@ -202,12 +202,12 @@ per_scan_setup (j_decompress_ptr cinfo) /* Prepare array describing MCU composition */ mcublks = compptr->MCU_blocks; if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU) - ERREXIT(cinfo, JERR_BAD_MCU_SIZE); + ERREXIT(cinfo, JERR_BAD_MCU_SIZE); while (mcublks-- > 0) { - cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; } } - + } } @@ -248,12 +248,12 @@ latch_quant_tables (j_decompress_ptr cinfo) /* Make sure specified quantization table is present */ qtblno = compptr->quant_tbl_no; if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || - cinfo->quant_tbl_ptrs[qtblno] == NULL) + cinfo->quant_tbl_ptrs[qtblno] == NULL) ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); /* OK, save away the quantization table */ qtbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(JQUANT_TBL)); + SIZEOF(JQUANT_TBL)); MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); compptr->quant_table = qtbl; } @@ -313,31 +313,31 @@ consume_markers (j_decompress_ptr cinfo) val = (*cinfo->marker->read_markers) (cinfo); switch (val) { - case JPEG_REACHED_SOS: /* Found SOS */ - if (inputctl->inheaders) { /* 1st SOS */ + case JPEG_REACHED_SOS: /* Found SOS */ + if (inputctl->inheaders) { /* 1st SOS */ initial_setup(cinfo); inputctl->inheaders = FALSE; /* Note: start_input_pass must be called by jdmaster.c * before any more input can be consumed. jdapimin.c is * responsible for enforcing this sequencing. */ - } else { /* 2nd or later SOS marker */ + } else { /* 2nd or later SOS marker */ if (! inputctl->pub.has_multiple_scans) - ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ + ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ start_input_pass(cinfo); } break; - case JPEG_REACHED_EOI: /* Found EOI */ + case JPEG_REACHED_EOI: /* Found EOI */ inputctl->pub.eoi_reached = TRUE; - if (inputctl->inheaders) { /* Tables-only datastream, apparently */ + if (inputctl->inheaders) { /* Tables-only datastream, apparently */ if (cinfo->marker->saw_SOF) - ERREXIT(cinfo, JERR_SOF_NO_SOS); + ERREXIT(cinfo, JERR_SOF_NO_SOS); } else { /* Prevent infinite loop in coef ctlr's decompress_data routine * if user set output_scan_number larger than number of scans. */ if (cinfo->output_scan_number > cinfo->input_scan_number) - cinfo->output_scan_number = cinfo->input_scan_number; + cinfo->output_scan_number = cinfo->input_scan_number; } break; case JPEG_SUSPENDED: @@ -382,7 +382,7 @@ jinit_input_controller (j_decompress_ptr cinfo) /* Create subobject in permanent pool */ inputctl = (my_inputctl_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_input_controller)); + SIZEOF(my_input_controller)); cinfo->inputctl = (struct jpeg_input_controller *) inputctl; /* Initialize method pointers */ inputctl->pub.consume_input = consume_markers; diff --git a/jdmainct.c b/jdmainct.c index 26b816c5..922f649a 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -120,39 +120,39 @@ typedef struct { /* Pointer to allocated workspace (M or M+2 row groups). */ JSAMPARRAY buffer[MAX_COMPONENTS]; - boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ - JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ + boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ + JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ /* Remaining fields are only used in the context case. */ /* These are the master pointers to the funny-order pointer lists. */ - JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ + JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ - int whichptr; /* indicates which pointer set is now in use */ - int context_state; /* process_data state machine status */ - JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ - JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ + int whichptr; /* indicates which pointer set is now in use */ + int context_state; /* process_data state machine status */ + JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ + JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ } my_main_controller; typedef my_main_controller * my_main_ptr; /* context_state values: */ -#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ -#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ -#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ +#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ +#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ +#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ /* Forward declarations */ METHODDEF(void) process_data_simple_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); METHODDEF(void) process_data_context_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + 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 - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); #endif @@ -173,7 +173,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) */ main_ptr->xbuffer[0] = (JSAMPIMAGE) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); + cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; @@ -185,8 +185,8 @@ alloc_funny_pointers (j_decompress_ptr cinfo) */ xbuf = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); - xbuf += rgroup; /* want one row group at negative offsets */ + 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); + xbuf += rgroup; /* want one row group at negative offsets */ main_ptr->xbuffer[0][ci] = xbuf; xbuf += rgroup * (M + 4); main_ptr->xbuffer[1][ci] = xbuf; @@ -316,14 +316,14 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) if (cinfo->upsample->need_context_rows) { main_ptr->pub.process_data = process_data_context_main; make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ - main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ + main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ main_ptr->context_state = CTX_PREPARE_FOR_IMCU; main_ptr->iMCU_row_ctr = 0; } else { /* Simple case with no context needed */ main_ptr->pub.process_data = process_data_simple_main; } - main_ptr->buffer_full = FALSE; /* Mark buffer empty */ + main_ptr->buffer_full = FALSE; /* Mark buffer empty */ main_ptr->rowgroup_ctr = 0; break; #ifdef QUANT_2PASS_SUPPORTED @@ -346,8 +346,8 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) METHODDEF(void) process_data_simple_main (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_main_ptr main_ptr = (my_main_ptr) cinfo->main; JDIMENSION rowgroups_avail; @@ -355,8 +355,8 @@ process_data_simple_main (j_decompress_ptr cinfo, /* Read input data if we haven't filled the main buffer yet */ if (! main_ptr->buffer_full) { if (! (*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer)) - return; /* suspension forced, can do nothing more */ - main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + return; /* suspension forced, can do nothing more */ + main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ } /* There are always min_DCT_scaled_size row groups in an iMCU row. */ @@ -368,8 +368,8 @@ process_data_simple_main (j_decompress_ptr cinfo, /* Feed the postprocessor */ (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer, - &main_ptr->rowgroup_ctr, rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); + &main_ptr->rowgroup_ctr, rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ if (main_ptr->rowgroup_ctr >= rowgroups_avail) { @@ -386,18 +386,18 @@ process_data_simple_main (j_decompress_ptr cinfo, METHODDEF(void) process_data_context_main (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_main_ptr main_ptr = (my_main_ptr) cinfo->main; /* Read input data if we haven't filled the main buffer yet */ if (! main_ptr->buffer_full) { if (! (*cinfo->coef->decompress_data) (cinfo, - main_ptr->xbuffer[main_ptr->whichptr])) - return; /* suspension forced, can do nothing more */ - main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ - main_ptr->iMCU_row_ctr++; /* count rows received */ + main_ptr->xbuffer[main_ptr->whichptr])) + return; /* suspension forced, can do nothing more */ + main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + main_ptr->iMCU_row_ctr++; /* count rows received */ } /* Postprocessor typically will not swallow all the input data it is handed @@ -409,13 +409,13 @@ process_data_context_main (j_decompress_ptr cinfo, case CTX_POSTPONED_ROW: /* Call postprocessor using previously set pointers for postponed row */ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], - &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); + &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) - return; /* Need to suspend */ + return; /* Need to suspend */ main_ptr->context_state = CTX_PREPARE_FOR_IMCU; if (*out_row_ctr >= out_rows_avail) - return; /* Postprocessor exactly filled output buf */ + return; /* Postprocessor exactly filled output buf */ /*FALLTHROUGH*/ case CTX_PREPARE_FOR_IMCU: /* Prepare to process first M-1 row groups of this iMCU row */ @@ -431,15 +431,15 @@ process_data_context_main (j_decompress_ptr cinfo, case CTX_PROCESS_IMCU: /* Call postprocessor using previously set pointers */ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], - &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, - output_buf, out_row_ctr, out_rows_avail); + &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) - return; /* Need to suspend */ + return; /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */ if (main_ptr->iMCU_row_ctr == 1) set_wraparound_pointers(cinfo); /* Prepare to load new iMCU row using other xbuffer list */ - main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */ + main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */ main_ptr->buffer_full = FALSE; /* Still need to process last row group of this iMCU row, */ /* which is saved at index M+1 of the other xbuffer */ @@ -460,12 +460,12 @@ process_data_context_main (j_decompress_ptr cinfo, METHODDEF(void) process_data_crank_post (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail) + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, - (JDIMENSION *) NULL, (JDIMENSION) 0, - output_buf, out_row_ctr, out_rows_avail); + (JDIMENSION *) NULL, (JDIMENSION) 0, + output_buf, out_row_ctr, out_rows_avail); } #endif /* QUANT_2PASS_SUPPORTED */ @@ -484,11 +484,11 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); + SIZEOF(my_main_controller)); cinfo->main = (struct jpeg_d_main_controller *) main_ptr; main_ptr->pub.start_pass = start_pass_main; - if (need_full_buffer) /* shouldn't happen */ + if (need_full_buffer) /* shouldn't happen */ ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); /* Allocate the workspace. @@ -508,8 +508,8 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / cinfo->_min_DCT_scaled_size; /* height of a row group of component */ main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - compptr->width_in_blocks * compptr->_DCT_scaled_size, - (JDIMENSION) (rgroup * ngroups)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * compptr->_DCT_scaled_size, + (JDIMENSION) (rgroup * ngroups)); } } diff --git a/jdmarker.c b/jdmarker.c index c8771bc0..d996f6b3 100644 --- a/jdmarker.c +++ b/jdmarker.c @@ -19,29 +19,29 @@ #include "jpeglib.h" -typedef enum { /* JPEG marker codes */ +typedef enum { /* JPEG marker codes */ M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, - + M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, - + M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, - + M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, - + M_DHT = 0xc4, - + M_DAC = 0xcc, - + M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, @@ -50,7 +50,7 @@ typedef enum { /* JPEG marker codes */ M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, - + M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, @@ -59,7 +59,7 @@ typedef enum { /* JPEG marker codes */ M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, - + M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, @@ -76,13 +76,13 @@ typedef enum { /* JPEG marker codes */ M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, - + M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, - + M_TEM = 0x01, - + M_ERROR = 0x100 } JPEG_MARKER; @@ -101,8 +101,8 @@ typedef struct { unsigned int length_limit_APPn[16]; /* Status of COM/APPn marker saving */ - jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */ - unsigned int bytes_read; /* data bytes read so far in marker */ + jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */ + unsigned int bytes_read; /* data bytes read so far in marker */ /* Note: cur_marker is not linked into marker_list until it's all read. */ } my_marker_reader; @@ -119,49 +119,49 @@ typedef my_marker_reader * my_marker_ptr; /* Declare and initialize local copies of input pointer/count */ #define INPUT_VARS(cinfo) \ - struct jpeg_source_mgr * datasrc = (cinfo)->src; \ - const JOCTET * next_input_byte = datasrc->next_input_byte; \ - size_t bytes_in_buffer = datasrc->bytes_in_buffer + struct jpeg_source_mgr * datasrc = (cinfo)->src; \ + const JOCTET * next_input_byte = datasrc->next_input_byte; \ + size_t bytes_in_buffer = datasrc->bytes_in_buffer /* Unload the local copies --- do this only at a restart boundary */ #define INPUT_SYNC(cinfo) \ - ( datasrc->next_input_byte = next_input_byte, \ - datasrc->bytes_in_buffer = bytes_in_buffer ) + ( datasrc->next_input_byte = next_input_byte, \ + datasrc->bytes_in_buffer = bytes_in_buffer ) /* Reload the local copies --- used only in MAKE_BYTE_AVAIL */ #define INPUT_RELOAD(cinfo) \ - ( next_input_byte = datasrc->next_input_byte, \ - bytes_in_buffer = datasrc->bytes_in_buffer ) + ( next_input_byte = datasrc->next_input_byte, \ + bytes_in_buffer = datasrc->bytes_in_buffer ) /* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available. * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, * but we must reload the local copies after a successful fill. */ #define MAKE_BYTE_AVAIL(cinfo,action) \ - if (bytes_in_buffer == 0) { \ - if (! (*datasrc->fill_input_buffer) (cinfo)) \ - { action; } \ - INPUT_RELOAD(cinfo); \ - } + if (bytes_in_buffer == 0) { \ + if (! (*datasrc->fill_input_buffer) (cinfo)) \ + { action; } \ + INPUT_RELOAD(cinfo); \ + } /* Read a byte into variable V. * If must suspend, take the specified action (typically "return FALSE"). */ #define INPUT_BYTE(cinfo,V,action) \ - MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V = GETJOCTET(*next_input_byte++); ) + MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V = GETJOCTET(*next_input_byte++); ) /* As above, but read two bytes interpreted as an unsigned 16-bit integer. * V should be declared unsigned int or perhaps INT32. */ #define INPUT_2BYTES(cinfo,V,action) \ - MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ - MAKE_BYTE_AVAIL(cinfo,action); \ - bytes_in_buffer--; \ - V += GETJOCTET(*next_input_byte++); ) + MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ + MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V += GETJOCTET(*next_input_byte++); ) /* @@ -200,7 +200,7 @@ get_soi (j_decompress_ptr cinfo) /* Process an SOI marker */ { int i; - + TRACEMS(cinfo, 1, JTRC_SOI); if (cinfo->marker->saw_SOI) @@ -257,8 +257,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) length -= 8; TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker, - (int) cinfo->image_width, (int) cinfo->image_height, - cinfo->num_components); + (int) cinfo->image_width, (int) cinfo->image_height, + cinfo->num_components); if (cinfo->marker->saw_SOF) ERREXIT(cinfo, JERR_SOF_DUPLICATE); @@ -273,11 +273,11 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) if (length != (cinfo->num_components * 3)) ERREXIT(cinfo, JERR_BAD_LENGTH); - if (cinfo->comp_info == NULL) /* do only once, even if suspend */ + if (cinfo->comp_info == NULL) /* do only once, even if suspend */ cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * SIZEOF(jpeg_component_info)); - + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components * SIZEOF(jpeg_component_info)); + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { compptr->component_index = ci; @@ -288,8 +288,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE); TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, - compptr->component_id, compptr->h_samp_factor, - compptr->v_samp_factor, compptr->quant_tbl_no); + compptr->component_id, compptr->h_samp_factor, + compptr->v_samp_factor, compptr->quant_tbl_no); } cinfo->marker->saw_SOF = TRUE; @@ -330,12 +330,12 @@ get_sos (j_decompress_ptr cinfo) for (i = 0; i < n; i++) { INPUT_BYTE(cinfo, cc, return FALSE); INPUT_BYTE(cinfo, c, return FALSE); - + for (ci = 0, compptr = cinfo->comp_info; - ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN; - ci++, compptr++) { + ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN; + ci++, compptr++) { if (cc == compptr->component_id && !cinfo->cur_comp_info[ci]) - goto id_found; + goto id_found; } ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); @@ -345,9 +345,9 @@ get_sos (j_decompress_ptr cinfo) cinfo->cur_comp_info[i] = compptr; compptr->dc_tbl_no = (c >> 4) & 15; compptr->ac_tbl_no = (c ) & 15; - + TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, - compptr->dc_tbl_no, compptr->ac_tbl_no); + compptr->dc_tbl_no, compptr->ac_tbl_no); /* This CSi (cc) should differ from the previous CSi */ for (pi = 0; pi < i; pi++) { @@ -367,7 +367,7 @@ get_sos (j_decompress_ptr cinfo) cinfo->Al = (c ) & 15; TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, - cinfo->Ah, cinfo->Al); + cinfo->Ah, cinfo->Al); /* Prepare to scan data & restart markers */ cinfo->marker->next_restart_num = 0; @@ -392,7 +392,7 @@ get_dac (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + while (length > 0) { INPUT_BYTE(cinfo, index, return FALSE); INPUT_BYTE(cinfo, val, return FALSE); @@ -406,11 +406,11 @@ get_dac (j_decompress_ptr cinfo) if (index >= NUM_ARITH_TBLS) { /* define AC table */ cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; - } else { /* define DC table */ + } else { /* define DC table */ cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); cinfo->arith_dc_U[index] = (UINT8) (val >> 4); if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) - ERREXIT1(cinfo, JERR_DAC_VALUE, val); + ERREXIT1(cinfo, JERR_DAC_VALUE, val); } } @@ -441,12 +441,12 @@ get_dht (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + while (length > 16) { INPUT_BYTE(cinfo, index, return FALSE); TRACEMS1(cinfo, 1, JTRC_DHT, index); - + bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { @@ -457,11 +457,11 @@ get_dht (j_decompress_ptr cinfo) length -= 1 + 16; TRACEMS8(cinfo, 2, JTRC_HUFFBITS, - bits[1], bits[2], bits[3], bits[4], - bits[5], bits[6], bits[7], bits[8]); + bits[1], bits[2], bits[3], bits[4], + bits[5], bits[6], bits[7], bits[8]); TRACEMS8(cinfo, 2, JTRC_HUFFBITS, - bits[9], bits[10], bits[11], bits[12], - bits[13], bits[14], bits[15], bits[16]); + bits[9], bits[10], bits[11], bits[12], + bits[13], bits[14], bits[15], bits[16]); /* Here we just do minimal validation of the counts to avoid walking * off the end of our table space. jdhuff.c will check more carefully. @@ -476,12 +476,12 @@ get_dht (j_decompress_ptr cinfo) length -= count; - if (index & 0x10) { /* AC table definition */ + if (index & 0x10) { /* AC table definition */ index -= 0x10; if (index < 0 || index >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_DHT_INDEX, index); htblptr = &cinfo->ac_huff_tbl_ptrs[index]; - } else { /* DC table definition */ + } else { /* DC table definition */ if (index < 0 || index >= NUM_HUFF_TBLS) ERREXIT1(cinfo, JERR_DHT_INDEX, index); htblptr = &cinfo->dc_huff_tbl_ptrs[index]; @@ -489,7 +489,7 @@ get_dht (j_decompress_ptr cinfo) if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - + MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); } @@ -524,27 +524,27 @@ get_dqt (j_decompress_ptr cinfo) if (n >= NUM_QUANT_TBLS) ERREXIT1(cinfo, JERR_DQT_INDEX, n); - + if (cinfo->quant_tbl_ptrs[n] == NULL) cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); quant_ptr = cinfo->quant_tbl_ptrs[n]; for (i = 0; i < DCTSIZE2; i++) { if (prec) - INPUT_2BYTES(cinfo, tmp, return FALSE); + INPUT_2BYTES(cinfo, tmp, return FALSE); else - INPUT_BYTE(cinfo, tmp, return FALSE); + INPUT_BYTE(cinfo, tmp, return FALSE); /* We convert the zigzag-order table to natural array order. */ quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; } 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]); + 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]); } } @@ -569,7 +569,7 @@ get_dri (j_decompress_ptr cinfo) INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); - + if (length != 4) ERREXIT(cinfo, JERR_BAD_LENGTH); @@ -591,14 +591,14 @@ get_dri (j_decompress_ptr cinfo) * JFIF and Adobe markers, respectively. */ -#define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */ -#define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */ -#define APPN_DATA_LEN 14 /* Must be the largest of the above!! */ +#define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */ +#define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */ +#define APPN_DATA_LEN 14 /* Must be the largest of the above!! */ LOCAL(void) examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, INT32 remaining) + unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP0. * Take appropriate action if it is a JFIF marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. @@ -627,18 +627,18 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, */ if (cinfo->JFIF_major_version != 1) WARNMS2(cinfo, JWRN_JFIF_MAJOR, - cinfo->JFIF_major_version, cinfo->JFIF_minor_version); + cinfo->JFIF_major_version, cinfo->JFIF_minor_version); /* Generate trace messages */ TRACEMS5(cinfo, 1, JTRC_JFIF, - cinfo->JFIF_major_version, cinfo->JFIF_minor_version, - cinfo->X_density, cinfo->Y_density, cinfo->density_unit); + cinfo->JFIF_major_version, cinfo->JFIF_minor_version, + cinfo->X_density, cinfo->Y_density, cinfo->density_unit); /* Validate thumbnail dimensions and issue appropriate messages */ if (GETJOCTET(data[12]) | GETJOCTET(data[13])) TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, - GETJOCTET(data[12]), GETJOCTET(data[13])); + GETJOCTET(data[12]), GETJOCTET(data[13])); totallen -= APP0_DATA_LEN; if (totallen != - ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) + ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); } else if (datalen >= 6 && GETJOCTET(data[0]) == 0x4A && @@ -662,7 +662,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, break; default: TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, - GETJOCTET(data[5]), (int) totallen); + GETJOCTET(data[5]), (int) totallen); break; } } else { @@ -674,7 +674,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, LOCAL(void) examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, INT32 remaining) + unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP14. * Take appropriate action if it is an Adobe marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. @@ -766,19 +766,19 @@ save_marker (j_decompress_ptr cinfo) /* begin reading a marker */ INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - if (length >= 0) { /* watch out for bogus length word */ + if (length >= 0) { /* watch out for bogus length word */ /* figure out how much we want to save */ unsigned int limit; if (cinfo->unread_marker == (int) M_COM) - limit = marker->length_limit_COM; + limit = marker->length_limit_COM; else - limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; + limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; if ((unsigned int) length < limit) - limit = (unsigned int) length; + limit = (unsigned int) length; /* allocate and initialize the marker item */ cur_marker = (jpeg_saved_marker_ptr) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(struct jpeg_marker_struct) + limit); + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(struct jpeg_marker_struct) + limit); cur_marker->next = NULL; cur_marker->marker = (UINT8) cinfo->unread_marker; cur_marker->original_length = (unsigned int) length; @@ -802,7 +802,7 @@ save_marker (j_decompress_ptr cinfo) } while (bytes_read < data_length) { - INPUT_SYNC(cinfo); /* move the restart point to here */ + INPUT_SYNC(cinfo); /* move the restart point to here */ marker->bytes_read = bytes_read; /* If there's not at least one byte in buffer, suspend */ MAKE_BYTE_AVAIL(cinfo, return FALSE); @@ -815,14 +815,14 @@ save_marker (j_decompress_ptr cinfo) } /* Done reading what we want to read */ - if (cur_marker != NULL) { /* will be NULL if bogus length word */ + if (cur_marker != NULL) { /* will be NULL if bogus length word */ /* Add new marker to end of list */ if (cinfo->marker_list == NULL) { cinfo->marker_list = cur_marker; } else { jpeg_saved_marker_ptr prev = cinfo->marker_list; while (prev->next != NULL) - prev = prev->next; + prev = prev->next; prev->next = cur_marker; } /* Reset pointer & calc remaining data length */ @@ -842,12 +842,12 @@ save_marker (j_decompress_ptr cinfo) break; default: TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, - (int) (data_length + length)); + (int) (data_length + length)); break; } /* skip any remaining data -- could be lots */ - INPUT_SYNC(cinfo); /* do before skip_input_data */ + INPUT_SYNC(cinfo); /* do before skip_input_data */ if (length > 0) (*cinfo->src->skip_input_data) (cinfo, (long) length); @@ -866,10 +866,10 @@ skip_variable (j_decompress_ptr cinfo) INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; - + TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); - INPUT_SYNC(cinfo); /* do before skip_input_data */ + INPUT_SYNC(cinfo); /* do before skip_input_data */ if (length > 0) (*cinfo->src->skip_input_data) (cinfo, (long) length); @@ -913,7 +913,7 @@ next_marker (j_decompress_ptr cinfo) INPUT_BYTE(cinfo, c, return FALSE); } while (c == 0xFF); if (c != 0) - break; /* found a valid marker, exit loop */ + break; /* found a valid marker, exit loop */ /* Reach here if we found a stuffed-zero data sequence (FF/00). * Discard it and loop back to try again. */ @@ -973,11 +973,11 @@ read_markers (j_decompress_ptr cinfo) /* NB: first_marker() enforces the requirement that SOI appear first. */ if (cinfo->unread_marker == 0) { if (! cinfo->marker->saw_SOI) { - if (! first_marker(cinfo)) - return JPEG_SUSPENDED; + if (! first_marker(cinfo)) + return JPEG_SUSPENDED; } else { - if (! next_marker(cinfo)) - return JPEG_SUSPENDED; + if (! next_marker(cinfo)) + return JPEG_SUSPENDED; } } /* At this point cinfo->unread_marker contains the marker code and the @@ -987,74 +987,74 @@ read_markers (j_decompress_ptr cinfo) switch (cinfo->unread_marker) { case M_SOI: if (! get_soi(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ if (! get_sof(cinfo, FALSE, FALSE)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - case M_SOF2: /* Progressive, Huffman */ + case M_SOF2: /* Progressive, Huffman */ if (! get_sof(cinfo, TRUE, FALSE)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - case M_SOF9: /* Extended sequential, arithmetic */ + case M_SOF9: /* Extended sequential, arithmetic */ if (! get_sof(cinfo, FALSE, TRUE)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - case M_SOF10: /* Progressive, arithmetic */ + case M_SOF10: /* Progressive, arithmetic */ if (! get_sof(cinfo, TRUE, TRUE)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; /* Currently unsupported SOFn types */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_JPG: /* Reserved for JPEG extensions */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_JPG: /* Reserved for JPEG extensions */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker); break; case M_SOS: if (! get_sos(cinfo)) - return JPEG_SUSPENDED; - cinfo->unread_marker = 0; /* processed the marker */ + return JPEG_SUSPENDED; + cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_SOS; - + case M_EOI: TRACEMS(cinfo, 1, JTRC_EOI); - cinfo->unread_marker = 0; /* processed the marker */ + cinfo->unread_marker = 0; /* processed the marker */ return JPEG_REACHED_EOI; - + case M_DAC: if (! get_dac(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - + case M_DHT: if (! get_dht(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - + case M_DQT: if (! get_dqt(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - + case M_DRI: if (! get_dri(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - + case M_APP0: case M_APP1: case M_APP2: @@ -1072,16 +1072,16 @@ read_markers (j_decompress_ptr cinfo) case M_APP14: case M_APP15: if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ - cinfo->unread_marker - (int) M_APP0]) (cinfo)) - return JPEG_SUSPENDED; - break; - - case M_COM: - if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) - return JPEG_SUSPENDED; + cinfo->unread_marker - (int) M_APP0]) (cinfo)) + return JPEG_SUSPENDED; break; - case M_RST0: /* these are all parameterless */ + case M_COM: + if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) + return JPEG_SUSPENDED; + break; + + case M_RST0: /* these are all parameterless */ case M_RST1: case M_RST2: case M_RST3: @@ -1093,12 +1093,12 @@ read_markers (j_decompress_ptr cinfo) TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker); break; - case M_DNL: /* Ignore DNL ... perhaps the wrong thing */ + case M_DNL: /* Ignore DNL ... perhaps the wrong thing */ if (! skip_variable(cinfo)) - return JPEG_SUSPENDED; + return JPEG_SUSPENDED; break; - default: /* must be DHP, EXP, JPGn, or RESn */ + default: /* must be DHP, EXP, JPGn, or RESn */ /* For now, we treat the reserved markers as fatal errors since they are * likely to be used to signal incompatible JPEG Part 3 extensions. * Once the JPEG 3 version-number marker is well defined, this code @@ -1144,7 +1144,7 @@ read_restart_marker (j_decompress_ptr cinfo) /* Uh-oh, the restart markers have been messed up. */ /* Let the data source manager determine how to resync. */ if (! (*cinfo->src->resync_to_restart) (cinfo, - cinfo->marker->next_restart_num)) + cinfo->marker->next_restart_num)) return FALSE; } @@ -1209,25 +1209,25 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) { int marker = cinfo->unread_marker; int action = 1; - + /* Always put up a warning. */ WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); - + /* Outer loop handles repeated decision after scanning forward. */ for (;;) { if (marker < (int) M_SOF0) - action = 2; /* invalid marker */ + action = 2; /* invalid marker */ else if (marker < (int) M_RST0 || marker > (int) M_RST7) - action = 3; /* valid non-restart marker */ + action = 3; /* valid non-restart marker */ else { if (marker == ((int) M_RST0 + ((desired+1) & 7)) || - marker == ((int) M_RST0 + ((desired+2) & 7))) - action = 3; /* one of the next two expected restarts */ + marker == ((int) M_RST0 + ((desired+2) & 7))) + action = 3; /* one of the next two expected restarts */ else if (marker == ((int) M_RST0 + ((desired-1) & 7)) || - marker == ((int) M_RST0 + ((desired-2) & 7))) - action = 2; /* a prior restart, so advance */ + marker == ((int) M_RST0 + ((desired-2) & 7))) + action = 2; /* a prior restart, so advance */ else - action = 1; /* desired restart or too far away */ + action = 1; /* desired restart or too far away */ } TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action); switch (action) { @@ -1238,7 +1238,7 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) case 2: /* Scan to the next marker, and repeat the decision loop. */ if (! next_marker(cinfo)) - return FALSE; + return FALSE; marker = cinfo->unread_marker; break; case 3: @@ -1259,10 +1259,10 @@ reset_marker_reader (j_decompress_ptr cinfo) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; - cinfo->comp_info = NULL; /* until allocated by get_sof */ - cinfo->input_scan_number = 0; /* no SOS seen yet */ - cinfo->unread_marker = 0; /* no pending marker */ - marker->pub.saw_SOI = FALSE; /* set internal state too */ + cinfo->comp_info = NULL; /* until allocated by get_sof */ + cinfo->input_scan_number = 0; /* no SOS seen yet */ + cinfo->unread_marker = 0; /* no pending marker */ + marker->pub.saw_SOI = FALSE; /* set internal state too */ marker->pub.saw_SOF = FALSE; marker->pub.discarded_bytes = 0; marker->cur_marker = NULL; @@ -1283,7 +1283,7 @@ jinit_marker_reader (j_decompress_ptr cinfo) /* Create subobject in permanent pool */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_marker_reader)); + SIZEOF(my_marker_reader)); cinfo->marker = (struct jpeg_marker_reader *) marker; /* Initialize public method pointers */ marker->pub.reset_marker_reader = reset_marker_reader; @@ -1314,7 +1314,7 @@ jinit_marker_reader (j_decompress_ptr cinfo) GLOBAL(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit) + unsigned int length_limit) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; long maxlength; @@ -1363,7 +1363,7 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, GLOBAL(void) jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, - jpeg_marker_parser_method routine) + jpeg_marker_parser_method routine) { my_marker_ptr marker = (my_marker_ptr) cinfo->marker; diff --git a/jdmaster.c b/jdmaster.c index e1f9f9e7..b9f78fd0 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -25,7 +25,7 @@ typedef struct { struct jpeg_decomp_master pub; /* public fields */ - int pass_number; /* # of passes completed */ + int pass_number; /* # of passes completed */ boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ @@ -80,7 +80,7 @@ use_merged_upsample (j_decompress_ptr cinfo) cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size) return FALSE; /* ??? also need to test for upsample-time rescaling, when & if supported */ - return TRUE; /* by golly, it'll work... */ + return TRUE; /* by golly, it'll work... */ #else return FALSE; #endif @@ -292,10 +292,10 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) ci++, compptr++) { int ssize = cinfo->_min_DCT_scaled_size; while (ssize < DCTSIZE && - ((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) % - (compptr->h_samp_factor * ssize * 2) == 0) && - ((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) % - (compptr->v_samp_factor * ssize * 2) == 0)) { + ((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) % + (compptr->h_samp_factor * ssize * 2) == 0) && + ((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) % + (compptr->v_samp_factor * ssize * 2) == 0)) { ssize = ssize * 2; } #if JPEG_LIB_VERSION >= 70 @@ -313,12 +313,12 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) /* Size in samples, after IDCT scaling */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * - (long) (compptr->h_samp_factor * compptr->_DCT_scaled_size), - (long) (cinfo->max_h_samp_factor * DCTSIZE)); + (long) (compptr->h_samp_factor * compptr->_DCT_scaled_size), + (long) (cinfo->max_h_samp_factor * DCTSIZE)); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * - (long) (compptr->v_samp_factor * compptr->_DCT_scaled_size), - (long) (cinfo->max_v_samp_factor * DCTSIZE)); + (long) (compptr->v_samp_factor * compptr->_DCT_scaled_size), + (long) (cinfo->max_v_samp_factor * DCTSIZE)); } #else /* !IDCT_SCALING_SUPPORTED */ @@ -358,12 +358,12 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) case JCS_YCCK: cinfo->out_color_components = 4; break; - default: /* else must be same colorspace as in file */ + default: /* else must be same colorspace as in file */ cinfo->out_color_components = cinfo->num_components; break; } cinfo->output_components = (cinfo->quantize_colors ? 1 : - cinfo->out_color_components); + cinfo->out_color_components); /* See if upsampler will want to emit more than one row at a time */ if (use_merged_upsample(cinfo)) @@ -380,20 +380,20 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) * processes are inner loops and need to be as fast as possible. On most * machines, particularly CPUs with pipelines or instruction prefetch, * a (subscript-check-less) C table lookup - * x = sample_range_limit[x]; + * x = sample_range_limit[x]; * is faster than explicit tests - * if (x < 0) x = 0; - * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; + * if (x < 0) x = 0; + * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; * These processes all use a common table prepared by the routine below. * * For most steps we can mathematically guarantee that the initial value * of x is within MAXJSAMPLE+1 of the legal range, so a table running from * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial - * limiting step (just after the IDCT), a wildly out-of-range value is + * limiting step (just after the IDCT), a wildly out-of-range value is * possible if the input data is corrupt. To avoid any chance of indexing * off the end of memory and getting a bad-pointer trap, we perform the * post-IDCT limiting thus: - * x = range_limit[x & MASK]; + * x = range_limit[x & MASK]; * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit * samples. Under normal circumstances this is more than enough range and * a correct output will be generated; with bogus input data the mask will @@ -425,23 +425,23 @@ prepare_range_limit_table (j_decompress_ptr cinfo) table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); - table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ + (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ cinfo->sample_range_limit = table; /* First segment of "simple" table: limit[x] = 0 for x < 0 */ MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); /* Main part of "simple" table: limit[x] = x */ for (i = 0; i <= MAXJSAMPLE; i++) table[i] = (JSAMPLE) i; - table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ + table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ /* End of simple table, rest of first half of post-IDCT table */ for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) table[i] = MAXJSAMPLE; /* Second half of post-IDCT table */ MEMZERO(table + (2 * (MAXJSAMPLE+1)), - (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), - cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); + cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); } @@ -629,24 +629,24 @@ prepare_for_output_pass (j_decompress_ptr cinfo) if (cinfo->quantize_colors && cinfo->colormap == NULL) { /* Select new quantization method */ if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { - cinfo->cquantize = master->quantizer_2pass; - master->pub.is_dummy_pass = TRUE; + cinfo->cquantize = master->quantizer_2pass; + master->pub.is_dummy_pass = TRUE; } else if (cinfo->enable_1pass_quant) { - cinfo->cquantize = master->quantizer_1pass; + cinfo->cquantize = master->quantizer_1pass; } else { - ERREXIT(cinfo, JERR_MODE_CHANGE); + ERREXIT(cinfo, JERR_MODE_CHANGE); } } (*cinfo->idct->start_pass) (cinfo); (*cinfo->coef->start_output_pass) (cinfo); if (! cinfo->raw_data_out) { if (! master->using_merged_upsample) - (*cinfo->cconvert->start_pass) (cinfo); + (*cinfo->cconvert->start_pass) (cinfo); (*cinfo->upsample->start_pass) (cinfo); if (cinfo->quantize_colors) - (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); + (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); (*cinfo->post->start_pass) (cinfo, - (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); + (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); } } @@ -655,7 +655,7 @@ prepare_for_output_pass (j_decompress_ptr cinfo) if (cinfo->progress != NULL) { cinfo->progress->completed_passes = master->pass_number; cinfo->progress->total_passes = master->pass_number + - (master->pub.is_dummy_pass ? 2 : 1); + (master->pub.is_dummy_pass ? 2 : 1); /* In buffered-image mode, we assume one more output pass if EOI not * yet reached, but no more passes if EOI has been reached. */ @@ -722,7 +722,7 @@ jinit_master_decompress (j_decompress_ptr cinfo) master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_decomp_master)); + SIZEOF(my_decomp_master)); cinfo->master = (struct jpeg_decomp_master *) master; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; diff --git a/jdmerge.c b/jdmerge.c index cb1aa0a3..c669b179 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -17,19 +17,19 @@ * (ie, box filtering), we can save some work in color conversion by * calculating all the output pixels corresponding to a pair of chroma * samples at one time. In the conversion equations - * R = Y + K1 * Cr - * G = Y + K2 * Cb + K3 * Cr - * B = Y + K4 * Cb + * R = Y + K1 * Cr + * G = Y + K2 * Cb + K3 * Cr + * B = Y + K4 * Cb * only the Y term varies among the group of pixels corresponding to a pair * of chroma samples, so the rest of the terms can be calculated just once. * At typical sampling ratios, this eliminates half or three-quarters of the * multiplications needed for color conversion. * * This file currently provides implementations for the following cases: - * YCbCr => RGB color conversion only. - * Sampling ratios of 2h1v or 2h2v. - * No scaling needed at upsample time. - * Corner-aligned (non-CCIR601) sampling alignment. + * YCbCr => RGB color conversion only. + * Sampling ratios of 2h1v or 2h2v. + * No scaling needed at upsample time. + * Corner-aligned (non-CCIR601) sampling alignment. * Other special cases could be added, but in most applications these are * the only common cases. (For uncommon cases we fall back on the more * general code in jdsample.c and jdcolor.c.) @@ -47,18 +47,18 @@ /* Private subobject */ typedef struct { - struct jpeg_upsampler pub; /* public fields */ + struct jpeg_upsampler pub; /* public fields */ /* Pointer to routine to do actual upsampling/conversion of one row group */ JMETHOD(void, upmethod, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf)); + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf)); /* Private state for YCC->RGB conversion */ - int * Cr_r_tab; /* => table for Cr to R conversion */ - int * Cb_b_tab; /* => table for Cb to B conversion */ - INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + int * Cr_r_tab; /* => table for Cr to R conversion */ + int * Cb_b_tab; /* => table for Cb to B conversion */ + INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + INT32 * Cb_g_tab; /* => table for Cb to G conversion */ /* For 2:1 vertical sampling, we produce two output rows at a time. * We need a "spare" row buffer to hold the second output row if the @@ -66,17 +66,17 @@ typedef struct { * to discard the dummy last row if the image height is odd. */ JSAMPROW spare_row; - boolean spare_full; /* T if spare buffer is occupied */ + boolean spare_full; /* T if spare buffer is occupied */ - JDIMENSION out_row_width; /* samples per output row */ - JDIMENSION rows_to_go; /* counts rows remaining in image */ + JDIMENSION out_row_width; /* samples per output row */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ } my_upsampler; typedef my_upsampler * my_upsample_ptr; -#define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L<Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * SIZEOF(int)); upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * SIZEOF(int)); upsample->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(INT32)); upsample->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ /* Cr=>R value is nearest int to 1.40200 * x */ upsample->Cr_r_tab[i] = (int) - RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); + RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); /* Cb=>B value is nearest int to 1.77200 * x */ upsample->Cb_b_tab[i] = (int) - RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); + RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); /* Cr=>G value is scaled-up -0.71414 * x */ upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x; /* Cb=>G value is scaled-up -0.34414 * x */ @@ -248,20 +248,20 @@ start_pass_merged_upsample (j_decompress_ptr cinfo) METHODDEF(void) merged_2v_upsample (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) /* 2:1 vertical sampling case: may need a spare row. */ { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; JSAMPROW work_ptrs[2]; - JDIMENSION num_rows; /* number of rows returned to caller */ + JDIMENSION num_rows; /* number of rows returned to caller */ if (upsample->spare_full) { /* If we have a spare row saved from a previous cycle, just return it. */ jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, - 1, upsample->out_row_width); + 1, upsample->out_row_width); num_rows = 1; upsample->spare_full = FALSE; } else { @@ -297,17 +297,17 @@ merged_2v_upsample (j_decompress_ptr cinfo, METHODDEF(void) merged_1v_upsample (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) /* 1:1 vertical sampling case: much easier, never need a spare row. */ { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; /* Just do the upsampling. */ (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, - output_buf + *out_row_ctr); + output_buf + *out_row_ctr); /* Adjust counts */ (*out_row_ctr)++; (*in_row_group_ctr)++; @@ -330,8 +330,8 @@ merged_1v_upsample (j_decompress_ptr cinfo, METHODDEF(void) h2v1_merged_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf) + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) { switch (cinfo->out_color_space) { case JCS_EXT_RGB: @@ -376,8 +376,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, METHODDEF(void) h2v2_merged_upsample (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf) + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) { switch (cinfo->out_color_space) { case JCS_EXT_RGB: @@ -431,7 +431,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); + SIZEOF(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_merged_upsample; upsample->pub.need_context_rows = FALSE; @@ -447,7 +447,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) /* Allocate a spare row buffer */ upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); + (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); } else { upsample->pub.upsample = merged_1v_upsample; if (jsimd_can_h2v1_merged_upsample()) diff --git a/jdphuff.c b/jdphuff.c index fa97aab6..783d8a8f 100644 --- a/jdphuff.c +++ b/jdphuff.c @@ -17,7 +17,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdhuff.h" /* Declarations shared with jdhuff.c */ +#include "jdhuff.h" /* Declarations shared with jdhuff.c */ #ifdef D_PROGRESSIVE_SUPPORTED @@ -30,8 +30,8 @@ */ typedef struct { - unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ - int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ + unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ + int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; /* This macro is to work around compilers with missing or broken @@ -44,11 +44,11 @@ typedef struct { #else #if MAX_COMPS_IN_SCAN == 4 #define ASSIGN_STATE(dest,src) \ - ((dest).EOBRUN = (src).EOBRUN, \ - (dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) + ((dest).EOBRUN = (src).EOBRUN, \ + (dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) #endif #endif @@ -59,11 +59,11 @@ typedef struct { /* These fields are loaded into local variables at start of each MCU. * In case of suspension, we exit WITHOUT updating them. */ - bitread_perm_state bitstate; /* Bit buffer at start of MCU */ - savable_state saved; /* Other state at start of MCU */ + bitread_perm_state bitstate; /* Bit buffer at start of MCU */ + savable_state saved; /* Other state at start of MCU */ /* These fields are NOT loaded into local working state. */ - unsigned int restarts_to_go; /* MCUs left in this restart interval */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ /* Pointers to derived tables (these workspaces have image lifespan) */ d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; @@ -75,13 +75,13 @@ typedef phuff_entropy_decoder * phuff_entropy_ptr; /* Forward declarations */ METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); /* @@ -117,7 +117,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo) if (cinfo->Al != cinfo->Ah-1) bad = TRUE; } - if (cinfo->Al > 13) /* need not check for < 0 */ + if (cinfo->Al > 13) /* need not check for < 0 */ bad = TRUE; /* Arguably the maximum Al value should be less than 13 for 8-bit precision, * but the spec doesn't say so, and we try to be liberal about what we @@ -127,7 +127,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo) */ if (bad) ERREXIT4(cinfo, JERR_BAD_PROGRESSION, - cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); + cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); /* Update progression status, and verify that scan order is legal. * Note that inter-scan inconsistencies are treated as warnings * not fatal errors ... not clear if this is right way to behave. @@ -140,7 +140,7 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo) for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; if (cinfo->Ah != expected) - WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); + WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); coef_bit_ptr[coefi] = cinfo->Al; } } @@ -164,15 +164,15 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo) * We may build same derived table more than once, but it's not expensive. */ if (is_DC_band) { - if (cinfo->Ah == 0) { /* DC refinement needs no table */ - tbl = compptr->dc_tbl_no; - jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, - & entropy->derived_tbls[tbl]); + if (cinfo->Ah == 0) { /* DC refinement needs no table */ + tbl = compptr->dc_tbl_no; + jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, + & entropy->derived_tbls[tbl]); } } else { tbl = compptr->ac_tbl_no; jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, - & entropy->derived_tbls[tbl]); + & entropy->derived_tbls[tbl]); /* remember the single active table */ entropy->ac_derived_tbl = entropy->derived_tbls[tbl]; } @@ -264,7 +264,7 @@ process_restart (j_decompress_ptr cinfo) /* * Huffman MCU decoding. * Each of these routines decodes and returns one MCU's worth of - * Huffman-compressed coefficients. + * Huffman-compressed coefficients. * The coefficients are reordered from zigzag order into natural array order, * but are not dequantized. * @@ -285,7 +285,7 @@ process_restart (j_decompress_ptr cinfo) METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; int Al = cinfo->Al; register int s, r; @@ -300,7 +300,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) - return FALSE; + return FALSE; } /* If we've run out of data, just leave the MCU set to zeroes. @@ -325,9 +325,9 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Section F.2.2.1: decode the DC coefficient difference */ HUFF_DECODE(s, br_state, tbl, return FALSE, label1); if (s) { - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); } /* Convert DC difference to actual value, update last_dc_val */ @@ -356,7 +356,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; int Se = cinfo->Se; int Al = cinfo->Al; @@ -370,7 +370,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) - return FALSE; + return FALSE; } /* If we've run out of data, just leave the MCU set to zeroes. @@ -381,49 +381,49 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Load up working state. * We can avoid loading/saving bitread state if in an EOB run. */ - EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ + EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ /* There is always only one block per MCU */ - if (EOBRUN > 0) /* if it's a band of zeroes... */ - EOBRUN--; /* ...process it now (we do nothing) */ + if (EOBRUN > 0) /* if it's a band of zeroes... */ + EOBRUN--; /* ...process it now (we do nothing) */ else { BITREAD_LOAD_STATE(cinfo,entropy->bitstate); block = MCU_data[0]; tbl = entropy->ac_derived_tbl; for (k = cinfo->Ss; k <= Se; k++) { - HUFF_DECODE(s, br_state, tbl, return FALSE, label2); - r = s >> 4; - s &= 15; - if (s) { - k += r; - CHECK_BIT_BUFFER(br_state, s, return FALSE); - r = GET_BITS(s); - s = HUFF_EXTEND(r, s); - /* Scale and output coefficient in natural (dezigzagged) order */ - (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al); - } else { - if (r == 15) { /* ZRL */ - k += 15; /* skip 15 zeroes in band */ - } else { /* EOBr, run length is 2^r + appended bits */ - EOBRUN = 1 << r; - if (r) { /* EOBr, r > 0 */ - CHECK_BIT_BUFFER(br_state, r, return FALSE); - r = GET_BITS(r); - EOBRUN += r; - } - EOBRUN--; /* this band is processed at this moment */ - break; /* force end-of-band */ - } - } + HUFF_DECODE(s, br_state, tbl, return FALSE, label2); + r = s >> 4; + s &= 15; + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + /* Scale and output coefficient in natural (dezigzagged) order */ + (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al); + } else { + if (r == 15) { /* ZRL */ + k += 15; /* skip 15 zeroes in band */ + } else { /* EOBr, run length is 2^r + appended bits */ + EOBRUN = 1 << r; + if (r) { /* EOBr, r > 0 */ + CHECK_BIT_BUFFER(br_state, r, return FALSE); + r = GET_BITS(r); + EOBRUN += r; + } + EOBRUN--; /* this band is processed at this moment */ + break; /* force end-of-band */ + } + } } BITREAD_SAVE_STATE(cinfo,entropy->bitstate); } /* Completed MCU, so update state */ - entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ + entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ } /* Account for restart interval (no-op if not using restarts) */ @@ -441,9 +441,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; - int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int blkn; JBLOCKROW block; BITREAD_STATE_VARS; @@ -452,7 +452,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) - return FALSE; + return FALSE; } /* Not worth the cycles to check insufficient_data here, @@ -490,11 +490,11 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) -{ +{ phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; int Se = cinfo->Se; - int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ - int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ + int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ register int s, k, r; unsigned int EOBRUN; JBLOCKROW block; @@ -508,7 +508,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) if (! process_restart(cinfo)) - return FALSE; + return FALSE; } /* If we've run out of data, don't modify the MCU. @@ -536,58 +536,58 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (EOBRUN == 0) { for (; k <= Se; k++) { - HUFF_DECODE(s, br_state, tbl, goto undoit, label3); - r = s >> 4; - s &= 15; - if (s) { - if (s != 1) /* size of new coef should always be 1 */ - WARNMS(cinfo, JWRN_HUFF_BAD_CODE); - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) - s = p1; /* newly nonzero coef is positive */ - else - s = m1; /* newly nonzero coef is negative */ - } else { - if (r != 15) { - EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ - if (r) { - CHECK_BIT_BUFFER(br_state, r, goto undoit); - r = GET_BITS(r); - EOBRUN += r; - } - break; /* rest of block is handled by EOB logic */ - } - /* note s = 0 for processing ZRL */ - } - /* Advance over already-nonzero coefs and r still-zero coefs, - * appending correction bits to the nonzeroes. A correction bit is 1 - * if the absolute value of the coefficient must be increased. - */ - do { - thiscoef = *block + jpeg_natural_order[k]; - if (*thiscoef != 0) { - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) { - if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ - if (*thiscoef >= 0) - *thiscoef += p1; - else - *thiscoef += m1; - } - } - } else { - if (--r < 0) - break; /* reached target zero coefficient */ - } - k++; - } while (k <= Se); - if (s) { - int pos = jpeg_natural_order[k]; - /* Output newly nonzero coefficient */ - (*block)[pos] = (JCOEF) s; - /* Remember its position in case we have to suspend */ - newnz_pos[num_newnz++] = pos; - } + HUFF_DECODE(s, br_state, tbl, goto undoit, label3); + r = s >> 4; + s &= 15; + if (s) { + if (s != 1) /* size of new coef should always be 1 */ + WARNMS(cinfo, JWRN_HUFF_BAD_CODE); + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) + s = p1; /* newly nonzero coef is positive */ + else + s = m1; /* newly nonzero coef is negative */ + } else { + if (r != 15) { + EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ + if (r) { + CHECK_BIT_BUFFER(br_state, r, goto undoit); + r = GET_BITS(r); + EOBRUN += r; + } + break; /* rest of block is handled by EOB logic */ + } + /* note s = 0 for processing ZRL */ + } + /* Advance over already-nonzero coefs and r still-zero coefs, + * appending correction bits to the nonzeroes. A correction bit is 1 + * if the absolute value of the coefficient must be increased. + */ + do { + thiscoef = *block + jpeg_natural_order[k]; + if (*thiscoef != 0) { + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) { + if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ + if (*thiscoef >= 0) + *thiscoef += p1; + else + *thiscoef += m1; + } + } + } else { + if (--r < 0) + break; /* reached target zero coefficient */ + } + k++; + } while (k <= Se); + if (s) { + int pos = jpeg_natural_order[k]; + /* Output newly nonzero coefficient */ + (*block)[pos] = (JCOEF) s; + /* Remember its position in case we have to suspend */ + newnz_pos[num_newnz++] = pos; + } } } @@ -598,18 +598,18 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) * if the absolute value of the coefficient must be increased. */ for (; k <= Se; k++) { - thiscoef = *block + jpeg_natural_order[k]; - if (*thiscoef != 0) { - CHECK_BIT_BUFFER(br_state, 1, goto undoit); - if (GET_BITS(1)) { - if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ - if (*thiscoef >= 0) - *thiscoef += p1; - else - *thiscoef += m1; - } - } - } + thiscoef = *block + jpeg_natural_order[k]; + if (*thiscoef != 0) { + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) { + if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ + if (*thiscoef >= 0) + *thiscoef += p1; + else + *thiscoef += m1; + } + } + } } /* Count one block completed in EOB run */ EOBRUN--; @@ -647,7 +647,7 @@ jinit_phuff_decoder (j_decompress_ptr cinfo) entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_decoder)); + SIZEOF(phuff_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass_phuff_decoder; @@ -659,9 +659,9 @@ jinit_phuff_decoder (j_decompress_ptr cinfo) /* Create progression status table */ cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components*DCTSIZE2*SIZEOF(int)); + cinfo->num_components*DCTSIZE2*SIZEOF(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; - for (ci = 0; ci < cinfo->num_components; ci++) + for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) *coef_bit_ptr++ = -1; } diff --git a/jdpostct.c b/jdpostct.c index 571563d7..aa2af07d 100644 --- a/jdpostct.c +++ b/jdpostct.c @@ -31,12 +31,12 @@ typedef struct { * For two-pass color quantization, we need a full-image buffer; * for one-pass operation, a strip buffer is sufficient. */ - jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */ - JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */ - JDIMENSION strip_height; /* buffer size in rows */ + jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */ + JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */ + JDIMENSION strip_height; /* buffer size in rows */ /* for two-pass mode only: */ - JDIMENSION starting_row; /* row # of first row in current strip */ - JDIMENSION next_row; /* index of next row to fill/empty in strip */ + JDIMENSION starting_row; /* row # of first row in current strip */ + JDIMENSION next_row; /* index of next row to fill/empty in strip */ } my_post_controller; typedef my_post_controller * my_post_ptr; @@ -44,24 +44,24 @@ typedef my_post_controller * my_post_ptr; /* Forward declarations */ 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)); + 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 - 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)); + 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 - 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)); + 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)); #endif @@ -84,9 +84,9 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) * allocate a strip buffer. Use the virtual-array buffer as workspace. */ if (post->buffer == NULL) { - post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - (JDIMENSION) 0, post->strip_height, TRUE); + post->buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, post->whole_image, + (JDIMENSION) 0, post->strip_height, TRUE); } } else { /* For single-pass processing without color quantization, @@ -124,10 +124,10 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) METHODDEF(void) post_process_1pass (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION num_rows, max_rows; @@ -139,11 +139,11 @@ post_process_1pass (j_decompress_ptr cinfo, max_rows = post->strip_height; num_rows = 0; (*cinfo->upsample->upsample) (cinfo, - input_buf, in_row_group_ctr, in_row_groups_avail, - post->buffer, &num_rows, max_rows); + input_buf, in_row_group_ctr, in_row_groups_avail, + post->buffer, &num_rows, max_rows); /* Quantize and emit data. */ (*cinfo->cquantize->color_quantize) (cinfo, - post->buffer, output_buf + *out_row_ctr, (int) num_rows); + post->buffer, output_buf + *out_row_ctr, (int) num_rows); *out_row_ctr += num_rows; } @@ -156,10 +156,10 @@ post_process_1pass (j_decompress_ptr cinfo, METHODDEF(void) post_process_prepass (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION old_next_row, num_rows; @@ -167,22 +167,22 @@ post_process_prepass (j_decompress_ptr cinfo, /* Reposition virtual buffer if at start of strip. */ if (post->next_row == 0) { post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - post->starting_row, post->strip_height, TRUE); + ((j_common_ptr) cinfo, post->whole_image, + post->starting_row, post->strip_height, TRUE); } /* Upsample some data (up to a strip height's worth). */ old_next_row = post->next_row; (*cinfo->upsample->upsample) (cinfo, - input_buf, in_row_group_ctr, in_row_groups_avail, - post->buffer, &post->next_row, post->strip_height); + input_buf, in_row_group_ctr, in_row_groups_avail, + post->buffer, &post->next_row, post->strip_height); /* Allow quantizer to scan new data. No data is emitted, */ /* but we advance out_row_ctr so outer loop can tell when we're done. */ if (post->next_row > old_next_row) { num_rows = post->next_row - old_next_row; (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row, - (JSAMPARRAY) NULL, (int) num_rows); + (JSAMPARRAY) NULL, (int) num_rows); *out_row_ctr += num_rows; } @@ -200,10 +200,10 @@ post_process_prepass (j_decompress_ptr cinfo, METHODDEF(void) post_process_2pass (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION num_rows, max_rows; @@ -211,8 +211,8 @@ post_process_2pass (j_decompress_ptr cinfo, /* Reposition virtual buffer if at start of strip. */ if (post->next_row == 0) { post->buffer = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, post->whole_image, - post->starting_row, post->strip_height, FALSE); + ((j_common_ptr) cinfo, post->whole_image, + post->starting_row, post->strip_height, FALSE); } /* Determine number of rows to emit. */ @@ -227,8 +227,8 @@ post_process_2pass (j_decompress_ptr cinfo, /* Quantize and emit data. */ (*cinfo->cquantize->color_quantize) (cinfo, - post->buffer + post->next_row, output_buf + *out_row_ctr, - (int) num_rows); + post->buffer + post->next_row, output_buf + *out_row_ctr, + (int) num_rows); *out_row_ctr += num_rows; /* Advance if we filled the strip. */ @@ -253,11 +253,11 @@ jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) post = (my_post_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_post_controller)); + SIZEOF(my_post_controller)); cinfo->post = (struct jpeg_d_post_controller *) post; post->pub.start_pass = start_pass_dpost; - post->whole_image = NULL; /* flag for no virtual arrays */ - post->buffer = NULL; /* flag for no strip buffer */ + post->whole_image = NULL; /* flag for no virtual arrays */ + post->buffer = NULL; /* flag for no strip buffer */ /* Create the quantization buffer, if needed */ if (cinfo->quantize_colors) { @@ -271,20 +271,20 @@ jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) /* We round up the number of rows to a multiple of the strip height. */ #ifdef QUANT_2PASS_SUPPORTED post->whole_image = (*cinfo->mem->request_virt_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - cinfo->output_width * cinfo->out_color_components, - (JDIMENSION) jround_up((long) cinfo->output_height, - (long) post->strip_height), - post->strip_height); + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + cinfo->output_width * cinfo->out_color_components, + (JDIMENSION) jround_up((long) cinfo->output_height, + (long) post->strip_height), + post->strip_height); #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif /* QUANT_2PASS_SUPPORTED */ } else { /* One-pass color quantization: just make a strip buffer. */ post->buffer = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->output_width * cinfo->out_color_components, - post->strip_height); + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->output_width * cinfo->out_color_components, + post->strip_height); } } } diff --git a/jdsample.c b/jdsample.c index 361b589e..3da1d064 100644 --- a/jdsample.c +++ b/jdsample.c @@ -30,13 +30,13 @@ /* Pointer to routine to upsample a single component */ typedef JMETHOD(void, upsample1_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); /* Private subobject */ typedef struct { - struct jpeg_upsampler pub; /* public fields */ + struct jpeg_upsampler pub; /* public fields */ /* Color conversion buffer. When using separate upsampling and color * conversion steps, this buffer holds one upsampled row group until it @@ -50,8 +50,8 @@ typedef struct { /* Per-component upsampling method pointers */ upsample1_ptr methods[MAX_COMPONENTS]; - int next_row_out; /* counts rows emitted from color_buf */ - JDIMENSION rows_to_go; /* counts rows remaining in image */ + int next_row_out; /* counts rows emitted from color_buf */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ /* Height of an input row group for each component. */ int rowgroup_height[MAX_COMPONENTS]; @@ -92,10 +92,10 @@ start_pass_upsample (j_decompress_ptr cinfo) METHODDEF(void) sep_upsample (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) + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; int ci; @@ -105,13 +105,13 @@ sep_upsample (j_decompress_ptr cinfo, /* Fill the conversion buffer, if it's empty */ if (upsample->next_row_out >= cinfo->max_v_samp_factor) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { + ci++, compptr++) { /* Invoke per-component upsample method. Notice we pass a POINTER * to color_buf[ci], so that fullsize_upsample can change it. */ (*upsample->methods[ci]) (cinfo, compptr, - input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]), - upsample->color_buf + ci); + input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]), + upsample->color_buf + ci); } upsample->next_row_out = 0; } @@ -123,7 +123,7 @@ sep_upsample (j_decompress_ptr cinfo, /* Not more than the distance to the end of the image. Need this test * in case the image height is not a multiple of max_v_samp_factor: */ - if (num_rows > upsample->rows_to_go) + if (num_rows > upsample->rows_to_go) num_rows = upsample->rows_to_go; /* And not more than what the client can accept: */ out_rows_avail -= *out_row_ctr; @@ -131,9 +131,9 @@ sep_upsample (j_decompress_ptr cinfo, num_rows = out_rows_avail; (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, - (JDIMENSION) upsample->next_row_out, - output_buf + *out_row_ctr, - (int) num_rows); + (JDIMENSION) upsample->next_row_out, + output_buf + *out_row_ctr, + (int) num_rows); /* Adjust counts */ *out_row_ctr += num_rows; @@ -160,7 +160,7 @@ sep_upsample (j_decompress_ptr cinfo, METHODDEF(void) fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { *output_data_ptr = input_data; } @@ -173,9 +173,9 @@ fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { - *output_data_ptr = NULL; /* safety check */ + *output_data_ptr = NULL; /* safety check */ } @@ -192,7 +192,7 @@ noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; JSAMPARRAY output_data = *output_data_ptr; @@ -213,15 +213,15 @@ int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr = output_data[outrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ + invalue = *inptr++; /* don't need GETJSAMPLE() here */ for (h = h_expand; h > 0; h--) { - *outptr++ = invalue; + *outptr++ = invalue; } } /* Generate any additional output rows by duplicating the first one */ if (v_expand > 1) { jcopy_sample_rows(output_data, outrow, output_data, outrow+1, - v_expand-1, cinfo->output_width); + v_expand-1, cinfo->output_width); } inrow++; outrow += v_expand; @@ -236,7 +236,7 @@ int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; @@ -249,7 +249,7 @@ h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr = output_data[inrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ + invalue = *inptr++; /* don't need GETJSAMPLE() here */ *outptr++ = invalue; *outptr++ = invalue; } @@ -264,7 +264,7 @@ h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; @@ -278,12 +278,12 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr = output_data[outrow]; outend = outptr + cinfo->output_width; while (outptr < outend) { - invalue = *inptr++; /* don't need GETJSAMPLE() here */ + invalue = *inptr++; /* don't need GETJSAMPLE() here */ *outptr++ = invalue; *outptr++ = invalue; } jcopy_sample_rows(output_data, outrow, output_data, outrow+1, - 1, cinfo->output_width); + 1, cinfo->output_width); inrow++; outrow += 2; } @@ -307,7 +307,7 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr, outptr; @@ -348,7 +348,7 @@ h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, METHODDEF(void) h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { JSAMPARRAY output_data = *output_data_ptr; register JSAMPROW inptr0, inptr1, outptr; @@ -365,10 +365,10 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, for (v = 0; v < 2; v++) { /* inptr0 points to nearest input row, inptr1 points to next nearest */ inptr0 = input_data[inrow]; - if (v == 0) /* next nearest is row above */ - inptr1 = input_data[inrow-1]; - else /* next nearest is row below */ - inptr1 = input_data[inrow+1]; + if (v == 0) /* next nearest is row above */ + inptr1 = input_data[inrow-1]; + else /* next nearest is row below */ + inptr1 = input_data[inrow+1]; outptr = output_data[outrow++]; /* Special case for first column */ @@ -379,12 +379,12 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, lastcolsum = thiscolsum; thiscolsum = nextcolsum; for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { - /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ - /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ - nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); - *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); - lastcolsum = thiscolsum; thiscolsum = nextcolsum; + /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ + /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ + nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + lastcolsum = thiscolsum; thiscolsum = nextcolsum; } /* Special case for last column */ @@ -411,13 +411,13 @@ jinit_upsampler (j_decompress_ptr cinfo) upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); + SIZEOF(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_upsample; upsample->pub.upsample = sep_upsample; upsample->pub.need_context_rows = FALSE; /* until we find out differently */ - if (cinfo->CCIR601_sampling) /* this isn't supported */ + if (cinfo->CCIR601_sampling) /* this isn't supported */ ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1, @@ -434,9 +434,9 @@ jinit_upsampler (j_decompress_ptr cinfo) * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. */ h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) / - cinfo->_min_DCT_scaled_size; + cinfo->_min_DCT_scaled_size; v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / - cinfo->_min_DCT_scaled_size; + cinfo->_min_DCT_scaled_size; h_out_group = cinfo->max_h_samp_factor; v_out_group = cinfo->max_v_samp_factor; upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ @@ -450,36 +450,36 @@ jinit_upsampler (j_decompress_ptr cinfo) upsample->methods[ci] = fullsize_upsample; need_buffer = FALSE; } else if (h_in_group * 2 == h_out_group && - v_in_group == v_out_group) { + v_in_group == v_out_group) { /* Special cases for 2h1v upsampling */ if (do_fancy && compptr->downsampled_width > 2) { - if (jsimd_can_h2v1_fancy_upsample()) - upsample->methods[ci] = jsimd_h2v1_fancy_upsample; - else - upsample->methods[ci] = h2v1_fancy_upsample; + if (jsimd_can_h2v1_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v1_fancy_upsample; + else + upsample->methods[ci] = h2v1_fancy_upsample; } else { - if (jsimd_can_h2v1_upsample()) - upsample->methods[ci] = jsimd_h2v1_upsample; - else - upsample->methods[ci] = h2v1_upsample; + if (jsimd_can_h2v1_upsample()) + upsample->methods[ci] = jsimd_h2v1_upsample; + else + upsample->methods[ci] = h2v1_upsample; } } else if (h_in_group * 2 == h_out_group && - v_in_group * 2 == v_out_group) { + v_in_group * 2 == v_out_group) { /* Special cases for 2h2v upsampling */ if (do_fancy && compptr->downsampled_width > 2) { - if (jsimd_can_h2v2_fancy_upsample()) - upsample->methods[ci] = jsimd_h2v2_fancy_upsample; - else - upsample->methods[ci] = h2v2_fancy_upsample; - upsample->pub.need_context_rows = TRUE; + if (jsimd_can_h2v2_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v2_fancy_upsample; + else + upsample->methods[ci] = h2v2_fancy_upsample; + upsample->pub.need_context_rows = TRUE; } else { - if (jsimd_can_h2v2_upsample()) - upsample->methods[ci] = jsimd_h2v2_upsample; - else - upsample->methods[ci] = h2v2_upsample; + if (jsimd_can_h2v2_upsample()) + upsample->methods[ci] = jsimd_h2v2_upsample; + else + upsample->methods[ci] = h2v2_upsample; } } else if ((h_out_group % h_in_group) == 0 && - (v_out_group % v_in_group) == 0) { + (v_out_group % v_in_group) == 0) { /* Generic integral-factors upsampling method */ upsample->methods[ci] = int_upsample; upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); @@ -488,10 +488,10 @@ jinit_upsampler (j_decompress_ptr cinfo) ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); if (need_buffer) { upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) jround_up((long) cinfo->output_width, - (long) cinfo->max_h_samp_factor), - (JDIMENSION) cinfo->max_v_samp_factor); + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) jround_up((long) cinfo->output_width, + (long) cinfo->max_h_samp_factor), + (JDIMENSION) cinfo->max_v_samp_factor); } } } diff --git a/jdtrans.c b/jdtrans.c index f0cd0aef..0a163c04 100644 --- a/jdtrans.c +++ b/jdtrans.c @@ -55,20 +55,20 @@ jpeg_read_coefficients (j_decompress_ptr cinfo) int retcode; /* Call progress monitor hook if present */ if (cinfo->progress != NULL) - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); /* Absorb some more input */ retcode = (*cinfo->inputctl->consume_input) (cinfo); if (retcode == JPEG_SUSPENDED) - return NULL; + return NULL; if (retcode == JPEG_REACHED_EOI) - break; + break; /* Advance progress counter if appropriate */ if (cinfo->progress != NULL && - (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { - if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { - /* startup underestimated number of scans; ratchet up one scan */ - cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; - } + (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { + if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { + /* startup underestimated number of scans; ratchet up one scan */ + cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; + } } } /* Set state so that jpeg_finish_decompress does the right thing */ @@ -84,7 +84,7 @@ jpeg_read_coefficients (j_decompress_ptr cinfo) } /* Oops, improper usage */ ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); - return NULL; /* keep compiler happy */ + return NULL; /* keep compiler happy */ } diff --git a/jerror.c b/jerror.c index 3da7be86..cd4c2a3c 100644 --- a/jerror.c +++ b/jerror.c @@ -28,7 +28,7 @@ #include #endif -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif @@ -42,10 +42,10 @@ */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_message_table jMsgTable +#define jpeg_std_message_table jMsgTable #endif -#define JMESSAGE(code,string) string , +#define JMESSAGE(code,string) string , const char * const jpeg_std_message_table[] = { #include "jerror.h" @@ -105,7 +105,7 @@ output_message (j_common_ptr cinfo) #ifdef USE_WINDOWS_MESSAGEBOX /* Display it in a message dialog box */ MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", - MB_OK | MB_ICONERROR); + MB_OK | MB_ICONERROR); #else /* Send it to stderr, adding a newline */ fprintf(stderr, "%s\n", buffer); @@ -167,8 +167,8 @@ format_message (j_common_ptr cinfo, char * buffer) if (msg_code > 0 && msg_code <= err->last_jpeg_message) { msgtext = err->jpeg_message_table[msg_code]; } else if (err->addon_message_table != NULL && - msg_code >= err->first_addon_message && - msg_code <= err->last_addon_message) { + msg_code >= err->first_addon_message && + msg_code <= err->last_addon_message) { msgtext = err->addon_message_table[msg_code - err->first_addon_message]; } @@ -193,10 +193,10 @@ format_message (j_common_ptr cinfo, char * buffer) sprintf(buffer, msgtext, err->msg_parm.s); else sprintf(buffer, msgtext, - err->msg_parm.i[0], err->msg_parm.i[1], - err->msg_parm.i[2], err->msg_parm.i[3], - err->msg_parm.i[4], err->msg_parm.i[5], - err->msg_parm.i[6], err->msg_parm.i[7]); + err->msg_parm.i[0], err->msg_parm.i[1], + err->msg_parm.i[2], err->msg_parm.i[3], + err->msg_parm.i[4], err->msg_parm.i[5], + err->msg_parm.i[6], err->msg_parm.i[7]); } @@ -213,17 +213,17 @@ reset_error_mgr (j_common_ptr cinfo) { cinfo->err->num_warnings = 0; /* trace_level is not reset since it is an application-supplied parameter */ - cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ + cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ } /* * Fill in the standard error-handling methods in a jpeg_error_mgr object. * Typical call is: - * struct jpeg_compress_struct cinfo; - * struct jpeg_error_mgr err; + * struct jpeg_compress_struct cinfo; + * struct jpeg_error_mgr err; * - * cinfo.err = jpeg_std_error(&err); + * cinfo.err = jpeg_std_error(&err); * after which the application may override some of the methods. */ @@ -236,16 +236,16 @@ jpeg_std_error (struct jpeg_error_mgr * err) err->format_message = format_message; err->reset_error_mgr = reset_error_mgr; - err->trace_level = 0; /* default = no tracing */ - err->num_warnings = 0; /* no warnings emitted yet */ - err->msg_code = 0; /* may be useful as a flag for "no error" */ + err->trace_level = 0; /* default = no tracing */ + err->num_warnings = 0; /* no warnings emitted yet */ + err->msg_code = 0; /* may be useful as a flag for "no error" */ /* Initialize message table pointers */ err->jpeg_message_table = jpeg_std_message_table; err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; err->addon_message_table = NULL; - err->first_addon_message = 0; /* for safety */ + err->first_addon_message = 0; /* for safety */ err->last_addon_message = 0; return err; diff --git a/jerror.h b/jerror.h index 275086e6..fab59b38 100644 --- a/jerror.h +++ b/jerror.h @@ -33,7 +33,7 @@ typedef enum { -#define JMESSAGE(code,string) code , +#define JMESSAGE(code,string) code , #endif /* JMAKE_ENUM_LIST */ @@ -42,7 +42,7 @@ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ /* For maintenance convenience, list is alphabetical by message code name */ #if JPEG_LIB_VERSION < 70 JMESSAGE(JERR_ARITH_NOTIMPL, - "Sorry, arithmetic coding is not implemented") + "Sorry, arithmetic coding is not implemented") #endif JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") @@ -55,26 +55,26 @@ JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") #if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_BAD_DROP_SAMPLING, - "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") #endif JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") 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") + "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") JMESSAGE(JERR_BAD_PROGRESSION, - "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") + "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") JMESSAGE(JERR_BAD_PROG_SCRIPT, - "Invalid progressive parameters at scan script entry %d") + "Invalid progressive parameters at scan script entry %d") 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") + "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") @@ -98,7 +98,7 @@ JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, - "Cannot transcode due to multiple use of quantization table %d") + "Cannot transcode due to multiple use of quantization table %d") JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_NOTIMPL, "Not implemented yet") @@ -113,7 +113,7 @@ JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") JMESSAGE(JERR_QUANT_COMPONENTS, - "Cannot quantize more than %d color components") + "Cannot quantize more than %d color components") JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") @@ -125,7 +125,7 @@ JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") JMESSAGE(JERR_TFILE_WRITE, - "Write failed on temporary file --- out of disk space?") + "Write failed on temporary file --- out of disk space?") JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") @@ -135,9 +135,9 @@ JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) JMESSAGE(JMSG_VERSION, JVERSION) JMESSAGE(JTRC_16BIT_TABLES, - "Caution: quantization tables are too coarse for baseline JPEG") + "Caution: quantization tables are too coarse for baseline JPEG") JMESSAGE(JTRC_ADOBE, - "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") + "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") @@ -150,9 +150,9 @@ JMESSAGE(JTRC_EOI, "End Of Image") JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, - "Warning: thumbnail image size does not match data length %u") + "Warning: thumbnail image size does not match data length %u") JMESSAGE(JTRC_JFIF_EXTENSION, - "JFIF extension marker: type 0x%02x, length %u") + "JFIF extension marker: type 0x%02x, length %u") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") @@ -163,7 +163,7 @@ JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") JMESSAGE(JTRC_RST, "RST%d") JMESSAGE(JTRC_SMOOTH_NOTIMPL, - "Smoothing not supported with nonstandard sampling ratios") + "Smoothing not supported with nonstandard sampling ratios") JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") JMESSAGE(JTRC_SOI, "Start of Image") @@ -173,13 +173,13 @@ JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") JMESSAGE(JTRC_THUMB_JPEG, - "JFIF extension marker: JPEG-compressed thumbnail image, length %u") + "JFIF extension marker: JPEG-compressed thumbnail image, length %u") JMESSAGE(JTRC_THUMB_PALETTE, - "JFIF extension marker: palette thumbnail image, length %u") + "JFIF extension marker: palette thumbnail image, length %u") JMESSAGE(JTRC_THUMB_RGB, - "JFIF extension marker: RGB thumbnail image, length %u") + "JFIF extension marker: RGB thumbnail image, length %u") JMESSAGE(JTRC_UNKNOWN_IDS, - "Unrecognized component IDs %d %d %d, assuming YCbCr") + "Unrecognized component IDs %d %d %d, assuming YCbCr") JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") @@ -187,15 +187,15 @@ JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") #endif JMESSAGE(JWRN_BOGUS_PROGRESSION, - "Inconsistent progression sequence for component %d coefficient %d") + "Inconsistent progression sequence for component %d coefficient %d") JMESSAGE(JWRN_EXTRANEOUS_DATA, - "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") + "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") JMESSAGE(JWRN_MUST_RESYNC, - "Corrupt JPEG data: found marker 0x%02x instead of RST%d") + "Corrupt JPEG data: found marker 0x%02x instead of RST%d") JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") #if JPEG_LIB_VERSION < 70 @@ -255,7 +255,7 @@ JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define MAKESTMT(stuff) do { stuff } while (0) +#define MAKESTMT(stuff) do { stuff } while (0) /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ #define WARNMS(cinfo,code) \ @@ -286,26 +286,26 @@ JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) #define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - _mp[4] = (p5); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ - _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ - _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ - (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) #define TRACEMSS(cinfo,lvl,code,str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ diff --git a/jfdctflt.c b/jfdctflt.c index 79d7a007..a8367c68 100644 --- a/jfdctflt.c +++ b/jfdctflt.c @@ -37,7 +37,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_FLOAT_SUPPORTED @@ -76,24 +76,24 @@ jpeg_fdct_float (FAST_FLOAT * data) tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; - + /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[4] = tmp10 - tmp11; - + z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ - dataptr[2] = tmp13 + z1; /* phase 5 */ + dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[6] = tmp13 - z1; - + /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; @@ -103,15 +103,15 @@ jpeg_fdct_float (FAST_FLOAT * data) z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ - z11 = tmp7 + z3; /* phase 5 */ + z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; - dataptr[5] = z13 + z2; /* phase 6 */ + dataptr[5] = z13 + z2; /* phase 6 */ dataptr[3] = z13 - z2; dataptr[1] = z11 + z4; dataptr[7] = z11 - z4; - dataptr += DCTSIZE; /* advance pointer to next row */ + dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ @@ -126,24 +126,24 @@ jpeg_fdct_float (FAST_FLOAT * data) tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - + /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*4] = tmp10 - tmp11; - + z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*6] = tmp13 - z1; - + /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; @@ -153,7 +153,7 @@ jpeg_fdct_float (FAST_FLOAT * data) z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ - z11 = tmp7 + z3; /* phase 5 */ + z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ @@ -161,7 +161,7 @@ jpeg_fdct_float (FAST_FLOAT * data) dataptr[DCTSIZE*1] = z11 + z4; dataptr[DCTSIZE*7] = z11 - z4; - dataptr++; /* advance pointer to next column */ + dataptr++; /* advance pointer to next column */ } } diff --git a/jfdctfst.c b/jfdctfst.c index ccb378a3..4936d476 100644 --- a/jfdctfst.c +++ b/jfdctfst.c @@ -33,7 +33,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_IFAST_SUPPORTED @@ -76,10 +76,10 @@ */ #if CONST_BITS == 8 -#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */ -#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */ -#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */ -#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */ +#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */ +#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */ +#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */ +#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */ #else #define FIX_0_382683433 FIX(0.382683433) #define FIX_0_541196100 FIX(0.541196100) @@ -132,24 +132,24 @@ jpeg_fdct_ifast (DCTELEM * data) tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; - + /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[4] = tmp10 - tmp11; - + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ - dataptr[2] = tmp13 + z1; /* phase 5 */ + dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[6] = tmp13 - z1; - + /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; @@ -159,15 +159,15 @@ jpeg_fdct_ifast (DCTELEM * data) z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ - z11 = tmp7 + z3; /* phase 5 */ + z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; - dataptr[5] = z13 + z2; /* phase 6 */ + dataptr[5] = z13 + z2; /* phase 6 */ dataptr[3] = z13 - z2; dataptr[1] = z11 + z4; dataptr[7] = z11 - z4; - dataptr += DCTSIZE; /* advance pointer to next row */ + dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ @@ -182,24 +182,24 @@ jpeg_fdct_ifast (DCTELEM * data) tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - + /* Even part */ - - tmp10 = tmp0 + tmp3; /* phase 2 */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*4] = tmp10 - tmp11; - + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*6] = tmp13 - z1; - + /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp10 = tmp4 + tmp5; /* phase 2 */ tmp11 = tmp5 + tmp6; tmp12 = tmp6 + tmp7; @@ -209,7 +209,7 @@ jpeg_fdct_ifast (DCTELEM * data) z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ - z11 = tmp7 + z3; /* phase 5 */ + z11 = tmp7 + z3; /* phase 5 */ z13 = tmp7 - z3; dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ @@ -217,7 +217,7 @@ jpeg_fdct_ifast (DCTELEM * data) dataptr[DCTSIZE*1] = z11 + z4; dataptr[DCTSIZE*7] = z11 - z4; - dataptr++; /* advance pointer to next column */ + dataptr++; /* advance pointer to next column */ } } diff --git a/jfdctint.c b/jfdctint.c index 0a78b64a..14f486cd 100644 --- a/jfdctint.c +++ b/jfdctint.c @@ -26,7 +26,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_ISLOW_SUPPORTED @@ -79,7 +79,7 @@ #define PASS1_BITS 2 #else #define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus @@ -90,18 +90,18 @@ */ #if CONST_BITS == 13 -#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) @@ -160,36 +160,36 @@ jpeg_fdct_islow (DCTELEM * data) tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; - + /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". */ - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); - + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), - CONST_BITS-PASS1_BITS); + CONST_BITS-PASS1_BITS); dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), - CONST_BITS-PASS1_BITS); - + CONST_BITS-PASS1_BITS); + /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * cK represents cos(K*pi/16). * i0..i3 in the paper are tmp4..tmp7 here. */ - + z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - + tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -198,16 +198,16 @@ jpeg_fdct_islow (DCTELEM * data) z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); - - dataptr += DCTSIZE; /* advance pointer to next row */ + + dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. @@ -225,36 +225,36 @@ jpeg_fdct_islow (DCTELEM * data) tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - + /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". */ - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); - + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), - CONST_BITS+PASS1_BITS); + CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), - CONST_BITS+PASS1_BITS); - + CONST_BITS+PASS1_BITS); + /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * cK represents cos(K*pi/16). * i0..i3 in the paper are tmp4..tmp7 here. */ - + z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - + tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -263,20 +263,20 @@ jpeg_fdct_islow (DCTELEM * data) z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, - CONST_BITS+PASS1_BITS); + CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, - CONST_BITS+PASS1_BITS); + CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, - CONST_BITS+PASS1_BITS); + CONST_BITS+PASS1_BITS); dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, - CONST_BITS+PASS1_BITS); - - dataptr++; /* advance pointer to next column */ + CONST_BITS+PASS1_BITS); + + dataptr++; /* advance pointer to next column */ } } diff --git a/jidctflt.c b/jidctflt.c index 0188ce3d..c172ea1f 100644 --- a/jidctflt.c +++ b/jidctflt.c @@ -39,7 +39,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_FLOAT_SUPPORTED @@ -66,8 +66,8 @@ GLOBAL(void) jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FAST_FLOAT tmp10, tmp11, tmp12, tmp13; @@ -95,14 +95,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; @@ -111,13 +111,13 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ + + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -125,17 +125,17 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - tmp10 = tmp0 + tmp2; /* phase 3 */ + tmp10 = tmp0 + tmp2; /* phase 3 */ tmp11 = tmp0 - tmp2; - tmp13 = tmp1 + tmp3; /* phases 5-3 */ + tmp13 = tmp1 + tmp3; /* phases 5-3 */ tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */ - tmp0 = tmp10 + tmp13; /* phase 2 */ + tmp0 = tmp10 + tmp13; /* phase 2 */ tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - + /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); @@ -143,19 +143,19 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - z13 = tmp6 + tmp5; /* phase 6 */ + z13 = tmp6 + tmp5; /* phase 6 */ z10 = tmp6 - tmp5; z11 = tmp4 + tmp7; z12 = tmp4 - tmp7; - tmp7 = z11 + z13; /* phase 5 */ + tmp7 = z11 + z13; /* phase 5 */ tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ - tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; @@ -168,11 +168,11 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*4] = tmp3 + tmp4; wsptr[DCTSIZE*3] = tmp3 - tmp4; - inptr++; /* advance pointers to next column */ + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3. */ @@ -184,7 +184,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, * the simplification applies less often (typically 5% to 10% of the time). * And testing floats for zero is relatively expensive, so we don't bother. */ - + /* Even part */ tmp10 = wsptr[0] + wsptr[4]; @@ -219,23 +219,23 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage: scale down by a factor of 8 and range-limit */ outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ } } diff --git a/jidctfst.c b/jidctfst.c index dba4216f..cae22b9a 100644 --- a/jidctfst.c +++ b/jidctfst.c @@ -35,7 +35,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_IFAST_SUPPORTED @@ -78,7 +78,7 @@ #define PASS1_BITS 2 #else #define CONST_BITS 8 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus @@ -89,10 +89,10 @@ */ #if CONST_BITS == 8 -#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ -#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ -#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ -#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ +#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ +#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ +#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ +#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ #else #define FIX_1_082392200 FIX(1.082392200) #define FIX_1_414213562 FIX(1.414213562) @@ -129,7 +129,7 @@ #define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval)) #else #define DEQUANTIZE(coef,quantval) \ - DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS) + DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS) #endif @@ -138,11 +138,11 @@ */ #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS DCTELEM ishift_temp; +#define ISHIFT_TEMPS DCTELEM ishift_temp; #if BITS_IN_JSAMPLE == 8 -#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ +#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ #else -#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ +#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ #endif #define IRIGHT_SHIFT(x,shft) \ ((ishift_temp = (x)) < 0 ? \ @@ -150,7 +150,7 @@ (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif #ifdef USE_ACCURATE_ROUNDING @@ -166,8 +166,8 @@ GLOBAL(void) jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; DCTELEM tmp10, tmp11, tmp12, tmp13; @@ -178,9 +178,9 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[DCTSIZE2]; /* buffers data between passes */ - SHIFT_TEMPS /* for DESCALE */ - ISHIFT_TEMPS /* for IDESCALE */ + int workspace[DCTSIZE2]; /* buffers data between passes */ + SHIFT_TEMPS /* for DESCALE */ + ISHIFT_TEMPS /* for IDESCALE */ /* Pass 1: process columns from input, store into work array. */ @@ -196,11 +196,11 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -212,13 +212,13 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ + + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -226,17 +226,17 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - tmp10 = tmp0 + tmp2; /* phase 3 */ + tmp10 = tmp0 + tmp2; /* phase 3 */ tmp11 = tmp0 - tmp2; - tmp13 = tmp1 + tmp3; /* phases 5-3 */ + tmp13 = tmp1 + tmp3; /* phases 5-3 */ tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ - tmp0 = tmp10 + tmp13; /* phase 2 */ + tmp0 = tmp10 + tmp13; /* phase 2 */ tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - + /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); @@ -244,19 +244,19 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); - z13 = tmp6 + tmp5; /* phase 6 */ + z13 = tmp6 + tmp5; /* phase 6 */ z10 = tmp6 - tmp5; z11 = tmp4 + tmp7; z12 = tmp4 - tmp7; - tmp7 = z11 + z13; /* phase 5 */ + tmp7 = z11 + z13; /* phase 5 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ - tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; @@ -269,11 +269,11 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); - inptr++; /* advance pointers to next column */ + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ @@ -288,14 +288,14 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, * test takes more time than it's worth. In that case this section * may be commented out. */ - + #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - + & RANGE_MASK]; + outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; @@ -305,11 +305,11 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr[6] = dcval; outptr[7] = dcval; - wsptr += DCTSIZE; /* advance pointer to next row */ + wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif - + /* Even part */ tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); @@ -317,7 +317,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) - - tmp13; + - tmp13; tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; @@ -331,37 +331,37 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; - tmp7 = z11 + z13; /* phase 5 */ + tmp7 = z11 + z13; /* phase 5 */ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ - tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 + tmp5; /* Final output stage: scale down by a factor of 8 and range-limit */ outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) - & RANGE_MASK]; + & RANGE_MASK]; - wsptr += DCTSIZE; /* advance pointer to next row */ + wsptr += DCTSIZE; /* advance pointer to next row */ } } diff --git a/jidctint.c b/jidctint.c index 77d81215..688fd224 100644 --- a/jidctint.c +++ b/jidctint.c @@ -50,7 +50,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef DCT_ISLOW_SUPPORTED @@ -101,7 +101,7 @@ #define PASS1_BITS 2 #else #define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus @@ -112,18 +112,18 @@ */ #if CONST_BITS == 13 -#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) @@ -168,8 +168,8 @@ GLOBAL(void) jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp3; INT32 tmp10, tmp11, tmp12, tmp13; @@ -180,7 +180,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[DCTSIZE2]; /* buffers data between passes */ + int workspace[DCTSIZE2]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -199,14 +199,14 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && - inptr[DCTSIZE*7] == 0) { + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; @@ -215,49 +215,49 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - - inptr++; /* advance pointers to next column */ + + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); - + z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); tmp0 = (z2 + z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS; - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - + z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - + tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -266,17 +266,17 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); @@ -285,12 +285,12 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - - inptr++; /* advance pointers to next column */ + + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ /* Note that we must descale the results by a factor of 8 == 2**3, */ /* and also undo the PASS1_BITS scaling. */ @@ -305,14 +305,14 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, * test takes more time than it's worth. In that case this section * may be commented out. */ - + #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - + & RANGE_MASK]; + outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; @@ -322,44 +322,44 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, outptr[6] = dcval; outptr[7] = dcval; - wsptr += DCTSIZE; /* advance pointer to next row */ + wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif - + /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; - + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); - + tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; - + tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - + /* Odd part per figure 8; the matrix is unitary and hence its * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - + tmp0 = (INT32) wsptr[7]; tmp1 = (INT32) wsptr[5]; tmp2 = (INT32) wsptr[3]; tmp3 = (INT32) wsptr[1]; - + z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - + tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ @@ -368,43 +368,43 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ - + z3 += z5; z4 += z5; - + tmp0 += z1 + z3; tmp1 += z2 + z4; tmp2 += z2 + z3; tmp3 += z1 + z4; - + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ } } @@ -421,8 +421,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; INT32 z1, z2, z3; @@ -432,7 +432,7 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[7*7]; /* buffers data between passes */ + int workspace[7*7]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -534,28 +534,28 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 7; /* advance pointer to next row */ + wsptr += 7; /* advance pointer to next row */ } } @@ -570,8 +570,8 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; INT32 z1, z2, z3; @@ -581,7 +581,7 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[6*6]; /* buffers data between passes */ + int workspace[6*6]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -658,25 +658,25 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 6; /* advance pointer to next row */ + wsptr += 6; /* advance pointer to next row */ } } @@ -691,8 +691,8 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp10, tmp11, tmp12; INT32 z1, z2, z3; @@ -702,7 +702,7 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[5*5]; /* buffers data between passes */ + int workspace[5*5]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -776,22 +776,22 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 5; /* advance pointer to next row */ + wsptr += 5; /* advance pointer to next row */ } } @@ -806,8 +806,8 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp2, tmp10, tmp12; JCOEFPTR inptr; @@ -816,7 +816,7 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[3*3]; /* buffers data between passes */ + int workspace[3*3]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -872,16 +872,16 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 3; /* advance pointer to next row */ + wsptr += 3; /* advance pointer to next row */ } } @@ -896,8 +896,8 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; INT32 z1, z2, z3, z4; @@ -907,7 +907,7 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*9]; /* buffers data between passes */ + int workspace[8*9]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1025,34 +1025,34 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -1067,8 +1067,8 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14; INT32 tmp20, tmp21, tmp22, tmp23, tmp24; @@ -1079,7 +1079,7 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*10]; /* buffers data between passes */ + int workspace[8*10]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1101,7 +1101,7 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 = z3 - z2; tmp22 = RIGHT_SHIFT(z3 - ((z1 - z2) << 1), /* c0 = (c4-c8)*2 */ - CONST_BITS-PASS1_BITS); + CONST_BITS-PASS1_BITS); z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); @@ -1217,37 +1217,37 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -1262,8 +1262,8 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; @@ -1274,7 +1274,7 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*11]; /* buffers data between passes */ + int workspace[8*11]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1301,13 +1301,13 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, z4 -= z2; tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ tmp21 = tmp20 + tmp23 + tmp25 - - MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ + MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ tmp24 += tmp25; tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ - MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ + MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ /* Odd part */ @@ -1323,7 +1323,7 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ tmp10 = tmp11 + tmp12 + tmp13 - - MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ + MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ @@ -1331,8 +1331,8 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 += z1; tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ - MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ - MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ + MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ + MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ /* Final output stage */ @@ -1372,13 +1372,13 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, z4 -= z2; tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ tmp21 = tmp20 + tmp23 + tmp25 - - MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ + MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ tmp24 += tmp25; tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ - MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ + MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ /* Odd part */ @@ -1394,7 +1394,7 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ tmp10 = tmp11 + tmp12 + tmp13 - - MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ + MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ @@ -1402,46 +1402,46 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 += z1; tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ - MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ - MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ + MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ + MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -1456,8 +1456,8 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; @@ -1468,7 +1468,7 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*12]; /* buffers data between passes */ + int workspace[8*12]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1529,7 +1529,7 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ - MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ + MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ z1 -= z4; z2 -= z3; @@ -1610,7 +1610,7 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ - MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ + MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ z1 -= z4; z2 -= z3; @@ -1621,43 +1621,43 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -1672,8 +1672,8 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; @@ -1684,7 +1684,7 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*13]; /* buffers data between passes */ + int workspace[8*13]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1739,7 +1739,7 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp15 = z1 + z4; tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ tmp10 = tmp11 + tmp12 + tmp13 - - MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ + MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ @@ -1751,11 +1751,11 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp13 += tmp14; tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ - MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ + MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ tmp14 += z1; tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ - MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ + MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ /* Final output stage */ @@ -1825,7 +1825,7 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp15 = z1 + z4; tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ tmp10 = tmp11 + tmp12 + tmp13 - - MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ + MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ @@ -1837,55 +1837,55 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp13 += tmp14; tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ - MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ + MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ tmp14 += z1; tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ - MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ + MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -1900,8 +1900,8 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; @@ -1912,7 +1912,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*14]; /* buffers data between passes */ + int workspace[8*14]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -1937,7 +1937,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp12 = z1 - z4; tmp23 = RIGHT_SHIFT(z1 - ((z2 + z3 - z4) << 1), /* c0 = (c4+c12-c8)*2 */ - CONST_BITS-PASS1_BITS); + CONST_BITS-PASS1_BITS); z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); @@ -1947,7 +1947,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ - MULTIPLY(z2, FIX(1.378756276)); /* c2 */ + MULTIPLY(z2, FIX(1.378756276)); /* c2 */ tmp20 = tmp10 + tmp13; tmp26 = tmp10 - tmp13; @@ -2031,7 +2031,7 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ - MULTIPLY(z2, FIX(1.378756276)); /* c2 */ + MULTIPLY(z2, FIX(1.378756276)); /* c2 */ tmp20 = tmp10 + tmp13; tmp26 = tmp10 - tmp13; @@ -2069,49 +2069,49 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -2126,8 +2126,8 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; @@ -2138,7 +2138,7 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*15]; /* buffers data between passes */ + int workspace[8*15]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -2308,52 +2308,52 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } @@ -2368,8 +2368,8 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; @@ -2380,7 +2380,7 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[8*16]; /* buffers data between passes */ + int workspace[8*16]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -2441,9 +2441,9 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ tmp0 = tmp1 + tmp2 + tmp3 - - MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ + MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ tmp13 = tmp10 + tmp11 + tmp12 - - MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ + MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ @@ -2541,9 +2541,9 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ tmp0 = tmp1 + tmp2 + tmp3 - - MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ + MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ tmp13 = tmp10 + tmp11 + tmp12 - - MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ + MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ @@ -2567,55 +2567,55 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage */ outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13, - CONST_BITS+PASS1_BITS+3) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; - wsptr += 8; /* advance pointer to next row */ + wsptr += 8; /* advance pointer to next row */ } } diff --git a/jidctred.c b/jidctred.c index 421f3c7c..2b385f86 100644 --- a/jidctred.c +++ b/jidctred.c @@ -23,7 +23,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jdct.h" /* Private declarations for DCT subsystem */ #ifdef IDCT_SCALING_SUPPORTED @@ -44,7 +44,7 @@ #define PASS1_BITS 2 #else #define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif /* Some C compilers fail to reduce "FIX(constant)" at compile time, thus @@ -55,20 +55,20 @@ */ #if CONST_BITS == 13 -#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ -#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ -#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ -#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ -#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ -#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ +#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ +#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ +#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ +#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ +#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ +#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ #else #define FIX_0_211164243 FIX(0.211164243) #define FIX_0_509795579 FIX(0.509795579) @@ -116,8 +116,8 @@ GLOBAL(void) jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp2, tmp10, tmp12; INT32 z1, z2, z3, z4; @@ -127,7 +127,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[DCTSIZE*4]; /* buffers data between passes */ + int workspace[DCTSIZE*4]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -140,57 +140,57 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, if (ctr == DCTSIZE-4) continue; if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && - inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && - inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && + inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero; we need not examine term 4 for 4x4 output */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*3] = dcval; - + continue; } - + /* Even part */ - + tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 <<= (CONST_BITS+1); - + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865); - + tmp10 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; - + /* Odd part */ - + z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - + tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ - + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ - + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ - + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ - + + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ - + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ - + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ - + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ /* Final output stage */ - + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); } - + /* Pass 2: process 4 rows from work array, store into output array. */ wsptr = workspace; @@ -200,64 +200,64 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && - wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - + & RANGE_MASK]; + outptr[0] = dcval; outptr[1] = dcval; outptr[2] = dcval; outptr[3] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ + + wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif - + /* Even part */ - + tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); - + tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) - + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); - + + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); + tmp10 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; - + /* Odd part */ - + z1 = (INT32) wsptr[7]; z2 = (INT32) wsptr[5]; z3 = (INT32) wsptr[3]; z4 = (INT32) wsptr[1]; - + tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ - + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ - + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ - + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ - + + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ - + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ - + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ - + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ /* Final output stage */ - + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0, - CONST_BITS+PASS1_BITS+3+1) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ } } @@ -269,8 +269,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { INT32 tmp0, tmp10, z1; JCOEFPTR inptr; @@ -279,7 +279,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; - int workspace[DCTSIZE*2]; /* buffers data between passes */ + int workspace[DCTSIZE*2]; /* buffers data between passes */ SHIFT_TEMPS /* Pass 1: process columns from input, store into work array. */ @@ -292,21 +292,21 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6) continue; if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 && - inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; - + continue; } - + /* Even part */ - + z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp10 = z1 << (CONST_BITS+2); - + /* Odd part */ z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); @@ -319,11 +319,11 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ /* Final output stage */ - + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); } - + /* Pass 2: process 2 rows from work array, store into output array. */ wsptr = workspace; @@ -335,37 +335,37 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { /* AC terms all zero */ JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) - & RANGE_MASK]; - + & RANGE_MASK]; + outptr[0] = dcval; outptr[1] = dcval; - - wsptr += DCTSIZE; /* advance pointer to next row */ + + wsptr += DCTSIZE; /* advance pointer to next row */ continue; } #endif - + /* Even part */ - + tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); - + /* Odd part */ tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ - + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ - + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ - + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ + + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ + + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ /* Final output stage */ - + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0, - CONST_BITS+PASS1_BITS+3+2) - & RANGE_MASK]; + CONST_BITS+PASS1_BITS+3+2) + & RANGE_MASK]; outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0, - CONST_BITS+PASS1_BITS+3+2) - & RANGE_MASK]; - - wsptr += DCTSIZE; /* advance pointer to next row */ + CONST_BITS+PASS1_BITS+3+2) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ } } @@ -377,8 +377,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col) + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) { int dcval; ISLOW_MULT_TYPE * quantptr; diff --git a/jinclude.h b/jinclude.h index 0a4f1514..b14a3fc0 100644 --- a/jinclude.h +++ b/jinclude.h @@ -17,8 +17,8 @@ /* Include auto-config file to find out which system include files we need. */ -#include "jconfig.h" /* auto configuration options */ -#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ +#include "jconfig.h" /* auto configuration options */ +#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ /* * We need the NULL macro and size_t typedef. @@ -58,14 +58,14 @@ #ifdef NEED_BSD_STRINGS #include -#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) -#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) +#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) +#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) #else /* not BSD, assume ANSI/SysV string lib */ #include -#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) -#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) +#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) +#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) #endif @@ -77,7 +77,7 @@ * we always use this SIZEOF() macro in place of using sizeof() directly. */ -#define SIZEOF(object) ((size_t) sizeof(object)) +#define SIZEOF(object) ((size_t) sizeof(object)) /* * The modules that use fread() and fwrite() always invoke them through diff --git a/jmemmgr.c b/jmemmgr.c index cf32524e..15b6325f 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -25,13 +25,13 @@ */ #define JPEG_INTERNALS -#define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ +#define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ #include "jinclude.h" #include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ +#include "jmemsys.h" /* import the system-dependent declarations */ #ifndef NO_GETENV -#ifndef HAVE_STDLIB_H /* should declare getenv() */ +#ifndef HAVE_STDLIB_H /* should declare getenv() */ extern char * getenv JPP((const char * name)); #endif #endif @@ -78,7 +78,7 @@ round_up_pow2 (size_t a, size_t b) * such a compiler. */ -#ifndef ALIGN_SIZE /* so can override from jconfig.h */ +#ifndef ALIGN_SIZE /* so can override from jconfig.h */ #ifndef WITH_SIMD #define ALIGN_SIZE SIZEOF(double) #else @@ -98,17 +98,17 @@ round_up_pow2 (size_t a, size_t b) typedef struct small_pool_struct * small_pool_ptr; typedef struct small_pool_struct { - small_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ + small_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ } small_pool_hdr; typedef struct large_pool_struct FAR * large_pool_ptr; typedef struct large_pool_struct { - large_pool_ptr next; /* next in list of pools */ - size_t bytes_used; /* how many bytes already used within pool */ - size_t bytes_left; /* bytes still available in this pool */ + large_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ } large_pool_hdr; /* @@ -116,7 +116,7 @@ typedef struct large_pool_struct { */ typedef struct { - struct jpeg_memory_mgr pub; /* public fields */ + struct jpeg_memory_mgr pub; /* public fields */ /* Each pool identifier (lifetime class) names a linked list of pools. */ small_pool_ptr small_list[JPOOL_NUMPOOLS]; @@ -136,7 +136,7 @@ typedef struct { /* alloc_sarray and alloc_barray set this value for use by virtual * array routines. */ - JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */ + JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */ } my_memory_mgr; typedef my_memory_mgr * my_mem_ptr; @@ -150,39 +150,39 @@ typedef my_memory_mgr * my_mem_ptr; */ struct jvirt_sarray_control { - JSAMPARRAY mem_buffer; /* => the in-memory buffer */ - JDIMENSION rows_in_array; /* total virtual array height */ - JDIMENSION samplesperrow; /* width of array (and of memory buffer) */ - JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */ - JDIMENSION rows_in_mem; /* height of memory buffer */ - JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ - JDIMENSION cur_start_row; /* first logical row # in the buffer */ - JDIMENSION first_undef_row; /* row # of first uninitialized row */ - boolean pre_zero; /* pre-zero mode requested? */ - boolean dirty; /* do current buffer contents need written? */ - boolean b_s_open; /* is backing-store data valid? */ - jvirt_sarray_ptr next; /* link to next virtual sarray control block */ - backing_store_info b_s_info; /* System-dependent control info */ + JSAMPARRAY mem_buffer; /* => the in-memory buffer */ + JDIMENSION rows_in_array; /* total virtual array height */ + JDIMENSION samplesperrow; /* width of array (and of memory buffer) */ + JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */ + JDIMENSION rows_in_mem; /* height of memory buffer */ + JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ + JDIMENSION cur_start_row; /* first logical row # in the buffer */ + JDIMENSION first_undef_row; /* row # of first uninitialized row */ + boolean pre_zero; /* pre-zero mode requested? */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + jvirt_sarray_ptr next; /* link to next virtual sarray control block */ + backing_store_info b_s_info; /* System-dependent control info */ }; struct jvirt_barray_control { - JBLOCKARRAY mem_buffer; /* => the in-memory buffer */ - JDIMENSION rows_in_array; /* total virtual array height */ - JDIMENSION blocksperrow; /* width of array (and of memory buffer) */ - JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */ - JDIMENSION rows_in_mem; /* height of memory buffer */ - JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ - JDIMENSION cur_start_row; /* first logical row # in the buffer */ - JDIMENSION first_undef_row; /* row # of first uninitialized row */ - boolean pre_zero; /* pre-zero mode requested? */ - boolean dirty; /* do current buffer contents need written? */ - boolean b_s_open; /* is backing-store data valid? */ - jvirt_barray_ptr next; /* link to next virtual barray control block */ - backing_store_info b_s_info; /* System-dependent control info */ + JBLOCKARRAY mem_buffer; /* => the in-memory buffer */ + JDIMENSION rows_in_array; /* total virtual array height */ + JDIMENSION blocksperrow; /* width of array (and of memory buffer) */ + JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */ + JDIMENSION rows_in_mem; /* height of memory buffer */ + JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ + JDIMENSION cur_start_row; /* first logical row # in the buffer */ + JDIMENSION first_undef_row; /* row # of first uninitialized row */ + boolean pre_zero; /* pre-zero mode requested? */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + jvirt_barray_ptr next; /* link to next virtual barray control block */ + backing_store_info b_s_info; /* System-dependent control info */ }; -#ifdef MEM_STATS /* optional extra stuff for statistics */ +#ifdef MEM_STATS /* optional extra stuff for statistics */ LOCAL(void) print_mem_stats (j_common_ptr cinfo, int pool_id) @@ -196,19 +196,19 @@ print_mem_stats (j_common_ptr cinfo, int pool_id) * This is helpful because message parm array can't handle longs. */ fprintf(stderr, "Freeing pool %d, total space = %ld\n", - pool_id, mem->total_space_allocated); + pool_id, mem->total_space_allocated); for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; lhdr_ptr = lhdr_ptr->next) { fprintf(stderr, " Large chunk used %ld\n", - (long) lhdr_ptr->bytes_used); + (long) lhdr_ptr->bytes_used); } for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; shdr_ptr = shdr_ptr->next) { fprintf(stderr, " Small chunk used %ld free %ld\n", - (long) shdr_ptr->bytes_used, - (long) shdr_ptr->bytes_left); + (long) shdr_ptr->bytes_used, + (long) shdr_ptr->bytes_left); } } @@ -221,7 +221,7 @@ out_of_memory (j_common_ptr cinfo, int which) /* If we compiled MEM_STATS support, report alloc requests before dying */ { #ifdef MEM_STATS - cinfo->err->trace_level = 2; /* force self_destruct to report stats */ + cinfo->err->trace_level = 2; /* force self_destruct to report stats */ #endif ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which); } @@ -244,19 +244,19 @@ out_of_memory (j_common_ptr cinfo, int which) * adjustment. */ -static const size_t first_pool_slop[JPOOL_NUMPOOLS] = +static const size_t first_pool_slop[JPOOL_NUMPOOLS] = { - 1600, /* first PERMANENT pool */ - 16000 /* first IMAGE pool */ + 1600, /* first PERMANENT pool */ + 16000 /* first IMAGE pool */ }; -static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = +static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = { - 0, /* additional PERMANENT pools */ - 5000 /* additional IMAGE pools */ + 0, /* additional PERMANENT pools */ + 5000 /* additional IMAGE pools */ }; -#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ +#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ METHODDEF(void *) @@ -278,16 +278,16 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Check for unsatisfiable request (do now to ensure no overflow below) */ if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) - out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ + out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ /* See if space is available in any existing pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ prev_hdr_ptr = NULL; hdr_ptr = mem->small_list[pool_id]; while (hdr_ptr != NULL) { if (hdr_ptr->bytes_left >= sizeofobject) - break; /* found pool with enough space */ + break; /* found pool with enough space */ prev_hdr_ptr = hdr_ptr; hdr_ptr = hdr_ptr->next; } @@ -296,7 +296,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) if (hdr_ptr == NULL) { /* min_request is what we need now, slop is what will be leftover */ min_request = SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1; - if (prev_hdr_ptr == NULL) /* first pool in class? */ + if (prev_hdr_ptr == NULL) /* first pool in class? */ slop = first_pool_slop[pool_id]; else slop = extra_pool_slop[pool_id]; @@ -307,17 +307,17 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) for (;;) { hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop); if (hdr_ptr != NULL) - break; + break; slop /= 2; - if (slop < MIN_SLOP) /* give up when it gets real small */ - out_of_memory(cinfo, 2); /* jpeg_get_small failed */ + if (slop < MIN_SLOP) /* give up when it gets real small */ + out_of_memory(cinfo, 2); /* jpeg_get_small failed */ } mem->total_space_allocated += min_request + slop; /* Success, initialize the new pool header and add to end of list */ hdr_ptr->next = NULL; hdr_ptr->bytes_used = 0; hdr_ptr->bytes_left = sizeofobject + slop; - if (prev_hdr_ptr == NULL) /* first pool in class? */ + if (prev_hdr_ptr == NULL) /* first pool in class? */ mem->small_list[pool_id] = hdr_ptr; else prev_hdr_ptr->next = hdr_ptr; @@ -367,17 +367,17 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Check for unsatisfiable request (do now to ensure no overflow below) */ if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) - out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ + out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ /* Always make a new pool */ if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + - SIZEOF(large_pool_hdr) + - ALIGN_SIZE - 1); + SIZEOF(large_pool_hdr) + + ALIGN_SIZE - 1); if (hdr_ptr == NULL) - out_of_memory(cinfo, 4); /* jpeg_get_large failed */ + out_of_memory(cinfo, 4); /* jpeg_get_large failed */ mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr) + ALIGN_SIZE - 1; /* Success, initialize the new pool header and add to list */ @@ -417,7 +417,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) METHODDEF(JSAMPARRAY) alloc_sarray (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, JDIMENSION numrows) + JDIMENSION samplesperrow, JDIMENSION numrows) /* Allocate a 2-D sample array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -428,12 +428,12 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, /* Make sure each row is properly aligned */ if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0) - out_of_memory(cinfo, 5); /* safety check */ + out_of_memory(cinfo, 5); /* safety check */ samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE)); /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) samplesperrow * SIZEOF(JSAMPLE)); + ((long) samplesperrow * SIZEOF(JSAMPLE)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) @@ -444,15 +444,15 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, /* Get space for row pointers (small object) */ result = (JSAMPARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JSAMPROW))); + (size_t) (numrows * SIZEOF(JSAMPROW))); /* Get the rows themselves (large objects) */ currow = 0; while (currow < numrows) { rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JSAMPROW) alloc_large(cinfo, pool_id, - (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow - * SIZEOF(JSAMPLE))); + (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow + * SIZEOF(JSAMPLE))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += samplesperrow; @@ -470,7 +470,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, METHODDEF(JBLOCKARRAY) alloc_barray (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, JDIMENSION numrows) + JDIMENSION blocksperrow, JDIMENSION numrows) /* Allocate a 2-D coefficient-block array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -481,11 +481,11 @@ alloc_barray (j_common_ptr cinfo, int pool_id, /* Make sure each row is properly aligned */ if ((SIZEOF(JBLOCK) % ALIGN_SIZE) != 0) - out_of_memory(cinfo, 6); /* safety check */ + out_of_memory(cinfo, 6); /* safety check */ /* Calculate max # of rows allowed in one allocation chunk */ ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) blocksperrow * SIZEOF(JBLOCK)); + ((long) blocksperrow * SIZEOF(JBLOCK)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) @@ -496,15 +496,15 @@ alloc_barray (j_common_ptr cinfo, int pool_id, /* Get space for row pointers (small object) */ result = (JBLOCKARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JBLOCKROW))); + (size_t) (numrows * SIZEOF(JBLOCKROW))); /* Get the rows themselves (large objects) */ currow = 0; while (currow < numrows) { rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JBLOCKROW) alloc_large(cinfo, pool_id, - (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow - * SIZEOF(JBLOCK))); + (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow + * SIZEOF(JBLOCK))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += blocksperrow; @@ -554,8 +554,8 @@ alloc_barray (j_common_ptr cinfo, int pool_id, METHODDEF(jvirt_sarray_ptr) request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, - JDIMENSION samplesperrow, JDIMENSION numrows, - JDIMENSION maxaccess) + JDIMENSION samplesperrow, JDIMENSION numrows, + JDIMENSION maxaccess) /* Request a virtual 2-D sample array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -563,18 +563,18 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, /* Only IMAGE-lifetime virtual arrays are currently supported */ if (pool_id != JPOOL_IMAGE) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ /* get control block */ result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_sarray_control)); + SIZEOF(struct jvirt_sarray_control)); - result->mem_buffer = NULL; /* marks array not yet realized */ + result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; result->samplesperrow = samplesperrow; result->maxaccess = maxaccess; result->pre_zero = pre_zero; - result->b_s_open = FALSE; /* no associated backing-store object */ + result->b_s_open = FALSE; /* no associated backing-store object */ result->next = mem->virt_sarray_list; /* add to list of virtual arrays */ mem->virt_sarray_list = result; @@ -584,8 +584,8 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, METHODDEF(jvirt_barray_ptr) request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, - JDIMENSION blocksperrow, JDIMENSION numrows, - JDIMENSION maxaccess) + JDIMENSION blocksperrow, JDIMENSION numrows, + JDIMENSION maxaccess) /* Request a virtual 2-D coefficient-block array */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; @@ -593,18 +593,18 @@ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, /* Only IMAGE-lifetime virtual arrays are currently supported */ if (pool_id != JPOOL_IMAGE) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ /* get control block */ result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_barray_control)); + SIZEOF(struct jvirt_barray_control)); - result->mem_buffer = NULL; /* marks array not yet realized */ + result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; result->blocksperrow = blocksperrow; result->maxaccess = maxaccess; result->pre_zero = pre_zero; - result->b_s_open = FALSE; /* no associated backing-store object */ + result->b_s_open = FALSE; /* no associated backing-store object */ result->next = mem->virt_barray_list; /* add to list of virtual arrays */ mem->virt_barray_list = result; @@ -631,26 +631,26 @@ realize_virt_arrays (j_common_ptr cinfo) for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { if (sptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) sptr->maxaccess * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + (long) sptr->samplesperrow * SIZEOF(JSAMPLE); maximum_space += (long) sptr->rows_in_array * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + (long) sptr->samplesperrow * SIZEOF(JSAMPLE); } } for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { if (bptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) bptr->maxaccess * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); + (long) bptr->blocksperrow * SIZEOF(JBLOCK); maximum_space += (long) bptr->rows_in_array * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); + (long) bptr->blocksperrow * SIZEOF(JBLOCK); } } if (space_per_minheight <= 0) - return; /* no unrealized arrays, no work */ + return; /* no unrealized arrays, no work */ /* Determine amount of memory to actually use; this is system-dependent. */ avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space, - mem->total_space_allocated); + mem->total_space_allocated); /* If the maximum space needed is available, make all the buffers full * height; otherwise parcel it out with the same number of minheights @@ -673,19 +673,19 @@ realize_virt_arrays (j_common_ptr cinfo) if (sptr->mem_buffer == NULL) { /* if not realized yet */ minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L; if (minheights <= max_minheights) { - /* This buffer fits in memory */ - sptr->rows_in_mem = sptr->rows_in_array; + /* This buffer fits in memory */ + sptr->rows_in_mem = sptr->rows_in_array; } else { - /* It doesn't fit in memory, create backing store. */ - sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess); - jpeg_open_backing_store(cinfo, & sptr->b_s_info, - (long) sptr->rows_in_array * - (long) sptr->samplesperrow * - (long) SIZEOF(JSAMPLE)); - sptr->b_s_open = TRUE; + /* It doesn't fit in memory, create backing store. */ + sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess); + jpeg_open_backing_store(cinfo, & sptr->b_s_info, + (long) sptr->rows_in_array * + (long) sptr->samplesperrow * + (long) SIZEOF(JSAMPLE)); + sptr->b_s_open = TRUE; } sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE, - sptr->samplesperrow, sptr->rows_in_mem); + sptr->samplesperrow, sptr->rows_in_mem); sptr->rowsperchunk = mem->last_rowsperchunk; sptr->cur_start_row = 0; sptr->first_undef_row = 0; @@ -697,19 +697,19 @@ realize_virt_arrays (j_common_ptr cinfo) if (bptr->mem_buffer == NULL) { /* if not realized yet */ minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L; if (minheights <= max_minheights) { - /* This buffer fits in memory */ - bptr->rows_in_mem = bptr->rows_in_array; + /* This buffer fits in memory */ + bptr->rows_in_mem = bptr->rows_in_array; } else { - /* It doesn't fit in memory, create backing store. */ - bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess); - jpeg_open_backing_store(cinfo, & bptr->b_s_info, - (long) bptr->rows_in_array * - (long) bptr->blocksperrow * - (long) SIZEOF(JBLOCK)); - bptr->b_s_open = TRUE; + /* It doesn't fit in memory, create backing store. */ + bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess); + jpeg_open_backing_store(cinfo, & bptr->b_s_info, + (long) bptr->rows_in_array * + (long) bptr->blocksperrow * + (long) SIZEOF(JBLOCK)); + bptr->b_s_open = TRUE; } bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE, - bptr->blocksperrow, bptr->rows_in_mem); + bptr->blocksperrow, bptr->rows_in_mem); bptr->rowsperchunk = mem->last_rowsperchunk; bptr->cur_start_row = 0; bptr->first_undef_row = 0; @@ -736,17 +736,17 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) rows = MIN(rows, (long) ptr->first_undef_row - thisrow); /* Transfer no more than fits in file */ rows = MIN(rows, (long) ptr->rows_in_array - thisrow); - if (rows <= 0) /* this chunk might be past end of file! */ + if (rows <= 0) /* this chunk might be past end of file! */ break; byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); file_offset += byte_count; } } @@ -769,17 +769,17 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) rows = MIN(rows, (long) ptr->first_undef_row - thisrow); /* Transfer no more than fits in file */ rows = MIN(rows, (long) ptr->rows_in_array - thisrow); - if (rows <= 0) /* this chunk might be past end of file! */ + if (rows <= 0) /* this chunk might be past end of file! */ break; byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], - file_offset, byte_count); + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); file_offset += byte_count; } } @@ -787,8 +787,8 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) METHODDEF(JSAMPARRAY) access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, - JDIMENSION start_row, JDIMENSION num_rows, - boolean writable) + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable) /* Access the part of a virtual sample array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ @@ -826,7 +826,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, ltemp = (long) end_row - (long) ptr->rows_in_mem; if (ltemp < 0) - ltemp = 0; /* don't fall off front end of file */ + ltemp = 0; /* don't fall off front end of file */ ptr->cur_start_row = (JDIMENSION) ltemp; } /* Read in the selected part of the array. @@ -841,9 +841,9 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, */ if (ptr->first_undef_row < end_row) { if (ptr->first_undef_row < start_row) { - if (writable) /* writer skipped over a section of array */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - undef_row = start_row; /* but reader is allowed to read ahead */ + if (writable) /* writer skipped over a section of array */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + undef_row = start_row; /* but reader is allowed to read ahead */ } else { undef_row = ptr->first_undef_row; } @@ -854,12 +854,12 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); - undef_row++; + jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + undef_row++; } } else { - if (! writable) /* reader looking at undefined data */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + if (! writable) /* reader looking at undefined data */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); } } /* Flag the buffer dirty if caller will write in it */ @@ -872,8 +872,8 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, METHODDEF(JBLOCKARRAY) access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, - JDIMENSION start_row, JDIMENSION num_rows, - boolean writable) + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable) /* Access the part of a virtual block array starting at start_row */ /* and extending for num_rows rows. writable is true if */ /* caller intends to modify the accessed area. */ @@ -911,7 +911,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, ltemp = (long) end_row - (long) ptr->rows_in_mem; if (ltemp < 0) - ltemp = 0; /* don't fall off front end of file */ + ltemp = 0; /* don't fall off front end of file */ ptr->cur_start_row = (JDIMENSION) ltemp; } /* Read in the selected part of the array. @@ -926,9 +926,9 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, */ if (ptr->first_undef_row < end_row) { if (ptr->first_undef_row < start_row) { - if (writable) /* writer skipped over a section of array */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); - undef_row = start_row; /* but reader is allowed to read ahead */ + if (writable) /* writer skipped over a section of array */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + undef_row = start_row; /* but reader is allowed to read ahead */ } else { undef_row = ptr->first_undef_row; } @@ -939,12 +939,12 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); - undef_row++; + jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + undef_row++; } } else { - if (! writable) /* reader looking at undefined data */ - ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + if (! writable) /* reader looking at undefined data */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); } } /* Flag the buffer dirty if caller will write in it */ @@ -968,7 +968,7 @@ free_pool (j_common_ptr cinfo, int pool_id) size_t space_freed; if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) - ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ #ifdef MEM_STATS if (cinfo->err->trace_level > 1) @@ -981,16 +981,16 @@ free_pool (j_common_ptr cinfo, int pool_id) jvirt_barray_ptr bptr; for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { - if (sptr->b_s_open) { /* there may be no backing store */ - sptr->b_s_open = FALSE; /* prevent recursive close if error */ - (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info); + if (sptr->b_s_open) { /* there may be no backing store */ + sptr->b_s_open = FALSE; /* prevent recursive close if error */ + (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info); } } mem->virt_sarray_list = NULL; for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { - if (bptr->b_s_open) { /* there may be no backing store */ - bptr->b_s_open = FALSE; /* prevent recursive close if error */ - (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info); + if (bptr->b_s_open) { /* there may be no backing store */ + bptr->b_s_open = FALSE; /* prevent recursive close if error */ + (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info); } } mem->virt_barray_list = NULL; @@ -1003,8 +1003,8 @@ free_pool (j_common_ptr cinfo, int pool_id) while (lhdr_ptr != NULL) { large_pool_ptr next_lhdr_ptr = lhdr_ptr->next; space_freed = lhdr_ptr->bytes_used + - lhdr_ptr->bytes_left + - SIZEOF(large_pool_hdr); + lhdr_ptr->bytes_left + + SIZEOF(large_pool_hdr); jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); mem->total_space_allocated -= space_freed; lhdr_ptr = next_lhdr_ptr; @@ -1017,8 +1017,8 @@ free_pool (j_common_ptr cinfo, int pool_id) while (shdr_ptr != NULL) { small_pool_ptr next_shdr_ptr = shdr_ptr->next; space_freed = shdr_ptr->bytes_used + - shdr_ptr->bytes_left + - SIZEOF(small_pool_hdr); + shdr_ptr->bytes_left + + SIZEOF(small_pool_hdr); jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); mem->total_space_allocated -= space_freed; shdr_ptr = next_shdr_ptr; @@ -1046,9 +1046,9 @@ self_destruct (j_common_ptr cinfo) /* Release the memory manager control block too. */ jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr)); - cinfo->mem = NULL; /* ensures I will be called only once */ + cinfo->mem = NULL; /* ensures I will be called only once */ - jpeg_mem_term(cinfo); /* system-dependent cleanup */ + jpeg_mem_term(cinfo); /* system-dependent cleanup */ } @@ -1065,7 +1065,7 @@ jinit_memory_mgr (j_common_ptr cinfo) int pool; size_t test_mac; - cinfo->mem = NULL; /* for safety if init fails */ + cinfo->mem = NULL; /* for safety if init fails */ /* Check for configuration errors. * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably @@ -1092,7 +1092,7 @@ jinit_memory_mgr (j_common_ptr cinfo) mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr)); if (mem == NULL) { - jpeg_mem_term(cinfo); /* system-dependent cleanup */ + jpeg_mem_term(cinfo); /* system-dependent cleanup */ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0); } @@ -1140,9 +1140,9 @@ jinit_memory_mgr (j_common_ptr cinfo) char ch = 'x'; if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) { - if (ch == 'm' || ch == 'M') - max_to_use *= 1000L; - mem->pub.max_memory_to_use = max_to_use * 1000L; + if (ch == 'm' || ch == 'M') + max_to_use *= 1000L; + mem->pub.max_memory_to_use = max_to_use * 1000L; } } } diff --git a/jmemnobs.c b/jmemnobs.c index 34b18956..2e4de090 100644 --- a/jmemnobs.c +++ b/jmemnobs.c @@ -18,9 +18,9 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" -#include "jmemsys.h" /* import the system-dependent declarations */ +#include "jmemsys.h" /* import the system-dependent declarations */ -#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ +#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ extern void * malloc JPP((size_t size)); extern void free JPP((void *ptr)); #endif @@ -71,7 +71,7 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) GLOBAL(size_t) jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed, - size_t max_bytes_needed, size_t already_allocated) + size_t max_bytes_needed, size_t already_allocated) { return max_bytes_needed; } @@ -85,7 +85,7 @@ jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed, GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, - long total_bytes_needed) + long total_bytes_needed) { ERREXIT(cinfo, JERR_NO_BACKING_STORE); } @@ -99,7 +99,7 @@ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { - return 0; /* just set max_memory_to_use to 0 */ + return 0; /* just set max_memory_to_use to 0 */ } GLOBAL(void) diff --git a/jmemsys.h b/jmemsys.h index b1909459..5b6b7c4e 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -22,14 +22,14 @@ /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_get_small jGetSmall -#define jpeg_free_small jFreeSmall -#define jpeg_get_large jGetLarge -#define jpeg_free_large jFreeLarge -#define jpeg_mem_available jMemAvail -#define jpeg_open_backing_store jOpenBackStore -#define jpeg_mem_init jMemInit -#define jpeg_mem_term jMemTerm +#define jpeg_get_small jGetSmall +#define jpeg_free_small jFreeSmall +#define jpeg_get_large jGetLarge +#define jpeg_free_large jFreeLarge +#define jpeg_mem_available jMemAvail +#define jpeg_open_backing_store jOpenBackStore +#define jpeg_mem_init jMemInit +#define jpeg_mem_term jMemTerm #endif /* NEED_SHORT_EXTERNAL_NAMES */ @@ -46,7 +46,7 @@ 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)); + size_t sizeofobject)); /* * These two functions are used to allocate and release large chunks of @@ -58,9 +58,9 @@ EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object, */ EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo, - size_t sizeofobject)); + size_t sizeofobject)); EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, - size_t sizeofobject)); + size_t sizeofobject)); /* * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may @@ -74,7 +74,7 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, * size_t and will be a multiple of sizeof(align_type). */ -#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ +#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ #define MAX_ALLOC_CHUNK 1000000000L #endif @@ -101,9 +101,9 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, */ EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo, - size_t min_bytes_needed, - size_t max_bytes_needed, - size_t already_allocated)); + size_t min_bytes_needed, + size_t max_bytes_needed, + size_t already_allocated)); /* @@ -113,23 +113,23 @@ EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo, * are private to the system-dependent backing store routines. */ -#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ -#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ +#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ -typedef unsigned short XMSH; /* type of extended-memory handles */ -typedef unsigned short EMSH; /* type of expanded-memory handles */ +typedef unsigned short XMSH; /* type of extended-memory handles */ +typedef unsigned short EMSH; /* type of expanded-memory handles */ typedef union { - short file_handle; /* DOS file handle if it's a temp file */ - XMSH xms_handle; /* handle if it's a chunk of XMS */ - EMSH ems_handle; /* handle if it's a chunk of EMS */ + short file_handle; /* DOS file handle if it's a temp file */ + XMSH xms_handle; /* handle if it's a chunk of XMS */ + EMSH ems_handle; /* handle if it's a chunk of EMS */ } handle_union; #endif /* USE_MSDOS_MEMMGR */ -#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ +#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ #include #endif /* USE_MAC_MEMMGR */ @@ -139,30 +139,30 @@ typedef struct backing_store_struct * backing_store_ptr; typedef struct backing_store_struct { /* Methods for reading/writing/closing this backing-store object */ JMETHOD(void, read_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); + backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); JMETHOD(void, write_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); + backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); JMETHOD(void, close_backing_store, (j_common_ptr cinfo, - backing_store_ptr info)); + backing_store_ptr info)); /* Private fields for system-dependent backing-store management */ #ifdef USE_MSDOS_MEMMGR /* For the MS-DOS manager (jmemdos.c), we need: */ - handle_union handle; /* reference to backing-store storage object */ + handle_union handle; /* reference to backing-store storage object */ char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ #else #ifdef USE_MAC_MEMMGR /* For the Mac manager (jmemmac.c), we need: */ - short temp_file; /* file reference number to temp file */ - FSSpec tempSpec; /* the FSSpec for the temp file */ + short temp_file; /* file reference number to temp file */ + FSSpec tempSpec; /* the FSSpec for the temp file */ char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ #else /* For a typical implementation with temp files, we need: */ - FILE * temp_file; /* stdio reference to temp file */ + FILE * temp_file; /* stdio reference to temp file */ char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ #endif #endif @@ -178,8 +178,8 @@ typedef struct backing_store_struct { */ EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, - backing_store_ptr info, - long total_bytes_needed)); + backing_store_ptr info, + long total_bytes_needed)); /* diff --git a/jmorecfg.h b/jmorecfg.h index 55af0568..f41eccf0 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -22,7 +22,7 @@ * We do not support run-time selection of data precision, sorry. */ -#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ /* @@ -34,7 +34,7 @@ * bytes of storage, whether actually used in an image or not.) */ -#define MAX_COMPONENTS 10 /* maximum number of image components */ +#define MAX_COMPONENTS 10 /* maximum number of image components */ /* @@ -72,8 +72,8 @@ typedef char JSAMPLE; #endif /* HAVE_UNSIGNED_CHAR */ -#define MAXJSAMPLE 255 -#define CENTERJSAMPLE 128 +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 #endif /* BITS_IN_JSAMPLE == 8 */ @@ -86,8 +86,8 @@ typedef char JSAMPLE; typedef short JSAMPLE; #define GETJSAMPLE(value) ((int) (value)) -#define MAXJSAMPLE 4095 -#define CENTERJSAMPLE 2048 +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 #endif /* BITS_IN_JSAMPLE == 12 */ @@ -153,13 +153,13 @@ typedef unsigned int UINT16; /* INT16 must hold at least the values -32768..32767. */ -#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ typedef short INT16; #endif /* INT32 must hold at least signed 32-bit values. */ -#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ typedef long INT32; #endif @@ -183,13 +183,13 @@ typedef unsigned int JDIMENSION; */ /* a function called through method pointers: */ -#define METHODDEF(type) static type +#define METHODDEF(type) static type /* a function used only in its module: */ -#define LOCAL(type) static type +#define LOCAL(type) static type /* a function referenced thru EXTERNs: */ -#define GLOBAL(type) type +#define GLOBAL(type) type /* a reference to a GLOBAL function: */ -#define EXTERN(type) extern type +#define EXTERN(type) extern type /* This macro is used to declare a "method", that is, a function pointer. @@ -231,11 +231,11 @@ typedef unsigned int JDIMENSION; #ifndef HAVE_BOOLEAN typedef int boolean; #endif -#ifndef FALSE /* in case these macros already exist */ -#define FALSE 0 /* values of boolean */ +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ #endif #ifndef TRUE -#define TRUE 1 +#define TRUE 1 #endif @@ -263,15 +263,15 @@ typedef int boolean; /* Capability options common to encoder and decoder: */ -#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ -#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ -#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ /* Encoder capability options: */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ /* Note: if you selected 12-bit data precision, it is dangerous to turn off * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit * precision, so jchuff.c normally uses entropy optimization to compute @@ -285,14 +285,14 @@ typedef int boolean; /* Decoder capability options: */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ -#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ -#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ -#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ /* more capability options later, no doubt */ @@ -312,10 +312,10 @@ typedef int boolean; * can't use color quantization if you change that value. */ -#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ -#define RGB_GREEN 1 /* Offset of Green */ -#define RGB_BLUE 2 /* Offset of Blue */ -#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ #define JPEG_NUMCS 16 @@ -382,7 +382,7 @@ static const int rgb_pixelsize[JPEG_NUMCS] = { #ifndef MULTIPLIER #ifndef WITH_SIMD -#define MULTIPLIER int /* type for fastest integer multiply */ +#define MULTIPLIER int /* type for fastest integer multiply */ #else #define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ #endif diff --git a/jpegint.h b/jpegint.h index 78717482..fcacef39 100644 --- a/jpegint.h +++ b/jpegint.h @@ -14,30 +14,30 @@ /* Declarations for both compression & decompression */ -typedef enum { /* Operating modes for buffer controllers */ - JBUF_PASS_THRU, /* Plain stripwise operation */ - /* Remaining modes require a full-image buffer to have been created */ - JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ - JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ - JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ +typedef enum { /* Operating modes for buffer controllers */ + JBUF_PASS_THRU, /* Plain stripwise operation */ + /* Remaining modes require a full-image buffer to have been created */ + JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ + JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ + JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ } J_BUF_MODE; /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ -#define CSTATE_START 100 /* after create_compress */ -#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ -#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ -#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ -#define DSTATE_START 200 /* after create_decompress */ -#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ -#define DSTATE_READY 202 /* found SOS, ready for start_decompress */ -#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ -#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ -#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ -#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ -#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ -#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ -#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ -#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ +#define CSTATE_START 100 /* after create_compress */ +#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ +#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ +#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ +#define DSTATE_START 200 /* after create_decompress */ +#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ +#define DSTATE_READY 202 /* found SOS, ready for start_decompress */ +#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ +#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ +#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ +#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ +#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ +#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ +#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ +#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ /* Declarations for compression modules */ @@ -49,54 +49,54 @@ struct jpeg_comp_master { JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); /* State variables made visible to other modules */ - boolean call_pass_startup; /* True if pass_startup must be called */ - boolean is_last_pass; /* True during last pass */ + boolean call_pass_startup; /* True if pass_startup must be called */ + boolean is_last_pass; /* True during last pass */ }; /* Main buffer control (downsampled-data buffer) */ struct jpeg_c_main_controller { JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail)); + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail)); }; /* Compression preprocessing (downsampling input buffer control) */ struct jpeg_c_prep_controller { JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, - JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail)); + JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, + JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail)); }; /* Coefficient buffer control */ struct jpeg_c_coef_controller { JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf)); + JSAMPIMAGE input_buf)); }; /* Colorspace conversion */ struct jpeg_color_converter { JMETHOD(void, start_pass, (j_compress_ptr cinfo)); JMETHOD(void, color_convert, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); }; /* Downsampling */ struct jpeg_downsampler { JMETHOD(void, start_pass, (j_compress_ptr cinfo)); JMETHOD(void, downsample, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_index, - JSAMPIMAGE output_buf, - JDIMENSION out_row_group_index)); + JSAMPIMAGE input_buf, JDIMENSION in_row_index, + JSAMPIMAGE output_buf, + JDIMENSION out_row_group_index)); - boolean need_context_rows; /* TRUE if need rows above & below */ + boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Forward DCT (also controls coefficient quantization) */ @@ -104,10 +104,10 @@ struct jpeg_forward_dct { JMETHOD(void, start_pass, (j_compress_ptr cinfo)); /* perhaps this should be an array??? */ JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, - jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks)); + jpeg_component_info * compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks)); }; /* Entropy encoding */ @@ -127,7 +127,7 @@ struct jpeg_marker_writer { /* These routines are exported to allow insertion of extra markers */ /* Probably only COM and APPn markers should be written this way */ JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, - unsigned int datalen)); + unsigned int datalen)); JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); }; @@ -140,7 +140,7 @@ struct jpeg_decomp_master { JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ - boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ + boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ }; /* Input control module */ @@ -151,16 +151,16 @@ struct jpeg_input_controller { JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ - boolean has_multiple_scans; /* True if file has multiple scans */ - boolean eoi_reached; /* True when EOI has been consumed */ + boolean has_multiple_scans; /* True if file has multiple scans */ + boolean eoi_reached; /* True when EOI has been consumed */ }; /* Main buffer control (downsampled-data buffer) */ struct jpeg_d_main_controller { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, process_data, (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); }; /* Coefficient buffer control */ @@ -169,7 +169,7 @@ struct jpeg_d_coef_controller { JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, - JSAMPIMAGE output_buf)); + JSAMPIMAGE output_buf)); /* Pointer to array of coefficient virtual arrays, or NULL if none */ jvirt_barray_ptr *coef_arrays; }; @@ -178,12 +178,12 @@ struct jpeg_d_coef_controller { struct jpeg_d_post_controller { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, post_process_data, (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)); + JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); }; /* Marker reading & parsing */ @@ -200,28 +200,28 @@ struct jpeg_marker_reader { /* State of marker reader --- nominally internal, but applications * supplying COM or APPn handlers might like to know the state. */ - boolean saw_SOI; /* found SOI? */ - boolean saw_SOF; /* found SOF? */ - int next_restart_num; /* next restart number expected (0-7) */ - unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ + boolean saw_SOI; /* found SOI? */ + boolean saw_SOF; /* found SOF? */ + int next_restart_num; /* next restart number expected (0-7) */ + unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ }; /* Entropy decoding */ struct jpeg_entropy_decoder { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + JBLOCKROW *MCU_data)); /* This is here to share code between baseline and progressive decoders; */ /* other modules probably should not use it */ - boolean insufficient_data; /* set TRUE after emitting warning */ + boolean insufficient_data; /* set TRUE after emitting warning */ }; /* Inverse DCT (also performs dequantization) */ typedef JMETHOD(void, inverse_DCT_method_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col)); struct jpeg_inverse_dct { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); @@ -233,30 +233,30 @@ struct jpeg_inverse_dct { struct jpeg_upsampler { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, upsample, (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)); + JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); - boolean need_context_rows; /* TRUE if need rows above & below */ + boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Colorspace conversion */ struct jpeg_color_deconverter { JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, color_convert, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); }; /* Color quantization or color precision reduction */ struct jpeg_color_quantizer { JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, - int num_rows)); + JSAMPARRAY input_buf, JSAMPARRAY output_buf, + int num_rows)); JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); }; @@ -265,9 +265,9 @@ struct jpeg_color_quantizer { /* Miscellaneous useful macros */ #undef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) #undef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) /* We assume that right shift corresponds to signed division by 2 with @@ -281,69 +281,69 @@ struct jpeg_color_quantizer { */ #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS INT32 shift_temp; +#define SHIFT_TEMPS INT32 shift_temp; #define RIGHT_SHIFT(x,shft) \ - ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ - (shift_temp >> (shft))) + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ + (shift_temp >> (shft))) #else #define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) #endif /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_compress_master jICompress -#define jinit_c_master_control jICMaster -#define jinit_c_main_controller jICMainC -#define jinit_c_prep_controller jICPrepC -#define jinit_c_coef_controller jICCoefC -#define jinit_color_converter jICColor -#define jinit_downsampler jIDownsampler -#define jinit_forward_dct jIFDCT -#define jinit_huff_encoder jIHEncoder -#define jinit_phuff_encoder jIPHEncoder -#define jinit_arith_encoder jIAEncoder -#define jinit_marker_writer jIMWriter -#define jinit_master_decompress jIDMaster -#define jinit_d_main_controller jIDMainC -#define jinit_d_coef_controller jIDCoefC -#define jinit_d_post_controller jIDPostC -#define jinit_input_controller jIInCtlr -#define jinit_marker_reader jIMReader -#define jinit_huff_decoder jIHDecoder -#define jinit_phuff_decoder jIPHDecoder -#define jinit_arith_decoder jIADecoder -#define jinit_inverse_dct jIIDCT -#define jinit_upsampler jIUpsampler -#define jinit_color_deconverter jIDColor -#define jinit_1pass_quantizer jI1Quant -#define jinit_2pass_quantizer jI2Quant -#define jinit_merged_upsampler jIMUpsampler -#define jinit_memory_mgr jIMemMgr -#define jdiv_round_up jDivRound -#define jround_up jRound -#define jcopy_sample_rows jCopySamples -#define jcopy_block_row jCopyBlocks -#define jzero_far jZeroFar -#define jpeg_zigzag_order jZIGTable -#define jpeg_natural_order jZAGTable -#define jpeg_aritab jAriTab +#define jinit_compress_master jICompress +#define jinit_c_master_control jICMaster +#define jinit_c_main_controller jICMainC +#define jinit_c_prep_controller jICPrepC +#define jinit_c_coef_controller jICCoefC +#define jinit_color_converter jICColor +#define jinit_downsampler jIDownsampler +#define jinit_forward_dct jIFDCT +#define jinit_huff_encoder jIHEncoder +#define jinit_phuff_encoder jIPHEncoder +#define jinit_arith_encoder jIAEncoder +#define jinit_marker_writer jIMWriter +#define jinit_master_decompress jIDMaster +#define jinit_d_main_controller jIDMainC +#define jinit_d_coef_controller jIDCoefC +#define jinit_d_post_controller jIDPostC +#define jinit_input_controller jIInCtlr +#define jinit_marker_reader jIMReader +#define jinit_huff_decoder jIHDecoder +#define jinit_phuff_decoder jIPHDecoder +#define jinit_arith_decoder jIADecoder +#define jinit_inverse_dct jIIDCT +#define jinit_upsampler jIUpsampler +#define jinit_color_deconverter jIDColor +#define jinit_1pass_quantizer jI1Quant +#define jinit_2pass_quantizer jI2Quant +#define jinit_merged_upsampler jIMUpsampler +#define jinit_memory_mgr jIMemMgr +#define jdiv_round_up jDivRound +#define jround_up jRound +#define jcopy_sample_rows jCopySamples +#define jcopy_block_row jCopyBlocks +#define jzero_far jZeroFar +#define jpeg_zigzag_order jZIGTable +#define jpeg_natural_order jZAGTable +#define jpeg_aritab jAriTab #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* 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)); + boolean transcode_only)); EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); + boolean need_full_buffer)); EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); + boolean need_full_buffer)); EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, - boolean need_full_buffer)); + 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)); @@ -354,11 +354,11 @@ 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)); + boolean need_full_buffer)); EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, - boolean need_full_buffer)); + boolean need_full_buffer)); EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, - boolean need_full_buffer)); + 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)); @@ -377,13 +377,13 @@ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); 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)); + 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)); + JDIMENSION num_blocks)); EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); /* Constant tables in jutils.c */ -#if 0 /* This table is not actually needed in v6a */ +#if 0 /* This table is not actually needed in v6a */ extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ #endif extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ @@ -394,7 +394,7 @@ extern const INT32 jpeg_aritab[]; /* Suppress undefined-structure complaints if necessary. */ #ifdef INCOMPLETE_TYPES_BROKEN -#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ +#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ struct jvirt_sarray_control { long dummy; }; struct jvirt_barray_control { long dummy; }; #endif diff --git a/jpeglib.h b/jpeglib.h index 7386a2ed..e5329cff 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -23,10 +23,10 @@ * manual configuration options that most people need not worry about. */ -#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ -#include "jconfig.h" /* widely used configuration options */ +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ #endif -#include "jmorecfg.h" /* seldom changed options */ +#include "jmorecfg.h" /* seldom changed options */ #ifdef __cplusplus @@ -41,13 +41,13 @@ extern "C" { * if you want to be compatible. */ -#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ -#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ -#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ -#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ -#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ -#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ -#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ /* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU @@ -66,16 +66,16 @@ extern "C" { * but the pointer arrays can fit in near memory. */ -typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ -typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ -typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ +typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ -typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ -typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ -typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ -typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ -typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ +typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ /* Types for JPEG compression parameters and working tables. */ @@ -88,13 +88,13 @@ typedef struct { * (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 */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ - boolean sent_table; /* TRUE when table has been output */ + boolean sent_table; /* TRUE when table has been output */ } JQUANT_TBL; @@ -102,15 +102,15 @@ typedef struct { typedef struct { /* These two fields directly represent the contents of a JPEG DHT marker */ - UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ - /* length k bits; bits[0] is unused */ - UINT8 huffval[256]; /* The symbols, in order of incr code length */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ /* This field is used only during compression. It's initialized FALSE when * the table is created, and set TRUE when it's been output to the file. * You could suppress output of a table by setting this to TRUE. * (See jpeg_suppress_tables for an example.) */ - boolean sent_table; /* TRUE when table has been output */ + boolean sent_table; /* TRUE when table has been output */ } JHUFF_TBL; @@ -120,20 +120,20 @@ typedef struct { /* These values are fixed over the whole image. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOF marker. */ - int component_id; /* identifier for this component (0..255) */ - int component_index; /* its index in SOF or cinfo->comp_info[] */ - int h_samp_factor; /* horizontal sampling factor (1..4) */ - int v_samp_factor; /* vertical sampling factor (1..4) */ - int quant_tbl_no; /* quantization table selector (0..3) */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ /* These values may vary between scans. */ /* For compression, they must be supplied by parameter setup; */ /* for decompression, they are read from the SOS marker. */ /* The decompressor output side may not use these variables. */ - int dc_tbl_no; /* DC entropy table selector (0..3) */ - int ac_tbl_no; /* AC entropy table selector (0..3) */ - + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + /* Remaining fields should be treated as private by applications. */ - + /* These values are computed during compression or decompression startup: */ /* Component's size in DCT blocks. * Any dummy blocks added to complete an MCU are not counted; therefore @@ -159,22 +159,22 @@ typedef struct { * and similarly for height. For decompression, IDCT scaling is included, so * downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE) */ - JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_width; /* actual width in samples */ JDIMENSION downsampled_height; /* actual height in samples */ /* This flag is used only for decompression. In cases where some of the * components will be ignored (eg grayscale output from YCbCr image), * we can skip most computations for the unused components. */ - boolean component_needed; /* do we need the value of this component? */ + boolean component_needed; /* do we need the value of this component? */ /* These values are computed before starting a scan of the component. */ /* The decompressor output side may not use these variables. */ - int MCU_width; /* number of blocks per MCU, horizontally */ - int MCU_height; /* number of blocks per MCU, vertically */ - int MCU_blocks; /* MCU_width * MCU_height */ - int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */ - int last_col_width; /* # of non-dummy blocks across in last MCU */ - int last_row_height; /* # of non-dummy blocks down in last MCU */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ /* Saved quantization table for component; NULL if none yet saved. * See jdinput.c comments about the need for this information. @@ -190,10 +190,10 @@ typedef struct { /* The script for encoding a multiple-scan file is an array of these: */ typedef struct { - int comps_in_scan; /* number of components encoded in this scan */ + int comps_in_scan; /* number of components encoded in this scan */ int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ - int Ss, Se; /* progressive JPEG spectral selection parms */ - int Ah, Al; /* progressive JPEG successive approx. parms */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ } jpeg_scan_info; /* The decompressor can save APPn and COM markers in a list of these: */ @@ -201,11 +201,11 @@ typedef struct { typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; struct jpeg_marker_struct { - jpeg_saved_marker_ptr next; /* next in list, or NULL */ - UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ - unsigned int original_length; /* # bytes of data in the file */ - unsigned int data_length; /* # bytes of data saved at data[] */ - JOCTET FAR * data; /* the data contained in the marker */ + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET FAR * data; /* the data contained in the marker */ /* the marker length word is not counted in data_length or original_length */ }; @@ -215,72 +215,72 @@ struct jpeg_marker_struct { #define JCS_ALPHA_EXTENSIONS 1 typedef enum { - JCS_UNKNOWN, /* error/unspecified */ - JCS_GRAYSCALE, /* monochrome */ - JCS_RGB, /* red/green/blue as specified by the RGB_RED, RGB_GREEN, - RGB_BLUE, and RGB_PIXELSIZE macros */ - JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ - JCS_CMYK, /* C/M/Y/K */ - JCS_YCCK, /* Y/Cb/Cr/K */ - JCS_EXT_RGB, /* red/green/blue */ - JCS_EXT_RGBX, /* red/green/blue/x */ - JCS_EXT_BGR, /* blue/green/red */ - JCS_EXT_BGRX, /* blue/green/red/x */ - JCS_EXT_XBGR, /* x/blue/green/red */ - JCS_EXT_XRGB, /* x/red/green/blue */ - /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, - JCS_EXT_XBGR, or JCS_EXT_XRGB during decompression, the X byte is - undefined, and in order to ensure the best performance, - libjpeg-turbo can set that byte to whatever value it wishes. Use - the following colorspace constants to ensure that the X byte is set - to 0xFF, so that it can be interpreted as an opaque alpha - channel. */ - JCS_EXT_RGBA, /* red/green/blue/alpha */ - JCS_EXT_BGRA, /* blue/green/red/alpha */ - JCS_EXT_ABGR, /* alpha/blue/green/red */ - JCS_EXT_ARGB /* alpha/red/green/blue */ + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue as specified by the RGB_RED, RGB_GREEN, + RGB_BLUE, and RGB_PIXELSIZE macros */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK, /* Y/Cb/Cr/K */ + JCS_EXT_RGB, /* red/green/blue */ + JCS_EXT_RGBX, /* red/green/blue/x */ + JCS_EXT_BGR, /* blue/green/red */ + JCS_EXT_BGRX, /* blue/green/red/x */ + JCS_EXT_XBGR, /* x/blue/green/red */ + JCS_EXT_XRGB, /* x/red/green/blue */ + /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, + JCS_EXT_XBGR, or JCS_EXT_XRGB during decompression, the X byte is + undefined, and in order to ensure the best performance, + libjpeg-turbo can set that byte to whatever value it wishes. Use + the following colorspace constants to ensure that the X byte is set + to 0xFF, so that it can be interpreted as an opaque alpha + channel. */ + JCS_EXT_RGBA, /* red/green/blue/alpha */ + JCS_EXT_BGRA, /* blue/green/red/alpha */ + JCS_EXT_ABGR, /* alpha/blue/green/red */ + JCS_EXT_ARGB /* alpha/red/green/blue */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ typedef enum { - JDCT_ISLOW, /* slow but accurate integer algorithm */ - JDCT_IFAST, /* faster, less accurate integer method */ - JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ } J_DCT_METHOD; -#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ #define JDCT_DEFAULT JDCT_ISLOW #endif -#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ #define JDCT_FASTEST JDCT_IFAST #endif /* Dithering options for decompression. */ typedef enum { - JDITHER_NONE, /* no dithering */ - JDITHER_ORDERED, /* simple ordered dither */ - JDITHER_FS /* Floyd-Steinberg error diffusion dither */ + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ } J_DITHER_MODE; /* Common fields between JPEG compression and decompression master structs. */ #define jpeg_common_fields \ - struct jpeg_error_mgr * err; /* Error handler module */\ - struct jpeg_memory_mgr * mem; /* Memory manager module */\ + struct jpeg_error_mgr * err; /* Error handler module */\ + struct jpeg_memory_mgr * mem; /* Memory manager module */\ struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ - void * client_data; /* Available for use by application */\ - boolean is_decompressor; /* So common code can tell which is which */\ - int global_state /* For checking call sequence validity */ + void * client_data; /* Available for use by application */\ + boolean is_decompressor; /* So common code can tell which is which */\ + int global_state /* For checking call sequence validity */ /* Routines that are to be used by both halves of the library are declared * to receive a pointer to this structure. There are no actual instances of * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. */ struct jpeg_common_struct { - jpeg_common_fields; /* Fields common to both master struct types */ + jpeg_common_fields; /* Fields common to both master struct types */ /* Additional fields follow in an actual jpeg_compress_struct or * jpeg_decompress_struct. All three structs must agree on these * initial fields! (This would be a lot cleaner in C++.) @@ -295,7 +295,7 @@ typedef struct jpeg_decompress_struct * j_decompress_ptr; /* Master record for a compression instance */ struct jpeg_compress_struct { - jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ /* Destination for compressed data */ struct jpeg_destination_mgr * dest; @@ -305,12 +305,12 @@ struct jpeg_compress_struct { * be correct before you can even call jpeg_set_defaults(). */ - JDIMENSION image_width; /* input image width */ - JDIMENSION image_height; /* input image height */ - int input_components; /* # of color components in input image */ - J_COLOR_SPACE in_color_space; /* colorspace of input image */ + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ - double input_gamma; /* image gamma of input image */ + double input_gamma; /* image gamma of input image */ /* Compression parameters --- these fields must be set before calling * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to @@ -323,8 +323,8 @@ struct jpeg_compress_struct { #if JPEG_LIB_VERSION >= 70 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ - JDIMENSION jpeg_width; /* scaled JPEG image width */ - JDIMENSION jpeg_height; /* scaled JPEG image height */ + JDIMENSION jpeg_width; /* scaled JPEG image width */ + JDIMENSION jpeg_height; /* scaled JPEG image height */ /* Dimensions of actual JPEG image that will be written to file, * derived from input dimensions by scaling factors above. * These fields are computed by jpeg_start_compress(). @@ -333,9 +333,9 @@ struct jpeg_compress_struct { */ #endif - int data_precision; /* bits of precision in image data */ + int data_precision; /* bits of precision in image data */ - int num_components; /* # of color components in JPEG image */ + int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ jpeg_component_info * comp_info; @@ -357,22 +357,22 @@ struct jpeg_compress_struct { UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ - int num_scans; /* # of entries in scan_info array */ + int num_scans; /* # of entries in scan_info array */ const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ /* The default value of scan_info is NULL, which causes a single-scan * sequential JPEG file to be emitted. To create a multi-scan file, * set num_scans and scan_info to point to an array of scan definitions. */ - boolean raw_data_in; /* TRUE=caller supplies downsampled data */ - boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ - boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ - boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ #if JPEG_LIB_VERSION >= 70 boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ #endif - int smoothing_factor; /* 1..100, or 0 for no input smoothing */ - J_DCT_METHOD dct_method; /* DCT algorithm selector */ + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ /* The restart interval can be specified in absolute MCUs by setting * restart_interval, or in MCU rows by setting restart_in_rows @@ -380,28 +380,28 @@ struct jpeg_compress_struct { * for each scan). */ unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ - int restart_in_rows; /* if > 0, MCU rows per restart interval */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ /* Parameters controlling emission of special markers. */ - boolean write_JFIF_header; /* should a JFIF marker be written? */ - UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ UINT8 JFIF_minor_version; /* These three values are not used by the JPEG code, merely copied */ /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ /* ratio is defined by X_density/Y_density even when density_unit=0. */ - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - boolean write_Adobe_marker; /* should an Adobe marker be written? */ - + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + /* State variable: index of next scanline to be written to * jpeg_write_scanlines(). Application may use this to control its * processing loop, e.g., "while (next_scanline < image_height)". */ - JDIMENSION next_scanline; /* 0 .. image_height-1 */ + JDIMENSION next_scanline; /* 0 .. image_height-1 */ /* Remaining fields are known throughout compressor, but generally * should not be touched by a surrounding application. @@ -410,44 +410,44 @@ struct jpeg_compress_struct { /* * These fields are computed during compression startup */ - boolean progressive_mode; /* TRUE if scan script uses progressive mode */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ #if JPEG_LIB_VERSION >= 70 - int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ - int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ #endif - JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ /* The coefficient controller receives data in units of MCU rows as defined * for fully interleaved scans (whether the JPEG file is interleaved or not). * There are v_samp_factor * DCTSIZE sample rows of each component in an * "iMCU" (interleaved MCU) row. */ - + /* * These fields are valid during any one scan. * They describe the components and MCUs actually appearing in the scan. */ - int comps_in_scan; /* # of JPEG components in this scan */ + int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ - - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - - int blocks_in_MCU; /* # of DCT blocks per MCU */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[C_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th block in an MCU */ - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ #if JPEG_LIB_VERSION >= 80 - int block_size; /* the basic DCT block size: 1..16 */ - const int * natural_order; /* natural-order position array */ - int lim_Se; /* min( Se, DCTSIZE2-1 ) */ + int block_size; /* the basic DCT block size: 1..16 */ + const int * natural_order; /* natural-order position array */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) */ #endif /* @@ -470,7 +470,7 @@ struct jpeg_compress_struct { /* Master record for a decompression instance */ struct jpeg_decompress_struct { - jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ /* Source of compressed data */ struct jpeg_source_mgr * src; @@ -478,9 +478,9 @@ struct jpeg_decompress_struct { /* Basic description of image --- filled in by jpeg_read_header(). */ /* Application may inspect these values to decide how to process image. */ - JDIMENSION image_width; /* nominal image width (from SOF marker) */ - JDIMENSION image_height; /* nominal image height */ - int num_components; /* # of color components in JPEG image */ + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ /* Decompression processing parameters --- these fields must be set before @@ -492,24 +492,24 @@ struct jpeg_decompress_struct { unsigned int scale_num, scale_denom; /* fraction by which to scale image */ - double output_gamma; /* image gamma wanted in output */ + double output_gamma; /* image gamma wanted in output */ - boolean buffered_image; /* TRUE=multiple output passes */ - boolean raw_data_out; /* TRUE=downsampled data wanted */ + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ - J_DCT_METHOD dct_method; /* IDCT algorithm selector */ - boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ - boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ - boolean quantize_colors; /* TRUE=colormapped output wanted */ + boolean quantize_colors; /* TRUE=colormapped output wanted */ /* the following are ignored if not quantize_colors: */ - J_DITHER_MODE dither_mode; /* type of color dithering to use */ - boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ - int desired_number_of_colors; /* max # colors to use in created colormap */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ /* these are significant only in buffered-image mode: */ - boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ boolean enable_external_quant;/* enable future use of external colormap */ - boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ /* Description of actual output image that will be returned to application. * These fields are computed by jpeg_start_decompress(). @@ -517,14 +517,14 @@ struct jpeg_decompress_struct { * in advance of calling jpeg_start_decompress(). */ - JDIMENSION output_width; /* scaled image width */ - JDIMENSION output_height; /* scaled image height */ - int out_color_components; /* # of color components in out_color_space */ - int output_components; /* # of color components returned */ + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ /* output_components is 1 (a colormap index) when quantizing colors; * otherwise it equals out_color_components. */ - int rec_outbuf_height; /* min recommended height of scanline buffer */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ /* If the buffer passed to jpeg_read_scanlines() is less than this many rows * high, space and time will be wasted due to unnecessary data copying. * Usually rec_outbuf_height will be 1 or 2, at most 4. @@ -536,8 +536,8 @@ struct jpeg_decompress_struct { * jpeg_start_decompress or jpeg_start_output. * The map has out_color_components rows and actual_number_of_colors columns. */ - int actual_number_of_colors; /* number of entries in use */ - JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ /* State variables: these variables indicate the progress of decompression. * The application may examine these but must not modify them. @@ -547,20 +547,20 @@ struct jpeg_decompress_struct { * Application may use this to control its processing loop, e.g., * "while (output_scanline < output_height)". */ - JDIMENSION output_scanline; /* 0 .. output_height-1 */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ /* Current input scan number and number of iMCU rows completed in scan. * These indicate the progress of the decompressor input side. */ - int input_scan_number; /* Number of SOS markers seen so far */ - JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ /* The "output scan number" is the notional scan being displayed by the * output side. The decompressor will not allow output scan/row number * to get ahead of input scan/row, but it can fall arbitrarily far behind. */ - int output_scan_number; /* Nominal scan number being displayed */ - JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ /* Current progression status. coef_bits[c][i] indicates the precision * with which component c's DCT coefficient i (in zigzag order) is known. @@ -569,7 +569,7 @@ struct jpeg_decompress_struct { * (thus, 0 at completion of the progression). * This pointer is NULL when reading a non-progressive file. */ - int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ /* Internal JPEG parameters --- the application usually need not look at * these fields. Note that the decompressor output side may not use @@ -591,16 +591,16 @@ struct jpeg_decompress_struct { * are given in SOF/SOS markers or defined to be reset by SOI. */ - int data_precision; /* bits of precision in image data */ + int data_precision; /* bits of precision in image data */ jpeg_component_info * comp_info; /* comp_info[i] describes component that appears i'th in SOF */ #if JPEG_LIB_VERSION >= 80 - boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ + boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ #endif - boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ - boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ @@ -611,17 +611,17 @@ struct jpeg_decompress_struct { /* These fields record data obtained from optional markers recognized by * the JPEG library. */ - boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ - UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_major_version; /* JFIF version number */ UINT8 JFIF_minor_version; - UINT8 density_unit; /* JFIF code for pixel size units */ - UINT16 X_density; /* Horizontal pixel density */ - UINT16 Y_density; /* Vertical pixel density */ - boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ - UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ - boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ /* Aside from the specific data retained from APPn markers known to the * library, the uninterpreted contents of any or all APPn and COM markers @@ -636,17 +636,17 @@ struct jpeg_decompress_struct { /* * These fields are computed during decompression startup */ - int max_h_samp_factor; /* largest h_samp_factor */ - int max_v_samp_factor; /* largest v_samp_factor */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ #if JPEG_LIB_VERSION >= 70 - int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ - int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ #else - int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ + int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ #endif - JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ /* The coefficient controller's input and output progress is measured in * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows * in fully interleaved JPEG scans, but are used whether the scan is @@ -662,26 +662,26 @@ struct jpeg_decompress_struct { * They describe the components and MCUs actually appearing in the scan. * Note that the decompressor output side must not use these fields. */ - int comps_in_scan; /* # of JPEG components in this scan */ + int comps_in_scan; /* # of JPEG components in this scan */ jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; /* *cur_comp_info[i] describes component that appears i'th in SOS */ - JDIMENSION MCUs_per_row; /* # of MCUs across the image */ - JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ - int blocks_in_MCU; /* # of DCT blocks per MCU */ + int blocks_in_MCU; /* # of DCT blocks per MCU */ int MCU_membership[D_MAX_BLOCKS_IN_MCU]; /* MCU_membership[i] is index in cur_comp_info of component owning */ /* i'th block in an MCU */ - int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ #if JPEG_LIB_VERSION >= 80 /* These fields are derived from Se of first SOS marker. */ - int block_size; /* the basic DCT block size: 1..16 */ + int block_size; /* the basic DCT block size: 1..16 */ const int * natural_order; /* natural-order position array for entropy decode */ - int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ #endif /* This field is shared between entropy decoder and marker parser. @@ -726,10 +726,10 @@ struct jpeg_error_mgr { JMETHOD(void, output_message, (j_common_ptr cinfo)); /* Format a message string for the most recent JPEG error or message */ JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); -#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); - + /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. */ @@ -739,18 +739,18 @@ struct jpeg_error_mgr { int i[8]; char s[JMSG_STR_PARM_MAX]; } msg_parm; - + /* Standard state variables for error facility */ - - int trace_level; /* max msg_level that will be displayed */ - + + int trace_level; /* max msg_level that will be displayed */ + /* For recoverable corrupt-data errors, we emit a warning message, * but keep going unless emit_message chooses to abort. emit_message * should count warnings in num_warnings. The surrounding application * can check for bad data by seeing if num_warnings is nonzero at the * end of processing. */ - long num_warnings; /* number of corrupt-data warnings */ + long num_warnings; /* number of corrupt-data warnings */ /* These fields point to the table(s) of error message strings. * An application can change the table pointer to switch to a different @@ -768,8 +768,8 @@ struct jpeg_error_mgr { * It contains strings numbered first_addon_message..last_addon_message. */ const char * const * addon_message_table; /* Non-library errors */ - int first_addon_message; /* code for first string in addon table */ - int last_addon_message; /* code for last string in addon table */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ }; @@ -778,18 +778,18 @@ struct jpeg_error_mgr { struct jpeg_progress_mgr { JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); - long pass_counter; /* work units completed in this pass */ - long pass_limit; /* total number of work units in this pass */ - int completed_passes; /* passes completed so far */ - int total_passes; /* total number of passes expected */ + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ }; /* Data destination object for compression */ struct jpeg_destination_mgr { - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ JMETHOD(void, init_destination, (j_compress_ptr cinfo)); JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); @@ -801,7 +801,7 @@ struct jpeg_destination_mgr { struct jpeg_source_mgr { const JOCTET * next_input_byte; /* => next byte to read from buffer */ - size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ JMETHOD(void, init_source, (j_decompress_ptr cinfo)); JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); @@ -822,9 +822,9 @@ struct jpeg_source_mgr { * successful. */ -#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ -#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ -#define JPOOL_NUMPOOLS 2 +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 typedef struct jvirt_sarray_control * jvirt_sarray_ptr; typedef struct jvirt_barray_control * jvirt_barray_ptr; @@ -833,38 +833,38 @@ typedef struct jvirt_barray_control * jvirt_barray_ptr; struct jpeg_memory_mgr { /* Method pointers */ JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); + size_t sizeofobject)); JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); + size_t sizeofobject)); JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, - JDIMENSION numrows)); + JDIMENSION samplesperrow, + JDIMENSION numrows)); JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, - JDIMENSION numrows)); + JDIMENSION blocksperrow, + JDIMENSION numrows)); JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION samplesperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); + int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION blocksperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); + int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, - jvirt_sarray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); + jvirt_sarray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, - jvirt_barray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); + jvirt_barray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); JMETHOD(void, self_destruct, (j_common_ptr cinfo)); @@ -892,87 +892,87 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); */ #ifdef HAVE_PROTOTYPES -#define JPP(arglist) arglist +#define JPP(arglist) arglist #else -#define JPP(arglist) () +#define JPP(arglist) () #endif /* Short forms of external names for systems with brain-damaged linkers. * We shorten external names to be unique in the first six letters, which * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 + * (If your compiler itself needs names to be unique in less than 15 * characters, you are out of luck. Get a better compiler.) */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_error jStdError -#define jpeg_CreateCompress jCreaCompress -#define jpeg_CreateDecompress jCreaDecompress -#define jpeg_destroy_compress jDestCompress -#define jpeg_destroy_decompress jDestDecompress -#define jpeg_stdio_dest jStdDest -#define jpeg_stdio_src jStdSrc +#define jpeg_std_error jStdError +#define jpeg_CreateCompress jCreaCompress +#define jpeg_CreateDecompress jCreaDecompress +#define jpeg_destroy_compress jDestCompress +#define jpeg_destroy_decompress jDestDecompress +#define jpeg_stdio_dest jStdDest +#define jpeg_stdio_src jStdSrc #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) -#define jpeg_mem_dest jMemDest -#define jpeg_mem_src jMemSrc +#define jpeg_mem_dest jMemDest +#define jpeg_mem_src jMemSrc #endif -#define jpeg_set_defaults jSetDefaults -#define jpeg_set_colorspace jSetColorspace -#define jpeg_default_colorspace jDefColorspace -#define jpeg_set_quality jSetQuality -#define jpeg_set_linear_quality jSetLQuality +#define jpeg_set_defaults jSetDefaults +#define jpeg_set_colorspace jSetColorspace +#define jpeg_default_colorspace jDefColorspace +#define jpeg_set_quality jSetQuality +#define jpeg_set_linear_quality jSetLQuality #if JPEG_LIB_VERSION >= 70 -#define jpeg_default_qtables jDefQTables +#define jpeg_default_qtables jDefQTables #endif -#define jpeg_add_quant_table jAddQuantTable -#define jpeg_quality_scaling jQualityScaling -#define jpeg_simple_progression jSimProgress -#define jpeg_suppress_tables jSuppressTables -#define jpeg_alloc_quant_table jAlcQTable -#define jpeg_alloc_huff_table jAlcHTable -#define jpeg_start_compress jStrtCompress -#define jpeg_write_scanlines jWrtScanlines -#define jpeg_finish_compress jFinCompress +#define jpeg_add_quant_table jAddQuantTable +#define jpeg_quality_scaling jQualityScaling +#define jpeg_simple_progression jSimProgress +#define jpeg_suppress_tables jSuppressTables +#define jpeg_alloc_quant_table jAlcQTable +#define jpeg_alloc_huff_table jAlcHTable +#define jpeg_start_compress jStrtCompress +#define jpeg_write_scanlines jWrtScanlines +#define jpeg_finish_compress jFinCompress #if JPEG_LIB_VERSION >= 70 -#define jpeg_calc_jpeg_dimensions jCjpegDimensions +#define jpeg_calc_jpeg_dimensions jCjpegDimensions #endif -#define jpeg_write_raw_data jWrtRawData -#define jpeg_write_marker jWrtMarker -#define jpeg_write_m_header jWrtMHeader -#define jpeg_write_m_byte jWrtMByte -#define jpeg_write_tables jWrtTables -#define jpeg_read_header jReadHeader -#define jpeg_start_decompress jStrtDecompress -#define jpeg_read_scanlines jReadScanlines -#define jpeg_finish_decompress jFinDecompress -#define jpeg_read_raw_data jReadRawData -#define jpeg_has_multiple_scans jHasMultScn -#define jpeg_start_output jStrtOutput -#define jpeg_finish_output jFinOutput -#define jpeg_input_complete jInComplete -#define jpeg_new_colormap jNewCMap -#define jpeg_consume_input jConsumeInput +#define jpeg_write_raw_data jWrtRawData +#define jpeg_write_marker jWrtMarker +#define jpeg_write_m_header jWrtMHeader +#define jpeg_write_m_byte jWrtMByte +#define jpeg_write_tables jWrtTables +#define jpeg_read_header jReadHeader +#define jpeg_start_decompress jStrtDecompress +#define jpeg_read_scanlines jReadScanlines +#define jpeg_finish_decompress jFinDecompress +#define jpeg_read_raw_data jReadRawData +#define jpeg_has_multiple_scans jHasMultScn +#define jpeg_start_output jStrtOutput +#define jpeg_finish_output jFinOutput +#define jpeg_input_complete jInComplete +#define jpeg_new_colormap jNewCMap +#define jpeg_consume_input jConsumeInput #if JPEG_LIB_VERSION >= 80 -#define jpeg_core_output_dimensions jCoreDimensions +#define jpeg_core_output_dimensions jCoreDimensions #endif -#define jpeg_calc_output_dimensions jCalcDimensions -#define jpeg_save_markers jSaveMarkers -#define jpeg_set_marker_processor jSetMarker -#define jpeg_read_coefficients jReadCoefs -#define jpeg_write_coefficients jWrtCoefs -#define jpeg_copy_critical_parameters jCopyCrit -#define jpeg_abort_compress jAbrtCompress -#define jpeg_abort_decompress jAbrtDecompress -#define jpeg_abort jAbort -#define jpeg_destroy jDestroy -#define jpeg_resync_to_restart jResyncRestart +#define jpeg_calc_output_dimensions jCalcDimensions +#define jpeg_save_markers jSaveMarkers +#define jpeg_set_marker_processor jSetMarker +#define jpeg_read_coefficients jReadCoefs +#define jpeg_write_coefficients jWrtCoefs +#define jpeg_copy_critical_parameters jCopyCrit +#define jpeg_abort_compress jAbrtCompress +#define jpeg_abort_decompress jAbrtDecompress +#define jpeg_abort jAbort +#define jpeg_destroy jDestroy +#define jpeg_resync_to_restart jResyncRestart #endif /* NEED_SHORT_EXTERNAL_NAMES */ /* Default error-management setup */ EXTERN(struct jpeg_error_mgr *) jpeg_std_error - JPP((struct jpeg_error_mgr * err)); + JPP((struct jpeg_error_mgr * err)); /* Initialization of JPEG compression objects. * jpeg_create_compress() and jpeg_create_decompress() are the exported @@ -983,14 +983,14 @@ EXTERN(struct jpeg_error_mgr *) jpeg_std_error */ #define jpeg_create_compress(cinfo) \ jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_compress_struct)) + (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)) + (size_t) sizeof(struct jpeg_decompress_struct)) EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, - int version, size_t structsize)); + int version, size_t structsize)); EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, - int version, size_t structsize)); + 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)); @@ -1003,45 +1003,45 @@ EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) /* Data source and destination managers: memory buffers. */ EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, - unsigned char ** outbuffer, - unsigned long * outsize)); + unsigned char ** outbuffer, + unsigned long * outsize)); EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, - unsigned char * inbuffer, - unsigned long insize)); + unsigned char * inbuffer, + unsigned long insize)); #endif /* Default parameter setup for compression */ 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)); + 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)); + boolean force_baseline)); EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, - int scale_factor, - boolean force_baseline)); + int scale_factor, + boolean force_baseline)); #if JPEG_LIB_VERSION >= 70 EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, - boolean force_baseline)); + boolean force_baseline)); #endif 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)); + 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)); + 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)); + boolean write_all_tables)); EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION num_lines)); + JSAMPARRAY scanlines, + JDIMENSION num_lines)); EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); #if JPEG_LIB_VERSION >= 70 @@ -1051,29 +1051,29 @@ EXTERN(void) jpeg_calc_jpeg_dimensions 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)); + JSAMPIMAGE data, + JDIMENSION num_lines)); /* Write a special marker. See libjpeg.txt concerning safe usage. */ EXTERN(void) jpeg_write_marker - JPP((j_compress_ptr cinfo, int marker, - const JOCTET * dataptr, unsigned int datalen)); + JPP((j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen)); /* Same, but piecemeal. */ EXTERN(void) jpeg_write_m_header - JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); + JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); EXTERN(void) jpeg_write_m_byte - JPP((j_compress_ptr cinfo, int val)); + JPP((j_compress_ptr cinfo, int val)); /* Alternate compression function: just write an abbreviated table file */ 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)); + 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 */ -#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ /* If you pass require_image = TRUE (normal case), you need not check for * a TABLES_ONLY return code; an abbreviated file will cause an error exit. * JPEG_SUSPENDED is only possible if you use a data source module that can @@ -1083,29 +1083,29 @@ 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)); + 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)); + 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)); + 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 */ -#define JPEG_REACHED_EOI 2 /* Reached end of image */ -#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ -#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ /* Precalculate output dimensions for current decompression parameters. */ #if JPEG_LIB_VERSION >= 80 @@ -1115,20 +1115,20 @@ EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); /* Control saving of COM and APPn markers into marker_list. */ EXTERN(void) jpeg_save_markers - JPP((j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit)); + JPP((j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit)); /* 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)); + 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)); + jvirt_barray_ptr * coef_arrays)); EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, - j_compress_ptr dstinfo)); + 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, @@ -1147,17 +1147,17 @@ 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)); + int desired)); /* These marker codes are exported since applications and data source modules * are likely to want to use them. */ -#define JPEG_RST0 0xD0 /* RST0 marker code */ -#define JPEG_EOI 0xD9 /* EOI marker code */ -#define JPEG_APP0 0xE0 /* APP0 marker code */ -#define JPEG_COM 0xFE /* COM marker code */ +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ /* If we have a brain-damaged compiler that emits warnings (or worse, errors) @@ -1166,7 +1166,7 @@ EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, */ #ifdef INCOMPLETE_TYPES_BROKEN -#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ struct jvirt_sarray_control { long dummy; }; struct jvirt_barray_control { long dummy; }; struct jpeg_comp_master { long dummy; }; @@ -1201,8 +1201,8 @@ struct jpeg_color_quantizer { long dummy; }; */ #ifdef JPEG_INTERNALS -#include "jpegint.h" /* fetch private declarations */ -#include "jerror.h" /* fetch error codes too */ +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ #endif #ifdef __cplusplus diff --git a/jpegtran.c b/jpegtran.c index 5bfab483..c7906f4d 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -13,18 +13,18 @@ * provides some lossless and sort-of-lossless transformations of JPEG data. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include "transupp.h" /* Support routines for jpegtran */ -#include "jversion.h" /* for version message */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "transupp.h" /* Support routines for jpegtran */ +#include "jversion.h" /* for version message */ #include "jconfigint.h" -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ #include /* Metrowerks needs this */ -#include /* ... and this */ +#include /* ... and this */ #endif #ifdef THINK_C -#include /* Think declares it here */ +#include /* Think declares it here */ #endif #endif @@ -38,9 +38,9 @@ */ -static const char * progname; /* program name for error messages */ -static char * outfilename; /* for -outfile switch */ -static JCOPY_OPTION copyoption; /* -copy switch */ +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ +static JCOPY_OPTION copyoption; /* -copy switch */ static jpeg_transform_info transformoption; /* image transformation options */ @@ -106,12 +106,12 @@ select_transform (JXFORM_CODE transform) transformoption.transform = transform; } else { fprintf(stderr, "%s: can only do one image transformation at a time\n", - progname); + progname); usage(); } #else fprintf(stderr, "%s: sorry, image transformation was not compiled\n", - progname); + progname); exit(EXIT_FAILURE); #endif } @@ -119,7 +119,7 @@ select_transform (JXFORM_CODE transform) LOCAL(int) parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) + int last_file_arg_seen, boolean for_real) /* Parse optional switches. * Returns argv[] index of first file-name argument (== argc if none). * Any file names with indexes <= last_file_arg_seen are ignored; @@ -132,7 +132,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, int argn; char * arg; boolean simple_progressive; - char * scansarg = NULL; /* saves -scans parm if any */ + char * scansarg = NULL; /* saves -scans parm if any */ /* Set up default JPEG parameters. */ simple_progressive = FALSE; @@ -153,12 +153,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, if (*arg != '-') { /* Not a switch, must be a file name argument */ if (argn <= last_file_arg_seen) { - outfilename = NULL; /* -outfile applies to just one input file */ - continue; /* ignore this name if previously processed */ + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ } - break; /* else done parsing switches */ + break; /* else done parsing switches */ } - arg++; /* advance past switch marker character */ + arg++; /* advance past switch marker character */ if (keymatch(arg, "arithmetic", 1)) { /* Use arithmetic coding. */ @@ -166,35 +166,35 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, cinfo->arith_code = TRUE; #else fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", - progname); + progname); exit(EXIT_FAILURE); #endif } else if (keymatch(arg, "copy", 2)) { /* Select which extra markers to copy. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "none", 1)) { - copyoption = JCOPYOPT_NONE; + copyoption = JCOPYOPT_NONE; } else if (keymatch(argv[argn], "comments", 1)) { - copyoption = JCOPYOPT_COMMENTS; + copyoption = JCOPYOPT_COMMENTS; } else if (keymatch(argv[argn], "all", 1)) { - copyoption = JCOPYOPT_ALL; + copyoption = JCOPYOPT_ALL; } else - usage(); + usage(); } else if (keymatch(arg, "crop", 2)) { /* Perform lossless cropping. */ #if TRANSFORMS_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (! jtransform_parse_crop_spec(&transformoption, argv[argn])) { - fprintf(stderr, "%s: bogus -crop argument '%s'\n", - progname, argv[argn]); - exit(EXIT_FAILURE); + fprintf(stderr, "%s: bogus -crop argument '%s'\n", + progname, argv[argn]); + exit(EXIT_FAILURE); } #else - select_transform(JXFORM_NONE); /* force an error */ + select_transform(JXFORM_NONE); /* force an error */ #endif } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { @@ -203,32 +203,32 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, static boolean printed_version = FALSE; if (! printed_version) { - fprintf(stderr, "%s version %s (build %s)\n", - PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", JCOPYRIGHT); - fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", - JVERSION); - printed_version = TRUE; + fprintf(stderr, "%s version %s (build %s)\n", + PACKAGE_NAME, VERSION, BUILD); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n", + JVERSION); + printed_version = TRUE; } cinfo->err->trace_level++; } else if (keymatch(arg, "flip", 1)) { /* Mirror left-right or top-bottom. */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "horizontal", 1)) - select_transform(JXFORM_FLIP_H); + select_transform(JXFORM_FLIP_H); else if (keymatch(argv[argn], "vertical", 1)) - select_transform(JXFORM_FLIP_V); + select_transform(JXFORM_FLIP_V); else - usage(); + usage(); } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { /* Force to grayscale. */ #if TRANSFORMS_SUPPORTED transformoption.force_grayscale = TRUE; #else - select_transform(JXFORM_NONE); /* force an error */ + select_transform(JXFORM_NONE); /* force an error */ #endif } else if (keymatch(arg, "maxmemory", 3)) { @@ -236,12 +236,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, long lval; char ch = 'x'; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); + usage(); if (ch == 'm' || ch == 'M') - lval *= 1000L; + lval *= 1000L; cinfo->mem->max_memory_to_use = lval * 1000L; } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { @@ -250,15 +250,15 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, cinfo->optimize_coding = TRUE; #else fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", - progname); + progname); exit(EXIT_FAILURE); #endif } else if (keymatch(arg, "outfile", 4)) { /* Set output file name. */ - if (++argn >= argc) /* advance to next argument */ - usage(); - outfilename = argv[argn]; /* save it away for later use */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ } else if (keymatch(arg, "perfect", 2)) { /* Fail if there is any partial edge MCUs that the transform can't @@ -272,7 +272,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, /* We must postpone execution until num_components is known. */ #else fprintf(stderr, "%s: sorry, progressive output was not compiled\n", - progname); + progname); exit(EXIT_FAILURE); #endif @@ -281,43 +281,43 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, long lval; char ch = 'x'; - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) - usage(); + usage(); if (lval < 0 || lval > 65535L) - usage(); + usage(); if (ch == 'b' || ch == 'B') { - cinfo->restart_interval = (unsigned int) lval; - cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ + cinfo->restart_interval = (unsigned int) lval; + cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ } else { - cinfo->restart_in_rows = (int) lval; - /* restart_interval will be computed during startup */ + cinfo->restart_in_rows = (int) lval; + /* restart_interval will be computed during startup */ } } else if (keymatch(arg, "rotate", 2)) { /* Rotate 90, 180, or 270 degrees (measured clockwise). */ - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); if (keymatch(argv[argn], "90", 2)) - select_transform(JXFORM_ROT_90); + select_transform(JXFORM_ROT_90); else if (keymatch(argv[argn], "180", 3)) - select_transform(JXFORM_ROT_180); + select_transform(JXFORM_ROT_180); else if (keymatch(argv[argn], "270", 3)) - select_transform(JXFORM_ROT_270); + select_transform(JXFORM_ROT_270); else - usage(); + usage(); } else if (keymatch(arg, "scans", 1)) { /* Set scan script. */ #ifdef C_MULTISCAN_FILES_SUPPORTED - if (++argn >= argc) /* advance to next argument */ - usage(); + if (++argn >= argc) /* advance to next argument */ + usage(); scansarg = argv[argn]; /* We must postpone reading the file in case -progressive appears. */ #else fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", - progname); + progname); exit(EXIT_FAILURE); #endif @@ -334,7 +334,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, transformoption.trim = TRUE; } else { - usage(); /* bogus switch */ + usage(); /* bogus switch */ } } @@ -343,18 +343,18 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, if (for_real) { #ifdef C_PROGRESSIVE_SUPPORTED - if (simple_progressive) /* process -progressive; -scans can override */ + if (simple_progressive) /* process -progressive; -scans can override */ jpeg_simple_progression(cinfo); #endif #ifdef C_MULTISCAN_FILES_SUPPORTED - if (scansarg != NULL) /* process -scans if it was present */ + if (scansarg != NULL) /* process -scans if it was present */ if (! read_scan_script(cinfo, scansarg)) - usage(); + usage(); #endif } - return argn; /* return index of next arg (file name) */ + return argn; /* return index of next arg (file name) */ } @@ -386,7 +386,7 @@ main (int argc, char **argv) progname = argv[0]; if (progname == NULL || progname[0] == 0) - progname = "jpegtran"; /* in case C library doesn't provide it */ + progname = "jpegtran"; /* in case C library doesn't provide it */ /* Initialize the JPEG decompression object with default error handling. */ srcinfo.err = jpeg_std_error(&jsrcerr); @@ -419,14 +419,14 @@ main (int argc, char **argv) if (outfilename == NULL) { if (file_index != argc-2) { fprintf(stderr, "%s: must name one input and one output file\n", - progname); + progname); usage(); } outfilename = argv[file_index+1]; } else { if (file_index != argc-1) { fprintf(stderr, "%s: must name one input and one output file\n", - progname); + progname); usage(); } } @@ -485,8 +485,8 @@ main (int argc, char **argv) */ #if TRANSFORMS_SUPPORTED dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); + src_coef_arrays, + &transformoption); #else dst_coef_arrays = src_coef_arrays; #endif @@ -527,8 +527,8 @@ main (int argc, char **argv) /* Execute image transformation, if any */ #if TRANSFORMS_SUPPORTED jtransform_execute_transformation(&srcinfo, &dstinfo, - src_coef_arrays, - &transformoption); + src_coef_arrays, + &transformoption); #endif /* Finish compression and release memory */ @@ -547,5 +547,5 @@ main (int argc, char **argv) /* All done. */ exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ + return 0; /* suppress no-return-value warnings */ } diff --git a/jquant1.c b/jquant1.c index aa2c59a4..dbcdd277 100644 --- a/jquant1.c +++ b/jquant1.c @@ -70,9 +70,9 @@ * table in both directions. */ -#define ODITHER_SIZE 16 /* dimension of dither matrix */ +#define ODITHER_SIZE 16 /* dimension of dither matrix */ /* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */ -#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */ +#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */ #define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */ typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; @@ -107,8 +107,8 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { * Errors are accumulated into the array fserrors[], at a resolution of * 1/16th of a pixel count. The error at a given pixel is propagated * to its not-yet-processed neighbors using the standard F-S fractions, - * ... (here) 7/16 - * 3/16 5/16 1/16 + * ... (here) 7/16 + * 3/16 5/16 1/16 * We work left-to-right on even rows, right-to-left on odd rows. * * We can get away with a single array (holding one row's worth of errors) @@ -127,43 +127,43 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { */ #if BITS_IN_JSAMPLE == 8 -typedef INT16 FSERROR; /* 16 bits should be enough */ -typedef int LOCFSERROR; /* use 'int' for calculation temps */ +typedef INT16 FSERROR; /* 16 bits should be enough */ +typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else -typedef INT32 FSERROR; /* may need more than 16 bits */ -typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ +typedef INT32 FSERROR; /* may need more than 16 bits */ +typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif -typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ +typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ /* Private subobject */ -#define MAX_Q_COMPS 4 /* max components I can handle */ +#define MAX_Q_COMPS 4 /* max components I can handle */ typedef struct { struct jpeg_color_quantizer pub; /* public fields */ /* Initially allocated colormap is saved here */ - JSAMPARRAY sv_colormap; /* The color map as a 2-D pixel array */ - int sv_actual; /* number of entries in use */ + JSAMPARRAY sv_colormap; /* The color map as a 2-D pixel array */ + int sv_actual; /* number of entries in use */ - JSAMPARRAY colorindex; /* Precomputed mapping for speed */ + JSAMPARRAY colorindex; /* Precomputed mapping for speed */ /* colorindex[i][j] = index of color closest to pixel value j in component i, * premultiplied as described above. Since colormap indexes must fit into * JSAMPLEs, the entries of this array will too. */ - boolean is_padded; /* is the colorindex padded for odither? */ + boolean is_padded; /* is the colorindex padded for odither? */ - int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ + int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ /* Variables for ordered dithering */ - int row_index; /* cur row's vertical index in dither matrix */ + int row_index; /* cur row's vertical index in dither matrix */ ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ /* Variables for Floyd-Steinberg dithering */ FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ - boolean on_odd_row; /* flag to remember which row we are on */ + boolean on_odd_row; /* flag to remember which row we are on */ } my_cquantizer; typedef my_cquantizer * my_cquantize_ptr; @@ -205,11 +205,11 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) iroot = 1; do { iroot++; - temp = iroot; /* set temp = iroot ** nc */ + temp = iroot; /* set temp = iroot ** nc */ for (i = 1; i < nc; i++) temp *= iroot; } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */ - iroot--; /* now iroot = floor(root) */ + iroot--; /* now iroot = floor(root) */ /* Must have at least 2 color values per component */ if (iroot < 2) @@ -233,10 +233,10 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i); /* calculate new total_colors if Ncolors[j] is incremented */ temp = total_colors / Ncolors[j]; - temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */ + temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */ if (temp > (long) max_colors) - break; /* won't fit, done with this pass */ - Ncolors[j]++; /* OK, apply the increment */ + break; /* won't fit, done with this pass */ + Ncolors[j]++; /* OK, apply the increment */ total_colors = (int) temp; changed = TRUE; } @@ -278,8 +278,8 @@ LOCAL(void) create_colormap (j_decompress_ptr cinfo) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - JSAMPARRAY colormap; /* Created colormap */ - int total_colors; /* Number of distinct output colors */ + JSAMPARRAY colormap; /* Created colormap */ + int total_colors; /* Number of distinct output colors */ int i,j,k, nci, blksize, blkdist, ptr, val; /* Select number of colors for each component */ @@ -288,8 +288,8 @@ create_colormap (j_decompress_ptr cinfo) /* Report selected color counts */ if (cinfo->out_color_components == 3) TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, - total_colors, cquantize->Ncolors[0], - cquantize->Ncolors[1], cquantize->Ncolors[2]); + total_colors, cquantize->Ncolors[0], + cquantize->Ncolors[1], cquantize->Ncolors[2]); else TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); @@ -314,12 +314,12 @@ create_colormap (j_decompress_ptr cinfo) val = output_value(cinfo, i, j, nci-1); /* Fill in all colormap entries that have this value of this component */ for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { - /* fill in blksize entries beginning at ptr */ - for (k = 0; k < blksize; k++) - colormap[i][ptr+k] = (JSAMPLE) val; + /* fill in blksize entries beginning at ptr */ + for (k = 0; k < blksize; k++) + colormap[i][ptr+k] = (JSAMPLE) val; } } - blkdist = blksize; /* blksize of this color is blkdist of next */ + blkdist = blksize; /* blksize of this color is blkdist of next */ } /* Save the colormap in private storage, @@ -377,16 +377,16 @@ create_colorindex (j_decompress_ptr cinfo) val = 0; k = largest_input_value(cinfo, i, 0, nci-1); for (j = 0; j <= MAXJSAMPLE; j++) { - while (j > k) /* advance val if past boundary */ - k = largest_input_value(cinfo, i, ++val, nci-1); + while (j > k) /* advance val if past boundary */ + k = largest_input_value(cinfo, i, ++val, nci-1); /* premultiply so that no multiplication needed in main processing */ indexptr[j] = (JSAMPLE) (val * blksize); } /* Pad at both ends if necessary */ if (pad) for (j = 1; j <= MAXJSAMPLE; j++) { - indexptr[-j] = indexptr[0]; - indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE]; + indexptr[-j] = indexptr[0]; + indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE]; } } } @@ -406,7 +406,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) odither = (ODITHER_MATRIX_PTR) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ODITHER_MATRIX)); + SIZEOF(ODITHER_MATRIX)); /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). * Hence the dither value for the matrix cell with fill order f * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). @@ -416,7 +416,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) for (j = 0; j < ODITHER_SIZE; j++) { for (k = 0; k < ODITHER_SIZE; k++) { num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) - * MAXJSAMPLE; + * MAXJSAMPLE; /* Ensure round towards zero despite C's lack of consistency * about rounding negative values in integer division... */ @@ -429,7 +429,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) /* * Create the ordered-dither tables. - * Components having the same number of representative colors may + * Components having the same number of representative colors may * share a dither table. */ @@ -442,14 +442,14 @@ create_odither_tables (j_decompress_ptr cinfo) for (i = 0; i < cinfo->out_color_components; i++) { nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ - odither = NULL; /* search for matching prior component */ + odither = NULL; /* search for matching prior component */ for (j = 0; j < i; j++) { if (nci == cquantize->Ncolors[j]) { - odither = cquantize->odither[j]; - break; + odither = cquantize->odither[j]; + break; } } - if (odither == NULL) /* need a new table? */ + if (odither == NULL) /* need a new table? */ odither = make_odither_array(cinfo, nci); cquantize->odither[i] = odither; } @@ -462,7 +462,7 @@ create_odither_tables (j_decompress_ptr cinfo) METHODDEF(void) color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY output_buf, int num_rows) /* General case, no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -480,7 +480,7 @@ color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (col = width; col > 0; col--) { pixcode = 0; for (ci = 0; ci < nc; ci++) { - pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]); + pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]); } *ptrout++ = (JSAMPLE) pixcode; } @@ -490,7 +490,7 @@ color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, METHODDEF(void) color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -518,15 +518,15 @@ color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, METHODDEF(void) quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY output_buf, int num_rows) /* General case, with ordered dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; register JSAMPROW input_ptr; register JSAMPROW output_ptr; JSAMPROW colorindex_ci; - int * dither; /* points to active row of dither matrix */ - int row_index, col_index; /* current indexes into dither matrix */ + int * dither; /* points to active row of dither matrix */ + int row_index, col_index; /* current indexes into dither matrix */ int nc = cinfo->out_color_components; int ci; int row; @@ -536,7 +536,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); + (size_t) (width * SIZEOF(JSAMPLE))); row_index = cquantize->row_index; for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; @@ -546,17 +546,17 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, col_index = 0; for (col = width; col > 0; col--) { - /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, - * select output value, accumulate into output code for this pixel. - * Range-limiting need not be done explicitly, as we have extended - * the colorindex table to produce the right answers for out-of-range - * inputs. The maximum dither is +- MAXJSAMPLE; this sets the - * required amount of padding. - */ - *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; - input_ptr += nc; - output_ptr++; - col_index = (col_index + 1) & ODITHER_MASK; + /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, + * select output value, accumulate into output code for this pixel. + * Range-limiting need not be done explicitly, as we have extended + * the colorindex table to produce the right answers for out-of-range + * inputs. The maximum dither is +- MAXJSAMPLE; this sets the + * required amount of padding. + */ + *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; + input_ptr += nc; + output_ptr++; + col_index = (col_index + 1) & ODITHER_MASK; } } /* Advance row index for next row */ @@ -568,7 +568,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, METHODDEF(void) quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY output_buf, int num_rows) /* Fast path for out_color_components==3, with ordered dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -578,10 +578,10 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPROW colorindex0 = cquantize->colorindex[0]; JSAMPROW colorindex1 = cquantize->colorindex[1]; JSAMPROW colorindex2 = cquantize->colorindex[2]; - int * dither0; /* points to active row of dither matrix */ + int * dither0; /* points to active row of dither matrix */ int * dither1; int * dither2; - int row_index, col_index; /* current indexes into dither matrix */ + int row_index, col_index; /* current indexes into dither matrix */ int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; @@ -597,11 +597,11 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (col = width; col > 0; col--) { pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + - dither0[col_index]]); + dither0[col_index]]); pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + - dither1[col_index]]); + dither1[col_index]]); pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + - dither2[col_index]]); + dither2[col_index]]); *output_ptr++ = (JSAMPLE) pixcode; col_index = (col_index + 1) & ODITHER_MASK; } @@ -613,24 +613,24 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, METHODDEF(void) quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, - JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY output_buf, int num_rows) /* General case, with Floyd-Steinberg dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register LOCFSERROR cur; /* current error or pixel value */ - LOCFSERROR belowerr; /* error for pixel below cur */ - LOCFSERROR bpreverr; /* error for below/prev col */ - LOCFSERROR bnexterr; /* error for below/next col */ + register LOCFSERROR cur; /* current error or pixel value */ + LOCFSERROR belowerr; /* error for pixel below cur */ + LOCFSERROR bpreverr; /* error for below/prev col */ + LOCFSERROR bnexterr; /* error for below/next col */ LOCFSERROR delta; - register FSERRPTR errorptr; /* => fserrors[] at column before current */ + register FSERRPTR errorptr; /* => fserrors[] at column before current */ register JSAMPROW input_ptr; register JSAMPROW output_ptr; JSAMPROW colorindex_ci; JSAMPROW colormap_ci; int pixcode; int nc = cinfo->out_color_components; - int dir; /* 1 for left-to-right, -1 for right-to-left */ - int dirnc; /* dir * nc */ + int dir; /* 1 for left-to-right, -1 for right-to-left */ + int dirnc; /* dir * nc */ int ci; int row; JDIMENSION col; @@ -641,22 +641,22 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); + (size_t) (width * SIZEOF(JSAMPLE))); for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; output_ptr = output_buf[row]; if (cquantize->on_odd_row) { - /* work right to left in this row */ - input_ptr += (width-1) * nc; /* so point to rightmost pixel */ - output_ptr += width-1; - dir = -1; - dirnc = -nc; - errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */ + /* work right to left in this row */ + input_ptr += (width-1) * nc; /* so point to rightmost pixel */ + output_ptr += width-1; + dir = -1; + dirnc = -nc; + errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */ } else { - /* work left to right in this row */ - dir = 1; - dirnc = nc; - errorptr = cquantize->fserrors[ci]; /* => entry before first column */ + /* work left to right in this row */ + dir = 1; + dirnc = nc; + errorptr = cquantize->fserrors[ci]; /* => entry before first column */ } colorindex_ci = cquantize->colorindex[ci]; colormap_ci = cquantize->sv_colormap[ci]; @@ -666,47 +666,47 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, belowerr = bpreverr = 0; for (col = width; col > 0; col--) { - /* cur holds the error propagated from the previous pixel on the - * current line. Add the error propagated from the previous line - * to form the complete error correction term for this pixel, and - * round the error term (which is expressed * 16) to an integer. - * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct - * for either sign of the error value. - * Note: errorptr points to *previous* column's array entry. - */ - cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4); - /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. - * The maximum error is +- MAXJSAMPLE; this sets the required size - * of the range_limit array. - */ - cur += GETJSAMPLE(*input_ptr); - cur = GETJSAMPLE(range_limit[cur]); - /* Select output value, accumulate into output code for this pixel */ - pixcode = GETJSAMPLE(colorindex_ci[cur]); - *output_ptr += (JSAMPLE) pixcode; - /* Compute actual representation error at this pixel */ - /* Note: we can do this even though we don't have the final */ - /* pixel code, because the colormap is orthogonal. */ - cur -= GETJSAMPLE(colormap_ci[pixcode]); - /* Compute error fractions to be propagated to adjacent pixels. - * Add these into the running sums, and simultaneously shift the - * next-line error sums left by 1 column. - */ - bnexterr = cur; - delta = cur * 2; - cur += delta; /* form error * 3 */ - errorptr[0] = (FSERROR) (bpreverr + cur); - cur += delta; /* form error * 5 */ - bpreverr = belowerr + cur; - belowerr = bnexterr; - cur += delta; /* form error * 7 */ - /* At this point cur contains the 7/16 error value to be propagated - * to the next pixel on the current line, and all the errors for the - * next line have been shifted over. We are therefore ready to move on. - */ - input_ptr += dirnc; /* advance input ptr to next column */ - output_ptr += dir; /* advance output ptr to next column */ - errorptr += dir; /* advance errorptr to current column */ + /* cur holds the error propagated from the previous pixel on the + * current line. Add the error propagated from the previous line + * to form the complete error correction term for this pixel, and + * round the error term (which is expressed * 16) to an integer. + * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct + * for either sign of the error value. + * Note: errorptr points to *previous* column's array entry. + */ + cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4); + /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. + * The maximum error is +- MAXJSAMPLE; this sets the required size + * of the range_limit array. + */ + cur += GETJSAMPLE(*input_ptr); + cur = GETJSAMPLE(range_limit[cur]); + /* Select output value, accumulate into output code for this pixel */ + pixcode = GETJSAMPLE(colorindex_ci[cur]); + *output_ptr += (JSAMPLE) pixcode; + /* Compute actual representation error at this pixel */ + /* Note: we can do this even though we don't have the final */ + /* pixel code, because the colormap is orthogonal. */ + cur -= GETJSAMPLE(colormap_ci[pixcode]); + /* Compute error fractions to be propagated to adjacent pixels. + * Add these into the running sums, and simultaneously shift the + * next-line error sums left by 1 column. + */ + bnexterr = cur; + delta = cur * 2; + cur += delta; /* form error * 3 */ + errorptr[0] = (FSERROR) (bpreverr + cur); + cur += delta; /* form error * 5 */ + bpreverr = belowerr + cur; + belowerr = bnexterr; + cur += delta; /* form error * 7 */ + /* At this point cur contains the 7/16 error value to be propagated + * to the next pixel on the current line, and all the errors for the + * next line have been shifted over. We are therefore ready to move on. + */ + input_ptr += dirnc; /* advance input ptr to next column */ + output_ptr += dir; /* advance output ptr to next column */ + errorptr += dir; /* advance errorptr to current column */ } /* Post-loop cleanup: we must unload the final error value into the * final fserrors[] entry. Note we need not unload belowerr because @@ -766,7 +766,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) cquantize->pub.color_quantize = quantize3_ord_dither; else cquantize->pub.color_quantize = quantize_ord_dither; - cquantize->row_index = 0; /* initialize state for ordered dither */ + cquantize->row_index = 0; /* initialize state for ordered dither */ /* If user changed to ordered dither from another mode, * we must recreate the color index table with padding. * This will cost extra space, but probably isn't very likely. @@ -829,13 +829,13 @@ jinit_1pass_quantizer (j_decompress_ptr cinfo) cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); + SIZEOF(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_1_quant; cquantize->pub.finish_pass = finish_pass_1_quant; cquantize->pub.new_color_map = new_color_map_1_quant; cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */ - cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */ + cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */ /* Make sure my internal arrays won't overflow */ if (cinfo->out_color_components > MAX_Q_COMPS) diff --git a/jquant2.c b/jquant2.c index 47a1f90a..0fdb1975 100644 --- a/jquant2.c +++ b/jquant2.c @@ -72,9 +72,9 @@ * probably need to change these scale factors. */ -#define R_SCALE 2 /* scale R distances by this much */ -#define G_SCALE 3 /* scale G distances by this much */ -#define B_SCALE 1 /* and B by this much */ +#define R_SCALE 2 /* scale R distances by this much */ +#define G_SCALE 3 /* scale G distances by this much */ +#define B_SCALE 1 /* and B by this much */ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE}; #define C0_SCALE c_scales[rgb_red[cinfo->out_color_space]] @@ -112,9 +112,9 @@ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE}; /* These will do the right thing for either R,G,B or B,G,R color order, * but you may not like the results for other color orders. */ -#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ -#define HIST_C1_BITS 6 /* bits of precision in G histogram */ -#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ +#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ +#define HIST_C1_BITS 6 /* bits of precision in G histogram */ +#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ /* Number of elements along histogram axes. */ #define HIST_C0_ELEMS (1<cquantize; register JSAMPROW ptr; @@ -220,11 +220,11 @@ prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (col = width; col > 0; col--) { /* get pixel value and index into the histogram */ histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] - [GETJSAMPLE(ptr[1]) >> C1_SHIFT] - [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; + [GETJSAMPLE(ptr[1]) >> C1_SHIFT] + [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; /* increment, check for overflow and undo increment if so. */ if (++(*histp) <= 0) - (*histp)--; + (*histp)--; ptr += 3; } } @@ -312,67 +312,67 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) if (c0max > c0min) for (c0 = c0min; c0 <= c0max; c0++) for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0min = c0min = c0; - goto have_c0min; - } + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0min = c0min = c0; + goto have_c0min; + } } have_c0min: if (c0max > c0min) for (c0 = c0max; c0 >= c0min; c0--) for (c1 = c1min; c1 <= c1max; c1++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c0max = c0max = c0; - goto have_c0max; - } + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0max = c0max = c0; + goto have_c0max; + } } have_c0max: if (c1max > c1min) for (c1 = c1min; c1 <= c1max; c1++) for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1min = c1min = c1; - goto have_c1min; - } + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1min = c1min = c1; + goto have_c1min; + } } have_c1min: if (c1max > c1min) for (c1 = c1max; c1 >= c1min; c1--) for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1][c2min]; - for (c2 = c2min; c2 <= c2max; c2++) - if (*histp++ != 0) { - boxp->c1max = c1max = c1; - goto have_c1max; - } + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1max = c1max = c1; + goto have_c1max; + } } have_c1max: if (c2max > c2min) for (c2 = c2min; c2 <= c2max; c2++) for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2min = c2min = c2; - goto have_c2min; - } + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) + if (*histp != 0) { + boxp->c2min = c2min = c2; + goto have_c2min; + } } have_c2min: if (c2max > c2min) for (c2 = c2max; c2 >= c2min; c2--) for (c0 = c0min; c0 <= c0max; c0++) { - histp = & histogram[c0][c1min][c2]; - for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) - if (*histp != 0) { - boxp->c2max = c2max = c2; - goto have_c2max; - } + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) + if (*histp != 0) { + boxp->c2max = c2max = c2; + goto have_c2max; + } } have_c2max: @@ -395,9 +395,9 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++, histp++) - if (*histp != 0) { - ccount++; - } + if (*histp != 0) { + ccount++; + } } boxp->colorcount = ccount; } @@ -405,7 +405,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) LOCAL(int) median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, - int desired_colors) + int desired_colors) /* Repeatedly select and split the largest box until we have enough boxes */ { int n,lb; @@ -421,9 +421,9 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, } else { b1 = find_biggest_volume(boxlist, numboxes); } - if (b1 == NULL) /* no splittable boxes left! */ + if (b1 == NULL) /* no splittable boxes left! */ break; - b2 = &boxlist[numboxes]; /* where new box will go */ + b2 = &boxlist[numboxes]; /* where new box will go */ /* Copy the color bounds to the new box. */ b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; @@ -504,12 +504,12 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) for (c1 = c1min; c1 <= c1max; c1++) { histp = & histogram[c0][c1][c2min]; for (c2 = c2min; c2 <= c2max; c2++) { - if ((count = *histp++) != 0) { - total += count; - c0total += ((c0 << C0_SHIFT) + ((1<>1)) * count; - c1total += ((c1 << C1_SHIFT) + ((1<>1)) * count; - c2total += ((c2 << C2_SHIFT) + ((1<>1)) * count; - } + if ((count = *histp++) != 0) { + total += count; + c0total += ((c0 << C0_SHIFT) + ((1<>1)) * count; + c1total += ((c1 << C1_SHIFT) + ((1<>1)) * count; + c2total += ((c2 << C2_SHIFT) + ((1<>1)) * count; + } } } @@ -628,7 +628,7 @@ select_colors (j_decompress_ptr cinfo, int desired_colors) LOCAL(int) find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, - JSAMPLE colorlist[]) + JSAMPLE colorlist[]) /* Locate the colormap entries close enough to an update box to be candidates * for the nearest entry to some cell(s) in the update box. The update box * is specified by the center coordinates of its first cell. The number of @@ -643,7 +643,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int centerc0, centerc1, centerc2; int i, x, ncolors; INT32 minmaxdist, min_dist, max_dist, tdist; - INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ + INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ /* Compute true coordinates of update box's upper corner and center. * Actually we compute the coordinates of the center of the upper-corner @@ -685,11 +685,11 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, /* within cell range so no contribution to min_dist */ min_dist = 0; if (x <= centerc0) { - tdist = (x - maxc0) * C0_SCALE; - max_dist = tdist*tdist; + tdist = (x - maxc0) * C0_SCALE; + max_dist = tdist*tdist; } else { - tdist = (x - minc0) * C0_SCALE; - max_dist = tdist*tdist; + tdist = (x - minc0) * C0_SCALE; + max_dist = tdist*tdist; } } @@ -707,11 +707,11 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, } else { /* within cell range so no contribution to min_dist */ if (x <= centerc1) { - tdist = (x - maxc1) * C1_SCALE; - max_dist += tdist*tdist; + tdist = (x - maxc1) * C1_SCALE; + max_dist += tdist*tdist; } else { - tdist = (x - minc1) * C1_SCALE; - max_dist += tdist*tdist; + tdist = (x - minc1) * C1_SCALE; + max_dist += tdist*tdist; } } @@ -729,15 +729,15 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, } else { /* within cell range so no contribution to min_dist */ if (x <= centerc2) { - tdist = (x - maxc2) * C2_SCALE; - max_dist += tdist*tdist; + tdist = (x - maxc2) * C2_SCALE; + max_dist += tdist*tdist; } else { - tdist = (x - minc2) * C2_SCALE; - max_dist += tdist*tdist; + tdist = (x - minc2) * C2_SCALE; + max_dist += tdist*tdist; } } - mindist[i] = min_dist; /* save away the results */ + mindist[i] = min_dist; /* save away the results */ if (max_dist < minmaxdist) minmaxdist = max_dist; } @@ -757,7 +757,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, LOCAL(void) find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, - int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) + int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) /* Find the closest colormap entry for each cell in the update box, * given the list of candidate colors prepared by find_nearby_colors. * Return the indexes of the closest entries in the bestcolor[] array. @@ -767,13 +767,13 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, { int ic0, ic1, ic2; int i, icolor; - register INT32 * bptr; /* pointer into bestdist[] array */ - JSAMPLE * cptr; /* pointer into bestcolor[] array */ - INT32 dist0, dist1; /* initial distance values */ - register INT32 dist2; /* current distance in inner loop */ - INT32 xx0, xx1; /* distance increments */ + register INT32 * bptr; /* pointer into bestdist[] array */ + JSAMPLE * cptr; /* pointer into bestcolor[] array */ + INT32 dist0, dist1; /* initial distance values */ + register INT32 dist2; /* current distance in inner loop */ + INT32 xx0, xx1; /* distance increments */ register INT32 xx2; - INT32 inc0, inc1, inc2; /* initial values for increments */ + INT32 inc0, inc1, inc2; /* initial values for increments */ /* This array holds the distance to the nearest-so-far color for each cell */ INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; @@ -813,20 +813,20 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, dist1 = dist0; xx1 = inc1; for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { - dist2 = dist1; - xx2 = inc2; - for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { - if (dist2 < *bptr) { - *bptr = dist2; - *cptr = (JSAMPLE) icolor; - } - dist2 += xx2; - xx2 += 2 * STEP_C2 * STEP_C2; - bptr++; - cptr++; - } - dist1 += xx1; - xx1 += 2 * STEP_C1 * STEP_C1; + dist2 = dist1; + xx2 = inc2; + for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { + if (dist2 < *bptr) { + *bptr = dist2; + *cptr = (JSAMPLE) icolor; + } + dist2 += xx2; + xx2 += 2 * STEP_C2 * STEP_C2; + bptr++; + cptr++; + } + dist1 += xx1; + xx1 += 2 * STEP_C1 * STEP_C1; } dist0 += xx0; xx0 += 2 * STEP_C0 * STEP_C0; @@ -843,13 +843,13 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - int minc0, minc1, minc2; /* lower left corner of update box */ + int minc0, minc1, minc2; /* lower left corner of update box */ int ic0, ic1, ic2; - register JSAMPLE * cptr; /* pointer into bestcolor[] array */ - register histptr cachep; /* pointer into main cache array */ + register JSAMPLE * cptr; /* pointer into bestcolor[] array */ + register histptr cachep; /* pointer into main cache array */ /* This array lists the candidate colormap indexes. */ JSAMPLE colorlist[MAXNUMCOLORS]; - int numcolors; /* number of candidate colors */ + int numcolors; /* number of candidate colors */ /* This array holds the actually closest colormap index for each cell. */ JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; @@ -873,10 +873,10 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) /* Determine the actually nearest colors. */ find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, - bestcolor); + bestcolor); /* Save the best color numbers (plus 1) in the main cache array */ - c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ + c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ c1 <<= BOX_C1_LOG; c2 <<= BOX_C2_LOG; cptr = bestcolor; @@ -884,7 +884,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { cachep = & histogram[c0+ic0][c1+ic1][c2]; for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { - *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); + *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); } } } @@ -897,7 +897,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) METHODDEF(void) pass2_no_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs no dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; @@ -921,7 +921,7 @@ pass2_no_dither (j_decompress_ptr cinfo, /* If we have not seen this color before, find nearest colormap entry */ /* and update the cache */ if (*cachep == 0) - fill_inverse_cmap(cinfo, c0,c1,c2); + fill_inverse_cmap(cinfo, c0,c1,c2); /* Now emit the colormap index for this cell */ *outptr++ = (JSAMPLE) (*cachep - 1); } @@ -931,20 +931,20 @@ pass2_no_dither (j_decompress_ptr cinfo, METHODDEF(void) pass2_fs_dither (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) + JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) /* This version performs Floyd-Steinberg dithering */ { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ + register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ - register FSERRPTR errorptr; /* => fserrors[] at column before current */ - JSAMPROW inptr; /* => current input pixel */ - JSAMPROW outptr; /* => current output pixel */ + register FSERRPTR errorptr; /* => fserrors[] at column before current */ + JSAMPROW inptr; /* => current input pixel */ + JSAMPROW outptr; /* => current output pixel */ histptr cachep; - int dir; /* +1 or -1 depending on direction */ - int dir3; /* 3*dir, for advancing inptr & errorptr */ + int dir; /* +1 or -1 depending on direction */ + int dir3; /* 3*dir, for advancing inptr & errorptr */ int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; @@ -960,7 +960,7 @@ pass2_fs_dither (j_decompress_ptr cinfo, outptr = output_buf[row]; if (cquantize->on_odd_row) { /* work right to left in this row */ - inptr += (width-1) * 3; /* so point to rightmost pixel */ + inptr += (width-1) * 3; /* so point to rightmost pixel */ outptr += width-1; dir = -1; dir3 = -3; @@ -1012,14 +1012,14 @@ pass2_fs_dither (j_decompress_ptr cinfo, /* If we have not seen this color before, find nearest colormap */ /* entry and update the cache */ if (*cachep == 0) - fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); + fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); /* Now emit the colormap index for this cell */ { register int pixcode = *cachep - 1; - *outptr = (JSAMPLE) pixcode; - /* Compute representation error for this pixel */ - cur0 -= GETJSAMPLE(colormap0[pixcode]); - cur1 -= GETJSAMPLE(colormap1[pixcode]); - cur2 -= GETJSAMPLE(colormap2[pixcode]); + *outptr = (JSAMPLE) pixcode; + /* Compute representation error for this pixel */ + cur0 -= GETJSAMPLE(colormap0[pixcode]); + cur1 -= GETJSAMPLE(colormap1[pixcode]); + cur2 -= GETJSAMPLE(colormap2[pixcode]); } /* Compute error fractions to be propagated to adjacent pixels. * Add these into the running sums, and simultaneously shift the @@ -1027,29 +1027,29 @@ pass2_fs_dither (j_decompress_ptr cinfo, */ { register LOCFSERROR bnexterr; - bnexterr = cur0; /* Process component 0 */ - errorptr[0] = (FSERROR) (bpreverr0 + cur0 * 3); - bpreverr0 = belowerr0 + cur0 * 5; - belowerr0 = bnexterr; - cur0 *= 7; - bnexterr = cur1; /* Process component 1 */ - errorptr[1] = (FSERROR) (bpreverr1 + cur1 * 3); - bpreverr1 = belowerr1 + cur1 * 5; - belowerr1 = bnexterr; - cur1 *= 7; - bnexterr = cur2; /* Process component 2 */ - errorptr[2] = (FSERROR) (bpreverr2 + cur2 * 3); - bpreverr2 = belowerr2 + cur2 * 5; - belowerr2 = bnexterr; - cur2 *= 7; + bnexterr = cur0; /* Process component 0 */ + errorptr[0] = (FSERROR) (bpreverr0 + cur0 * 3); + bpreverr0 = belowerr0 + cur0 * 5; + belowerr0 = bnexterr; + cur0 *= 7; + bnexterr = cur1; /* Process component 1 */ + errorptr[1] = (FSERROR) (bpreverr1 + cur1 * 3); + bpreverr1 = belowerr1 + cur1 * 5; + belowerr1 = bnexterr; + cur1 *= 7; + bnexterr = cur2; /* Process component 2 */ + errorptr[2] = (FSERROR) (bpreverr2 + cur2 * 3); + bpreverr2 = belowerr2 + cur2 * 5; + belowerr2 = bnexterr; + cur2 *= 7; } /* At this point curN contains the 7/16 error value to be propagated * to the next pixel on the current line, and all the errors for the * next line have been shifted over. We are therefore ready to move on. */ - inptr += dir3; /* Advance pixel pointers to next column */ + inptr += dir3; /* Advance pixel pointers to next column */ outptr += dir; - errorptr += dir3; /* advance errorptr to current column */ + errorptr += dir3; /* advance errorptr to current column */ } /* Post-loop cleanup: we must unload the final error values into the * final fserrors[] entry. Note we need not unload belowerrN because @@ -1089,7 +1089,7 @@ init_error_limit (j_decompress_ptr cinfo) table = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int)); - table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ + table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ cquantize->error_limiter = table; #define STEPSIZE ((MAXJSAMPLE+1)/16) @@ -1172,16 +1172,16 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) if (cinfo->dither_mode == JDITHER_FS) { size_t arraysize = (size_t) ((cinfo->output_width + 2) * - (3 * SIZEOF(FSERROR))); + (3 * SIZEOF(FSERROR))); /* Allocate Floyd-Steinberg workspace if we didn't already. */ if (cquantize->fserrors == NULL) - cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) - ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); + cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) + ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); /* Initialize the propagated errors to zero. */ jzero_far((void FAR *) cquantize->fserrors, arraysize); /* Make the error-limit table if we didn't already. */ if (cquantize->error_limiter == NULL) - init_error_limit(cinfo); + init_error_limit(cinfo); cquantize->on_odd_row = FALSE; } @@ -1190,7 +1190,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) if (cquantize->needs_zeroed) { for (i = 0; i < HIST_C0_ELEMS; i++) { jzero_far((void FAR *) histogram[i], - HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); + HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); } cquantize->needs_zeroed = FALSE; } @@ -1223,11 +1223,11 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); + SIZEOF(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_2_quant; cquantize->pub.new_color_map = new_color_map_2_quant; - cquantize->fserrors = NULL; /* flag optional arrays not allocated */ + cquantize->fserrors = NULL; /* flag optional arrays not allocated */ cquantize->error_limiter = NULL; /* Make sure jdmaster didn't give me a case I can't handle */ diff --git a/jstdhuff.c b/jstdhuff.c index 7fec6caf..0e9aff42 100644 --- a/jstdhuff.c +++ b/jstdhuff.c @@ -17,7 +17,7 @@ LOCAL(void) add_huff_table (j_common_ptr cinfo, - JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) + JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) /* Define a Huffman table */ { int nsymbols, len; diff --git a/jutils.c b/jutils.c index d18a9555..b9997a39 100644 --- a/jutils.c +++ b/jutils.c @@ -21,7 +21,7 @@ * of a DCT block read in natural order (left to right, top to bottom). */ -#if 0 /* This table is not actually needed in v6a */ +#if 0 /* This table is not actually needed in v6a */ const int jpeg_zigzag_order[DCTSIZE2] = { 0, 1, 5, 6, 14, 15, 27, 28, @@ -96,21 +96,21 @@ jround_up (long a, long b) * is not all that great, because these routines aren't very heavily used.) */ -#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ -#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) -#define FMEMZERO(target,size) MEMZERO(target,size) -#else /* 80x86 case, define if we can */ +#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ +#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) +#define FMEMZERO(target,size) MEMZERO(target,size) +#else /* 80x86 case, define if we can */ #ifdef USE_FMEM -#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) -#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) +#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) +#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) #endif #endif GLOBAL(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, - JSAMPARRAY output_array, int dest_row, - int num_rows, JDIMENSION num_cols) + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols) /* Copy some rows of samples from one place to another. * num_rows rows are copied from input_array[source_row++] * to output_array[dest_row++]; these areas may overlap for duplication. @@ -135,7 +135,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, FMEMCOPY(outptr, inptr, count); #else for (count = num_cols; count > 0; count--) - *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ + *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ #endif } } @@ -143,7 +143,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, GLOBAL(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, - JDIMENSION num_blocks) + JDIMENSION num_blocks) /* Copy a row of coefficient blocks from one place to another. */ { #ifdef FMEMCOPY diff --git a/jversion.h b/jversion.h index e1c4f499..5ddadc81 100644 --- a/jversion.h +++ b/jversion.h @@ -13,22 +13,22 @@ #if JPEG_LIB_VERSION >= 80 -#define JVERSION "8d 15-Jan-2012" +#define JVERSION "8d 15-Jan-2012" #elif JPEG_LIB_VERSION >= 70 -#define JVERSION "7 27-Jun-2009" +#define JVERSION "7 27-Jun-2009" #else -#define JVERSION "6b 27-Mar-1998" +#define JVERSION "6b 27-Mar-1998" #endif -#define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \ - "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ - "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ - "Copyright (C) 2009-2014 D. R. Commander\n" \ - "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ - "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ - "Copyright (C) 2013 Linaro Limited" +#define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ + "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ + "Copyright (C) 2009-2014 D. R. Commander\n" \ + "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ + "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ + "Copyright (C) 2013 Linaro Limited" diff --git a/libjpeg.txt b/libjpeg.txt index 88d3a5d1..d1107380 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -27,32 +27,32 @@ TABLE OF CONTENTS ----------------- Overview: - Functions provided by the library - Outline of typical usage + Functions provided by the library + Outline of typical usage Basic library usage: - Data formats - Compression details - Decompression details - Mechanics of usage: include files, linking, etc + Data formats + Compression details + Decompression details + Mechanics of usage: include files, linking, etc Advanced features: - Compression parameter selection - Decompression parameter selection - Special color spaces - Error handling - Compressed data handling (source and destination managers) - I/O suspension - Progressive JPEG support - Buffered-image mode - Abbreviated datastreams and multiple images - Special markers - Raw (downsampled) image data - Really raw data: DCT coefficients - Progress monitoring - Memory management - Memory usage - Library compile-time options - Portability considerations - Notes for MS-DOS implementors + Compression parameter selection + Decompression parameter selection + Special color spaces + Error handling + Compressed data handling (source and destination managers) + I/O suspension + Progressive JPEG support + Buffered-image mode + Abbreviated datastreams and multiple images + Special markers + Raw (downsampled) image data + Really raw data: DCT coefficients + Progress monitoring + Memory management + Memory usage + Library compile-time options + Portability considerations + Notes for MS-DOS implementors You should read at least the overview and basic usage sections before trying to program with the library. The sections on advanced features can be read @@ -93,10 +93,10 @@ A word about functions *not* provided by the library. We handle a subset of the ISO JPEG standard; most baseline, extended-sequential, and progressive JPEG processes are supported. (Our subset includes all features now in common use.) Unsupported ISO options include: - * Hierarchical storage - * Lossless JPEG - * DNL marker - * Nonintegral subsampling ratios + * Hierarchical storage + * Lossless JPEG + * DNL marker + * Nonintegral subsampling ratios We support both 8- and 12-bit data precision, but this is a compile-time choice rather than a run-time choice; hence it is difficult to use both precisions in a single application. @@ -113,14 +113,14 @@ Outline of typical usage The rough outline of a JPEG compression operation is: - Allocate and initialize a JPEG compression object - Specify the destination for the compressed data (eg, a file) - Set parameters for compression, including image size & colorspace - jpeg_start_compress(...); - while (scan lines remain to be written) - jpeg_write_scanlines(...); - jpeg_finish_compress(...); - Release the JPEG compression object + Allocate and initialize a JPEG compression object + Specify the destination for the compressed data (eg, a file) + Set parameters for compression, including image size & colorspace + jpeg_start_compress(...); + while (scan lines remain to be written) + jpeg_write_scanlines(...); + jpeg_finish_compress(...); + Release the JPEG compression object A JPEG compression object holds parameters and working state for the JPEG library. We make creation/destruction of the object separate from starting @@ -139,15 +139,15 @@ provide its own destination manager to do something else. Similarly, the rough outline of a JPEG decompression operation is: - Allocate and initialize a JPEG decompression object - Specify the source of the compressed data (eg, a file) - Call jpeg_read_header() to obtain image info - Set parameters for decompression - jpeg_start_decompress(...); - while (scan lines remain to be read) - jpeg_read_scanlines(...); - jpeg_finish_decompress(...); - Release the JPEG decompression object + Allocate and initialize a JPEG decompression object + Specify the source of the compressed data (eg, a file) + Call jpeg_read_header() to obtain image info + Set parameters for decompression + jpeg_start_decompress(...); + while (scan lines remain to be read) + jpeg_read_scanlines(...); + jpeg_finish_decompress(...); + Release the JPEG decompression object This is comparable to the compression outline except that reading the datastream header is a separate step. This is helpful because information @@ -272,11 +272,11 @@ initialize the rest of the JPEG object. Typical code for this step, if you are using the default error handler, is - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - ... - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jerr; + ... + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_compress(&cinfo); jpeg_create_compress allocates a small amount of memory, so it could fail if you are out of memory. In that case it will exit via the error handler; @@ -293,13 +293,13 @@ destination module if you want to do something else, as discussed later. If you use the standard destination module, you must open the target stdio stream beforehand. Typical code for this step looks like: - FILE * outfile; - ... - if ((outfile = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - exit(1); - } - jpeg_stdio_dest(&cinfo, outfile); + FILE * outfile; + ... + if ((outfile = fopen(filename, "wb")) == NULL) { + fprintf(stderr, "can't open %s\n", filename); + exit(1); + } + jpeg_stdio_dest(&cinfo, outfile); where the last line invokes the standard destination module. @@ -320,10 +320,10 @@ calling jpeg_start_compress() and jpeg_finish_compress(). You must supply information about the source image by setting the following fields in the JPEG object (cinfo structure): - image_width Width of image, in pixels - image_height Height of image, in pixels - input_components Number of color channels (samples per pixel) - in_color_space Color space of source image + image_width Width of image, in pixels + image_height Height of image, in pixels + input_components Number of color channels (samples per pixel) + in_color_space Color space of source image The image dimensions are, hopefully, obvious. JPEG supports image dimensions of 1 to 64K pixels in either direction. The input color space is typically @@ -347,13 +347,13 @@ than once, if that happens to be convenient. Typical code for a 24-bit RGB source image is - cinfo.image_width = Width; /* image width and height, in pixels */ - cinfo.image_height = Height; - cinfo.input_components = 3; /* # of color components per pixel */ - cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ + cinfo.image_width = Width; /* image width and height, in pixels */ + cinfo.image_height = Height; + cinfo.input_components = 3; /* # of color components per pixel */ + cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ - jpeg_set_defaults(&cinfo); - /* Make optional parameter settings here */ + jpeg_set_defaults(&cinfo); + /* Make optional parameter settings here */ 4. jpeg_start_compress(...); @@ -365,7 +365,7 @@ storage, and emit the first few bytes of the JPEG datastream header. Typical code: - jpeg_start_compress(&cinfo, TRUE); + jpeg_start_compress(&cinfo, TRUE); The "TRUE" parameter ensures that a complete JPEG interchange datastream will be written. This is appropriate in most cases. If you think you might @@ -378,7 +378,7 @@ the compression cycle. 5. while (scan lines remain to be written) - jpeg_write_scanlines(...); + jpeg_write_scanlines(...); Now write all the required image data by calling jpeg_write_scanlines() one or more times. You can pass one or more scanlines in each call, up @@ -403,15 +403,15 @@ Code for this step depends heavily on the way that you store the source data. example.c shows the following code for the case of a full-size 2-D source array containing 3-byte RGB pixels: - JSAMPROW row_pointer[1]; /* pointer to a single row */ - int row_stride; /* physical row width in buffer */ + JSAMPROW row_pointer[1]; /* pointer to a single row */ + int row_stride; /* physical row width in buffer */ - row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ + row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */ - while (cinfo.next_scanline < cinfo.image_height) { - row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; - jpeg_write_scanlines(&cinfo, row_pointer, 1); - } + while (cinfo.next_scanline < cinfo.image_height) { + row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; + jpeg_write_scanlines(&cinfo, row_pointer, 1); + } jpeg_write_scanlines() returns the number of scanlines actually written. This will normally be equal to the number passed in, so you can usually @@ -436,7 +436,7 @@ object. Typical code: - jpeg_finish_compress(&cinfo); + jpeg_finish_compress(&cinfo); If using the stdio destination manager, don't forget to close the output stdio stream (if necessary) afterwards. @@ -479,7 +479,7 @@ handler structure. Typical code: - jpeg_destroy_compress(&cinfo); + jpeg_destroy_compress(&cinfo); 8. Aborting. @@ -520,11 +520,11 @@ call jpeg_create_decompress(). Error handling is exactly the same. Typical code: - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - ... - cinfo.err = jpeg_std_error(&jerr); - jpeg_create_decompress(&cinfo); + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + ... + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); (Both here and in the IJG code, we usually use variable name "cinfo" for both compression and decompression objects.) @@ -540,13 +540,13 @@ to do something else, as discussed later. If you use the standard source module, you must open the source stdio stream beforehand. Typical code for this step looks like: - FILE * infile; - ... - if ((infile = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "can't open %s\n", filename); - exit(1); - } - jpeg_stdio_src(&cinfo, infile); + FILE * infile; + ... + if ((infile = fopen(filename, "rb")) == NULL) { + fprintf(stderr, "can't open %s\n", filename); + exit(1); + } + jpeg_stdio_src(&cinfo, infile); where the last line invokes the standard source module. @@ -569,7 +569,7 @@ being discarded. Typical code for this step is just - jpeg_read_header(&cinfo, TRUE); + jpeg_read_header(&cinfo, TRUE); This will read the source datastream header markers, up to the beginning of the compressed data proper. On return, the image dimensions and other @@ -617,7 +617,7 @@ memory, and prepare for returning data. Typical code is just - jpeg_start_decompress(&cinfo); + jpeg_start_decompress(&cinfo); If you have requested a multi-pass operating mode, such as 2-pass color quantization, jpeg_start_decompress() will do everything needed before data @@ -630,12 +630,12 @@ After this call, the final output image dimensions, including any requested scaling, are available in the JPEG object; so is the selected colormap, if colormapped output has been requested. Useful fields include - output_width image width and height, as scaled - output_height - out_color_components # of color components in out_color_space - output_components # of color components returned per pixel - colormap the selected colormap, if any - actual_number_of_colors number of entries in colormap + output_width image width and height, as scaled + output_height + out_color_components # of color components in out_color_space + output_components # of color components returned per pixel + colormap the selected colormap, if any + actual_number_of_colors number of entries in colormap output_components is 1 (a colormap index) when quantizing colors; otherwise it equals out_color_components. It is the number of JSAMPLE values that will be @@ -654,7 +654,7 @@ relevant parameters (scaling, output color space, and quantization flag). 6. while (scan lines remain to be read) - jpeg_read_scanlines(...); + jpeg_read_scanlines(...); Now you can read the decompressed image data by calling jpeg_read_scanlines() one or more times. At each call, you pass in the maximum number of scanlines @@ -696,7 +696,7 @@ with the JPEG object to be released. Typical code: - jpeg_finish_decompress(&cinfo); + jpeg_finish_decompress(&cinfo); If using the stdio source manager, don't forget to close the source stdio stream if necessary. @@ -719,7 +719,7 @@ destroying compression objects applies here too. Typical code: - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); 9. Aborting. @@ -800,220 +800,220 @@ cinfo fields directly. The helper routines are: jpeg_set_defaults (j_compress_ptr cinfo) - This routine sets all JPEG parameters to reasonable defaults, using - only the input image's color space (field in_color_space, which must - already be set in cinfo). Many applications will only need to use - this routine and perhaps jpeg_set_quality(). + This routine sets all JPEG parameters to reasonable defaults, using + only the input image's color space (field in_color_space, which must + already be set in cinfo). Many applications will only need to use + this routine and perhaps jpeg_set_quality(). jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) - Sets the JPEG file's colorspace (field jpeg_color_space) as specified, - and sets other color-space-dependent parameters appropriately. See - "Special color spaces", below, before using this. A large number of - parameters, including all per-component parameters, are set by this - routine; if you want to twiddle individual parameters you should call - jpeg_set_colorspace() before rather than after. + Sets the JPEG file's colorspace (field jpeg_color_space) as specified, + and sets other color-space-dependent parameters appropriately. See + "Special color spaces", below, before using this. A large number of + parameters, including all per-component parameters, are set by this + routine; if you want to twiddle individual parameters you should call + jpeg_set_colorspace() before rather than after. jpeg_default_colorspace (j_compress_ptr cinfo) - Selects an appropriate JPEG colorspace based on cinfo->in_color_space, - and calls jpeg_set_colorspace(). This is actually a subroutine of - jpeg_set_defaults(). It's broken out in case you want to change - just the colorspace-dependent JPEG parameters. + Selects an appropriate JPEG colorspace based on cinfo->in_color_space, + and calls jpeg_set_colorspace(). This is actually a subroutine of + jpeg_set_defaults(). It's broken out in case you want to change + just the colorspace-dependent JPEG parameters. jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) - Constructs JPEG quantization tables appropriate for the indicated - quality setting. The quality value is expressed on the 0..100 scale - recommended by IJG (cjpeg's "-quality" switch uses this routine). - Note that the exact mapping from quality values to tables may change - in future IJG releases as more is learned about DCT quantization. - If the force_baseline parameter is TRUE, then the quantization table - entries are constrained to the range 1..255 for full JPEG baseline - compatibility. In the current implementation, this only makes a - difference for quality settings below 25, and it effectively prevents - very small/low quality files from being generated. The IJG decoder - is capable of reading the non-baseline files generated at low quality - settings when force_baseline is FALSE, but other decoders may not be. + Constructs JPEG quantization tables appropriate for the indicated + quality setting. The quality value is expressed on the 0..100 scale + recommended by IJG (cjpeg's "-quality" switch uses this routine). + Note that the exact mapping from quality values to tables may change + in future IJG releases as more is learned about DCT quantization. + If the force_baseline parameter is TRUE, then the quantization table + entries are constrained to the range 1..255 for full JPEG baseline + compatibility. In the current implementation, this only makes a + difference for quality settings below 25, and it effectively prevents + very small/low quality files from being generated. The IJG decoder + is capable of reading the non-baseline files generated at low quality + settings when force_baseline is FALSE, but other decoders may not be. jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - boolean force_baseline) - Same as jpeg_set_quality() except that the generated tables are the - sample tables given in the JPEC spec section K.1, multiplied by the - specified scale factor (which is expressed as a percentage; thus - scale_factor = 100 reproduces the spec's tables). Note that larger - scale factors give lower quality. This entry point is useful for - conforming to the Adobe PostScript DCT conventions, but we do not - recommend linear scaling as a user-visible quality scale otherwise. - force_baseline again constrains the computed table entries to 1..255. + boolean force_baseline) + Same as jpeg_set_quality() except that the generated tables are the + sample tables given in the JPEC spec section K.1, multiplied by the + specified scale factor (which is expressed as a percentage; thus + scale_factor = 100 reproduces the spec's tables). Note that larger + scale factors give lower quality. This entry point is useful for + conforming to the Adobe PostScript DCT conventions, but we do not + recommend linear scaling as a user-visible quality scale otherwise. + force_baseline again constrains the computed table entries to 1..255. int jpeg_quality_scaling (int quality) - Converts a value on the IJG-recommended quality scale to a linear - scaling percentage. Note that this routine may change or go away - in future releases --- IJG may choose to adopt a scaling method that - can't be expressed as a simple scalar multiplier, in which case the - premise of this routine collapses. Caveat user. + Converts a value on the IJG-recommended quality scale to a linear + scaling percentage. Note that this routine may change or go away + in future releases --- IJG may choose to adopt a scaling method that + can't be expressed as a simple scalar multiplier, in which case the + premise of this routine collapses. Caveat user. jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) - [libjpeg v7+ API/ABI emulation only] - Set default quantization tables with linear q_scale_factor[] values - (see below). + [libjpeg v7+ API/ABI emulation only] + Set default quantization tables with linear q_scale_factor[] values + (see below). jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - 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 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. + const unsigned int *basic_table, + 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 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. - This is the recommended method of creating a progressive file, - unless you want to make a custom scan sequence. You must ensure that - the JPEG color space is set correctly before calling this routine. + Generates a default scan script for writing a progressive-JPEG file. + This is the recommended method of creating a progressive file, + unless you want to make a custom scan sequence. You must ensure that + the JPEG color space is set correctly before calling this routine. Compression parameters (cinfo fields) include: J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are: - JDCT_ISLOW: slow but accurate integer algorithm - JDCT_IFAST: faster, less accurate integer method - JDCT_FLOAT: floating-point method - JDCT_DEFAULT: default method (normally JDCT_ISLOW) - JDCT_FASTEST: fastest method (normally JDCT_IFAST) - The FLOAT method is very slightly more accurate than the ISLOW method, - but may give different results on different machines due to varying - roundoff behavior. The integer methods should give the same results - on all machines. On machines with sufficiently fast FP hardware, the - floating-point method may also be the fastest. The IFAST method is - considerably less accurate than the other two; its use is not - recommended if high quality is a concern. JDCT_DEFAULT and - JDCT_FASTEST are macros configurable by each installation. + Selects the algorithm used for the DCT step. Choices are: + JDCT_ISLOW: slow but accurate integer algorithm + JDCT_IFAST: faster, less accurate integer method + JDCT_FLOAT: floating-point method + JDCT_DEFAULT: default method (normally JDCT_ISLOW) + JDCT_FASTEST: fastest method (normally JDCT_IFAST) + The FLOAT method is very slightly more accurate than the ISLOW method, + but may give different results on different machines due to varying + roundoff behavior. The integer methods should give the same results + on all machines. On machines with sufficiently fast FP hardware, the + floating-point method may also be the fastest. The IFAST method is + considerably less accurate than the other two; its use is not + recommended if high quality is a concern. JDCT_DEFAULT and + JDCT_FASTEST are macros configurable by each installation. J_COLOR_SPACE jpeg_color_space int num_components - The JPEG color space and corresponding number of components; see - "Special color spaces", below, for more info. We recommend using - jpeg_set_color_space() if you want to change these. + The JPEG color space and corresponding number of components; see + "Special color spaces", below, for more info. We recommend using + jpeg_set_color_space() if you want to change these. boolean optimize_coding - TRUE causes the compressor to compute optimal Huffman coding tables - for the image. This requires an extra pass over the data and - therefore costs a good deal of space and time. The default is - FALSE, which tells the compressor to use the supplied or default - Huffman tables. In most cases optimal tables save only a few percent - of file size compared to the default tables. Note that when this is - TRUE, you need not supply Huffman tables at all, and any you do - supply will be overwritten. + TRUE causes the compressor to compute optimal Huffman coding tables + for the image. This requires an extra pass over the data and + therefore costs a good deal of space and time. The default is + FALSE, which tells the compressor to use the supplied or default + Huffman tables. In most cases optimal tables save only a few percent + of file size compared to the default tables. Note that when this is + TRUE, you need not supply Huffman tables at all, and any you do + supply will be overwritten. unsigned int restart_interval int restart_in_rows - To emit restart markers in the JPEG file, set one of these nonzero. - Set restart_interval to specify the exact interval in MCU blocks. - Set restart_in_rows to specify the interval in MCU rows. (If - restart_in_rows is not 0, then restart_interval is set after the - image width in MCUs is computed.) Defaults are zero (no restarts). - One restart marker per MCU row is often a good choice. - NOTE: the overhead of restart markers is higher in grayscale JPEG - files than in color files, and MUCH higher in progressive JPEGs. - If you use restarts, you may want to use larger intervals in those - cases. + To emit restart markers in the JPEG file, set one of these nonzero. + Set restart_interval to specify the exact interval in MCU blocks. + Set restart_in_rows to specify the interval in MCU rows. (If + restart_in_rows is not 0, then restart_interval is set after the + image width in MCUs is computed.) Defaults are zero (no restarts). + One restart marker per MCU row is often a good choice. + NOTE: the overhead of restart markers is higher in grayscale JPEG + files than in color files, and MUCH higher in progressive JPEGs. + If you use restarts, you may want to use larger intervals in those + cases. const jpeg_scan_info * scan_info int num_scans - By default, scan_info is NULL; this causes the compressor to write a - single-scan sequential JPEG file. If not NULL, scan_info points to - an array of scan definition records of length num_scans. The - compressor will then write a JPEG file having one scan for each scan - definition record. This is used to generate noninterleaved or - progressive JPEG files. The library checks that the scan array - defines a valid JPEG scan sequence. (jpeg_simple_progression creates - a suitable scan definition array for progressive JPEG.) This is - discussed further under "Progressive JPEG support". + By default, scan_info is NULL; this causes the compressor to write a + single-scan sequential JPEG file. If not NULL, scan_info points to + an array of scan definition records of length num_scans. The + compressor will then write a JPEG file having one scan for each scan + definition record. This is used to generate noninterleaved or + progressive JPEG files. The library checks that the scan array + defines a valid JPEG scan sequence. (jpeg_simple_progression creates + a suitable scan definition array for progressive JPEG.) This is + discussed further under "Progressive JPEG support". int smoothing_factor - If non-zero, the input image is smoothed; the value should be 1 for - minimal smoothing to 100 for maximum smoothing. Consult jcsample.c - for details of the smoothing algorithm. The default is zero. + If non-zero, the input image is smoothed; the value should be 1 for + minimal smoothing to 100 for maximum smoothing. Consult jcsample.c + for details of the smoothing algorithm. The default is zero. boolean write_JFIF_header - If TRUE, a JFIF APP0 marker is emitted. jpeg_set_defaults() and - jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space - (ie, YCbCr or grayscale) is selected, otherwise FALSE. + If TRUE, a JFIF APP0 marker is emitted. jpeg_set_defaults() and + jpeg_set_colorspace() set this TRUE if a JFIF-legal JPEG color space + (ie, YCbCr or grayscale) is selected, otherwise FALSE. UINT8 JFIF_major_version UINT8 JFIF_minor_version - The version number to be written into the JFIF marker. - jpeg_set_defaults() initializes the version to 1.01 (major=minor=1). - You should set it to 1.02 (major=1, minor=2) if you plan to write - any JFIF 1.02 extension markers. + The version number to be written into the JFIF marker. + jpeg_set_defaults() initializes the version to 1.01 (major=minor=1). + You should set it to 1.02 (major=1, minor=2) if you plan to write + any JFIF 1.02 extension markers. UINT8 density_unit UINT16 X_density UINT16 Y_density - The resolution information to be written into the JFIF marker; - not used otherwise. density_unit may be 0 for unknown, - 1 for dots/inch, or 2 for dots/cm. The default values are 0,1,1 - indicating square pixels of unknown size. + The resolution information to be written into the JFIF marker; + not used otherwise. density_unit may be 0 for unknown, + 1 for dots/inch, or 2 for dots/cm. The default values are 0,1,1 + indicating square pixels of unknown size. boolean write_Adobe_marker - If TRUE, an Adobe APP14 marker is emitted. jpeg_set_defaults() and - jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK, - or YCCK is selected, otherwise FALSE. It is generally a bad idea - to set both write_JFIF_header and write_Adobe_marker. In fact, - you probably shouldn't change the default settings at all --- the - default behavior ensures that the JPEG file's color space can be - recognized by the decoder. + If TRUE, an Adobe APP14 marker is emitted. jpeg_set_defaults() and + jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK, + or YCCK is selected, otherwise FALSE. It is generally a bad idea + to set both write_JFIF_header and write_Adobe_marker. In fact, + you probably shouldn't change the default settings at all --- the + default behavior ensures that the JPEG file's color space can be + recognized by the decoder. JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS] - Pointers to coefficient quantization tables, one per table slot, - or NULL if no table is defined for a slot. Usually these should - be set via one of the above helper routines; jpeg_add_quant_table() - is general enough to define any quantization table. The other - routines will set up table slot 0 for luminance quality and table - slot 1 for chrominance. + Pointers to coefficient quantization tables, one per table slot, + or NULL if no table is defined for a slot. Usually these should + be set via one of the above helper routines; jpeg_add_quant_table() + is general enough to define any quantization table. The other + routines will set up table slot 0 for luminance quality and table + slot 1 for chrominance. int q_scale_factor[NUM_QUANT_TBLS] - [libjpeg v7+ API/ABI emulation only] - Linear quantization scaling factors (0-100, default 100) - for use with jpeg_default_qtables(). - See rdswitch.c and cjpeg.c for an example of usage. - Note that the q_scale_factor[] values use "linear" scales, so JPEG - quality levels chosen by the user must be converted to these scales - using jpeg_quality_scaling(). Here is an example that corresponds to - cjpeg -quality 90,70: + [libjpeg v7+ API/ABI emulation only] + Linear quantization scaling factors (0-100, default 100) + for use with jpeg_default_qtables(). + See rdswitch.c and cjpeg.c for an example of usage. + Note that the q_scale_factor[] values use "linear" scales, so JPEG + quality levels chosen by the user must be converted to these scales + using jpeg_quality_scaling(). Here is an example that corresponds to + cjpeg -quality 90,70: - jpeg_set_defaults(cinfo); + jpeg_set_defaults(cinfo); - /* Set luminance quality 90. */ - cinfo->q_scale_factor[0] = jpeg_quality_scaling(90); - /* Set chrominance quality 70. */ - cinfo->q_scale_factor[1] = jpeg_quality_scaling(70); + /* Set luminance quality 90. */ + cinfo->q_scale_factor[0] = jpeg_quality_scaling(90); + /* Set chrominance quality 70. */ + cinfo->q_scale_factor[1] = jpeg_quality_scaling(70); - jpeg_default_qtables(cinfo, force_baseline); + jpeg_default_qtables(cinfo, force_baseline); - CAUTION: Setting separate quality levels for chrominance and luminance - is mainly only useful if chrominance subsampling is disabled. 2x2 - chrominance subsampling (AKA "4:2:0") is the default, but you can - explicitly disable subsampling as follows: + CAUTION: Setting separate quality levels for chrominance and luminance + is mainly only useful if chrominance subsampling is disabled. 2x2 + chrominance subsampling (AKA "4:2:0") is the default, but you can + explicitly disable subsampling as follows: - cinfo->comp_info[0].v_samp_factor = 1; - cinfo->comp_info[0].h_samp_factor = 1; + cinfo->comp_info[0].v_samp_factor = 1; + cinfo->comp_info[0].h_samp_factor = 1; JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS] JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS] - Pointers to Huffman coding tables, one per table slot, or NULL if - no table is defined for a slot. Slots 0 and 1 are filled with the - JPEG sample tables by jpeg_set_defaults(). If you need to allocate - more table structures, jpeg_alloc_huff_table() may be used. - Note that optimal Huffman tables can be computed for an image - by setting optimize_coding, as discussed above; there's seldom - any need to mess with providing your own Huffman tables. + Pointers to Huffman coding tables, one per table slot, or NULL if + no table is defined for a slot. Slots 0 and 1 are filled with the + JPEG sample tables by jpeg_set_defaults(). If you need to allocate + more table structures, jpeg_alloc_huff_table() may be used. + Note that optimal Huffman tables can be computed for an image + by setting optimize_coding, as discussed above; there's seldom + any need to mess with providing your own Huffman tables. [libjpeg v7+ API/ABI emulation only] @@ -1024,7 +1024,7 @@ also call jpeg_calc_jpeg_dimensions() to obtain the values that will result from the current parameter settings. This can be useful if you are trying to pick a scaling ratio that will get close to a desired target size. -JDIMENSION jpeg_width Actual dimensions of output image. +JDIMENSION jpeg_width Actual dimensions of output image. JDIMENSION jpeg_height @@ -1035,32 +1035,32 @@ comp_info[] array is allocated by jpeg_set_defaults(); if you choose not to use that routine, it's up to you to allocate the array. int component_id - The one-byte identifier code to be recorded in the JPEG file for - this component. For the standard color spaces, we recommend you - leave the default values alone. + The one-byte identifier code to be recorded in the JPEG file for + this component. For the standard color spaces, we recommend you + leave the default values alone. int h_samp_factor int v_samp_factor - Horizontal and vertical sampling factors for the component; must - be 1..4 according to the JPEG standard. Note that larger sampling - factors indicate a higher-resolution component; many people find - this behavior quite unintuitive. The default values are 2,2 for - luminance components and 1,1 for chrominance components, except - for grayscale where 1,1 is used. + Horizontal and vertical sampling factors for the component; must + be 1..4 according to the JPEG standard. Note that larger sampling + factors indicate a higher-resolution component; many people find + this behavior quite unintuitive. The default values are 2,2 for + luminance components and 1,1 for chrominance components, except + for grayscale where 1,1 is used. int quant_tbl_no - Quantization table number for component. The default value is - 0 for luminance components and 1 for chrominance components. + Quantization table number for component. The default value is + 0 for luminance components and 1 for chrominance components. int dc_tbl_no int ac_tbl_no - DC and AC entropy coding table numbers. The default values are - 0 for luminance components and 1 for chrominance components. + DC and AC entropy coding table numbers. The default values are + 0 for luminance components and 1 for chrominance components. int component_index - Must equal the component's index in comp_info[]. (Beginning in - release v6, the compressor library will fill this in automatically; - you don't have to.) + Must equal the component's index in comp_info[]. (Beginning in + release v6, the compressor library will fill this in automatically; + you don't have to.) Decompression parameter selection @@ -1080,18 +1080,18 @@ processing. The following fields in the JPEG object are set by jpeg_read_header() and may be useful to the application in choosing decompression parameters: -JDIMENSION image_width Width and height of image +JDIMENSION image_width Width and height of image JDIMENSION image_height -int num_components Number of color components -J_COLOR_SPACE jpeg_color_space Colorspace of image -boolean saw_JFIF_marker TRUE if a JFIF APP0 marker was seen - UINT8 JFIF_major_version Version information from JFIF marker +int num_components Number of color components +J_COLOR_SPACE jpeg_color_space Colorspace of image +boolean saw_JFIF_marker TRUE if a JFIF APP0 marker was seen + UINT8 JFIF_major_version Version information from JFIF marker UINT8 JFIF_minor_version - UINT8 density_unit Resolution data from JFIF marker + UINT8 density_unit Resolution data from JFIF marker UINT16 X_density UINT16 Y_density -boolean saw_Adobe_marker TRUE if an Adobe APP14 marker was seen - UINT8 Adobe_transform Color transform code from Adobe marker +boolean saw_Adobe_marker TRUE if an Adobe APP14 marker was seen + UINT8 Adobe_transform Color transform code from Adobe marker The JPEG color space, unfortunately, is something of a guess since the JPEG standard proper does not provide a way to record it. In practice most files @@ -1103,51 +1103,51 @@ The decompression parameters that determine the basic properties of the returned image are: J_COLOR_SPACE out_color_space - Output color space. jpeg_read_header() sets an appropriate default - based on jpeg_color_space; typically it will be RGB or grayscale. - The application can change this field to request output in a different - colorspace. For example, set it to JCS_GRAYSCALE to get grayscale - output from a color file. (This is useful for previewing: grayscale - output is faster than full color since the color components need not - be processed.) Note that not all possible color space transforms are - currently implemented; you may need to extend jdcolor.c if you want an - unusual conversion. + Output color space. jpeg_read_header() sets an appropriate default + based on jpeg_color_space; typically it will be RGB or grayscale. + The application can change this field to request output in a different + colorspace. For example, set it to JCS_GRAYSCALE to get grayscale + output from a color file. (This is useful for previewing: grayscale + output is faster than full color since the color components need not + be processed.) Note that not all possible color space transforms are + currently implemented; you may need to extend jdcolor.c if you want an + unusual conversion. unsigned int scale_num, scale_denom - Scale the image by the fraction scale_num/scale_denom. Default is - 1/1, or no scaling. Currently, the only supported scaling ratios - are M/8 with all M from 1 to 16, or any reduced fraction thereof (such - as 1/2, 3/4, etc.) (The library design allows for arbitrary - scaling ratios but this is not likely to be implemented any time soon.) - Smaller scaling ratios permit significantly faster decoding since - fewer pixels need be processed and a simpler IDCT method can be used. + Scale the image by the fraction scale_num/scale_denom. Default is + 1/1, or no scaling. Currently, the only supported scaling ratios + are M/8 with all M from 1 to 16, or any reduced fraction thereof (such + as 1/2, 3/4, etc.) (The library design allows for arbitrary + scaling ratios but this is not likely to be implemented any time soon.) + Smaller scaling ratios permit significantly faster decoding since + fewer pixels need be processed and a simpler IDCT method can be used. boolean quantize_colors - If set TRUE, colormapped output will be delivered. Default is FALSE, - meaning that full-color output will be delivered. + If set TRUE, colormapped output will be delivered. Default is FALSE, + meaning that full-color output will be delivered. The next three parameters are relevant only if quantize_colors is TRUE. int desired_number_of_colors - Maximum number of colors to use in generating a library-supplied color - map (the actual number of colors is returned in a different field). - Default 256. Ignored when the application supplies its own color map. + Maximum number of colors to use in generating a library-supplied color + map (the actual number of colors is returned in a different field). + Default 256. Ignored when the application supplies its own color map. boolean two_pass_quantize - If TRUE, an extra pass over the image is made to select a custom color - map for the image. This usually looks a lot better than the one-size- - fits-all colormap that is used otherwise. Default is TRUE. Ignored - when the application supplies its own color map. + If TRUE, an extra pass over the image is made to select a custom color + map for the image. This usually looks a lot better than the one-size- + fits-all colormap that is used otherwise. Default is TRUE. Ignored + when the application supplies its own color map. J_DITHER_MODE dither_mode - Selects color dithering method. Supported values are: - JDITHER_NONE no dithering: fast, very low quality - JDITHER_ORDERED ordered dither: moderate speed and quality - JDITHER_FS Floyd-Steinberg dither: slow, high quality - Default is JDITHER_FS. (At present, ordered dither is implemented - only in the single-pass, standard-colormap case. If you ask for - ordered dither when two_pass_quantize is TRUE or when you supply - an external color map, you'll get F-S dithering.) + Selects color dithering method. Supported values are: + JDITHER_NONE no dithering: fast, very low quality + JDITHER_ORDERED ordered dither: moderate speed and quality + JDITHER_FS Floyd-Steinberg dither: slow, high quality + Default is JDITHER_FS. (At present, ordered dither is implemented + only in the single-pass, standard-colormap case. If you ask for + ordered dither when two_pass_quantize is TRUE or when you supply + an external color map, you'll get F-S dithering.) When quantize_colors is TRUE, the target color map is described by the next two fields. colormap is set to NULL by jpeg_read_header(). The application @@ -1158,39 +1158,39 @@ selects a suitable color map and sets these two fields itself. only accepted for 3-component output color spaces.] JSAMPARRAY colormap - The color map, represented as a 2-D pixel array of out_color_components - rows and actual_number_of_colors columns. Ignored if not quantizing. - CAUTION: if the JPEG library creates its own colormap, the storage - pointed to by this field is released by jpeg_finish_decompress(). - Copy the colormap somewhere else first, if you want to save it. + The color map, represented as a 2-D pixel array of out_color_components + rows and actual_number_of_colors columns. Ignored if not quantizing. + CAUTION: if the JPEG library creates its own colormap, the storage + pointed to by this field is released by jpeg_finish_decompress(). + Copy the colormap somewhere else first, if you want to save it. int actual_number_of_colors - The number of colors in the color map. + The number of colors in the color map. Additional decompression parameters that the application may set include: J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are the same - as described above for compression. + Selects the algorithm used for the DCT step. Choices are the same + as described above for compression. boolean do_fancy_upsampling - If TRUE, do careful upsampling of chroma components. If FALSE, - a faster but sloppier method is used. Default is TRUE. The visual - impact of the sloppier method is often very small. + If TRUE, do careful upsampling of chroma components. If FALSE, + a faster but sloppier method is used. Default is TRUE. The visual + impact of the sloppier method is often very small. boolean do_block_smoothing - If TRUE, interblock smoothing is applied in early stages of decoding - progressive JPEG files; if FALSE, not. Default is TRUE. Early - progression stages look "fuzzy" with smoothing, "blocky" without. - In any case, block smoothing ceases to be applied after the first few - AC coefficients are known to full accuracy, so it is relevant only - when using buffered-image mode for progressive images. + If TRUE, interblock smoothing is applied in early stages of decoding + progressive JPEG files; if FALSE, not. Default is TRUE. Early + progression stages look "fuzzy" with smoothing, "blocky" without. + In any case, block smoothing ceases to be applied after the first few + AC coefficients are known to full accuracy, so it is relevant only + when using buffered-image mode for progressive images. boolean enable_1pass_quant boolean enable_external_quant boolean enable_2pass_quant - These are significant only in buffered-image mode, which is - described in its own section below. + These are significant only in buffered-image mode, which is + described in its own section below. The output image dimensions are given by the following fields. These are @@ -1202,11 +1202,11 @@ close to a desired target size. It's also important if you are using the JPEG library's memory manager to allocate output buffer space, because you are supposed to request such buffers *before* jpeg_start_decompress(). -JDIMENSION output_width Actual dimensions of output image. +JDIMENSION output_width Actual dimensions of output image. JDIMENSION output_height -int out_color_components Number of color components in out_color_space. -int output_components Number of color components returned. -int rec_outbuf_height Recommended height of scanline buffer. +int out_color_components Number of color components in out_color_space. +int output_components Number of color components returned. +int rec_outbuf_height Recommended height of scanline buffer. When quantizing colors, output_components is 1, indicating a single color map index per pixel. Otherwise it equals out_color_components. The output arrays @@ -1246,10 +1246,10 @@ by jpeg_color_space. jpeg_set_defaults() chooses a reasonable JPEG color space depending on in_color_space, but you can override this by calling jpeg_set_colorspace(). Of course you must select a supported transformation. jccolor.c currently supports the following transformations: - RGB => YCbCr - RGB => GRAYSCALE - YCbCr => GRAYSCALE - CMYK => YCCK + RGB => YCbCr + RGB => GRAYSCALE + YCbCr => GRAYSCALE + CMYK => YCCK plus the null transforms: GRAYSCALE => GRAYSCALE, RGB => RGB, YCbCr => YCbCr, CMYK => CMYK, YCCK => YCCK, and UNKNOWN => UNKNOWN. @@ -1279,11 +1279,11 @@ jpeg_read_header's guess by setting jpeg_color_space. jpeg_read_header also selects a default output color space based on (its guess of) jpeg_color_space; set out_color_space to override this. Again, you must select a supported transformation. jdcolor.c currently supports - YCbCr => RGB - YCbCr => GRAYSCALE - RGB => GRAYSCALE - GRAYSCALE => RGB - YCCK => CMYK + YCbCr => RGB + YCbCr => GRAYSCALE + RGB => GRAYSCALE + GRAYSCALE => RGB + YCCK => CMYK as well as the null transforms. (Since GRAYSCALE=>RGB is provided, an application can force grayscale JPEGs to look like color JPEGs if it only wants to handle one case.) @@ -1353,31 +1353,31 @@ The library does not touch client_data at all.) The individual methods that you might wish to override are: error_exit (j_common_ptr cinfo) - Receives control for a fatal error. Information sufficient to - generate the error message has been stored in cinfo->err; call - output_message to display it. Control must NOT return to the caller; - generally this routine will exit() or longjmp() somewhere. - Typically you would override this routine to get rid of the exit() - default behavior. Note that if you continue processing, you should - clean up the JPEG object with jpeg_abort() or jpeg_destroy(). + Receives control for a fatal error. Information sufficient to + generate the error message has been stored in cinfo->err; call + output_message to display it. Control must NOT return to the caller; + generally this routine will exit() or longjmp() somewhere. + Typically you would override this routine to get rid of the exit() + default behavior. Note that if you continue processing, you should + clean up the JPEG object with jpeg_abort() or jpeg_destroy(). output_message (j_common_ptr cinfo) - Actual output of any JPEG message. Override this to send messages - somewhere other than stderr. Note that this method does not know - how to generate a message, only where to send it. + Actual output of any JPEG message. Override this to send messages + somewhere other than stderr. Note that this method does not know + how to generate a message, only where to send it. format_message (j_common_ptr cinfo, char * buffer) - Constructs a readable error message string based on the error info - stored in cinfo->err. This method is called by output_message. Few - applications should need to override this method. One possible - reason for doing so is to implement dynamic switching of error message - language. + Constructs a readable error message string based on the error info + stored in cinfo->err. This method is called by output_message. Few + applications should need to override this method. One possible + reason for doing so is to implement dynamic switching of error message + language. emit_message (j_common_ptr cinfo, int msg_level) - Decide whether or not to emit a warning or trace message; if so, - calls output_message. The main reason for overriding this method - would be to abort on warnings. msg_level is -1 for warnings, - 0 and up for trace messages. + Decide whether or not to emit a warning or trace message; if so, + calls output_message. The main reason for overriding this method + would be to abort on warnings. msg_level is -1 for warnings, + 0 and up for trace messages. Only error_exit() and emit_message() are called from the rest of the JPEG library; the other two are internal to the error handler. @@ -1400,9 +1400,9 @@ messages. See the sample applications cjpeg/djpeg for an example of using addon messages (the addon messages are defined in cderror.h). Actual invocation of the error handler is done via macros defined in jerror.h: - ERREXITn(...) for fatal errors - WARNMSn(...) for corrupt-data warnings - TRACEMSn(...) for trace and informational messages. + ERREXITn(...) for fatal errors + WARNMSn(...) for corrupt-data warnings + TRACEMSn(...) for trace and informational messages. These macros store the message code and any additional parameters into the error handler struct, then invoke the error_exit() or emit_message() method. The variants of each macro are for varying numbers of additional parameters. @@ -1443,8 +1443,8 @@ on external storage. A data destination manager struct contains a pointer and count defining the next byte to write in the work buffer and the remaining free space: - JOCTET * next_output_byte; /* => next byte to write in buffer */ - size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ The library increments the pointer and decrements the count until the buffer is filled. The manager's empty_output_buffer method must reset the pointer @@ -1454,27 +1454,27 @@ and total size in private fields not visible to the library. A data destination manager provides three methods: init_destination (j_compress_ptr cinfo) - Initialize destination. This is called by jpeg_start_compress() - before any data is actually written. It must initialize - next_output_byte and free_in_buffer. free_in_buffer must be - initialized to a positive value. + Initialize destination. This is called by jpeg_start_compress() + before any data is actually written. It must initialize + next_output_byte and free_in_buffer. free_in_buffer must be + initialized to a positive value. empty_output_buffer (j_compress_ptr cinfo) - This is called whenever the buffer has filled (free_in_buffer - reaches zero). In typical applications, it should write out the - *entire* buffer (use the saved start address and buffer length; - ignore the current state of next_output_byte and free_in_buffer). - Then reset the pointer & count to the start of the buffer, and - return TRUE indicating that the buffer has been dumped. - free_in_buffer must be set to a positive value when TRUE is - returned. A FALSE return should only be used when I/O suspension is - desired (this operating mode is discussed in the next section). + This is called whenever the buffer has filled (free_in_buffer + reaches zero). In typical applications, it should write out the + *entire* buffer (use the saved start address and buffer length; + ignore the current state of next_output_byte and free_in_buffer). + Then reset the pointer & count to the start of the buffer, and + return TRUE indicating that the buffer has been dumped. + free_in_buffer must be set to a positive value when TRUE is + returned. A FALSE return should only be used when I/O suspension is + desired (this operating mode is discussed in the next section). term_destination (j_compress_ptr cinfo) - Terminate destination --- called by jpeg_finish_compress() after all - data has been written. In most applications, this must flush any - data remaining in the buffer. Use either next_output_byte or - free_in_buffer to determine how much data is in the buffer. + Terminate destination --- called by jpeg_finish_compress() after all + data has been written. In most applications, this must flush any + data remaining in the buffer. Use either next_output_byte or + free_in_buffer to determine how much data is in the buffer. term_destination() is NOT called by jpeg_abort() or jpeg_destroy(). If you want the destination manager to be cleaned up during an abort, you must do it @@ -1492,8 +1492,8 @@ additional frammishes. The source manager struct contains a pointer and count defining the next byte to read from the work buffer and the number of bytes remaining: - const JOCTET * next_input_byte; /* => next byte to read from buffer */ - size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + const JOCTET * next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ The library increments the pointer and decrements the count until the buffer is emptied. The manager's fill_input_buffer method must reset the pointer and @@ -1503,47 +1503,47 @@ address and total size in private fields not visible to the library. A data source manager provides five methods: init_source (j_decompress_ptr cinfo) - Initialize source. This is called by jpeg_read_header() before any - data is actually read. Unlike init_destination(), it may leave - bytes_in_buffer set to 0 (in which case a fill_input_buffer() call - will occur immediately). + Initialize source. This is called by jpeg_read_header() before any + data is actually read. Unlike init_destination(), it may leave + bytes_in_buffer set to 0 (in which case a fill_input_buffer() call + will occur immediately). fill_input_buffer (j_decompress_ptr cinfo) - This is called whenever bytes_in_buffer has reached zero and more - data is wanted. In typical applications, it should read fresh data - into the buffer (ignoring the current state of next_input_byte and - bytes_in_buffer), reset the pointer & count to the start of the - buffer, and return TRUE indicating that the buffer has been reloaded. - It is not necessary to fill the buffer entirely, only to obtain at - least one more byte. bytes_in_buffer MUST be set to a positive value - if TRUE is returned. A FALSE return should only be used when I/O - suspension is desired (this mode is discussed in the next section). + This is called whenever bytes_in_buffer has reached zero and more + data is wanted. In typical applications, it should read fresh data + into the buffer (ignoring the current state of next_input_byte and + bytes_in_buffer), reset the pointer & count to the start of the + buffer, and return TRUE indicating that the buffer has been reloaded. + It is not necessary to fill the buffer entirely, only to obtain at + least one more byte. bytes_in_buffer MUST be set to a positive value + if TRUE is returned. A FALSE return should only be used when I/O + suspension is desired (this mode is discussed in the next section). skip_input_data (j_decompress_ptr cinfo, long num_bytes) - Skip num_bytes worth of data. The buffer pointer and count should - be advanced over num_bytes input bytes, refilling the buffer as - needed. This is used to skip over a potentially large amount of - uninteresting data (such as an APPn marker). In some applications - it may be possible to optimize away the reading of the skipped data, - but it's not clear that being smart is worth much trouble; large - skips are uncommon. bytes_in_buffer may be zero on return. - A zero or negative skip count should be treated as a no-op. + Skip num_bytes worth of data. The buffer pointer and count should + be advanced over num_bytes input bytes, refilling the buffer as + needed. This is used to skip over a potentially large amount of + uninteresting data (such as an APPn marker). In some applications + it may be possible to optimize away the reading of the skipped data, + but it's not clear that being smart is worth much trouble; large + skips are uncommon. bytes_in_buffer may be zero on return. + A zero or negative skip count should be treated as a no-op. resync_to_restart (j_decompress_ptr cinfo, int desired) - This routine is called only when the decompressor has failed to find - a restart (RSTn) marker where one is expected. Its mission is to - find a suitable point for resuming decompression. For most - applications, we recommend that you just use the default resync - procedure, jpeg_resync_to_restart(). However, if you are able to back - up in the input data stream, or if you have a-priori knowledge about - the likely location of restart markers, you may be able to do better. - Read the read_restart_marker() and jpeg_resync_to_restart() routines - in jdmarker.c if you think you'd like to implement your own resync - procedure. + This routine is called only when the decompressor has failed to find + a restart (RSTn) marker where one is expected. Its mission is to + find a suitable point for resuming decompression. For most + applications, we recommend that you just use the default resync + procedure, jpeg_resync_to_restart(). However, if you are able to back + up in the input data stream, or if you have a-priori knowledge about + the likely location of restart markers, you may be able to do better. + Read the read_restart_marker() and jpeg_resync_to_restart() routines + in jdmarker.c if you think you'd like to implement your own resync + procedure. term_source (j_decompress_ptr cinfo) - Terminate source --- called by jpeg_finish_decompress() after all - data has been read. Often a no-op. + Terminate source --- called by jpeg_finish_decompress() after all + data has been read. Often a no-op. For both fill_input_buffer() and skip_input_data(), there is no such thing as an EOF return. If the end of the file has been reached, the routine has @@ -1651,7 +1651,7 @@ that suspension has occurred. This can happen at four places: * jpeg_read_header(): will return JPEG_SUSPENDED. * jpeg_start_decompress(): will return FALSE, rather than its usual TRUE. * jpeg_read_scanlines(): will return the number of scanlines already - completed (possibly 0). + completed (possibly 0). * jpeg_finish_decompress(): will return FALSE, rather than its usual TRUE. The surrounding application must recognize these cases, load more data into the input buffer, and repeat the call. In the case of jpeg_read_scanlines(), @@ -1829,23 +1829,23 @@ rates. The basic control flow for buffered-image decoding is - jpeg_create_decompress() - set data source - jpeg_read_header() - set overall decompression parameters - cinfo.buffered_image = TRUE; /* select buffered-image mode */ - jpeg_start_decompress() - for (each output pass) { - adjust output decompression parameters if required - jpeg_start_output() /* start a new output pass */ - for (all scanlines in image) { - jpeg_read_scanlines() - display scanlines - } - jpeg_finish_output() /* terminate output pass */ - } - jpeg_finish_decompress() - jpeg_destroy_decompress() + jpeg_create_decompress() + set data source + jpeg_read_header() + set overall decompression parameters + cinfo.buffered_image = TRUE; /* select buffered-image mode */ + jpeg_start_decompress() + for (each output pass) { + adjust output decompression parameters if required + jpeg_start_output() /* start a new output pass */ + for (all scanlines in image) { + jpeg_read_scanlines() + display scanlines + } + jpeg_finish_output() /* terminate output pass */ + } + jpeg_finish_decompress() + jpeg_destroy_decompress() This differs from ordinary unbuffered decoding in that there is an additional level of looping. The application can choose how many output passes to make @@ -1854,9 +1854,9 @@ and how to display each pass. The simplest approach to displaying progressive images is to do one display pass for each scan appearing in the input file. In this case the outer loop condition is typically - while (! jpeg_input_complete(&cinfo)) + while (! jpeg_input_complete(&cinfo)) and the start-output call should read - jpeg_start_output(&cinfo, cinfo.input_scan_number); + jpeg_start_output(&cinfo, cinfo.input_scan_number); The second parameter to jpeg_start_output() indicates which scan of the input file is to be displayed; the scans are numbered starting at 1 for this purpose. (You can use a loop counter starting at 1 if you like, but using @@ -1887,11 +1887,11 @@ If input data arrives faster than it can be displayed, the application can cause the library to decode input data in advance of what's needed to produce output. This is done by calling the routine jpeg_consume_input(). The return value is one of the following: - JPEG_REACHED_SOS: reached an SOS marker (the start of a new scan) - JPEG_REACHED_EOI: reached the EOI marker (end of image) - JPEG_ROW_COMPLETED: completed reading one MCU row of compressed data - JPEG_SCAN_COMPLETED: completed reading last MCU row of current scan - JPEG_SUSPENDED: suspended before completing any of the above + JPEG_REACHED_SOS: reached an SOS marker (the start of a new scan) + JPEG_REACHED_EOI: reached the EOI marker (end of image) + JPEG_ROW_COMPLETED: completed reading one MCU row of compressed data + JPEG_SCAN_COMPLETED: completed reading last MCU row of current scan + JPEG_SUSPENDED: suspended before completing any of the above (JPEG_SUSPENDED can occur only if a suspending data source is used.) This routine can be called at any time after initializing the JPEG object. It reads some additional data and returns when one of the indicated significant @@ -1968,27 +1968,27 @@ 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); - adjust output decompression parameters if required - jpeg_start_output(&cinfo, cinfo.input_scan_number); - ... - jpeg_finish_output() - } while (! final_pass); + do { + absorb any waiting input by calling jpeg_consume_input() + final_pass = jpeg_input_complete(&cinfo); + adjust output decompression parameters if required + jpeg_start_output(&cinfo, cinfo.input_scan_number); + ... + jpeg_finish_output() + } while (! final_pass); rather than quitting as soon as jpeg_input_complete() returns TRUE. This arrangement makes it simple to use higher-quality decoding parameters for the final pass. But if you don't want to use special parameters for the final pass, the right loop logic is like this: - for (;;) { - absorb any waiting input by calling jpeg_consume_input() - jpeg_start_output(&cinfo, cinfo.input_scan_number); - ... - jpeg_finish_output() - if (jpeg_input_complete(&cinfo) && - cinfo.input_scan_number == cinfo.output_scan_number) - break; - } + for (;;) { + absorb any waiting input by calling jpeg_consume_input() + jpeg_start_output(&cinfo, cinfo.input_scan_number); + ... + jpeg_finish_output() + if (jpeg_input_complete(&cinfo) && + 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 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 @@ -2097,9 +2097,9 @@ working-storage requirements, the library requires you to indicate which one(s) you intend to use before you call jpeg_start_decompress(). (If we did not require this, the max_memory_to_use setting would be a complete fiction.) You do this by setting one or more of these three cinfo fields to TRUE: - enable_1pass_quant Fixed color cube colormap - enable_external_quant Externally-supplied colormap - enable_2pass_quant Two-pass custom colormap + enable_1pass_quant Fixed color cube colormap + enable_external_quant Externally-supplied colormap + enable_2pass_quant Two-pass custom colormap All three are initialized FALSE by jpeg_read_header(). But jpeg_start_decompress() automatically sets TRUE the one selected by the current two_pass_quantize and colormap settings, so you only need to set the @@ -2250,14 +2250,14 @@ sent_tables flags will be set TRUE. A sure-fire way to create matching tables-only and abbreviated image files is to proceed as follows: - create JPEG compression object - set JPEG parameters - set destination to tables-only file - jpeg_write_tables(&cinfo); - set destination to image file - jpeg_start_compress(&cinfo, FALSE); - write data... - jpeg_finish_compress(&cinfo); + create JPEG compression object + set JPEG parameters + set destination to tables-only file + jpeg_write_tables(&cinfo); + set destination to image file + jpeg_start_compress(&cinfo, FALSE); + write data... + jpeg_finish_compress(&cinfo); Since the JPEG parameters are not altered between writing the table file and the abbreviated image file, the same tables are sure to be used. Of course, @@ -2285,7 +2285,7 @@ to load a fixed quantization table into table slot "n": if (cinfo.quant_tbl_ptrs[n] == NULL) cinfo.quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) &cinfo); - quant_ptr = cinfo.quant_tbl_ptrs[n]; /* quant_ptr is JQUANT_TBL* */ + quant_ptr = cinfo.quant_tbl_ptrs[n]; /* quant_ptr is JQUANT_TBL* */ for (i = 0; i < 64; i++) { /* Qtable[] is desired quantization table, in natural array order */ quant_ptr->quantval[i] = Qtable[i]; @@ -2295,7 +2295,7 @@ Code to load a fixed Huffman table is typically (for AC table "n"): if (cinfo.ac_huff_tbl_ptrs[n] == NULL) cinfo.ac_huff_tbl_ptrs[n] = jpeg_alloc_huff_table((j_common_ptr) &cinfo); - huff_ptr = cinfo.ac_huff_tbl_ptrs[n]; /* huff_ptr is JHUFF_TBL* */ + huff_ptr = cinfo.ac_huff_tbl_ptrs[n]; /* huff_ptr is JHUFF_TBL* */ for (i = 1; i <= 16; i++) { /* counts[i] is number of Huffman codes of length i bits, i=1..16 */ huff_ptr->bits[i] = counts[i]; @@ -2317,15 +2317,15 @@ sufficient to read a tables-only file. You must pass a second parameter of FALSE to indicate that you do not require an image to be present. Thus, the typical scenario is - create JPEG decompression object - set source to tables-only file - jpeg_read_header(&cinfo, FALSE); - set source to abbreviated image file - jpeg_read_header(&cinfo, TRUE); - set decompression parameters - jpeg_start_decompress(&cinfo); - read data... - jpeg_finish_decompress(&cinfo); + create JPEG decompression object + set source to tables-only file + jpeg_read_header(&cinfo, FALSE); + set source to abbreviated image file + jpeg_read_header(&cinfo, TRUE); + set decompression parameters + jpeg_start_decompress(&cinfo); + read data... + jpeg_finish_decompress(&cinfo); In some cases, you may want to read a file without knowing whether it contains an image or just tables. In that case, pass FALSE and check the return value @@ -2398,7 +2398,7 @@ all else. Specify the marker type parameter as "JPEG_COM" for COM or "JPEG_APP0 + n" for APPn. (Actually, jpeg_write_marker will let you write any marker type, but we don't recommend writing any other kinds of marker.) For example, to write a user comment string pointed to by comment_text: - jpeg_write_marker(cinfo, JPEG_COM, comment_text, strlen(comment_text)); + jpeg_write_marker(cinfo, JPEG_COM, comment_text, strlen(comment_text)); If it's not convenient to store all the marker data in memory at once, you can instead call jpeg_write_m_header() followed by multiple calls to @@ -2444,7 +2444,7 @@ determined separately for COM markers and for each APPn marker code. To save the contents of special markers in memory, call - jpeg_save_markers(cinfo, marker_code, length_limit) + jpeg_save_markers(cinfo, marker_code, length_limit) where marker_code is the marker type to save, JPEG_COM or JPEG_APP0+n. (To arrange to save all the special marker types, you need to call this routine 17 times, for COM and APP0-APP15.) If the incoming marker is longer @@ -2489,7 +2489,7 @@ effective length limit is exactly what you set it to be. If you want to supply your own marker-reading routine, you do it by calling jpeg_set_marker_processor(). A marker processor routine must have the signature - boolean jpeg_marker_parser_method (j_decompress_ptr cinfo) + boolean jpeg_marker_parser_method (j_decompress_ptr cinfo) Although the marker code is not explicitly passed, the routine can find it in cinfo->unread_marker. At the time of call, the marker proper has been read from the data source module. The processor routine is responsible for @@ -2576,8 +2576,8 @@ image; don't forget to pad your data as necessary. The required dimensions of the supplied data can be computed for each component as - cinfo->comp_info[i].width_in_blocks*DCTSIZE samples per row - cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image + cinfo->comp_info[i].width_in_blocks*DCTSIZE samples per row + cinfo->comp_info[i].height_in_blocks*DCTSIZE rows in image after jpeg_start_compress() has initialized those fields. If the valid data is smaller than this, it must be padded appropriately. For some sampling factors and image sizes, additional dummy DCT blocks are inserted to make @@ -2585,12 +2585,12 @@ the image a multiple of the MCU dimensions. The library creates such dummy blocks itself; it does not read them from your supplied data. Therefore you need never pad by more than DCTSIZE samples. An example may help here. Assume 2h2v downsampling of YCbCr data, that is - cinfo->comp_info[0].h_samp_factor = 2 for Y - cinfo->comp_info[0].v_samp_factor = 2 - cinfo->comp_info[1].h_samp_factor = 1 for Cb - cinfo->comp_info[1].v_samp_factor = 1 - cinfo->comp_info[2].h_samp_factor = 1 for Cr - cinfo->comp_info[2].v_samp_factor = 1 + cinfo->comp_info[0].h_samp_factor = 2 for Y + cinfo->comp_info[0].v_samp_factor = 2 + cinfo->comp_info[1].h_samp_factor = 1 for Cb + cinfo->comp_info[1].v_samp_factor = 1 + cinfo->comp_info[2].h_samp_factor = 1 for Cr + cinfo->comp_info[2].v_samp_factor = 1 and suppose that the nominal image dimensions (cinfo->image_width and cinfo->image_height) are 101x101 pixels. Then jpeg_start_compress() will compute downsampled_width = 101 and width_in_blocks = 13 for Y, @@ -2761,18 +2761,18 @@ JPEG memory manager with lifetime JPOOL_PERMANENT will work nicely.) You can use the same callback routine for both compression and decompression. The jpeg_progress_mgr struct contains four fields which are set by the library: - long pass_counter; /* work units completed in this pass */ - long pass_limit; /* total number of work units in this pass */ - int completed_passes; /* passes completed so far */ - int total_passes; /* total number of passes expected */ + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ During any one pass, pass_counter increases from 0 up to (not including) pass_limit; the step size is usually but not necessarily 1. The pass_limit value may change from one pass to another. The expected total number of passes is in total_passes, and the number of passes already completed is in completed_passes. Thus the fraction of work completed may be estimated as - completed_passes + (pass_counter/pass_limit) - -------------------------------------------- - total_passes + completed_passes + (pass_counter/pass_limit) + -------------------------------------------- + total_passes ignoring the fact that the passes may not be equal amounts of work. When decompressing, pass_limit can even change within a pass, because it @@ -2945,7 +2945,7 @@ functions. To do this, undefine xxx_SUPPORTED symbols as necessary. You can also save a few K by not having text error messages in the library; the standard error message table occupies about 5Kb. This is particularly -reasonable for embedded applications where there's no good way to display +reasonable for embedded applications where there's no good way to display a message anyway. To do this, remove the creation of the message table (jpeg_std_message_table[]) from jerror.c, and alter format_message to do something reasonable without it. You could output the numeric value of the @@ -2969,10 +2969,10 @@ See install.txt for configuration procedures. The code is not dependent on the exact sizes of the C data types. As distributed, we make the assumptions that - char is at least 8 bits wide - short is at least 16 bits wide - int is at least 16 bits wide - long is at least 32 bits wide + char is at least 8 bits wide + short is at least 16 bits wide + int is at least 16 bits wide + long is at least 32 bits wide (These are the minimum requirements of the ANSI C standard.) Wider types will work fine, although memory may be used inefficiently if char is much larger than 8 bits or short is much bigger than 16 bits. The code should work diff --git a/rdbmp.c b/rdbmp.c index 7c2e0441..0b2351db 100644 --- a/rdbmp.c +++ b/rdbmp.c @@ -24,7 +24,7 @@ * This code contributed by James Arthur Boucher. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef BMP_SUPPORTED @@ -33,19 +33,19 @@ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ #ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) +#define UCH(x) ((int) (x) & 0xFF) #endif #endif /* HAVE_UNSIGNED_CHAR */ -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) +#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) /* Private version of data source object */ @@ -55,15 +55,15 @@ typedef struct _bmp_source_struct * bmp_source_ptr; typedef struct _bmp_source_struct { struct cjpeg_source_struct pub; /* public fields */ - j_compress_ptr cinfo; /* back link saves passing separate parm */ + j_compress_ptr cinfo; /* back link saves passing separate parm */ - JSAMPARRAY colormap; /* BMP colormap (converted to my format) */ + JSAMPARRAY colormap; /* BMP colormap (converted to my format) */ - jvirt_sarray_ptr whole_image; /* Needed to reverse row order */ - JDIMENSION source_row; /* Current source row number */ - JDIMENSION row_width; /* Physical width of scanlines in file */ + jvirt_sarray_ptr whole_image; /* Needed to reverse row order */ + JDIMENSION source_row; /* Current source row number */ + JDIMENSION row_width; /* Physical width of scanlines in file */ - int bits_per_pixel; /* remembers 8- or 24-bit format */ + int bits_per_pixel; /* remembers 8- or 24-bit format */ } bmp_source_struct; @@ -140,7 +140,7 @@ get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) outptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { t = GETJSAMPLE(*inptr++); - *outptr++ = colormap[0][t]; /* can omit GETJSAMPLE() safely */ + *outptr++ = colormap[0][t]; /* can omit GETJSAMPLE() safely */ *outptr++ = colormap[1][t]; *outptr++ = colormap[2][t]; } @@ -170,7 +170,7 @@ get_24bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) inptr = image_ptr[0]; outptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ + outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ outptr[1] = *inptr++; outptr[0] = *inptr++; outptr += 3; @@ -200,10 +200,10 @@ get_32bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) inptr = image_ptr[0]; outptr = source->pub.buffer[0]; for (col = cinfo->image_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ + outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ outptr[1] = *inptr++; outptr[0] = *inptr++; - inptr++; /* skip the 4th byte (Alpha channel) */ + inptr++; /* skip the 4th byte (Alpha channel) */ outptr += 3; } @@ -280,11 +280,11 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) U_CHAR bmpfileheader[14]; U_CHAR bmpinfoheader[64]; #define GET_2B(array,offset) ((unsigned int) UCH(array[offset]) + \ - (((unsigned int) UCH(array[offset+1])) << 8)) + (((unsigned int) UCH(array[offset+1])) << 8)) #define GET_4B(array,offset) ((INT32) UCH(array[offset]) + \ - (((INT32) UCH(array[offset+1])) << 8) + \ - (((INT32) UCH(array[offset+2])) << 16) + \ - (((INT32) UCH(array[offset+3])) << 24)) + (((INT32) UCH(array[offset+1])) << 8) + \ + (((INT32) UCH(array[offset+2])) << 16) + \ + (((INT32) UCH(array[offset+3])) << 24)) INT32 bfOffBits; INT32 headerSize; INT32 biWidth; @@ -293,7 +293,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) INT32 biCompression; INT32 biXPelsPerMeter,biYPelsPerMeter; INT32 biClrUsed = 0; - int mapentrysize = 0; /* 0 indicates no colormap */ + int mapentrysize = 0; /* 0 indicates no colormap */ INT32 bPad; JDIMENSION row_width; @@ -325,11 +325,11 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) source->bits_per_pixel = (int) GET_2B(bmpinfoheader,10); switch (source->bits_per_pixel) { - case 8: /* colormapped image */ - mapentrysize = 3; /* OS/2 uses RGBTRIPLE colormap */ + case 8: /* colormapped image */ + mapentrysize = 3; /* OS/2 uses RGBTRIPLE colormap */ TRACEMS2(cinfo, 1, JTRC_BMP_OS2_MAPPED, (int) biWidth, (int) biHeight); break; - case 24: /* RGB image */ + case 24: /* RGB image */ TRACEMS2(cinfo, 1, JTRC_BMP_OS2, (int) biWidth, (int) biHeight); break; default: @@ -352,14 +352,14 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* biSizeImage, biClrImportant fields are ignored */ switch (source->bits_per_pixel) { - case 8: /* colormapped image */ - mapentrysize = 4; /* Windows uses RGBQUAD colormap */ + case 8: /* colormapped image */ + mapentrysize = 4; /* Windows uses RGBQUAD colormap */ TRACEMS2(cinfo, 1, JTRC_BMP_MAPPED, (int) biWidth, (int) biHeight); break; - case 24: /* RGB image */ + case 24: /* RGB image */ TRACEMS2(cinfo, 1, JTRC_BMP, (int) biWidth, (int) biHeight); break; - case 32: /* RGB image + Alpha channel */ + case 32: /* RGB image + Alpha channel */ TRACEMS2(cinfo, 1, JTRC_BMP, (int) biWidth, (int) biHeight); break; default: @@ -373,7 +373,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* Set JFIF density parameters from the BMP data */ cinfo->X_density = (UINT16) (biXPelsPerMeter/100); /* 100 cm per meter */ cinfo->Y_density = (UINT16) (biYPelsPerMeter/100); - cinfo->density_unit = 2; /* dots/cm */ + cinfo->density_unit = 2; /* dots/cm */ } break; default: @@ -392,7 +392,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* Read the colormap, if any */ if (mapentrysize > 0) { if (biClrUsed <= 0) - biClrUsed = 256; /* assume it's 256 */ + biClrUsed = 256; /* assume it's 256 */ else if (biClrUsed > 256) ERREXIT(cinfo, JERR_BMP_BADCMAP); /* Allocate space to store the colormap */ @@ -406,7 +406,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } /* Skip any remaining pad bytes */ - if (bPad < 0) /* incorrect bfOffBits value? */ + if (bPad < 0) /* incorrect bfOffBits value? */ ERREXIT(cinfo, JERR_BMP_BADHEADER); while (--bPad >= 0) { (void) read_byte(source); @@ -469,8 +469,8 @@ jinit_read_bmp (j_compress_ptr cinfo) /* Create module interface object */ source = (bmp_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_source_struct)); - source->cinfo = cinfo; /* make back link for subroutines */ + SIZEOF(bmp_source_struct)); + source->cinfo = cinfo; /* make back link for subroutines */ /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_bmp; source->pub.finish_input = finish_input_bmp; diff --git a/rdcolmap.c b/rdcolmap.c index 42b34376..ac6f50ee 100644 --- a/rdcolmap.c +++ b/rdcolmap.c @@ -21,9 +21,9 @@ * currently implemented. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ +#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ /* Portions of this code are based on the PBMPLUS library, which is: ** @@ -54,9 +54,9 @@ add_map_entry (j_decompress_ptr cinfo, int R, int G, int B) /* Check for duplicate color. */ for (index = 0; index < ncolors; index++) { if (GETJSAMPLE(colormap0[index]) == R && - GETJSAMPLE(colormap1[index]) == G && - GETJSAMPLE(colormap2[index]) == B) - return; /* color is already in map */ + GETJSAMPLE(colormap1[index]) == G && + GETJSAMPLE(colormap2[index]) == B) + return; /* color is already in map */ } /* Check for map overflow. */ @@ -107,9 +107,9 @@ read_gif_map (j_decompress_ptr cinfo, FILE * infile) if (R == EOF || G == EOF || B == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); add_map_entry(cinfo, - R << (BITS_IN_JSAMPLE-8), - G << (BITS_IN_JSAMPLE-8), - B << (BITS_IN_JSAMPLE-8)); + R << (BITS_IN_JSAMPLE-8), + G << (BITS_IN_JSAMPLE-8), + B << (BITS_IN_JSAMPLE-8)); } } @@ -123,7 +123,7 @@ pbm_getc (FILE * infile) /* A comment/newline sequence is returned as a newline */ { register int ch; - + ch = getc(infile); if (ch == '#') { do { @@ -143,17 +143,17 @@ read_pbm_integer (j_decompress_ptr cinfo, FILE * infile) { register int ch; register unsigned int val; - + /* Skip any leading whitespace */ do { ch = pbm_getc(infile); if (ch == EOF) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'); - + if (ch < '0' || ch > '9') ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - + val = ch - '0'; while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') { val *= 10; @@ -175,7 +175,7 @@ read_ppm_map (j_decompress_ptr cinfo, FILE * infile) int R, G, B; /* Initial 'P' has already been read by read_color_map */ - c = getc(infile); /* save format discriminator for a sec */ + c = getc(infile); /* save format discriminator for a sec */ /* while we fetch the remaining header info */ w = read_pbm_integer(cinfo, infile); @@ -190,26 +190,26 @@ read_ppm_map (j_decompress_ptr cinfo, FILE * infile) ERREXIT(cinfo, JERR_BAD_CMAP_FILE); switch (c) { - case '3': /* it's a text-format PPM file */ + case '3': /* it's a text-format PPM file */ for (row = 0; row < h; row++) { for (col = 0; col < w; col++) { - R = read_pbm_integer(cinfo, infile); - G = read_pbm_integer(cinfo, infile); - B = read_pbm_integer(cinfo, infile); - add_map_entry(cinfo, R, G, B); + R = read_pbm_integer(cinfo, infile); + G = read_pbm_integer(cinfo, infile); + B = read_pbm_integer(cinfo, infile); + add_map_entry(cinfo, R, G, B); } } break; - case '6': /* it's a raw-format PPM file */ + case '6': /* it's a raw-format PPM file */ for (row = 0; row < h; row++) { for (col = 0; col < w; col++) { - R = getc(infile); - G = getc(infile); - B = getc(infile); - if (R == EOF || G == EOF || B == EOF) - ERREXIT(cinfo, JERR_BAD_CMAP_FILE); - add_map_entry(cinfo, R, G, B); + R = getc(infile); + G = getc(infile); + B = getc(infile); + if (R == EOF || G == EOF || B == EOF) + ERREXIT(cinfo, JERR_BAD_CMAP_FILE); + add_map_entry(cinfo, R, G, B); } } break; diff --git a/rdgif.c b/rdgif.c index b27c1675..5caad8a0 100644 --- a/rdgif.c +++ b/rdgif.c @@ -19,7 +19,7 @@ * CompuServe Incorporated." */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef GIF_SUPPORTED @@ -32,7 +32,7 @@ jinit_read_gif (j_compress_ptr cinfo) { fprintf(stderr, "GIF input is unsupported for legal reasons. Sorry.\n"); exit(EXIT_FAILURE); - return NULL; /* keep compiler happy */ + return NULL; /* keep compiler happy */ } #endif /* GIF_SUPPORTED */ diff --git a/rdjpgcom.c b/rdjpgcom.c index 37191547..02ce90f2 100644 --- a/rdjpgcom.c +++ b/rdjpgcom.c @@ -12,45 +12,45 @@ * JPEG markers. */ -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jinclude.h" /* get auto-config symbols, */ +#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ +#include "jinclude.h" /* get auto-config symbols, */ #ifdef HAVE_LOCALE_H -#include /* Bill Allombert: use locale for isprint */ +#include /* Bill Allombert: use locale for isprint */ #endif -#include /* to declare isupper(), tolower() */ +#include /* to declare isupper(), tolower() */ #ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ +#include /* to declare setmode()'s parameter macros */ /* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ +#include /* to declare setmode() */ #endif -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ #include /* Metrowerks needs this */ -#include /* ... and this */ +#include /* ... and this */ #endif #ifdef THINK_C -#include /* Think declares it here */ +#include /* Think declares it here */ #endif #endif -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" #endif #endif -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS #ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ #else #define EXIT_SUCCESS 0 #endif @@ -62,7 +62,7 @@ * To reuse this code in another application, you might need to change these. */ -static FILE * infile; /* input JPEG file */ +static FILE * infile; /* input JPEG file */ /* Return next input byte, or EOF if no more */ #define NEXTBYTE() getc(infile) @@ -107,11 +107,11 @@ read_2_bytes (void) * in this program. (See jdmarker.c for a more complete list.) */ -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ #define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ #define M_SOF6 0xC6 #define M_SOF7 0xC7 #define M_SOF9 0xC9 @@ -120,12 +120,12 @@ read_2_bytes (void) #define M_SOF13 0xCD #define M_SOF14 0xCE #define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_APP0 0xE0 /* Application-specific marker, type N */ -#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ -#define M_COM 0xFE /* COMment */ +#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_APP0 0xE0 /* Application-specific marker, type N */ +#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ +#define M_COM 0xFE /* COMment */ /* @@ -253,7 +253,7 @@ process_COM (int raw) printf("\n"); } else if (ch == '\n') { if (lastch != '\r') - printf("\n"); + printf("\n"); } else if (ch == '\\') { printf("\\\\"); } else if (isprint(ch)) { @@ -287,7 +287,7 @@ process_SOFn (int marker) const char * process; int ci; - length = read_2_bytes(); /* usual parameter length count */ + length = read_2_bytes(); /* usual parameter length count */ data_precision = read_1_byte(); image_height = read_2_bytes(); @@ -295,33 +295,33 @@ process_SOFn (int marker) num_components = read_1_byte(); switch (marker) { - case M_SOF0: process = "Baseline"; break; - case M_SOF1: process = "Extended sequential"; break; - case M_SOF2: process = "Progressive"; break; - case M_SOF3: process = "Lossless"; break; - case M_SOF5: process = "Differential sequential"; break; - case M_SOF6: process = "Differential progressive"; break; - case M_SOF7: process = "Differential lossless"; break; - case M_SOF9: process = "Extended sequential, arithmetic coding"; break; - case M_SOF10: process = "Progressive, arithmetic coding"; break; - case M_SOF11: process = "Lossless, arithmetic coding"; break; - case M_SOF13: process = "Differential sequential, arithmetic coding"; break; - case M_SOF14: process = "Differential progressive, arithmetic coding"; break; - case M_SOF15: process = "Differential lossless, arithmetic coding"; break; - default: process = "Unknown"; break; + case M_SOF0: process = "Baseline"; break; + case M_SOF1: process = "Extended sequential"; break; + case M_SOF2: process = "Progressive"; break; + case M_SOF3: process = "Lossless"; break; + case M_SOF5: process = "Differential sequential"; break; + case M_SOF6: process = "Differential progressive"; break; + case M_SOF7: process = "Differential lossless"; break; + case M_SOF9: process = "Extended sequential, arithmetic coding"; break; + case M_SOF10: process = "Progressive, arithmetic coding"; break; + case M_SOF11: process = "Lossless, arithmetic coding"; break; + case M_SOF13: process = "Differential sequential, arithmetic coding"; break; + case M_SOF14: process = "Differential progressive, arithmetic coding"; break; + case M_SOF15: process = "Differential lossless, arithmetic coding"; break; + default: process = "Unknown"; break; } printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - image_width, image_height, num_components, data_precision); + image_width, image_height, num_components, data_precision); printf("JPEG process: %s\n", process); if (length != (unsigned int) (8 + num_components * 3)) ERREXIT("Bogus SOF marker length"); for (ci = 0; ci < num_components; ci++) { - (void) read_1_byte(); /* Component ID code */ - (void) read_1_byte(); /* H, V sampling factors */ - (void) read_1_byte(); /* Quantization table number */ + (void) read_1_byte(); /* Component ID code */ + (void) read_1_byte(); /* H, V sampling factors */ + (void) read_1_byte(); /* Quantization table number */ } } @@ -352,29 +352,29 @@ scan_JPEG_header (int verbose, int raw) /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, * treated as SOFn. C4 in particular is actually DHT. */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ + case M_SOF2: /* Progressive, Huffman */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_SOF9: /* Extended sequential, arithmetic */ + case M_SOF10: /* Progressive, arithmetic */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ if (verbose) - process_SOFn(marker); + process_SOFn(marker); else - skip_variable(); + skip_variable(); break; - case M_SOS: /* stop before hitting compressed data */ + case M_SOS: /* stop before hitting compressed data */ return marker; - case M_EOI: /* in case it's a tables-only JPEG stream */ + case M_EOI: /* in case it's a tables-only JPEG stream */ return marker; case M_COM: @@ -386,14 +386,14 @@ scan_JPEG_header (int verbose, int raw) * APP12 markers, so we print those out too when in -verbose mode. */ if (verbose) { - printf("APP12 contains:\n"); - process_COM(raw); + printf("APP12 contains:\n"); + process_COM(raw); } else - skip_variable(); + skip_variable(); break; - default: /* Anything else just gets skipped */ - skip_variable(); /* we assume it has a parameter count... */ + default: /* Anything else just gets skipped */ + skip_variable(); /* we assume it has a parameter count... */ break; } } /* end loop */ @@ -402,7 +402,7 @@ scan_JPEG_header (int verbose, int raw) /* Command line parsing code */ -static const char * progname; /* program name for error messages */ +static const char * progname; /* program name for error messages */ static void @@ -432,17 +432,17 @@ keymatch (char * arg, const char * keyword, int minchars) while ((ca = *arg++) != '\0') { if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ + return 0; /* arg longer than keyword, no good */ + if (isupper(ca)) /* force arg to lcase (assume ck is already) */ ca = tolower(ca); if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ + return 0; /* no good */ + nmatched++; /* count matched characters */ } /* reached end of argument; fail if it's too short for unique abbrev */ if (nmatched < minchars) return 0; - return 1; /* A-OK */ + return 1; /* A-OK */ } @@ -464,14 +464,14 @@ main (int argc, char **argv) progname = argv[0]; if (progname == NULL || progname[0] == 0) - progname = "rdjpgcom"; /* in case C library doesn't provide it */ + progname = "rdjpgcom"; /* in case C library doesn't provide it */ /* Parse switches, if any */ for (argn = 1; argn < argc; argn++) { arg = argv[argn]; if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ + break; /* not switch, must be file name */ + arg++; /* advance over '-' */ if (keymatch(arg, "verbose", 1)) { verbose++; } else if (keymatch(arg, "raw", 1)) { @@ -493,10 +493,10 @@ main (int argc, char **argv) } } else { /* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ +#ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdin), O_BINARY); #endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open stdin\n", progname); exit(EXIT_FAILURE); @@ -511,5 +511,5 @@ main (int argc, char **argv) /* All done. */ exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ + return 0; /* suppress no-return-value warnings */ } diff --git a/rdppm.c b/rdppm.c index 0f3994d2..c55ab2b6 100644 --- a/rdppm.c +++ b/rdppm.c @@ -19,7 +19,7 @@ * the file is indeed PPM format). */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef PPM_SUPPORTED @@ -41,19 +41,19 @@ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ #ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) +#define UCH(x) ((int) (x) & 0xFF) #endif #endif /* HAVE_UNSIGNED_CHAR */ -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) +#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) /* @@ -72,10 +72,10 @@ typedef char U_CHAR; typedef struct { struct cjpeg_source_struct pub; /* public fields */ - U_CHAR *iobuffer; /* non-FAR pointer to I/O buffer */ - JSAMPROW pixrow; /* FAR pointer to same */ - size_t buffer_width; /* width of I/O buffer */ - JSAMPLE *rescale; /* => maxval-remapping array, or NULL */ + U_CHAR *iobuffer; /* non-FAR pointer to I/O buffer */ + JSAMPROW pixrow; /* FAR pointer to same */ + size_t buffer_width; /* width of I/O buffer */ + JSAMPLE *rescale; /* => maxval-remapping array, or NULL */ } ppm_source_struct; typedef ppm_source_struct * ppm_source_ptr; @@ -308,10 +308,10 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* detect unsupported variants (ie, PBM) before trying to read header */ switch (c) { - case '2': /* it's a text-format PGM file */ - case '3': /* it's a text-format PPM file */ - case '5': /* it's a raw-format PGM file */ - case '6': /* it's a raw-format PPM file */ + case '2': /* it's a text-format PGM file */ + case '3': /* it's a text-format PPM file */ + case '5': /* it's a raw-format PGM file */ + case '6': /* it's a raw-format PPM file */ break; default: ERREXIT(cinfo, JERR_PPM_NOT); @@ -331,12 +331,12 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) cinfo->image_height = (JDIMENSION) h; /* initialize flags to most common settings */ - need_iobuffer = TRUE; /* do we need an I/O buffer? */ - use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */ - need_rescale = TRUE; /* do we need a rescale array? */ + need_iobuffer = TRUE; /* do we need an I/O buffer? */ + use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */ + need_rescale = TRUE; /* do we need a rescale array? */ switch (c) { - case '2': /* it's a text-format PGM file */ + case '2': /* it's a text-format PGM file */ cinfo->input_components = 1; cinfo->in_color_space = JCS_GRAYSCALE; TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h); @@ -344,7 +344,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) need_iobuffer = FALSE; break; - case '3': /* it's a text-format PPM file */ + case '3': /* it's a text-format PPM file */ cinfo->input_components = 3; cinfo->in_color_space = JCS_RGB; TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h); @@ -352,7 +352,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) need_iobuffer = FALSE; break; - case '5': /* it's a raw-format PGM file */ + case '5': /* it's a raw-format PGM file */ cinfo->input_components = 1; cinfo->in_color_space = JCS_GRAYSCALE; TRACEMS2(cinfo, 1, JTRC_PGM, w, h); @@ -367,7 +367,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } break; - case '6': /* it's a raw-format PPM file */ + case '6': /* it's a raw-format PPM file */ cinfo->input_components = 3; cinfo->in_color_space = JCS_RGB; TRACEMS2(cinfo, 1, JTRC_PPM, w, h); @@ -389,7 +389,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) ((maxval<=255) ? SIZEOF(U_CHAR) : (2*SIZEOF(U_CHAR))); source->iobuffer = (U_CHAR *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - source->buffer_width); + source->buffer_width); } /* Create compressor input buffer. */ @@ -415,7 +415,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* On 16-bit-int machines we have to be careful of maxval = 65535 */ source->rescale = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE))); + (size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE))); half_maxval = maxval / 2; for (val = 0; val <= (INT32) maxval; val++) { /* The multiplication here must be done in 32 bits to avoid overflow */ @@ -448,7 +448,7 @@ jinit_read_ppm (j_compress_ptr cinfo) /* Create module interface object */ source = (ppm_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_source_struct)); + SIZEOF(ppm_source_struct)); /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_ppm; source->pub.finish_input = finish_input_ppm; diff --git a/rdrle.c b/rdrle.c index 542bc374..f8b3587f 100644 --- a/rdrle.c +++ b/rdrle.c @@ -19,7 +19,7 @@ * with updates from Robert Hutchinson. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef RLE_SUPPORTED @@ -38,7 +38,7 @@ /* * We support the following types of RLE files: - * + * * GRAYSCALE - 8 bits, no colormap * MAPPEDGRAY - 8 bits, 1 channel colomap * PSEUDOCOLOR - 8 bits, 3 channel colormap @@ -66,7 +66,7 @@ typedef struct _rle_source_struct { rle_kind visual; /* actual type of input file */ jvirt_sarray_ptr image; /* virtual array to hold the image */ - JDIMENSION row; /* current row # in the virtual array */ + JDIMENSION row; /* current row # in the virtual array */ rle_hdr header; /* Input file information */ rle_pixel** rle_row; /* holds a row returned by rle_getrow() */ @@ -111,10 +111,10 @@ start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } /* Figure out what we have, set private vars and return values accordingly */ - + width = source->header.xmax - source->header.xmin + 1; height = source->header.ymax - source->header.ymin + 1; - source->header.xmin = 0; /* realign horizontally */ + source->header.xmin = 0; /* realign horizontally */ source->header.xmax = width-1; cinfo->image_width = width; @@ -131,17 +131,17 @@ start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } else if (source->header.ncolors == 1 && source->header.ncmap == 3) { source->visual = PSEUDOCOLOR; TRACEMS3(cinfo, 1, JTRC_RLE_MAPPED, width, height, - 1 << source->header.cmaplen); + 1 << source->header.cmaplen); } else if (source->header.ncolors == 3 && source->header.ncmap == 3) { source->visual = TRUECOLOR; TRACEMS3(cinfo, 1, JTRC_RLE_FULLMAP, width, height, - 1 << source->header.cmaplen); + 1 << source->header.cmaplen); } else if (source->header.ncolors == 3 && source->header.ncmap == 0) { source->visual = DIRECTCOLOR; TRACEMS2(cinfo, 1, JTRC_RLE, width, height); } else ERREXIT(cinfo, JERR_RLE_UNSUPPORTED); - + if (source->visual == GRAYSCALE || source->visual == MAPPEDGRAY) { cinfo->in_color_space = JCS_GRAYSCALE; cinfo->input_components = 1; @@ -348,7 +348,7 @@ load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) source->row = cinfo->image_height; /* And fetch the topmost (bottommost) row */ - return (*source->pub.get_pixel_rows) (cinfo, sinfo); + return (*source->pub.get_pixel_rows) (cinfo, sinfo); } diff --git a/rdswitch.c b/rdswitch.c index fc0727a5..65499740 100644 --- a/rdswitch.c +++ b/rdswitch.c @@ -9,15 +9,15 @@ * * This file contains routines to process some of cjpeg's more complicated * command-line switches. Switches processed here are: - * -qtables file Read quantization tables from text file - * -scans file Read scan script from text file - * -quality N[,N,...] Set quality ratings - * -qslots N[,N,...] Set component quantization table selectors - * -sample HxV[,HxV,...] Set component sampling factors + * -qtables file Read quantization tables from text file + * -scans file Read scan script from text file + * -quality N[,N,...] Set quality ratings + * -qslots N[,N,...] Set component quantization table selectors + * -sample HxV[,HxV,...] Set component sampling factors */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ -#include /* to declare isdigit(), isspace() */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include /* to declare isdigit(), isspace() */ LOCAL(int) @@ -26,7 +26,7 @@ text_getc (FILE * file) /* A comment/newline sequence is returned as a newline */ { register int ch; - + ch = getc(file); if (ch == '#') { do { @@ -44,7 +44,7 @@ read_text_integer (FILE * file, long * result, int * termchar) { register int ch; register long val; - + /* Skip any leading whitespace, detect EOF */ do { ch = text_getc(file); @@ -53,7 +53,7 @@ read_text_integer (FILE * file, long * result, int * termchar) return FALSE; } } while (isspace(ch)); - + if (! isdigit(ch)) { *termchar = ch; return FALSE; @@ -108,15 +108,15 @@ read_quant_tables (j_compress_ptr cinfo, char * filename, boolean force_baseline table[0] = (unsigned int) val; for (i = 1; i < DCTSIZE2; i++) { if (! read_text_integer(fp, &val, &termchar)) { - fprintf(stderr, "Invalid table data in file %s\n", filename); - fclose(fp); - return FALSE; + fprintf(stderr, "Invalid table data in file %s\n", filename); + fclose(fp); + return FALSE; } table[i] = (unsigned int) val; } #if JPEG_LIB_VERSION >= 70 jpeg_add_quant_table(cinfo, tblno, table, cinfo->q_scale_factor[tblno], - force_baseline); + force_baseline); #else jpeg_add_quant_table(cinfo, tblno, table, q_scale_factor[tblno], force_baseline); @@ -150,7 +150,7 @@ read_scan_integer (FILE * file, long * result, int * termchar) ch = *termchar; while (ch != EOF && isspace(ch)) ch = text_getc(file); - if (isdigit(ch)) { /* oops, put it back */ + if (isdigit(ch)) { /* oops, put it back */ if (ungetc(ch, file) == EOF) return FALSE; ch = ' '; @@ -188,7 +188,7 @@ read_scan_script (j_compress_ptr cinfo, char * filename) int scanno, ncomps, termchar; long val; jpeg_scan_info * scanptr; -#define MAX_SCANS 100 /* quite arbitrary limit */ +#define MAX_SCANS 100 /* quite arbitrary limit */ jpeg_scan_info scans[MAX_SCANS]; if ((fp = fopen(filename, "r")) == NULL) { @@ -208,29 +208,29 @@ read_scan_script (j_compress_ptr cinfo, char * filename) ncomps = 1; while (termchar == ' ') { if (ncomps >= MAX_COMPS_IN_SCAN) { - fprintf(stderr, "Too many components in one scan in file %s\n", - filename); - fclose(fp); - return FALSE; + fprintf(stderr, "Too many components in one scan in file %s\n", + filename); + fclose(fp); + return FALSE; } if (! read_scan_integer(fp, &val, &termchar)) - goto bogus; + goto bogus; scanptr->component_index[ncomps] = (int) val; ncomps++; } scanptr->comps_in_scan = ncomps; if (termchar == ':') { if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; + goto bogus; scanptr->Ss = (int) val; if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; + goto bogus; scanptr->Se = (int) val; if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') - goto bogus; + goto bogus; scanptr->Ah = (int) val; if (! read_scan_integer(fp, &val, &termchar)) - goto bogus; + goto bogus; scanptr->Al = (int) val; } else { /* set non-progressive parameters */ @@ -261,7 +261,7 @@ bogus: */ scanptr = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - scanno * SIZEOF(jpeg_scan_info)); + scanno * SIZEOF(jpeg_scan_info)); MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info)); cinfo->scan_info = scanptr; cinfo->num_scans = scanno; @@ -305,9 +305,9 @@ LOCAL(void) jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) { jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, - q_scale_factor[0], force_baseline); + q_scale_factor[0], force_baseline); jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, - q_scale_factor[1], force_baseline); + q_scale_factor[1], force_baseline); } #endif @@ -319,17 +319,17 @@ set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline) * If there are more q-table slots than parameters, the last value is replicated. */ { - int val = 75; /* default value */ + int val = 75; /* default value */ int tblno; char ch; for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { if (*arg) { - ch = ','; /* if not set by sscanf, will be ',' */ + ch = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c", &val, &ch) < 1) - return FALSE; - if (ch != ',') /* syntax check */ - return FALSE; + return FALSE; + if (ch != ',') /* syntax check */ + return FALSE; /* Convert user 0-100 rating to percentage scaling */ #if JPEG_LIB_VERSION >= 70 cinfo->q_scale_factor[tblno] = jpeg_quality_scaling(val); @@ -337,7 +337,7 @@ set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline) q_scale_factor[tblno] = jpeg_quality_scaling(val); #endif while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + ; } else { /* reached end of parameter, set remaining factors to last value */ #if JPEG_LIB_VERSION >= 70 @@ -359,25 +359,25 @@ set_quant_slots (j_compress_ptr cinfo, char *arg) * If there are more components than parameters, the last value is replicated. */ { - int val = 0; /* default table # */ + int val = 0; /* default table # */ int ci; char ch; for (ci = 0; ci < MAX_COMPONENTS; ci++) { if (*arg) { - ch = ','; /* if not set by sscanf, will be ',' */ + ch = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c", &val, &ch) < 1) - return FALSE; - if (ch != ',') /* syntax check */ - return FALSE; + return FALSE; + if (ch != ',') /* syntax check */ + return FALSE; if (val < 0 || val >= NUM_QUANT_TBLS) { - fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n", - NUM_QUANT_TBLS-1); - return FALSE; + fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n", + NUM_QUANT_TBLS-1); + return FALSE; } cinfo->comp_info[ci].quant_tbl_no = val; while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + ; } else { /* reached end of parameter, set remaining components to last table */ cinfo->comp_info[ci].quant_tbl_no = val; @@ -399,19 +399,19 @@ set_sample_factors (j_compress_ptr cinfo, char *arg) for (ci = 0; ci < MAX_COMPONENTS; ci++) { if (*arg) { - ch2 = ','; /* if not set by sscanf, will be ',' */ + ch2 = ','; /* if not set by sscanf, will be ',' */ if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3) - return FALSE; + return FALSE; if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */ - return FALSE; + return FALSE; if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) { - fprintf(stderr, "JPEG sampling factors must be 1..4\n"); - return FALSE; + fprintf(stderr, "JPEG sampling factors must be 1..4\n"); + return FALSE; } cinfo->comp_info[ci].h_samp_factor = val1; cinfo->comp_info[ci].v_samp_factor = val2; while (*arg && *arg++ != ',') /* advance to next segment of arg string */ - ; + ; } else { /* reached end of parameter, set remaining components to 1x1 sampling */ cinfo->comp_info[ci].h_samp_factor = 1; diff --git a/rdtarga.c b/rdtarga.c index 0ad4642e..e8bbaf64 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -17,7 +17,7 @@ * Based on code contributed by Lee Daniel Crocker. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef TARGA_SUPPORTED @@ -26,19 +26,19 @@ #ifdef HAVE_UNSIGNED_CHAR typedef unsigned char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else /* !HAVE_UNSIGNED_CHAR */ #ifdef __CHAR_UNSIGNED__ typedef char U_CHAR; -#define UCH(x) ((int) (x)) +#define UCH(x) ((int) (x)) #else typedef char U_CHAR; -#define UCH(x) ((int) (x) & 0xFF) +#define UCH(x) ((int) (x) & 0xFF) #endif #endif /* HAVE_UNSIGNED_CHAR */ -#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) +#define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) /* Private version of data source object */ @@ -48,12 +48,12 @@ typedef struct _tga_source_struct * tga_source_ptr; typedef struct _tga_source_struct { struct cjpeg_source_struct pub; /* public fields */ - j_compress_ptr cinfo; /* back link saves passing separate parm */ + j_compress_ptr cinfo; /* back link saves passing separate parm */ - JSAMPARRAY colormap; /* Targa colormap (converted to my format) */ + JSAMPARRAY colormap; /* Targa colormap (converted to my format) */ - jvirt_sarray_ptr whole_image; /* Needed if funny input row order */ - JDIMENSION current_row; /* Current logical row number to read */ + jvirt_sarray_ptr whole_image; /* Needed if funny input row order */ + JDIMENSION current_row; /* Current logical row number to read */ /* Pointer to routine to extract next Targa pixel from input file */ JMETHOD(void, read_pixel, (tga_source_ptr sinfo)); @@ -61,15 +61,15 @@ typedef struct _tga_source_struct { /* Result of read_pixel is delivered here: */ U_CHAR tga_pixel[4]; - int pixel_size; /* Bytes per Targa pixel (1 to 4) */ + int pixel_size; /* Bytes per Targa pixel (1 to 4) */ /* State info for reading RLE-coded pixels; both counts must be init to 0 */ - int block_count; /* # of pixels remaining in RLE block */ - int dup_pixel_count; /* # of times to duplicate previous pixel */ + int block_count; /* # of pixels remaining in RLE block */ + int dup_pixel_count; /* # of times to duplicate previous pixel */ /* This saves the correct pixel-row-expansion method for preload_image */ JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + cjpeg_source_ptr sinfo)); } tga_source_struct; @@ -148,9 +148,9 @@ read_rle_pixel (tga_source_ptr sinfo) /* Time to read RLE block header? */ if (--sinfo->block_count < 0) { /* decrement pixels remaining in block */ i = read_byte(sinfo); - if (i & 0x80) { /* Start of duplicate-pixel block? */ + if (i & 0x80) { /* Start of duplicate-pixel block? */ sinfo->dup_pixel_count = i & 0x7F; /* number of dups after this one */ - sinfo->block_count = 0; /* then read new block header */ + sinfo->block_count = 0; /* then read new block header */ } else { sinfo->block_count = i & 0x7F; /* number of pixels after this one */ } @@ -338,8 +338,8 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) unsigned int width, height, maplen; boolean is_bottom_up; -#define GET_2B(offset) ((unsigned int) UCH(targaheader[offset]) + \ - (((unsigned int) UCH(targaheader[offset+1])) << 8)) +#define GET_2B(offset) ((unsigned int) UCH(targaheader[offset]) + \ + (((unsigned int) UCH(targaheader[offset+1])) << 8)) if (! ReadOK(source->pub.input_file, targaheader, 18)) ERREXIT(cinfo, JERR_INPUT_EOF); @@ -355,15 +355,15 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) width = GET_2B(12); height = GET_2B(14); source->pixel_size = UCH(targaheader[16]) >> 3; - flags = UCH(targaheader[17]); /* Image Descriptor byte */ + flags = UCH(targaheader[17]); /* Image Descriptor byte */ - is_bottom_up = ((flags & 0x20) == 0); /* bit 5 set => top-down */ - interlace_type = flags >> 6; /* bits 6/7 are interlace code */ + is_bottom_up = ((flags & 0x20) == 0); /* bit 5 set => top-down */ + interlace_type = flags >> 6; /* bits 6/7 are interlace code */ - if (cmaptype > 1 || /* cmaptype must be 0 or 1 */ + if (cmaptype > 1 || /* cmaptype must be 0 or 1 */ source->pixel_size < 1 || source->pixel_size > 4 || (UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */ - interlace_type != 0) /* currently don't allow interlaced image */ + interlace_type != 0) /* currently don't allow interlaced image */ ERREXIT(cinfo, JERR_TGA_BADPARMS); if (subtype > 8) { @@ -377,18 +377,18 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } /* Now should have subtype 1, 2, or 3 */ - components = 3; /* until proven different */ + components = 3; /* until proven different */ cinfo->in_color_space = JCS_RGB; switch (subtype) { - case 1: /* Colormapped image */ + case 1: /* Colormapped image */ if (source->pixel_size == 1 && cmaptype == 1) source->get_pixel_rows = get_8bit_row; else ERREXIT(cinfo, JERR_TGA_BADPARMS); TRACEMS2(cinfo, 1, JTRC_TGA_MAPPED, width, height); break; - case 2: /* RGB image */ + case 2: /* RGB image */ switch (source->pixel_size) { case 2: source->get_pixel_rows = get_16bit_row; @@ -405,7 +405,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) } TRACEMS2(cinfo, 1, JTRC_TGA, width, height); break; - case 3: /* Grayscale image */ + case 3: /* Grayscale image */ components = 1; cinfo->in_color_space = JCS_GRAYSCALE; if (source->pixel_size == 1) @@ -441,7 +441,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) source->pub.get_pixel_rows = source->get_pixel_rows; } - while (idlen--) /* Throw away ID field */ + while (idlen--) /* Throw away ID field */ (void) read_byte(source); if (maplen > 0) { @@ -453,7 +453,7 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* and read it from the file */ read_colormap(source, (int) maplen, UCH(targaheader[7])); } else { - if (cmaptype) /* but you promised a cmap! */ + if (cmaptype) /* but you promised a cmap! */ ERREXIT(cinfo, JERR_TGA_BADPARMS); source->colormap = NULL; } @@ -488,8 +488,8 @@ jinit_read_targa (j_compress_ptr cinfo) /* Create module interface object */ source = (tga_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_source_struct)); - source->cinfo = cinfo; /* make back link for subroutines */ + SIZEOF(tga_source_struct)); + source->cinfo = cinfo; /* make back link for subroutines */ /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_tga; source->pub.finish_input = finish_input_tga; diff --git a/simd/jcclrmmx.asm b/simd/jcclrmmx.asm index e0952531..f34104f3 100644 --- a/simd/jcclrmmx.asm +++ b/simd/jcclrmmx.asm @@ -28,450 +28,450 @@ ; JDIMENSION output_row, int num_rows); ; -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 8 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_rgb_ycc_convert_mmx) + align 16 + global EXTN(jsimd_rgb_ycc_convert_mmx) EXTN(jsimd_rgb_ycc_convert_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [img_width(eax)] ; num_cols - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [img_width(eax)] ; num_cols + test ecx,ecx + jz near .return - push ecx + push ecx - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - pushpic eax - push edx - push ebx - push edi - push esi - push ecx ; col + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - mov ebx, JSAMPROW [ebx] ; outptr1 - mov edx, JSAMPROW [edx] ; outptr2 - movpic eax, POINTER [gotptr] ; load GOT address (eax) + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) - cmp ecx, byte SIZEOF_MMWORD - jae short .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_MMWORD + jae short .columnloop + alignx 16,7 %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - xor eax,eax - mov al, BYTE [esi+ecx] + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + xor eax,eax + mov al, BYTE [esi+ecx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - xor edx,edx - mov dx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + xor edx,edx + mov dx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx .column_ld4: - movd mmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd mmG, DWORD [esi+ecx] - psllq mmA, DWORD_BIT - por mmA,mmG + movd mmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd mmG, DWORD [esi+ecx] + psllq mmA, DWORD_BIT + por mmA,mmG .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - movq mmG,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - mov ecx, SIZEOF_MMWORD - jmp short .rgb_ycc_cnv + test cl, SIZEOF_MMWORD + jz short .column_ld16 + movq mmG,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + mov ecx, SIZEOF_MMWORD + jmp short .rgb_ycc_cnv .column_ld16: - test cl, 2*SIZEOF_MMWORD - mov ecx, SIZEOF_MMWORD - jz short .rgb_ycc_cnv - movq mmF,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 + test cl, 2*SIZEOF_MMWORD + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmF,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 .columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] .rgb_ycc_cnv: - ; mmA=(00 10 20 01 11 21 02 12) - ; mmG=(22 03 13 23 04 14 24 05) - ; mmF=(15 25 06 16 26 07 17 27) + ; mmA=(00 10 20 01 11 21 02 12) + ; mmG=(22 03 13 23 04 14 24 05) + ; mmF=(15 25 06 16 26 07 17 27) - movq mmD,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) - psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) + movq mmD,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) + psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) - punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) - psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) + punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) + psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) - punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) - punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) + punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) + punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) - movq mmE,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) - psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) + movq mmE,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) + psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) - punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) + punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) - punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) - punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) + punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) + punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) - pxor mmH,mmH + pxor mmH,mmH - movq mmC,mmA - punpcklbw mmA,mmH ; mmA=(00 02 04 06) - punpckhbw mmC,mmH ; mmC=(10 12 14 16) + movq mmC,mmA + punpcklbw mmA,mmH ; mmA=(00 02 04 06) + punpckhbw mmC,mmH ; mmC=(10 12 14 16) - movq mmB,mmE - punpcklbw mmE,mmH ; mmE=(20 22 24 26) - punpckhbw mmB,mmH ; mmB=(01 03 05 07) + movq mmB,mmE + punpcklbw mmE,mmH ; mmE=(20 22 24 26) + punpckhbw mmB,mmH ; mmB=(01 03 05 07) - movq mmF,mmD - punpcklbw mmD,mmH ; mmD=(11 13 15 17) - punpckhbw mmF,mmH ; mmF=(21 23 25 27) + movq mmF,mmD + punpcklbw mmD,mmH ; mmD=(11 13 15 17) + punpckhbw mmF,mmH ; mmF=(21 23 25 27) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_MMWORD/8 - jz short .column_ld2 - sub ecx, byte SIZEOF_MMWORD/8 - movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_MMWORD/8 + jz short .column_ld2 + sub ecx, byte SIZEOF_MMWORD/8 + movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_MMWORD/4 - jz short .column_ld4 - sub ecx, byte SIZEOF_MMWORD/4 - movq mmF,mmA - movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_MMWORD/4 + jz short .column_ld4 + sub ecx, byte SIZEOF_MMWORD/4 + movq mmF,mmA + movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] .column_ld4: - test cl, SIZEOF_MMWORD/2 - mov ecx, SIZEOF_MMWORD - jz short .rgb_ycc_cnv - movq mmD,mmA - movq mmC,mmF - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 + test cl, SIZEOF_MMWORD/2 + mov ecx, SIZEOF_MMWORD + jz short .rgb_ycc_cnv + movq mmD,mmA + movq mmC,mmF + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 .columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] - movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] .rgb_ycc_cnv: - ; mmA=(00 10 20 30 01 11 21 31) - ; mmF=(02 12 22 32 03 13 23 33) - ; mmD=(04 14 24 34 05 15 25 35) - ; mmC=(06 16 26 36 07 17 27 37) + ; mmA=(00 10 20 30 01 11 21 31) + ; mmF=(02 12 22 32 03 13 23 33) + ; mmD=(04 14 24 34 05 15 25 35) + ; mmC=(06 16 26 36 07 17 27 37) - movq mmB,mmA - punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) - punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) + movq mmB,mmA + punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) + punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) - movq mmG,mmD - punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) - punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) + movq mmG,mmD + punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) + punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) - movq mmE,mmA - punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) + movq mmE,mmA + punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) - movq mmH,mmB - punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) - punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) + movq mmH,mmB + punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) + punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) - pxor mmF,mmF + pxor mmF,mmF - movq mmC,mmA - punpcklbw mmA,mmF ; mmA=(00 02 04 06) - punpckhbw mmC,mmF ; mmC=(10 12 14 16) + movq mmC,mmA + punpcklbw mmA,mmF ; mmA=(00 02 04 06) + punpckhbw mmC,mmF ; mmC=(10 12 14 16) - movq mmD,mmB - punpcklbw mmB,mmF ; mmB=(01 03 05 07) - punpckhbw mmD,mmF ; mmD=(11 13 15 17) + movq mmD,mmB + punpcklbw mmB,mmF ; mmB=(01 03 05 07) + punpckhbw mmD,mmF ; mmD=(11 13 15 17) - movq mmG,mmE - punpcklbw mmE,mmF ; mmE=(20 22 24 26) - punpckhbw mmG,mmF ; mmG=(30 32 34 36) + movq mmG,mmE + punpcklbw mmE,mmF ; mmE=(20 22 24 26) + punpckhbw mmG,mmF ; mmG=(30 32 34 36) - punpcklbw mmF,mmH - punpckhbw mmH,mmH - psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) - psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) + punpcklbw mmF,mmH + punpckhbw mmH,mmH + psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) + psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) %endif ; RGB_PIXELSIZE ; --------------- - ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE - ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO + ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE + ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - movq MMWORD [wk(0)], mm0 ; wk(0)=RE - movq MMWORD [wk(1)], mm1 ; wk(1)=RO - movq MMWORD [wk(2)], mm4 ; wk(2)=BE - movq MMWORD [wk(3)], mm5 ; wk(3)=BO + movq MMWORD [wk(0)], mm0 ; wk(0)=RE + movq MMWORD [wk(1)], mm1 ; wk(1)=RO + movq MMWORD [wk(2)], mm4 ; wk(2)=BE + movq MMWORD [wk(3)], mm5 ; wk(3)=BO - movq mm6,mm1 - punpcklwd mm1,mm3 - punpckhwd mm6,mm3 - movq mm7,mm1 - movq mm4,mm6 - pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd mm7,[GOTOFF(eax,PW_MF016_MF033)] ; mm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + movq mm6,mm1 + punpcklwd mm1,mm3 + punpckhwd mm6,mm3 + movq mm7,mm1 + movq mm4,mm6 + pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd mm7,[GOTOFF(eax,PW_MF016_MF033)] ; mm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - movq MMWORD [wk(4)], mm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movq MMWORD [wk(5)], mm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + movq MMWORD [wk(4)], mm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movq MMWORD [wk(5)], mm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - pxor mm1,mm1 - pxor mm6,mm6 - punpcklwd mm1,mm5 ; mm1=BOL - punpckhwd mm6,mm5 ; mm6=BOH - psrld mm1,1 ; mm1=BOL*FIX(0.500) - psrld mm6,1 ; mm6=BOH*FIX(0.500) + pxor mm1,mm1 + pxor mm6,mm6 + punpcklwd mm1,mm5 ; mm1=BOL + punpckhwd mm6,mm5 ; mm6=BOH + psrld mm1,1 ; mm1=BOL*FIX(0.500) + psrld mm6,1 ; mm6=BOH*FIX(0.500) - movq mm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm5=[PD_ONEHALFM1_CJ] + movq mm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm5=[PD_ONEHALFM1_CJ] - paddd mm7,mm1 - paddd mm4,mm6 - paddd mm7,mm5 - paddd mm4,mm5 - psrld mm7,SCALEBITS ; mm7=CbOL - psrld mm4,SCALEBITS ; mm4=CbOH - packssdw mm7,mm4 ; mm7=CbO + paddd mm7,mm1 + paddd mm4,mm6 + paddd mm7,mm5 + paddd mm4,mm5 + psrld mm7,SCALEBITS ; mm7=CbOL + psrld mm4,SCALEBITS ; mm4=CbOH + packssdw mm7,mm4 ; mm7=CbO - movq mm1, MMWORD [wk(2)] ; mm1=BE + movq mm1, MMWORD [wk(2)] ; mm1=BE - movq mm6,mm0 - punpcklwd mm0,mm2 - punpckhwd mm6,mm2 - movq mm5,mm0 - movq mm4,mm6 - pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd mm5,[GOTOFF(eax,PW_MF016_MF033)] ; mm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + movq mm6,mm0 + punpcklwd mm0,mm2 + punpckhwd mm6,mm2 + movq mm5,mm0 + movq mm4,mm6 + pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd mm5,[GOTOFF(eax,PW_MF016_MF033)] ; mm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd mm4,[GOTOFF(eax,PW_MF016_MF033)] ; mm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - movq MMWORD [wk(6)], mm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movq MMWORD [wk(7)], mm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + movq MMWORD [wk(6)], mm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movq MMWORD [wk(7)], mm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - pxor mm0,mm0 - pxor mm6,mm6 - punpcklwd mm0,mm1 ; mm0=BEL - punpckhwd mm6,mm1 ; mm6=BEH - psrld mm0,1 ; mm0=BEL*FIX(0.500) - psrld mm6,1 ; mm6=BEH*FIX(0.500) + pxor mm0,mm0 + pxor mm6,mm6 + punpcklwd mm0,mm1 ; mm0=BEL + punpckhwd mm6,mm1 ; mm6=BEH + psrld mm0,1 ; mm0=BEL*FIX(0.500) + psrld mm6,1 ; mm6=BEH*FIX(0.500) - movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] - paddd mm5,mm0 - paddd mm4,mm6 - paddd mm5,mm1 - paddd mm4,mm1 - psrld mm5,SCALEBITS ; mm5=CbEL - psrld mm4,SCALEBITS ; mm4=CbEH - packssdw mm5,mm4 ; mm5=CbE + paddd mm5,mm0 + paddd mm4,mm6 + paddd mm5,mm1 + paddd mm4,mm1 + psrld mm5,SCALEBITS ; mm5=CbEL + psrld mm4,SCALEBITS ; mm4=CbEH + packssdw mm5,mm4 ; mm5=CbE - psllw mm7,BYTE_BIT - por mm5,mm7 ; mm5=Cb - movq MMWORD [ebx], mm5 ; Save Cb + psllw mm7,BYTE_BIT + por mm5,mm7 ; mm5=Cb + movq MMWORD [ebx], mm5 ; Save Cb - movq mm0, MMWORD [wk(3)] ; mm0=BO - movq mm6, MMWORD [wk(2)] ; mm6=BE - movq mm1, MMWORD [wk(1)] ; mm1=RO + movq mm0, MMWORD [wk(3)] ; mm0=BO + movq mm6, MMWORD [wk(2)] ; mm6=BE + movq mm1, MMWORD [wk(1)] ; mm1=RO - movq mm4,mm0 - punpcklwd mm0,mm3 - punpckhwd mm4,mm3 - movq mm7,mm0 - movq mm5,mm4 - pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd mm7,[GOTOFF(eax,PW_MF008_MF041)] ; mm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + movq mm4,mm0 + punpcklwd mm0,mm3 + punpckhwd mm4,mm3 + movq mm7,mm0 + movq mm5,mm4 + pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd mm7,[GOTOFF(eax,PW_MF008_MF041)] ; mm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] + movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] - paddd mm0, MMWORD [wk(4)] - paddd mm4, MMWORD [wk(5)] - paddd mm0,mm3 - paddd mm4,mm3 - psrld mm0,SCALEBITS ; mm0=YOL - psrld mm4,SCALEBITS ; mm4=YOH - packssdw mm0,mm4 ; mm0=YO + paddd mm0, MMWORD [wk(4)] + paddd mm4, MMWORD [wk(5)] + paddd mm0,mm3 + paddd mm4,mm3 + psrld mm0,SCALEBITS ; mm0=YOL + psrld mm4,SCALEBITS ; mm4=YOH + packssdw mm0,mm4 ; mm0=YO - pxor mm3,mm3 - pxor mm4,mm4 - punpcklwd mm3,mm1 ; mm3=ROL - punpckhwd mm4,mm1 ; mm4=ROH - psrld mm3,1 ; mm3=ROL*FIX(0.500) - psrld mm4,1 ; mm4=ROH*FIX(0.500) + pxor mm3,mm3 + pxor mm4,mm4 + punpcklwd mm3,mm1 ; mm3=ROL + punpckhwd mm4,mm1 ; mm4=ROH + psrld mm3,1 ; mm3=ROL*FIX(0.500) + psrld mm4,1 ; mm4=ROH*FIX(0.500) - movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] + movq mm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm1=[PD_ONEHALFM1_CJ] - paddd mm7,mm3 - paddd mm5,mm4 - paddd mm7,mm1 - paddd mm5,mm1 - psrld mm7,SCALEBITS ; mm7=CrOL - psrld mm5,SCALEBITS ; mm5=CrOH - packssdw mm7,mm5 ; mm7=CrO + paddd mm7,mm3 + paddd mm5,mm4 + paddd mm7,mm1 + paddd mm5,mm1 + psrld mm7,SCALEBITS ; mm7=CrOL + psrld mm5,SCALEBITS ; mm5=CrOH + packssdw mm7,mm5 ; mm7=CrO - movq mm3, MMWORD [wk(0)] ; mm3=RE + movq mm3, MMWORD [wk(0)] ; mm3=RE - movq mm4,mm6 - punpcklwd mm6,mm2 - punpckhwd mm4,mm2 - movq mm1,mm6 - movq mm5,mm4 - pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd mm1,[GOTOFF(eax,PW_MF008_MF041)] ; mm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + movq mm4,mm6 + punpcklwd mm6,mm2 + punpckhwd mm4,mm2 + movq mm1,mm6 + movq mm5,mm4 + pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd mm1,[GOTOFF(eax,PW_MF008_MF041)] ; mm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd mm5,[GOTOFF(eax,PW_MF008_MF041)] ; mm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] + movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] - paddd mm6, MMWORD [wk(6)] - paddd mm4, MMWORD [wk(7)] - paddd mm6,mm2 - paddd mm4,mm2 - psrld mm6,SCALEBITS ; mm6=YEL - psrld mm4,SCALEBITS ; mm4=YEH - packssdw mm6,mm4 ; mm6=YE + paddd mm6, MMWORD [wk(6)] + paddd mm4, MMWORD [wk(7)] + paddd mm6,mm2 + paddd mm4,mm2 + psrld mm6,SCALEBITS ; mm6=YEL + psrld mm4,SCALEBITS ; mm4=YEH + packssdw mm6,mm4 ; mm6=YE - psllw mm0,BYTE_BIT - por mm6,mm0 ; mm6=Y - movq MMWORD [edi], mm6 ; Save Y + psllw mm0,BYTE_BIT + por mm6,mm0 ; mm6=Y + movq MMWORD [edi], mm6 ; Save Y - pxor mm2,mm2 - pxor mm4,mm4 - punpcklwd mm2,mm3 ; mm2=REL - punpckhwd mm4,mm3 ; mm4=REH - psrld mm2,1 ; mm2=REL*FIX(0.500) - psrld mm4,1 ; mm4=REH*FIX(0.500) + pxor mm2,mm2 + pxor mm4,mm4 + punpcklwd mm2,mm3 ; mm2=REL + punpckhwd mm4,mm3 ; mm4=REH + psrld mm2,1 ; mm2=REL*FIX(0.500) + psrld mm4,1 ; mm4=REH*FIX(0.500) - movq mm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm0=[PD_ONEHALFM1_CJ] + movq mm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; mm0=[PD_ONEHALFM1_CJ] - paddd mm1,mm2 - paddd mm5,mm4 - paddd mm1,mm0 - paddd mm5,mm0 - psrld mm1,SCALEBITS ; mm1=CrEL - psrld mm5,SCALEBITS ; mm5=CrEH - packssdw mm1,mm5 ; mm1=CrE + paddd mm1,mm2 + paddd mm5,mm4 + paddd mm1,mm0 + paddd mm5,mm0 + psrld mm1,SCALEBITS ; mm1=CrEL + psrld mm5,SCALEBITS ; mm5=CrEH + packssdw mm1,mm5 ; mm1=CrE - psllw mm7,BYTE_BIT - por mm1,mm7 ; mm1=Cr - movq MMWORD [edx], mm1 ; Save Cr + psllw mm7,BYTE_BIT + por mm1,mm7 ; mm1=Cr + movq MMWORD [edx], mm1 ; Save Cr - sub ecx, byte SIZEOF_MMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr - add edi, byte SIZEOF_MMWORD ; outptr0 - add ebx, byte SIZEOF_MMWORD ; outptr1 - add edx, byte SIZEOF_MMWORD ; outptr2 - cmp ecx, byte SIZEOF_MMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 + sub ecx, byte SIZEOF_MMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr + add edi, byte SIZEOF_MMWORD ; outptr0 + add ebx, byte SIZEOF_MMWORD ; outptr1 + add edx, byte SIZEOF_MMWORD ; outptr2 + cmp ecx, byte SIZEOF_MMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 - pop ecx ; col - pop esi - pop edi - pop ebx - pop edx - poppic eax + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm index f5d6bed9..1cdae27f 100644 --- a/simd/jcclrss2-64.asm +++ b/simd/jcclrss2-64.asm @@ -32,454 +32,454 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 8 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 - align 16 + align 16 - global EXTN(jsimd_rgb_ycc_convert_sse2) + global EXTN(jsimd_rgb_ycc_convert_sse2) EXTN(jsimd_rgb_ycc_convert_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + push rbx - mov rcx, r10 - test rcx,rcx - jz near .return + mov rcx, r10 + test rcx,rcx + jz near .return - push rcx + push rcx - mov rsi, r12 - mov rcx, r13 - mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] - mov rbx, JSAMPARRAY [rsi+1*SIZEOF_JSAMPARRAY] - mov rdx, JSAMPARRAY [rsi+2*SIZEOF_JSAMPARRAY] - lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] - lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] - lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] + mov rsi, r12 + mov rcx, r13 + mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rsi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rsi+2*SIZEOF_JSAMPARRAY] + lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] + lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] + lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] - pop rcx + pop rcx - mov rsi, r11 - mov eax, r14d - test rax,rax - jle near .return + mov rsi, r11 + mov eax, r14d + test rax,rax + jle near .return .rowloop: - push rdx - push rbx - push rdi - push rsi - push rcx ; col + push rdx + push rbx + push rdi + push rsi + push rcx ; col - mov rsi, JSAMPROW [rsi] ; inptr - mov rdi, JSAMPROW [rdi] ; outptr0 - mov rbx, JSAMPROW [rbx] ; outptr1 - mov rdx, JSAMPROW [rdx] ; outptr2 + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr0 + mov rbx, JSAMPROW [rbx] ; outptr1 + mov rdx, JSAMPROW [rdx] ; outptr2 - cmp rcx, byte SIZEOF_XMMWORD - jae near .columnloop + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push rax - push rdx - lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub rcx, byte SIZEOF_BYTE - movzx rax, BYTE [rsi+rcx] + push rax + push rdx + lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub rcx, byte SIZEOF_BYTE + movzx rax, BYTE [rsi+rcx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub rcx, byte SIZEOF_WORD - movzx rdx, WORD [rsi+rcx] - shl rax, WORD_BIT - or rax,rdx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub rcx, byte SIZEOF_WORD + movzx rdx, WORD [rsi+rcx] + shl rax, WORD_BIT + or rax,rdx .column_ld4: - movd xmmA,eax - pop rdx - pop rax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub rcx, byte SIZEOF_DWORD - movd xmmF, XMM_DWORD [rsi+rcx] - pslldq xmmA, SIZEOF_DWORD - por xmmA,xmmF + movd xmmA,eax + pop rdx + pop rax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub rcx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [rsi+rcx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - sub rcx, byte SIZEOF_MMWORD - movq xmmB, XMM_MMWORD [rsi+rcx] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmB + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub rcx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [rsi+rcx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB .column_ld16: - test cl, SIZEOF_XMMWORD - jz short .column_ld32 - movdqa xmmF,xmmA - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - mov rcx, SIZEOF_XMMWORD - jmp short .rgb_ycc_cnv + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + mov rcx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv .column_ld32: - test cl, 2*SIZEOF_XMMWORD - mov rcx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmB,xmmA - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv + test cl, 2*SIZEOF_XMMWORD + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv .columnloop: - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] .rgb_ycc_cnv: - ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - movdqa xmmG,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) - psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) - pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) - punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) - punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) - movdqa xmmD,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) - psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) - pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) - punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) - punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) - movdqa xmmE,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) - psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) - punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) - pxor xmmH,xmmH + pxor xmmH,xmmH - movdqa xmmC,xmmA - punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmB,xmmE - punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) - movdqa xmmF,xmmD - punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) - punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_XMMWORD/16 - jz short .column_ld2 - sub rcx, byte SIZEOF_XMMWORD/16 - movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub rcx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_XMMWORD/8 - jz short .column_ld4 - sub rcx, byte SIZEOF_XMMWORD/8 - movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmE + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub rcx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE .column_ld4: - test cl, SIZEOF_XMMWORD/4 - jz short .column_ld8 - sub rcx, byte SIZEOF_XMMWORD/4 - movdqa xmmE,xmmA - movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub rcx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld8: - test cl, SIZEOF_XMMWORD/2 - mov rcx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmF,xmmA - movdqa xmmH,xmmE - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv + test cl, SIZEOF_XMMWORD/2 + mov rcx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv .columnloop: - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] - movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] .rgb_ycc_cnv: - ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) - punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) - movdqa xmmC,xmmF - punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) - punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) - movdqa xmmB,xmmA - punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) - punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) - movdqa xmmG,xmmD - punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) - punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) - movdqa xmmE,xmmA - punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) - movdqa xmmH,xmmB - punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) - punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) - pxor xmmF,xmmF + pxor xmmF,xmmF - movdqa xmmC,xmmA - punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmD,xmmB - punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) - movdqa xmmG,xmmE - punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) - punpcklbw xmmF,xmmH - punpckhbw xmmH,xmmH - psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) - psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) %endif ; RGB_PIXELSIZE ; --------------- - ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE - ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE - movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO - movdqa xmm6,xmm1 - punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 - movdqa xmm7,xmm1 - movdqa xmm4,xmm6 - pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd xmm7,[rel PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + movdqa xmm7,xmm1 + movdqa xmm4,xmm6 + pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[rel PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - pxor xmm1,xmm1 - pxor xmm6,xmm6 - punpcklwd xmm1,xmm5 ; xmm1=BOL - punpckhwd xmm6,xmm5 ; xmm6=BOH - psrld xmm1,1 ; xmm1=BOL*FIX(0.500) - psrld xmm6,1 ; xmm6=BOH*FIX(0.500) + pxor xmm1,xmm1 + pxor xmm6,xmm6 + punpcklwd xmm1,xmm5 ; xmm1=BOL + punpckhwd xmm6,xmm5 ; xmm6=BOH + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm6,1 ; xmm6=BOH*FIX(0.500) - movdqa xmm5,[rel PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] + movdqa xmm5,[rel PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm1 - paddd xmm4,xmm6 - paddd xmm7,xmm5 - paddd xmm4,xmm5 - psrld xmm7,SCALEBITS ; xmm7=CbOL - psrld xmm4,SCALEBITS ; xmm4=CbOH - packssdw xmm7,xmm4 ; xmm7=CbO + paddd xmm7,xmm1 + paddd xmm4,xmm6 + paddd xmm7,xmm5 + paddd xmm4,xmm5 + psrld xmm7,SCALEBITS ; xmm7=CbOL + psrld xmm4,SCALEBITS ; xmm4=CbOH + packssdw xmm7,xmm4 ; xmm7=CbO - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE - movdqa xmm6,xmm0 - punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 - movdqa xmm5,xmm0 - movdqa xmm4,xmm6 - pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd xmm5,[rel PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + movdqa xmm5,xmm0 + movdqa xmm4,xmm6 + pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[rel PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - pxor xmm0,xmm0 - pxor xmm6,xmm6 - punpcklwd xmm0,xmm1 ; xmm0=BEL - punpckhwd xmm6,xmm1 ; xmm6=BEH - psrld xmm0,1 ; xmm0=BEL*FIX(0.500) - psrld xmm6,1 ; xmm6=BEH*FIX(0.500) + pxor xmm0,xmm0 + pxor xmm6,xmm6 + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] - paddd xmm5,xmm0 - paddd xmm4,xmm6 - paddd xmm5,xmm1 - paddd xmm4,xmm1 - psrld xmm5,SCALEBITS ; xmm5=CbEL - psrld xmm4,SCALEBITS ; xmm4=CbEH - packssdw xmm5,xmm4 ; xmm5=CbE + paddd xmm5,xmm0 + paddd xmm4,xmm6 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrld xmm5,SCALEBITS ; xmm5=CbEL + psrld xmm4,SCALEBITS ; xmm4=CbEH + packssdw xmm5,xmm4 ; xmm5=CbE - psllw xmm7,BYTE_BIT - por xmm5,xmm7 ; xmm5=Cb - movdqa XMMWORD [rbx], xmm5 ; Save Cb + psllw xmm7,BYTE_BIT + por xmm5,xmm7 ; xmm5=Cb + movdqa XMMWORD [rbx], xmm5 ; Save Cb - movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - movdqa xmm7,xmm0 - movdqa xmm5,xmm4 - pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd xmm7,[rel PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + movdqa xmm7,xmm0 + movdqa xmm5,xmm4 + pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[rel PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] + movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm0, XMMWORD [wk(4)] - paddd xmm4, XMMWORD [wk(5)] - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO - pxor xmm3,xmm3 - pxor xmm4,xmm4 - punpcklwd xmm3,xmm1 ; xmm3=ROL - punpckhwd xmm4,xmm1 ; xmm4=ROH - psrld xmm3,1 ; xmm3=ROL*FIX(0.500) - psrld xmm4,1 ; xmm4=ROH*FIX(0.500) + pxor xmm3,xmm3 + pxor xmm4,xmm4 + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH + psrld xmm3,1 ; xmm3=ROL*FIX(0.500) + psrld xmm4,1 ; xmm4=ROH*FIX(0.500) - movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm3 - paddd xmm5,xmm4 - paddd xmm7,xmm1 - paddd xmm5,xmm1 - psrld xmm7,SCALEBITS ; xmm7=CrOL - psrld xmm5,SCALEBITS ; xmm5=CrOH - packssdw xmm7,xmm5 ; xmm7=CrO + paddd xmm7,xmm3 + paddd xmm5,xmm4 + paddd xmm7,xmm1 + paddd xmm5,xmm1 + psrld xmm7,SCALEBITS ; xmm7=CrOL + psrld xmm5,SCALEBITS ; xmm5=CrOH + packssdw xmm7,xmm5 ; xmm7=CrO - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - movdqa xmm1,xmm6 - movdqa xmm5,xmm4 - pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd xmm1,[rel PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[rel PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] + movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(6)] - paddd xmm4, XMMWORD [wk(7)] - paddd xmm6,xmm2 - paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [rdi], xmm6 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [rdi], xmm6 ; Save Y - pxor xmm2,xmm2 - pxor xmm4,xmm4 - punpcklwd xmm2,xmm3 ; xmm2=REL - punpckhwd xmm4,xmm3 ; xmm4=REH - psrld xmm2,1 ; xmm2=REL*FIX(0.500) - psrld xmm4,1 ; xmm4=REH*FIX(0.500) + pxor xmm2,xmm2 + pxor xmm4,xmm4 + punpcklwd xmm2,xmm3 ; xmm2=REL + punpckhwd xmm4,xmm3 ; xmm4=REH + psrld xmm2,1 ; xmm2=REL*FIX(0.500) + psrld xmm4,1 ; xmm4=REH*FIX(0.500) - movdqa xmm0,[rel PD_ONEHALFM1_CJ] ; xmm0=[PD_ONEHALFM1_CJ] + movdqa xmm0,[rel PD_ONEHALFM1_CJ] ; xmm0=[PD_ONEHALFM1_CJ] - paddd xmm1,xmm2 - paddd xmm5,xmm4 - paddd xmm1,xmm0 - paddd xmm5,xmm0 - psrld xmm1,SCALEBITS ; xmm1=CrEL - psrld xmm5,SCALEBITS ; xmm5=CrEH - packssdw xmm1,xmm5 ; xmm1=CrE + paddd xmm1,xmm2 + paddd xmm5,xmm4 + paddd xmm1,xmm0 + paddd xmm5,xmm0 + psrld xmm1,SCALEBITS ; xmm1=CrEL + psrld xmm5,SCALEBITS ; xmm5=CrEH + packssdw xmm1,xmm5 ; xmm1=CrE - psllw xmm7,BYTE_BIT - por xmm1,xmm7 ; xmm1=Cr - movdqa XMMWORD [rdx], xmm1 ; Save Cr + psllw xmm7,BYTE_BIT + por xmm1,xmm7 ; xmm1=Cr + movdqa XMMWORD [rdx], xmm1 ; Save Cr - sub rcx, byte SIZEOF_XMMWORD - add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr - add rdi, byte SIZEOF_XMMWORD ; outptr0 - add rbx, byte SIZEOF_XMMWORD ; outptr1 - add rdx, byte SIZEOF_XMMWORD ; outptr2 - cmp rcx, byte SIZEOF_XMMWORD - jae near .columnloop - test rcx,rcx - jnz near .column_ld1 + sub rcx, byte SIZEOF_XMMWORD + add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add rdi, byte SIZEOF_XMMWORD ; outptr0 + add rbx, byte SIZEOF_XMMWORD ; outptr1 + add rdx, byte SIZEOF_XMMWORD ; outptr2 + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx,rcx + jnz near .column_ld1 - pop rcx ; col - pop rsi - pop rdi - pop rbx - pop rdx + pop rcx ; col + pop rsi + pop rdi + pop rbx + pop rdx - add rsi, byte SIZEOF_JSAMPROW ; input_buf - add rdi, byte SIZEOF_JSAMPROW - add rbx, byte SIZEOF_JSAMPROW - add rdx, byte SIZEOF_JSAMPROW - dec rax ; num_rows - jg near .rowloop + add rsi, byte SIZEOF_JSAMPROW ; input_buf + add rdi, byte SIZEOF_JSAMPROW + add rbx, byte SIZEOF_JSAMPROW + add rdx, byte SIZEOF_JSAMPROW + dec rax ; num_rows + jg near .rowloop .return: - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcclrss2.asm b/simd/jcclrss2.asm index 517b7056..220d016f 100644 --- a/simd/jcclrss2.asm +++ b/simd/jcclrss2.asm @@ -25,479 +25,479 @@ ; JDIMENSION output_row, int num_rows); ; -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 8 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 + align 16 - global EXTN(jsimd_rgb_ycc_convert_sse2) + global EXTN(jsimd_rgb_ycc_convert_sse2) EXTN(jsimd_rgb_ycc_convert_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [img_width(eax)] - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [img_width(eax)] + test ecx,ecx + jz near .return - push ecx + push ecx - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [esi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [esi+2*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - pushpic eax - push edx - push ebx - push edi - push esi - push ecx ; col + pushpic eax + push edx + push ebx + push edi + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - mov ebx, JSAMPROW [ebx] ; outptr1 - mov edx, JSAMPROW [edx] ; outptr2 - movpic eax, POINTER [gotptr] ; load GOT address (eax) + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + mov ebx, JSAMPROW [ebx] ; outptr1 + mov edx, JSAMPROW [edx] ; outptr2 + movpic eax, POINTER [gotptr] ; load GOT address (eax) - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + alignx 16,7 %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - movzx eax, BYTE [esi+ecx] + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + movzx eax, BYTE [esi+ecx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - movzx edx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + movzx edx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx .column_ld4: - movd xmmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd xmmF, XMM_DWORD [esi+ecx] - pslldq xmmA, SIZEOF_DWORD - por xmmA,xmmF + movd xmmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [esi+ecx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - sub ecx, byte SIZEOF_MMWORD - movq xmmB, XMM_MMWORD [esi+ecx] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmB + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub ecx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [esi+ecx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB .column_ld16: - test cl, SIZEOF_XMMWORD - jz short .column_ld32 - movdqa xmmF,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - mov ecx, SIZEOF_XMMWORD - jmp short .rgb_ycc_cnv + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + mov ecx, SIZEOF_XMMWORD + jmp short .rgb_ycc_cnv .column_ld32: - test cl, 2*SIZEOF_XMMWORD - mov ecx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmB,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 + test cl, 2*SIZEOF_XMMWORD + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 .columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] .rgb_ycc_cnv: - ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - movdqa xmmG,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) - psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) - pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) - punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) - punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) - movdqa xmmD,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) - psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) - pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) - punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) - punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) - movdqa xmmE,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) - psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) - punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) - pxor xmmH,xmmH + pxor xmmH,xmmH - movdqa xmmC,xmmA - punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmB,xmmE - punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) - movdqa xmmF,xmmD - punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) - punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_XMMWORD/16 - jz short .column_ld2 - sub ecx, byte SIZEOF_XMMWORD/16 - movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub ecx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_XMMWORD/8 - jz short .column_ld4 - sub ecx, byte SIZEOF_XMMWORD/8 - movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmE + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub ecx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE .column_ld4: - test cl, SIZEOF_XMMWORD/4 - jz short .column_ld8 - sub ecx, byte SIZEOF_XMMWORD/4 - movdqa xmmE,xmmA - movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub ecx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] .column_ld8: - test cl, SIZEOF_XMMWORD/2 - mov ecx, SIZEOF_XMMWORD - jz short .rgb_ycc_cnv - movdqa xmmF,xmmA - movdqa xmmH,xmmE - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_ycc_cnv - alignx 16,7 + test cl, SIZEOF_XMMWORD/2 + mov ecx, SIZEOF_XMMWORD + jz short .rgb_ycc_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_ycc_cnv + alignx 16,7 .columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] - movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] .rgb_ycc_cnv: - ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) - punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) - movdqa xmmC,xmmF - punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) - punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) - movdqa xmmB,xmmA - punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) - punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) - movdqa xmmG,xmmD - punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) - punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) - movdqa xmmE,xmmA - punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) - movdqa xmmH,xmmB - punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) - punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) - pxor xmmF,xmmF + pxor xmmF,xmmF - movdqa xmmC,xmmA - punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmD,xmmB - punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) - movdqa xmmG,xmmE - punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) - punpcklbw xmmF,xmmH - punpckhbw xmmH,xmmH - psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) - psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) %endif ; RGB_PIXELSIZE ; --------------- - ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE - ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE - ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE - movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO - movdqa xmm6,xmm1 - punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 - movdqa xmm7,xmm1 - movdqa xmm4,xmm6 - pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - pmaddwd xmm7,[GOTOFF(eax,PW_MF016_MF033)] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) - pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + movdqa xmm7,xmm1 + movdqa xmm4,xmm6 + pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm7,[GOTOFF(eax,PW_MF016_MF033)] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - pxor xmm1,xmm1 - pxor xmm6,xmm6 - punpcklwd xmm1,xmm5 ; xmm1=BOL - punpckhwd xmm6,xmm5 ; xmm6=BOH - psrld xmm1,1 ; xmm1=BOL*FIX(0.500) - psrld xmm6,1 ; xmm6=BOH*FIX(0.500) + pxor xmm1,xmm1 + pxor xmm6,xmm6 + punpcklwd xmm1,xmm5 ; xmm1=BOL + punpckhwd xmm6,xmm5 ; xmm6=BOH + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm6,1 ; xmm6=BOH*FIX(0.500) - movdqa xmm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm5=[PD_ONEHALFM1_CJ] + movdqa xmm5,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm5=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm1 - paddd xmm4,xmm6 - paddd xmm7,xmm5 - paddd xmm4,xmm5 - psrld xmm7,SCALEBITS ; xmm7=CbOL - psrld xmm4,SCALEBITS ; xmm4=CbOH - packssdw xmm7,xmm4 ; xmm7=CbO + paddd xmm7,xmm1 + paddd xmm4,xmm6 + paddd xmm7,xmm5 + paddd xmm4,xmm5 + psrld xmm7,SCALEBITS ; xmm7=CbOL + psrld xmm4,SCALEBITS ; xmm4=CbOH + packssdw xmm7,xmm4 ; xmm7=CbO - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE - movdqa xmm6,xmm0 - punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 - movdqa xmm5,xmm0 - movdqa xmm4,xmm6 - pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - pmaddwd xmm5,[GOTOFF(eax,PW_MF016_MF033)] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) - pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + movdqa xmm5,xmm0 + movdqa xmm4,xmm6 + pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm5,[GOTOFF(eax,PW_MF016_MF033)] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) + pmaddwd xmm4,[GOTOFF(eax,PW_MF016_MF033)] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - pxor xmm0,xmm0 - pxor xmm6,xmm6 - punpcklwd xmm0,xmm1 ; xmm0=BEL - punpckhwd xmm6,xmm1 ; xmm6=BEH - psrld xmm0,1 ; xmm0=BEL*FIX(0.500) - psrld xmm6,1 ; xmm6=BEH*FIX(0.500) + pxor xmm0,xmm0 + pxor xmm6,xmm6 + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] - paddd xmm5,xmm0 - paddd xmm4,xmm6 - paddd xmm5,xmm1 - paddd xmm4,xmm1 - psrld xmm5,SCALEBITS ; xmm5=CbEL - psrld xmm4,SCALEBITS ; xmm4=CbEH - packssdw xmm5,xmm4 ; xmm5=CbE + paddd xmm5,xmm0 + paddd xmm4,xmm6 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrld xmm5,SCALEBITS ; xmm5=CbEL + psrld xmm4,SCALEBITS ; xmm4=CbEH + packssdw xmm5,xmm4 ; xmm5=CbE - psllw xmm7,BYTE_BIT - por xmm5,xmm7 ; xmm5=Cb - movdqa XMMWORD [ebx], xmm5 ; Save Cb + psllw xmm7,BYTE_BIT + por xmm5,xmm7 ; xmm5=Cb + movdqa XMMWORD [ebx], xmm5 ; Save Cb - movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - movdqa xmm7,xmm0 - movdqa xmm5,xmm4 - pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - pmaddwd xmm7,[GOTOFF(eax,PW_MF008_MF041)] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) - pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + movdqa xmm7,xmm0 + movdqa xmm5,xmm4 + pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + pmaddwd xmm7,[GOTOFF(eax,PW_MF008_MF041)] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) - movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] + movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] - paddd xmm0, XMMWORD [wk(4)] - paddd xmm4, XMMWORD [wk(5)] - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO - pxor xmm3,xmm3 - pxor xmm4,xmm4 - punpcklwd xmm3,xmm1 ; xmm3=ROL - punpckhwd xmm4,xmm1 ; xmm4=ROH - psrld xmm3,1 ; xmm3=ROL*FIX(0.500) - psrld xmm4,1 ; xmm4=ROH*FIX(0.500) + pxor xmm3,xmm3 + pxor xmm4,xmm4 + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH + psrld xmm3,1 ; xmm3=ROL*FIX(0.500) + psrld xmm4,1 ; xmm4=ROH*FIX(0.500) - movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm1,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm1=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm3 - paddd xmm5,xmm4 - paddd xmm7,xmm1 - paddd xmm5,xmm1 - psrld xmm7,SCALEBITS ; xmm7=CrOL - psrld xmm5,SCALEBITS ; xmm5=CrOH - packssdw xmm7,xmm5 ; xmm7=CrO + paddd xmm7,xmm3 + paddd xmm5,xmm4 + paddd xmm7,xmm1 + paddd xmm5,xmm1 + psrld xmm7,SCALEBITS ; xmm7=CrOL + psrld xmm5,SCALEBITS ; xmm5=CrOH + packssdw xmm7,xmm5 ; xmm7=CrO - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - movdqa xmm1,xmm6 - movdqa xmm5,xmm4 - pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - pmaddwd xmm1,[GOTOFF(eax,PW_MF008_MF041)] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) - pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + pmaddwd xmm1,[GOTOFF(eax,PW_MF008_MF041)] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) + pmaddwd xmm5,[GOTOFF(eax,PW_MF008_MF041)] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) - movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] + movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(6)] - paddd xmm4, XMMWORD [wk(7)] - paddd xmm6,xmm2 - paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [edi], xmm6 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [edi], xmm6 ; Save Y - pxor xmm2,xmm2 - pxor xmm4,xmm4 - punpcklwd xmm2,xmm3 ; xmm2=REL - punpckhwd xmm4,xmm3 ; xmm4=REH - psrld xmm2,1 ; xmm2=REL*FIX(0.500) - psrld xmm4,1 ; xmm4=REH*FIX(0.500) + pxor xmm2,xmm2 + pxor xmm4,xmm4 + punpcklwd xmm2,xmm3 ; xmm2=REL + punpckhwd xmm4,xmm3 ; xmm4=REH + psrld xmm2,1 ; xmm2=REL*FIX(0.500) + psrld xmm4,1 ; xmm4=REH*FIX(0.500) - movdqa xmm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm0=[PD_ONEHALFM1_CJ] + movdqa xmm0,[GOTOFF(eax,PD_ONEHALFM1_CJ)] ; xmm0=[PD_ONEHALFM1_CJ] - paddd xmm1,xmm2 - paddd xmm5,xmm4 - paddd xmm1,xmm0 - paddd xmm5,xmm0 - psrld xmm1,SCALEBITS ; xmm1=CrEL - psrld xmm5,SCALEBITS ; xmm5=CrEH - packssdw xmm1,xmm5 ; xmm1=CrE + paddd xmm1,xmm2 + paddd xmm5,xmm4 + paddd xmm1,xmm0 + paddd xmm5,xmm0 + psrld xmm1,SCALEBITS ; xmm1=CrEL + psrld xmm5,SCALEBITS ; xmm5=CrEH + packssdw xmm1,xmm5 ; xmm1=CrE - psllw xmm7,BYTE_BIT - por xmm1,xmm7 ; xmm1=Cr - movdqa XMMWORD [edx], xmm1 ; Save Cr + psllw xmm7,BYTE_BIT + por xmm1,xmm7 ; xmm1=Cr + movdqa XMMWORD [edx], xmm1 ; Save Cr - sub ecx, byte SIZEOF_XMMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr - add edi, byte SIZEOF_XMMWORD ; outptr0 - add ebx, byte SIZEOF_XMMWORD ; outptr1 - add edx, byte SIZEOF_XMMWORD ; outptr2 - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 + sub ecx, byte SIZEOF_XMMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add edi, byte SIZEOF_XMMWORD ; outptr0 + add ebx, byte SIZEOF_XMMWORD ; outptr1 + add edx, byte SIZEOF_XMMWORD ; outptr2 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 - pop ecx ; col - pop esi - pop edi - pop ebx - pop edx - poppic eax + pop ecx ; col + pop esi + pop edi + pop ebx + pop edx + poppic eax - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm index 9650e47d..87058ee1 100644 --- a/simd/jccolmmx.asm +++ b/simd/jccolmmx.asm @@ -21,38 +21,38 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_081 equ 5329 ; FIX(0.08131) -F_0_114 equ 7471 ; FIX(0.11400) -F_0_168 equ 11059 ; FIX(0.16874) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_331 equ 21709 ; FIX(0.33126) -F_0_418 equ 27439 ; FIX(0.41869) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_ycc_convert_mmx) + alignz 16 + global EXTN(jconst_rgb_ycc_convert_mmx) EXTN(jconst_rgb_ycc_convert_mmx): -PW_F0299_F0337 times 2 dw F_0_299, F_0_337 -PW_F0114_F0250 times 2 dw F_0_114, F_0_250 -PW_MF016_MF033 times 2 dw -F_0_168,-F_0_331 -PW_MF008_MF041 times 2 dw -F_0_081,-F_0_418 -PD_ONEHALFM1_CJ times 2 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) -PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 2 dw F_0_299, F_0_337 +PW_F0114_F0250 times 2 dw F_0_114, F_0_250 +PW_MF016_MF033 times 2 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 2 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 2 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jcclrmmx.asm" diff --git a/simd/jccolss2-64.asm b/simd/jccolss2-64.asm index ae601488..5b1ee78a 100644 --- a/simd/jccolss2-64.asm +++ b/simd/jccolss2-64.asm @@ -18,38 +18,38 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_081 equ 5329 ; FIX(0.08131) -F_0_114 equ 7471 ; FIX(0.11400) -F_0_168 equ 11059 ; FIX(0.16874) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_331 equ 21709 ; FIX(0.33126) -F_0_418 equ 27439 ; FIX(0.41869) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_ycc_convert_sse2) + alignz 16 + global EXTN(jconst_rgb_ycc_convert_sse2) EXTN(jconst_rgb_ycc_convert_sse2): -PW_F0299_F0337 times 4 dw F_0_299, F_0_337 -PW_F0114_F0250 times 4 dw F_0_114, F_0_250 -PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 -PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 -PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) -PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 %include "jcclrss2-64.asm" diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm index ac001d18..2b8faef7 100644 --- a/simd/jccolss2.asm +++ b/simd/jccolss2.asm @@ -18,38 +18,38 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_081 equ 5329 ; FIX(0.08131) -F_0_114 equ 7471 ; FIX(0.11400) -F_0_168 equ 11059 ; FIX(0.16874) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_331 equ 21709 ; FIX(0.33126) -F_0_418 equ 27439 ; FIX(0.41869) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_081 equ 5329 ; FIX(0.08131) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_168 equ 11059 ; FIX(0.16874) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_331 equ 21709 ; FIX(0.33126) +F_0_418 equ 27439 ; FIX(0.41869) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_ycc_convert_sse2) + alignz 16 + global EXTN(jconst_rgb_ycc_convert_sse2) EXTN(jconst_rgb_ycc_convert_sse2): -PW_F0299_F0337 times 4 dw F_0_299, F_0_337 -PW_F0114_F0250 times 4 dw F_0_114, F_0_250 -PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 -PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 -PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) -PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PW_MF016_MF033 times 4 dw -F_0_168,-F_0_331 +PW_MF008_MF041 times 4 dw -F_0_081,-F_0_418 +PD_ONEHALFM1_CJ times 4 dd (1 << (SCALEBITS-1)) - 1 + (CENTERJSAMPLE << SCALEBITS) +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jcclrss2.asm" diff --git a/simd/jcgrammx.asm b/simd/jcgrammx.asm index b8b8dd3a..43ffd0f3 100644 --- a/simd/jcgrammx.asm +++ b/simd/jcgrammx.asm @@ -21,31 +21,31 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_114 equ 7471 ; FIX(0.11400) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_gray_convert_mmx) + alignz 16 + global EXTN(jconst_rgb_gray_convert_mmx) EXTN(jconst_rgb_gray_convert_mmx): -PW_F0299_F0337 times 2 dw F_0_299, F_0_337 -PW_F0114_F0250 times 2 dw F_0_114, F_0_250 -PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 2 dw F_0_299, F_0_337 +PW_F0114_F0250 times 2 dw F_0_114, F_0_250 +PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jcgrymmx.asm" diff --git a/simd/jcgrass2-64.asm b/simd/jcgrass2-64.asm index ba28cc31..39236ffd 100644 --- a/simd/jcgrass2-64.asm +++ b/simd/jcgrass2-64.asm @@ -18,31 +18,31 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_114 equ 7471 ; FIX(0.11400) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_gray_convert_sse2) + alignz 16 + global EXTN(jconst_rgb_gray_convert_sse2) EXTN(jconst_rgb_gray_convert_sse2): -PW_F0299_F0337 times 4 dw F_0_299, F_0_337 -PW_F0114_F0250 times 4 dw F_0_114, F_0_250 -PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 %include "jcgryss2-64.asm" diff --git a/simd/jcgrass2.asm b/simd/jcgrass2.asm index 998968e7..f5bd93dd 100644 --- a/simd/jcgrass2.asm +++ b/simd/jcgrass2.asm @@ -18,31 +18,31 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_114 equ 7471 ; FIX(0.11400) -F_0_250 equ 16384 ; FIX(0.25000) -F_0_299 equ 19595 ; FIX(0.29900) -F_0_587 equ 38470 ; FIX(0.58700) -F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) +F_0_114 equ 7471 ; FIX(0.11400) +F_0_250 equ 16384 ; FIX(0.25000) +F_0_299 equ 19595 ; FIX(0.29900) +F_0_587 equ 38470 ; FIX(0.58700) +F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_rgb_gray_convert_sse2) + alignz 16 + global EXTN(jconst_rgb_gray_convert_sse2) EXTN(jconst_rgb_gray_convert_sse2): -PW_F0299_F0337 times 4 dw F_0_299, F_0_337 -PW_F0114_F0250 times 4 dw F_0_114, F_0_250 -PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) +PW_F0299_F0337 times 4 dw F_0_299, F_0_337 +PW_F0114_F0250 times 4 dw F_0_114, F_0_250 +PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jcgryss2.asm" diff --git a/simd/jcgrymmx.asm b/simd/jcgrymmx.asm index bbeea09b..cbe56222 100644 --- a/simd/jcgrymmx.asm +++ b/simd/jcgrymmx.asm @@ -29,329 +29,329 @@ ; JDIMENSION output_row, int num_rows); ; -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_rgb_gray_convert_mmx) + align 16 + global EXTN(jsimd_rgb_gray_convert_mmx) EXTN(jsimd_rgb_gray_convert_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [img_width(eax)] ; num_cols - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [img_width(eax)] ; num_cols + test ecx,ecx + jz near .return - push ecx + push ecx - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - pushpic eax - push edi - push esi - push ecx ; col + pushpic eax + push edi + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - movpic eax, POINTER [gotptr] ; load GOT address (eax) + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + movpic eax, POINTER [gotptr] ; load GOT address (eax) - cmp ecx, byte SIZEOF_MMWORD - jae short .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_MMWORD + jae short .columnloop + alignx 16,7 %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - xor eax,eax - mov al, BYTE [esi+ecx] + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + xor eax,eax + mov al, BYTE [esi+ecx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - xor edx,edx - mov dx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + xor edx,edx + mov dx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx .column_ld4: - movd mmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd mmG, DWORD [esi+ecx] - psllq mmA, DWORD_BIT - por mmA,mmG + movd mmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd mmG, DWORD [esi+ecx] + psllq mmA, DWORD_BIT + por mmA,mmG .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - movq mmG,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - mov ecx, SIZEOF_MMWORD - jmp short .rgb_gray_cnv + test cl, SIZEOF_MMWORD + jz short .column_ld16 + movq mmG,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + mov ecx, SIZEOF_MMWORD + jmp short .rgb_gray_cnv .column_ld16: - test cl, 2*SIZEOF_MMWORD - mov ecx, SIZEOF_MMWORD - jz short .rgb_gray_cnv - movq mmF,mmA - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_gray_cnv - alignx 16,7 + test cl, 2*SIZEOF_MMWORD + mov ecx, SIZEOF_MMWORD + jz short .rgb_gray_cnv + movq mmF,mmA + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_gray_cnv + alignx 16,7 .columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmG, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+2*SIZEOF_MMWORD] .rgb_gray_cnv: - ; mmA=(00 10 20 01 11 21 02 12) - ; mmG=(22 03 13 23 04 14 24 05) - ; mmF=(15 25 06 16 26 07 17 27) + ; mmA=(00 10 20 01 11 21 02 12) + ; mmG=(22 03 13 23 04 14 24 05) + ; mmF=(15 25 06 16 26 07 17 27) - movq mmD,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) - psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) + movq mmD,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01) + psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --) - punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) - psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) + punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05) + psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23) - punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) - punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) + punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16) + punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27) - movq mmE,mmA - psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) - psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) + movq mmE,mmA + psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14) + psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --) - punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) + punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25) - punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) - punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) + punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07) + punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27) - pxor mmH,mmH + pxor mmH,mmH - movq mmC,mmA - punpcklbw mmA,mmH ; mmA=(00 02 04 06) - punpckhbw mmC,mmH ; mmC=(10 12 14 16) + movq mmC,mmA + punpcklbw mmA,mmH ; mmA=(00 02 04 06) + punpckhbw mmC,mmH ; mmC=(10 12 14 16) - movq mmB,mmE - punpcklbw mmE,mmH ; mmE=(20 22 24 26) - punpckhbw mmB,mmH ; mmB=(01 03 05 07) + movq mmB,mmE + punpcklbw mmE,mmH ; mmE=(20 22 24 26) + punpckhbw mmB,mmH ; mmB=(01 03 05 07) - movq mmF,mmD - punpcklbw mmD,mmH ; mmD=(11 13 15 17) - punpckhbw mmF,mmH ; mmF=(21 23 25 27) + movq mmF,mmD + punpcklbw mmD,mmH ; mmD=(11 13 15 17) + punpckhbw mmF,mmH ; mmF=(21 23 25 27) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_MMWORD/8 - jz short .column_ld2 - sub ecx, byte SIZEOF_MMWORD/8 - movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_MMWORD/8 + jz short .column_ld2 + sub ecx, byte SIZEOF_MMWORD/8 + movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_MMWORD/4 - jz short .column_ld4 - sub ecx, byte SIZEOF_MMWORD/4 - movq mmF,mmA - movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_MMWORD/4 + jz short .column_ld4 + sub ecx, byte SIZEOF_MMWORD/4 + movq mmF,mmA + movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE] .column_ld4: - test cl, SIZEOF_MMWORD/2 - mov ecx, SIZEOF_MMWORD - jz short .rgb_gray_cnv - movq mmD,mmA - movq mmC,mmF - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - jmp short .rgb_gray_cnv - alignx 16,7 + test cl, SIZEOF_MMWORD/2 + mov ecx, SIZEOF_MMWORD + jz short .rgb_gray_cnv + movq mmD,mmA + movq mmC,mmF + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + jmp short .rgb_gray_cnv + alignx 16,7 .columnloop: - movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] - movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] - movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] - movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] + movq mmA, MMWORD [esi+0*SIZEOF_MMWORD] + movq mmF, MMWORD [esi+1*SIZEOF_MMWORD] + movq mmD, MMWORD [esi+2*SIZEOF_MMWORD] + movq mmC, MMWORD [esi+3*SIZEOF_MMWORD] .rgb_gray_cnv: - ; mmA=(00 10 20 30 01 11 21 31) - ; mmF=(02 12 22 32 03 13 23 33) - ; mmD=(04 14 24 34 05 15 25 35) - ; mmC=(06 16 26 36 07 17 27 37) + ; mmA=(00 10 20 30 01 11 21 31) + ; mmF=(02 12 22 32 03 13 23 33) + ; mmD=(04 14 24 34 05 15 25 35) + ; mmC=(06 16 26 36 07 17 27 37) - movq mmB,mmA - punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) - punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) + movq mmB,mmA + punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32) + punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33) - movq mmG,mmD - punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) - punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) + movq mmG,mmD + punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36) + punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37) - movq mmE,mmA - punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) - punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) + movq mmE,mmA + punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16) + punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36) - movq mmH,mmB - punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) - punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) + movq mmH,mmB + punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17) + punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37) - pxor mmF,mmF + pxor mmF,mmF - movq mmC,mmA - punpcklbw mmA,mmF ; mmA=(00 02 04 06) - punpckhbw mmC,mmF ; mmC=(10 12 14 16) + movq mmC,mmA + punpcklbw mmA,mmF ; mmA=(00 02 04 06) + punpckhbw mmC,mmF ; mmC=(10 12 14 16) - movq mmD,mmB - punpcklbw mmB,mmF ; mmB=(01 03 05 07) - punpckhbw mmD,mmF ; mmD=(11 13 15 17) + movq mmD,mmB + punpcklbw mmB,mmF ; mmB=(01 03 05 07) + punpckhbw mmD,mmF ; mmD=(11 13 15 17) - movq mmG,mmE - punpcklbw mmE,mmF ; mmE=(20 22 24 26) - punpckhbw mmG,mmF ; mmG=(30 32 34 36) + movq mmG,mmE + punpcklbw mmE,mmF ; mmE=(20 22 24 26) + punpckhbw mmG,mmF ; mmG=(30 32 34 36) - punpcklbw mmF,mmH - punpckhbw mmH,mmH - psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) - psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) + punpcklbw mmF,mmH + punpckhbw mmH,mmH + psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27) + psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37) %endif ; RGB_PIXELSIZE ; --------------- - ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE - ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO + ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE + ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - movq mm6,mm1 - punpcklwd mm1,mm3 - punpckhwd mm6,mm3 - pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) + movq mm6,mm1 + punpcklwd mm1,mm3 + punpckhwd mm6,mm3 + pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337) - movq mm7, mm6 ; mm7=ROH*FIX(0.299)+GOH*FIX(0.337) + movq mm7, mm6 ; mm7=ROH*FIX(0.299)+GOH*FIX(0.337) - movq mm6,mm0 - punpcklwd mm0,mm2 - punpckhwd mm6,mm2 - pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) + movq mm6,mm0 + punpcklwd mm0,mm2 + punpckhwd mm6,mm2 + pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337) - movq MMWORD [wk(0)], mm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) - movq MMWORD [wk(1)], mm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) + movq MMWORD [wk(0)], mm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) + movq MMWORD [wk(1)], mm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) - movq mm0, mm5 ; mm0=BO - movq mm6, mm4 ; mm6=BE + movq mm0, mm5 ; mm0=BO + movq mm6, mm4 ; mm6=BE - movq mm4,mm0 - punpcklwd mm0,mm3 - punpckhwd mm4,mm3 - pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) + movq mm4,mm0 + punpcklwd mm0,mm3 + punpckhwd mm4,mm3 + pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250) - movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] + movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF] - paddd mm0, mm1 - paddd mm4, mm7 - paddd mm0,mm3 - paddd mm4,mm3 - psrld mm0,SCALEBITS ; mm0=YOL - psrld mm4,SCALEBITS ; mm4=YOH - packssdw mm0,mm4 ; mm0=YO + paddd mm0, mm1 + paddd mm4, mm7 + paddd mm0,mm3 + paddd mm4,mm3 + psrld mm0,SCALEBITS ; mm0=YOL + psrld mm4,SCALEBITS ; mm4=YOH + packssdw mm0,mm4 ; mm0=YO - movq mm4,mm6 - punpcklwd mm6,mm2 - punpckhwd mm4,mm2 - pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) + movq mm4,mm6 + punpcklwd mm6,mm2 + punpckhwd mm4,mm2 + pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250) - movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] + movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF] - paddd mm6, MMWORD [wk(0)] - paddd mm4, MMWORD [wk(1)] - paddd mm6,mm2 - paddd mm4,mm2 - psrld mm6,SCALEBITS ; mm6=YEL - psrld mm4,SCALEBITS ; mm4=YEH - packssdw mm6,mm4 ; mm6=YE + paddd mm6, MMWORD [wk(0)] + paddd mm4, MMWORD [wk(1)] + paddd mm6,mm2 + paddd mm4,mm2 + psrld mm6,SCALEBITS ; mm6=YEL + psrld mm4,SCALEBITS ; mm4=YEH + packssdw mm6,mm4 ; mm6=YE - psllw mm0,BYTE_BIT - por mm6,mm0 ; mm6=Y - movq MMWORD [edi], mm6 ; Save Y + psllw mm0,BYTE_BIT + por mm6,mm0 ; mm6=Y + movq MMWORD [edi], mm6 ; Save Y - sub ecx, byte SIZEOF_MMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr - add edi, byte SIZEOF_MMWORD ; outptr0 - cmp ecx, byte SIZEOF_MMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 + sub ecx, byte SIZEOF_MMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr + add edi, byte SIZEOF_MMWORD ; outptr0 + cmp ecx, byte SIZEOF_MMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 - pop ecx ; col - pop esi - pop edi - poppic eax + pop ecx ; col + pop esi + pop edi + poppic eax - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcgryss2-64.asm b/simd/jcgryss2-64.asm index 23ae8afb..2308129e 100644 --- a/simd/jcgryss2-64.asm +++ b/simd/jcgryss2-64.asm @@ -32,333 +32,333 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 + align 16 - global EXTN(jsimd_rgb_gray_convert_sse2) + global EXTN(jsimd_rgb_gray_convert_sse2) EXTN(jsimd_rgb_gray_convert_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + push rbx - mov rcx, r10 - test rcx,rcx - jz near .return + mov rcx, r10 + test rcx,rcx + jz near .return - push rcx + push rcx - mov rsi, r12 - mov rcx, r13 - mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] - lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] + mov rsi, r12 + mov rcx, r13 + mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY] + lea rdi, [rdi+rcx*SIZEOF_JSAMPROW] - pop rcx + pop rcx - mov rsi, r11 - mov eax, r14d - test rax,rax - jle near .return + mov rsi, r11 + mov eax, r14d + test rax,rax + jle near .return .rowloop: - push rdi - push rsi - push rcx ; col + push rdi + push rsi + push rcx ; col - mov rsi, JSAMPROW [rsi] ; inptr - mov rdi, JSAMPROW [rdi] ; outptr0 + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr0 - cmp rcx, byte SIZEOF_XMMWORD - jae near .columnloop + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push rax - push rdx - lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub rcx, byte SIZEOF_BYTE - movzx rax, BYTE [rsi+rcx] + push rax + push rdx + lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub rcx, byte SIZEOF_BYTE + movzx rax, BYTE [rsi+rcx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub rcx, byte SIZEOF_WORD - movzx rdx, WORD [rsi+rcx] - shl rax, WORD_BIT - or rax,rdx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub rcx, byte SIZEOF_WORD + movzx rdx, WORD [rsi+rcx] + shl rax, WORD_BIT + or rax,rdx .column_ld4: - movd xmmA,eax - pop rdx - pop rax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub rcx, byte SIZEOF_DWORD - movd xmmF, XMM_DWORD [rsi+rcx] - pslldq xmmA, SIZEOF_DWORD - por xmmA,xmmF + movd xmmA,eax + pop rdx + pop rax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub rcx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [rsi+rcx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - sub rcx, byte SIZEOF_MMWORD - movq xmmB, XMM_MMWORD [rsi+rcx] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmB + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub rcx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [rsi+rcx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB .column_ld16: - test cl, SIZEOF_XMMWORD - jz short .column_ld32 - movdqa xmmF,xmmA - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - mov rcx, SIZEOF_XMMWORD - jmp short .rgb_gray_cnv + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + mov rcx, SIZEOF_XMMWORD + jmp short .rgb_gray_cnv .column_ld32: - test cl, 2*SIZEOF_XMMWORD - mov rcx, SIZEOF_XMMWORD - jz short .rgb_gray_cnv - movdqa xmmB,xmmA - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] - jmp short .rgb_gray_cnv + test cl, 2*SIZEOF_XMMWORD + mov rcx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv .columnloop: - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD] .rgb_gray_cnv: - ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - movdqa xmmG,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) - psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) - pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) - punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) - punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) - movdqa xmmD,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) - psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) - pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) - punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) - punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) - movdqa xmmE,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) - psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) - punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) - pxor xmmH,xmmH + pxor xmmH,xmmH - movdqa xmmC,xmmA - punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmB,xmmE - punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) - movdqa xmmF,xmmD - punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) - punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_XMMWORD/16 - jz short .column_ld2 - sub rcx, byte SIZEOF_XMMWORD/16 - movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub rcx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_XMMWORD/8 - jz short .column_ld4 - sub rcx, byte SIZEOF_XMMWORD/8 - movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmE + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub rcx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE .column_ld4: - test cl, SIZEOF_XMMWORD/4 - jz short .column_ld8 - sub rcx, byte SIZEOF_XMMWORD/4 - movdqa xmmE,xmmA - movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub rcx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE] .column_ld8: - test cl, SIZEOF_XMMWORD/2 - mov rcx, SIZEOF_XMMWORD - jz short .rgb_gray_cnv - movdqa xmmF,xmmA - movdqa xmmH,xmmE - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] - jmp short .rgb_gray_cnv + test cl, SIZEOF_XMMWORD/2 + mov rcx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv .columnloop: - movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] - movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD] .rgb_gray_cnv: - ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) - punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) - movdqa xmmC,xmmF - punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) - punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) - movdqa xmmB,xmmA - punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) - punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) - movdqa xmmG,xmmD - punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) - punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) - movdqa xmmE,xmmA - punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) - movdqa xmmH,xmmB - punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) - punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) - pxor xmmF,xmmF + pxor xmmF,xmmF - movdqa xmmC,xmmA - punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmD,xmmB - punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) - movdqa xmmG,xmmE - punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) - punpcklbw xmmF,xmmH - punpckhbw xmmH,xmmH - psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) - psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) %endif ; RGB_PIXELSIZE ; --------------- - ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE - ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - movdqa xmm6,xmm1 - punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 - pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm6,xmm0 - punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 - pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa xmm0, xmm5 ; xmm0=BO - movdqa xmm6, xmm4 ; xmm6=BE + movdqa xmm0, xmm5 ; xmm0=BO + movdqa xmm6, xmm4 ; xmm6=BE - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] + movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm0, xmm1 - paddd xmm4, xmm7 - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + paddd xmm0, xmm1 + paddd xmm4, xmm7 + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] + movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(0)] - paddd xmm4, XMMWORD [wk(1)] - paddd xmm6,xmm2 - paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + paddd xmm6, XMMWORD [wk(0)] + paddd xmm4, XMMWORD [wk(1)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [rdi], xmm6 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [rdi], xmm6 ; Save Y - sub rcx, byte SIZEOF_XMMWORD - add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr - add rdi, byte SIZEOF_XMMWORD ; outptr0 - cmp rcx, byte SIZEOF_XMMWORD - jae near .columnloop - test rcx,rcx - jnz near .column_ld1 + sub rcx, byte SIZEOF_XMMWORD + add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add rdi, byte SIZEOF_XMMWORD ; outptr0 + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx,rcx + jnz near .column_ld1 - pop rcx ; col - pop rsi - pop rdi + pop rcx ; col + pop rsi + pop rdi - add rsi, byte SIZEOF_JSAMPROW ; input_buf - add rdi, byte SIZEOF_JSAMPROW - dec rax ; num_rows - jg near .rowloop + add rsi, byte SIZEOF_JSAMPROW ; input_buf + add rdi, byte SIZEOF_JSAMPROW + dec rax ; num_rows + jg near .rowloop .return: - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcgryss2.asm b/simd/jcgryss2.asm index c2942879..b5125c1b 100644 --- a/simd/jcgryss2.asm +++ b/simd/jcgryss2.asm @@ -26,358 +26,358 @@ ; JDIMENSION output_row, int num_rows); ; -%define img_width(b) (b)+8 ; JDIMENSION img_width -%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf -%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf -%define output_row(b) (b)+20 ; JDIMENSION output_row -%define num_rows(b) (b)+24 ; int num_rows +%define img_width(b) (b)+8 ; JDIMENSION img_width +%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf +%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf +%define output_row(b) (b)+20 ; JDIMENSION output_row +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 + align 16 - global EXTN(jsimd_rgb_gray_convert_sse2) + global EXTN(jsimd_rgb_gray_convert_sse2) EXTN(jsimd_rgb_gray_convert_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [img_width(eax)] - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [img_width(eax)] + test ecx,ecx + jz near .return - push ecx + push ecx - mov esi, JSAMPIMAGE [output_buf(eax)] - mov ecx, JDIMENSION [output_row(eax)] - mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] - lea edi, [edi+ecx*SIZEOF_JSAMPROW] + mov esi, JSAMPIMAGE [output_buf(eax)] + mov ecx, JDIMENSION [output_row(eax)] + mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] + lea edi, [edi+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov esi, JSAMPARRAY [input_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov esi, JSAMPARRAY [input_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - pushpic eax - push edi - push esi - push ecx ; col + pushpic eax + push edi + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr0 - movpic eax, POINTER [gotptr] ; load GOT address (eax) + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr0 + movpic eax, POINTER [gotptr] ; load GOT address (eax) - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + alignx 16,7 %if RGB_PIXELSIZE == 3 ; --------------- .column_ld1: - push eax - push edx - lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE - test cl, SIZEOF_BYTE - jz short .column_ld2 - sub ecx, byte SIZEOF_BYTE - movzx eax, BYTE [esi+ecx] + push eax + push edx + lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE + test cl, SIZEOF_BYTE + jz short .column_ld2 + sub ecx, byte SIZEOF_BYTE + movzx eax, BYTE [esi+ecx] .column_ld2: - test cl, SIZEOF_WORD - jz short .column_ld4 - sub ecx, byte SIZEOF_WORD - movzx edx, WORD [esi+ecx] - shl eax, WORD_BIT - or eax,edx + test cl, SIZEOF_WORD + jz short .column_ld4 + sub ecx, byte SIZEOF_WORD + movzx edx, WORD [esi+ecx] + shl eax, WORD_BIT + or eax,edx .column_ld4: - movd xmmA,eax - pop edx - pop eax - test cl, SIZEOF_DWORD - jz short .column_ld8 - sub ecx, byte SIZEOF_DWORD - movd xmmF, XMM_DWORD [esi+ecx] - pslldq xmmA, SIZEOF_DWORD - por xmmA,xmmF + movd xmmA,eax + pop edx + pop eax + test cl, SIZEOF_DWORD + jz short .column_ld8 + sub ecx, byte SIZEOF_DWORD + movd xmmF, XMM_DWORD [esi+ecx] + pslldq xmmA, SIZEOF_DWORD + por xmmA,xmmF .column_ld8: - test cl, SIZEOF_MMWORD - jz short .column_ld16 - sub ecx, byte SIZEOF_MMWORD - movq xmmB, XMM_MMWORD [esi+ecx] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmB + test cl, SIZEOF_MMWORD + jz short .column_ld16 + sub ecx, byte SIZEOF_MMWORD + movq xmmB, XMM_MMWORD [esi+ecx] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmB .column_ld16: - test cl, SIZEOF_XMMWORD - jz short .column_ld32 - movdqa xmmF,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - mov ecx, SIZEOF_XMMWORD - jmp short .rgb_gray_cnv + test cl, SIZEOF_XMMWORD + jz short .column_ld32 + movdqa xmmF,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + mov ecx, SIZEOF_XMMWORD + jmp short .rgb_gray_cnv .column_ld32: - test cl, 2*SIZEOF_XMMWORD - mov ecx, SIZEOF_XMMWORD - jz short .rgb_gray_cnv - movdqa xmmB,xmmA - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_gray_cnv - alignx 16,7 + test cl, 2*SIZEOF_XMMWORD + mov ecx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmB,xmmA + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv + alignx 16,7 .columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD] .rgb_gray_cnv: - ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - movdqa xmmG,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) - psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) + movdqa xmmG,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12) + psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) - pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) + punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A) + pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27) - punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) - punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) + punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D) + punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F) - movdqa xmmD,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) - psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) + movdqa xmmD,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09) + psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) - pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) + punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D) + pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B) - punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) - punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) + punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E) + punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F) - movdqa xmmE,xmmA - pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) - psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) + movdqa xmmE,xmmA + pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C) + psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --) - punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) + punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D) - punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) + punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F) - pxor xmmH,xmmH + pxor xmmH,xmmH - movdqa xmmC,xmmA - punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmB,xmmE - punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) + movdqa xmmB,xmmE + punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F) - movdqa xmmF,xmmD - punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) - punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) + movdqa xmmF,xmmD + punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F) + punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F) %else ; RGB_PIXELSIZE == 4 ; ----------- .column_ld1: - test cl, SIZEOF_XMMWORD/16 - jz short .column_ld2 - sub ecx, byte SIZEOF_XMMWORD/16 - movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/16 + jz short .column_ld2 + sub ecx, byte SIZEOF_XMMWORD/16 + movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] .column_ld2: - test cl, SIZEOF_XMMWORD/8 - jz short .column_ld4 - sub ecx, byte SIZEOF_XMMWORD/8 - movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] - pslldq xmmA, SIZEOF_MMWORD - por xmmA,xmmE + test cl, SIZEOF_XMMWORD/8 + jz short .column_ld4 + sub ecx, byte SIZEOF_XMMWORD/8 + movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] + pslldq xmmA, SIZEOF_MMWORD + por xmmA,xmmE .column_ld4: - test cl, SIZEOF_XMMWORD/4 - jz short .column_ld8 - sub ecx, byte SIZEOF_XMMWORD/4 - movdqa xmmE,xmmA - movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] + test cl, SIZEOF_XMMWORD/4 + jz short .column_ld8 + sub ecx, byte SIZEOF_XMMWORD/4 + movdqa xmmE,xmmA + movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] .column_ld8: - test cl, SIZEOF_XMMWORD/2 - mov ecx, SIZEOF_XMMWORD - jz short .rgb_gray_cnv - movdqa xmmF,xmmA - movdqa xmmH,xmmE - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - jmp short .rgb_gray_cnv - alignx 16,7 + test cl, SIZEOF_XMMWORD/2 + mov ecx, SIZEOF_XMMWORD + jz short .rgb_gray_cnv + movdqa xmmF,xmmA + movdqa xmmH,xmmE + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + jmp short .rgb_gray_cnv + alignx 16,7 .columnloop: - movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] - movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] + movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD] + movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD] .rgb_gray_cnv: - ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) - punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) + movdqa xmmD,xmmA + punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35) + punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37) - movdqa xmmC,xmmF - punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) - punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) + movdqa xmmC,xmmF + punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D) + punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F) - movdqa xmmB,xmmA - punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) - punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) + movdqa xmmB,xmmA + punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C) + punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D) - movdqa xmmG,xmmD - punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) - punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) + movdqa xmmG,xmmD + punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E) + punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F) - movdqa xmmE,xmmA - punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) - punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) + movdqa xmmE,xmmA + punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E) + punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E) - movdqa xmmH,xmmB - punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) - punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) + movdqa xmmH,xmmB + punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F) + punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F) - pxor xmmF,xmmF + pxor xmmF,xmmF - movdqa xmmC,xmmA - punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) - punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) + movdqa xmmC,xmmA + punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E) + punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E) - movdqa xmmD,xmmB - punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) - punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) + movdqa xmmD,xmmB + punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F) + punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F) - movdqa xmmG,xmmE - punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) - punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) + movdqa xmmG,xmmE + punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E) + punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E) - punpcklbw xmmF,xmmH - punpckhbw xmmH,xmmH - psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) - psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) + punpcklbw xmmF,xmmH + punpckhbw xmmH,xmmH + psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F) + psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F) %endif ; RGB_PIXELSIZE ; --------------- - ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE - ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO + ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE + ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO - ; (Original) - ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B - ; - ; (This implementation) - ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G + ; (Original) + ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + ; + ; (This implementation) + ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G - movdqa xmm6,xmm1 - punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 - pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm6,xmm1 + punpcklwd xmm1,xmm3 + punpckhwd xmm6,xmm3 + pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm6,xmm0 - punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 - pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa xmm6,xmm0 + punpcklwd xmm0,xmm2 + punpckhwd xmm6,xmm2 + pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) + pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa xmm0, xmm5 ; xmm0=BO - movdqa xmm6, xmm4 ; xmm6=BE + movdqa xmm0, xmm5 ; xmm0=BO + movdqa xmm6, xmm4 ; xmm6=BE - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) - movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] + movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF] - paddd xmm0, xmm1 - paddd xmm4, xmm7 - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + paddd xmm0, xmm1 + paddd xmm4, xmm7 + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) - movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] + movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(0)] - paddd xmm4, XMMWORD [wk(1)] - paddd xmm6,xmm2 - paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + paddd xmm6, XMMWORD [wk(0)] + paddd xmm4, XMMWORD [wk(1)] + paddd xmm6,xmm2 + paddd xmm4,xmm2 + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [edi], xmm6 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [edi], xmm6 ; Save Y - sub ecx, byte SIZEOF_XMMWORD - add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr - add edi, byte SIZEOF_XMMWORD ; outptr0 - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - test ecx,ecx - jnz near .column_ld1 + sub ecx, byte SIZEOF_XMMWORD + add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr + add edi, byte SIZEOF_XMMWORD ; outptr0 + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .column_ld1 - pop ecx ; col - pop esi - pop edi - poppic eax + pop ecx ; col + pop esi + pop edi + poppic eax - add esi, byte SIZEOF_JSAMPROW ; input_buf - add edi, byte SIZEOF_JSAMPROW - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_buf + add edi, byte SIZEOF_JSAMPROW + dec eax ; num_rows + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqnt3dn.asm b/simd/jcqnt3dn.asm index 182c8695..0b8ec17e 100644 --- a/simd/jcqnt3dn.asm +++ b/simd/jcqnt3dn.asm @@ -20,8 +20,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -30,98 +30,98 @@ ; FAST_FLOAT * workspace); ; -%define sample_data ebp+8 ; JSAMPARRAY sample_data -%define start_col ebp+12 ; JDIMENSION start_col -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_convsamp_float_3dnow) + align 16 + global EXTN(jsimd_convsamp_float_3dnow) EXTN(jsimd_convsamp_float_3dnow): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - pcmpeqw mm7,mm7 - psllw mm7,7 - packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) + pcmpeqw mm7,mm7 + psllw mm7,7 + packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) - mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) - mov eax, JDIMENSION [start_col] - mov edi, POINTER [workspace] ; (DCTELEM *) - mov ecx, DCTSIZE/2 - alignx 16,7 + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 .convloop: - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] - movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] - psubb mm0,mm7 ; mm0=(01234567) - psubb mm1,mm7 ; mm1=(89ABCDEF) + psubb mm0,mm7 ; mm0=(01234567) + psubb mm1,mm7 ; mm1=(89ABCDEF) - punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) - punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) - punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) - punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) + punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) + punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) + punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) + punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) - punpcklwd mm4,mm2 ; mm4=(***0***1) - punpckhwd mm2,mm2 ; mm2=(***2***3) - punpcklwd mm5,mm0 ; mm5=(***4***5) - punpckhwd mm0,mm0 ; mm0=(***6***7) + punpcklwd mm4,mm2 ; mm4=(***0***1) + punpckhwd mm2,mm2 ; mm2=(***2***3) + punpcklwd mm5,mm0 ; mm5=(***4***5) + punpckhwd mm0,mm0 ; mm0=(***6***7) - psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) - psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) - pi2fd mm4,mm4 - pi2fd mm2,mm2 - psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) - psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) - pi2fd mm5,mm5 - pi2fd mm0,mm0 + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) + psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) + pi2fd mm4,mm4 + pi2fd mm2,mm2 + psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) + psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) + pi2fd mm5,mm5 + pi2fd mm0,mm0 - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm2 - movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 - movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 - punpcklwd mm6,mm3 ; mm6=(***8***9) - punpckhwd mm3,mm3 ; mm3=(***A***B) - punpcklwd mm4,mm1 ; mm4=(***C***D) - punpckhwd mm1,mm1 ; mm1=(***E***F) + punpcklwd mm6,mm3 ; mm6=(***8***9) + punpckhwd mm3,mm3 ; mm3=(***A***B) + punpcklwd mm4,mm1 ; mm4=(***C***D) + punpckhwd mm1,mm1 ; mm1=(***E***F) - psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) - psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) - pi2fd mm6,mm6 - pi2fd mm3,mm3 - psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) - psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) - pi2fd mm4,mm4 - pi2fd mm1,mm1 + psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) + psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) + pi2fd mm6,mm6 + pi2fd mm3,mm3 + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) + psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) + pi2fd mm4,mm4 + pi2fd mm1,mm1 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm6 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm3 - movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm3 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 - add esi, byte 2*SIZEOF_JSAMPROW - add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT - dec ecx - jnz near .convloop + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .convloop - femms ; empty MMX/3DNow! state + femms ; empty MMX/3DNow! state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; -------------------------------------------------------------------------- @@ -133,101 +133,101 @@ EXTN(jsimd_convsamp_float_3dnow): ; FAST_FLOAT * workspace); ; -%define coef_block ebp+8 ; JCOEFPTR coef_block -%define divisors ebp+12 ; FAST_FLOAT * divisors -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_quantize_float_3dnow) + align 16 + global EXTN(jsimd_quantize_float_3dnow) EXTN(jsimd_quantize_float_3dnow): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - mov eax, 0x4B400000 ; (float)0x00C00000 (rndint_magic) - movd mm7,eax - punpckldq mm7,mm7 ; mm7={12582912.0F 12582912.0F} + mov eax, 0x4B400000 ; (float)0x00C00000 (rndint_magic) + movd mm7,eax + punpckldq mm7,mm7 ; mm7={12582912.0F 12582912.0F} - mov esi, POINTER [workspace] - mov edx, POINTER [divisors] - mov edi, JCOEFPTR [coef_block] - mov eax, DCTSIZE2/16 - alignx 16,7 + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 .quantloop: - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] - pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - pfmul mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(0,2,esi,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(0,3,esi,SIZEOF_FAST_FLOAT)] - pfmul mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] - pfmul mm3, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + pfmul mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,2,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(0,3,esi,SIZEOF_FAST_FLOAT)] + pfmul mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] + pfmul mm3, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] - pfadd mm0,mm7 ; mm0=(00 ** 01 **) - pfadd mm1,mm7 ; mm1=(02 ** 03 **) - pfadd mm2,mm7 ; mm0=(04 ** 05 **) - pfadd mm3,mm7 ; mm1=(06 ** 07 **) + pfadd mm0,mm7 ; mm0=(00 ** 01 **) + pfadd mm1,mm7 ; mm1=(02 ** 03 **) + pfadd mm2,mm7 ; mm0=(04 ** 05 **) + pfadd mm3,mm7 ; mm1=(06 ** 07 **) - movq mm4,mm0 - punpcklwd mm0,mm1 ; mm0=(00 02 ** **) - punpckhwd mm4,mm1 ; mm4=(01 03 ** **) - movq mm5,mm2 - punpcklwd mm2,mm3 ; mm2=(04 06 ** **) - punpckhwd mm5,mm3 ; mm5=(05 07 ** **) + movq mm4,mm0 + punpcklwd mm0,mm1 ; mm0=(00 02 ** **) + punpckhwd mm4,mm1 ; mm4=(01 03 ** **) + movq mm5,mm2 + punpcklwd mm2,mm3 ; mm2=(04 06 ** **) + punpckhwd mm5,mm3 ; mm5=(05 07 ** **) - punpcklwd mm0,mm4 ; mm0=(00 01 02 03) - punpcklwd mm2,mm5 ; mm2=(04 05 06 07) + punpcklwd mm0,mm4 ; mm0=(00 01 02 03) + punpcklwd mm2,mm5 ; mm2=(04 05 06 07) - movq mm6, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] - pfmul mm6, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - pfmul mm1, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(1,2,esi,SIZEOF_FAST_FLOAT)] - movq mm4, MMWORD [MMBLOCK(1,3,esi,SIZEOF_FAST_FLOAT)] - pfmul mm3, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] - pfmul mm4, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] + movq mm6, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + pfmul mm6, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + pfmul mm1, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,2,esi,SIZEOF_FAST_FLOAT)] + movq mm4, MMWORD [MMBLOCK(1,3,esi,SIZEOF_FAST_FLOAT)] + pfmul mm3, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] + pfmul mm4, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] - pfadd mm6,mm7 ; mm0=(10 ** 11 **) - pfadd mm1,mm7 ; mm4=(12 ** 13 **) - pfadd mm3,mm7 ; mm0=(14 ** 15 **) - pfadd mm4,mm7 ; mm4=(16 ** 17 **) + pfadd mm6,mm7 ; mm0=(10 ** 11 **) + pfadd mm1,mm7 ; mm4=(12 ** 13 **) + pfadd mm3,mm7 ; mm0=(14 ** 15 **) + pfadd mm4,mm7 ; mm4=(16 ** 17 **) - movq mm5,mm6 - punpcklwd mm6,mm1 ; mm6=(10 12 ** **) - punpckhwd mm5,mm1 ; mm5=(11 13 ** **) - movq mm1,mm3 - punpcklwd mm3,mm4 ; mm3=(14 16 ** **) - punpckhwd mm1,mm4 ; mm1=(15 17 ** **) + movq mm5,mm6 + punpcklwd mm6,mm1 ; mm6=(10 12 ** **) + punpckhwd mm5,mm1 ; mm5=(11 13 ** **) + movq mm1,mm3 + punpcklwd mm3,mm4 ; mm3=(14 16 ** **) + punpckhwd mm1,mm4 ; mm1=(15 17 ** **) - punpcklwd mm6,mm5 ; mm6=(10 11 12 13) - punpcklwd mm3,mm1 ; mm3=(14 15 16 17) + punpcklwd mm6,mm5 ; mm6=(10 11 12 13) + punpcklwd mm3,mm1 ; mm3=(14 15 16 17) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm6 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 - add esi, byte 16*SIZEOF_FAST_FLOAT - add edx, byte 16*SIZEOF_FAST_FLOAT - add edi, byte 16*SIZEOF_JCOEF - dec eax - jnz near .quantloop + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz near .quantloop - femms ; empty MMX/3DNow! state + femms ; empty MMX/3DNow! state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqntmmx.asm b/simd/jcqntmmx.asm index 08b08b79..ae837d2b 100644 --- a/simd/jcqntmmx.asm +++ b/simd/jcqntmmx.asm @@ -20,8 +20,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -30,92 +30,92 @@ ; DCTELEM * workspace); ; -%define sample_data ebp+8 ; JSAMPARRAY sample_data -%define start_col ebp+12 ; JDIMENSION start_col -%define workspace ebp+16 ; DCTELEM * workspace +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; DCTELEM * workspace - align 16 - global EXTN(jsimd_convsamp_mmx) + align 16 + global EXTN(jsimd_convsamp_mmx) EXTN(jsimd_convsamp_mmx): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - pxor mm6,mm6 ; mm6=(all 0's) - pcmpeqw mm7,mm7 - psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} + pxor mm6,mm6 ; mm6=(all 0's) + pcmpeqw mm7,mm7 + psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} - mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) - mov eax, JDIMENSION [start_col] - mov edi, POINTER [workspace] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .convloop: - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm0=(01234567) - movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm1=(89ABCDEF) + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm0=(01234567) + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm1=(89ABCDEF) - mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq mm2, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm2=(GHIJKLMN) - movq mm3, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm3=(OPQRSTUV) + movq mm2, MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; mm2=(GHIJKLMN) + movq mm3, MMWORD [edx+eax*SIZEOF_JSAMPLE] ; mm3=(OPQRSTUV) - movq mm4,mm0 - punpcklbw mm0,mm6 ; mm0=(0123) - punpckhbw mm4,mm6 ; mm4=(4567) - movq mm5,mm1 - punpcklbw mm1,mm6 ; mm1=(89AB) - punpckhbw mm5,mm6 ; mm5=(CDEF) + movq mm4,mm0 + punpcklbw mm0,mm6 ; mm0=(0123) + punpckhbw mm4,mm6 ; mm4=(4567) + movq mm5,mm1 + punpcklbw mm1,mm6 ; mm1=(89AB) + punpckhbw mm5,mm6 ; mm5=(CDEF) - paddw mm0,mm7 - paddw mm4,mm7 - paddw mm1,mm7 - paddw mm5,mm7 + paddw mm0,mm7 + paddw mm4,mm7 + paddw mm1,mm7 + paddw mm5,mm7 - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm4 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_DCTELEM)], mm1 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_DCTELEM)], mm5 - movq mm0,mm2 - punpcklbw mm2,mm6 ; mm2=(GHIJ) - punpckhbw mm0,mm6 ; mm0=(KLMN) - movq mm4,mm3 - punpcklbw mm3,mm6 ; mm3=(OPQR) - punpckhbw mm4,mm6 ; mm4=(STUV) + movq mm0,mm2 + punpcklbw mm2,mm6 ; mm2=(GHIJ) + punpckhbw mm0,mm6 ; mm0=(KLMN) + movq mm4,mm3 + punpcklbw mm3,mm6 ; mm3=(OPQR) + punpckhbw mm4,mm6 ; mm4=(STUV) - paddw mm2,mm7 - paddw mm0,mm7 - paddw mm3,mm7 - paddw mm4,mm7 + paddw mm2,mm7 + paddw mm0,mm7 + paddw mm3,mm7 + paddw mm4,mm7 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_DCTELEM)], mm2 - movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_DCTELEM)], mm0 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_DCTELEM)], mm3 - movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_DCTELEM)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_DCTELEM)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_DCTELEM)], mm4 - add esi, byte 4*SIZEOF_JSAMPROW - add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM - dec ecx - jnz short .convloop + add esi, byte 4*SIZEOF_JSAMPROW + add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz short .convloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -135,140 +135,140 @@ EXTN(jsimd_convsamp_mmx): %define SCALE(m,n,b) MMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) %define SHIFT(m,n,b) MMBLOCK(DCTSIZE*3+(m),(n),(b),SIZEOF_DCTELEM) -%define coef_block ebp+8 ; JCOEFPTR coef_block -%define divisors ebp+12 ; DCTELEM * divisors -%define workspace ebp+16 ; DCTELEM * workspace +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; DCTELEM * divisors +%define workspace ebp+16 ; DCTELEM * workspace - align 16 - global EXTN(jsimd_quantize_mmx) + align 16 + global EXTN(jsimd_quantize_mmx) EXTN(jsimd_quantize_mmx): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - mov esi, POINTER [workspace] - mov edx, POINTER [divisors] - mov edi, JCOEFPTR [coef_block] - mov ah, 2 - alignx 16,7 + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov ah, 2 + alignx 16,7 .quantloop1: - mov al, DCTSIZE2/8/2 - alignx 16,7 + mov al, DCTSIZE2/8/2 + alignx 16,7 .quantloop2: - movq mm2, MMWORD [MMBLOCK(0,0,esi,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(0,1,esi,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(0,0,esi,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(0,1,esi,SIZEOF_DCTELEM)] - movq mm0,mm2 - movq mm1,mm3 + movq mm0,mm2 + movq mm1,mm3 - psraw mm2,(WORD_BIT-1) ; -1 if value < 0, 0 otherwise - psraw mm3,(WORD_BIT-1) + psraw mm2,(WORD_BIT-1) ; -1 if value < 0, 0 otherwise + psraw mm3,(WORD_BIT-1) - pxor mm0,mm2 ; val = -val - pxor mm1,mm3 - psubw mm0,mm2 - psubw mm1,mm3 + pxor mm0,mm2 ; val = -val + pxor mm1,mm3 + psubw mm0,mm2 + psubw mm1,mm3 - ; - ; MMX is an annoyingly crappy instruction set. It has two - ; misfeatures that are causing problems here: - ; - ; - All multiplications are signed. - ; - ; - The second operand for the shifts is not treated as packed. - ; - ; - ; We work around the first problem by implementing this algorithm: - ; - ; unsigned long unsigned_multiply(unsigned short x, unsigned short y) - ; { - ; enum { SHORT_BIT = 16 }; - ; signed short sx = (signed short) x; - ; signed short sy = (signed short) y; - ; signed long sz; - ; - ; sz = (long) sx * (long) sy; /* signed multiply */ - ; - ; if (sx < 0) sz += (long) sy << SHORT_BIT; - ; if (sy < 0) sz += (long) sx << SHORT_BIT; - ; - ; return (unsigned long) sz; - ; } - ; - ; (note that a negative sx adds _sy_ and vice versa) - ; - ; For the second problem, we replace the shift by a multiplication. - ; Unfortunately that means we have to deal with the signed issue again. - ; + ; + ; MMX is an annoyingly crappy instruction set. It has two + ; misfeatures that are causing problems here: + ; + ; - All multiplications are signed. + ; + ; - The second operand for the shifts is not treated as packed. + ; + ; + ; We work around the first problem by implementing this algorithm: + ; + ; unsigned long unsigned_multiply(unsigned short x, unsigned short y) + ; { + ; enum { SHORT_BIT = 16 }; + ; signed short sx = (signed short) x; + ; signed short sy = (signed short) y; + ; signed long sz; + ; + ; sz = (long) sx * (long) sy; /* signed multiply */ + ; + ; if (sx < 0) sz += (long) sy << SHORT_BIT; + ; if (sy < 0) sz += (long) sx << SHORT_BIT; + ; + ; return (unsigned long) sz; + ; } + ; + ; (note that a negative sx adds _sy_ and vice versa) + ; + ; For the second problem, we replace the shift by a multiplication. + ; Unfortunately that means we have to deal with the signed issue again. + ; - paddw mm0, MMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor - paddw mm1, MMWORD [CORRECTION(0,1,edx)] + paddw mm0, MMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor + paddw mm1, MMWORD [CORRECTION(0,1,edx)] - movq mm4,mm0 ; store current value for later - movq mm5,mm1 - pmulhw mm0, MMWORD [RECIPROCAL(0,0,edx)] ; reciprocal - pmulhw mm1, MMWORD [RECIPROCAL(0,1,edx)] - paddw mm0,mm4 ; reciprocal is always negative (MSB=1), - paddw mm1,mm5 ; so we always need to add the initial value - ; (input value is never negative as we - ; inverted it at the start of this routine) + movq mm4,mm0 ; store current value for later + movq mm5,mm1 + pmulhw mm0, MMWORD [RECIPROCAL(0,0,edx)] ; reciprocal + pmulhw mm1, MMWORD [RECIPROCAL(0,1,edx)] + paddw mm0,mm4 ; reciprocal is always negative (MSB=1), + paddw mm1,mm5 ; so we always need to add the initial value + ; (input value is never negative as we + ; inverted it at the start of this routine) - ; here it gets a bit tricky as both scale - ; and mm0/mm1 can be negative - movq mm6, MMWORD [SCALE(0,0,edx)] ; scale - movq mm7, MMWORD [SCALE(0,1,edx)] - movq mm4,mm0 - movq mm5,mm1 - pmulhw mm0,mm6 - pmulhw mm1,mm7 + ; here it gets a bit tricky as both scale + ; and mm0/mm1 can be negative + movq mm6, MMWORD [SCALE(0,0,edx)] ; scale + movq mm7, MMWORD [SCALE(0,1,edx)] + movq mm4,mm0 + movq mm5,mm1 + pmulhw mm0,mm6 + pmulhw mm1,mm7 - psraw mm6,(WORD_BIT-1) ; determine if scale is negative - psraw mm7,(WORD_BIT-1) + psraw mm6,(WORD_BIT-1) ; determine if scale is negative + psraw mm7,(WORD_BIT-1) - pand mm6,mm4 ; and add input if it is - pand mm7,mm5 - paddw mm0,mm6 - paddw mm1,mm7 + pand mm6,mm4 ; and add input if it is + pand mm7,mm5 + paddw mm0,mm6 + paddw mm1,mm7 - psraw mm4,(WORD_BIT-1) ; then check if negative input - psraw mm5,(WORD_BIT-1) + psraw mm4,(WORD_BIT-1) ; then check if negative input + psraw mm5,(WORD_BIT-1) - pand mm4, MMWORD [SCALE(0,0,edx)] ; and add scale if it is - pand mm5, MMWORD [SCALE(0,1,edx)] - paddw mm0,mm4 - paddw mm1,mm5 + pand mm4, MMWORD [SCALE(0,0,edx)] ; and add scale if it is + pand mm5, MMWORD [SCALE(0,1,edx)] + paddw mm0,mm4 + paddw mm1,mm5 - pxor mm0,mm2 ; val = -val - pxor mm1,mm3 - psubw mm0,mm2 - psubw mm1,mm3 + pxor mm0,mm2 ; val = -val + pxor mm1,mm3 + psubw mm0,mm2 + psubw mm1,mm3 - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_DCTELEM)], mm1 - add esi, byte 8*SIZEOF_DCTELEM - add edx, byte 8*SIZEOF_DCTELEM - add edi, byte 8*SIZEOF_JCOEF - dec al - jnz near .quantloop2 - dec ah - jnz near .quantloop1 ; to avoid branch misprediction + add esi, byte 8*SIZEOF_DCTELEM + add edx, byte 8*SIZEOF_DCTELEM + add edi, byte 8*SIZEOF_JCOEF + dec al + jnz near .quantloop2 + dec ah + jnz near .quantloop1 ; to avoid branch misprediction - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqnts2f-64.asm b/simd/jcqnts2f-64.asm index d0efa1b9..0752542f 100644 --- a/simd/jcqnts2f-64.asm +++ b/simd/jcqnts2f-64.asm @@ -21,8 +21,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -35,65 +35,65 @@ ; r11 = JDIMENSION start_col ; r12 = FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_convsamp_float_sse2) + align 16 + global EXTN(jsimd_convsamp_float_sse2) EXTN(jsimd_convsamp_float_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args - push rbx + push rbp + mov rax,rsp + mov rbp,rsp + collect_args + push rbx - pcmpeqw xmm7,xmm7 - psllw xmm7,7 - packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 + packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) - mov rsi, r10 - mov rax, r11 - mov rdi, r12 - mov rcx, DCTSIZE/2 + mov rsi, r10 + mov rax, r11 + mov rdi, r12 + mov rcx, DCTSIZE/2 .convloop: - mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] - movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] + movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] + movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] - psubb xmm0,xmm7 ; xmm0=(01234567) - psubb xmm1,xmm7 ; xmm1=(89ABCDEF) + psubb xmm0,xmm7 ; xmm0=(01234567) + psubb xmm1,xmm7 ; xmm1=(89ABCDEF) - punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) - punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) + punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) + punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) - punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) - punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) - punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) - punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) + punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) + punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) + punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) + punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) - psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) - psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) - cvtdq2ps xmm2,xmm2 ; xmm2=(0123) - cvtdq2ps xmm0,xmm0 ; xmm0=(4567) - psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) - psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) - cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) - cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) + psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) + psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) + cvtdq2ps xmm2,xmm2 ; xmm2=(0123) + cvtdq2ps xmm0,xmm0 ; xmm0=(4567) + psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) + psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) + cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) + cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) - movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 - add rsi, byte 2*SIZEOF_JSAMPROW - add rdi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT - dec rcx - jnz short .convloop + add rsi, byte 2*SIZEOF_JSAMPROW + add rdi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec rcx + jnz short .convloop - pop rbx - uncollect_args - pop rbp - ret + pop rbx + uncollect_args + pop rbp + ret ; -------------------------------------------------------------------------- @@ -109,50 +109,50 @@ EXTN(jsimd_convsamp_float_sse2): ; r11 = FAST_FLOAT * divisors ; r12 = FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_quantize_float_sse2) + align 16 + global EXTN(jsimd_quantize_float_sse2) EXTN(jsimd_quantize_float_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rsi, r12 - mov rdx, r11 - mov rdi, r10 - mov rax, DCTSIZE2/16 + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2/16 .quantloop: - movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(0,1,rsi,SIZEOF_FAST_FLOAT)] - mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] - mulps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(1,1,rsi,SIZEOF_FAST_FLOAT)] - mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] - mulps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,rsi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,rsi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] - cvtps2dq xmm0,xmm0 - cvtps2dq xmm1,xmm1 - cvtps2dq xmm2,xmm2 - cvtps2dq xmm3,xmm3 + cvtps2dq xmm0,xmm0 + cvtps2dq xmm1,xmm1 + cvtps2dq xmm2,xmm2 + cvtps2dq xmm3,xmm3 - packssdw xmm0,xmm1 - packssdw xmm2,xmm3 + packssdw xmm0,xmm1 + packssdw xmm2,xmm3 - movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_JCOEF)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_JCOEF)], xmm2 + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_JCOEF)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_JCOEF)], xmm2 - add rsi, byte 16*SIZEOF_FAST_FLOAT - add rdx, byte 16*SIZEOF_FAST_FLOAT - add rdi, byte 16*SIZEOF_JCOEF - dec rax - jnz short .quantloop + add rsi, byte 16*SIZEOF_FAST_FLOAT + add rdx, byte 16*SIZEOF_FAST_FLOAT + add rdi, byte 16*SIZEOF_JCOEF + dec rax + jnz short .quantloop - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqnts2f.asm b/simd/jcqnts2f.asm index d80ae5dc..0df2df78 100644 --- a/simd/jcqnts2f.asm +++ b/simd/jcqnts2f.asm @@ -20,8 +20,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -30,75 +30,75 @@ ; FAST_FLOAT * workspace); ; -%define sample_data ebp+8 ; JSAMPARRAY sample_data -%define start_col ebp+12 ; JDIMENSION start_col -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_convsamp_float_sse2) + align 16 + global EXTN(jsimd_convsamp_float_sse2) EXTN(jsimd_convsamp_float_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - pcmpeqw xmm7,xmm7 - psllw xmm7,7 - packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 + packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..) - mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) - mov eax, JDIMENSION [start_col] - mov edi, POINTER [workspace] ; (DCTELEM *) - mov ecx, DCTSIZE/2 - alignx 16,7 + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 .convloop: - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] - movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] + movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] - psubb xmm0,xmm7 ; xmm0=(01234567) - psubb xmm1,xmm7 ; xmm1=(89ABCDEF) + psubb xmm0,xmm7 ; xmm0=(01234567) + psubb xmm1,xmm7 ; xmm1=(89ABCDEF) - punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) - punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) + punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7) + punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F) - punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) - punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) - punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) - punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) + punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3) + punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7) + punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B) + punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F) - psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) - psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) - cvtdq2ps xmm2,xmm2 ; xmm2=(0123) - cvtdq2ps xmm0,xmm0 ; xmm0=(4567) - psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) - psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) - cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) - cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) + psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123) + psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567) + cvtdq2ps xmm2,xmm2 ; xmm2=(0123) + cvtdq2ps xmm0,xmm0 ; xmm0=(4567) + psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB) + psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF) + cvtdq2ps xmm3,xmm3 ; xmm3=(89AB) + cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 - add esi, byte 2*SIZEOF_JSAMPROW - add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT - dec ecx - jnz short .convloop + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz short .convloop - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; -------------------------------------------------------------------------- @@ -110,62 +110,62 @@ EXTN(jsimd_convsamp_float_sse2): ; FAST_FLOAT * workspace); ; -%define coef_block ebp+8 ; JCOEFPTR coef_block -%define divisors ebp+12 ; FAST_FLOAT * divisors -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_quantize_float_sse2) + align 16 + global EXTN(jsimd_quantize_float_sse2) EXTN(jsimd_quantize_float_sse2): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - mov esi, POINTER [workspace] - mov edx, POINTER [divisors] - mov edi, JCOEFPTR [coef_block] - mov eax, DCTSIZE2/16 - alignx 16,7 + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 .quantloop: - movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] - mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] - cvtps2dq xmm0,xmm0 - cvtps2dq xmm1,xmm1 - cvtps2dq xmm2,xmm2 - cvtps2dq xmm3,xmm3 + cvtps2dq xmm0,xmm0 + cvtps2dq xmm1,xmm1 + cvtps2dq xmm2,xmm2 + cvtps2dq xmm3,xmm3 - packssdw xmm0,xmm1 - packssdw xmm2,xmm3 + packssdw xmm0,xmm1 + packssdw xmm2,xmm3 - movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_JCOEF)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_JCOEF)], xmm2 + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_JCOEF)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_JCOEF)], xmm2 - add esi, byte 16*SIZEOF_FAST_FLOAT - add edx, byte 16*SIZEOF_FAST_FLOAT - add edi, byte 16*SIZEOF_JCOEF - dec eax - jnz short .quantloop + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz short .quantloop - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqnts2i-64.asm b/simd/jcqnts2i-64.asm index cc33d59f..5de8062f 100644 --- a/simd/jcqnts2i-64.asm +++ b/simd/jcqnts2i-64.asm @@ -21,8 +21,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -35,60 +35,60 @@ ; r11 = JDIMENSION start_col ; r12 = DCTELEM * workspace - align 16 - global EXTN(jsimd_convsamp_sse2) + align 16 + global EXTN(jsimd_convsamp_sse2) EXTN(jsimd_convsamp_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args - push rbx + push rbp + mov rax,rsp + mov rbp,rsp + collect_args + push rbx - pxor xmm6,xmm6 ; xmm6=(all 0's) - pcmpeqw xmm7,xmm7 - psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + pxor xmm6,xmm6 ; xmm6=(all 0's) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} - mov rsi, r10 - mov rax, r11 - mov rdi, r12 - mov rcx, DCTSIZE/4 + mov rsi, r10 + mov rax, r11 + mov rdi, r12 + mov rcx, DCTSIZE/4 .convloop: - mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm0=(01234567) - movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) + movq xmm0, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm0=(01234567) + movq xmm1, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) - mov rbx, JSAMPROW [rsi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov rdx, JSAMPROW [rsi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rbx, JSAMPROW [rsi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov rdx, JSAMPROW [rsi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm2, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) - movq xmm3, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) + movq xmm2, XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) + movq xmm3, XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) - punpcklbw xmm0,xmm6 ; xmm0=(01234567) - punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) - paddw xmm0,xmm7 - paddw xmm1,xmm7 - punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) - punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) - paddw xmm2,xmm7 - paddw xmm3,xmm7 + punpcklbw xmm0,xmm6 ; xmm0=(01234567) + punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) + paddw xmm0,xmm7 + paddw xmm1,xmm7 + punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) + punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) + paddw xmm2,xmm7 + paddw xmm3,xmm7 - movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 - movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 - add rsi, byte 4*SIZEOF_JSAMPROW - add rdi, byte 4*DCTSIZE*SIZEOF_DCTELEM - dec rcx - jnz short .convloop + add rsi, byte 4*SIZEOF_JSAMPROW + add rdi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec rcx + jnz short .convloop - pop rbx - uncollect_args - pop rbp - ret + pop rbx + uncollect_args + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -111,77 +111,77 @@ EXTN(jsimd_convsamp_sse2): ; r11 = DCTELEM * divisors ; r12 = DCTELEM * workspace - align 16 - global EXTN(jsimd_quantize_sse2) + align 16 + global EXTN(jsimd_quantize_sse2) EXTN(jsimd_quantize_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rsi, r12 - mov rdx, r11 - mov rdi, r10 - mov rax, DCTSIZE2/32 + mov rsi, r12 + mov rdx, r11 + mov rdi, r10 + mov rax, DCTSIZE2/32 .quantloop: - movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_DCTELEM)] - movdqa xmm5, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_DCTELEM)] - movdqa xmm6, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_DCTELEM)] - movdqa xmm0,xmm4 - movdqa xmm1,xmm5 - movdqa xmm2,xmm6 - movdqa xmm3,xmm7 - psraw xmm4,(WORD_BIT-1) - psraw xmm5,(WORD_BIT-1) - psraw xmm6,(WORD_BIT-1) - psraw xmm7,(WORD_BIT-1) - pxor xmm0,xmm4 - pxor xmm1,xmm5 - pxor xmm2,xmm6 - pxor xmm3,xmm7 - psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; - psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; - psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; - psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + psraw xmm4,(WORD_BIT-1) + psraw xmm5,(WORD_BIT-1) + psraw xmm6,(WORD_BIT-1) + psraw xmm7,(WORD_BIT-1) + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; + psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; + psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; + psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; - paddw xmm0, XMMWORD [CORRECTION(0,0,rdx)] ; correction + roundfactor - paddw xmm1, XMMWORD [CORRECTION(1,0,rdx)] - paddw xmm2, XMMWORD [CORRECTION(2,0,rdx)] - paddw xmm3, XMMWORD [CORRECTION(3,0,rdx)] - pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,rdx)] ; reciprocal - pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,rdx)] - pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,rdx)] - pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,rdx)] - pmulhuw xmm0, XMMWORD [SCALE(0,0,rdx)] ; scale - pmulhuw xmm1, XMMWORD [SCALE(1,0,rdx)] - pmulhuw xmm2, XMMWORD [SCALE(2,0,rdx)] - pmulhuw xmm3, XMMWORD [SCALE(3,0,rdx)] + paddw xmm0, XMMWORD [CORRECTION(0,0,rdx)] ; correction + roundfactor + paddw xmm1, XMMWORD [CORRECTION(1,0,rdx)] + paddw xmm2, XMMWORD [CORRECTION(2,0,rdx)] + paddw xmm3, XMMWORD [CORRECTION(3,0,rdx)] + pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,rdx)] ; reciprocal + pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,rdx)] + pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,rdx)] + pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,rdx)] + pmulhuw xmm0, XMMWORD [SCALE(0,0,rdx)] ; scale + pmulhuw xmm1, XMMWORD [SCALE(1,0,rdx)] + pmulhuw xmm2, XMMWORD [SCALE(2,0,rdx)] + pmulhuw xmm3, XMMWORD [SCALE(3,0,rdx)] - pxor xmm0,xmm4 - pxor xmm1,xmm5 - pxor xmm2,xmm6 - pxor xmm3,xmm7 - psubw xmm0,xmm4 - psubw xmm1,xmm5 - psubw xmm2,xmm6 - psubw xmm3,xmm7 - movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 - movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 + psubw xmm1,xmm5 + psubw xmm2,xmm6 + psubw xmm3,xmm7 + movdqa XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_DCTELEM)], xmm3 - add rsi, byte 32*SIZEOF_DCTELEM - add rdx, byte 32*SIZEOF_DCTELEM - add rdi, byte 32*SIZEOF_JCOEF - dec rax - jnz near .quantloop + add rsi, byte 32*SIZEOF_DCTELEM + add rdx, byte 32*SIZEOF_DCTELEM + add rdi, byte 32*SIZEOF_JCOEF + dec rax + jnz near .quantloop - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqnts2i.asm b/simd/jcqnts2i.asm index 0864d6ed..07cdc685 100644 --- a/simd/jcqnts2i.asm +++ b/simd/jcqnts2i.asm @@ -20,8 +20,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -30,70 +30,70 @@ ; DCTELEM * workspace); ; -%define sample_data ebp+8 ; JSAMPARRAY sample_data -%define start_col ebp+12 ; JDIMENSION start_col -%define workspace ebp+16 ; DCTELEM * workspace +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; DCTELEM * workspace - align 16 - global EXTN(jsimd_convsamp_sse2) + align 16 + global EXTN(jsimd_convsamp_sse2) EXTN(jsimd_convsamp_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - pxor xmm6,xmm6 ; xmm6=(all 0's) - pcmpeqw xmm7,xmm7 - psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + pxor xmm6,xmm6 ; xmm6=(all 0's) + pcmpeqw xmm7,xmm7 + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} - mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) - mov eax, JDIMENSION [start_col] - mov edi, POINTER [workspace] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .convloop: - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm0=(01234567) - movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) + movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm0=(01234567) + movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm1=(89ABCDEF) - mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq xmm2, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) - movq xmm3, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) + movq xmm2, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE] ; xmm2=(GHIJKLMN) + movq xmm3, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE] ; xmm3=(OPQRSTUV) - punpcklbw xmm0,xmm6 ; xmm0=(01234567) - punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) - paddw xmm0,xmm7 - paddw xmm1,xmm7 - punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) - punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) - paddw xmm2,xmm7 - paddw xmm3,xmm7 + punpcklbw xmm0,xmm6 ; xmm0=(01234567) + punpcklbw xmm1,xmm6 ; xmm1=(89ABCDEF) + paddw xmm0,xmm7 + paddw xmm1,xmm7 + punpcklbw xmm2,xmm6 ; xmm2=(GHIJKLMN) + punpcklbw xmm3,xmm6 ; xmm3=(OPQRSTUV) + paddw xmm2,xmm7 + paddw xmm3,xmm7 - movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 - movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 - add esi, byte 4*SIZEOF_JSAMPROW - add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM - dec ecx - jnz short .convloop + add esi, byte 4*SIZEOF_JSAMPROW + add edi, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz short .convloop - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -112,89 +112,89 @@ EXTN(jsimd_convsamp_sse2): %define CORRECTION(m,n,b) XMMBLOCK(DCTSIZE*1+(m),(n),(b),SIZEOF_DCTELEM) %define SCALE(m,n,b) XMMBLOCK(DCTSIZE*2+(m),(n),(b),SIZEOF_DCTELEM) -%define coef_block ebp+8 ; JCOEFPTR coef_block -%define divisors ebp+12 ; DCTELEM * divisors -%define workspace ebp+16 ; DCTELEM * workspace +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; DCTELEM * divisors +%define workspace ebp+16 ; DCTELEM * workspace - align 16 - global EXTN(jsimd_quantize_sse2) + align 16 + global EXTN(jsimd_quantize_sse2) EXTN(jsimd_quantize_sse2): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - mov esi, POINTER [workspace] - mov edx, POINTER [divisors] - mov edi, JCOEFPTR [coef_block] - mov eax, DCTSIZE2/32 - alignx 16,7 + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/32 + alignx 16,7 .quantloop: - movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_DCTELEM)] - movdqa xmm5, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_DCTELEM)] - movdqa xmm6, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_DCTELEM)] - movdqa xmm0,xmm4 - movdqa xmm1,xmm5 - movdqa xmm2,xmm6 - movdqa xmm3,xmm7 - psraw xmm4,(WORD_BIT-1) - psraw xmm5,(WORD_BIT-1) - psraw xmm6,(WORD_BIT-1) - psraw xmm7,(WORD_BIT-1) - pxor xmm0,xmm4 - pxor xmm1,xmm5 - pxor xmm2,xmm6 - pxor xmm3,xmm7 - psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; - psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; - psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; - psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + psraw xmm4,(WORD_BIT-1) + psraw xmm5,(WORD_BIT-1) + psraw xmm6,(WORD_BIT-1) + psraw xmm7,(WORD_BIT-1) + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 ; if (xmm0 < 0) xmm0 = -xmm0; + psubw xmm1,xmm5 ; if (xmm1 < 0) xmm1 = -xmm1; + psubw xmm2,xmm6 ; if (xmm2 < 0) xmm2 = -xmm2; + psubw xmm3,xmm7 ; if (xmm3 < 0) xmm3 = -xmm3; - paddw xmm0, XMMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor - paddw xmm1, XMMWORD [CORRECTION(1,0,edx)] - paddw xmm2, XMMWORD [CORRECTION(2,0,edx)] - paddw xmm3, XMMWORD [CORRECTION(3,0,edx)] - pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,edx)] ; reciprocal - pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,edx)] - pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,edx)] - pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,edx)] - pmulhuw xmm0, XMMWORD [SCALE(0,0,edx)] ; scale - pmulhuw xmm1, XMMWORD [SCALE(1,0,edx)] - pmulhuw xmm2, XMMWORD [SCALE(2,0,edx)] - pmulhuw xmm3, XMMWORD [SCALE(3,0,edx)] + paddw xmm0, XMMWORD [CORRECTION(0,0,edx)] ; correction + roundfactor + paddw xmm1, XMMWORD [CORRECTION(1,0,edx)] + paddw xmm2, XMMWORD [CORRECTION(2,0,edx)] + paddw xmm3, XMMWORD [CORRECTION(3,0,edx)] + pmulhuw xmm0, XMMWORD [RECIPROCAL(0,0,edx)] ; reciprocal + pmulhuw xmm1, XMMWORD [RECIPROCAL(1,0,edx)] + pmulhuw xmm2, XMMWORD [RECIPROCAL(2,0,edx)] + pmulhuw xmm3, XMMWORD [RECIPROCAL(3,0,edx)] + pmulhuw xmm0, XMMWORD [SCALE(0,0,edx)] ; scale + pmulhuw xmm1, XMMWORD [SCALE(1,0,edx)] + pmulhuw xmm2, XMMWORD [SCALE(2,0,edx)] + pmulhuw xmm3, XMMWORD [SCALE(3,0,edx)] - pxor xmm0,xmm4 - pxor xmm1,xmm5 - pxor xmm2,xmm6 - pxor xmm3,xmm7 - psubw xmm0,xmm4 - psubw xmm1,xmm5 - psubw xmm2,xmm6 - psubw xmm3,xmm7 - movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 - movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 - movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 + pxor xmm0,xmm4 + pxor xmm1,xmm5 + pxor xmm2,xmm6 + pxor xmm3,xmm7 + psubw xmm0,xmm4 + psubw xmm1,xmm5 + psubw xmm2,xmm6 + psubw xmm3,xmm7 + movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_DCTELEM)], xmm3 - add esi, byte 32*SIZEOF_DCTELEM - add edx, byte 32*SIZEOF_DCTELEM - add edi, byte 32*SIZEOF_JCOEF - dec eax - jnz near .quantloop + add esi, byte 32*SIZEOF_DCTELEM + add edx, byte 32*SIZEOF_DCTELEM + add edi, byte 32*SIZEOF_JCOEF + dec eax + jnz near .quantloop - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcqntsse.asm b/simd/jcqntsse.asm index 3065eca8..2e32d0cb 100644 --- a/simd/jcqntsse.asm +++ b/simd/jcqntsse.asm @@ -20,8 +20,8 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Load data into workspace, applying unsigned->signed conversion ; @@ -30,98 +30,98 @@ ; FAST_FLOAT * workspace); ; -%define sample_data ebp+8 ; JSAMPARRAY sample_data -%define start_col ebp+12 ; JDIMENSION start_col -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define sample_data ebp+8 ; JSAMPARRAY sample_data +%define start_col ebp+12 ; JDIMENSION start_col +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_convsamp_float_sse) + align 16 + global EXTN(jsimd_convsamp_float_sse) EXTN(jsimd_convsamp_float_sse): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - pcmpeqw mm7,mm7 - psllw mm7,7 - packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) + pcmpeqw mm7,mm7 + psllw mm7,7 + packsswb mm7,mm7 ; mm7 = PB_CENTERJSAMPLE (0x808080..) - mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) - mov eax, JDIMENSION [start_col] - mov edi, POINTER [workspace] ; (DCTELEM *) - mov ecx, DCTSIZE/2 - alignx 16,7 + mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *) + mov eax, JDIMENSION [start_col] + mov edi, POINTER [workspace] ; (DCTELEM *) + mov ecx, DCTSIZE/2 + alignx 16,7 .convloop: - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) - mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) + mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) - movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] - movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] + movq mm0, MMWORD [ebx+eax*SIZEOF_JSAMPLE] + movq mm1, MMWORD [edx+eax*SIZEOF_JSAMPLE] - psubb mm0,mm7 ; mm0=(01234567) - psubb mm1,mm7 ; mm1=(89ABCDEF) + psubb mm0,mm7 ; mm0=(01234567) + psubb mm1,mm7 ; mm1=(89ABCDEF) - punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) - punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) - punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) - punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) + punpcklbw mm2,mm0 ; mm2=(*0*1*2*3) + punpckhbw mm0,mm0 ; mm0=(*4*5*6*7) + punpcklbw mm3,mm1 ; mm3=(*8*9*A*B) + punpckhbw mm1,mm1 ; mm1=(*C*D*E*F) - punpcklwd mm4,mm2 ; mm4=(***0***1) - punpckhwd mm2,mm2 ; mm2=(***2***3) - punpcklwd mm5,mm0 ; mm5=(***4***5) - punpckhwd mm0,mm0 ; mm0=(***6***7) + punpcklwd mm4,mm2 ; mm4=(***0***1) + punpckhwd mm2,mm2 ; mm2=(***2***3) + punpcklwd mm5,mm0 ; mm5=(***4***5) + punpckhwd mm0,mm0 ; mm0=(***6***7) - psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) - psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) - cvtpi2ps xmm0,mm4 ; xmm0=(01**) - cvtpi2ps xmm1,mm2 ; xmm1=(23**) - psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) - psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) - cvtpi2ps xmm2,mm5 ; xmm2=(45**) - cvtpi2ps xmm3,mm0 ; xmm3=(67**) + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(01) + psrad mm2,(DWORD_BIT-BYTE_BIT) ; mm2=(23) + cvtpi2ps xmm0,mm4 ; xmm0=(01**) + cvtpi2ps xmm1,mm2 ; xmm1=(23**) + psrad mm5,(DWORD_BIT-BYTE_BIT) ; mm5=(45) + psrad mm0,(DWORD_BIT-BYTE_BIT) ; mm0=(67) + cvtpi2ps xmm2,mm5 ; xmm2=(45**) + cvtpi2ps xmm3,mm0 ; xmm3=(67**) - punpcklwd mm6,mm3 ; mm6=(***8***9) - punpckhwd mm3,mm3 ; mm3=(***A***B) - punpcklwd mm4,mm1 ; mm4=(***C***D) - punpckhwd mm1,mm1 ; mm1=(***E***F) + punpcklwd mm6,mm3 ; mm6=(***8***9) + punpckhwd mm3,mm3 ; mm3=(***A***B) + punpcklwd mm4,mm1 ; mm4=(***C***D) + punpckhwd mm1,mm1 ; mm1=(***E***F) - psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) - psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) - cvtpi2ps xmm4,mm6 ; xmm4=(89**) - cvtpi2ps xmm5,mm3 ; xmm5=(AB**) - psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) - psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) - cvtpi2ps xmm6,mm4 ; xmm6=(CD**) - cvtpi2ps xmm7,mm1 ; xmm7=(EF**) + psrad mm6,(DWORD_BIT-BYTE_BIT) ; mm6=(89) + psrad mm3,(DWORD_BIT-BYTE_BIT) ; mm3=(AB) + cvtpi2ps xmm4,mm6 ; xmm4=(89**) + cvtpi2ps xmm5,mm3 ; xmm5=(AB**) + psrad mm4,(DWORD_BIT-BYTE_BIT) ; mm4=(CD) + psrad mm1,(DWORD_BIT-BYTE_BIT) ; mm1=(EF) + cvtpi2ps xmm6,mm4 ; xmm6=(CD**) + cvtpi2ps xmm7,mm1 ; xmm7=(EF**) - movlhps xmm0,xmm1 ; xmm0=(0123) - movlhps xmm2,xmm3 ; xmm2=(4567) - movlhps xmm4,xmm5 ; xmm4=(89AB) - movlhps xmm6,xmm7 ; xmm6=(CDEF) + movlhps xmm0,xmm1 ; xmm0=(0123) + movlhps xmm2,xmm3 ; xmm2=(4567) + movlhps xmm4,xmm5 ; xmm4=(89AB) + movlhps xmm6,xmm7 ; xmm6=(CDEF) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm4 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 - add esi, byte 2*SIZEOF_JSAMPROW - add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT - dec ecx - jnz near .convloop + add esi, byte 2*SIZEOF_JSAMPROW + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .convloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; -------------------------------------------------------------------------- @@ -133,79 +133,79 @@ EXTN(jsimd_convsamp_float_sse): ; FAST_FLOAT * workspace); ; -%define coef_block ebp+8 ; JCOEFPTR coef_block -%define divisors ebp+12 ; FAST_FLOAT * divisors -%define workspace ebp+16 ; FAST_FLOAT * workspace +%define coef_block ebp+8 ; JCOEFPTR coef_block +%define divisors ebp+12 ; FAST_FLOAT * divisors +%define workspace ebp+16 ; FAST_FLOAT * workspace - align 16 - global EXTN(jsimd_quantize_float_sse) + align 16 + global EXTN(jsimd_quantize_float_sse) EXTN(jsimd_quantize_float_sse): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - mov esi, POINTER [workspace] - mov edx, POINTER [divisors] - mov edi, JCOEFPTR [coef_block] - mov eax, DCTSIZE2/16 - alignx 16,7 + mov esi, POINTER [workspace] + mov edx, POINTER [divisors] + mov edi, JCOEFPTR [coef_block] + mov eax, DCTSIZE2/16 + alignx 16,7 .quantloop: - movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] - mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] - movhlps xmm4,xmm0 - movhlps xmm5,xmm1 + movhlps xmm4,xmm0 + movhlps xmm5,xmm1 - cvtps2pi mm0,xmm0 - cvtps2pi mm1,xmm1 - cvtps2pi mm4,xmm4 - cvtps2pi mm5,xmm5 + cvtps2pi mm0,xmm0 + cvtps2pi mm1,xmm1 + cvtps2pi mm4,xmm4 + cvtps2pi mm5,xmm5 - movhlps xmm6,xmm2 - movhlps xmm7,xmm3 + movhlps xmm6,xmm2 + movhlps xmm7,xmm3 - cvtps2pi mm2,xmm2 - cvtps2pi mm3,xmm3 - cvtps2pi mm6,xmm6 - cvtps2pi mm7,xmm7 + cvtps2pi mm2,xmm2 + cvtps2pi mm3,xmm3 + cvtps2pi mm6,xmm6 + cvtps2pi mm7,xmm7 - packssdw mm0,mm4 - packssdw mm1,mm5 - packssdw mm2,mm6 - packssdw mm3,mm7 + packssdw mm0,mm4 + packssdw mm1,mm5 + packssdw mm2,mm6 + packssdw mm3,mm7 - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm3 - add esi, byte 16*SIZEOF_FAST_FLOAT - add edx, byte 16*SIZEOF_FAST_FLOAT - add edi, byte 16*SIZEOF_JCOEF - dec eax - jnz short .quantloop + add esi, byte 16*SIZEOF_FAST_FLOAT + add edx, byte 16*SIZEOF_FAST_FLOAT + add edi, byte 16*SIZEOF_JCOEF + dec eax + jnz short .quantloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcsammmx.asm b/simd/jcsammmx.asm index 9e43b2f8..9ab1518f 100644 --- a/simd/jcsammmx.asm +++ b/simd/jcsammmx.asm @@ -19,8 +19,8 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Downsample pixel values of a single component. ; This version handles the common case of 2:1 horizontal and 1:1 vertical, @@ -32,135 +32,135 @@ ; JSAMPARRAY input_data, JSAMPARRAY output_data); ; -%define img_width(b) (b)+8 ; JDIMENSION image_width -%define max_v_samp(b) (b)+12 ; int max_v_samp_factor -%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor -%define width_blks(b) (b)+20 ; JDIMENSION width_blocks -%define input_data(b) (b)+24 ; JSAMPARRAY input_data -%define output_data(b) (b)+28 ; JSAMPARRAY output_data +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v1_downsample_mmx) + align 16 + global EXTN(jsimd_h2v1_downsample_mmx) EXTN(jsimd_h2v1_downsample_mmx): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov ecx, JDIMENSION [width_blks(ebp)] - shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) - jz near .return + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return - mov edx, JDIMENSION [img_width(ebp)] + mov edx, JDIMENSION [img_width(ebp)] - ; -- expand_right_edge + ; -- expand_right_edge - push ecx - shl ecx,1 ; output_cols * 2 - sub ecx,edx - jle short .expand_end + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end - mov eax, INT [max_v_samp(ebp)] - test eax,eax - jle short .expand_end + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end - cld - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - alignx 16,7 + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 .expandloop: - push eax - push ecx + push eax + push ecx - mov edi, JSAMPROW [esi] - add edi,edx - mov al, JSAMPLE [edi-1] + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] - rep stosb + rep stosb - pop ecx - pop eax + pop ecx + pop eax - add esi, byte SIZEOF_JSAMPROW - dec eax - jg short .expandloop + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop .expand_end: - pop ecx ; output_cols + pop ecx ; output_cols - ; -- h2v1_downsample + ; -- h2v1_downsample - mov eax, JDIMENSION [v_samp(ebp)] ; rowctr - test eax,eax - jle near .return + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return - mov edx, 0x00010000 ; bias pattern - movd mm7,edx - pcmpeqw mm6,mm6 - punpckldq mm7,mm7 ; mm7={0, 1, 0, 1} - psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + mov edx, 0x00010000 ; bias pattern + movd mm7,edx + pcmpeqw mm6,mm6 + punpckldq mm7,mm7 ; mm7={0, 1, 0, 1} + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, JSAMPARRAY [output_data(ebp)] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 .rowloop: - push ecx - push edi - push esi + push ecx + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + alignx 16,7 .columnloop: - movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] - movq mm1, MMWORD [esi+1*SIZEOF_MMWORD] - movq mm2,mm0 - movq mm3,mm1 + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm1, MMWORD [esi+1*SIZEOF_MMWORD] + movq mm2,mm0 + movq mm3,mm1 - pand mm0,mm6 - psrlw mm2,BYTE_BIT - pand mm1,mm6 - psrlw mm3,BYTE_BIT + pand mm0,mm6 + psrlw mm2,BYTE_BIT + pand mm1,mm6 + psrlw mm3,BYTE_BIT - paddw mm0,mm2 - paddw mm1,mm3 - paddw mm0,mm7 - paddw mm1,mm7 - psrlw mm0,1 - psrlw mm1,1 + paddw mm0,mm2 + paddw mm1,mm3 + paddw mm0,mm7 + paddw mm1,mm7 + psrlw mm0,1 + psrlw mm1,1 - packuswb mm0,mm1 + packuswb mm0,mm1 - movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 - add esi, byte 2*SIZEOF_MMWORD ; inptr - add edi, byte 1*SIZEOF_MMWORD ; outptr - sub ecx, byte SIZEOF_MMWORD ; outcol - jnz short .columnloop + add esi, byte 2*SIZEOF_MMWORD ; inptr + add edi, byte 1*SIZEOF_MMWORD ; outptr + sub ecx, byte SIZEOF_MMWORD ; outcol + jnz short .columnloop - pop esi - pop edi - pop ecx + pop esi + pop edi + pop ecx - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec eax ; rowctr - jg short .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg short .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -174,151 +174,151 @@ EXTN(jsimd_h2v1_downsample_mmx): ; JSAMPARRAY input_data, JSAMPARRAY output_data); ; -%define img_width(b) (b)+8 ; JDIMENSION image_width -%define max_v_samp(b) (b)+12 ; int max_v_samp_factor -%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor -%define width_blks(b) (b)+20 ; JDIMENSION width_blocks -%define input_data(b) (b)+24 ; JSAMPARRAY input_data -%define output_data(b) (b)+28 ; JSAMPARRAY output_data +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v2_downsample_mmx) + align 16 + global EXTN(jsimd_h2v2_downsample_mmx) EXTN(jsimd_h2v2_downsample_mmx): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov ecx, JDIMENSION [width_blks(ebp)] - shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) - jz near .return + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return - mov edx, JDIMENSION [img_width(ebp)] + mov edx, JDIMENSION [img_width(ebp)] - ; -- expand_right_edge + ; -- expand_right_edge - push ecx - shl ecx,1 ; output_cols * 2 - sub ecx,edx - jle short .expand_end + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end - mov eax, INT [max_v_samp(ebp)] - test eax,eax - jle short .expand_end + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end - cld - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - alignx 16,7 + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 .expandloop: - push eax - push ecx + push eax + push ecx - mov edi, JSAMPROW [esi] - add edi,edx - mov al, JSAMPLE [edi-1] + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] - rep stosb + rep stosb - pop ecx - pop eax + pop ecx + pop eax - add esi, byte SIZEOF_JSAMPROW - dec eax - jg short .expandloop + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop .expand_end: - pop ecx ; output_cols + pop ecx ; output_cols - ; -- h2v2_downsample + ; -- h2v2_downsample - mov eax, JDIMENSION [v_samp(ebp)] ; rowctr - test eax,eax - jle near .return + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return - mov edx, 0x00020001 ; bias pattern - movd mm7,edx - pcmpeqw mm6,mm6 - punpckldq mm7,mm7 ; mm7={1, 2, 1, 2} - psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + mov edx, 0x00020001 ; bias pattern + movd mm7,edx + pcmpeqw mm6,mm6 + punpckldq mm7,mm7 ; mm7={1, 2, 1, 2} + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, JSAMPARRAY [output_data(ebp)] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 .rowloop: - push ecx - push edi - push esi + push ecx + push edi + push esi - mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 - mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 - mov edi, JSAMPROW [edi] ; outptr - alignx 16,7 + mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 + mov edi, JSAMPROW [edi] ; outptr + alignx 16,7 .columnloop: - movq mm0, MMWORD [edx+0*SIZEOF_MMWORD] - movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] - movq mm2, MMWORD [edx+1*SIZEOF_MMWORD] - movq mm3, MMWORD [esi+1*SIZEOF_MMWORD] + movq mm0, MMWORD [edx+0*SIZEOF_MMWORD] + movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm2, MMWORD [edx+1*SIZEOF_MMWORD] + movq mm3, MMWORD [esi+1*SIZEOF_MMWORD] - movq mm4,mm0 - movq mm5,mm1 - pand mm0,mm6 - psrlw mm4,BYTE_BIT - pand mm1,mm6 - psrlw mm5,BYTE_BIT - paddw mm0,mm4 - paddw mm1,mm5 + movq mm4,mm0 + movq mm5,mm1 + pand mm0,mm6 + psrlw mm4,BYTE_BIT + pand mm1,mm6 + psrlw mm5,BYTE_BIT + paddw mm0,mm4 + paddw mm1,mm5 - movq mm4,mm2 - movq mm5,mm3 - pand mm2,mm6 - psrlw mm4,BYTE_BIT - pand mm3,mm6 - psrlw mm5,BYTE_BIT - paddw mm2,mm4 - paddw mm3,mm5 + movq mm4,mm2 + movq mm5,mm3 + pand mm2,mm6 + psrlw mm4,BYTE_BIT + pand mm3,mm6 + psrlw mm5,BYTE_BIT + paddw mm2,mm4 + paddw mm3,mm5 - paddw mm0,mm1 - paddw mm2,mm3 - paddw mm0,mm7 - paddw mm2,mm7 - psrlw mm0,2 - psrlw mm2,2 + paddw mm0,mm1 + paddw mm2,mm3 + paddw mm0,mm7 + paddw mm2,mm7 + psrlw mm0,2 + psrlw mm2,2 - packuswb mm0,mm2 + packuswb mm0,mm2 - movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 - add edx, byte 2*SIZEOF_MMWORD ; inptr0 - add esi, byte 2*SIZEOF_MMWORD ; inptr1 - add edi, byte 1*SIZEOF_MMWORD ; outptr - sub ecx, byte SIZEOF_MMWORD ; outcol - jnz near .columnloop + add edx, byte 2*SIZEOF_MMWORD ; inptr0 + add esi, byte 2*SIZEOF_MMWORD ; inptr1 + add edi, byte 1*SIZEOF_MMWORD ; outptr + sub ecx, byte SIZEOF_MMWORD ; outcol + jnz near .columnloop - pop esi - pop edi - pop ecx + pop esi + pop edi + pop ecx - add esi, byte 2*SIZEOF_JSAMPROW ; input_data - add edi, byte 1*SIZEOF_JSAMPROW ; output_data - dec eax ; rowctr - jg near .rowloop + add esi, byte 2*SIZEOF_JSAMPROW ; input_data + add edi, byte 1*SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcsamss2-64.asm b/simd/jcsamss2-64.asm index 6a16dc5f..6c50d9c5 100644 --- a/simd/jcsamss2-64.asm +++ b/simd/jcsamss2-64.asm @@ -20,8 +20,8 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Downsample pixel values of a single component. ; This version handles the common case of 2:1 horizontal and 1:1 vertical, @@ -40,130 +40,130 @@ ; r14 = JSAMPARRAY input_data ; r15 = JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v1_downsample_sse2) + align 16 + global EXTN(jsimd_h2v1_downsample_sse2) EXTN(jsimd_h2v1_downsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rcx, r13 - shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) - jz near .return + mov rcx, r13 + shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) + jz near .return - mov rdx, r10 + mov rdx, r10 - ; -- expand_right_edge + ; -- expand_right_edge - push rcx - shl rcx,1 ; output_cols * 2 - sub rcx,rdx - jle short .expand_end + push rcx + shl rcx,1 ; output_cols * 2 + sub rcx,rdx + jle short .expand_end - mov rax, r11 - test rax,rax - jle short .expand_end + mov rax, r11 + test rax,rax + jle short .expand_end - cld - mov rsi, r14 ; input_data + cld + mov rsi, r14 ; input_data .expandloop: - push rax - push rcx + push rax + push rcx - mov rdi, JSAMPROW [rsi] - add rdi,rdx - mov al, JSAMPLE [rdi-1] + mov rdi, JSAMPROW [rsi] + add rdi,rdx + mov al, JSAMPLE [rdi-1] - rep stosb + rep stosb - pop rcx - pop rax + pop rcx + pop rax - add rsi, byte SIZEOF_JSAMPROW - dec rax - jg short .expandloop + add rsi, byte SIZEOF_JSAMPROW + dec rax + jg short .expandloop .expand_end: - pop rcx ; output_cols + pop rcx ; output_cols - ; -- h2v1_downsample + ; -- h2v1_downsample - mov rax, r12 ; rowctr - test eax,eax - jle near .return + mov rax, r12 ; rowctr + test eax,eax + jle near .return - mov rdx, 0x00010000 ; bias pattern - movd xmm7,edx - pcmpeqw xmm6,xmm6 - pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + mov rdx, 0x00010000 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - mov rsi, r14 ; input_data - mov rdi, r15 ; output_data + mov rsi, r14 ; input_data + mov rdi, r15 ; output_data .rowloop: - push rcx - push rdi - push rsi + push rcx + push rdi + push rsi - mov rsi, JSAMPROW [rsi] ; inptr - mov rdi, JSAMPROW [rdi] ; outptr + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr - cmp rcx, byte SIZEOF_XMMWORD - jae short .columnloop + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop .columnloop_r8: - movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] - pxor xmm1,xmm1 - mov rcx, SIZEOF_XMMWORD - jmp short .downsample + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + pxor xmm1,xmm1 + mov rcx, SIZEOF_XMMWORD + jmp short .downsample .columnloop: - movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+1*SIZEOF_XMMWORD] .downsample: - movdqa xmm2,xmm0 - movdqa xmm3,xmm1 + movdqa xmm2,xmm0 + movdqa xmm3,xmm1 - pand xmm0,xmm6 - psrlw xmm2,BYTE_BIT - pand xmm1,xmm6 - psrlw xmm3,BYTE_BIT + pand xmm0,xmm6 + psrlw xmm2,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm3,BYTE_BIT - paddw xmm0,xmm2 - paddw xmm1,xmm3 - paddw xmm0,xmm7 - paddw xmm1,xmm7 - psrlw xmm0,1 - psrlw xmm1,1 + paddw xmm0,xmm2 + paddw xmm1,xmm3 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + psrlw xmm0,1 + psrlw xmm1,1 - packuswb xmm0,xmm1 + packuswb xmm0,xmm1 - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 - sub rcx, byte SIZEOF_XMMWORD ; outcol - add rsi, byte 2*SIZEOF_XMMWORD ; inptr - add rdi, byte 1*SIZEOF_XMMWORD ; outptr - cmp rcx, byte SIZEOF_XMMWORD - jae short .columnloop - test rcx,rcx - jnz short .columnloop_r8 + sub rcx, byte SIZEOF_XMMWORD ; outcol + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rdi, byte 1*SIZEOF_XMMWORD ; outptr + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop + test rcx,rcx + jnz short .columnloop_r8 - pop rsi - pop rdi - pop rcx + pop rsi + pop rdi + pop rcx - add rsi, byte SIZEOF_JSAMPROW ; input_data - add rdi, byte SIZEOF_JSAMPROW ; output_data - dec rax ; rowctr - jg near .rowloop + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rax ; rowctr + jg near .rowloop .return: - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -184,147 +184,147 @@ EXTN(jsimd_h2v1_downsample_sse2): ; r14 = JSAMPARRAY input_data ; r15 = JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v2_downsample_sse2) + align 16 + global EXTN(jsimd_h2v2_downsample_sse2) EXTN(jsimd_h2v2_downsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rcx, r13 - shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) - jz near .return + mov rcx, r13 + shl rcx,3 ; imul rcx,DCTSIZE (rcx = output_cols) + jz near .return - mov rdx, r10 + mov rdx, r10 - ; -- expand_right_edge + ; -- expand_right_edge - push rcx - shl rcx,1 ; output_cols * 2 - sub rcx,rdx - jle short .expand_end + push rcx + shl rcx,1 ; output_cols * 2 + sub rcx,rdx + jle short .expand_end - mov rax, r11 - test rax,rax - jle short .expand_end + mov rax, r11 + test rax,rax + jle short .expand_end - cld - mov rsi, r14 ; input_data + cld + mov rsi, r14 ; input_data .expandloop: - push rax - push rcx + push rax + push rcx - mov rdi, JSAMPROW [rsi] - add rdi,rdx - mov al, JSAMPLE [rdi-1] + mov rdi, JSAMPROW [rsi] + add rdi,rdx + mov al, JSAMPLE [rdi-1] - rep stosb + rep stosb - pop rcx - pop rax + pop rcx + pop rax - add rsi, byte SIZEOF_JSAMPROW - dec rax - jg short .expandloop + add rsi, byte SIZEOF_JSAMPROW + dec rax + jg short .expandloop .expand_end: - pop rcx ; output_cols + pop rcx ; output_cols - ; -- h2v2_downsample + ; -- h2v2_downsample - mov rax, r12 ; rowctr - test rax,rax - jle near .return + mov rax, r12 ; rowctr + test rax,rax + jle near .return - mov rdx, 0x00020001 ; bias pattern - movd xmm7,edx - pcmpeqw xmm6,xmm6 - pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + mov rdx, 0x00020001 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - mov rsi, r14 ; input_data - mov rdi, r15 ; output_data + mov rsi, r14 ; input_data + mov rdi, r15 ; output_data .rowloop: - push rcx - push rdi - push rsi + push rcx + push rdi + push rsi - mov rdx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 - mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1 - mov rdi, JSAMPROW [rdi] ; outptr + mov rdx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 + mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1 + mov rdi, JSAMPROW [rdi] ; outptr - cmp rcx, byte SIZEOF_XMMWORD - jae short .columnloop + cmp rcx, byte SIZEOF_XMMWORD + jae short .columnloop .columnloop_r8: - movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] - pxor xmm2,xmm2 - pxor xmm3,xmm3 - mov rcx, SIZEOF_XMMWORD - jmp short .downsample + movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + pxor xmm2,xmm2 + pxor xmm3,xmm3 + mov rcx, SIZEOF_XMMWORD + jmp short .downsample .columnloop: - movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqa xmm2, XMMWORD [rdx+1*SIZEOF_XMMWORD] - movdqa xmm3, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [rdx+1*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [rsi+1*SIZEOF_XMMWORD] .downsample: - movdqa xmm4,xmm0 - movdqa xmm5,xmm1 - pand xmm0,xmm6 - psrlw xmm4,BYTE_BIT - pand xmm1,xmm6 - psrlw xmm5,BYTE_BIT - paddw xmm0,xmm4 - paddw xmm1,xmm5 + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + pand xmm0,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm0,xmm4 + paddw xmm1,xmm5 - movdqa xmm4,xmm2 - movdqa xmm5,xmm3 - pand xmm2,xmm6 - psrlw xmm4,BYTE_BIT - pand xmm3,xmm6 - psrlw xmm5,BYTE_BIT - paddw xmm2,xmm4 - paddw xmm3,xmm5 + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + pand xmm2,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm3,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm2,xmm4 + paddw xmm3,xmm5 - paddw xmm0,xmm1 - paddw xmm2,xmm3 - paddw xmm0,xmm7 - paddw xmm2,xmm7 - psrlw xmm0,2 - psrlw xmm2,2 + paddw xmm0,xmm1 + paddw xmm2,xmm3 + paddw xmm0,xmm7 + paddw xmm2,xmm7 + psrlw xmm0,2 + psrlw xmm2,2 - packuswb xmm0,xmm2 + packuswb xmm0,xmm2 - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 - sub rcx, byte SIZEOF_XMMWORD ; outcol - add rdx, byte 2*SIZEOF_XMMWORD ; inptr0 - add rsi, byte 2*SIZEOF_XMMWORD ; inptr1 - add rdi, byte 1*SIZEOF_XMMWORD ; outptr - cmp rcx, byte SIZEOF_XMMWORD - jae near .columnloop - test rcx,rcx - jnz near .columnloop_r8 + sub rcx, byte SIZEOF_XMMWORD ; outcol + add rdx, byte 2*SIZEOF_XMMWORD ; inptr0 + add rsi, byte 2*SIZEOF_XMMWORD ; inptr1 + add rdi, byte 1*SIZEOF_XMMWORD ; outptr + cmp rcx, byte SIZEOF_XMMWORD + jae near .columnloop + test rcx,rcx + jnz near .columnloop_r8 - pop rsi - pop rdi - pop rcx + pop rsi + pop rdi + pop rcx - add rsi, byte 2*SIZEOF_JSAMPROW ; input_data - add rdi, byte 1*SIZEOF_JSAMPROW ; output_data - dec rax ; rowctr - jg near .rowloop + add rsi, byte 2*SIZEOF_JSAMPROW ; input_data + add rdi, byte 1*SIZEOF_JSAMPROW ; output_data + dec rax ; rowctr + jg near .rowloop .return: - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jcsamss2.asm b/simd/jcsamss2.asm index 818e911d..73618435 100644 --- a/simd/jcsamss2.asm +++ b/simd/jcsamss2.asm @@ -19,8 +19,8 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Downsample pixel values of a single component. ; This version handles the common case of 2:1 horizontal and 1:1 vertical, @@ -32,148 +32,148 @@ ; JSAMPARRAY input_data, JSAMPARRAY output_data); ; -%define img_width(b) (b)+8 ; JDIMENSION image_width -%define max_v_samp(b) (b)+12 ; int max_v_samp_factor -%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor -%define width_blks(b) (b)+20 ; JDIMENSION width_blocks -%define input_data(b) (b)+24 ; JSAMPARRAY input_data -%define output_data(b) (b)+28 ; JSAMPARRAY output_data +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v1_downsample_sse2) + align 16 + global EXTN(jsimd_h2v1_downsample_sse2) EXTN(jsimd_h2v1_downsample_sse2): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov ecx, JDIMENSION [width_blks(ebp)] - shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) - jz near .return + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return - mov edx, JDIMENSION [img_width(ebp)] + mov edx, JDIMENSION [img_width(ebp)] - ; -- expand_right_edge + ; -- expand_right_edge - push ecx - shl ecx,1 ; output_cols * 2 - sub ecx,edx - jle short .expand_end + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end - mov eax, INT [max_v_samp(ebp)] - test eax,eax - jle short .expand_end + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end - cld - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - alignx 16,7 + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 .expandloop: - push eax - push ecx + push eax + push ecx - mov edi, JSAMPROW [esi] - add edi,edx - mov al, JSAMPLE [edi-1] + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] - rep stosb + rep stosb - pop ecx - pop eax + pop ecx + pop eax - add esi, byte SIZEOF_JSAMPROW - dec eax - jg short .expandloop + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop .expand_end: - pop ecx ; output_cols + pop ecx ; output_cols - ; -- h2v1_downsample + ; -- h2v1_downsample - mov eax, JDIMENSION [v_samp(ebp)] ; rowctr - test eax,eax - jle near .return + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return - mov edx, 0x00010000 ; bias pattern - movd xmm7,edx - pcmpeqw xmm6,xmm6 - pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + mov edx, 0x00010000 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={0, 1, 0, 1, 0, 1, 0, 1} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, JSAMPARRAY [output_data(ebp)] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 .rowloop: - push ecx - push edi - push esi + push ecx + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr - cmp ecx, byte SIZEOF_XMMWORD - jae short .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + alignx 16,7 .columnloop_r8: - movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] - pxor xmm1,xmm1 - mov ecx, SIZEOF_XMMWORD - jmp short .downsample - alignx 16,7 + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + pxor xmm1,xmm1 + mov ecx, SIZEOF_XMMWORD + jmp short .downsample + alignx 16,7 .columnloop: - movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+1*SIZEOF_XMMWORD] .downsample: - movdqa xmm2,xmm0 - movdqa xmm3,xmm1 + movdqa xmm2,xmm0 + movdqa xmm3,xmm1 - pand xmm0,xmm6 - psrlw xmm2,BYTE_BIT - pand xmm1,xmm6 - psrlw xmm3,BYTE_BIT + pand xmm0,xmm6 + psrlw xmm2,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm3,BYTE_BIT - paddw xmm0,xmm2 - paddw xmm1,xmm3 - paddw xmm0,xmm7 - paddw xmm1,xmm7 - psrlw xmm0,1 - psrlw xmm1,1 + paddw xmm0,xmm2 + paddw xmm1,xmm3 + paddw xmm0,xmm7 + paddw xmm1,xmm7 + psrlw xmm0,1 + psrlw xmm1,1 - packuswb xmm0,xmm1 + packuswb xmm0,xmm1 - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 - sub ecx, byte SIZEOF_XMMWORD ; outcol - add esi, byte 2*SIZEOF_XMMWORD ; inptr - add edi, byte 1*SIZEOF_XMMWORD ; outptr - cmp ecx, byte SIZEOF_XMMWORD - jae short .columnloop - test ecx,ecx - jnz short .columnloop_r8 + sub ecx, byte SIZEOF_XMMWORD ; outcol + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add edi, byte 1*SIZEOF_XMMWORD ; outptr + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + test ecx,ecx + jnz short .columnloop_r8 - pop esi - pop edi - pop ecx + pop esi + pop edi + pop ecx - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec eax ; rowctr - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -187,165 +187,165 @@ EXTN(jsimd_h2v1_downsample_sse2): ; JSAMPARRAY input_data, JSAMPARRAY output_data); ; -%define img_width(b) (b)+8 ; JDIMENSION image_width -%define max_v_samp(b) (b)+12 ; int max_v_samp_factor -%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor -%define width_blks(b) (b)+20 ; JDIMENSION width_blocks -%define input_data(b) (b)+24 ; JSAMPARRAY input_data -%define output_data(b) (b)+28 ; JSAMPARRAY output_data +%define img_width(b) (b)+8 ; JDIMENSION image_width +%define max_v_samp(b) (b)+12 ; int max_v_samp_factor +%define v_samp(b) (b)+16 ; JDIMENSION v_samp_factor +%define width_blks(b) (b)+20 ; JDIMENSION width_blocks +%define input_data(b) (b)+24 ; JSAMPARRAY input_data +%define output_data(b) (b)+28 ; JSAMPARRAY output_data - align 16 - global EXTN(jsimd_h2v2_downsample_sse2) + align 16 + global EXTN(jsimd_h2v2_downsample_sse2) EXTN(jsimd_h2v2_downsample_sse2): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov ecx, JDIMENSION [width_blks(ebp)] - shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) - jz near .return + mov ecx, JDIMENSION [width_blks(ebp)] + shl ecx,3 ; imul ecx,DCTSIZE (ecx = output_cols) + jz near .return - mov edx, JDIMENSION [img_width(ebp)] + mov edx, JDIMENSION [img_width(ebp)] - ; -- expand_right_edge + ; -- expand_right_edge - push ecx - shl ecx,1 ; output_cols * 2 - sub ecx,edx - jle short .expand_end + push ecx + shl ecx,1 ; output_cols * 2 + sub ecx,edx + jle short .expand_end - mov eax, INT [max_v_samp(ebp)] - test eax,eax - jle short .expand_end + mov eax, INT [max_v_samp(ebp)] + test eax,eax + jle short .expand_end - cld - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - alignx 16,7 + cld + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + alignx 16,7 .expandloop: - push eax - push ecx + push eax + push ecx - mov edi, JSAMPROW [esi] - add edi,edx - mov al, JSAMPLE [edi-1] + mov edi, JSAMPROW [esi] + add edi,edx + mov al, JSAMPLE [edi-1] - rep stosb + rep stosb - pop ecx - pop eax + pop ecx + pop eax - add esi, byte SIZEOF_JSAMPROW - dec eax - jg short .expandloop + add esi, byte SIZEOF_JSAMPROW + dec eax + jg short .expandloop .expand_end: - pop ecx ; output_cols + pop ecx ; output_cols - ; -- h2v2_downsample + ; -- h2v2_downsample - mov eax, JDIMENSION [v_samp(ebp)] ; rowctr - test eax,eax - jle near .return + mov eax, JDIMENSION [v_samp(ebp)] ; rowctr + test eax,eax + jle near .return - mov edx, 0x00020001 ; bias pattern - movd xmm7,edx - pcmpeqw xmm6,xmm6 - pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + mov edx, 0x00020001 ; bias pattern + movd xmm7,edx + pcmpeqw xmm6,xmm6 + pshufd xmm7,xmm7,0x00 ; xmm7={1, 2, 1, 2, 1, 2, 1, 2} + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, JSAMPARRAY [output_data(ebp)] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, JSAMPARRAY [output_data(ebp)] ; output_data + alignx 16,7 .rowloop: - push ecx - push edi - push esi + push ecx + push edi + push esi - mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 - mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 - mov edi, JSAMPROW [edi] ; outptr + mov edx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1 + mov edi, JSAMPROW [edi] ; outptr - cmp ecx, byte SIZEOF_XMMWORD - jae short .columnloop - alignx 16,7 + cmp ecx, byte SIZEOF_XMMWORD + jae short .columnloop + alignx 16,7 .columnloop_r8: - movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] - pxor xmm2,xmm2 - pxor xmm3,xmm3 - mov ecx, SIZEOF_XMMWORD - jmp short .downsample - alignx 16,7 + movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + pxor xmm2,xmm2 + pxor xmm3,xmm3 + mov ecx, SIZEOF_XMMWORD + jmp short .downsample + alignx 16,7 .columnloop: - movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] - movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqa xmm2, XMMWORD [edx+1*SIZEOF_XMMWORD] - movdqa xmm3, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [edx+1*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [esi+1*SIZEOF_XMMWORD] .downsample: - movdqa xmm4,xmm0 - movdqa xmm5,xmm1 - pand xmm0,xmm6 - psrlw xmm4,BYTE_BIT - pand xmm1,xmm6 - psrlw xmm5,BYTE_BIT - paddw xmm0,xmm4 - paddw xmm1,xmm5 + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + pand xmm0,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm1,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm0,xmm4 + paddw xmm1,xmm5 - movdqa xmm4,xmm2 - movdqa xmm5,xmm3 - pand xmm2,xmm6 - psrlw xmm4,BYTE_BIT - pand xmm3,xmm6 - psrlw xmm5,BYTE_BIT - paddw xmm2,xmm4 - paddw xmm3,xmm5 + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + pand xmm2,xmm6 + psrlw xmm4,BYTE_BIT + pand xmm3,xmm6 + psrlw xmm5,BYTE_BIT + paddw xmm2,xmm4 + paddw xmm3,xmm5 - paddw xmm0,xmm1 - paddw xmm2,xmm3 - paddw xmm0,xmm7 - paddw xmm2,xmm7 - psrlw xmm0,2 - psrlw xmm2,2 + paddw xmm0,xmm1 + paddw xmm2,xmm3 + paddw xmm0,xmm7 + paddw xmm2,xmm7 + psrlw xmm0,2 + psrlw xmm2,2 - packuswb xmm0,xmm2 + packuswb xmm0,xmm2 - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 - sub ecx, byte SIZEOF_XMMWORD ; outcol - add edx, byte 2*SIZEOF_XMMWORD ; inptr0 - add esi, byte 2*SIZEOF_XMMWORD ; inptr1 - add edi, byte 1*SIZEOF_XMMWORD ; outptr - cmp ecx, byte SIZEOF_XMMWORD - jae near .columnloop - test ecx,ecx - jnz near .columnloop_r8 + sub ecx, byte SIZEOF_XMMWORD ; outcol + add edx, byte 2*SIZEOF_XMMWORD ; inptr0 + add esi, byte 2*SIZEOF_XMMWORD ; inptr1 + add edi, byte 1*SIZEOF_XMMWORD ; outptr + cmp ecx, byte SIZEOF_XMMWORD + jae near .columnloop + test ecx,ecx + jnz near .columnloop_r8 - pop esi - pop edi - pop ecx + pop esi + pop edi + pop ecx - add esi, byte 2*SIZEOF_JSAMPROW ; input_data - add edi, byte 1*SIZEOF_JSAMPROW ; output_data - dec eax ; rowctr - jg near .rowloop + add esi, byte 2*SIZEOF_JSAMPROW ; input_data + add edi, byte 1*SIZEOF_JSAMPROW ; output_data + dec eax ; rowctr + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdclrmmx.asm b/simd/jdclrmmx.asm index 1c255e80..bb1d2fa0 100644 --- a/simd/jdclrmmx.asm +++ b/simd/jdclrmmx.asm @@ -28,378 +28,378 @@ ; JSAMPARRAY output_buf, int num_rows) ; -%define out_width(b) (b)+8 ; JDIMENSION out_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define input_row(b) (b)+16 ; JDIMENSION input_row -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define num_rows(b) (b)+24 ; int num_rows +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_ycc_rgb_convert_mmx) + align 16 + global EXTN(jsimd_ycc_rgb_convert_mmx) EXTN(jsimd_ycc_rgb_convert_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [out_width(eax)] ; num_cols - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return - push ecx + push ecx - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [input_row(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov edi, JSAMPARRAY [output_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - push eax - push edi - push edx - push ebx - push esi - push ecx ; col + push eax + push edi + push edx + push ebx + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr0 - mov ebx, JSAMPROW [ebx] ; inptr1 - mov edx, JSAMPROW [edx] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - movpic eax, POINTER [gotptr] ; load GOT address (eax) - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 .columnloop: - movq mm5, MMWORD [ebx] ; mm5=Cb(01234567) - movq mm1, MMWORD [edx] ; mm1=Cr(01234567) + movq mm5, MMWORD [ebx] ; mm5=Cb(01234567) + movq mm1, MMWORD [edx] ; mm1=Cr(01234567) - pcmpeqw mm4,mm4 - pcmpeqw mm7,mm7 - psrlw mm4,BYTE_BIT - psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} - movq mm0,mm4 ; mm0=mm4={0xFF 0x00 0xFF 0x00 ..} + pcmpeqw mm4,mm4 + pcmpeqw mm7,mm7 + psrlw mm4,BYTE_BIT + psllw mm7,7 ; mm7={0xFF80 0xFF80 0xFF80 0xFF80} + movq mm0,mm4 ; mm0=mm4={0xFF 0x00 0xFF 0x00 ..} - pand mm4,mm5 ; mm4=Cb(0246)=CbE - psrlw mm5,BYTE_BIT ; mm5=Cb(1357)=CbO - pand mm0,mm1 ; mm0=Cr(0246)=CrE - psrlw mm1,BYTE_BIT ; mm1=Cr(1357)=CrO + pand mm4,mm5 ; mm4=Cb(0246)=CbE + psrlw mm5,BYTE_BIT ; mm5=Cb(1357)=CbO + pand mm0,mm1 ; mm0=Cr(0246)=CrE + psrlw mm1,BYTE_BIT ; mm1=Cr(1357)=CrO - paddw mm4,mm7 - paddw mm5,mm7 - paddw mm0,mm7 - paddw mm1,mm7 + paddw mm4,mm7 + paddw mm5,mm7 + paddw mm0,mm7 + paddw mm1,mm7 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movq mm2,mm4 ; mm2=CbE - movq mm3,mm5 ; mm3=CbO - paddw mm4,mm4 ; mm4=2*CbE - paddw mm5,mm5 ; mm5=2*CbO - movq mm6,mm0 ; mm6=CrE - movq mm7,mm1 ; mm7=CrO - paddw mm0,mm0 ; mm0=2*CrE - paddw mm1,mm1 ; mm1=2*CrO + movq mm2,mm4 ; mm2=CbE + movq mm3,mm5 ; mm3=CbO + paddw mm4,mm4 ; mm4=2*CbE + paddw mm5,mm5 ; mm5=2*CbO + movq mm6,mm0 ; mm6=CrE + movq mm7,mm1 ; mm7=CrO + paddw mm0,mm0 ; mm0=2*CrE + paddw mm1,mm1 ; mm1=2*CrO - pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbE * -FIX(0.22800)) - pmulhw mm5,[GOTOFF(eax,PW_MF0228)] ; mm5=(2*CbO * -FIX(0.22800)) - pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrE * FIX(0.40200)) - pmulhw mm1,[GOTOFF(eax,PW_F0402)] ; mm1=(2*CrO * FIX(0.40200)) + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbE * -FIX(0.22800)) + pmulhw mm5,[GOTOFF(eax,PW_MF0228)] ; mm5=(2*CbO * -FIX(0.22800)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrE * FIX(0.40200)) + pmulhw mm1,[GOTOFF(eax,PW_F0402)] ; mm1=(2*CrO * FIX(0.40200)) - paddw mm4,[GOTOFF(eax,PW_ONE)] - paddw mm5,[GOTOFF(eax,PW_ONE)] - psraw mm4,1 ; mm4=(CbE * -FIX(0.22800)) - psraw mm5,1 ; mm5=(CbO * -FIX(0.22800)) - paddw mm0,[GOTOFF(eax,PW_ONE)] - paddw mm1,[GOTOFF(eax,PW_ONE)] - psraw mm0,1 ; mm0=(CrE * FIX(0.40200)) - psraw mm1,1 ; mm1=(CrO * FIX(0.40200)) + paddw mm4,[GOTOFF(eax,PW_ONE)] + paddw mm5,[GOTOFF(eax,PW_ONE)] + psraw mm4,1 ; mm4=(CbE * -FIX(0.22800)) + psraw mm5,1 ; mm5=(CbO * -FIX(0.22800)) + paddw mm0,[GOTOFF(eax,PW_ONE)] + paddw mm1,[GOTOFF(eax,PW_ONE)] + psraw mm0,1 ; mm0=(CrE * FIX(0.40200)) + psraw mm1,1 ; mm1=(CrO * FIX(0.40200)) - paddw mm4,mm2 - paddw mm5,mm3 - paddw mm4,mm2 ; mm4=(CbE * FIX(1.77200))=(B-Y)E - paddw mm5,mm3 ; mm5=(CbO * FIX(1.77200))=(B-Y)O - paddw mm0,mm6 ; mm0=(CrE * FIX(1.40200))=(R-Y)E - paddw mm1,mm7 ; mm1=(CrO * FIX(1.40200))=(R-Y)O + paddw mm4,mm2 + paddw mm5,mm3 + paddw mm4,mm2 ; mm4=(CbE * FIX(1.77200))=(B-Y)E + paddw mm5,mm3 ; mm5=(CbO * FIX(1.77200))=(B-Y)O + paddw mm0,mm6 ; mm0=(CrE * FIX(1.40200))=(R-Y)E + paddw mm1,mm7 ; mm1=(CrO * FIX(1.40200))=(R-Y)O - movq MMWORD [wk(0)], mm4 ; wk(0)=(B-Y)E - movq MMWORD [wk(1)], mm5 ; wk(1)=(B-Y)O + movq MMWORD [wk(0)], mm4 ; wk(0)=(B-Y)E + movq MMWORD [wk(1)], mm5 ; wk(1)=(B-Y)O - movq mm4,mm2 - movq mm5,mm3 - punpcklwd mm2,mm6 - punpckhwd mm4,mm6 - pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm4,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd mm3,mm7 - punpckhwd mm5,mm7 - pmaddwd mm3,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + movq mm4,mm2 + movq mm5,mm3 + punpcklwd mm2,mm6 + punpckhwd mm4,mm6 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm3,mm7 + punpckhwd mm5,mm7 + pmaddwd mm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] - paddd mm2,[GOTOFF(eax,PD_ONEHALF)] - paddd mm4,[GOTOFF(eax,PD_ONEHALF)] - psrad mm2,SCALEBITS - psrad mm4,SCALEBITS - paddd mm3,[GOTOFF(eax,PD_ONEHALF)] - paddd mm5,[GOTOFF(eax,PD_ONEHALF)] - psrad mm3,SCALEBITS - psrad mm5,SCALEBITS + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm4,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm4,SCALEBITS + paddd mm3,[GOTOFF(eax,PD_ONEHALF)] + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + psrad mm3,SCALEBITS + psrad mm5,SCALEBITS - packssdw mm2,mm4 ; mm2=CbE*-FIX(0.344)+CrE*FIX(0.285) - packssdw mm3,mm5 ; mm3=CbO*-FIX(0.344)+CrO*FIX(0.285) - psubw mm2,mm6 ; mm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E - psubw mm3,mm7 ; mm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + packssdw mm2,mm4 ; mm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw mm3,mm5 ; mm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw mm2,mm6 ; mm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw mm3,mm7 ; mm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O - movq mm5, MMWORD [esi] ; mm5=Y(01234567) + movq mm5, MMWORD [esi] ; mm5=Y(01234567) - pcmpeqw mm4,mm4 - psrlw mm4,BYTE_BIT ; mm4={0xFF 0x00 0xFF 0x00 ..} - pand mm4,mm5 ; mm4=Y(0246)=YE - psrlw mm5,BYTE_BIT ; mm5=Y(1357)=YO + pcmpeqw mm4,mm4 + psrlw mm4,BYTE_BIT ; mm4={0xFF 0x00 0xFF 0x00 ..} + pand mm4,mm5 ; mm4=Y(0246)=YE + psrlw mm5,BYTE_BIT ; mm5=Y(1357)=YO - paddw mm0,mm4 ; mm0=((R-Y)E+YE)=RE=(R0 R2 R4 R6) - paddw mm1,mm5 ; mm1=((R-Y)O+YO)=RO=(R1 R3 R5 R7) - packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) - packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + paddw mm0,mm4 ; mm0=((R-Y)E+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm5 ; mm1=((R-Y)O+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) - paddw mm2,mm4 ; mm2=((G-Y)E+YE)=GE=(G0 G2 G4 G6) - paddw mm3,mm5 ; mm3=((G-Y)O+YO)=GO=(G1 G3 G5 G7) - packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) - packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + paddw mm2,mm4 ; mm2=((G-Y)E+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm5 ; mm3=((G-Y)O+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) - paddw mm4, MMWORD [wk(0)] ; mm4=(YE+(B-Y)E)=BE=(B0 B2 B4 B6) - paddw mm5, MMWORD [wk(1)] ; mm5=(YO+(B-Y)O)=BO=(B1 B3 B5 B7) - packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) - packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + paddw mm4, MMWORD [wk(0)] ; mm4=(YE+(B-Y)E)=BE=(B0 B2 B4 B6) + paddw mm5, MMWORD [wk(1)] ; mm5=(YO+(B-Y)O)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) %if RGB_PIXELSIZE == 3 ; --------------- - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) - punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) - movq mmG,mmA - movq mmH,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) - punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) - psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) - psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) - movq mmC,mmD - movq mmB,mmD - punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) - punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) - psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) - movq mmF,mmE - punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) - punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) - punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) - punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) - punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - sub ecx, byte SIZEOF_MMWORD - jz short .nextrow + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow - add esi, byte SIZEOF_MMWORD ; inptr0 - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - jmp near .columnloop - alignx 16,7 + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 .column_st16: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_MMWORD - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq mmA,mmC - sub ecx, byte 2*SIZEOF_MMWORD - add edi, byte 2*SIZEOF_MMWORD - jmp short .column_st4 + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 .column_st8: - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmE - sub ecx, byte SIZEOF_MMWORD - add edi, byte SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD .column_st4: - movd eax,mmA - cmp ecx, byte SIZEOF_DWORD - jb short .column_st2 - mov DWORD [edi+0*SIZEOF_DWORD], eax - psrlq mmA,DWORD_BIT - movd eax,mmA - sub ecx, byte SIZEOF_DWORD - add edi, byte SIZEOF_DWORD + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD .column_st2: - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi+0*SIZEOF_WORD], ax - shr eax,WORD_BIT - sub ecx, byte SIZEOF_WORD - add edi, byte SIZEOF_WORD + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD .column_st1: - cmp ecx, byte SIZEOF_BYTE - jb short .nextrow - mov BYTE [edi+0*SIZEOF_BYTE], al + cmp ecx, byte SIZEOF_BYTE + jb short .nextrow + mov BYTE [edi+0*SIZEOF_BYTE], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) %else - pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) %endif - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) - punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) - punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) - movq mmC,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) - punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) - movq mmG,mmB - punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) - punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) - movq mmD,mmA - punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) - punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) - movq mmH,mmC - punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) - punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH - sub ecx, byte SIZEOF_MMWORD - jz short .nextrow + sub ecx, byte SIZEOF_MMWORD + jz short .nextrow - add esi, byte SIZEOF_MMWORD ; inptr0 - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - jmp near .columnloop - alignx 16,7 + add esi, byte SIZEOF_MMWORD ; inptr0 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + jmp near .columnloop + alignx 16,7 .column_st16: - cmp ecx, byte SIZEOF_MMWORD/2 - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq mmA,mmC - movq mmD,mmH - sub ecx, byte SIZEOF_MMWORD/2 - add edi, byte 2*SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD .column_st8: - cmp ecx, byte SIZEOF_MMWORD/4 - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmD - sub ecx, byte SIZEOF_MMWORD/4 - add edi, byte 1*SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD .column_st4: - cmp ecx, byte SIZEOF_MMWORD/8 - jb short .nextrow - movd DWORD [edi+0*SIZEOF_DWORD], mmA + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .nextrow + movd DWORD [edi+0*SIZEOF_DWORD], mmA %endif ; RGB_PIXELSIZE ; --------------- - alignx 16,7 + alignx 16,7 .nextrow: - pop ecx - pop esi - pop ebx - pop edx - pop edi - pop eax + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax - add esi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - add edi, byte SIZEOF_JSAMPROW ; output_buf - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm index 7d17c52b..88a9f1e4 100644 --- a/simd/jdclrss2-64.asm +++ b/simd/jdclrss2-64.asm @@ -18,7 +18,7 @@ ; [TAB8] %include "jcolsamp.inc" - + ; -------------------------------------------------------------------------- ; ; Convert some rows of samples to the output colorspace. @@ -35,407 +35,407 @@ ; r13 = JSAMPARRAY output_buf ; r14 = int num_rows -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_ycc_rgb_convert_sse2) + align 16 + global EXTN(jsimd_ycc_rgb_convert_sse2) EXTN(jsimd_ycc_rgb_convert_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + push rbx - mov rcx, r10 ; num_cols - test rcx,rcx - jz near .return + mov rcx, r10 ; num_cols + test rcx,rcx + jz near .return - push rcx + push rcx - mov rdi, r11 - mov rcx, r12 - mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] - mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] - mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] - lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] - lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] - lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] + lea rbx, [rbx+rcx*SIZEOF_JSAMPROW] + lea rdx, [rdx+rcx*SIZEOF_JSAMPROW] - pop rcx + pop rcx - mov rdi, r13 - mov eax, r14d - test rax,rax - jle near .return + mov rdi, r13 + mov eax, r14d + test rax,rax + jle near .return .rowloop: - push rax - push rdi - push rdx - push rbx - push rsi - push rcx ; col + push rax + push rdi + push rdx + push rbx + push rsi + push rcx ; col - mov rsi, JSAMPROW [rsi] ; inptr0 - mov rbx, JSAMPROW [rbx] ; inptr1 - mov rdx, JSAMPROW [rdx] ; inptr2 - mov rdi, JSAMPROW [rdi] ; outptr + mov rsi, JSAMPROW [rsi] ; inptr0 + mov rbx, JSAMPROW [rbx] ; inptr1 + mov rdx, JSAMPROW [rdx] ; inptr2 + mov rdi, JSAMPROW [rdi] ; outptr .columnloop: - movdqa xmm5, XMMWORD [rbx] ; xmm5=Cb(0123456789ABCDEF) - movdqa xmm1, XMMWORD [rdx] ; xmm1=Cr(0123456789ABCDEF) + movdqa xmm5, XMMWORD [rbx] ; xmm5=Cb(0123456789ABCDEF) + movdqa xmm1, XMMWORD [rdx] ; xmm1=Cr(0123456789ABCDEF) - pcmpeqw xmm4,xmm4 - pcmpeqw xmm7,xmm7 - psrlw xmm4,BYTE_BIT - psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} - movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} + pcmpeqw xmm4,xmm4 + pcmpeqw xmm7,xmm7 + psrlw xmm4,BYTE_BIT + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} - pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE - psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO - pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE - psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO + pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE + psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO + pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE + psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO - paddw xmm4,xmm7 - paddw xmm5,xmm7 - paddw xmm0,xmm7 - paddw xmm1,xmm7 + paddw xmm4,xmm7 + paddw xmm5,xmm7 + paddw xmm0,xmm7 + paddw xmm1,xmm7 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movdqa xmm2,xmm4 ; xmm2=CbE - movdqa xmm3,xmm5 ; xmm3=CbO - paddw xmm4,xmm4 ; xmm4=2*CbE - paddw xmm5,xmm5 ; xmm5=2*CbO - movdqa xmm6,xmm0 ; xmm6=CrE - movdqa xmm7,xmm1 ; xmm7=CrO - paddw xmm0,xmm0 ; xmm0=2*CrE - paddw xmm1,xmm1 ; xmm1=2*CrO + movdqa xmm2,xmm4 ; xmm2=CbE + movdqa xmm3,xmm5 ; xmm3=CbO + paddw xmm4,xmm4 ; xmm4=2*CbE + paddw xmm5,xmm5 ; xmm5=2*CbO + movdqa xmm6,xmm0 ; xmm6=CrE + movdqa xmm7,xmm1 ; xmm7=CrO + paddw xmm0,xmm0 ; xmm0=2*CrE + paddw xmm1,xmm1 ; xmm1=2*CrO - pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbE * -FIX(0.22800)) - pmulhw xmm5,[rel PW_MF0228] ; xmm5=(2*CbO * -FIX(0.22800)) - pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrE * FIX(0.40200)) - pmulhw xmm1,[rel PW_F0402] ; xmm1=(2*CrO * FIX(0.40200)) + pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[rel PW_MF0228] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[rel PW_F0402] ; xmm1=(2*CrO * FIX(0.40200)) - paddw xmm4,[rel PW_ONE] - paddw xmm5,[rel PW_ONE] - psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) - psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) - paddw xmm0,[rel PW_ONE] - paddw xmm1,[rel PW_ONE] - psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) - psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) + paddw xmm4,[rel PW_ONE] + paddw xmm5,[rel PW_ONE] + psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) + psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) + paddw xmm0,[rel PW_ONE] + paddw xmm1,[rel PW_ONE] + psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) + psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) - paddw xmm4,xmm2 - paddw xmm5,xmm3 - paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E - paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O - paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E - paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O + paddw xmm4,xmm2 + paddw xmm5,xmm3 + paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E + paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O + paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E + paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O - movdqa xmm4,xmm2 - movdqa xmm5,xmm3 - punpcklwd xmm2,xmm6 - punpckhwd xmm4,xmm6 - pmaddwd xmm2,[rel PW_MF0344_F0285] - pmaddwd xmm4,[rel PW_MF0344_F0285] - punpcklwd xmm3,xmm7 - punpckhwd xmm5,xmm7 - pmaddwd xmm3,[rel PW_MF0344_F0285] - pmaddwd xmm5,[rel PW_MF0344_F0285] + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + punpcklwd xmm2,xmm6 + punpckhwd xmm4,xmm6 + pmaddwd xmm2,[rel PW_MF0344_F0285] + pmaddwd xmm4,[rel PW_MF0344_F0285] + punpcklwd xmm3,xmm7 + punpckhwd xmm5,xmm7 + pmaddwd xmm3,[rel PW_MF0344_F0285] + pmaddwd xmm5,[rel PW_MF0344_F0285] - paddd xmm2,[rel PD_ONEHALF] - paddd xmm4,[rel PD_ONEHALF] - psrad xmm2,SCALEBITS - psrad xmm4,SCALEBITS - paddd xmm3,[rel PD_ONEHALF] - paddd xmm5,[rel PD_ONEHALF] - psrad xmm3,SCALEBITS - psrad xmm5,SCALEBITS + paddd xmm2,[rel PD_ONEHALF] + paddd xmm4,[rel PD_ONEHALF] + psrad xmm2,SCALEBITS + psrad xmm4,SCALEBITS + paddd xmm3,[rel PD_ONEHALF] + paddd xmm5,[rel PD_ONEHALF] + psrad xmm3,SCALEBITS + psrad xmm5,SCALEBITS - packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) - packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) - psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E - psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O - movdqa xmm5, XMMWORD [rsi] ; xmm5=Y(0123456789ABCDEF) + movdqa xmm5, XMMWORD [rsi] ; xmm5=Y(0123456789ABCDEF) - pcmpeqw xmm4,xmm4 - psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} - pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE - psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO + pcmpeqw xmm4,xmm4 + psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} + pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE + psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO - paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) - paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) + paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) - paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) + paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) - paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) + paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) %if RGB_PIXELSIZE == 3 ; --------------- - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 - test rdi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF .out0: - add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub rcx, byte SIZEOF_XMMWORD - jz near .nextrow + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .nextrow - add rsi, byte SIZEOF_XMMWORD ; inptr0 - add rbx, byte SIZEOF_XMMWORD ; inptr1 - add rdx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop + add rsi, byte SIZEOF_XMMWORD ; inptr0 + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop .column_st32: - lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE - cmp rcx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - add rdi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub rcx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 + lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub rcx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 .column_st16: - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st15 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - add rdi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub rcx, byte SIZEOF_XMMWORD + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD .column_st15: - ; Store the lower 8 bytes of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_MMWORD - jb short .column_st7 - movq XMM_MMWORD [rdi], xmmA - add rdi, byte SIZEOF_MMWORD - sub rcx, byte SIZEOF_MMWORD - psrldq xmmA, SIZEOF_MMWORD + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + movq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD .column_st7: - ; Store the lower 4 bytes of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_DWORD - jb short .column_st3 - movd XMM_DWORD [rdi], xmmA - add rdi, byte SIZEOF_DWORD - sub rcx, byte SIZEOF_DWORD - psrldq xmmA, SIZEOF_DWORD + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + movd XMM_DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD .column_st3: - ; Store the lower 2 bytes of rax to the output when it has enough - ; space. - movd eax, xmmA - cmp rcx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [rdi], ax - add rdi, byte SIZEOF_WORD - sub rcx, byte SIZEOF_WORD - shr rax, 16 + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + movd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 .column_st1: - ; Store the lower 1 byte of rax to the output when it has enough - ; space. - test rcx, rcx - jz short .nextrow - mov BYTE [rdi], al + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .nextrow + mov BYTE [rdi], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 - test rdi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC - movdqu XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movdqu XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH .out0: - add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub rcx, byte SIZEOF_XMMWORD - jz near .nextrow + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .nextrow - add rsi, byte SIZEOF_XMMWORD ; inptr0 - add rbx, byte SIZEOF_XMMWORD ; inptr1 - add rdx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop + add rsi, byte SIZEOF_XMMWORD ; inptr0 + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop .column_st32: - cmp rcx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - add rdi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub rcx, byte SIZEOF_XMMWORD/2 + cmp rcx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub rcx, byte SIZEOF_XMMWORD/2 .column_st16: - cmp rcx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - add rdi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub rcx, byte SIZEOF_XMMWORD/4 + cmp rcx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD/4 .column_st15: - ; Store two pixels (8 bytes) of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_XMMWORD/8 - jb short .column_st7 - movq MMWORD [rdi], xmmA - add rdi, byte SIZEOF_XMMWORD/8*4 - sub rcx, byte SIZEOF_XMMWORD/8 - psrldq xmmA, SIZEOF_XMMWORD/8*4 + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD/8*4 + sub rcx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 .column_st7: - ; Store one pixel (4 bytes) of xmmA to the output when it has enough - ; space. - test rcx, rcx - jz short .nextrow - movd XMM_DWORD [rdi], xmmA + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test rcx, rcx + jz short .nextrow + movd XMM_DWORD [rdi], xmmA %endif ; RGB_PIXELSIZE ; --------------- .nextrow: - pop rcx - pop rsi - pop rbx - pop rdx - pop rdi - pop rax + pop rcx + pop rsi + pop rbx + pop rdx + pop rdi + pop rax - add rsi, byte SIZEOF_JSAMPROW - add rbx, byte SIZEOF_JSAMPROW - add rdx, byte SIZEOF_JSAMPROW - add rdi, byte SIZEOF_JSAMPROW ; output_buf - dec rax ; num_rows - jg near .rowloop + add rsi, byte SIZEOF_JSAMPROW + add rbx, byte SIZEOF_JSAMPROW + add rdx, byte SIZEOF_JSAMPROW + add rdi, byte SIZEOF_JSAMPROW ; output_buf + dec rax ; num_rows + jg near .rowloop - sfence ; flush the write buffer + sfence ; flush the write buffer .return: - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm index 97754cb4..07b4fcf4 100644 --- a/simd/jdclrss2.asm +++ b/simd/jdclrss2.asm @@ -18,7 +18,7 @@ ; [TAB8] %include "jcolsamp.inc" - + ; -------------------------------------------------------------------------- ; ; Convert some rows of samples to the output colorspace. @@ -29,432 +29,432 @@ ; JSAMPARRAY output_buf, int num_rows) ; -%define out_width(b) (b)+8 ; JDIMENSION out_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define input_row(b) (b)+16 ; JDIMENSION input_row -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define num_rows(b) (b)+24 ; int num_rows +%define out_width(b) (b)+8 ; JDIMENSION out_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define input_row(b) (b)+16 ; JDIMENSION input_row +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define num_rows(b) (b)+24 ; int num_rows -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_ycc_rgb_convert_sse2) + align 16 + global EXTN(jsimd_ycc_rgb_convert_sse2) EXTN(jsimd_ycc_rgb_convert_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [out_width(eax)] ; num_cols - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [out_width(eax)] ; num_cols + test ecx,ecx + jz near .return - push ecx + push ecx - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [input_row(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] - lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] - lea edx, [edx+ecx*SIZEOF_JSAMPROW] + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [input_row(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] + lea ebx, [ebx+ecx*SIZEOF_JSAMPROW] + lea edx, [edx+ecx*SIZEOF_JSAMPROW] - pop ecx + pop ecx - mov edi, JSAMPARRAY [output_buf(eax)] - mov eax, INT [num_rows(eax)] - test eax,eax - jle near .return - alignx 16,7 + mov edi, JSAMPARRAY [output_buf(eax)] + mov eax, INT [num_rows(eax)] + test eax,eax + jle near .return + alignx 16,7 .rowloop: - push eax - push edi - push edx - push ebx - push esi - push ecx ; col + push eax + push edi + push edx + push ebx + push esi + push ecx ; col - mov esi, JSAMPROW [esi] ; inptr0 - mov ebx, JSAMPROW [ebx] ; inptr1 - mov edx, JSAMPROW [edx] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr - movpic eax, POINTER [gotptr] ; load GOT address (eax) - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr0 + mov ebx, JSAMPROW [ebx] ; inptr1 + mov edx, JSAMPROW [edx] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr + movpic eax, POINTER [gotptr] ; load GOT address (eax) + alignx 16,7 .columnloop: - movdqa xmm5, XMMWORD [ebx] ; xmm5=Cb(0123456789ABCDEF) - movdqa xmm1, XMMWORD [edx] ; xmm1=Cr(0123456789ABCDEF) + movdqa xmm5, XMMWORD [ebx] ; xmm5=Cb(0123456789ABCDEF) + movdqa xmm1, XMMWORD [edx] ; xmm1=Cr(0123456789ABCDEF) - pcmpeqw xmm4,xmm4 - pcmpeqw xmm7,xmm7 - psrlw xmm4,BYTE_BIT - psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} - movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} + pcmpeqw xmm4,xmm4 + pcmpeqw xmm7,xmm7 + psrlw xmm4,BYTE_BIT + psllw xmm7,7 ; xmm7={0xFF80 0xFF80 0xFF80 0xFF80 ..} + movdqa xmm0,xmm4 ; xmm0=xmm4={0xFF 0x00 0xFF 0x00 ..} - pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE - psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO - pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE - psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO + pand xmm4,xmm5 ; xmm4=Cb(02468ACE)=CbE + psrlw xmm5,BYTE_BIT ; xmm5=Cb(13579BDF)=CbO + pand xmm0,xmm1 ; xmm0=Cr(02468ACE)=CrE + psrlw xmm1,BYTE_BIT ; xmm1=Cr(13579BDF)=CrO - paddw xmm4,xmm7 - paddw xmm5,xmm7 - paddw xmm0,xmm7 - paddw xmm1,xmm7 + paddw xmm4,xmm7 + paddw xmm5,xmm7 + paddw xmm0,xmm7 + paddw xmm1,xmm7 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movdqa xmm2,xmm4 ; xmm2=CbE - movdqa xmm3,xmm5 ; xmm3=CbO - paddw xmm4,xmm4 ; xmm4=2*CbE - paddw xmm5,xmm5 ; xmm5=2*CbO - movdqa xmm6,xmm0 ; xmm6=CrE - movdqa xmm7,xmm1 ; xmm7=CrO - paddw xmm0,xmm0 ; xmm0=2*CrE - paddw xmm1,xmm1 ; xmm1=2*CrO + movdqa xmm2,xmm4 ; xmm2=CbE + movdqa xmm3,xmm5 ; xmm3=CbO + paddw xmm4,xmm4 ; xmm4=2*CbE + paddw xmm5,xmm5 ; xmm5=2*CbO + movdqa xmm6,xmm0 ; xmm6=CrE + movdqa xmm7,xmm1 ; xmm7=CrO + paddw xmm0,xmm0 ; xmm0=2*CrE + paddw xmm1,xmm1 ; xmm1=2*CrO - pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbE * -FIX(0.22800)) - pmulhw xmm5,[GOTOFF(eax,PW_MF0228)] ; xmm5=(2*CbO * -FIX(0.22800)) - pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrE * FIX(0.40200)) - pmulhw xmm1,[GOTOFF(eax,PW_F0402)] ; xmm1=(2*CrO * FIX(0.40200)) + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbE * -FIX(0.22800)) + pmulhw xmm5,[GOTOFF(eax,PW_MF0228)] ; xmm5=(2*CbO * -FIX(0.22800)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrE * FIX(0.40200)) + pmulhw xmm1,[GOTOFF(eax,PW_F0402)] ; xmm1=(2*CrO * FIX(0.40200)) - paddw xmm4,[GOTOFF(eax,PW_ONE)] - paddw xmm5,[GOTOFF(eax,PW_ONE)] - psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) - psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) - paddw xmm0,[GOTOFF(eax,PW_ONE)] - paddw xmm1,[GOTOFF(eax,PW_ONE)] - psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) - psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) + paddw xmm4,[GOTOFF(eax,PW_ONE)] + paddw xmm5,[GOTOFF(eax,PW_ONE)] + psraw xmm4,1 ; xmm4=(CbE * -FIX(0.22800)) + psraw xmm5,1 ; xmm5=(CbO * -FIX(0.22800)) + paddw xmm0,[GOTOFF(eax,PW_ONE)] + paddw xmm1,[GOTOFF(eax,PW_ONE)] + psraw xmm0,1 ; xmm0=(CrE * FIX(0.40200)) + psraw xmm1,1 ; xmm1=(CrO * FIX(0.40200)) - paddw xmm4,xmm2 - paddw xmm5,xmm3 - paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E - paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O - paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E - paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O + paddw xmm4,xmm2 + paddw xmm5,xmm3 + paddw xmm4,xmm2 ; xmm4=(CbE * FIX(1.77200))=(B-Y)E + paddw xmm5,xmm3 ; xmm5=(CbO * FIX(1.77200))=(B-Y)O + paddw xmm0,xmm6 ; xmm0=(CrE * FIX(1.40200))=(R-Y)E + paddw xmm1,xmm7 ; xmm1=(CrO * FIX(1.40200))=(R-Y)O - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=(B-Y)E + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(B-Y)O - movdqa xmm4,xmm2 - movdqa xmm5,xmm3 - punpcklwd xmm2,xmm6 - punpckhwd xmm4,xmm6 - pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm4,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd xmm3,xmm7 - punpckhwd xmm5,xmm7 - pmaddwd xmm3,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + movdqa xmm4,xmm2 + movdqa xmm5,xmm3 + punpcklwd xmm2,xmm6 + punpckhwd xmm4,xmm6 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm4,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm3,xmm7 + punpckhwd xmm5,xmm7 + pmaddwd xmm3,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] - paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm4,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm2,SCALEBITS - psrad xmm4,SCALEBITS - paddd xmm3,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm3,SCALEBITS - psrad xmm5,SCALEBITS + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm4,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm4,SCALEBITS + paddd xmm3,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm3,SCALEBITS + psrad xmm5,SCALEBITS - packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) - packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) - psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E - psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O + packssdw xmm2,xmm4 ; xmm2=CbE*-FIX(0.344)+CrE*FIX(0.285) + packssdw xmm3,xmm5 ; xmm3=CbO*-FIX(0.344)+CrO*FIX(0.285) + psubw xmm2,xmm6 ; xmm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E + psubw xmm3,xmm7 ; xmm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O - movdqa xmm5, XMMWORD [esi] ; xmm5=Y(0123456789ABCDEF) + movdqa xmm5, XMMWORD [esi] ; xmm5=Y(0123456789ABCDEF) - pcmpeqw xmm4,xmm4 - psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} - pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE - psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO + pcmpeqw xmm4,xmm4 + psrlw xmm4,BYTE_BIT ; xmm4={0xFF 0x00 0xFF 0x00 ..} + pand xmm4,xmm5 ; xmm4=Y(02468ACE)=YE + psrlw xmm5,BYTE_BIT ; xmm5=Y(13579BDF)=YO - paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) - paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + paddw xmm0,xmm4 ; xmm0=((R-Y)E+YE)=RE=R(02468ACE) + paddw xmm1,xmm5 ; xmm1=((R-Y)O+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) - paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + paddw xmm2,xmm4 ; xmm2=((G-Y)E+YE)=GE=G(02468ACE) + paddw xmm3,xmm5 ; xmm3=((G-Y)O+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) - paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + paddw xmm4, XMMWORD [wk(0)] ; xmm4=(YE+(B-Y)E)=BE=B(02468ACE) + paddw xmm5, XMMWORD [wk(1)] ; xmm5=(YO+(B-Y)O)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) %if RGB_PIXELSIZE == 3 ; --------------- - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF .out0: - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub ecx, byte SIZEOF_XMMWORD - jz near .nextrow + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow - add esi, byte SIZEOF_XMMWORD ; inptr0 - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st32: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - add edi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub ecx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + add edi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 .column_st16: - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st15 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD .column_st15: - ; Store the lower 8 bytes of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st7 - movq XMM_MMWORD [edi], xmmA - add edi, byte SIZEOF_MMWORD - sub ecx, byte SIZEOF_MMWORD - psrldq xmmA, SIZEOF_MMWORD + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st7 + movq XMM_MMWORD [edi], xmmA + add edi, byte SIZEOF_MMWORD + sub ecx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD .column_st7: - ; Store the lower 4 bytes of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_DWORD - jb short .column_st3 - movd XMM_DWORD [edi], xmmA - add edi, byte SIZEOF_DWORD - sub ecx, byte SIZEOF_DWORD - psrldq xmmA, SIZEOF_DWORD + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_DWORD + jb short .column_st3 + movd XMM_DWORD [edi], xmmA + add edi, byte SIZEOF_DWORD + sub ecx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD .column_st3: - ; Store the lower 2 bytes of eax to the output when it has enough - ; space. - movd eax, xmmA - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi], ax - add edi, byte SIZEOF_WORD - sub ecx, byte SIZEOF_WORD - shr eax, 16 + ; Store the lower 2 bytes of eax to the output when it has enough + ; space. + movd eax, xmmA + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi], ax + add edi, byte SIZEOF_WORD + sub ecx, byte SIZEOF_WORD + shr eax, 16 .column_st1: - ; Store the lower 1 byte of eax to the output when it has enough - ; space. - test ecx, ecx - jz short .nextrow - mov BYTE [edi], al + ; Store the lower 1 byte of eax to the output when it has enough + ; space. + test ecx, ecx + jz short .nextrow + mov BYTE [edi], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movdqu XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movdqu XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH .out0: - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub ecx, byte SIZEOF_XMMWORD - jz near .nextrow + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub ecx, byte SIZEOF_XMMWORD + jz near .nextrow - add esi, byte SIZEOF_XMMWORD ; inptr0 - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add esi, byte SIZEOF_XMMWORD ; inptr0 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st32: - cmp ecx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - add edi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub ecx, byte SIZEOF_XMMWORD/2 + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + add edi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 .column_st16: - cmp ecx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD/4 + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 .column_st15: - ; Store two pixels (8 bytes) of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_XMMWORD/8 - jb short .column_st7 - movq XMM_MMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD/8*4 - sub ecx, byte SIZEOF_XMMWORD/8 - psrldq xmmA, SIZEOF_XMMWORD/8*4 + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq XMM_MMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD/8*4 + sub ecx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 .column_st7: - ; Store one pixel (4 bytes) of xmmA to the output when it has enough - ; space. - test ecx, ecx - jz short .nextrow - movd XMM_DWORD [edi], xmmA + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test ecx, ecx + jz short .nextrow + movd XMM_DWORD [edi], xmmA %endif ; RGB_PIXELSIZE ; --------------- - alignx 16,7 + alignx 16,7 .nextrow: - pop ecx - pop esi - pop ebx - pop edx - pop edi - pop eax + pop ecx + pop esi + pop ebx + pop edx + pop edi + pop eax - add esi, byte SIZEOF_JSAMPROW - add ebx, byte SIZEOF_JSAMPROW - add edx, byte SIZEOF_JSAMPROW - add edi, byte SIZEOF_JSAMPROW ; output_buf - dec eax ; num_rows - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW + add ebx, byte SIZEOF_JSAMPROW + add edx, byte SIZEOF_JSAMPROW + add edi, byte SIZEOF_JSAMPROW ; output_buf + dec eax ; num_rows + jg near .rowloop - sfence ; flush the write buffer + sfence ; flush the write buffer .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm index 5e4e47d4..d2966fe2 100644 --- a/simd/jdcolmmx.asm +++ b/simd/jdcolmmx.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_ycc_rgb_convert_mmx) + alignz 16 + global EXTN(jconst_ycc_rgb_convert_mmx) EXTN(jconst_ycc_rgb_convert_mmx): -PW_F0402 times 4 dw F_0_402 -PW_MF0228 times 4 dw -F_0_228 -PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 -PW_ONE times 4 dw 1 -PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) +PW_F0402 times 4 dw F_0_402 +PW_MF0228 times 4 dw -F_0_228 +PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 +PW_ONE times 4 dw 1 +PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jdclrmmx.asm" diff --git a/simd/jdcolss2-64.asm b/simd/jdcolss2-64.asm index 01b3dce6..b484618d 100644 --- a/simd/jdcolss2-64.asm +++ b/simd/jdcolss2-64.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_ycc_rgb_convert_sse2) + alignz 16 + global EXTN(jconst_ycc_rgb_convert_sse2) EXTN(jconst_ycc_rgb_convert_sse2): -PW_F0402 times 8 dw F_0_402 -PW_MF0228 times 8 dw -F_0_228 -PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 -PW_ONE times 8 dw 1 -PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 %include "jdclrss2-64.asm" diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm index 1912d92e..38ed4164 100644 --- a/simd/jdcolss2.asm +++ b/simd/jdcolss2.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_ycc_rgb_convert_sse2) + alignz 16 + global EXTN(jconst_ycc_rgb_convert_sse2) EXTN(jconst_ycc_rgb_convert_sse2): -PW_F0402 times 8 dw F_0_402 -PW_MF0228 times 8 dw -F_0_228 -PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 -PW_ONE times 8 dw 1 -PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jdclrss2.asm" diff --git a/simd/jdct.inc b/simd/jdct.inc index cc627042..ad5890c6 100644 --- a/simd/jdct.inc +++ b/simd/jdct.inc @@ -18,11 +18,11 @@ ; %define RANGE_MASK (MAXJSAMPLE * 4 + 3) ; 2 bits wider than legal samples -%define ROW(n,b,s) ((b)+(n)*(s)) -%define COL(n,b,s) ((b)+(n)*(s)*DCTSIZE) +%define ROW(n,b,s) ((b)+(n)*(s)) +%define COL(n,b,s) ((b)+(n)*(s)*DCTSIZE) -%define DWBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_DWORD) -%define MMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_MMWORD) -%define XMMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_XMMWORD) +%define DWBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_DWORD) +%define MMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_MMWORD) +%define XMMBLOCK(m,n,b,s) ((b)+(m)*DCTSIZE*(s)+(n)*SIZEOF_XMMWORD) ; -------------------------------------------------------------------------- diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm index 7b86c749..c2093c2c 100644 --- a/simd/jdmermmx.asm +++ b/simd/jdmermmx.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_merged_upsample_mmx) + alignz 16 + global EXTN(jconst_merged_upsample_mmx) EXTN(jconst_merged_upsample_mmx): -PW_F0402 times 4 dw F_0_402 -PW_MF0228 times 4 dw -F_0_228 -PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 -PW_ONE times 4 dw 1 -PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) +PW_F0402 times 4 dw F_0_402 +PW_MF0228 times 4 dw -F_0_228 +PW_MF0344_F0285 times 2 dw -F_0_344, F_0_285 +PW_ONE times 4 dw 1 +PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jdmrgmmx.asm" diff --git a/simd/jdmerss2-64.asm b/simd/jdmerss2-64.asm index a184ea69..1f0b3398 100644 --- a/simd/jdmerss2-64.asm +++ b/simd/jdmerss2-64.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_merged_upsample_sse2) + alignz 16 + global EXTN(jconst_merged_upsample_sse2) EXTN(jconst_merged_upsample_sse2): -PW_F0402 times 8 dw F_0_402 -PW_MF0228 times 8 dw -F_0_228 -PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 -PW_ONE times 8 dw 1 -PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 %include "jdmrgss2-64.asm" diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm index e536c802..60d0ebb7 100644 --- a/simd/jdmerss2.asm +++ b/simd/jdmerss2.asm @@ -21,35 +21,35 @@ ; -------------------------------------------------------------------------- -%define SCALEBITS 16 +%define SCALEBITS 16 -F_0_344 equ 22554 ; FIX(0.34414) -F_0_714 equ 46802 ; FIX(0.71414) -F_1_402 equ 91881 ; FIX(1.40200) -F_1_772 equ 116130 ; FIX(1.77200) -F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) -F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) -F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) +F_0_344 equ 22554 ; FIX(0.34414) +F_0_714 equ 46802 ; FIX(0.71414) +F_1_402 equ 91881 ; FIX(1.40200) +F_1_772 equ 116130 ; FIX(1.77200) +F_0_402 equ (F_1_402 - 65536) ; FIX(1.40200) - FIX(1) +F_0_285 equ ( 65536 - F_0_714) ; FIX(1) - FIX(0.71414) +F_0_228 equ (131072 - F_1_772) ; FIX(2) - FIX(1.77200) ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_merged_upsample_sse2) + alignz 16 + global EXTN(jconst_merged_upsample_sse2) EXTN(jconst_merged_upsample_sse2): -PW_F0402 times 8 dw F_0_402 -PW_MF0228 times 8 dw -F_0_228 -PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 -PW_ONE times 8 dw 1 -PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) +PW_F0402 times 8 dw F_0_402 +PW_MF0228 times 8 dw -F_0_228 +PW_MF0344_F0285 times 4 dw -F_0_344, F_0_285 +PW_ONE times 8 dw 1 +PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 %include "jdmrgss2.asm" diff --git a/simd/jdmrgmmx.asm b/simd/jdmrgmmx.asm index d0800a73..136f12cf 100644 --- a/simd/jdmrgmmx.asm +++ b/simd/jdmrgmmx.asm @@ -29,368 +29,368 @@ ; JSAMPARRAY output_buf); ; -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 3 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_h2v1_merged_upsample_mmx) + align 16 + global EXTN(jsimd_h2v1_merged_upsample_mmx) EXTN(jsimd_h2v1_merged_upsample_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [output_width(eax)] ; col - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return - push ecx + push ecx - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [in_row_group_ctr(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(eax)] - mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 - mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 - mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr - pop ecx ; col + pop ecx ; col - alignx 16,7 + alignx 16,7 .columnloop: - movpic eax, POINTER [gotptr] ; load GOT address (eax) + movpic eax, POINTER [gotptr] ; load GOT address (eax) - movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) - movq mm7, MMWORD [edx] ; mm7=Cr(01234567) + movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) + movq mm7, MMWORD [edx] ; mm7=Cr(01234567) - pxor mm1,mm1 ; mm1=(all 0's) - pcmpeqw mm3,mm3 - psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} + pxor mm1,mm1 ; mm1=(all 0's) + pcmpeqw mm3,mm3 + psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} - movq mm4,mm6 - punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH - punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL - movq mm0,mm7 - punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH - punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL + movq mm4,mm6 + punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH + punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL + movq mm0,mm7 + punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH + punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL - paddw mm6,mm3 - paddw mm4,mm3 - paddw mm7,mm3 - paddw mm0,mm3 + paddw mm6,mm3 + paddw mm4,mm3 + paddw mm7,mm3 + paddw mm0,mm3 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movq mm5,mm6 ; mm5=CbH - movq mm2,mm4 ; mm2=CbL - paddw mm6,mm6 ; mm6=2*CbH - paddw mm4,mm4 ; mm4=2*CbL - movq mm1,mm7 ; mm1=CrH - movq mm3,mm0 ; mm3=CrL - paddw mm7,mm7 ; mm7=2*CrH - paddw mm0,mm0 ; mm0=2*CrL + movq mm5,mm6 ; mm5=CbH + movq mm2,mm4 ; mm2=CbL + paddw mm6,mm6 ; mm6=2*CbH + paddw mm4,mm4 ; mm4=2*CbL + movq mm1,mm7 ; mm1=CrH + movq mm3,mm0 ; mm3=CrL + paddw mm7,mm7 ; mm7=2*CrH + paddw mm0,mm0 ; mm0=2*CrL - pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) - pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) - pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) - pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) + pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) + pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) + pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) + pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) - paddw mm6,[GOTOFF(eax,PW_ONE)] - paddw mm4,[GOTOFF(eax,PW_ONE)] - psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) - psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) - paddw mm7,[GOTOFF(eax,PW_ONE)] - paddw mm0,[GOTOFF(eax,PW_ONE)] - psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) - psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) + paddw mm6,[GOTOFF(eax,PW_ONE)] + paddw mm4,[GOTOFF(eax,PW_ONE)] + psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) + psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) + paddw mm7,[GOTOFF(eax,PW_ONE)] + paddw mm0,[GOTOFF(eax,PW_ONE)] + psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) + psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) - paddw mm6,mm5 - paddw mm4,mm2 - paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H - paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L - paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H - paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L + paddw mm6,mm5 + paddw mm4,mm2 + paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H + paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L + paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H + paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L - movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H - movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H + movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H + movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H - movq mm6,mm5 - movq mm7,mm2 - punpcklwd mm5,mm1 - punpckhwd mm6,mm1 - pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd mm2,mm3 - punpckhwd mm7,mm3 - pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] + movq mm6,mm5 + movq mm7,mm2 + punpcklwd mm5,mm1 + punpckhwd mm6,mm1 + pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd mm2,mm3 + punpckhwd mm7,mm3 + pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] - paddd mm5,[GOTOFF(eax,PD_ONEHALF)] - paddd mm6,[GOTOFF(eax,PD_ONEHALF)] - psrad mm5,SCALEBITS - psrad mm6,SCALEBITS - paddd mm2,[GOTOFF(eax,PD_ONEHALF)] - paddd mm7,[GOTOFF(eax,PD_ONEHALF)] - psrad mm2,SCALEBITS - psrad mm7,SCALEBITS + paddd mm5,[GOTOFF(eax,PD_ONEHALF)] + paddd mm6,[GOTOFF(eax,PD_ONEHALF)] + psrad mm5,SCALEBITS + psrad mm6,SCALEBITS + paddd mm2,[GOTOFF(eax,PD_ONEHALF)] + paddd mm7,[GOTOFF(eax,PD_ONEHALF)] + psrad mm2,SCALEBITS + psrad mm7,SCALEBITS - packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) - packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) - psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H - psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L - movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H + movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H - mov al,2 ; Yctr - jmp short .Yloop_1st - alignx 16,7 + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 .Yloop_2nd: - movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H - movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H - movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H - alignx 16,7 + movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H + movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H + movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H + alignx 16,7 .Yloop_1st: - movq mm7, MMWORD [esi] ; mm7=Y(01234567) + movq mm7, MMWORD [esi] ; mm7=Y(01234567) - pcmpeqw mm6,mm6 - psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} - pand mm6,mm7 ; mm6=Y(0246)=YE - psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO + pcmpeqw mm6,mm6 + psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} + pand mm6,mm7 ; mm6=Y(0246)=YE + psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO - movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) - movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) - movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) + movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) + movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) + movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) - paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) - paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) - packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) - packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) + paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) + paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) + packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) + packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) - paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) - paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) - packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) - packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) + paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) + paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) + packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) + packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) - paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) - paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) - packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) - packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) + paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) + paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) + packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) + packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) %if RGB_PIXELSIZE == 3 ; --------------- - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) - punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) + punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) - movq mmG,mmA - movq mmH,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) - punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) + movq mmG,mmA + movq mmH,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) + punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) - psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) - psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) + psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) + psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) - movq mmC,mmD - movq mmB,mmD - punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) - punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) + movq mmC,mmD + movq mmB,mmD + punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) + punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) - psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) + psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) - movq mmF,mmE - punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) - punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) + movq mmF,mmE + punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) + punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) - punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) - punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) - punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) + punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) + punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) + punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - sub ecx, byte SIZEOF_MMWORD - jz near .endcolumn + sub ecx, byte SIZEOF_MMWORD + jz near .endcolumn - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - add esi, byte SIZEOF_MMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st16: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_MMWORD - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmE - movq mmA,mmC - sub ecx, byte 2*SIZEOF_MMWORD - add edi, byte 2*SIZEOF_MMWORD - jmp short .column_st4 + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_MMWORD + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmE + movq mmA,mmC + sub ecx, byte 2*SIZEOF_MMWORD + add edi, byte 2*SIZEOF_MMWORD + jmp short .column_st4 .column_st8: - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmE - sub ecx, byte SIZEOF_MMWORD - add edi, byte SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmE + sub ecx, byte SIZEOF_MMWORD + add edi, byte SIZEOF_MMWORD .column_st4: - movd eax,mmA - cmp ecx, byte SIZEOF_DWORD - jb short .column_st2 - mov DWORD [edi+0*SIZEOF_DWORD], eax - psrlq mmA,DWORD_BIT - movd eax,mmA - sub ecx, byte SIZEOF_DWORD - add edi, byte SIZEOF_DWORD + movd eax,mmA + cmp ecx, byte SIZEOF_DWORD + jb short .column_st2 + mov DWORD [edi+0*SIZEOF_DWORD], eax + psrlq mmA,DWORD_BIT + movd eax,mmA + sub ecx, byte SIZEOF_DWORD + add edi, byte SIZEOF_DWORD .column_st2: - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi+0*SIZEOF_WORD], ax - shr eax,WORD_BIT - sub ecx, byte SIZEOF_WORD - add edi, byte SIZEOF_WORD + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi+0*SIZEOF_WORD], ax + shr eax,WORD_BIT + sub ecx, byte SIZEOF_WORD + add edi, byte SIZEOF_WORD .column_st1: - cmp ecx, byte SIZEOF_BYTE - jb short .endcolumn - mov BYTE [edi+0*SIZEOF_BYTE], al + cmp ecx, byte SIZEOF_BYTE + jb short .endcolumn + mov BYTE [edi+0*SIZEOF_BYTE], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) + pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) %else - pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) - pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) + pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) + pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) %endif - ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) - ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) - ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) - ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) + ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) + ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) + ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) + ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) - punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) - punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) - punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) - punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) + punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) + punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) + punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) + punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) - movq mmC,mmA - punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) - punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) - movq mmG,mmB - punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) - punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) + movq mmC,mmA + punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) + punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) + movq mmG,mmB + punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) + punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) - movq mmD,mmA - punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) - punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) - movq mmH,mmC - punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) - punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) + movq mmD,mmA + punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) + punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) + movq mmH,mmC + punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) + punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st16 + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st16 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq MMWORD [edi+2*SIZEOF_MMWORD], mmC - movq MMWORD [edi+3*SIZEOF_MMWORD], mmH + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq MMWORD [edi+2*SIZEOF_MMWORD], mmC + movq MMWORD [edi+3*SIZEOF_MMWORD], mmH - sub ecx, byte SIZEOF_MMWORD - jz short .endcolumn + sub ecx, byte SIZEOF_MMWORD + jz short .endcolumn - add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr - add esi, byte SIZEOF_MMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr + add esi, byte SIZEOF_MMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add ebx, byte SIZEOF_MMWORD ; inptr1 - add edx, byte SIZEOF_MMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add ebx, byte SIZEOF_MMWORD ; inptr1 + add edx, byte SIZEOF_MMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st16: - cmp ecx, byte SIZEOF_MMWORD/2 - jb short .column_st8 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq MMWORD [edi+1*SIZEOF_MMWORD], mmD - movq mmA,mmC - movq mmD,mmH - sub ecx, byte SIZEOF_MMWORD/2 - add edi, byte 2*SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD/2 + jb short .column_st8 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq MMWORD [edi+1*SIZEOF_MMWORD], mmD + movq mmA,mmC + movq mmD,mmH + sub ecx, byte SIZEOF_MMWORD/2 + add edi, byte 2*SIZEOF_MMWORD .column_st8: - cmp ecx, byte SIZEOF_MMWORD/4 - jb short .column_st4 - movq MMWORD [edi+0*SIZEOF_MMWORD], mmA - movq mmA,mmD - sub ecx, byte SIZEOF_MMWORD/4 - add edi, byte 1*SIZEOF_MMWORD + cmp ecx, byte SIZEOF_MMWORD/4 + jb short .column_st4 + movq MMWORD [edi+0*SIZEOF_MMWORD], mmA + movq mmA,mmD + sub ecx, byte SIZEOF_MMWORD/4 + add edi, byte 1*SIZEOF_MMWORD .column_st4: - cmp ecx, byte SIZEOF_MMWORD/8 - jb short .endcolumn - movd DWORD [edi+0*SIZEOF_DWORD], mmA + cmp ecx, byte SIZEOF_MMWORD/8 + jb short .endcolumn + movd DWORD [edi+0*SIZEOF_DWORD], mmA %endif ; RGB_PIXELSIZE ; --------------- .endcolumn: - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -403,62 +403,62 @@ EXTN(jsimd_h2v1_merged_upsample_mmx): ; JSAMPARRAY output_buf); ; -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - align 16 - global EXTN(jsimd_h2v2_merged_upsample_mmx) + align 16 + global EXTN(jsimd_h2v2_merged_upsample_mmx) EXTN(jsimd_h2v2_merged_upsample_mmx): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov eax, JDIMENSION [output_width(ebp)] + mov eax, JDIMENSION [output_width(ebp)] - mov edi, JSAMPIMAGE [input_buf(ebp)] - mov ecx, JDIMENSION [in_row_group_ctr(ebp)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(ebp)] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] - push edx ; inptr2 - push ebx ; inptr1 - push esi ; inptr00 - mov ebx,esp + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp - push edi ; output_buf (outptr0) - push ecx ; in_row_group_ctr - push ebx ; input_buf - push eax ; output_width + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width - call near EXTN(jsimd_h2v1_merged_upsample_mmx) + call near EXTN(jsimd_h2v1_merged_upsample_mmx) - add esi, byte SIZEOF_JSAMPROW ; inptr01 - add edi, byte SIZEOF_JSAMPROW ; outptr1 - mov POINTER [ebx+0*SIZEOF_POINTER], esi - mov POINTER [ebx-1*SIZEOF_POINTER], edi + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi - call near EXTN(jsimd_h2v1_merged_upsample_mmx) + call near EXTN(jsimd_h2v1_merged_upsample_mmx) - add esp, byte 7*SIZEOF_DWORD + add esp, byte 7*SIZEOF_DWORD - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm index ffbf6b25..d0e1ea70 100644 --- a/simd/jdmrgss2-64.asm +++ b/simd/jdmrgss2-64.asm @@ -18,7 +18,7 @@ ; [TAB8] %include "jcolsamp.inc" - + ; -------------------------------------------------------------------------- ; ; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. @@ -35,399 +35,399 @@ ; r12 = JDIMENSION in_row_group_ctr ; r13 = JSAMPARRAY output_buf -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 3 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 - align 16 - global EXTN(jsimd_h2v1_merged_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_merged_upsample_sse2) EXTN(jsimd_h2v1_merged_upsample_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + push rbx - mov rcx, r10 ; col - test rcx,rcx - jz near .return + mov rcx, r10 ; col + test rcx,rcx + jz near .return - push rcx + push rcx - mov rdi, r11 - mov rcx, r12 - mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] - mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] - mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] - mov rdi, r13 - mov rsi, JSAMPROW [rsi+rcx*SIZEOF_JSAMPROW] ; inptr0 - mov rbx, JSAMPROW [rbx+rcx*SIZEOF_JSAMPROW] ; inptr1 - mov rdx, JSAMPROW [rdx+rcx*SIZEOF_JSAMPROW] ; inptr2 - mov rdi, JSAMPROW [rdi] ; outptr + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + mov rdi, r13 + mov rsi, JSAMPROW [rsi+rcx*SIZEOF_JSAMPROW] ; inptr0 + mov rbx, JSAMPROW [rbx+rcx*SIZEOF_JSAMPROW] ; inptr1 + mov rdx, JSAMPROW [rdx+rcx*SIZEOF_JSAMPROW] ; inptr2 + mov rdi, JSAMPROW [rdi] ; outptr - pop rcx ; col + pop rcx ; col .columnloop: - movdqa xmm6, XMMWORD [rbx] ; xmm6=Cb(0123456789ABCDEF) - movdqa xmm7, XMMWORD [rdx] ; xmm7=Cr(0123456789ABCDEF) + movdqa xmm6, XMMWORD [rbx] ; xmm6=Cb(0123456789ABCDEF) + movdqa xmm7, XMMWORD [rdx] ; xmm7=Cr(0123456789ABCDEF) - pxor xmm1,xmm1 ; xmm1=(all 0's) - pcmpeqw xmm3,xmm3 - psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} + pxor xmm1,xmm1 ; xmm1=(all 0's) + pcmpeqw xmm3,xmm3 + psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} - movdqa xmm4,xmm6 - punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH - punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL - movdqa xmm0,xmm7 - punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH - punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL + movdqa xmm4,xmm6 + punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH + punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL + movdqa xmm0,xmm7 + punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH + punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL - paddw xmm6,xmm3 - paddw xmm4,xmm3 - paddw xmm7,xmm3 - paddw xmm0,xmm3 + paddw xmm6,xmm3 + paddw xmm4,xmm3 + paddw xmm7,xmm3 + paddw xmm0,xmm3 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movdqa xmm5,xmm6 ; xmm5=CbH - movdqa xmm2,xmm4 ; xmm2=CbL - paddw xmm6,xmm6 ; xmm6=2*CbH - paddw xmm4,xmm4 ; xmm4=2*CbL - movdqa xmm1,xmm7 ; xmm1=CrH - movdqa xmm3,xmm0 ; xmm3=CrL - paddw xmm7,xmm7 ; xmm7=2*CrH - paddw xmm0,xmm0 ; xmm0=2*CrL + movdqa xmm5,xmm6 ; xmm5=CbH + movdqa xmm2,xmm4 ; xmm2=CbL + paddw xmm6,xmm6 ; xmm6=2*CbH + paddw xmm4,xmm4 ; xmm4=2*CbL + movdqa xmm1,xmm7 ; xmm1=CrH + movdqa xmm3,xmm0 ; xmm3=CrL + paddw xmm7,xmm7 ; xmm7=2*CrH + paddw xmm0,xmm0 ; xmm0=2*CrL - pmulhw xmm6,[rel PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800)) - pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800)) - pmulhw xmm7,[rel PW_F0402] ; xmm7=(2*CrH * FIX(0.40200)) - pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrL * FIX(0.40200)) + pmulhw xmm6,[rel PW_MF0228] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[rel PW_MF0228] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[rel PW_F0402] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[rel PW_F0402] ; xmm0=(2*CrL * FIX(0.40200)) - paddw xmm6,[rel PW_ONE] - paddw xmm4,[rel PW_ONE] - psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) - psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) - paddw xmm7,[rel PW_ONE] - paddw xmm0,[rel PW_ONE] - psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) - psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) + paddw xmm6,[rel PW_ONE] + paddw xmm4,[rel PW_ONE] + psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) + psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) + paddw xmm7,[rel PW_ONE] + paddw xmm0,[rel PW_ONE] + psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) + psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) - paddw xmm6,xmm5 - paddw xmm4,xmm2 - paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H - paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L - paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H - paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L + paddw xmm6,xmm5 + paddw xmm4,xmm2 + paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H + paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L + paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H + paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H - movdqa xmm6,xmm5 - movdqa xmm7,xmm2 - punpcklwd xmm5,xmm1 - punpckhwd xmm6,xmm1 - pmaddwd xmm5,[rel PW_MF0344_F0285] - pmaddwd xmm6,[rel PW_MF0344_F0285] - punpcklwd xmm2,xmm3 - punpckhwd xmm7,xmm3 - pmaddwd xmm2,[rel PW_MF0344_F0285] - pmaddwd xmm7,[rel PW_MF0344_F0285] + movdqa xmm6,xmm5 + movdqa xmm7,xmm2 + punpcklwd xmm5,xmm1 + punpckhwd xmm6,xmm1 + pmaddwd xmm5,[rel PW_MF0344_F0285] + pmaddwd xmm6,[rel PW_MF0344_F0285] + punpcklwd xmm2,xmm3 + punpckhwd xmm7,xmm3 + pmaddwd xmm2,[rel PW_MF0344_F0285] + pmaddwd xmm7,[rel PW_MF0344_F0285] - paddd xmm5,[rel PD_ONEHALF] - paddd xmm6,[rel PD_ONEHALF] - psrad xmm5,SCALEBITS - psrad xmm6,SCALEBITS - paddd xmm2,[rel PD_ONEHALF] - paddd xmm7,[rel PD_ONEHALF] - psrad xmm2,SCALEBITS - psrad xmm7,SCALEBITS + paddd xmm5,[rel PD_ONEHALF] + paddd xmm6,[rel PD_ONEHALF] + psrad xmm5,SCALEBITS + psrad xmm6,SCALEBITS + paddd xmm2,[rel PD_ONEHALF] + paddd xmm7,[rel PD_ONEHALF] + psrad xmm2,SCALEBITS + psrad xmm7,SCALEBITS - packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) - packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) - psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H - psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L - movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H + movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H - mov al,2 ; Yctr - jmp short .Yloop_1st + mov al,2 ; Yctr + jmp short .Yloop_1st .Yloop_2nd: - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H - movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H .Yloop_1st: - movdqa xmm7, XMMWORD [rsi] ; xmm7=Y(0123456789ABCDEF) + movdqa xmm7, XMMWORD [rsi] ; xmm7=Y(0123456789ABCDEF) - pcmpeqw xmm6,xmm6 - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE - psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO + pcmpeqw xmm6,xmm6 + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE + psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO - movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) - movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) - movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) + movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) + movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) + movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) - paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) - paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) + paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) - paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) + paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) - paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) + paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) %if RGB_PIXELSIZE == 3 ; --------------- - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 - test rdi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmF .out0: - add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub rcx, byte SIZEOF_XMMWORD - jz near .endcolumn + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn - add rsi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add rbx, byte SIZEOF_XMMWORD ; inptr1 - add rdx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop .column_st32: - lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE - cmp rcx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - add rdi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub rcx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 + lea rcx, [rcx+rcx*2] ; imul ecx, RGB_PIXELSIZE + cmp rcx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub rcx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 .column_st16: - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st15 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - add rdi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub rcx, byte SIZEOF_XMMWORD + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st15 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD .column_st15: - ; Store the lower 8 bytes of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_MMWORD - jb short .column_st7 - movq XMM_MMWORD [rdi], xmmA - add rdi, byte SIZEOF_MMWORD - sub rcx, byte SIZEOF_MMWORD - psrldq xmmA, SIZEOF_MMWORD + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + movq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD .column_st7: - ; Store the lower 4 bytes of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_DWORD - jb short .column_st3 - movd XMM_DWORD [rdi], xmmA - add rdi, byte SIZEOF_DWORD - sub rcx, byte SIZEOF_DWORD - psrldq xmmA, SIZEOF_DWORD + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + movd XMM_DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD .column_st3: - ; Store the lower 2 bytes of rax to the output when it has enough - ; space. - movd eax, xmmA - cmp rcx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [rdi], ax - add rdi, byte SIZEOF_WORD - sub rcx, byte SIZEOF_WORD - shr rax, 16 + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + movd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 .column_st1: - ; Store the lower 1 byte of rax to the output when it has enough - ; space. - test rcx, rcx - jz short .endcolumn - mov BYTE [rdi], al + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + mov BYTE [rdi], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - cmp rcx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp rcx, byte SIZEOF_XMMWORD + jb short .column_st32 - test rdi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC - movdqu XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + test rdi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [rdi+2*SIZEOF_XMMWORD], xmmC + movdqu XMMWORD [rdi+3*SIZEOF_XMMWORD], xmmH .out0: - add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub rcx, byte SIZEOF_XMMWORD - jz near .endcolumn + add rdi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub rcx, byte SIZEOF_XMMWORD + jz near .endcolumn - add rsi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add rsi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add rbx, byte SIZEOF_XMMWORD ; inptr1 - add rdx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop + add rbx, byte SIZEOF_XMMWORD ; inptr1 + add rdx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop .column_st32: - cmp rcx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD - add rdi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub rcx, byte SIZEOF_XMMWORD/2 + cmp rcx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [rdi+1*SIZEOF_XMMWORD], xmmD + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub rcx, byte SIZEOF_XMMWORD/2 .column_st16: - cmp rcx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA - add rdi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub rcx, byte SIZEOF_XMMWORD/4 + cmp rcx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + movdqu XMMWORD [rdi+0*SIZEOF_XMMWORD], xmmA + add rdi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub rcx, byte SIZEOF_XMMWORD/4 .column_st15: - ; Store two pixels (8 bytes) of xmmA to the output when it has enough - ; space. - cmp rcx, byte SIZEOF_XMMWORD/8 - jb short .column_st7 - movq XMM_MMWORD [rdi], xmmA - add rdi, byte SIZEOF_XMMWORD/8*4 - sub rcx, byte SIZEOF_XMMWORD/8 - psrldq xmmA, SIZEOF_XMMWORD/8*4 + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq XMM_MMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD/8*4 + sub rcx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 .column_st7: - ; Store one pixel (4 bytes) of xmmA to the output when it has enough - ; space. - test rcx, rcx - jz short .endcolumn - movd XMM_DWORD [rdi], xmmA + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + movd XMM_DWORD [rdi], xmmA %endif ; RGB_PIXELSIZE ; --------------- .endcolumn: - sfence ; flush the write buffer + sfence ; flush the write buffer .return: - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -445,94 +445,94 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): ; r12 = JDIMENSION in_row_group_ctr ; r13 = JSAMPARRAY output_buf - align 16 - global EXTN(jsimd_h2v2_merged_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_merged_upsample_sse2) EXTN(jsimd_h2v2_merged_upsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args - push rbx + push rbp + mov rax,rsp + mov rbp,rsp + collect_args + push rbx - mov rax, r10 + mov rax, r10 - mov rdi, r11 - mov rcx, r12 - mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] - mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] - mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] - mov rdi, r13 - lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] + mov rdi, r11 + mov rcx, r12 + mov rsi, JSAMPARRAY [rdi+0*SIZEOF_JSAMPARRAY] + mov rbx, JSAMPARRAY [rdi+1*SIZEOF_JSAMPARRAY] + mov rdx, JSAMPARRAY [rdi+2*SIZEOF_JSAMPARRAY] + mov rdi, r13 + lea rsi, [rsi+rcx*SIZEOF_JSAMPROW] - push rdx ; inptr2 - push rbx ; inptr1 - push rsi ; inptr00 - mov rbx,rsp + push rdx ; inptr2 + push rbx ; inptr1 + push rsi ; inptr00 + mov rbx,rsp - push rdi - push rcx - push rax + push rdi + push rcx + push rax - %ifdef WIN64 - mov r8, rcx - mov r9, rdi - mov rcx, rax - mov rdx, rbx - %else - mov rdx, rcx - mov rcx, rdi - mov rdi, rax - mov rsi, rbx - %endif + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif - call EXTN(jsimd_h2v1_merged_upsample_sse2) + call EXTN(jsimd_h2v1_merged_upsample_sse2) - pop rax - pop rcx - pop rdi - pop rsi - pop rbx - pop rdx + pop rax + pop rcx + pop rdi + pop rsi + pop rbx + pop rdx - add rdi, byte SIZEOF_JSAMPROW ; outptr1 - add rsi, byte SIZEOF_JSAMPROW ; inptr01 + add rdi, byte SIZEOF_JSAMPROW ; outptr1 + add rsi, byte SIZEOF_JSAMPROW ; inptr01 - push rdx ; inptr2 - push rbx ; inptr1 - push rsi ; inptr00 - mov rbx,rsp + push rdx ; inptr2 + push rbx ; inptr1 + push rsi ; inptr00 + mov rbx,rsp - push rdi - push rcx - push rax + push rdi + push rcx + push rax - %ifdef WIN64 - mov r8, rcx - mov r9, rdi - mov rcx, rax - mov rdx, rbx - %else - mov rdx, rcx - mov rcx, rdi - mov rdi, rax - mov rsi, rbx - %endif + %ifdef WIN64 + mov r8, rcx + mov r9, rdi + mov rcx, rax + mov rdx, rbx + %else + mov rdx, rcx + mov rcx, rdi + mov rdi, rax + mov rsi, rbx + %endif - call EXTN(jsimd_h2v1_merged_upsample_sse2) + call EXTN(jsimd_h2v1_merged_upsample_sse2) - pop rax - pop rcx - pop rdi - pop rsi - pop rbx - pop rdx + pop rax + pop rcx + pop rdi + pop rsi + pop rbx + pop rdx - pop rbx - uncollect_args - pop rbp - ret + pop rbx + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdmrgss2.asm b/simd/jdmrgss2.asm index 6494340f..0206f62b 100644 --- a/simd/jdmrgss2.asm +++ b/simd/jdmrgss2.asm @@ -18,7 +18,7 @@ ; [TAB8] %include "jcolsamp.inc" - + ; -------------------------------------------------------------------------- ; ; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. @@ -30,422 +30,422 @@ ; JSAMPARRAY output_buf); ; -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 3 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 3 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_h2v1_merged_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_merged_upsample_sse2) EXTN(jsimd_h2v1_merged_upsample_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov ecx, JDIMENSION [output_width(eax)] ; col - test ecx,ecx - jz near .return + mov ecx, JDIMENSION [output_width(eax)] ; col + test ecx,ecx + jz near .return - push ecx + push ecx - mov edi, JSAMPIMAGE [input_buf(eax)] - mov ecx, JDIMENSION [in_row_group_ctr(eax)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(eax)] - mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 - mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 - mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 - mov edi, JSAMPROW [edi] ; outptr + mov edi, JSAMPIMAGE [input_buf(eax)] + mov ecx, JDIMENSION [in_row_group_ctr(eax)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(eax)] + mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 + mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 + mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 + mov edi, JSAMPROW [edi] ; outptr - pop ecx ; col + pop ecx ; col - alignx 16,7 + alignx 16,7 .columnloop: - movpic eax, POINTER [gotptr] ; load GOT address (eax) + movpic eax, POINTER [gotptr] ; load GOT address (eax) - movdqa xmm6, XMMWORD [ebx] ; xmm6=Cb(0123456789ABCDEF) - movdqa xmm7, XMMWORD [edx] ; xmm7=Cr(0123456789ABCDEF) + movdqa xmm6, XMMWORD [ebx] ; xmm6=Cb(0123456789ABCDEF) + movdqa xmm7, XMMWORD [edx] ; xmm7=Cr(0123456789ABCDEF) - pxor xmm1,xmm1 ; xmm1=(all 0's) - pcmpeqw xmm3,xmm3 - psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} + pxor xmm1,xmm1 ; xmm1=(all 0's) + pcmpeqw xmm3,xmm3 + psllw xmm3,7 ; xmm3={0xFF80 0xFF80 0xFF80 0xFF80 ..} - movdqa xmm4,xmm6 - punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH - punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL - movdqa xmm0,xmm7 - punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH - punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL + movdqa xmm4,xmm6 + punpckhbw xmm6,xmm1 ; xmm6=Cb(89ABCDEF)=CbH + punpcklbw xmm4,xmm1 ; xmm4=Cb(01234567)=CbL + movdqa xmm0,xmm7 + punpckhbw xmm7,xmm1 ; xmm7=Cr(89ABCDEF)=CrH + punpcklbw xmm0,xmm1 ; xmm0=Cr(01234567)=CrL - paddw xmm6,xmm3 - paddw xmm4,xmm3 - paddw xmm7,xmm3 - paddw xmm0,xmm3 + paddw xmm6,xmm3 + paddw xmm4,xmm3 + paddw xmm7,xmm3 + paddw xmm0,xmm3 - ; (Original) - ; R = Y + 1.40200 * Cr - ; G = Y - 0.34414 * Cb - 0.71414 * Cr - ; B = Y + 1.77200 * Cb - ; - ; (This implementation) - ; R = Y + 0.40200 * Cr + Cr - ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr - ; B = Y - 0.22800 * Cb + Cb + Cb + ; (Original) + ; R = Y + 1.40200 * Cr + ; G = Y - 0.34414 * Cb - 0.71414 * Cr + ; B = Y + 1.77200 * Cb + ; + ; (This implementation) + ; R = Y + 0.40200 * Cr + Cr + ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr + ; B = Y - 0.22800 * Cb + Cb + Cb - movdqa xmm5,xmm6 ; xmm5=CbH - movdqa xmm2,xmm4 ; xmm2=CbL - paddw xmm6,xmm6 ; xmm6=2*CbH - paddw xmm4,xmm4 ; xmm4=2*CbL - movdqa xmm1,xmm7 ; xmm1=CrH - movdqa xmm3,xmm0 ; xmm3=CrL - paddw xmm7,xmm7 ; xmm7=2*CrH - paddw xmm0,xmm0 ; xmm0=2*CrL + movdqa xmm5,xmm6 ; xmm5=CbH + movdqa xmm2,xmm4 ; xmm2=CbL + paddw xmm6,xmm6 ; xmm6=2*CbH + paddw xmm4,xmm4 ; xmm4=2*CbL + movdqa xmm1,xmm7 ; xmm1=CrH + movdqa xmm3,xmm0 ; xmm3=CrL + paddw xmm7,xmm7 ; xmm7=2*CrH + paddw xmm0,xmm0 ; xmm0=2*CrL - pmulhw xmm6,[GOTOFF(eax,PW_MF0228)] ; xmm6=(2*CbH * -FIX(0.22800)) - pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbL * -FIX(0.22800)) - pmulhw xmm7,[GOTOFF(eax,PW_F0402)] ; xmm7=(2*CrH * FIX(0.40200)) - pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrL * FIX(0.40200)) + pmulhw xmm6,[GOTOFF(eax,PW_MF0228)] ; xmm6=(2*CbH * -FIX(0.22800)) + pmulhw xmm4,[GOTOFF(eax,PW_MF0228)] ; xmm4=(2*CbL * -FIX(0.22800)) + pmulhw xmm7,[GOTOFF(eax,PW_F0402)] ; xmm7=(2*CrH * FIX(0.40200)) + pmulhw xmm0,[GOTOFF(eax,PW_F0402)] ; xmm0=(2*CrL * FIX(0.40200)) - paddw xmm6,[GOTOFF(eax,PW_ONE)] - paddw xmm4,[GOTOFF(eax,PW_ONE)] - psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) - psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) - paddw xmm7,[GOTOFF(eax,PW_ONE)] - paddw xmm0,[GOTOFF(eax,PW_ONE)] - psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) - psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) + paddw xmm6,[GOTOFF(eax,PW_ONE)] + paddw xmm4,[GOTOFF(eax,PW_ONE)] + psraw xmm6,1 ; xmm6=(CbH * -FIX(0.22800)) + psraw xmm4,1 ; xmm4=(CbL * -FIX(0.22800)) + paddw xmm7,[GOTOFF(eax,PW_ONE)] + paddw xmm0,[GOTOFF(eax,PW_ONE)] + psraw xmm7,1 ; xmm7=(CrH * FIX(0.40200)) + psraw xmm0,1 ; xmm0=(CrL * FIX(0.40200)) - paddw xmm6,xmm5 - paddw xmm4,xmm2 - paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H - paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L - paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H - paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L + paddw xmm6,xmm5 + paddw xmm4,xmm2 + paddw xmm6,xmm5 ; xmm6=(CbH * FIX(1.77200))=(B-Y)H + paddw xmm4,xmm2 ; xmm4=(CbL * FIX(1.77200))=(B-Y)L + paddw xmm7,xmm1 ; xmm7=(CrH * FIX(1.40200))=(R-Y)H + paddw xmm0,xmm3 ; xmm0=(CrL * FIX(1.40200))=(R-Y)L - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=(B-Y)H + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(R-Y)H - movdqa xmm6,xmm5 - movdqa xmm7,xmm2 - punpcklwd xmm5,xmm1 - punpckhwd xmm6,xmm1 - pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm6,[GOTOFF(eax,PW_MF0344_F0285)] - punpcklwd xmm2,xmm3 - punpckhwd xmm7,xmm3 - pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] - pmaddwd xmm7,[GOTOFF(eax,PW_MF0344_F0285)] + movdqa xmm6,xmm5 + movdqa xmm7,xmm2 + punpcklwd xmm5,xmm1 + punpckhwd xmm6,xmm1 + pmaddwd xmm5,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm6,[GOTOFF(eax,PW_MF0344_F0285)] + punpcklwd xmm2,xmm3 + punpckhwd xmm7,xmm3 + pmaddwd xmm2,[GOTOFF(eax,PW_MF0344_F0285)] + pmaddwd xmm7,[GOTOFF(eax,PW_MF0344_F0285)] - paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm6,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm5,SCALEBITS - psrad xmm6,SCALEBITS - paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] - paddd xmm7,[GOTOFF(eax,PD_ONEHALF)] - psrad xmm2,SCALEBITS - psrad xmm7,SCALEBITS + paddd xmm5,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm6,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm5,SCALEBITS + psrad xmm6,SCALEBITS + paddd xmm2,[GOTOFF(eax,PD_ONEHALF)] + paddd xmm7,[GOTOFF(eax,PD_ONEHALF)] + psrad xmm2,SCALEBITS + psrad xmm7,SCALEBITS - packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) - packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) - psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H - psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L + packssdw xmm5,xmm6 ; xmm5=CbH*-FIX(0.344)+CrH*FIX(0.285) + packssdw xmm2,xmm7 ; xmm2=CbL*-FIX(0.344)+CrL*FIX(0.285) + psubw xmm5,xmm1 ; xmm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H + psubw xmm2,xmm3 ; xmm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L - movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H + movdqa XMMWORD [wk(2)], xmm5 ; wk(2)=(G-Y)H - mov al,2 ; Yctr - jmp short .Yloop_1st - alignx 16,7 + mov al,2 ; Yctr + jmp short .Yloop_1st + alignx 16,7 .Yloop_2nd: - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H - movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H - alignx 16,7 + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(R-Y)H + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(G-Y)H + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(B-Y)H + alignx 16,7 .Yloop_1st: - movdqa xmm7, XMMWORD [esi] ; xmm7=Y(0123456789ABCDEF) + movdqa xmm7, XMMWORD [esi] ; xmm7=Y(0123456789ABCDEF) - pcmpeqw xmm6,xmm6 - psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} - pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE - psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO + pcmpeqw xmm6,xmm6 + psrlw xmm6,BYTE_BIT ; xmm6={0xFF 0x00 0xFF 0x00 ..} + pand xmm6,xmm7 ; xmm6=Y(02468ACE)=YE + psrlw xmm7,BYTE_BIT ; xmm7=Y(13579BDF)=YO - movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) - movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) - movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) + movdqa xmm1,xmm0 ; xmm1=xmm0=(R-Y)(L/H) + movdqa xmm3,xmm2 ; xmm3=xmm2=(G-Y)(L/H) + movdqa xmm5,xmm4 ; xmm5=xmm4=(B-Y)(L/H) - paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) - paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) - packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) - packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) + paddw xmm0,xmm6 ; xmm0=((R-Y)+YE)=RE=R(02468ACE) + paddw xmm1,xmm7 ; xmm1=((R-Y)+YO)=RO=R(13579BDF) + packuswb xmm0,xmm0 ; xmm0=R(02468ACE********) + packuswb xmm1,xmm1 ; xmm1=R(13579BDF********) - paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) - paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) - packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) - packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) + paddw xmm2,xmm6 ; xmm2=((G-Y)+YE)=GE=G(02468ACE) + paddw xmm3,xmm7 ; xmm3=((G-Y)+YO)=GO=G(13579BDF) + packuswb xmm2,xmm2 ; xmm2=G(02468ACE********) + packuswb xmm3,xmm3 ; xmm3=G(13579BDF********) - paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) - paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) - packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) - packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) + paddw xmm4,xmm6 ; xmm4=((B-Y)+YE)=BE=B(02468ACE) + paddw xmm5,xmm7 ; xmm5=((B-Y)+YO)=BO=B(13579BDF) + packuswb xmm4,xmm4 ; xmm4=B(02468ACE********) + packuswb xmm5,xmm5 ; xmm5=B(13579BDF********) %if RGB_PIXELSIZE == 3 ; --------------- - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(** ** ** ** ** ** ** ** **), xmmH=(** ** ** ** ** ** ** ** **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) - punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmB ; xmmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F) + punpcklbw xmmD,xmmF ; xmmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F) - movdqa xmmG,xmmA - movdqa xmmH,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) - punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) + movdqa xmmG,xmmA + movdqa xmmH,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07) + punpckhwd xmmG,xmmE ; xmmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F) - psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) - psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) + psrldq xmmH,2 ; xmmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E -- --) + psrldq xmmE,2 ; xmmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F -- --) - movdqa xmmC,xmmD - movdqa xmmB,xmmD - punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) - punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) + movdqa xmmC,xmmD + movdqa xmmB,xmmD + punpcklwd xmmD,xmmH ; xmmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18) + punpckhwd xmmC,xmmH ; xmmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F -- --) - psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) + psrldq xmmB,2 ; xmmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F -- --) - movdqa xmmF,xmmE - punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) - punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) + movdqa xmmF,xmmE + punpcklwd xmmE,xmmB ; xmmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29) + punpckhwd xmmF,xmmB ; xmmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F -- -- -- --) - pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) - movdqa xmmB,xmmE - punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) - punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) - punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) + pshufd xmmH,xmmA,0x4E; xmmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03) + movdqa xmmB,xmmE + punpckldq xmmA,xmmD ; xmmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14) + punpckldq xmmE,xmmH ; xmmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07) + punpckhdq xmmD,xmmB ; xmmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29) - pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) - movdqa xmmB,xmmF - punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) - punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) - punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) + pshufd xmmH,xmmG,0x4E; xmmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B) + movdqa xmmB,xmmF + punpckldq xmmG,xmmC ; xmmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C) + punpckldq xmmF,xmmH ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F) + punpckhdq xmmC,xmmB ; xmmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F -- -- -- -- -- --) - punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) - punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) - punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) + punpcklqdq xmmA,xmmE ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05) + punpcklqdq xmmD,xmmG ; xmmD=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) + punpcklqdq xmmF,xmmC ; xmmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F) - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmF .out0: - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub ecx, byte SIZEOF_XMMWORD - jz near .endcolumn + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn - add esi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st32: - lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE - cmp ecx, byte 2*SIZEOF_XMMWORD - jb short .column_st16 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - add edi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmF - sub ecx, byte 2*SIZEOF_XMMWORD - jmp short .column_st15 + lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE + cmp ecx, byte 2*SIZEOF_XMMWORD + jb short .column_st16 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + add edi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmF + sub ecx, byte 2*SIZEOF_XMMWORD + jmp short .column_st15 .column_st16: - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st15 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st15 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD .column_st15: - ; Store the lower 8 bytes of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_MMWORD - jb short .column_st7 - movq XMM_MMWORD [edi], xmmA - add edi, byte SIZEOF_MMWORD - sub ecx, byte SIZEOF_MMWORD - psrldq xmmA, SIZEOF_MMWORD + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st7 + movq XMM_MMWORD [edi], xmmA + add edi, byte SIZEOF_MMWORD + sub ecx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD .column_st7: - ; Store the lower 4 bytes of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_DWORD - jb short .column_st3 - movd XMM_DWORD [edi], xmmA - add edi, byte SIZEOF_DWORD - sub ecx, byte SIZEOF_DWORD - psrldq xmmA, SIZEOF_DWORD + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_DWORD + jb short .column_st3 + movd XMM_DWORD [edi], xmmA + add edi, byte SIZEOF_DWORD + sub ecx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD .column_st3: - ; Store the lower 2 bytes of eax to the output when it has enough - ; space. - movd eax, xmmA - cmp ecx, byte SIZEOF_WORD - jb short .column_st1 - mov WORD [edi], ax - add edi, byte SIZEOF_WORD - sub ecx, byte SIZEOF_WORD - shr eax, 16 + ; Store the lower 2 bytes of eax to the output when it has enough + ; space. + movd eax, xmmA + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi], ax + add edi, byte SIZEOF_WORD + sub ecx, byte SIZEOF_WORD + shr eax, 16 .column_st1: - ; Store the lower 1 byte of eax to the output when it has enough - ; space. - test ecx, ecx - jz short .endcolumn - mov BYTE [edi], al + ; Store the lower 1 byte of eax to the output when it has enough + ; space. + test ecx, ecx + jz short .endcolumn + mov BYTE [edi], al %else ; RGB_PIXELSIZE == 4 ; ----------- %ifdef RGBX_FILLER_0XFF - pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pcmpeqb xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pcmpeqb xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %else - pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) - pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) + pxor xmm6,xmm6 ; xmm6=XE=X(02468ACE********) + pxor xmm7,xmm7 ; xmm7=XO=X(13579BDF********) %endif - ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) - ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) - ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) - ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) + ; xmmA=(00 02 04 06 08 0A 0C 0E **), xmmB=(01 03 05 07 09 0B 0D 0F **) + ; xmmC=(10 12 14 16 18 1A 1C 1E **), xmmD=(11 13 15 17 19 1B 1D 1F **) + ; xmmE=(20 22 24 26 28 2A 2C 2E **), xmmF=(21 23 25 27 29 2B 2D 2F **) + ; xmmG=(30 32 34 36 38 3A 3C 3E **), xmmH=(31 33 35 37 39 3B 3D 3F **) - punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) - punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) - punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) - punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) + punpcklbw xmmA,xmmC ; xmmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E) + punpcklbw xmmE,xmmG ; xmmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E) + punpcklbw xmmB,xmmD ; xmmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F) + punpcklbw xmmF,xmmH ; xmmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F) - movdqa xmmC,xmmA - punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) - punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) - movdqa xmmG,xmmB - punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) - punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) + movdqa xmmC,xmmA + punpcklwd xmmA,xmmE ; xmmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36) + punpckhwd xmmC,xmmE ; xmmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E) + movdqa xmmG,xmmB + punpcklwd xmmB,xmmF ; xmmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37) + punpckhwd xmmG,xmmF ; xmmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F) - movdqa xmmD,xmmA - punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) - punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) - movdqa xmmH,xmmC - punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) - punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) + movdqa xmmD,xmmA + punpckldq xmmA,xmmB ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33) + punpckhdq xmmD,xmmB ; xmmD=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) + movdqa xmmH,xmmC + punpckldq xmmC,xmmG ; xmmC=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B) + punpckhdq xmmH,xmmG ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) - cmp ecx, byte SIZEOF_XMMWORD - jb short .column_st32 + cmp ecx, byte SIZEOF_XMMWORD + jb short .column_st32 - test edi, SIZEOF_XMMWORD-1 - jnz short .out1 - ; --(aligned)------------------- - movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH - jmp short .out0 -.out1: ; --(unaligned)----------------- - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC - movdqu XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + test edi, SIZEOF_XMMWORD-1 + jnz short .out1 + ; --(aligned)------------------- + movntdq XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movntdq XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movntdq XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movntdq XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH + jmp short .out0 +.out1: ; --(unaligned)----------------- + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + movdqu XMMWORD [edi+2*SIZEOF_XMMWORD], xmmC + movdqu XMMWORD [edi+3*SIZEOF_XMMWORD], xmmH .out0: - add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr - sub ecx, byte SIZEOF_XMMWORD - jz near .endcolumn + add edi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; outptr + sub ecx, byte SIZEOF_XMMWORD + jz near .endcolumn - add esi, byte SIZEOF_XMMWORD ; inptr0 - dec al ; Yctr - jnz near .Yloop_2nd + add esi, byte SIZEOF_XMMWORD ; inptr0 + dec al ; Yctr + jnz near .Yloop_2nd - add ebx, byte SIZEOF_XMMWORD ; inptr1 - add edx, byte SIZEOF_XMMWORD ; inptr2 - jmp near .columnloop - alignx 16,7 + add ebx, byte SIZEOF_XMMWORD ; inptr1 + add edx, byte SIZEOF_XMMWORD ; inptr2 + jmp near .columnloop + alignx 16,7 .column_st32: - cmp ecx, byte SIZEOF_XMMWORD/2 - jb short .column_st16 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD - add edi, byte 2*SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmC - movdqa xmmD,xmmH - sub ecx, byte SIZEOF_XMMWORD/2 + cmp ecx, byte SIZEOF_XMMWORD/2 + jb short .column_st16 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + movdqu XMMWORD [edi+1*SIZEOF_XMMWORD], xmmD + add edi, byte 2*SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmC + movdqa xmmD,xmmH + sub ecx, byte SIZEOF_XMMWORD/2 .column_st16: - cmp ecx, byte SIZEOF_XMMWORD/4 - jb short .column_st15 - movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA - add edi, byte SIZEOF_XMMWORD ; outptr - movdqa xmmA,xmmD - sub ecx, byte SIZEOF_XMMWORD/4 + cmp ecx, byte SIZEOF_XMMWORD/4 + jb short .column_st15 + movdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA + add edi, byte SIZEOF_XMMWORD ; outptr + movdqa xmmA,xmmD + sub ecx, byte SIZEOF_XMMWORD/4 .column_st15: - ; Store two pixels (8 bytes) of xmmA to the output when it has enough - ; space. - cmp ecx, byte SIZEOF_XMMWORD/8 - jb short .column_st7 - movq XMM_MMWORD [edi], xmmA - add edi, byte SIZEOF_XMMWORD/8*4 - sub ecx, byte SIZEOF_XMMWORD/8 - psrldq xmmA, SIZEOF_XMMWORD/8*4 + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq XMM_MMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD/8*4 + sub ecx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 .column_st7: - ; Store one pixel (4 bytes) of xmmA to the output when it has enough - ; space. - test ecx, ecx - jz short .endcolumn - movd XMM_DWORD [edi], xmmA + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test ecx, ecx + jz short .endcolumn + movd XMM_DWORD [edi], xmmA %endif ; RGB_PIXELSIZE ; --------------- .endcolumn: - sfence ; flush the write buffer + sfence ; flush the write buffer .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -458,62 +458,62 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): ; JSAMPARRAY output_buf); ; -%define output_width(b) (b)+8 ; JDIMENSION output_width -%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf -%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr -%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf +%define output_width(b) (b)+8 ; JDIMENSION output_width +%define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf +%define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr +%define output_buf(b) (b)+20 ; JSAMPARRAY output_buf - align 16 - global EXTN(jsimd_h2v2_merged_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_merged_upsample_sse2) EXTN(jsimd_h2v2_merged_upsample_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov eax, POINTER [output_width(ebp)] + mov eax, POINTER [output_width(ebp)] - mov edi, JSAMPIMAGE [input_buf(ebp)] - mov ecx, JDIMENSION [in_row_group_ctr(ebp)] - mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] - mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] - mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] - mov edi, JSAMPARRAY [output_buf(ebp)] - lea esi, [esi+ecx*SIZEOF_JSAMPROW] + mov edi, JSAMPIMAGE [input_buf(ebp)] + mov ecx, JDIMENSION [in_row_group_ctr(ebp)] + mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] + mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] + mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] + mov edi, JSAMPARRAY [output_buf(ebp)] + lea esi, [esi+ecx*SIZEOF_JSAMPROW] - push edx ; inptr2 - push ebx ; inptr1 - push esi ; inptr00 - mov ebx,esp + push edx ; inptr2 + push ebx ; inptr1 + push esi ; inptr00 + mov ebx,esp - push edi ; output_buf (outptr0) - push ecx ; in_row_group_ctr - push ebx ; input_buf - push eax ; output_width + push edi ; output_buf (outptr0) + push ecx ; in_row_group_ctr + push ebx ; input_buf + push eax ; output_width - call near EXTN(jsimd_h2v1_merged_upsample_sse2) + call near EXTN(jsimd_h2v1_merged_upsample_sse2) - add esi, byte SIZEOF_JSAMPROW ; inptr01 - add edi, byte SIZEOF_JSAMPROW ; outptr1 - mov POINTER [ebx+0*SIZEOF_POINTER], esi - mov POINTER [ebx-1*SIZEOF_POINTER], edi + add esi, byte SIZEOF_JSAMPROW ; inptr01 + add edi, byte SIZEOF_JSAMPROW ; outptr1 + mov POINTER [ebx+0*SIZEOF_POINTER], esi + mov POINTER [ebx-1*SIZEOF_POINTER], edi - call near EXTN(jsimd_h2v1_merged_upsample_sse2) + call near EXTN(jsimd_h2v1_merged_upsample_sse2) - add esp, byte 7*SIZEOF_DWORD + add esp, byte 7*SIZEOF_DWORD - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdsammmx.asm b/simd/jdsammmx.asm index c09e5b96..823fe191 100644 --- a/simd/jdsammmx.asm +++ b/simd/jdsammmx.asm @@ -19,24 +19,24 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fancy_upsample_mmx) + alignz 16 + global EXTN(jconst_fancy_upsample_mmx) EXTN(jconst_fancy_upsample_mmx): -PW_ONE times 4 dw 1 -PW_TWO times 4 dw 2 -PW_THREE times 4 dw 3 -PW_SEVEN times 4 dw 7 -PW_EIGHT times 4 dw 8 +PW_ONE times 4 dw 1 +PW_TWO times 4 dw 2 +PW_THREE times 4 dw 3 +PW_SEVEN times 4 dw 7 +PW_EIGHT times 4 dw 8 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. ; @@ -52,146 +52,146 @@ PW_EIGHT times 4 dw 8 ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_fancy_upsample_mmx) + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_mmx) EXTN(jsimd_h2v1_fancy_upsample_mmx): - push ebp - mov ebp,esp - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr - test eax,eax - jz near .return + mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr + test eax,eax + jz near .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz near .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push eax ; colctr - push edi - push esi + push eax ; colctr + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr - test eax, SIZEOF_MMWORD-1 - jz short .skip - mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + test eax, SIZEOF_MMWORD-1 + jz short .skip + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample .skip: - pxor mm0,mm0 ; mm0=(all 0's) - pcmpeqb mm7,mm7 - psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT - pand mm7, MMWORD [esi+0*SIZEOF_MMWORD] + pxor mm0,mm0 ; mm0=(all 0's) + pcmpeqb mm7,mm7 + psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT + pand mm7, MMWORD [esi+0*SIZEOF_MMWORD] - add eax, byte SIZEOF_MMWORD-1 - and eax, byte -SIZEOF_MMWORD - cmp eax, byte SIZEOF_MMWORD - ja short .columnloop - alignx 16,7 + add eax, byte SIZEOF_MMWORD-1 + and eax, byte -SIZEOF_MMWORD + cmp eax, byte SIZEOF_MMWORD + ja short .columnloop + alignx 16,7 .columnloop_last: - pcmpeqb mm6,mm6 - psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT - pand mm6, MMWORD [esi+0*SIZEOF_MMWORD] - jmp short .upsample - alignx 16,7 + pcmpeqb mm6,mm6 + psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT + pand mm6, MMWORD [esi+0*SIZEOF_MMWORD] + jmp short .upsample + alignx 16,7 .columnloop: - movq mm6, MMWORD [esi+1*SIZEOF_MMWORD] - psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT + movq mm6, MMWORD [esi+1*SIZEOF_MMWORD] + psllq mm6,(SIZEOF_MMWORD-1)*BYTE_BIT .upsample: - movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] - movq mm2,mm1 - movq mm3,mm1 ; mm1=( 0 1 2 3 4 5 6 7) - psllq mm2,BYTE_BIT ; mm2=( - 0 1 2 3 4 5 6) - psrlq mm3,BYTE_BIT ; mm3=( 1 2 3 4 5 6 7 -) + movq mm1, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm2,mm1 + movq mm3,mm1 ; mm1=( 0 1 2 3 4 5 6 7) + psllq mm2,BYTE_BIT ; mm2=( - 0 1 2 3 4 5 6) + psrlq mm3,BYTE_BIT ; mm3=( 1 2 3 4 5 6 7 -) - por mm2,mm7 ; mm2=(-1 0 1 2 3 4 5 6) - por mm3,mm6 ; mm3=( 1 2 3 4 5 6 7 8) + por mm2,mm7 ; mm2=(-1 0 1 2 3 4 5 6) + por mm3,mm6 ; mm3=( 1 2 3 4 5 6 7 8) - movq mm7,mm1 - psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT ; mm7=( 7 - - - - - - -) + movq mm7,mm1 + psrlq mm7,(SIZEOF_MMWORD-1)*BYTE_BIT ; mm7=( 7 - - - - - - -) - movq mm4,mm1 - punpcklbw mm1,mm0 ; mm1=( 0 1 2 3) - punpckhbw mm4,mm0 ; mm4=( 4 5 6 7) - movq mm5,mm2 - punpcklbw mm2,mm0 ; mm2=(-1 0 1 2) - punpckhbw mm5,mm0 ; mm5=( 3 4 5 6) - movq mm6,mm3 - punpcklbw mm3,mm0 ; mm3=( 1 2 3 4) - punpckhbw mm6,mm0 ; mm6=( 5 6 7 8) + movq mm4,mm1 + punpcklbw mm1,mm0 ; mm1=( 0 1 2 3) + punpckhbw mm4,mm0 ; mm4=( 4 5 6 7) + movq mm5,mm2 + punpcklbw mm2,mm0 ; mm2=(-1 0 1 2) + punpckhbw mm5,mm0 ; mm5=( 3 4 5 6) + movq mm6,mm3 + punpcklbw mm3,mm0 ; mm3=( 1 2 3 4) + punpckhbw mm6,mm0 ; mm6=( 5 6 7 8) - pmullw mm1,[GOTOFF(ebx,PW_THREE)] - pmullw mm4,[GOTOFF(ebx,PW_THREE)] - paddw mm2,[GOTOFF(ebx,PW_ONE)] - paddw mm5,[GOTOFF(ebx,PW_ONE)] - paddw mm3,[GOTOFF(ebx,PW_TWO)] - paddw mm6,[GOTOFF(ebx,PW_TWO)] + pmullw mm1,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + paddw mm2,[GOTOFF(ebx,PW_ONE)] + paddw mm5,[GOTOFF(ebx,PW_ONE)] + paddw mm3,[GOTOFF(ebx,PW_TWO)] + paddw mm6,[GOTOFF(ebx,PW_TWO)] - paddw mm2,mm1 - paddw mm5,mm4 - psrlw mm2,2 ; mm2=OutLE=( 0 2 4 6) - psrlw mm5,2 ; mm5=OutHE=( 8 10 12 14) - paddw mm3,mm1 - paddw mm6,mm4 - psrlw mm3,2 ; mm3=OutLO=( 1 3 5 7) - psrlw mm6,2 ; mm6=OutHO=( 9 11 13 15) + paddw mm2,mm1 + paddw mm5,mm4 + psrlw mm2,2 ; mm2=OutLE=( 0 2 4 6) + psrlw mm5,2 ; mm5=OutHE=( 8 10 12 14) + paddw mm3,mm1 + paddw mm6,mm4 + psrlw mm3,2 ; mm3=OutLO=( 1 3 5 7) + psrlw mm6,2 ; mm6=OutHO=( 9 11 13 15) - psllw mm3,BYTE_BIT - psllw mm6,BYTE_BIT - por mm2,mm3 ; mm2=OutL=( 0 1 2 3 4 5 6 7) - por mm5,mm6 ; mm5=OutH=( 8 9 10 11 12 13 14 15) + psllw mm3,BYTE_BIT + psllw mm6,BYTE_BIT + por mm2,mm3 ; mm2=OutL=( 0 1 2 3 4 5 6 7) + por mm5,mm6 ; mm5=OutH=( 8 9 10 11 12 13 14 15) - movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 - movq MMWORD [edi+1*SIZEOF_MMWORD], mm5 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm5 - sub eax, byte SIZEOF_MMWORD - add esi, byte 1*SIZEOF_MMWORD ; inptr - add edi, byte 2*SIZEOF_MMWORD ; outptr - cmp eax, byte SIZEOF_MMWORD - ja near .columnloop - test eax,eax - jnz near .columnloop_last + sub eax, byte SIZEOF_MMWORD + add esi, byte 1*SIZEOF_MMWORD ; inptr + add edi, byte 2*SIZEOF_MMWORD ; outptr + cmp eax, byte SIZEOF_MMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last - pop esi - pop edi - pop eax + pop esi + pop edi + pop eax - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec ecx ; rowctr - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -205,324 +205,324 @@ EXTN(jsimd_h2v1_fancy_upsample_mmx): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 4 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 4 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_h2v2_fancy_upsample_mmx) + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_mmx) EXTN(jsimd_h2v2_fancy_upsample_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov edx,eax ; edx = original ebp - mov eax, JDIMENSION [downsamp_width(edx)] ; colctr - test eax,eax - jz near .return + mov edx,eax ; edx = original ebp + mov eax, JDIMENSION [downsamp_width(edx)] ; colctr + test eax,eax + jz near .return - mov ecx, INT [max_v_samp(edx)] ; rowctr - test ecx,ecx - jz near .return + mov ecx, INT [max_v_samp(edx)] ; rowctr + test ecx,ecx + jz near .return - mov esi, JSAMPARRAY [input_data(edx)] ; input_data - mov edi, POINTER [output_data_ptr(edx)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(edx)] ; input_data + mov edi, POINTER [output_data_ptr(edx)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push eax ; colctr - push ecx - push edi - push esi + push eax ; colctr + push ecx + push edi + push esi - mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 - mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 - mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 - test eax, SIZEOF_MMWORD-1 - jz short .skip - push edx - mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample - pop edx + test eax, SIZEOF_MMWORD-1 + jz short .skip + push edx + mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop edx .skip: - ; -- process the first column block + ; -- process the first column block - movq mm0, MMWORD [ebx+0*SIZEOF_MMWORD] ; mm0=row[ 0][0] - movq mm1, MMWORD [ecx+0*SIZEOF_MMWORD] ; mm1=row[-1][0] - movq mm2, MMWORD [esi+0*SIZEOF_MMWORD] ; mm2=row[+1][0] + movq mm0, MMWORD [ebx+0*SIZEOF_MMWORD] ; mm0=row[ 0][0] + movq mm1, MMWORD [ecx+0*SIZEOF_MMWORD] ; mm1=row[-1][0] + movq mm2, MMWORD [esi+0*SIZEOF_MMWORD] ; mm2=row[+1][0] - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pxor mm3,mm3 ; mm3=(all 0's) - movq mm4,mm0 - punpcklbw mm0,mm3 ; mm0=row[ 0][0]( 0 1 2 3) - punpckhbw mm4,mm3 ; mm4=row[ 0][0]( 4 5 6 7) - movq mm5,mm1 - punpcklbw mm1,mm3 ; mm1=row[-1][0]( 0 1 2 3) - punpckhbw mm5,mm3 ; mm5=row[-1][0]( 4 5 6 7) - movq mm6,mm2 - punpcklbw mm2,mm3 ; mm2=row[+1][0]( 0 1 2 3) - punpckhbw mm6,mm3 ; mm6=row[+1][0]( 4 5 6 7) + pxor mm3,mm3 ; mm3=(all 0's) + movq mm4,mm0 + punpcklbw mm0,mm3 ; mm0=row[ 0][0]( 0 1 2 3) + punpckhbw mm4,mm3 ; mm4=row[ 0][0]( 4 5 6 7) + movq mm5,mm1 + punpcklbw mm1,mm3 ; mm1=row[-1][0]( 0 1 2 3) + punpckhbw mm5,mm3 ; mm5=row[-1][0]( 4 5 6 7) + movq mm6,mm2 + punpcklbw mm2,mm3 ; mm2=row[+1][0]( 0 1 2 3) + punpckhbw mm6,mm3 ; mm6=row[+1][0]( 4 5 6 7) - pmullw mm0,[GOTOFF(ebx,PW_THREE)] - pmullw mm4,[GOTOFF(ebx,PW_THREE)] + pmullw mm0,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] - pcmpeqb mm7,mm7 - psrlq mm7,(SIZEOF_MMWORD-2)*BYTE_BIT + pcmpeqb mm7,mm7 + psrlq mm7,(SIZEOF_MMWORD-2)*BYTE_BIT - paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) - paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) - paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) - paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) + paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) + paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) + paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) + paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) - movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 ; temporarily save - movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 ; the intermediate data - movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 - movq MMWORD [edi+1*SIZEOF_MMWORD], mm6 + movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 ; temporarily save + movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 ; the intermediate data + movq MMWORD [edi+0*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm6 - pand mm1,mm7 ; mm1=( 0 - - -) - pand mm2,mm7 ; mm2=( 0 - - -) + pand mm1,mm7 ; mm1=( 0 - - -) + pand mm2,mm7 ; mm2=( 0 - - -) - movq MMWORD [wk(0)], mm1 - movq MMWORD [wk(1)], mm2 + movq MMWORD [wk(0)], mm1 + movq MMWORD [wk(1)], mm2 - poppic ebx + poppic ebx - add eax, byte SIZEOF_MMWORD-1 - and eax, byte -SIZEOF_MMWORD - cmp eax, byte SIZEOF_MMWORD - ja short .columnloop - alignx 16,7 + add eax, byte SIZEOF_MMWORD-1 + and eax, byte -SIZEOF_MMWORD + cmp eax, byte SIZEOF_MMWORD + ja short .columnloop + alignx 16,7 .columnloop_last: - ; -- process the last column block + ; -- process the last column block - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pcmpeqb mm1,mm1 - psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT - movq mm2,mm1 + pcmpeqb mm1,mm1 + psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT + movq mm2,mm1 - pand mm1, MMWORD [edx+1*SIZEOF_MMWORD] ; mm1=( - - - 7) - pand mm2, MMWORD [edi+1*SIZEOF_MMWORD] ; mm2=( - - - 7) + pand mm1, MMWORD [edx+1*SIZEOF_MMWORD] ; mm1=( - - - 7) + pand mm2, MMWORD [edi+1*SIZEOF_MMWORD] ; mm2=( - - - 7) - movq MMWORD [wk(2)], mm1 - movq MMWORD [wk(3)], mm2 + movq MMWORD [wk(2)], mm1 + movq MMWORD [wk(3)], mm2 - jmp short .upsample - alignx 16,7 + jmp short .upsample + alignx 16,7 .columnloop: - ; -- process the next column block + ; -- process the next column block - movq mm0, MMWORD [ebx+1*SIZEOF_MMWORD] ; mm0=row[ 0][1] - movq mm1, MMWORD [ecx+1*SIZEOF_MMWORD] ; mm1=row[-1][1] - movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] ; mm2=row[+1][1] + movq mm0, MMWORD [ebx+1*SIZEOF_MMWORD] ; mm0=row[ 0][1] + movq mm1, MMWORD [ecx+1*SIZEOF_MMWORD] ; mm1=row[-1][1] + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] ; mm2=row[+1][1] - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pxor mm3,mm3 ; mm3=(all 0's) - movq mm4,mm0 - punpcklbw mm0,mm3 ; mm0=row[ 0][1]( 0 1 2 3) - punpckhbw mm4,mm3 ; mm4=row[ 0][1]( 4 5 6 7) - movq mm5,mm1 - punpcklbw mm1,mm3 ; mm1=row[-1][1]( 0 1 2 3) - punpckhbw mm5,mm3 ; mm5=row[-1][1]( 4 5 6 7) - movq mm6,mm2 - punpcklbw mm2,mm3 ; mm2=row[+1][1]( 0 1 2 3) - punpckhbw mm6,mm3 ; mm6=row[+1][1]( 4 5 6 7) + pxor mm3,mm3 ; mm3=(all 0's) + movq mm4,mm0 + punpcklbw mm0,mm3 ; mm0=row[ 0][1]( 0 1 2 3) + punpckhbw mm4,mm3 ; mm4=row[ 0][1]( 4 5 6 7) + movq mm5,mm1 + punpcklbw mm1,mm3 ; mm1=row[-1][1]( 0 1 2 3) + punpckhbw mm5,mm3 ; mm5=row[-1][1]( 4 5 6 7) + movq mm6,mm2 + punpcklbw mm2,mm3 ; mm2=row[+1][1]( 0 1 2 3) + punpckhbw mm6,mm3 ; mm6=row[+1][1]( 4 5 6 7) - pmullw mm0,[GOTOFF(ebx,PW_THREE)] - pmullw mm4,[GOTOFF(ebx,PW_THREE)] + pmullw mm0,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] - paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) - paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) - paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) - paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) + paddw mm1,mm0 ; mm1=Int0L=( 0 1 2 3) + paddw mm5,mm4 ; mm5=Int0H=( 4 5 6 7) + paddw mm2,mm0 ; mm2=Int1L=( 0 1 2 3) + paddw mm6,mm4 ; mm6=Int1H=( 4 5 6 7) - movq MMWORD [edx+2*SIZEOF_MMWORD], mm1 ; temporarily save - movq MMWORD [edx+3*SIZEOF_MMWORD], mm5 ; the intermediate data - movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 - movq MMWORD [edi+3*SIZEOF_MMWORD], mm6 + movq MMWORD [edx+2*SIZEOF_MMWORD], mm1 ; temporarily save + movq MMWORD [edx+3*SIZEOF_MMWORD], mm5 ; the intermediate data + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm6 - psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm1=( - - - 0) - psllq mm2,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm2=( - - - 0) + psllq mm1,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm1=( - - - 0) + psllq mm2,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm2=( - - - 0) - movq MMWORD [wk(2)], mm1 - movq MMWORD [wk(3)], mm2 + movq MMWORD [wk(2)], mm1 + movq MMWORD [wk(3)], mm2 .upsample: - ; -- process the upper row + ; -- process the upper row - movq mm7, MMWORD [edx+0*SIZEOF_MMWORD] ; mm7=Int0L=( 0 1 2 3) - movq mm3, MMWORD [edx+1*SIZEOF_MMWORD] ; mm3=Int0H=( 4 5 6 7) + movq mm7, MMWORD [edx+0*SIZEOF_MMWORD] ; mm7=Int0L=( 0 1 2 3) + movq mm3, MMWORD [edx+1*SIZEOF_MMWORD] ; mm3=Int0H=( 4 5 6 7) - movq mm0,mm7 - movq mm4,mm3 - psrlq mm0,2*BYTE_BIT ; mm0=( 1 2 3 -) - psllq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( - - - 4) - movq mm5,mm7 - movq mm6,mm3 - psrlq mm5,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm5=( 3 - - -) - psllq mm6,2*BYTE_BIT ; mm6=( - 4 5 6) + movq mm0,mm7 + movq mm4,mm3 + psrlq mm0,2*BYTE_BIT ; mm0=( 1 2 3 -) + psllq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( - - - 4) + movq mm5,mm7 + movq mm6,mm3 + psrlq mm5,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm5=( 3 - - -) + psllq mm6,2*BYTE_BIT ; mm6=( - 4 5 6) - por mm0,mm4 ; mm0=( 1 2 3 4) - por mm5,mm6 ; mm5=( 3 4 5 6) + por mm0,mm4 ; mm0=( 1 2 3 4) + por mm5,mm6 ; mm5=( 3 4 5 6) - movq mm1,mm7 - movq mm2,mm3 - psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) - psrlq mm2,2*BYTE_BIT ; mm2=( 5 6 7 -) - movq mm4,mm3 - psrlq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( 7 - - -) + movq mm1,mm7 + movq mm2,mm3 + psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) + psrlq mm2,2*BYTE_BIT ; mm2=( 5 6 7 -) + movq mm4,mm3 + psrlq mm4,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm4=( 7 - - -) - por mm1, MMWORD [wk(0)] ; mm1=(-1 0 1 2) - por mm2, MMWORD [wk(2)] ; mm2=( 5 6 7 8) + por mm1, MMWORD [wk(0)] ; mm1=(-1 0 1 2) + por mm2, MMWORD [wk(2)] ; mm2=( 5 6 7 8) - movq MMWORD [wk(0)], mm4 + movq MMWORD [wk(0)], mm4 - pmullw mm7,[GOTOFF(ebx,PW_THREE)] - pmullw mm3,[GOTOFF(ebx,PW_THREE)] - paddw mm1,[GOTOFF(ebx,PW_EIGHT)] - paddw mm5,[GOTOFF(ebx,PW_EIGHT)] - paddw mm0,[GOTOFF(ebx,PW_SEVEN)] - paddw mm2,[GOTOFF(ebx,PW_SEVEN)] + pmullw mm7,[GOTOFF(ebx,PW_THREE)] + pmullw mm3,[GOTOFF(ebx,PW_THREE)] + paddw mm1,[GOTOFF(ebx,PW_EIGHT)] + paddw mm5,[GOTOFF(ebx,PW_EIGHT)] + paddw mm0,[GOTOFF(ebx,PW_SEVEN)] + paddw mm2,[GOTOFF(ebx,PW_SEVEN)] - paddw mm1,mm7 - paddw mm5,mm3 - psrlw mm1,4 ; mm1=Out0LE=( 0 2 4 6) - psrlw mm5,4 ; mm5=Out0HE=( 8 10 12 14) - paddw mm0,mm7 - paddw mm2,mm3 - psrlw mm0,4 ; mm0=Out0LO=( 1 3 5 7) - psrlw mm2,4 ; mm2=Out0HO=( 9 11 13 15) + paddw mm1,mm7 + paddw mm5,mm3 + psrlw mm1,4 ; mm1=Out0LE=( 0 2 4 6) + psrlw mm5,4 ; mm5=Out0HE=( 8 10 12 14) + paddw mm0,mm7 + paddw mm2,mm3 + psrlw mm0,4 ; mm0=Out0LO=( 1 3 5 7) + psrlw mm2,4 ; mm2=Out0HO=( 9 11 13 15) - psllw mm0,BYTE_BIT - psllw mm2,BYTE_BIT - por mm1,mm0 ; mm1=Out0L=( 0 1 2 3 4 5 6 7) - por mm5,mm2 ; mm5=Out0H=( 8 9 10 11 12 13 14 15) + psllw mm0,BYTE_BIT + psllw mm2,BYTE_BIT + por mm1,mm0 ; mm1=Out0L=( 0 1 2 3 4 5 6 7) + por mm5,mm2 ; mm5=Out0H=( 8 9 10 11 12 13 14 15) - movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 - movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 + movq MMWORD [edx+0*SIZEOF_MMWORD], mm1 + movq MMWORD [edx+1*SIZEOF_MMWORD], mm5 - ; -- process the lower row + ; -- process the lower row - movq mm6, MMWORD [edi+0*SIZEOF_MMWORD] ; mm6=Int1L=( 0 1 2 3) - movq mm4, MMWORD [edi+1*SIZEOF_MMWORD] ; mm4=Int1H=( 4 5 6 7) + movq mm6, MMWORD [edi+0*SIZEOF_MMWORD] ; mm6=Int1L=( 0 1 2 3) + movq mm4, MMWORD [edi+1*SIZEOF_MMWORD] ; mm4=Int1H=( 4 5 6 7) - movq mm7,mm6 - movq mm3,mm4 - psrlq mm7,2*BYTE_BIT ; mm7=( 1 2 3 -) - psllq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( - - - 4) - movq mm0,mm6 - movq mm2,mm4 - psrlq mm0,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm0=( 3 - - -) - psllq mm2,2*BYTE_BIT ; mm2=( - 4 5 6) + movq mm7,mm6 + movq mm3,mm4 + psrlq mm7,2*BYTE_BIT ; mm7=( 1 2 3 -) + psllq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( - - - 4) + movq mm0,mm6 + movq mm2,mm4 + psrlq mm0,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm0=( 3 - - -) + psllq mm2,2*BYTE_BIT ; mm2=( - 4 5 6) - por mm7,mm3 ; mm7=( 1 2 3 4) - por mm0,mm2 ; mm0=( 3 4 5 6) + por mm7,mm3 ; mm7=( 1 2 3 4) + por mm0,mm2 ; mm0=( 3 4 5 6) - movq mm1,mm6 - movq mm5,mm4 - psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) - psrlq mm5,2*BYTE_BIT ; mm5=( 5 6 7 -) - movq mm3,mm4 - psrlq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( 7 - - -) + movq mm1,mm6 + movq mm5,mm4 + psllq mm1,2*BYTE_BIT ; mm1=( - 0 1 2) + psrlq mm5,2*BYTE_BIT ; mm5=( 5 6 7 -) + movq mm3,mm4 + psrlq mm3,(SIZEOF_MMWORD-2)*BYTE_BIT ; mm3=( 7 - - -) - por mm1, MMWORD [wk(1)] ; mm1=(-1 0 1 2) - por mm5, MMWORD [wk(3)] ; mm5=( 5 6 7 8) + por mm1, MMWORD [wk(1)] ; mm1=(-1 0 1 2) + por mm5, MMWORD [wk(3)] ; mm5=( 5 6 7 8) - movq MMWORD [wk(1)], mm3 + movq MMWORD [wk(1)], mm3 - pmullw mm6,[GOTOFF(ebx,PW_THREE)] - pmullw mm4,[GOTOFF(ebx,PW_THREE)] - paddw mm1,[GOTOFF(ebx,PW_EIGHT)] - paddw mm0,[GOTOFF(ebx,PW_EIGHT)] - paddw mm7,[GOTOFF(ebx,PW_SEVEN)] - paddw mm5,[GOTOFF(ebx,PW_SEVEN)] + pmullw mm6,[GOTOFF(ebx,PW_THREE)] + pmullw mm4,[GOTOFF(ebx,PW_THREE)] + paddw mm1,[GOTOFF(ebx,PW_EIGHT)] + paddw mm0,[GOTOFF(ebx,PW_EIGHT)] + paddw mm7,[GOTOFF(ebx,PW_SEVEN)] + paddw mm5,[GOTOFF(ebx,PW_SEVEN)] - paddw mm1,mm6 - paddw mm0,mm4 - psrlw mm1,4 ; mm1=Out1LE=( 0 2 4 6) - psrlw mm0,4 ; mm0=Out1HE=( 8 10 12 14) - paddw mm7,mm6 - paddw mm5,mm4 - psrlw mm7,4 ; mm7=Out1LO=( 1 3 5 7) - psrlw mm5,4 ; mm5=Out1HO=( 9 11 13 15) + paddw mm1,mm6 + paddw mm0,mm4 + psrlw mm1,4 ; mm1=Out1LE=( 0 2 4 6) + psrlw mm0,4 ; mm0=Out1HE=( 8 10 12 14) + paddw mm7,mm6 + paddw mm5,mm4 + psrlw mm7,4 ; mm7=Out1LO=( 1 3 5 7) + psrlw mm5,4 ; mm5=Out1HO=( 9 11 13 15) - psllw mm7,BYTE_BIT - psllw mm5,BYTE_BIT - por mm1,mm7 ; mm1=Out1L=( 0 1 2 3 4 5 6 7) - por mm0,mm5 ; mm0=Out1H=( 8 9 10 11 12 13 14 15) + psllw mm7,BYTE_BIT + psllw mm5,BYTE_BIT + por mm1,mm7 ; mm1=Out1L=( 0 1 2 3 4 5 6 7) + por mm0,mm5 ; mm0=Out1H=( 8 9 10 11 12 13 14 15) - movq MMWORD [edi+0*SIZEOF_MMWORD], mm1 - movq MMWORD [edi+1*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm1 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm0 - poppic ebx + poppic ebx - sub eax, byte SIZEOF_MMWORD - add ecx, byte 1*SIZEOF_MMWORD ; inptr1(above) - add ebx, byte 1*SIZEOF_MMWORD ; inptr0 - add esi, byte 1*SIZEOF_MMWORD ; inptr1(below) - add edx, byte 2*SIZEOF_MMWORD ; outptr0 - add edi, byte 2*SIZEOF_MMWORD ; outptr1 - cmp eax, byte SIZEOF_MMWORD - ja near .columnloop - test eax,eax - jnz near .columnloop_last + sub eax, byte SIZEOF_MMWORD + add ecx, byte 1*SIZEOF_MMWORD ; inptr1(above) + add ebx, byte 1*SIZEOF_MMWORD ; inptr0 + add esi, byte 1*SIZEOF_MMWORD ; inptr1(below) + add edx, byte 2*SIZEOF_MMWORD ; outptr0 + add edi, byte 2*SIZEOF_MMWORD ; outptr1 + cmp eax, byte SIZEOF_MMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last - pop esi - pop edi - pop ecx - pop eax + pop esi + pop edi + pop ecx + pop eax - add esi, byte 1*SIZEOF_JSAMPROW ; input_data - add edi, byte 2*SIZEOF_JSAMPROW ; output_data - sub ecx, byte 2 ; rowctr - jg near .rowloop + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg near .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -536,94 +536,94 @@ EXTN(jsimd_h2v2_fancy_upsample_mmx): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define output_width(b) (b)+12 ; JDIMENSION output_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_upsample_mmx) + align 16 + global EXTN(jsimd_h2v1_upsample_mmx) EXTN(jsimd_h2v1_upsample_mmx): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov edx, JDIMENSION [output_width(ebp)] - add edx, byte (2*SIZEOF_MMWORD)-1 - and edx, byte -(2*SIZEOF_MMWORD) - jz short .return + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_MMWORD)-1 + and edx, byte -(2*SIZEOF_MMWORD) + jz short .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz short .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push edi - push esi + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr - mov eax,edx ; colctr - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + mov eax,edx ; colctr + alignx 16,7 .columnloop: - movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] - movq mm1,mm0 - punpcklbw mm0,mm0 - punpckhbw mm1,mm1 + movq mm1,mm0 + punpcklbw mm0,mm0 + punpckhbw mm1,mm1 - movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 - movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 - sub eax, byte 2*SIZEOF_MMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow - movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] - movq mm3,mm2 - punpcklbw mm2,mm2 - punpckhbw mm3,mm3 + movq mm3,mm2 + punpcklbw mm2,mm2 + punpckhbw mm3,mm3 - movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 - movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 - sub eax, byte 2*SIZEOF_MMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow - add esi, byte 2*SIZEOF_MMWORD ; inptr - add edi, byte 4*SIZEOF_MMWORD ; outptr - jmp short .columnloop - alignx 16,7 + add esi, byte 2*SIZEOF_MMWORD ; inptr + add edi, byte 4*SIZEOF_MMWORD ; outptr + jmp short .columnloop + alignx 16,7 .nextrow: - pop esi - pop edi + pop esi + pop edi - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec ecx ; rowctr - jg short .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg short .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -637,101 +637,101 @@ EXTN(jsimd_h2v1_upsample_mmx): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define output_width(b) (b)+12 ; JDIMENSION output_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v2_upsample_mmx) + align 16 + global EXTN(jsimd_h2v2_upsample_mmx) EXTN(jsimd_h2v2_upsample_mmx): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov edx, JDIMENSION [output_width(ebp)] - add edx, byte (2*SIZEOF_MMWORD)-1 - and edx, byte -(2*SIZEOF_MMWORD) - jz near .return + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_MMWORD)-1 + and edx, byte -(2*SIZEOF_MMWORD) + jz near .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz short .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push edi - push esi + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 - mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 - mov eax,edx ; colctr - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr + mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov eax,edx ; colctr + alignx 16,7 .columnloop: - movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] + movq mm0, MMWORD [esi+0*SIZEOF_MMWORD] - movq mm1,mm0 - punpcklbw mm0,mm0 - punpckhbw mm1,mm1 + movq mm1,mm0 + punpcklbw mm0,mm0 + punpckhbw mm1,mm1 - movq MMWORD [ebx+0*SIZEOF_MMWORD], mm0 - movq MMWORD [ebx+1*SIZEOF_MMWORD], mm1 - movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 - movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 + movq MMWORD [ebx+0*SIZEOF_MMWORD], mm0 + movq MMWORD [ebx+1*SIZEOF_MMWORD], mm1 + movq MMWORD [edi+0*SIZEOF_MMWORD], mm0 + movq MMWORD [edi+1*SIZEOF_MMWORD], mm1 - sub eax, byte 2*SIZEOF_MMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow - movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] + movq mm2, MMWORD [esi+1*SIZEOF_MMWORD] - movq mm3,mm2 - punpcklbw mm2,mm2 - punpckhbw mm3,mm3 + movq mm3,mm2 + punpcklbw mm2,mm2 + punpckhbw mm3,mm3 - movq MMWORD [ebx+2*SIZEOF_MMWORD], mm2 - movq MMWORD [ebx+3*SIZEOF_MMWORD], mm3 - movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 - movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 + movq MMWORD [ebx+2*SIZEOF_MMWORD], mm2 + movq MMWORD [ebx+3*SIZEOF_MMWORD], mm3 + movq MMWORD [edi+2*SIZEOF_MMWORD], mm2 + movq MMWORD [edi+3*SIZEOF_MMWORD], mm3 - sub eax, byte 2*SIZEOF_MMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_MMWORD + jz short .nextrow - add esi, byte 2*SIZEOF_MMWORD ; inptr - add ebx, byte 4*SIZEOF_MMWORD ; outptr0 - add edi, byte 4*SIZEOF_MMWORD ; outptr1 - jmp short .columnloop - alignx 16,7 + add esi, byte 2*SIZEOF_MMWORD ; inptr + add ebx, byte 4*SIZEOF_MMWORD ; outptr0 + add edi, byte 4*SIZEOF_MMWORD ; outptr1 + jmp short .columnloop + alignx 16,7 .nextrow: - pop esi - pop edi + pop esi + pop edi - add esi, byte 1*SIZEOF_JSAMPROW ; input_data - add edi, byte 2*SIZEOF_JSAMPROW ; output_data - sub ecx, byte 2 ; rowctr - jg short .rowloop + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg short .rowloop - emms ; empty MMX state + emms ; empty MMX state .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdsamss2-64.asm b/simd/jdsamss2-64.asm index f36c1562..a41d0593 100644 --- a/simd/jdsamss2-64.asm +++ b/simd/jdsamss2-64.asm @@ -20,24 +20,24 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fancy_upsample_sse2) + alignz 16 + global EXTN(jconst_fancy_upsample_sse2) EXTN(jconst_fancy_upsample_sse2): -PW_ONE times 8 dw 1 -PW_TWO times 8 dw 2 -PW_THREE times 8 dw 3 -PW_SEVEN times 8 dw 7 -PW_EIGHT times 8 dw 8 +PW_ONE times 8 dw 1 +PW_TWO times 8 dw 2 +PW_THREE times 8 dw 3 +PW_SEVEN times 8 dw 7 +PW_EIGHT times 8 dw 8 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. ; @@ -58,127 +58,127 @@ PW_EIGHT times 8 dw 8 ; r12 = JSAMPARRAY input_data ; r13 = JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_fancy_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_sse2) EXTN(jsimd_h2v1_fancy_upsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rax, r11 ; colctr - test rax,rax - jz near .return + mov rax, r11 ; colctr + test rax,rax + jz near .return - mov rcx, r10 ; rowctr - test rcx,rcx - jz near .return + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return - mov rsi, r12 ; input_data - mov rdi, r13 - mov rdi, JSAMPARRAY [rdi] ; output_data + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data .rowloop: - push rax ; colctr - push rdi - push rsi + push rax ; colctr + push rdi + push rsi - mov rsi, JSAMPROW [rsi] ; inptr - mov rdi, JSAMPROW [rdi] ; outptr + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr - test rax, SIZEOF_XMMWORD-1 - jz short .skip - mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + test rax, SIZEOF_XMMWORD-1 + jz short .skip + mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample .skip: - pxor xmm0,xmm0 ; xmm0=(all 0's) - pcmpeqb xmm7,xmm7 - psrldq xmm7,(SIZEOF_XMMWORD-1) - pand xmm7, XMMWORD [rsi+0*SIZEOF_XMMWORD] + pxor xmm0,xmm0 ; xmm0=(all 0's) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-1) + pand xmm7, XMMWORD [rsi+0*SIZEOF_XMMWORD] - add rax, byte SIZEOF_XMMWORD-1 - and rax, byte -SIZEOF_XMMWORD - cmp rax, byte SIZEOF_XMMWORD - ja short .columnloop + add rax, byte SIZEOF_XMMWORD-1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop .columnloop_last: - pcmpeqb xmm6,xmm6 - pslldq xmm6,(SIZEOF_XMMWORD-1) - pand xmm6, XMMWORD [rsi+0*SIZEOF_XMMWORD] - jmp short .upsample + pcmpeqb xmm6,xmm6 + pslldq xmm6,(SIZEOF_XMMWORD-1) + pand xmm6, XMMWORD [rsi+0*SIZEOF_XMMWORD] + jmp short .upsample .columnloop: - movdqa xmm6, XMMWORD [rsi+1*SIZEOF_XMMWORD] - pslldq xmm6,(SIZEOF_XMMWORD-1) + movdqa xmm6, XMMWORD [rsi+1*SIZEOF_XMMWORD] + pslldq xmm6,(SIZEOF_XMMWORD-1) .upsample: - movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqa xmm2,xmm1 - movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) - pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) - psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) + movdqa xmm1, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm2,xmm1 + movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) + pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) + psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) - por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) - por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) + por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) + por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) - movdqa xmm7,xmm1 - psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) + movdqa xmm7,xmm1 + psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) - movdqa xmm4,xmm1 - punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm2 - punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) - punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) - movdqa xmm6,xmm3 - punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) - punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) + movdqa xmm4,xmm1 + punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm2 + punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) + punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) + movdqa xmm6,xmm3 + punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) + punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) - pmullw xmm1,[rel PW_THREE] - pmullw xmm4,[rel PW_THREE] - paddw xmm2,[rel PW_ONE] - paddw xmm5,[rel PW_ONE] - paddw xmm3,[rel PW_TWO] - paddw xmm6,[rel PW_TWO] + pmullw xmm1,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] + paddw xmm2,[rel PW_ONE] + paddw xmm5,[rel PW_ONE] + paddw xmm3,[rel PW_TWO] + paddw xmm6,[rel PW_TWO] - paddw xmm2,xmm1 - paddw xmm5,xmm4 - psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) - psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) - paddw xmm3,xmm1 - paddw xmm6,xmm4 - psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) - psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) + paddw xmm2,xmm1 + paddw xmm5,xmm4 + psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) + paddw xmm3,xmm1 + paddw xmm6,xmm4 + psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) + psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) - psllw xmm3,BYTE_BIT - psllw xmm6,BYTE_BIT - por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) - por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) + psllw xmm3,BYTE_BIT + psllw xmm6,BYTE_BIT + por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) + por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm5 - sub rax, byte SIZEOF_XMMWORD - add rsi, byte 1*SIZEOF_XMMWORD ; inptr - add rdi, byte 2*SIZEOF_XMMWORD ; outptr - cmp rax, byte SIZEOF_XMMWORD - ja near .columnloop - test eax,eax - jnz near .columnloop_last + sub rax, byte SIZEOF_XMMWORD + add rsi, byte 1*SIZEOF_XMMWORD ; inptr + add rdi, byte 2*SIZEOF_XMMWORD ; outptr + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last - pop rsi - pop rdi - pop rax + pop rsi + pop rdi + pop rax - add rsi, byte SIZEOF_JSAMPROW ; input_data - add rdi, byte SIZEOF_JSAMPROW ; output_data - dec rcx ; rowctr - jg near .rowloop + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg near .rowloop .return: - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -197,288 +197,288 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2): ; r12 = JSAMPARRAY input_data ; r13 = JSAMPARRAY * output_data_ptr -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 4 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 4 - align 16 - global EXTN(jsimd_h2v2_fancy_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_sse2) EXTN(jsimd_h2v2_fancy_upsample_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + push rbx - mov rax, r11 ; colctr - test rax,rax - jz near .return + mov rax, r11 ; colctr + test rax,rax + jz near .return - mov rcx, r10 ; rowctr - test rcx,rcx - jz near .return + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return - mov rsi, r12 ; input_data - mov rdi, r13 - mov rdi, JSAMPARRAY [rdi] ; output_data + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data .rowloop: - push rax ; colctr - push rcx - push rdi - push rsi + push rax ; colctr + push rcx + push rdi + push rsi - mov rcx, JSAMPROW [rsi-1*SIZEOF_JSAMPROW] ; inptr1(above) - mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 - mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1(below) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 - mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 + mov rcx, JSAMPROW [rsi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov rbx, JSAMPROW [rsi+0*SIZEOF_JSAMPROW] ; inptr0 + mov rsi, JSAMPROW [rsi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 + mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 - test rax, SIZEOF_XMMWORD-1 - jz short .skip - push rdx - mov dl, JSAMPLE [rcx+(rax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [rcx+rax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [rbx+(rax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [rbx+rax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample - pop rdx + test rax, SIZEOF_XMMWORD-1 + jz short .skip + push rdx + mov dl, JSAMPLE [rcx+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rcx+rax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rbx+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rbx+rax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [rsi+(rax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [rsi+rax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop rdx .skip: - ; -- process the first column block + ; -- process the first column block - movdqa xmm0, XMMWORD [rbx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] - movdqa xmm1, XMMWORD [rcx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] - movdqa xmm2, XMMWORD [rsi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] + movdqa xmm0, XMMWORD [rbx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] + movdqa xmm1, XMMWORD [rcx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] + movdqa xmm2, XMMWORD [rsi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] - pxor xmm3,xmm3 ; xmm3=(all 0's) - movdqa xmm4,xmm0 - punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm1 - punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) - movdqa xmm6,xmm2 - punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[rel PW_THREE] - pmullw xmm4,[rel PW_THREE] + pmullw xmm0,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] - pcmpeqb xmm7,xmm7 - psrldq xmm7,(SIZEOF_XMMWORD-2) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-2) - paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) - paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) - paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) - paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) - movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save - movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm6 + movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm6 - pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) - pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) + pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) + pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) - movdqa XMMWORD [wk(0)], xmm1 - movdqa XMMWORD [wk(1)], xmm2 + movdqa XMMWORD [wk(0)], xmm1 + movdqa XMMWORD [wk(1)], xmm2 - add rax, byte SIZEOF_XMMWORD-1 - and rax, byte -SIZEOF_XMMWORD - cmp rax, byte SIZEOF_XMMWORD - ja short .columnloop + add rax, byte SIZEOF_XMMWORD-1 + and rax, byte -SIZEOF_XMMWORD + cmp rax, byte SIZEOF_XMMWORD + ja short .columnloop .columnloop_last: - ; -- process the last column block + ; -- process the last column block - pcmpeqb xmm1,xmm1 - pslldq xmm1,(SIZEOF_XMMWORD-2) - movdqa xmm2,xmm1 + pcmpeqb xmm1,xmm1 + pslldq xmm1,(SIZEOF_XMMWORD-2) + movdqa xmm2,xmm1 - pand xmm1, XMMWORD [rdx+1*SIZEOF_XMMWORD] - pand xmm2, XMMWORD [rdi+1*SIZEOF_XMMWORD] + pand xmm1, XMMWORD [rdx+1*SIZEOF_XMMWORD] + pand xmm2, XMMWORD [rdi+1*SIZEOF_XMMWORD] - movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) - movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) - jmp near .upsample + jmp near .upsample .columnloop: - ; -- process the next column block + ; -- process the next column block - movdqa xmm0, XMMWORD [rbx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] - movdqa xmm1, XMMWORD [rcx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] - movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] + movdqa xmm0, XMMWORD [rbx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] + movdqa xmm1, XMMWORD [rcx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] - pxor xmm3,xmm3 ; xmm3=(all 0's) - movdqa xmm4,xmm0 - punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm1 - punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) - movdqa xmm6,xmm2 - punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[rel PW_THREE] - pmullw xmm4,[rel PW_THREE] + pmullw xmm0,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] - paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) - paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) - paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) - paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) - movdqa XMMWORD [rdx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save - movdqa XMMWORD [rdx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data - movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm6 + movdqa XMMWORD [rdx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [rdx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm6 - pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) - pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) + pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) + pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) - movdqa XMMWORD [wk(2)], xmm1 - movdqa XMMWORD [wk(3)], xmm2 + movdqa XMMWORD [wk(2)], xmm1 + movdqa XMMWORD [wk(3)], xmm2 .upsample: - ; -- process the upper row + ; -- process the upper row - movdqa xmm7, XMMWORD [rdx+0*SIZEOF_XMMWORD] - movdqa xmm3, XMMWORD [rdx+1*SIZEOF_XMMWORD] + movdqa xmm7, XMMWORD [rdx+0*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [rdx+1*SIZEOF_XMMWORD] - movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) - movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) - psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) - pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) - movdqa xmm5,xmm7 - movdqa xmm6,xmm3 - psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) - pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) + movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) + movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) + psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) + pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) + movdqa xmm5,xmm7 + movdqa xmm6,xmm3 + psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) + pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) - por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) - por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) + por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) + por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) - movdqa xmm1,xmm7 - movdqa xmm2,xmm3 - pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) - psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) - movdqa xmm4,xmm3 - psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) + movdqa xmm1,xmm7 + movdqa xmm2,xmm3 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) + movdqa xmm4,xmm3 + psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) - por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) - por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) + por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) - movdqa XMMWORD [wk(0)], xmm4 + movdqa XMMWORD [wk(0)], xmm4 - pmullw xmm7,[rel PW_THREE] - pmullw xmm3,[rel PW_THREE] - paddw xmm1,[rel PW_EIGHT] - paddw xmm5,[rel PW_EIGHT] - paddw xmm0,[rel PW_SEVEN] - paddw xmm2,[rel PW_SEVEN] + pmullw xmm7,[rel PW_THREE] + pmullw xmm3,[rel PW_THREE] + paddw xmm1,[rel PW_EIGHT] + paddw xmm5,[rel PW_EIGHT] + paddw xmm0,[rel PW_SEVEN] + paddw xmm2,[rel PW_SEVEN] - paddw xmm1,xmm7 - paddw xmm5,xmm3 - psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) - psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) - paddw xmm0,xmm7 - paddw xmm2,xmm3 - psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) - psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) + paddw xmm1,xmm7 + paddw xmm5,xmm3 + psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) + paddw xmm0,xmm7 + paddw xmm2,xmm3 + psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) + psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) - psllw xmm0,BYTE_BIT - psllw xmm2,BYTE_BIT - por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) - por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) + psllw xmm0,BYTE_BIT + psllw xmm2,BYTE_BIT + por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) + por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) - movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [rdx+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdx+1*SIZEOF_XMMWORD], xmm5 - ; -- process the lower row + ; -- process the lower row - movdqa xmm6, XMMWORD [rdi+0*SIZEOF_XMMWORD] - movdqa xmm4, XMMWORD [rdi+1*SIZEOF_XMMWORD] + movdqa xmm6, XMMWORD [rdi+0*SIZEOF_XMMWORD] + movdqa xmm4, XMMWORD [rdi+1*SIZEOF_XMMWORD] - movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) - movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) - psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) - pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) - movdqa xmm0,xmm6 - movdqa xmm2,xmm4 - psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) - pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) + movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) + movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) + psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) + pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) + movdqa xmm0,xmm6 + movdqa xmm2,xmm4 + psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) + pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) - por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) - por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) + por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) + por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) - movdqa xmm1,xmm6 - movdqa xmm5,xmm4 - pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) - psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) - movdqa xmm3,xmm4 - psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) + movdqa xmm3,xmm4 + psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) - por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) - por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) + por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) - movdqa XMMWORD [wk(1)], xmm3 + movdqa XMMWORD [wk(1)], xmm3 - pmullw xmm6,[rel PW_THREE] - pmullw xmm4,[rel PW_THREE] - paddw xmm1,[rel PW_EIGHT] - paddw xmm0,[rel PW_EIGHT] - paddw xmm7,[rel PW_SEVEN] - paddw xmm5,[rel PW_SEVEN] + pmullw xmm6,[rel PW_THREE] + pmullw xmm4,[rel PW_THREE] + paddw xmm1,[rel PW_EIGHT] + paddw xmm0,[rel PW_EIGHT] + paddw xmm7,[rel PW_SEVEN] + paddw xmm5,[rel PW_SEVEN] - paddw xmm1,xmm6 - paddw xmm0,xmm4 - psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) - psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) - paddw xmm7,xmm6 - paddw xmm5,xmm4 - psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) - psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) + paddw xmm1,xmm6 + paddw xmm0,xmm4 + psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) + psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) + paddw xmm7,xmm6 + paddw xmm5,xmm4 + psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) + psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) - psllw xmm7,BYTE_BIT - psllw xmm5,BYTE_BIT - por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) - por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) + psllw xmm7,BYTE_BIT + psllw xmm5,BYTE_BIT + por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) + por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm0 - sub rax, byte SIZEOF_XMMWORD - add rcx, byte 1*SIZEOF_XMMWORD ; inptr1(above) - add rbx, byte 1*SIZEOF_XMMWORD ; inptr0 - add rsi, byte 1*SIZEOF_XMMWORD ; inptr1(below) - add rdx, byte 2*SIZEOF_XMMWORD ; outptr0 - add rdi, byte 2*SIZEOF_XMMWORD ; outptr1 - cmp rax, byte SIZEOF_XMMWORD - ja near .columnloop - test rax,rax - jnz near .columnloop_last + sub rax, byte SIZEOF_XMMWORD + add rcx, byte 1*SIZEOF_XMMWORD ; inptr1(above) + add rbx, byte 1*SIZEOF_XMMWORD ; inptr0 + add rsi, byte 1*SIZEOF_XMMWORD ; inptr1(below) + add rdx, byte 2*SIZEOF_XMMWORD ; outptr0 + add rdi, byte 2*SIZEOF_XMMWORD ; outptr1 + cmp rax, byte SIZEOF_XMMWORD + ja near .columnloop + test rax,rax + jnz near .columnloop_last - pop rsi - pop rdi - pop rcx - pop rax + pop rsi + pop rdi + pop rcx + pop rax - add rsi, byte 1*SIZEOF_JSAMPROW ; input_data - add rdi, byte 2*SIZEOF_JSAMPROW ; output_data - sub rcx, byte 2 ; rowctr - jg near .rowloop + add rsi, byte 1*SIZEOF_JSAMPROW ; input_data + add rdi, byte 2*SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop .return: - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -497,77 +497,77 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): ; r12 = JSAMPARRAY input_data ; r13 = JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_upsample_sse2) EXTN(jsimd_h2v1_upsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args + push rbp + mov rax,rsp + mov rbp,rsp + collect_args - mov rdx, r11 - add rdx, byte (2*SIZEOF_XMMWORD)-1 - and rdx, byte -(2*SIZEOF_XMMWORD) - jz near .return + mov rdx, r11 + add rdx, byte (2*SIZEOF_XMMWORD)-1 + and rdx, byte -(2*SIZEOF_XMMWORD) + jz near .return - mov rcx, r10 ; rowctr - test rcx,rcx - jz short .return + mov rcx, r10 ; rowctr + test rcx,rcx + jz short .return - mov rsi, r12 ; input_data - mov rdi, r13 - mov rdi, JSAMPARRAY [rdi] ; output_data + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data .rowloop: - push rdi - push rsi + push rdi + push rsi - mov rsi, JSAMPROW [rsi] ; inptr - mov rdi, JSAMPROW [rdi] ; outptr - mov rax,rdx ; colctr + mov rsi, JSAMPROW [rsi] ; inptr + mov rdi, JSAMPROW [rdi] ; outptr + mov rax,rdx ; colctr .columnloop: - movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqa xmm1,xmm0 - punpcklbw xmm0,xmm0 - punpckhbw xmm1,xmm1 + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 - sub rax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqa xmm3,xmm2 - punpcklbw xmm2,xmm2 - punpckhbw xmm3,xmm3 + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 - movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 - sub rax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - add rsi, byte 2*SIZEOF_XMMWORD ; inptr - add rdi, byte 4*SIZEOF_XMMWORD ; outptr - jmp short .columnloop + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rdi, byte 4*SIZEOF_XMMWORD ; outptr + jmp short .columnloop .nextrow: - pop rsi - pop rdi + pop rsi + pop rdi - add rsi, byte SIZEOF_JSAMPROW ; input_data - add rdi, byte SIZEOF_JSAMPROW ; output_data - dec rcx ; rowctr - jg short .rowloop + add rsi, byte SIZEOF_JSAMPROW ; input_data + add rdi, byte SIZEOF_JSAMPROW ; output_data + dec rcx ; rowctr + jg short .rowloop .return: - uncollect_args - pop rbp - ret + uncollect_args + pop rbp + ret ; -------------------------------------------------------------------------- ; @@ -586,86 +586,86 @@ EXTN(jsimd_h2v1_upsample_sse2): ; r12 = JSAMPARRAY input_data ; r13 = JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v2_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_upsample_sse2) EXTN(jsimd_h2v2_upsample_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args - push rbx + push rbp + mov rax,rsp + mov rbp,rsp + collect_args + push rbx - mov rdx, r11 - add rdx, byte (2*SIZEOF_XMMWORD)-1 - and rdx, byte -(2*SIZEOF_XMMWORD) - jz near .return + mov rdx, r11 + add rdx, byte (2*SIZEOF_XMMWORD)-1 + and rdx, byte -(2*SIZEOF_XMMWORD) + jz near .return - mov rcx, r10 ; rowctr - test rcx,rcx - jz near .return + mov rcx, r10 ; rowctr + test rcx,rcx + jz near .return - mov rsi, r12 ; input_data - mov rdi, r13 - mov rdi, JSAMPARRAY [rdi] ; output_data + mov rsi, r12 ; input_data + mov rdi, r13 + mov rdi, JSAMPARRAY [rdi] ; output_data .rowloop: - push rdi - push rsi + push rdi + push rsi - mov rsi, JSAMPROW [rsi] ; inptr - mov rbx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 - mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 - mov rax,rdx ; colctr + mov rsi, JSAMPROW [rsi] ; inptr + mov rbx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] ; outptr0 + mov rdi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] ; outptr1 + mov rax,rdx ; colctr .columnloop: - movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [rsi+0*SIZEOF_XMMWORD] - movdqa xmm1,xmm0 - punpcklbw xmm0,xmm0 - punpckhbw xmm1,xmm1 + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 - movdqa XMMWORD [rbx+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [rbx+1*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rbx+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rbx+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [rdi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [rdi+1*SIZEOF_XMMWORD], xmm1 - sub rax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [rsi+1*SIZEOF_XMMWORD] - movdqa xmm3,xmm2 - punpcklbw xmm2,xmm2 - punpckhbw xmm3,xmm3 + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 - movdqa XMMWORD [rbx+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rbx+3*SIZEOF_XMMWORD], xmm3 - movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [rbx+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rbx+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [rdi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [rdi+3*SIZEOF_XMMWORD], xmm3 - sub rax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub rax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - add rsi, byte 2*SIZEOF_XMMWORD ; inptr - add rbx, byte 4*SIZEOF_XMMWORD ; outptr0 - add rdi, byte 4*SIZEOF_XMMWORD ; outptr1 - jmp short .columnloop + add rsi, byte 2*SIZEOF_XMMWORD ; inptr + add rbx, byte 4*SIZEOF_XMMWORD ; outptr0 + add rdi, byte 4*SIZEOF_XMMWORD ; outptr1 + jmp short .columnloop .nextrow: - pop rsi - pop rdi + pop rsi + pop rdi - add rsi, byte 1*SIZEOF_JSAMPROW ; input_data - add rdi, byte 2*SIZEOF_JSAMPROW ; output_data - sub rcx, byte 2 ; rowctr - jg near .rowloop + add rsi, byte 1*SIZEOF_JSAMPROW ; input_data + add rdi, byte 2*SIZEOF_JSAMPROW ; output_data + sub rcx, byte 2 ; rowctr + jg near .rowloop .return: - pop rbx - uncollect_args - pop rbp - ret + pop rbx + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jdsamss2.asm b/simd/jdsamss2.asm index b5c863b4..2259026b 100644 --- a/simd/jdsamss2.asm +++ b/simd/jdsamss2.asm @@ -19,24 +19,24 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fancy_upsample_sse2) + alignz 16 + global EXTN(jconst_fancy_upsample_sse2) EXTN(jconst_fancy_upsample_sse2): -PW_ONE times 8 dw 1 -PW_TWO times 8 dw 2 -PW_THREE times 8 dw 3 -PW_SEVEN times 8 dw 7 -PW_EIGHT times 8 dw 8 +PW_ONE times 8 dw 1 +PW_TWO times 8 dw 2 +PW_THREE times 8 dw 3 +PW_SEVEN times 8 dw 7 +PW_EIGHT times 8 dw 8 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. ; @@ -52,144 +52,144 @@ PW_EIGHT times 8 dw 8 ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_fancy_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_fancy_upsample_sse2) EXTN(jsimd_h2v1_fancy_upsample_sse2): - push ebp - mov ebp,esp - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr - test eax,eax - jz near .return + mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr + test eax,eax + jz near .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz near .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push eax ; colctr - push edi - push esi + push eax ; colctr + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr - test eax, SIZEOF_XMMWORD-1 - jz short .skip - mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + test eax, SIZEOF_XMMWORD-1 + jz short .skip + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample .skip: - pxor xmm0,xmm0 ; xmm0=(all 0's) - pcmpeqb xmm7,xmm7 - psrldq xmm7,(SIZEOF_XMMWORD-1) - pand xmm7, XMMWORD [esi+0*SIZEOF_XMMWORD] + pxor xmm0,xmm0 ; xmm0=(all 0's) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-1) + pand xmm7, XMMWORD [esi+0*SIZEOF_XMMWORD] - add eax, byte SIZEOF_XMMWORD-1 - and eax, byte -SIZEOF_XMMWORD - cmp eax, byte SIZEOF_XMMWORD - ja short .columnloop - alignx 16,7 + add eax, byte SIZEOF_XMMWORD-1 + and eax, byte -SIZEOF_XMMWORD + cmp eax, byte SIZEOF_XMMWORD + ja short .columnloop + alignx 16,7 .columnloop_last: - pcmpeqb xmm6,xmm6 - pslldq xmm6,(SIZEOF_XMMWORD-1) - pand xmm6, XMMWORD [esi+0*SIZEOF_XMMWORD] - jmp short .upsample - alignx 16,7 + pcmpeqb xmm6,xmm6 + pslldq xmm6,(SIZEOF_XMMWORD-1) + pand xmm6, XMMWORD [esi+0*SIZEOF_XMMWORD] + jmp short .upsample + alignx 16,7 .columnloop: - movdqa xmm6, XMMWORD [esi+1*SIZEOF_XMMWORD] - pslldq xmm6,(SIZEOF_XMMWORD-1) + movdqa xmm6, XMMWORD [esi+1*SIZEOF_XMMWORD] + pslldq xmm6,(SIZEOF_XMMWORD-1) .upsample: - movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqa xmm2,xmm1 - movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) - pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) - psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) + movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm2,xmm1 + movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) + pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) + psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) - por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) - por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) + por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) + por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) - movdqa xmm7,xmm1 - psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) + movdqa xmm7,xmm1 + psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) - movdqa xmm4,xmm1 - punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm2 - punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) - punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) - movdqa xmm6,xmm3 - punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) - punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) + movdqa xmm4,xmm1 + punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm2 + punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) + punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) + movdqa xmm6,xmm3 + punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) + punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) - pmullw xmm1,[GOTOFF(ebx,PW_THREE)] - pmullw xmm4,[GOTOFF(ebx,PW_THREE)] - paddw xmm2,[GOTOFF(ebx,PW_ONE)] - paddw xmm5,[GOTOFF(ebx,PW_ONE)] - paddw xmm3,[GOTOFF(ebx,PW_TWO)] - paddw xmm6,[GOTOFF(ebx,PW_TWO)] + pmullw xmm1,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + paddw xmm2,[GOTOFF(ebx,PW_ONE)] + paddw xmm5,[GOTOFF(ebx,PW_ONE)] + paddw xmm3,[GOTOFF(ebx,PW_TWO)] + paddw xmm6,[GOTOFF(ebx,PW_TWO)] - paddw xmm2,xmm1 - paddw xmm5,xmm4 - psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) - psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) - paddw xmm3,xmm1 - paddw xmm6,xmm4 - psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) - psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) + paddw xmm2,xmm1 + paddw xmm5,xmm4 + psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) + paddw xmm3,xmm1 + paddw xmm6,xmm4 + psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) + psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) - psllw xmm3,BYTE_BIT - psllw xmm6,BYTE_BIT - por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) - por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) + psllw xmm3,BYTE_BIT + psllw xmm6,BYTE_BIT + por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) + por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm5 - sub eax, byte SIZEOF_XMMWORD - add esi, byte 1*SIZEOF_XMMWORD ; inptr - add edi, byte 2*SIZEOF_XMMWORD ; outptr - cmp eax, byte SIZEOF_XMMWORD - ja near .columnloop - test eax,eax - jnz near .columnloop_last + sub eax, byte SIZEOF_XMMWORD + add esi, byte 1*SIZEOF_XMMWORD ; inptr + add edi, byte 2*SIZEOF_XMMWORD ; outptr + cmp eax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last - pop esi - pop edi - pop eax + pop esi + pop edi + pop eax - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec ecx ; rowctr - jg near .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -203,322 +203,322 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 4 -%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 4 +%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr - align 16 - global EXTN(jsimd_h2v2_fancy_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_fancy_upsample_sse2) EXTN(jsimd_h2v2_fancy_upsample_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic eax ; make a room for GOT address - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic eax ; make a room for GOT address + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address - movpic POINTER [gotptr], ebx ; save GOT address + get_GOT ebx ; get GOT address + movpic POINTER [gotptr], ebx ; save GOT address - mov edx,eax ; edx = original ebp - mov eax, JDIMENSION [downsamp_width(edx)] ; colctr - test eax,eax - jz near .return + mov edx,eax ; edx = original ebp + mov eax, JDIMENSION [downsamp_width(edx)] ; colctr + test eax,eax + jz near .return - mov ecx, INT [max_v_samp(edx)] ; rowctr - test ecx,ecx - jz near .return + mov ecx, INT [max_v_samp(edx)] ; rowctr + test ecx,ecx + jz near .return - mov esi, JSAMPARRAY [input_data(edx)] ; input_data - mov edi, POINTER [output_data_ptr(edx)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(edx)] ; input_data + mov edi, POINTER [output_data_ptr(edx)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push eax ; colctr - push ecx - push edi - push esi + push eax ; colctr + push ecx + push edi + push esi - mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) - mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 - mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 - mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) + mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 + mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 - test eax, SIZEOF_XMMWORD-1 - jz short .skip - push edx - mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl - mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] - mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample - pop edx + test eax, SIZEOF_XMMWORD-1 + jz short .skip + push edx + mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl + mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] + mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample + pop edx .skip: - ; -- process the first column block + ; -- process the first column block - movdqa xmm0, XMMWORD [ebx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] - movdqa xmm1, XMMWORD [ecx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] - movdqa xmm2, XMMWORD [esi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] + movdqa xmm0, XMMWORD [ebx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] + movdqa xmm1, XMMWORD [ecx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] + movdqa xmm2, XMMWORD [esi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pxor xmm3,xmm3 ; xmm3=(all 0's) - movdqa xmm4,xmm0 - punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm1 - punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) - movdqa xmm6,xmm2 - punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[GOTOFF(ebx,PW_THREE)] - pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + pmullw xmm0,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] - pcmpeqb xmm7,xmm7 - psrldq xmm7,(SIZEOF_XMMWORD-2) + pcmpeqb xmm7,xmm7 + psrldq xmm7,(SIZEOF_XMMWORD-2) - paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) - paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) - paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) - paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) - movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save - movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm6 + movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm6 - pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) - pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) + pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) + pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) - movdqa XMMWORD [wk(0)], xmm1 - movdqa XMMWORD [wk(1)], xmm2 + movdqa XMMWORD [wk(0)], xmm1 + movdqa XMMWORD [wk(1)], xmm2 - poppic ebx + poppic ebx - add eax, byte SIZEOF_XMMWORD-1 - and eax, byte -SIZEOF_XMMWORD - cmp eax, byte SIZEOF_XMMWORD - ja short .columnloop - alignx 16,7 + add eax, byte SIZEOF_XMMWORD-1 + and eax, byte -SIZEOF_XMMWORD + cmp eax, byte SIZEOF_XMMWORD + ja short .columnloop + alignx 16,7 .columnloop_last: - ; -- process the last column block + ; -- process the last column block - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pcmpeqb xmm1,xmm1 - pslldq xmm1,(SIZEOF_XMMWORD-2) - movdqa xmm2,xmm1 + pcmpeqb xmm1,xmm1 + pslldq xmm1,(SIZEOF_XMMWORD-2) + movdqa xmm2,xmm1 - pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] - pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] + pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] + pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] - movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) - movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) + movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) - jmp near .upsample - alignx 16,7 + jmp near .upsample + alignx 16,7 .columnloop: - ; -- process the next column block + ; -- process the next column block - movdqa xmm0, XMMWORD [ebx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] - movdqa xmm1, XMMWORD [ecx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] - movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] + movdqa xmm0, XMMWORD [ebx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] + movdqa xmm1, XMMWORD [ecx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] - pushpic ebx - movpic ebx, POINTER [gotptr] ; load GOT address + pushpic ebx + movpic ebx, POINTER [gotptr] ; load GOT address - pxor xmm3,xmm3 ; xmm3=(all 0's) - movdqa xmm4,xmm0 - punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) - punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) - movdqa xmm5,xmm1 - punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) - movdqa xmm6,xmm2 - punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) - punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) + pxor xmm3,xmm3 ; xmm3=(all 0's) + movdqa xmm4,xmm0 + punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) + punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) + movdqa xmm5,xmm1 + punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) + movdqa xmm6,xmm2 + punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) + punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) - pmullw xmm0,[GOTOFF(ebx,PW_THREE)] - pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + pmullw xmm0,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] - paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) - paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) - paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) - paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) + paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) + paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) + paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) + paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) - movdqa XMMWORD [edx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save - movdqa XMMWORD [edx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data - movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm6 + movdqa XMMWORD [edx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save + movdqa XMMWORD [edx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm6 - pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) - pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) + pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) + pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) - movdqa XMMWORD [wk(2)], xmm1 - movdqa XMMWORD [wk(3)], xmm2 + movdqa XMMWORD [wk(2)], xmm1 + movdqa XMMWORD [wk(3)], xmm2 .upsample: - ; -- process the upper row + ; -- process the upper row - movdqa xmm7, XMMWORD [edx+0*SIZEOF_XMMWORD] - movdqa xmm3, XMMWORD [edx+1*SIZEOF_XMMWORD] + movdqa xmm7, XMMWORD [edx+0*SIZEOF_XMMWORD] + movdqa xmm3, XMMWORD [edx+1*SIZEOF_XMMWORD] - movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) - movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) - psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) - pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) - movdqa xmm5,xmm7 - movdqa xmm6,xmm3 - psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) - pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) + movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) + movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) + psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) + pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) + movdqa xmm5,xmm7 + movdqa xmm6,xmm3 + psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) + pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) - por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) - por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) + por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) + por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) - movdqa xmm1,xmm7 - movdqa xmm2,xmm3 - pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) - psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) - movdqa xmm4,xmm3 - psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) + movdqa xmm1,xmm7 + movdqa xmm2,xmm3 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) + movdqa xmm4,xmm3 + psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) - por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) - por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) + por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) - movdqa XMMWORD [wk(0)], xmm4 + movdqa XMMWORD [wk(0)], xmm4 - pmullw xmm7,[GOTOFF(ebx,PW_THREE)] - pmullw xmm3,[GOTOFF(ebx,PW_THREE)] - paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] - paddw xmm5,[GOTOFF(ebx,PW_EIGHT)] - paddw xmm0,[GOTOFF(ebx,PW_SEVEN)] - paddw xmm2,[GOTOFF(ebx,PW_SEVEN)] + pmullw xmm7,[GOTOFF(ebx,PW_THREE)] + pmullw xmm3,[GOTOFF(ebx,PW_THREE)] + paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm5,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm0,[GOTOFF(ebx,PW_SEVEN)] + paddw xmm2,[GOTOFF(ebx,PW_SEVEN)] - paddw xmm1,xmm7 - paddw xmm5,xmm3 - psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) - psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) - paddw xmm0,xmm7 - paddw xmm2,xmm3 - psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) - psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) + paddw xmm1,xmm7 + paddw xmm5,xmm3 + psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) + psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) + paddw xmm0,xmm7 + paddw xmm2,xmm3 + psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) + psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) - psllw xmm0,BYTE_BIT - psllw xmm2,BYTE_BIT - por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) - por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) + psllw xmm0,BYTE_BIT + psllw xmm2,BYTE_BIT + por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) + por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) - movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 + movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 - ; -- process the lower row + ; -- process the lower row - movdqa xmm6, XMMWORD [edi+0*SIZEOF_XMMWORD] - movdqa xmm4, XMMWORD [edi+1*SIZEOF_XMMWORD] + movdqa xmm6, XMMWORD [edi+0*SIZEOF_XMMWORD] + movdqa xmm4, XMMWORD [edi+1*SIZEOF_XMMWORD] - movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) - movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) - psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) - pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) - movdqa xmm0,xmm6 - movdqa xmm2,xmm4 - psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) - pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) + movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) + movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) + psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) + pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) + movdqa xmm0,xmm6 + movdqa xmm2,xmm4 + psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) + pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) - por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) - por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) + por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) + por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) - movdqa xmm1,xmm6 - movdqa xmm5,xmm4 - pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) - psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) - movdqa xmm3,xmm4 - psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) + movdqa xmm1,xmm6 + movdqa xmm5,xmm4 + pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) + psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) + movdqa xmm3,xmm4 + psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) - por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) - por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) + por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) + por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) - movdqa XMMWORD [wk(1)], xmm3 + movdqa XMMWORD [wk(1)], xmm3 - pmullw xmm6,[GOTOFF(ebx,PW_THREE)] - pmullw xmm4,[GOTOFF(ebx,PW_THREE)] - paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] - paddw xmm0,[GOTOFF(ebx,PW_EIGHT)] - paddw xmm7,[GOTOFF(ebx,PW_SEVEN)] - paddw xmm5,[GOTOFF(ebx,PW_SEVEN)] + pmullw xmm6,[GOTOFF(ebx,PW_THREE)] + pmullw xmm4,[GOTOFF(ebx,PW_THREE)] + paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm0,[GOTOFF(ebx,PW_EIGHT)] + paddw xmm7,[GOTOFF(ebx,PW_SEVEN)] + paddw xmm5,[GOTOFF(ebx,PW_SEVEN)] - paddw xmm1,xmm6 - paddw xmm0,xmm4 - psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) - psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) - paddw xmm7,xmm6 - paddw xmm5,xmm4 - psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) - psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) + paddw xmm1,xmm6 + paddw xmm0,xmm4 + psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) + psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) + paddw xmm7,xmm6 + paddw xmm5,xmm4 + psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) + psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) - psllw xmm7,BYTE_BIT - psllw xmm5,BYTE_BIT - por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) - por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) + psllw xmm7,BYTE_BIT + psllw xmm5,BYTE_BIT + por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) + por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm0 - poppic ebx + poppic ebx - sub eax, byte SIZEOF_XMMWORD - add ecx, byte 1*SIZEOF_XMMWORD ; inptr1(above) - add ebx, byte 1*SIZEOF_XMMWORD ; inptr0 - add esi, byte 1*SIZEOF_XMMWORD ; inptr1(below) - add edx, byte 2*SIZEOF_XMMWORD ; outptr0 - add edi, byte 2*SIZEOF_XMMWORD ; outptr1 - cmp eax, byte SIZEOF_XMMWORD - ja near .columnloop - test eax,eax - jnz near .columnloop_last + sub eax, byte SIZEOF_XMMWORD + add ecx, byte 1*SIZEOF_XMMWORD ; inptr1(above) + add ebx, byte 1*SIZEOF_XMMWORD ; inptr0 + add esi, byte 1*SIZEOF_XMMWORD ; inptr1(below) + add edx, byte 2*SIZEOF_XMMWORD ; outptr0 + add edi, byte 2*SIZEOF_XMMWORD ; outptr1 + cmp eax, byte SIZEOF_XMMWORD + ja near .columnloop + test eax,eax + jnz near .columnloop_last - pop esi - pop edi - pop ecx - pop eax + pop esi + pop edi + pop ecx + pop eax - add esi, byte 1*SIZEOF_JSAMPROW ; input_data - add edi, byte 2*SIZEOF_JSAMPROW ; output_data - sub ecx, byte 2 ; rowctr - jg near .rowloop + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg near .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -532,92 +532,92 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define output_width(b) (b)+12 ; JDIMENSION output_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v1_upsample_sse2) + align 16 + global EXTN(jsimd_h2v1_upsample_sse2) EXTN(jsimd_h2v1_upsample_sse2): - push ebp - mov ebp,esp -; push ebx ; unused -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp +; push ebx ; unused +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov edx, JDIMENSION [output_width(ebp)] - add edx, byte (2*SIZEOF_XMMWORD)-1 - and edx, byte -(2*SIZEOF_XMMWORD) - jz short .return + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_XMMWORD)-1 + and edx, byte -(2*SIZEOF_XMMWORD) + jz short .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz short .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz short .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push edi - push esi + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov edi, JSAMPROW [edi] ; outptr - mov eax,edx ; colctr - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr + mov edi, JSAMPROW [edi] ; outptr + mov eax,edx ; colctr + alignx 16,7 .columnloop: - movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqa xmm1,xmm0 - punpcklbw xmm0,xmm0 - punpckhbw xmm1,xmm1 + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 - sub eax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqa xmm3,xmm2 - punpcklbw xmm2,xmm2 - punpckhbw xmm3,xmm3 + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 - movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 - sub eax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - add esi, byte 2*SIZEOF_XMMWORD ; inptr - add edi, byte 4*SIZEOF_XMMWORD ; outptr - jmp short .columnloop - alignx 16,7 + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add edi, byte 4*SIZEOF_XMMWORD ; outptr + jmp short .columnloop + alignx 16,7 .nextrow: - pop esi - pop edi + pop esi + pop edi - add esi, byte SIZEOF_JSAMPROW ; input_data - add edi, byte SIZEOF_JSAMPROW ; output_data - dec ecx ; rowctr - jg short .rowloop + add esi, byte SIZEOF_JSAMPROW ; input_data + add edi, byte SIZEOF_JSAMPROW ; output_data + dec ecx ; rowctr + jg short .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved -; pop ebx ; unused - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved +; pop ebx ; unused + pop ebp + ret ; -------------------------------------------------------------------------- ; @@ -631,99 +631,99 @@ EXTN(jsimd_h2v1_upsample_sse2): ; JSAMPARRAY * output_data_ptr); ; -%define max_v_samp(b) (b)+8 ; int max_v_samp_factor -%define output_width(b) (b)+12 ; JDIMENSION output_width -%define input_data(b) (b)+16 ; JSAMPARRAY input_data -%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr +%define max_v_samp(b) (b)+8 ; int max_v_samp_factor +%define output_width(b) (b)+12 ; JDIMENSION output_width +%define input_data(b) (b)+16 ; JSAMPARRAY input_data +%define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr - align 16 - global EXTN(jsimd_h2v2_upsample_sse2) + align 16 + global EXTN(jsimd_h2v2_upsample_sse2) EXTN(jsimd_h2v2_upsample_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - mov edx, JDIMENSION [output_width(ebp)] - add edx, byte (2*SIZEOF_XMMWORD)-1 - and edx, byte -(2*SIZEOF_XMMWORD) - jz near .return + mov edx, JDIMENSION [output_width(ebp)] + add edx, byte (2*SIZEOF_XMMWORD)-1 + and edx, byte -(2*SIZEOF_XMMWORD) + jz near .return - mov ecx, INT [max_v_samp(ebp)] ; rowctr - test ecx,ecx - jz near .return + mov ecx, INT [max_v_samp(ebp)] ; rowctr + test ecx,ecx + jz near .return - mov esi, JSAMPARRAY [input_data(ebp)] ; input_data - mov edi, POINTER [output_data_ptr(ebp)] - mov edi, JSAMPARRAY [edi] ; output_data - alignx 16,7 + mov esi, JSAMPARRAY [input_data(ebp)] ; input_data + mov edi, POINTER [output_data_ptr(ebp)] + mov edi, JSAMPARRAY [edi] ; output_data + alignx 16,7 .rowloop: - push edi - push esi + push edi + push esi - mov esi, JSAMPROW [esi] ; inptr - mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 - mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 - mov eax,edx ; colctr - alignx 16,7 + mov esi, JSAMPROW [esi] ; inptr + mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 + mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 + mov eax,edx ; colctr + alignx 16,7 .columnloop: - movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] + movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] - movdqa xmm1,xmm0 - punpcklbw xmm0,xmm0 - punpckhbw xmm1,xmm1 + movdqa xmm1,xmm0 + punpcklbw xmm0,xmm0 + punpckhbw xmm1,xmm1 - movdqa XMMWORD [ebx+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [ebx+1*SIZEOF_XMMWORD], xmm1 - movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 - movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [ebx+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [ebx+1*SIZEOF_XMMWORD], xmm1 + movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 + movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 - sub eax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] + movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] - movdqa xmm3,xmm2 - punpcklbw xmm2,xmm2 - punpckhbw xmm3,xmm3 + movdqa xmm3,xmm2 + punpcklbw xmm2,xmm2 + punpckhbw xmm3,xmm3 - movdqa XMMWORD [ebx+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [ebx+3*SIZEOF_XMMWORD], xmm3 - movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 - movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [ebx+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [ebx+3*SIZEOF_XMMWORD], xmm3 + movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 + movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 - sub eax, byte 2*SIZEOF_XMMWORD - jz short .nextrow + sub eax, byte 2*SIZEOF_XMMWORD + jz short .nextrow - add esi, byte 2*SIZEOF_XMMWORD ; inptr - add ebx, byte 4*SIZEOF_XMMWORD ; outptr0 - add edi, byte 4*SIZEOF_XMMWORD ; outptr1 - jmp short .columnloop - alignx 16,7 + add esi, byte 2*SIZEOF_XMMWORD ; inptr + add ebx, byte 4*SIZEOF_XMMWORD ; outptr0 + add edi, byte 4*SIZEOF_XMMWORD ; outptr1 + jmp short .columnloop + alignx 16,7 .nextrow: - pop esi - pop edi + pop esi + pop edi - add esi, byte 1*SIZEOF_JSAMPROW ; input_data - add edi, byte 2*SIZEOF_JSAMPROW ; output_data - sub ecx, byte 2 ; rowctr - jg short .rowloop + add esi, byte 1*SIZEOF_JSAMPROW ; input_data + add edi, byte 2*SIZEOF_JSAMPROW ; output_data + sub ecx, byte 2 ; rowctr + jg short .rowloop .return: - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jf3dnflt.asm b/simd/jf3dnflt.asm index 542672dc..06712e8e 100644 --- a/simd/jf3dnflt.asm +++ b/simd/jf3dnflt.asm @@ -24,23 +24,23 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_float_3dnow) + alignz 16 + global EXTN(jconst_fdct_float_3dnow) EXTN(jconst_fdct_float_3dnow): -PD_0_382 times 2 dd 0.382683432365089771728460 -PD_0_707 times 2 dd 0.707106781186547524400844 -PD_0_541 times 2 dd 0.541196100146196984399723 -PD_1_306 times 2 dd 1.306562964876376527856643 +PD_0_382 times 2 dd 0.382683432365089771728460 +PD_0_707 times 2 dd 0.707106781186547524400844 +PD_0_541 times 2 dd 0.541196100146196984399723 +PD_1_306 times 2 dd 1.306562964876376527856643 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -48,273 +48,273 @@ PD_1_306 times 2 dd 1.306562964876376527856643 ; jsimd_fdct_float_3dnow (FAST_FLOAT * data) ; -%define data(b) (b)+8 ; FAST_FLOAT * data +%define data(b) (b)+8 ; FAST_FLOAT * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_float_3dnow) + align 16 + global EXTN(jsimd_fdct_float_3dnow) EXTN(jsimd_fdct_float_3dnow): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) - mov ecx, DCTSIZE/2 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/2 + alignx 16,7 .rowloop: - movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] + movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)] - ; mm0=(00 01), mm1=(10 11), mm2=(06 07), mm3=(16 17) + ; mm0=(00 01), mm1=(10 11), mm2=(06 07), mm3=(16 17) - movq mm4,mm0 ; transpose coefficients - punpckldq mm0,mm1 ; mm0=(00 10)=data0 - punpckhdq mm4,mm1 ; mm4=(01 11)=data1 - movq mm5,mm2 ; transpose coefficients - punpckldq mm2,mm3 ; mm2=(06 16)=data6 - punpckhdq mm5,mm3 ; mm5=(07 17)=data7 + movq mm4,mm0 ; transpose coefficients + punpckldq mm0,mm1 ; mm0=(00 10)=data0 + punpckhdq mm4,mm1 ; mm4=(01 11)=data1 + movq mm5,mm2 ; transpose coefficients + punpckldq mm2,mm3 ; mm2=(06 16)=data6 + punpckhdq mm5,mm3 ; mm5=(07 17)=data7 - movq mm6,mm4 - movq mm7,mm0 - pfsub mm4,mm2 ; mm4=data1-data6=tmp6 - pfsub mm0,mm5 ; mm0=data0-data7=tmp7 - pfadd mm6,mm2 ; mm6=data1+data6=tmp1 - pfadd mm7,mm5 ; mm7=data0+data7=tmp0 + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm2 ; mm4=data1-data6=tmp6 + pfsub mm0,mm5 ; mm0=data0-data7=tmp7 + pfadd mm6,mm2 ; mm6=data1+data6=tmp1 + pfadd mm7,mm5 ; mm7=data0+data7=tmp0 - movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] - movq mm5, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)] - ; mm1=(02 03), mm3=(12 13), mm2=(04 05), mm5=(14 15) + ; mm1=(02 03), mm3=(12 13), mm2=(04 05), mm5=(14 15) - movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 + movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 - movq mm4,mm1 ; transpose coefficients - punpckldq mm1,mm3 ; mm1=(02 12)=data2 - punpckhdq mm4,mm3 ; mm4=(03 13)=data3 - movq mm0,mm2 ; transpose coefficients - punpckldq mm2,mm5 ; mm2=(04 14)=data4 - punpckhdq mm0,mm5 ; mm0=(05 15)=data5 + movq mm4,mm1 ; transpose coefficients + punpckldq mm1,mm3 ; mm1=(02 12)=data2 + punpckhdq mm4,mm3 ; mm4=(03 13)=data3 + movq mm0,mm2 ; transpose coefficients + punpckldq mm2,mm5 ; mm2=(04 14)=data4 + punpckhdq mm0,mm5 ; mm0=(05 15)=data5 - movq mm3,mm4 - movq mm5,mm1 - pfadd mm4,mm2 ; mm4=data3+data4=tmp3 - pfadd mm1,mm0 ; mm1=data2+data5=tmp2 - pfsub mm3,mm2 ; mm3=data3-data4=tmp4 - pfsub mm5,mm0 ; mm5=data2-data5=tmp5 + movq mm3,mm4 + movq mm5,mm1 + pfadd mm4,mm2 ; mm4=data3+data4=tmp3 + pfadd mm1,mm0 ; mm1=data2+data5=tmp2 + pfsub mm3,mm2 ; mm3=data3-data4=tmp4 + pfsub mm5,mm0 ; mm5=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm2,mm7 - movq mm0,mm6 - pfsub mm7,mm4 ; mm7=tmp13 - pfsub mm6,mm1 ; mm6=tmp12 - pfadd mm2,mm4 ; mm2=tmp10 - pfadd mm0,mm1 ; mm0=tmp11 + movq mm2,mm7 + movq mm0,mm6 + pfsub mm7,mm4 ; mm7=tmp13 + pfsub mm6,mm1 ; mm6=tmp12 + pfadd mm2,mm4 ; mm2=tmp10 + pfadd mm0,mm1 ; mm0=tmp11 - pfadd mm6,mm7 - pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 + pfadd mm6,mm7 + pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 - movq mm4,mm2 - movq mm1,mm7 - pfsub mm2,mm0 ; mm2=data4 - pfsub mm7,mm6 ; mm7=data6 - pfadd mm4,mm0 ; mm4=data0 - pfadd mm1,mm6 ; mm1=data2 + movq mm4,mm2 + movq mm1,mm7 + pfsub mm2,mm0 ; mm2=data4 + pfsub mm7,mm6 ; mm7=data6 + pfadd mm4,mm0 ; mm4=data0 + pfadd mm1,mm6 ; mm1=data2 - movq MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)], mm2 - movq MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)], mm7 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(0,2,edx,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(0,3,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], mm1 - ; -- Odd part + ; -- Odd part - movq mm0, MMWORD [wk(0)] ; mm0=tmp6 - movq mm6, MMWORD [wk(1)] ; mm6=tmp7 + movq mm0, MMWORD [wk(0)] ; mm0=tmp6 + movq mm6, MMWORD [wk(1)] ; mm6=tmp7 - pfadd mm3,mm5 ; mm3=tmp10 - pfadd mm5,mm0 ; mm5=tmp11 - pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 + pfadd mm3,mm5 ; mm3=tmp10 + pfadd mm5,mm0 ; mm5=tmp11 + pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 - pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 + pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 - movq mm2,mm3 ; mm2=tmp10 - pfsub mm3,mm0 - pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 - pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) - pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) - pfadd mm2,mm3 ; mm2=z2 - pfadd mm0,mm3 ; mm0=z4 + movq mm2,mm3 ; mm2=tmp10 + pfsub mm3,mm0 + pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 + pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) + pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) + pfadd mm2,mm3 ; mm2=z2 + pfadd mm0,mm3 ; mm0=z4 - movq mm7,mm6 - pfsub mm6,mm5 ; mm6=z13 - pfadd mm7,mm5 ; mm7=z11 + movq mm7,mm6 + pfsub mm6,mm5 ; mm6=z13 + pfadd mm7,mm5 ; mm7=z11 - movq mm4,mm6 - movq mm1,mm7 - pfsub mm6,mm2 ; mm6=data3 - pfsub mm7,mm0 ; mm7=data7 - pfadd mm4,mm2 ; mm4=data5 - pfadd mm1,mm0 ; mm1=data1 + movq mm4,mm6 + movq mm1,mm7 + pfsub mm6,mm2 ; mm6=data3 + pfsub mm7,mm0 ; mm7=data7 + pfadd mm4,mm2 ; mm4=data5 + pfadd mm1,mm0 ; mm1=data1 - movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], mm6 - movq MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)], mm7 - movq MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,3,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(1,2,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 - add edx, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT - dec ecx - jnz near .rowloop + add edx, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .rowloop - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) - mov ecx, DCTSIZE/2 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/2 + alignx 16,7 .columnloop: - movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] + movq mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] - ; mm0=(00 10), mm1=(01 11), mm2=(60 70), mm3=(61 71) + ; mm0=(00 10), mm1=(01 11), mm2=(60 70), mm3=(61 71) - movq mm4,mm0 ; transpose coefficients - punpckldq mm0,mm1 ; mm0=(00 01)=data0 - punpckhdq mm4,mm1 ; mm4=(10 11)=data1 - movq mm5,mm2 ; transpose coefficients - punpckldq mm2,mm3 ; mm2=(60 61)=data6 - punpckhdq mm5,mm3 ; mm5=(70 71)=data7 + movq mm4,mm0 ; transpose coefficients + punpckldq mm0,mm1 ; mm0=(00 01)=data0 + punpckhdq mm4,mm1 ; mm4=(10 11)=data1 + movq mm5,mm2 ; transpose coefficients + punpckldq mm2,mm3 ; mm2=(60 61)=data6 + punpckhdq mm5,mm3 ; mm5=(70 71)=data7 - movq mm6,mm4 - movq mm7,mm0 - pfsub mm4,mm2 ; mm4=data1-data6=tmp6 - pfsub mm0,mm5 ; mm0=data0-data7=tmp7 - pfadd mm6,mm2 ; mm6=data1+data6=tmp1 - pfadd mm7,mm5 ; mm7=data0+data7=tmp0 + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm2 ; mm4=data1-data6=tmp6 + pfsub mm0,mm5 ; mm0=data0-data7=tmp7 + pfadd mm6,mm2 ; mm6=data1+data6=tmp1 + pfadd mm7,mm5 ; mm7=data0+data7=tmp0 - movq mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] - movq mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] - ; mm1=(20 30), mm3=(21 31), mm2=(40 50), mm5=(41 51) + ; mm1=(20 30), mm3=(21 31), mm2=(40 50), mm5=(41 51) - movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 + movq MMWORD [wk(0)], mm4 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm0 ; wk(1)=tmp7 - movq mm4,mm1 ; transpose coefficients - punpckldq mm1,mm3 ; mm1=(20 21)=data2 - punpckhdq mm4,mm3 ; mm4=(30 31)=data3 - movq mm0,mm2 ; transpose coefficients - punpckldq mm2,mm5 ; mm2=(40 41)=data4 - punpckhdq mm0,mm5 ; mm0=(50 51)=data5 + movq mm4,mm1 ; transpose coefficients + punpckldq mm1,mm3 ; mm1=(20 21)=data2 + punpckhdq mm4,mm3 ; mm4=(30 31)=data3 + movq mm0,mm2 ; transpose coefficients + punpckldq mm2,mm5 ; mm2=(40 41)=data4 + punpckhdq mm0,mm5 ; mm0=(50 51)=data5 - movq mm3,mm4 - movq mm5,mm1 - pfadd mm4,mm2 ; mm4=data3+data4=tmp3 - pfadd mm1,mm0 ; mm1=data2+data5=tmp2 - pfsub mm3,mm2 ; mm3=data3-data4=tmp4 - pfsub mm5,mm0 ; mm5=data2-data5=tmp5 + movq mm3,mm4 + movq mm5,mm1 + pfadd mm4,mm2 ; mm4=data3+data4=tmp3 + pfadd mm1,mm0 ; mm1=data2+data5=tmp2 + pfsub mm3,mm2 ; mm3=data3-data4=tmp4 + pfsub mm5,mm0 ; mm5=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm2,mm7 - movq mm0,mm6 - pfsub mm7,mm4 ; mm7=tmp13 - pfsub mm6,mm1 ; mm6=tmp12 - pfadd mm2,mm4 ; mm2=tmp10 - pfadd mm0,mm1 ; mm0=tmp11 + movq mm2,mm7 + movq mm0,mm6 + pfsub mm7,mm4 ; mm7=tmp13 + pfsub mm6,mm1 ; mm6=tmp12 + pfadd mm2,mm4 ; mm2=tmp10 + pfadd mm0,mm1 ; mm0=tmp11 - pfadd mm6,mm7 - pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 + pfadd mm6,mm7 + pfmul mm6,[GOTOFF(ebx,PD_0_707)] ; mm6=z1 - movq mm4,mm2 - movq mm1,mm7 - pfsub mm2,mm0 ; mm2=data4 - pfsub mm7,mm6 ; mm7=data6 - pfadd mm4,mm0 ; mm4=data0 - pfadd mm1,mm6 ; mm1=data2 + movq mm4,mm2 + movq mm1,mm7 + pfsub mm2,mm0 ; mm2=data4 + pfsub mm7,mm6 ; mm7=data6 + pfadd mm4,mm0 ; mm4=data0 + pfadd mm1,mm6 ; mm1=data2 - movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], mm2 - movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], mm7 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], mm2 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], mm1 - ; -- Odd part + ; -- Odd part - movq mm0, MMWORD [wk(0)] ; mm0=tmp6 - movq mm6, MMWORD [wk(1)] ; mm6=tmp7 + movq mm0, MMWORD [wk(0)] ; mm0=tmp6 + movq mm6, MMWORD [wk(1)] ; mm6=tmp7 - pfadd mm3,mm5 ; mm3=tmp10 - pfadd mm5,mm0 ; mm5=tmp11 - pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 + pfadd mm3,mm5 ; mm3=tmp10 + pfadd mm5,mm0 ; mm5=tmp11 + pfadd mm0,mm6 ; mm0=tmp12, mm6=tmp7 - pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 + pfmul mm5,[GOTOFF(ebx,PD_0_707)] ; mm5=z3 - movq mm2,mm3 ; mm2=tmp10 - pfsub mm3,mm0 - pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 - pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) - pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) - pfadd mm2,mm3 ; mm2=z2 - pfadd mm0,mm3 ; mm0=z4 + movq mm2,mm3 ; mm2=tmp10 + pfsub mm3,mm0 + pfmul mm3,[GOTOFF(ebx,PD_0_382)] ; mm3=z5 + pfmul mm2,[GOTOFF(ebx,PD_0_541)] ; mm2=MULTIPLY(tmp10,FIX_0_54119610) + pfmul mm0,[GOTOFF(ebx,PD_1_306)] ; mm0=MULTIPLY(tmp12,FIX_1_30656296) + pfadd mm2,mm3 ; mm2=z2 + pfadd mm0,mm3 ; mm0=z4 - movq mm7,mm6 - pfsub mm6,mm5 ; mm6=z13 - pfadd mm7,mm5 ; mm7=z11 + movq mm7,mm6 + pfsub mm6,mm5 ; mm6=z13 + pfadd mm7,mm5 ; mm7=z11 - movq mm4,mm6 - movq mm1,mm7 - pfsub mm6,mm2 ; mm6=data3 - pfsub mm7,mm0 ; mm7=data7 - pfadd mm4,mm2 ; mm4=data5 - pfadd mm1,mm0 ; mm1=data1 + movq mm4,mm6 + movq mm1,mm7 + pfsub mm6,mm2 ; mm6=data3 + pfsub mm7,mm0 ; mm7=data7 + pfadd mm4,mm2 ; mm4=data5 + pfadd mm1,mm0 ; mm1=data1 - movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], mm6 - movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], mm7 - movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], mm4 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], mm1 - add edx, byte 2*SIZEOF_FAST_FLOAT - dec ecx - jnz near .columnloop + add edx, byte 2*SIZEOF_FAST_FLOAT + dec ecx + jnz near .columnloop - femms ; empty MMX/3DNow! state + femms ; empty MMX/3DNow! state -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfmmxfst.asm b/simd/jfmmxfst.asm index 0647242a..d8cd4b9e 100644 --- a/simd/jfmmxfst.asm +++ b/simd/jfmmxfst.asm @@ -26,24 +26,24 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. +%define CONST_BITS 8 ; 14 is also OK. %if CONST_BITS == 8 -F_0_382 equ 98 ; FIX(0.382683433) -F_0_541 equ 139 ; FIX(0.541196100) -F_0_707 equ 181 ; FIX(0.707106781) -F_1_306 equ 334 ; FIX(1.306562965) +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) -F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -51,21 +51,21 @@ F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_fdct_ifast_mmx) + alignz 16 + global EXTN(jconst_fdct_ifast_mmx) EXTN(jconst_fdct_ifast_mmx): -PW_F0707 times 4 dw F_0_707 << CONST_SHIFT -PW_F0382 times 4 dw F_0_382 << CONST_SHIFT -PW_F0541 times 4 dw F_0_541 << CONST_SHIFT -PW_F1306 times 4 dw F_1_306 << CONST_SHIFT +PW_F0707 times 4 dw F_0_707 << CONST_SHIFT +PW_F0382 times 4 dw F_0_382 << CONST_SHIFT +PW_F0541 times 4 dw F_0_541 << CONST_SHIFT +PW_F1306 times 4 dw F_1_306 << CONST_SHIFT - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -73,325 +73,325 @@ PW_F1306 times 4 dw F_1_306 << CONST_SHIFT ; jsimd_fdct_ifast_mmx (DCTELEM * data) ; -%define data(b) (b)+8 ; DCTELEM * data +%define data(b) (b)+8 ; DCTELEM * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_ifast_mmx) + align 16 + global EXTN(jsimd_fdct_ifast_mmx) EXTN(jsimd_fdct_ifast_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov edx, POINTER [data(eax)] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .rowloop: - movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] - ; mm0=(20 21 22 23), mm2=(24 25 26 27) - ; mm1=(30 31 32 33), mm3=(34 35 36 37) + ; mm0=(20 21 22 23), mm2=(24 25 26 27) + ; mm1=(30 31 32 33), mm3=(34 35 36 37) - movq mm4,mm0 ; transpose coefficients(phase 1) - punpcklwd mm0,mm1 ; mm0=(20 30 21 31) - punpckhwd mm4,mm1 ; mm4=(22 32 23 33) - movq mm5,mm2 ; transpose coefficients(phase 1) - punpcklwd mm2,mm3 ; mm2=(24 34 25 35) - punpckhwd mm5,mm3 ; mm5=(26 36 27 37) + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(24 34 25 35) + punpckhwd mm5,mm3 ; mm5=(26 36 27 37) - movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] - ; mm6=(00 01 02 03), mm1=(04 05 06 07) - ; mm7=(10 11 12 13), mm3=(14 15 16 17) + ; mm6=(00 01 02 03), mm1=(04 05 06 07) + ; mm7=(10 11 12 13), mm3=(14 15 16 17) - movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) - movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) - movq mm4,mm6 ; transpose coefficients(phase 1) - punpcklwd mm6,mm7 ; mm6=(00 10 01 11) - punpckhwd mm4,mm7 ; mm4=(02 12 03 13) - movq mm2,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm3 ; mm1=(04 14 05 15) - punpckhwd mm2,mm3 ; mm2=(06 16 07 17) + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm4,mm7 ; mm4=(02 12 03 13) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(04 14 05 15) + punpckhwd mm2,mm3 ; mm2=(06 16 07 17) - movq mm7,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 - punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 - movq mm3,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 - punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 + punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 + punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 - movq mm0,mm7 - movq mm5,mm6 - psubw mm7,mm2 ; mm7=data1-data6=tmp6 - psubw mm6,mm3 ; mm6=data0-data7=tmp7 - paddw mm0,mm2 ; mm0=data1+data6=tmp1 - paddw mm5,mm3 ; mm5=data0+data7=tmp0 + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 - movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) - movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) + movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 - movq mm7,mm4 ; transpose coefficients(phase 2) - punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 - punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 - movq mm6,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 - punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 + punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 + punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 - movq mm2,mm7 - movq mm3,mm4 - paddw mm7,mm1 ; mm7=data3+data4=tmp3 - paddw mm4,mm6 ; mm4=data2+data5=tmp2 - psubw mm2,mm1 ; mm2=data3-data4=tmp4 - psubw mm3,mm6 ; mm3=data2-data5=tmp5 + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm1,mm5 - movq mm6,mm0 - psubw mm5,mm7 ; mm5=tmp13 - psubw mm0,mm4 ; mm0=tmp12 - paddw mm1,mm7 ; mm1=tmp10 - paddw mm6,mm4 ; mm6=tmp11 + movq mm1,mm5 + movq mm6,mm0 + psubw mm5,mm7 ; mm5=tmp13 + psubw mm0,mm4 ; mm0=tmp12 + paddw mm1,mm7 ; mm1=tmp10 + paddw mm6,mm4 ; mm6=tmp11 - paddw mm0,mm5 - psllw mm0,PRE_MULTIPLY_SCALE_BITS - pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 + paddw mm0,mm5 + psllw mm0,PRE_MULTIPLY_SCALE_BITS + pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 - movq mm7,mm1 - movq mm4,mm5 - psubw mm1,mm6 ; mm1=data4 - psubw mm5,mm0 ; mm5=data6 - paddw mm7,mm6 ; mm7=data0 - paddw mm4,mm0 ; mm4=data2 + movq mm7,mm1 + movq mm4,mm5 + psubw mm1,mm6 ; mm1=data4 + psubw mm5,mm0 ; mm5=data6 + paddw mm7,mm6 ; mm7=data0 + paddw mm4,mm0 ; mm4=data2 - movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm1 - movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 - movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 - ; -- Odd part + ; -- Odd part - movq mm6, MMWORD [wk(0)] ; mm6=tmp6 - movq mm0, MMWORD [wk(1)] ; mm0=tmp7 + movq mm6, MMWORD [wk(0)] ; mm6=tmp6 + movq mm0, MMWORD [wk(1)] ; mm0=tmp7 - paddw mm2,mm3 ; mm2=tmp10 - paddw mm3,mm6 ; mm3=tmp11 - paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 + paddw mm2,mm3 ; mm2=tmp10 + paddw mm3,mm6 ; mm3=tmp11 + paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 - psllw mm2,PRE_MULTIPLY_SCALE_BITS - psllw mm6,PRE_MULTIPLY_SCALE_BITS + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm6,PRE_MULTIPLY_SCALE_BITS - psllw mm3,PRE_MULTIPLY_SCALE_BITS - pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 + psllw mm3,PRE_MULTIPLY_SCALE_BITS + pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 - movq mm1,mm2 ; mm1=tmp10 - psubw mm2,mm6 - pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 - pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) - pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) - paddw mm1,mm2 ; mm1=z2 - paddw mm6,mm2 ; mm6=z4 + movq mm1,mm2 ; mm1=tmp10 + psubw mm2,mm6 + pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 + pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) + pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) + paddw mm1,mm2 ; mm1=z2 + paddw mm6,mm2 ; mm6=z4 - movq mm5,mm0 - psubw mm0,mm3 ; mm0=z13 - paddw mm5,mm3 ; mm5=z11 + movq mm5,mm0 + psubw mm0,mm3 ; mm0=z13 + paddw mm5,mm3 ; mm5=z11 - movq mm7,mm0 - movq mm4,mm5 - psubw mm0,mm1 ; mm0=data3 - psubw mm5,mm6 ; mm5=data7 - paddw mm7,mm1 ; mm7=data5 - paddw mm4,mm6 ; mm4=data1 + movq mm7,mm0 + movq mm4,mm5 + psubw mm0,mm1 ; mm0=data3 + psubw mm5,mm6 ; mm5=data7 + paddw mm7,mm1 ; mm7=data5 + paddw mm4,mm6 ; mm4=data1 - movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 - movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm7 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 - add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM - dec ecx - jnz near .rowloop + add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz near .rowloop - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - mov edx, POINTER [data(eax)] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .columnloop: - movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] - ; mm0=(02 12 22 32), mm2=(42 52 62 72) - ; mm1=(03 13 23 33), mm3=(43 53 63 73) + ; mm0=(02 12 22 32), mm2=(42 52 62 72) + ; mm1=(03 13 23 33), mm3=(43 53 63 73) - movq mm4,mm0 ; transpose coefficients(phase 1) - punpcklwd mm0,mm1 ; mm0=(02 03 12 13) - punpckhwd mm4,mm1 ; mm4=(22 23 32 33) - movq mm5,mm2 ; transpose coefficients(phase 1) - punpcklwd mm2,mm3 ; mm2=(42 43 52 53) - punpckhwd mm5,mm3 ; mm5=(62 63 72 73) + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(02 03 12 13) + punpckhwd mm4,mm1 ; mm4=(22 23 32 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(42 43 52 53) + punpckhwd mm5,mm3 ; mm5=(62 63 72 73) - movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] - ; mm6=(00 10 20 30), mm1=(40 50 60 70) - ; mm7=(01 11 21 31), mm3=(41 51 61 71) + ; mm6=(00 10 20 30), mm1=(40 50 60 70) + ; mm7=(01 11 21 31), mm3=(41 51 61 71) - movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) - movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) - movq mm4,mm6 ; transpose coefficients(phase 1) - punpcklwd mm6,mm7 ; mm6=(00 01 10 11) - punpckhwd mm4,mm7 ; mm4=(20 21 30 31) - movq mm2,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm3 ; mm1=(40 41 50 51) - punpckhwd mm2,mm3 ; mm2=(60 61 70 71) + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 01 10 11) + punpckhwd mm4,mm7 ; mm4=(20 21 30 31) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(40 41 50 51) + punpckhwd mm2,mm3 ; mm2=(60 61 70 71) - movq mm7,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 - punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 - movq mm3,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 - punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 + punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 + punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 - movq mm0,mm7 - movq mm5,mm6 - psubw mm7,mm2 ; mm7=data1-data6=tmp6 - psubw mm6,mm3 ; mm6=data0-data7=tmp7 - paddw mm0,mm2 ; mm0=data1+data6=tmp1 - paddw mm5,mm3 ; mm5=data0+data7=tmp0 + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 - movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) - movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) + movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 - movq mm7,mm4 ; transpose coefficients(phase 2) - punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 - punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 - movq mm6,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 - punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 + punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 + punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 - movq mm2,mm7 - movq mm3,mm4 - paddw mm7,mm1 ; mm7=data3+data4=tmp3 - paddw mm4,mm6 ; mm4=data2+data5=tmp2 - psubw mm2,mm1 ; mm2=data3-data4=tmp4 - psubw mm3,mm6 ; mm3=data2-data5=tmp5 + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm1,mm5 - movq mm6,mm0 - psubw mm5,mm7 ; mm5=tmp13 - psubw mm0,mm4 ; mm0=tmp12 - paddw mm1,mm7 ; mm1=tmp10 - paddw mm6,mm4 ; mm6=tmp11 + movq mm1,mm5 + movq mm6,mm0 + psubw mm5,mm7 ; mm5=tmp13 + psubw mm0,mm4 ; mm0=tmp12 + paddw mm1,mm7 ; mm1=tmp10 + paddw mm6,mm4 ; mm6=tmp11 - paddw mm0,mm5 - psllw mm0,PRE_MULTIPLY_SCALE_BITS - pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 + paddw mm0,mm5 + psllw mm0,PRE_MULTIPLY_SCALE_BITS + pmulhw mm0,[GOTOFF(ebx,PW_F0707)] ; mm0=z1 - movq mm7,mm1 - movq mm4,mm5 - psubw mm1,mm6 ; mm1=data4 - psubw mm5,mm0 ; mm5=data6 - paddw mm7,mm6 ; mm7=data0 - paddw mm4,mm0 ; mm4=data2 + movq mm7,mm1 + movq mm4,mm5 + psubw mm1,mm6 ; mm1=data4 + psubw mm5,mm0 ; mm5=data6 + paddw mm7,mm6 ; mm7=data0 + paddw mm4,mm0 ; mm4=data2 - movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm1 - movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 - movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 - ; -- Odd part + ; -- Odd part - movq mm6, MMWORD [wk(0)] ; mm6=tmp6 - movq mm0, MMWORD [wk(1)] ; mm0=tmp7 + movq mm6, MMWORD [wk(0)] ; mm6=tmp6 + movq mm0, MMWORD [wk(1)] ; mm0=tmp7 - paddw mm2,mm3 ; mm2=tmp10 - paddw mm3,mm6 ; mm3=tmp11 - paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 + paddw mm2,mm3 ; mm2=tmp10 + paddw mm3,mm6 ; mm3=tmp11 + paddw mm6,mm0 ; mm6=tmp12, mm0=tmp7 - psllw mm2,PRE_MULTIPLY_SCALE_BITS - psllw mm6,PRE_MULTIPLY_SCALE_BITS + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm6,PRE_MULTIPLY_SCALE_BITS - psllw mm3,PRE_MULTIPLY_SCALE_BITS - pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 + psllw mm3,PRE_MULTIPLY_SCALE_BITS + pmulhw mm3,[GOTOFF(ebx,PW_F0707)] ; mm3=z3 - movq mm1,mm2 ; mm1=tmp10 - psubw mm2,mm6 - pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 - pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) - pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) - paddw mm1,mm2 ; mm1=z2 - paddw mm6,mm2 ; mm6=z4 + movq mm1,mm2 ; mm1=tmp10 + psubw mm2,mm6 + pmulhw mm2,[GOTOFF(ebx,PW_F0382)] ; mm2=z5 + pmulhw mm1,[GOTOFF(ebx,PW_F0541)] ; mm1=MULTIPLY(tmp10,FIX_0_54119610) + pmulhw mm6,[GOTOFF(ebx,PW_F1306)] ; mm6=MULTIPLY(tmp12,FIX_1_30656296) + paddw mm1,mm2 ; mm1=z2 + paddw mm6,mm2 ; mm6=z4 - movq mm5,mm0 - psubw mm0,mm3 ; mm0=z13 - paddw mm5,mm3 ; mm5=z11 + movq mm5,mm0 + psubw mm0,mm3 ; mm0=z13 + paddw mm5,mm3 ; mm5=z11 - movq mm7,mm0 - movq mm4,mm5 - psubw mm0,mm1 ; mm0=data3 - psubw mm5,mm6 ; mm5=data7 - paddw mm7,mm1 ; mm7=data5 - paddw mm4,mm6 ; mm4=data1 + movq mm7,mm0 + movq mm4,mm5 + psubw mm0,mm1 ; mm0=data3 + psubw mm5,mm6 ; mm5=data7 + paddw mm7,mm1 ; mm7=data5 + paddw mm4,mm6 ; mm4=data1 - movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 - movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm7 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm0 + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm4 - add edx, byte 4*SIZEOF_DCTELEM - dec ecx - jnz near .columnloop + add edx, byte 4*SIZEOF_DCTELEM + dec ecx + jnz near .columnloop - emms ; empty MMX state + emms ; empty MMX state -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfmmxint.asm b/simd/jfmmxint.asm index a7e73f73..c16f2621 100644 --- a/simd/jfmmxint.asm +++ b/simd/jfmmxint.asm @@ -26,67 +26,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_islow_mmx) + alignz 16 + global EXTN(jconst_fdct_islow_mmx) EXTN(jconst_fdct_islow_mmx): -PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) -PW_DESCALE_P2X times 4 dw 1 << (PASS1_BITS-1) +PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 4 dw 1 << (PASS1_BITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -94,529 +94,529 @@ PW_DESCALE_P2X times 4 dw 1 << (PASS1_BITS-1) ; jsimd_fdct_islow_mmx (DCTELEM * data) ; -%define data(b) (b)+8 ; DCTELEM * data +%define data(b) (b)+8 ; DCTELEM * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_islow_mmx) + align 16 + global EXTN(jsimd_fdct_islow_mmx) EXTN(jsimd_fdct_islow_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov edx, POINTER [data(eax)] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .rowloop: - movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)] - ; mm0=(20 21 22 23), mm2=(24 25 26 27) - ; mm1=(30 31 32 33), mm3=(34 35 36 37) + ; mm0=(20 21 22 23), mm2=(24 25 26 27) + ; mm1=(30 31 32 33), mm3=(34 35 36 37) - movq mm4,mm0 ; transpose coefficients(phase 1) - punpcklwd mm0,mm1 ; mm0=(20 30 21 31) - punpckhwd mm4,mm1 ; mm4=(22 32 23 33) - movq mm5,mm2 ; transpose coefficients(phase 1) - punpcklwd mm2,mm3 ; mm2=(24 34 25 35) - punpckhwd mm5,mm3 ; mm5=(26 36 27 37) + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(24 34 25 35) + punpckhwd mm5,mm3 ; mm5=(26 36 27 37) - movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)] - ; mm6=(00 01 02 03), mm1=(04 05 06 07) - ; mm7=(10 11 12 13), mm3=(14 15 16 17) + ; mm6=(00 01 02 03), mm1=(04 05 06 07) + ; mm7=(10 11 12 13), mm3=(14 15 16 17) - movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) - movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 32 23 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(24 34 25 35) - movq mm4,mm6 ; transpose coefficients(phase 1) - punpcklwd mm6,mm7 ; mm6=(00 10 01 11) - punpckhwd mm4,mm7 ; mm4=(02 12 03 13) - movq mm2,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm3 ; mm1=(04 14 05 15) - punpckhwd mm2,mm3 ; mm2=(06 16 07 17) + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm4,mm7 ; mm4=(02 12 03 13) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(04 14 05 15) + punpckhwd mm2,mm3 ; mm2=(06 16 07 17) - movq mm7,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 - punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 - movq mm3,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 - punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 10 20 30)=data0 + punpckhdq mm7,mm0 ; mm7=(01 11 21 31)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(06 16 26 36)=data6 + punpckhdq mm3,mm5 ; mm3=(07 17 27 37)=data7 - movq mm0,mm7 - movq mm5,mm6 - psubw mm7,mm2 ; mm7=data1-data6=tmp6 - psubw mm6,mm3 ; mm6=data0-data7=tmp7 - paddw mm0,mm2 ; mm0=data1+data6=tmp1 - paddw mm5,mm3 ; mm5=data0+data7=tmp0 + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 - movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) - movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + movq mm2, MMWORD [wk(0)] ; mm2=(22 32 23 33) + movq mm3, MMWORD [wk(1)] ; mm3=(24 34 25 35) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 - movq mm7,mm4 ; transpose coefficients(phase 2) - punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 - punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 - movq mm6,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 - punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(02 12 22 32)=data2 + punpckhdq mm7,mm2 ; mm7=(03 13 23 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(04 14 24 34)=data4 + punpckhdq mm6,mm3 ; mm6=(05 15 25 35)=data5 - movq mm2,mm7 - movq mm3,mm4 - paddw mm7,mm1 ; mm7=data3+data4=tmp3 - paddw mm4,mm6 ; mm4=data2+data5=tmp2 - psubw mm2,mm1 ; mm2=data3-data4=tmp4 - psubw mm3,mm6 ; mm3=data2-data5=tmp5 + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm1,mm5 - movq mm6,mm0 - paddw mm5,mm7 ; mm5=tmp10 - paddw mm0,mm4 ; mm0=tmp11 - psubw mm1,mm7 ; mm1=tmp13 - psubw mm6,mm4 ; mm6=tmp12 + movq mm1,mm5 + movq mm6,mm0 + paddw mm5,mm7 ; mm5=tmp10 + paddw mm0,mm4 ; mm0=tmp11 + psubw mm1,mm7 ; mm1=tmp13 + psubw mm6,mm4 ; mm6=tmp12 - movq mm7,mm5 - paddw mm5,mm0 ; mm5=tmp10+tmp11 - psubw mm7,mm0 ; mm7=tmp10-tmp11 + movq mm7,mm5 + paddw mm5,mm0 ; mm5=tmp10+tmp11 + psubw mm7,mm0 ; mm7=tmp10-tmp11 - psllw mm5,PASS1_BITS ; mm5=data0 - psllw mm7,PASS1_BITS ; mm7=data4 + psllw mm5,PASS1_BITS ; mm5=data0 + psllw mm7,PASS1_BITS ; mm7=data4 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm7 - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movq mm4,mm1 ; mm1=tmp13 - movq mm0,mm1 - punpcklwd mm4,mm6 ; mm6=tmp12 - punpckhwd mm0,mm6 - movq mm1,mm4 - movq mm6,mm0 - pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L - pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H - pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L - pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H + movq mm4,mm1 ; mm1=tmp13 + movq mm0,mm1 + punpcklwd mm4,mm6 ; mm6=tmp12 + punpckhwd mm0,mm6 + movq mm1,mm4 + movq mm6,mm0 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L + pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L + pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H - paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm0,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm4,DESCALE_P1 - psrad mm0,DESCALE_P1 - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm6,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm1,DESCALE_P1 - psrad mm6,DESCALE_P1 + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm0,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm4,DESCALE_P1 + psrad mm0,DESCALE_P1 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm6,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm1,DESCALE_P1 + psrad mm6,DESCALE_P1 - packssdw mm4,mm0 ; mm4=data2 - packssdw mm1,mm6 ; mm1=data6 + packssdw mm4,mm0 ; mm4=data2 + packssdw mm1,mm6 ; mm1=data6 - movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 - movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm1 - ; -- Odd part + ; -- Odd part - movq mm5, MMWORD [wk(0)] ; mm5=tmp6 - movq mm7, MMWORD [wk(1)] ; mm7=tmp7 + movq mm5, MMWORD [wk(0)] ; mm5=tmp6 + movq mm7, MMWORD [wk(1)] ; mm7=tmp7 - movq mm0,mm2 ; mm2=tmp4 - movq mm6,mm3 ; mm3=tmp5 - paddw mm0,mm5 ; mm0=z3 - paddw mm6,mm7 ; mm6=z4 + movq mm0,mm2 ; mm2=tmp4 + movq mm6,mm3 ; mm3=tmp5 + paddw mm0,mm5 ; mm0=z3 + paddw mm6,mm7 ; mm6=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movq mm4,mm0 - movq mm1,mm0 - punpcklwd mm4,mm6 - punpckhwd mm1,mm6 - movq mm0,mm4 - movq mm6,mm1 - pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L - pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H - pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L - pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H + movq mm4,mm0 + movq mm1,mm0 + punpcklwd mm4,mm6 + punpckhwd mm1,mm6 + movq mm0,mm4 + movq mm6,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L + pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H + pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L + pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H - movq MMWORD [wk(0)], mm4 ; wk(0)=z3L - movq MMWORD [wk(1)], mm1 ; wk(1)=z3H + movq MMWORD [wk(0)], mm4 ; wk(0)=z3L + movq MMWORD [wk(1)], mm1 ; wk(1)=z3H - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; - movq mm4,mm2 - movq mm1,mm2 - punpcklwd mm4,mm7 - punpckhwd mm1,mm7 - movq mm2,mm4 - movq mm7,mm1 - pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L - pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H - pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L - pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H + movq mm4,mm2 + movq mm1,mm2 + punpcklwd mm4,mm7 + punpckhwd mm1,mm7 + movq mm2,mm4 + movq mm7,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L + pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H + pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L + pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H - paddd mm4, MMWORD [wk(0)] ; mm4=data7L - paddd mm1, MMWORD [wk(1)] ; mm1=data7H - paddd mm2,mm0 ; mm2=data1L - paddd mm7,mm6 ; mm7=data1H + paddd mm4, MMWORD [wk(0)] ; mm4=data7L + paddd mm1, MMWORD [wk(1)] ; mm1=data7H + paddd mm2,mm0 ; mm2=data1L + paddd mm7,mm6 ; mm7=data1H - paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm4,DESCALE_P1 - psrad mm1,DESCALE_P1 - paddd mm2,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm2,DESCALE_P1 - psrad mm7,DESCALE_P1 + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm4,DESCALE_P1 + psrad mm1,DESCALE_P1 + paddd mm2,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm2,DESCALE_P1 + psrad mm7,DESCALE_P1 - packssdw mm4,mm1 ; mm4=data7 - packssdw mm2,mm7 ; mm2=data1 + packssdw mm4,mm1 ; mm4=data7 + packssdw mm2,mm7 ; mm2=data1 - movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm4 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 + movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 - movq mm1,mm3 - movq mm7,mm3 - punpcklwd mm1,mm5 - punpckhwd mm7,mm5 - movq mm3,mm1 - movq mm5,mm7 - pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L - pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H - pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L - pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H + movq mm1,mm3 + movq mm7,mm3 + punpcklwd mm1,mm5 + punpckhwd mm7,mm5 + movq mm3,mm1 + movq mm5,mm7 + pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L + pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H + pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L + pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H - paddd mm1,mm0 ; mm1=data5L - paddd mm7,mm6 ; mm7=data5H - paddd mm3, MMWORD [wk(0)] ; mm3=data3L - paddd mm5, MMWORD [wk(1)] ; mm5=data3H + paddd mm1,mm0 ; mm1=data5L + paddd mm7,mm6 ; mm7=data5H + paddd mm3, MMWORD [wk(0)] ; mm3=data3L + paddd mm5, MMWORD [wk(1)] ; mm5=data3H - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm1,DESCALE_P1 - psrad mm7,DESCALE_P1 - paddd mm3,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd mm5,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad mm3,DESCALE_P1 - psrad mm5,DESCALE_P1 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm1,DESCALE_P1 + psrad mm7,DESCALE_P1 + paddd mm3,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd mm5,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad mm3,DESCALE_P1 + psrad mm5,DESCALE_P1 - packssdw mm1,mm7 ; mm1=data5 - packssdw mm3,mm5 ; mm3=data3 + packssdw mm1,mm7 ; mm1=data5 + packssdw mm3,mm5 ; mm3=data3 - movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm1 - movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 + movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 - add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM - dec ecx - jnz near .rowloop + add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM + dec ecx + jnz near .rowloop - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - mov edx, POINTER [data(eax)] ; (DCTELEM *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov ecx, DCTSIZE/4 + alignx 16,7 .columnloop: - movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)] - ; mm0=(02 12 22 32), mm2=(42 52 62 72) - ; mm1=(03 13 23 33), mm3=(43 53 63 73) + ; mm0=(02 12 22 32), mm2=(42 52 62 72) + ; mm1=(03 13 23 33), mm3=(43 53 63 73) - movq mm4,mm0 ; transpose coefficients(phase 1) - punpcklwd mm0,mm1 ; mm0=(02 03 12 13) - punpckhwd mm4,mm1 ; mm4=(22 23 32 33) - movq mm5,mm2 ; transpose coefficients(phase 1) - punpcklwd mm2,mm3 ; mm2=(42 43 52 53) - punpckhwd mm5,mm3 ; mm5=(62 63 72 73) + movq mm4,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm1 ; mm0=(02 03 12 13) + punpckhwd mm4,mm1 ; mm4=(22 23 32 33) + movq mm5,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm3 ; mm2=(42 43 52 53) + punpckhwd mm5,mm3 ; mm5=(62 63 72 73) - movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] - movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)] - ; mm6=(00 10 20 30), mm1=(40 50 60 70) - ; mm7=(01 11 21 31), mm3=(41 51 61 71) + ; mm6=(00 10 20 30), mm1=(40 50 60 70) + ; mm7=(01 11 21 31), mm3=(41 51 61 71) - movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) - movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) + movq MMWORD [wk(0)], mm4 ; wk(0)=(22 23 32 33) + movq MMWORD [wk(1)], mm2 ; wk(1)=(42 43 52 53) - movq mm4,mm6 ; transpose coefficients(phase 1) - punpcklwd mm6,mm7 ; mm6=(00 01 10 11) - punpckhwd mm4,mm7 ; mm4=(20 21 30 31) - movq mm2,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm3 ; mm1=(40 41 50 51) - punpckhwd mm2,mm3 ; mm2=(60 61 70 71) + movq mm4,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 01 10 11) + punpckhwd mm4,mm7 ; mm4=(20 21 30 31) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm3 ; mm1=(40 41 50 51) + punpckhwd mm2,mm3 ; mm2=(60 61 70 71) - movq mm7,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 - punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 - movq mm3,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 - punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 + movq mm7,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm0 ; mm6=(00 01 02 03)=data0 + punpckhdq mm7,mm0 ; mm7=(10 11 12 13)=data1 + movq mm3,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm5 ; mm2=(60 61 62 63)=data6 + punpckhdq mm3,mm5 ; mm3=(70 71 72 73)=data7 - movq mm0,mm7 - movq mm5,mm6 - psubw mm7,mm2 ; mm7=data1-data6=tmp6 - psubw mm6,mm3 ; mm6=data0-data7=tmp7 - paddw mm0,mm2 ; mm0=data1+data6=tmp1 - paddw mm5,mm3 ; mm5=data0+data7=tmp0 + movq mm0,mm7 + movq mm5,mm6 + psubw mm7,mm2 ; mm7=data1-data6=tmp6 + psubw mm6,mm3 ; mm6=data0-data7=tmp7 + paddw mm0,mm2 ; mm0=data1+data6=tmp1 + paddw mm5,mm3 ; mm5=data0+data7=tmp0 - movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) - movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 - movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 + movq mm2, MMWORD [wk(0)] ; mm2=(22 23 32 33) + movq mm3, MMWORD [wk(1)] ; mm3=(42 43 52 53) + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp6 + movq MMWORD [wk(1)], mm6 ; wk(1)=tmp7 - movq mm7,mm4 ; transpose coefficients(phase 2) - punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 - punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 - movq mm6,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 - punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 + movq mm7,mm4 ; transpose coefficients(phase 2) + punpckldq mm4,mm2 ; mm4=(20 21 22 23)=data2 + punpckhdq mm7,mm2 ; mm7=(30 31 32 33)=data3 + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm3 ; mm1=(40 41 42 43)=data4 + punpckhdq mm6,mm3 ; mm6=(50 51 52 53)=data5 - movq mm2,mm7 - movq mm3,mm4 - paddw mm7,mm1 ; mm7=data3+data4=tmp3 - paddw mm4,mm6 ; mm4=data2+data5=tmp2 - psubw mm2,mm1 ; mm2=data3-data4=tmp4 - psubw mm3,mm6 ; mm3=data2-data5=tmp5 + movq mm2,mm7 + movq mm3,mm4 + paddw mm7,mm1 ; mm7=data3+data4=tmp3 + paddw mm4,mm6 ; mm4=data2+data5=tmp2 + psubw mm2,mm1 ; mm2=data3-data4=tmp4 + psubw mm3,mm6 ; mm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movq mm1,mm5 - movq mm6,mm0 - paddw mm5,mm7 ; mm5=tmp10 - paddw mm0,mm4 ; mm0=tmp11 - psubw mm1,mm7 ; mm1=tmp13 - psubw mm6,mm4 ; mm6=tmp12 + movq mm1,mm5 + movq mm6,mm0 + paddw mm5,mm7 ; mm5=tmp10 + paddw mm0,mm4 ; mm0=tmp11 + psubw mm1,mm7 ; mm1=tmp13 + psubw mm6,mm4 ; mm6=tmp12 - movq mm7,mm5 - paddw mm5,mm0 ; mm5=tmp10+tmp11 - psubw mm7,mm0 ; mm7=tmp10-tmp11 + movq mm7,mm5 + paddw mm5,mm0 ; mm5=tmp10+tmp11 + psubw mm7,mm0 ; mm7=tmp10-tmp11 - paddw mm5,[GOTOFF(ebx,PW_DESCALE_P2X)] - paddw mm7,[GOTOFF(ebx,PW_DESCALE_P2X)] - psraw mm5,PASS1_BITS ; mm5=data0 - psraw mm7,PASS1_BITS ; mm7=data4 + paddw mm5,[GOTOFF(ebx,PW_DESCALE_P2X)] + paddw mm7,[GOTOFF(ebx,PW_DESCALE_P2X)] + psraw mm5,PASS1_BITS ; mm5=data0 + psraw mm7,PASS1_BITS ; mm7=data4 - movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 - movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm7 + movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5 + movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm7 - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movq mm4,mm1 ; mm1=tmp13 - movq mm0,mm1 - punpcklwd mm4,mm6 ; mm6=tmp12 - punpckhwd mm0,mm6 - movq mm1,mm4 - movq mm6,mm0 - pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L - pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H - pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L - pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H + movq mm4,mm1 ; mm1=tmp13 + movq mm0,mm1 + punpcklwd mm4,mm6 ; mm6=tmp12 + punpckhwd mm0,mm6 + movq mm1,mm4 + movq mm6,mm0 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=data2L + pmaddwd mm0,[GOTOFF(ebx,PW_F130_F054)] ; mm0=data2H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=data6L + pmaddwd mm6,[GOTOFF(ebx,PW_F054_MF130)] ; mm6=data6H - paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm0,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm4,DESCALE_P2 - psrad mm0,DESCALE_P2 - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm6,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm1,DESCALE_P2 - psrad mm6,DESCALE_P2 + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm0,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm4,DESCALE_P2 + psrad mm0,DESCALE_P2 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm6,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm1,DESCALE_P2 + psrad mm6,DESCALE_P2 - packssdw mm4,mm0 ; mm4=data2 - packssdw mm1,mm6 ; mm1=data6 + packssdw mm4,mm0 ; mm4=data2 + packssdw mm1,mm6 ; mm1=data6 - movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 - movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm1 - ; -- Odd part + ; -- Odd part - movq mm5, MMWORD [wk(0)] ; mm5=tmp6 - movq mm7, MMWORD [wk(1)] ; mm7=tmp7 + movq mm5, MMWORD [wk(0)] ; mm5=tmp6 + movq mm7, MMWORD [wk(1)] ; mm7=tmp7 - movq mm0,mm2 ; mm2=tmp4 - movq mm6,mm3 ; mm3=tmp5 - paddw mm0,mm5 ; mm0=z3 - paddw mm6,mm7 ; mm6=z4 + movq mm0,mm2 ; mm2=tmp4 + movq mm6,mm3 ; mm3=tmp5 + paddw mm0,mm5 ; mm0=z3 + paddw mm6,mm7 ; mm6=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movq mm4,mm0 - movq mm1,mm0 - punpcklwd mm4,mm6 - punpckhwd mm1,mm6 - movq mm0,mm4 - movq mm6,mm1 - pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L - pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H - pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L - pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H + movq mm4,mm0 + movq mm1,mm0 + punpcklwd mm4,mm6 + punpckhwd mm1,mm6 + movq mm0,mm4 + movq mm6,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF078_F117)] ; mm4=z3L + pmaddwd mm1,[GOTOFF(ebx,PW_MF078_F117)] ; mm1=z3H + pmaddwd mm0,[GOTOFF(ebx,PW_F117_F078)] ; mm0=z4L + pmaddwd mm6,[GOTOFF(ebx,PW_F117_F078)] ; mm6=z4H - movq MMWORD [wk(0)], mm4 ; wk(0)=z3L - movq MMWORD [wk(1)], mm1 ; wk(1)=z3H + movq MMWORD [wk(0)], mm4 ; wk(0)=z3L + movq MMWORD [wk(1)], mm1 ; wk(1)=z3H - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; - movq mm4,mm2 - movq mm1,mm2 - punpcklwd mm4,mm7 - punpckhwd mm1,mm7 - movq mm2,mm4 - movq mm7,mm1 - pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L - pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H - pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L - pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H + movq mm4,mm2 + movq mm1,mm2 + punpcklwd mm4,mm7 + punpckhwd mm1,mm7 + movq mm2,mm4 + movq mm7,mm1 + pmaddwd mm4,[GOTOFF(ebx,PW_MF060_MF089)] ; mm4=tmp4L + pmaddwd mm1,[GOTOFF(ebx,PW_MF060_MF089)] ; mm1=tmp4H + pmaddwd mm2,[GOTOFF(ebx,PW_MF089_F060)] ; mm2=tmp7L + pmaddwd mm7,[GOTOFF(ebx,PW_MF089_F060)] ; mm7=tmp7H - paddd mm4, MMWORD [wk(0)] ; mm4=data7L - paddd mm1, MMWORD [wk(1)] ; mm1=data7H - paddd mm2,mm0 ; mm2=data1L - paddd mm7,mm6 ; mm7=data1H + paddd mm4, MMWORD [wk(0)] ; mm4=data7L + paddd mm1, MMWORD [wk(1)] ; mm1=data7H + paddd mm2,mm0 ; mm2=data1L + paddd mm7,mm6 ; mm7=data1H - paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm4,DESCALE_P2 - psrad mm1,DESCALE_P2 - paddd mm2,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm2,DESCALE_P2 - psrad mm7,DESCALE_P2 + paddd mm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm4,DESCALE_P2 + psrad mm1,DESCALE_P2 + paddd mm2,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm2,DESCALE_P2 + psrad mm7,DESCALE_P2 - packssdw mm4,mm1 ; mm4=data7 - packssdw mm2,mm7 ; mm2=data1 + packssdw mm4,mm1 ; mm4=data7 + packssdw mm2,mm7 ; mm2=data1 - movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm4 - movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 + movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm4 + movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2 - movq mm1,mm3 - movq mm7,mm3 - punpcklwd mm1,mm5 - punpckhwd mm7,mm5 - movq mm3,mm1 - movq mm5,mm7 - pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L - pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H - pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L - pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H + movq mm1,mm3 + movq mm7,mm3 + punpcklwd mm1,mm5 + punpckhwd mm7,mm5 + movq mm3,mm1 + movq mm5,mm7 + pmaddwd mm1,[GOTOFF(ebx,PW_MF050_MF256)] ; mm1=tmp5L + pmaddwd mm7,[GOTOFF(ebx,PW_MF050_MF256)] ; mm7=tmp5H + pmaddwd mm3,[GOTOFF(ebx,PW_MF256_F050)] ; mm3=tmp6L + pmaddwd mm5,[GOTOFF(ebx,PW_MF256_F050)] ; mm5=tmp6H - paddd mm1,mm0 ; mm1=data5L - paddd mm7,mm6 ; mm7=data5H - paddd mm3, MMWORD [wk(0)] ; mm3=data3L - paddd mm5, MMWORD [wk(1)] ; mm5=data3H + paddd mm1,mm0 ; mm1=data5L + paddd mm7,mm6 ; mm7=data5H + paddd mm3, MMWORD [wk(0)] ; mm3=data3L + paddd mm5, MMWORD [wk(1)] ; mm5=data3H - paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm1,DESCALE_P2 - psrad mm7,DESCALE_P2 - paddd mm3,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd mm5,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad mm3,DESCALE_P2 - psrad mm5,DESCALE_P2 + paddd mm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm1,DESCALE_P2 + psrad mm7,DESCALE_P2 + paddd mm3,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd mm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad mm3,DESCALE_P2 + psrad mm5,DESCALE_P2 - packssdw mm1,mm7 ; mm1=data5 - packssdw mm3,mm5 ; mm3=data3 + packssdw mm1,mm7 ; mm1=data5 + packssdw mm3,mm5 ; mm3=data3 - movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm1 - movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 + movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm1 + movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3 - add edx, byte 4*SIZEOF_DCTELEM - dec ecx - jnz near .columnloop + add edx, byte 4*SIZEOF_DCTELEM + dec ecx + jnz near .columnloop - emms ; empty MMX state + emms ; empty MMX state -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfss2fst-64.asm b/simd/jfss2fst-64.asm index 6953caf3..41483bf6 100644 --- a/simd/jfss2fst-64.asm +++ b/simd/jfss2fst-64.asm @@ -27,24 +27,24 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. +%define CONST_BITS 8 ; 14 is also OK. %if CONST_BITS == 8 -F_0_382 equ 98 ; FIX(0.382683433) -F_0_541 equ 139 ; FIX(0.541196100) -F_0_707 equ 181 ; FIX(0.707106781) -F_1_306 equ 334 ; FIX(1.306562965) +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) -F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -52,21 +52,21 @@ F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_fdct_ifast_sse2) + alignz 16 + global EXTN(jconst_fdct_ifast_sse2) EXTN(jconst_fdct_ifast_sse2): -PW_F0707 times 8 dw F_0_707 << CONST_SHIFT -PW_F0382 times 8 dw F_0_382 << CONST_SHIFT -PW_F0541 times 8 dw F_0_541 << CONST_SHIFT -PW_F1306 times 8 dw F_1_306 << CONST_SHIFT +PW_F0707 times 8 dw F_0_707 << CONST_SHIFT +PW_F0382 times 8 dw F_0_382 << CONST_SHIFT +PW_F0541 times 8 dw F_0_541 << CONST_SHIFT +PW_F1306 times 8 dw F_1_306 << CONST_SHIFT - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform the forward DCT on one block of samples. ; @@ -76,317 +76,317 @@ PW_F1306 times 8 dw F_1_306 << CONST_SHIFT ; r10 = DCTELEM * data -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_ifast_sse2) + align 16 + global EXTN(jsimd_fdct_ifast_sse2) EXTN(jsimd_fdct_ifast_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov rdx, r10 ; (DCTELEM *) + mov rdx, r10 ; (DCTELEM *) - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - psubw xmm3,xmm1 ; xmm3=tmp13 - psubw xmm6,xmm7 ; xmm6=tmp12 - paddw xmm4,xmm1 ; xmm4=tmp10 - paddw xmm0,xmm7 ; xmm0=tmp11 + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + psubw xmm3,xmm1 ; xmm3=tmp13 + psubw xmm6,xmm7 ; xmm6=tmp12 + paddw xmm4,xmm1 ; xmm4=tmp10 + paddw xmm0,xmm7 ; xmm0=tmp11 - paddw xmm6,xmm3 - psllw xmm6,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm6,[rel PW_F0707] ; xmm6=z1 + paddw xmm6,xmm3 + psllw xmm6,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm6,[rel PW_F0707] ; xmm6=z1 - movdqa xmm1,xmm4 - movdqa xmm7,xmm3 - psubw xmm4,xmm0 ; xmm4=data4 - psubw xmm3,xmm6 ; xmm3=data6 - paddw xmm1,xmm0 ; xmm1=data0 - paddw xmm7,xmm6 ; xmm7=data2 + movdqa xmm1,xmm4 + movdqa xmm7,xmm3 + psubw xmm4,xmm0 ; xmm4=data4 + psubw xmm3,xmm6 ; xmm3=data6 + paddw xmm1,xmm0 ; xmm1=data0 + paddw xmm7,xmm6 ; xmm7=data2 - movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 - ; -- Odd part + ; -- Odd part - paddw xmm2,xmm5 ; xmm2=tmp10 - paddw xmm5,xmm0 ; xmm5=tmp11 - paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 + paddw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm5,xmm0 ; xmm5=tmp11 + paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm0,PRE_MULTIPLY_SCALE_BITS - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[rel PW_F0707] ; xmm5=z3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[rel PW_F0707] ; xmm5=z3 - movdqa xmm4,xmm2 ; xmm4=tmp10 - psubw xmm2,xmm0 - pmulhw xmm2,[rel PW_F0382] ; xmm2=z5 - pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm0,[rel PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm2 ; xmm4=z2 - paddw xmm0,xmm2 ; xmm0=z4 + movdqa xmm4,xmm2 ; xmm4=tmp10 + psubw xmm2,xmm0 + pmulhw xmm2,[rel PW_F0382] ; xmm2=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[rel PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm2 ; xmm4=z2 + paddw xmm0,xmm2 ; xmm0=z4 - movdqa xmm3,xmm6 - psubw xmm6,xmm5 ; xmm6=z13 - paddw xmm3,xmm5 ; xmm3=z11 + movdqa xmm3,xmm6 + psubw xmm6,xmm5 ; xmm6=z13 + paddw xmm3,xmm5 ; xmm3=z11 - movdqa xmm2,xmm6 - movdqa xmm5,xmm3 - psubw xmm6,xmm4 ; xmm6=data3 - psubw xmm3,xmm0 ; xmm3=data7 - paddw xmm2,xmm4 ; xmm2=data5 - paddw xmm5,xmm0 ; xmm5=data1 + movdqa xmm2,xmm6 + movdqa xmm5,xmm3 + psubw xmm6,xmm4 ; xmm6=data3 + psubw xmm3,xmm0 ; xmm3=data7 + paddw xmm2,xmm4 ; xmm2=data5 + paddw xmm5,xmm0 ; xmm5=data1 - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) - ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) + ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) + ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) - movdqa xmm4,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) - punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) - movdqa xmm0,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) - punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) + movdqa xmm4,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) + punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 - ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) - ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) + ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) + ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) - movdqa xmm7,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) - punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) - movdqa xmm0,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) - punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) + movdqa xmm7,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) + punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) + punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) - movdqa xmm2,xmm5 ; transpose coefficients(phase 2) - punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) - punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) - movdqa xmm3,xmm7 ; transpose coefficients(phase 2) - punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) - punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) + movdqa xmm2,xmm5 ; transpose coefficients(phase 2) + punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) + punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) + movdqa xmm3,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) + punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) - movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) - movdqa xmm2,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) - punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) - movdqa xmm7,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) - punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) + movdqa xmm2,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) + punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) + movdqa xmm7,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) + punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm0,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm0,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 - movdqa xmm5,xmm6 - movdqa xmm3,xmm1 - psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 - psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 - paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 - paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 + movdqa xmm5,xmm6 + movdqa xmm3,xmm1 + psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 + psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 + paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 + paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 - movdqa xmm6,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm1,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 + movdqa xmm6,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm1,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 - movdqa xmm7,xmm6 - movdqa xmm0,xmm2 - paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 - paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 - psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 - psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 + movdqa xmm7,xmm6 + movdqa xmm0,xmm2 + paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 + paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 + psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 + psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm1,xmm5 - psubw xmm3,xmm6 ; xmm3=tmp13 - psubw xmm5,xmm2 ; xmm5=tmp12 - paddw xmm4,xmm6 ; xmm4=tmp10 - paddw xmm1,xmm2 ; xmm1=tmp11 + movdqa xmm4,xmm3 + movdqa xmm1,xmm5 + psubw xmm3,xmm6 ; xmm3=tmp13 + psubw xmm5,xmm2 ; xmm5=tmp12 + paddw xmm4,xmm6 ; xmm4=tmp10 + paddw xmm1,xmm2 ; xmm1=tmp11 - paddw xmm5,xmm3 - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[rel PW_F0707] ; xmm5=z1 + paddw xmm5,xmm3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[rel PW_F0707] ; xmm5=z1 - movdqa xmm6,xmm4 - movdqa xmm2,xmm3 - psubw xmm4,xmm1 ; xmm4=data4 - psubw xmm3,xmm5 ; xmm3=data6 - paddw xmm6,xmm1 ; xmm6=data0 - paddw xmm2,xmm5 ; xmm2=data2 + movdqa xmm6,xmm4 + movdqa xmm2,xmm3 + psubw xmm4,xmm1 ; xmm4=data4 + psubw xmm3,xmm5 ; xmm3=data6 + paddw xmm6,xmm1 ; xmm6=data0 + paddw xmm2,xmm5 ; xmm2=data2 - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 - ; -- Odd part + ; -- Odd part - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - paddw xmm7,xmm0 ; xmm7=tmp10 - paddw xmm0,xmm1 ; xmm0=tmp11 - paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 + paddw xmm7,xmm0 ; xmm7=tmp10 + paddw xmm0,xmm1 ; xmm0=tmp11 + paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 - psllw xmm7,PRE_MULTIPLY_SCALE_BITS - psllw xmm1,PRE_MULTIPLY_SCALE_BITS + psllw xmm7,PRE_MULTIPLY_SCALE_BITS + psllw xmm1,PRE_MULTIPLY_SCALE_BITS - psllw xmm0,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm0,[rel PW_F0707] ; xmm0=z3 + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm0,[rel PW_F0707] ; xmm0=z3 - movdqa xmm4,xmm7 ; xmm4=tmp10 - psubw xmm7,xmm1 - pmulhw xmm7,[rel PW_F0382] ; xmm7=z5 - pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm1,[rel PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm7 ; xmm4=z2 - paddw xmm1,xmm7 ; xmm1=z4 + movdqa xmm4,xmm7 ; xmm4=tmp10 + psubw xmm7,xmm1 + pmulhw xmm7,[rel PW_F0382] ; xmm7=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[rel PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm7 ; xmm4=z2 + paddw xmm1,xmm7 ; xmm1=z4 - movdqa xmm3,xmm5 - psubw xmm5,xmm0 ; xmm5=z13 - paddw xmm3,xmm0 ; xmm3=z11 + movdqa xmm3,xmm5 + psubw xmm5,xmm0 ; xmm5=z13 + paddw xmm3,xmm0 ; xmm3=z11 - movdqa xmm6,xmm5 - movdqa xmm2,xmm3 - psubw xmm5,xmm4 ; xmm5=data3 - psubw xmm3,xmm1 ; xmm3=data7 - paddw xmm6,xmm4 ; xmm6=data5 - paddw xmm2,xmm1 ; xmm2=data1 + movdqa xmm6,xmm5 + movdqa xmm2,xmm3 + psubw xmm5,xmm4 ; xmm5=data3 + psubw xmm3,xmm1 ; xmm3=data7 + paddw xmm6,xmm4 ; xmm6=data5 + paddw xmm2,xmm1 ; xmm2=data1 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm5 - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2 - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfss2fst.asm b/simd/jfss2fst.asm index 73fc9e51..8bc05f4f 100644 --- a/simd/jfss2fst.asm +++ b/simd/jfss2fst.asm @@ -26,24 +26,24 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. +%define CONST_BITS 8 ; 14 is also OK. %if CONST_BITS == 8 -F_0_382 equ 98 ; FIX(0.382683433) -F_0_541 equ 139 ; FIX(0.541196100) -F_0_707 equ 181 ; FIX(0.707106781) -F_1_306 equ 334 ; FIX(1.306562965) +F_0_382 equ 98 ; FIX(0.382683433) +F_0_541 equ 139 ; FIX(0.541196100) +F_0_707 equ 181 ; FIX(0.707106781) +F_1_306 equ 334 ; FIX(1.306562965) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) -F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) +F_0_382 equ DESCALE( 410903207,30-CONST_BITS) ; FIX(0.382683433) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_707 equ DESCALE( 759250124,30-CONST_BITS) ; FIX(0.707106781) +F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -51,21 +51,21 @@ F_1_306 equ DESCALE(1402911301,30-CONST_BITS) ; FIX(1.306562965) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_fdct_ifast_sse2) + alignz 16 + global EXTN(jconst_fdct_ifast_sse2) EXTN(jconst_fdct_ifast_sse2): -PW_F0707 times 8 dw F_0_707 << CONST_SHIFT -PW_F0382 times 8 dw F_0_382 << CONST_SHIFT -PW_F0541 times 8 dw F_0_541 << CONST_SHIFT -PW_F1306 times 8 dw F_1_306 << CONST_SHIFT +PW_F0707 times 8 dw F_0_707 << CONST_SHIFT +PW_F0382 times 8 dw F_0_382 << CONST_SHIFT +PW_F0541 times 8 dw F_0_541 << CONST_SHIFT +PW_F1306 times 8 dw F_1_306 << CONST_SHIFT - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -73,332 +73,332 @@ PW_F1306 times 8 dw F_1_306 << CONST_SHIFT ; jsimd_fdct_ifast_sse2 (DCTELEM * data) ; -%define data(b) (b)+8 ; DCTELEM * data +%define data(b) (b)+8 ; DCTELEM * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_ifast_sse2) + align 16 + global EXTN(jsimd_fdct_ifast_sse2) EXTN(jsimd_fdct_ifast_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; unused -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov edx, POINTER [data(eax)] ; (DCTELEM *) + mov edx, POINTER [data(eax)] ; (DCTELEM *) - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - psubw xmm3,xmm1 ; xmm3=tmp13 - psubw xmm6,xmm7 ; xmm6=tmp12 - paddw xmm4,xmm1 ; xmm4=tmp10 - paddw xmm0,xmm7 ; xmm0=tmp11 + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + psubw xmm3,xmm1 ; xmm3=tmp13 + psubw xmm6,xmm7 ; xmm6=tmp12 + paddw xmm4,xmm1 ; xmm4=tmp10 + paddw xmm0,xmm7 ; xmm0=tmp11 - paddw xmm6,xmm3 - psllw xmm6,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm6,[GOTOFF(ebx,PW_F0707)] ; xmm6=z1 + paddw xmm6,xmm3 + psllw xmm6,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm6,[GOTOFF(ebx,PW_F0707)] ; xmm6=z1 - movdqa xmm1,xmm4 - movdqa xmm7,xmm3 - psubw xmm4,xmm0 ; xmm4=data4 - psubw xmm3,xmm6 ; xmm3=data6 - paddw xmm1,xmm0 ; xmm1=data0 - paddw xmm7,xmm6 ; xmm7=data2 + movdqa xmm1,xmm4 + movdqa xmm7,xmm3 + psubw xmm4,xmm0 ; xmm4=data4 + psubw xmm3,xmm6 ; xmm3=data6 + paddw xmm1,xmm0 ; xmm1=data0 + paddw xmm7,xmm6 ; xmm7=data2 - movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 - ; -- Odd part + ; -- Odd part - paddw xmm2,xmm5 ; xmm2=tmp10 - paddw xmm5,xmm0 ; xmm5=tmp11 - paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 + paddw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm5,xmm0 ; xmm5=tmp11 + paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm0,PRE_MULTIPLY_SCALE_BITS - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z3 - movdqa xmm4,xmm2 ; xmm4=tmp10 - psubw xmm2,xmm0 - pmulhw xmm2,[GOTOFF(ebx,PW_F0382)] ; xmm2=z5 - pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm0,[GOTOFF(ebx,PW_F1306)] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm2 ; xmm4=z2 - paddw xmm0,xmm2 ; xmm0=z4 + movdqa xmm4,xmm2 ; xmm4=tmp10 + psubw xmm2,xmm0 + pmulhw xmm2,[GOTOFF(ebx,PW_F0382)] ; xmm2=z5 + pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[GOTOFF(ebx,PW_F1306)] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm2 ; xmm4=z2 + paddw xmm0,xmm2 ; xmm0=z4 - movdqa xmm3,xmm6 - psubw xmm6,xmm5 ; xmm6=z13 - paddw xmm3,xmm5 ; xmm3=z11 + movdqa xmm3,xmm6 + psubw xmm6,xmm5 ; xmm6=z13 + paddw xmm3,xmm5 ; xmm3=z11 - movdqa xmm2,xmm6 - movdqa xmm5,xmm3 - psubw xmm6,xmm4 ; xmm6=data3 - psubw xmm3,xmm0 ; xmm3=data7 - paddw xmm2,xmm4 ; xmm2=data5 - paddw xmm5,xmm0 ; xmm5=data1 + movdqa xmm2,xmm6 + movdqa xmm5,xmm3 + psubw xmm6,xmm4 ; xmm6=data3 + psubw xmm3,xmm0 ; xmm3=data7 + paddw xmm2,xmm4 ; xmm2=data5 + paddw xmm5,xmm0 ; xmm5=data1 - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. -; mov edx, POINTER [data(eax)] ; (DCTELEM *) +; mov edx, POINTER [data(eax)] ; (DCTELEM *) - ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) - ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) + ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) + ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) - movdqa xmm4,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) - punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) - movdqa xmm0,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) - punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) + movdqa xmm4,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) + punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 - ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) - ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) + ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) + ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) - movdqa xmm7,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) - punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) - movdqa xmm0,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) - punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) + movdqa xmm7,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) + punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) + punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) - movdqa xmm2,xmm5 ; transpose coefficients(phase 2) - punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) - punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) - movdqa xmm3,xmm7 ; transpose coefficients(phase 2) - punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) - punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) + movdqa xmm2,xmm5 ; transpose coefficients(phase 2) + punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) + punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) + movdqa xmm3,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) + punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) - movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) - movdqa xmm2,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) - punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) - movdqa xmm7,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) - punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) + movdqa xmm2,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) + punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) + movdqa xmm7,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) + punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm0,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm0,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 - movdqa xmm5,xmm6 - movdqa xmm3,xmm1 - psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 - psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 - paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 - paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 + movdqa xmm5,xmm6 + movdqa xmm3,xmm1 + psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 + psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 + paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 + paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 - movdqa xmm6,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm1,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 + movdqa xmm6,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm1,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 - movdqa xmm7,xmm6 - movdqa xmm0,xmm2 - paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 - paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 - psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 - psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 + movdqa xmm7,xmm6 + movdqa xmm0,xmm2 + paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 + paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 + psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 + psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm1,xmm5 - psubw xmm3,xmm6 ; xmm3=tmp13 - psubw xmm5,xmm2 ; xmm5=tmp12 - paddw xmm4,xmm6 ; xmm4=tmp10 - paddw xmm1,xmm2 ; xmm1=tmp11 + movdqa xmm4,xmm3 + movdqa xmm1,xmm5 + psubw xmm3,xmm6 ; xmm3=tmp13 + psubw xmm5,xmm2 ; xmm5=tmp12 + paddw xmm4,xmm6 ; xmm4=tmp10 + paddw xmm1,xmm2 ; xmm1=tmp11 - paddw xmm5,xmm3 - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z1 + paddw xmm5,xmm3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F0707)] ; xmm5=z1 - movdqa xmm6,xmm4 - movdqa xmm2,xmm3 - psubw xmm4,xmm1 ; xmm4=data4 - psubw xmm3,xmm5 ; xmm3=data6 - paddw xmm6,xmm1 ; xmm6=data0 - paddw xmm2,xmm5 ; xmm2=data2 + movdqa xmm6,xmm4 + movdqa xmm2,xmm3 + psubw xmm4,xmm1 ; xmm4=data4 + psubw xmm3,xmm5 ; xmm3=data6 + paddw xmm6,xmm1 ; xmm6=data0 + paddw xmm2,xmm5 ; xmm2=data2 - movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm2 - ; -- Odd part + ; -- Odd part - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - paddw xmm7,xmm0 ; xmm7=tmp10 - paddw xmm0,xmm1 ; xmm0=tmp11 - paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 + paddw xmm7,xmm0 ; xmm7=tmp10 + paddw xmm0,xmm1 ; xmm0=tmp11 + paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 - psllw xmm7,PRE_MULTIPLY_SCALE_BITS - psllw xmm1,PRE_MULTIPLY_SCALE_BITS + psllw xmm7,PRE_MULTIPLY_SCALE_BITS + psllw xmm1,PRE_MULTIPLY_SCALE_BITS - psllw xmm0,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm0,[GOTOFF(ebx,PW_F0707)] ; xmm0=z3 + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm0,[GOTOFF(ebx,PW_F0707)] ; xmm0=z3 - movdqa xmm4,xmm7 ; xmm4=tmp10 - psubw xmm7,xmm1 - pmulhw xmm7,[GOTOFF(ebx,PW_F0382)] ; xmm7=z5 - pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm1,[GOTOFF(ebx,PW_F1306)] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm7 ; xmm4=z2 - paddw xmm1,xmm7 ; xmm1=z4 + movdqa xmm4,xmm7 ; xmm4=tmp10 + psubw xmm7,xmm1 + pmulhw xmm7,[GOTOFF(ebx,PW_F0382)] ; xmm7=z5 + pmulhw xmm4,[GOTOFF(ebx,PW_F0541)] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[GOTOFF(ebx,PW_F1306)] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm7 ; xmm4=z2 + paddw xmm1,xmm7 ; xmm1=z4 - movdqa xmm3,xmm5 - psubw xmm5,xmm0 ; xmm5=z13 - paddw xmm3,xmm0 ; xmm3=z11 + movdqa xmm3,xmm5 + psubw xmm5,xmm0 ; xmm5=z13 + paddw xmm3,xmm0 ; xmm3=z11 - movdqa xmm6,xmm5 - movdqa xmm2,xmm3 - psubw xmm5,xmm4 ; xmm5=data3 - psubw xmm3,xmm1 ; xmm3=data7 - paddw xmm6,xmm4 ; xmm6=data5 - paddw xmm2,xmm1 ; xmm2=data1 + movdqa xmm6,xmm5 + movdqa xmm2,xmm3 + psubw xmm5,xmm4 ; xmm5=data3 + psubw xmm3,xmm1 ; xmm3=data7 + paddw xmm6,xmm4 ; xmm6=data5 + paddw xmm2,xmm1 ; xmm2=data1 - movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm5 - movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm2 -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; unused - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfss2int-64.asm b/simd/jfss2int-64.asm index bd1bd45a..f5ec3465 100644 --- a/simd/jfss2int-64.asm +++ b/simd/jfss2int-64.asm @@ -27,67 +27,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_islow_sse2) + alignz 16 + global EXTN(jconst_fdct_islow_sse2) EXTN(jconst_fdct_islow_sse2): -PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) -PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform the forward DCT on one block of samples. ; @@ -97,526 +97,526 @@ PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) ; r10 = DCTELEM * data -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 6 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 - align 16 - global EXTN(jsimd_fdct_islow_sse2) + align 16 + global EXTN(jsimd_fdct_islow_sse2) EXTN(jsimd_fdct_islow_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args - - ; ---- Pass 1: process rows. - - mov rdx, r10 ; (DCTELEM *) - - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) - - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 - - ; -- Even part - - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - paddw xmm3,xmm1 ; xmm3=tmp10 - paddw xmm6,xmm7 ; xmm6=tmp11 - psubw xmm4,xmm1 ; xmm4=tmp13 - psubw xmm0,xmm7 ; xmm0=tmp12 - - movdqa xmm1,xmm3 - paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 - psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 - - psllw xmm3,PASS1_BITS ; xmm3=data0 - psllw xmm1,PASS1_BITS ; xmm1=data4 - - movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 - movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 - - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - - movdqa xmm7,xmm4 ; xmm4=tmp13 - movdqa xmm6,xmm4 - punpcklwd xmm7,xmm0 ; xmm0=tmp12 - punpckhwd xmm6,xmm0 - movdqa xmm4,xmm7 - movdqa xmm0,xmm6 - pmaddwd xmm7,[rel PW_F130_F054] ; xmm7=data2L - pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=data2H - pmaddwd xmm4,[rel PW_F054_MF130] ; xmm4=data6L - pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=data6H - - paddd xmm7,[rel PD_DESCALE_P1] - paddd xmm6,[rel PD_DESCALE_P1] - psrad xmm7,DESCALE_P1 - psrad xmm6,DESCALE_P1 - paddd xmm4,[rel PD_DESCALE_P1] - paddd xmm0,[rel PD_DESCALE_P1] - psrad xmm4,DESCALE_P1 - psrad xmm0,DESCALE_P1 - - packssdw xmm7,xmm6 ; xmm7=data2 - packssdw xmm4,xmm0 ; xmm4=data6 - - movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 - movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 - - ; -- Odd part - - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 - - movdqa xmm6,xmm2 ; xmm2=tmp4 - movdqa xmm0,xmm5 ; xmm5=tmp5 - paddw xmm6,xmm3 ; xmm6=z3 - paddw xmm0,xmm1 ; xmm0=z4 - - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - - movdqa xmm7,xmm6 - movdqa xmm4,xmm6 - punpcklwd xmm7,xmm0 - punpckhwd xmm4,xmm0 - movdqa xmm6,xmm7 - movdqa xmm0,xmm4 - pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L - pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3H - pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L - pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H - - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H - - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; - - movdqa xmm7,xmm2 - movdqa xmm4,xmm2 - punpcklwd xmm7,xmm1 - punpckhwd xmm4,xmm1 - movdqa xmm2,xmm7 - movdqa xmm1,xmm4 - pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp4L - pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4H - pmaddwd xmm2,[rel PW_MF089_F060] ; xmm2=tmp7L - pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H - - paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L - paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H - paddd xmm2,xmm6 ; xmm2=data1L - paddd xmm1,xmm0 ; xmm1=data1H - - paddd xmm7,[rel PD_DESCALE_P1] - paddd xmm4,[rel PD_DESCALE_P1] - psrad xmm7,DESCALE_P1 - psrad xmm4,DESCALE_P1 - paddd xmm2,[rel PD_DESCALE_P1] - paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm2,DESCALE_P1 - psrad xmm1,DESCALE_P1 - - packssdw xmm7,xmm4 ; xmm7=data7 - packssdw xmm2,xmm1 ; xmm2=data1 - - movdqa xmm4,xmm5 - movdqa xmm1,xmm5 - punpcklwd xmm4,xmm3 - punpckhwd xmm1,xmm3 - movdqa xmm5,xmm4 - movdqa xmm3,xmm1 - pmaddwd xmm4,[rel PW_MF050_MF256] ; xmm4=tmp5L - pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H - pmaddwd xmm5,[rel PW_MF256_F050] ; xmm5=tmp6L - pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H - - paddd xmm4,xmm6 ; xmm4=data5L - paddd xmm1,xmm0 ; xmm1=data5H - paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L - paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H - - paddd xmm4,[rel PD_DESCALE_P1] - paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm4,DESCALE_P1 - psrad xmm1,DESCALE_P1 - paddd xmm5,[rel PD_DESCALE_P1] - paddd xmm3,[rel PD_DESCALE_P1] - psrad xmm5,DESCALE_P1 - psrad xmm3,DESCALE_P1 - - packssdw xmm4,xmm1 ; xmm4=data5 - packssdw xmm5,xmm3 ; xmm5=data3 - - ; ---- Pass 2: process columns. - - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 - movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 - - ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) - ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) - - movdqa xmm1,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) - punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) - movdqa xmm3,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) - punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) - - movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 - movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 - - ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) - ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) - - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) - - movdqa xmm0,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) - punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) - movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) - punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) - - movdqa xmm4,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) - punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) - punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) - - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) - movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) - - movdqa xmm4,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) - punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) - movdqa xmm0,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) - punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) - - movdqa xmm5,xmm6 ; transpose coefficients(phase 3) - punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm3,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 - - movdqa xmm2,xmm5 - movdqa xmm7,xmm6 - psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 - psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 - paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 - paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 - - movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) - movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - - movdqa xmm5,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 - - movdqa xmm0,xmm5 - movdqa xmm3,xmm4 - paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 - paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 - psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 - psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 - - ; -- Even part - - movdqa xmm1,xmm7 - movdqa xmm6,xmm2 - paddw xmm7,xmm5 ; xmm7=tmp10 - paddw xmm2,xmm4 ; xmm2=tmp11 - psubw xmm1,xmm5 ; xmm1=tmp13 - psubw xmm6,xmm4 ; xmm6=tmp12 - - movdqa xmm5,xmm7 - paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 - psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 - - paddw xmm7,[rel PW_DESCALE_P2X] - paddw xmm5,[rel PW_DESCALE_P2X] - psraw xmm7,PASS1_BITS ; xmm7=data0 - psraw xmm5,PASS1_BITS ; xmm5=data4 - - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm7 - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm5 - - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - - movdqa xmm4,xmm1 ; xmm1=tmp13 - movdqa xmm2,xmm1 - punpcklwd xmm4,xmm6 ; xmm6=tmp12 - punpckhwd xmm2,xmm6 - movdqa xmm1,xmm4 - movdqa xmm6,xmm2 - pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=data2L - pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=data2H - pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=data6L - pmaddwd xmm6,[rel PW_F054_MF130] ; xmm6=data6H - - paddd xmm4,[rel PD_DESCALE_P2] - paddd xmm2,[rel PD_DESCALE_P2] - psrad xmm4,DESCALE_P2 - psrad xmm2,DESCALE_P2 - paddd xmm1,[rel PD_DESCALE_P2] - paddd xmm6,[rel PD_DESCALE_P2] - psrad xmm1,DESCALE_P2 - psrad xmm6,DESCALE_P2 - - packssdw xmm4,xmm2 ; xmm4=data2 - packssdw xmm1,xmm6 ; xmm1=data6 - - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm1 - - ; -- Odd part - - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - - movdqa xmm2,xmm0 ; xmm0=tmp4 - movdqa xmm6,xmm3 ; xmm3=tmp5 - paddw xmm2,xmm7 ; xmm2=z3 - paddw xmm6,xmm5 ; xmm6=z4 - - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - - movdqa xmm4,xmm2 - movdqa xmm1,xmm2 - punpcklwd xmm4,xmm6 - punpckhwd xmm1,xmm6 - movdqa xmm2,xmm4 - movdqa xmm6,xmm1 - pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3L - pmaddwd xmm1,[rel PW_MF078_F117] ; xmm1=z3H - pmaddwd xmm2,[rel PW_F117_F078] ; xmm2=z4L - pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4H - - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H - - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; - - movdqa xmm4,xmm0 - movdqa xmm1,xmm0 - punpcklwd xmm4,xmm5 - punpckhwd xmm1,xmm5 - movdqa xmm0,xmm4 - movdqa xmm5,xmm1 - pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4L - pmaddwd xmm1,[rel PW_MF060_MF089] ; xmm1=tmp4H - pmaddwd xmm0,[rel PW_MF089_F060] ; xmm0=tmp7L - pmaddwd xmm5,[rel PW_MF089_F060] ; xmm5=tmp7H - - paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L - paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H - paddd xmm0,xmm2 ; xmm0=data1L - paddd xmm5,xmm6 ; xmm5=data1H - - paddd xmm4,[rel PD_DESCALE_P2] - paddd xmm1,[rel PD_DESCALE_P2] - psrad xmm4,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm0,[rel PD_DESCALE_P2] - paddd xmm5,[rel PD_DESCALE_P2] - psrad xmm0,DESCALE_P2 - psrad xmm5,DESCALE_P2 - - packssdw xmm4,xmm1 ; xmm4=data7 - packssdw xmm0,xmm5 ; xmm0=data1 - - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm0 - - movdqa xmm1,xmm3 - movdqa xmm5,xmm3 - punpcklwd xmm1,xmm7 - punpckhwd xmm5,xmm7 - movdqa xmm3,xmm1 - movdqa xmm7,xmm5 - pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5L - pmaddwd xmm5,[rel PW_MF050_MF256] ; xmm5=tmp5H - pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6L - pmaddwd xmm7,[rel PW_MF256_F050] ; xmm7=tmp6H - - paddd xmm1,xmm2 ; xmm1=data5L - paddd xmm5,xmm6 ; xmm5=data5H - paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L - paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H - - paddd xmm1,[rel PD_DESCALE_P2] - paddd xmm5,[rel PD_DESCALE_P2] - psrad xmm1,DESCALE_P2 - psrad xmm5,DESCALE_P2 - paddd xmm3,[rel PD_DESCALE_P2] - paddd xmm7,[rel PD_DESCALE_P2] - psrad xmm3,DESCALE_P2 - psrad xmm7,DESCALE_P2 - - packssdw xmm1,xmm5 ; xmm1=data5 - packssdw xmm3,xmm7 ; xmm3=data3 - - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3 - - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args + + ; ---- Pass 1: process rows. + + mov rdx, r10 ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + paddw xmm3,xmm1 ; xmm3=tmp10 + paddw xmm6,xmm7 ; xmm6=tmp11 + psubw xmm4,xmm1 ; xmm4=tmp13 + psubw xmm0,xmm7 ; xmm0=tmp12 + + movdqa xmm1,xmm3 + paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 + psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 + + psllw xmm3,PASS1_BITS ; xmm3=data0 + psllw xmm1,PASS1_BITS ; xmm1=data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm7,xmm4 ; xmm4=tmp13 + movdqa xmm6,xmm4 + punpcklwd xmm7,xmm0 ; xmm0=tmp12 + punpckhwd xmm6,xmm0 + movdqa xmm4,xmm7 + movdqa xmm0,xmm6 + pmaddwd xmm7,[rel PW_F130_F054] ; xmm7=data2L + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=data2H + pmaddwd xmm4,[rel PW_F054_MF130] ; xmm4=data6L + pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=data6H + + paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm6,[rel PD_DESCALE_P1] + psrad xmm7,DESCALE_P1 + psrad xmm6,DESCALE_P1 + paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm0,[rel PD_DESCALE_P1] + psrad xmm4,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm7,xmm6 ; xmm7=data2 + packssdw xmm4,xmm0 ; xmm4=data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 + + ; -- Odd part + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 + + movdqa xmm6,xmm2 ; xmm2=tmp4 + movdqa xmm0,xmm5 ; xmm5=tmp5 + paddw xmm6,xmm3 ; xmm6=z3 + paddw xmm0,xmm1 ; xmm0=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm7,xmm6 + movdqa xmm4,xmm6 + punpcklwd xmm7,xmm0 + punpckhwd xmm4,xmm0 + movdqa xmm6,xmm7 + movdqa xmm0,xmm4 + pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3H + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L + pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm7,xmm2 + movdqa xmm4,xmm2 + punpcklwd xmm7,xmm1 + punpckhwd xmm4,xmm1 + movdqa xmm2,xmm7 + movdqa xmm1,xmm4 + pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp4L + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4H + pmaddwd xmm2,[rel PW_MF089_F060] ; xmm2=tmp7L + pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H + + paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H + paddd xmm2,xmm6 ; xmm2=data1L + paddd xmm1,xmm0 ; xmm1=data1H + + paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] + psrad xmm7,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm2,[rel PD_DESCALE_P1] + paddd xmm1,[rel PD_DESCALE_P1] + psrad xmm2,DESCALE_P1 + psrad xmm1,DESCALE_P1 + + packssdw xmm7,xmm4 ; xmm7=data7 + packssdw xmm2,xmm1 ; xmm2=data1 + + movdqa xmm4,xmm5 + movdqa xmm1,xmm5 + punpcklwd xmm4,xmm3 + punpckhwd xmm1,xmm3 + movdqa xmm5,xmm4 + movdqa xmm3,xmm1 + pmaddwd xmm4,[rel PW_MF050_MF256] ; xmm4=tmp5L + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H + pmaddwd xmm5,[rel PW_MF256_F050] ; xmm5=tmp6L + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H + + paddd xmm4,xmm6 ; xmm4=data5L + paddd xmm1,xmm0 ; xmm1=data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H + + paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm1,[rel PD_DESCALE_P1] + psrad xmm4,DESCALE_P1 + psrad xmm1,DESCALE_P1 + paddd xmm5,[rel PD_DESCALE_P1] + paddd xmm3,[rel PD_DESCALE_P1] + psrad xmm5,DESCALE_P1 + psrad xmm3,DESCALE_P1 + + packssdw xmm4,xmm1 ; xmm4=data5 + packssdw xmm5,xmm3 ; xmm5=data3 + + ; ---- Pass 2: process columns. + + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 + + ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) + ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) + + movdqa xmm1,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) + punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) + movdqa xmm3,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) + punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) + + movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 + + ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) + ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm0,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) + + movdqa xmm4,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) + punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) + punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) + punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) + punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) + + movdqa xmm5,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm2,xmm5 + movdqa xmm7,xmm6 + psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 + psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 + paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 + paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movdqa xmm5,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm0,xmm5 + movdqa xmm3,xmm4 + paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 + paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 + psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 + psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm1,xmm7 + movdqa xmm6,xmm2 + paddw xmm7,xmm5 ; xmm7=tmp10 + paddw xmm2,xmm4 ; xmm2=tmp11 + psubw xmm1,xmm5 ; xmm1=tmp13 + psubw xmm6,xmm4 ; xmm6=tmp12 + + movdqa xmm5,xmm7 + paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 + psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 + + paddw xmm7,[rel PW_DESCALE_P2X] + paddw xmm5,[rel PW_DESCALE_P2X] + psraw xmm7,PASS1_BITS ; xmm7=data0 + psraw xmm5,PASS1_BITS ; xmm5=data4 + + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm5 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm4,xmm1 ; xmm1=tmp13 + movdqa xmm2,xmm1 + punpcklwd xmm4,xmm6 ; xmm6=tmp12 + punpckhwd xmm2,xmm6 + movdqa xmm1,xmm4 + movdqa xmm6,xmm2 + pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=data2L + pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=data2H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=data6L + pmaddwd xmm6,[rel PW_F054_MF130] ; xmm6=data6H + + paddd xmm4,[rel PD_DESCALE_P2] + paddd xmm2,[rel PD_DESCALE_P2] + psrad xmm4,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm1,[rel PD_DESCALE_P2] + paddd xmm6,[rel PD_DESCALE_P2] + psrad xmm1,DESCALE_P2 + psrad xmm6,DESCALE_P2 + + packssdw xmm4,xmm2 ; xmm4=data2 + packssdw xmm1,xmm6 ; xmm1=data6 + + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm1 + + ; -- Odd part + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + movdqa xmm2,xmm0 ; xmm0=tmp4 + movdqa xmm6,xmm3 ; xmm3=tmp5 + paddw xmm2,xmm7 ; xmm2=z3 + paddw xmm6,xmm5 ; xmm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm4,xmm2 + movdqa xmm1,xmm2 + punpcklwd xmm4,xmm6 + punpckhwd xmm1,xmm6 + movdqa xmm2,xmm4 + movdqa xmm6,xmm1 + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3L + pmaddwd xmm1,[rel PW_MF078_F117] ; xmm1=z3H + pmaddwd xmm2,[rel PW_F117_F078] ; xmm2=z4L + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm4,xmm0 + movdqa xmm1,xmm0 + punpcklwd xmm4,xmm5 + punpckhwd xmm1,xmm5 + movdqa xmm0,xmm4 + movdqa xmm5,xmm1 + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4L + pmaddwd xmm1,[rel PW_MF060_MF089] ; xmm1=tmp4H + pmaddwd xmm0,[rel PW_MF089_F060] ; xmm0=tmp7L + pmaddwd xmm5,[rel PW_MF089_F060] ; xmm5=tmp7H + + paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H + paddd xmm0,xmm2 ; xmm0=data1L + paddd xmm5,xmm6 ; xmm5=data1H + + paddd xmm4,[rel PD_DESCALE_P2] + paddd xmm1,[rel PD_DESCALE_P2] + psrad xmm4,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm0,[rel PD_DESCALE_P2] + paddd xmm5,[rel PD_DESCALE_P2] + psrad xmm0,DESCALE_P2 + psrad xmm5,DESCALE_P2 + + packssdw xmm4,xmm1 ; xmm4=data7 + packssdw xmm0,xmm5 ; xmm0=data1 + + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1,xmm3 + movdqa xmm5,xmm3 + punpcklwd xmm1,xmm7 + punpckhwd xmm5,xmm7 + movdqa xmm3,xmm1 + movdqa xmm7,xmm5 + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5L + pmaddwd xmm5,[rel PW_MF050_MF256] ; xmm5=tmp5H + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6L + pmaddwd xmm7,[rel PW_MF256_F050] ; xmm7=tmp6H + + paddd xmm1,xmm2 ; xmm1=data5L + paddd xmm5,xmm6 ; xmm5=data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H + + paddd xmm1,[rel PD_DESCALE_P2] + paddd xmm5,[rel PD_DESCALE_P2] + psrad xmm1,DESCALE_P2 + psrad xmm5,DESCALE_P2 + paddd xmm3,[rel PD_DESCALE_P2] + paddd xmm7,[rel PD_DESCALE_P2] + psrad xmm3,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm1,xmm5 ; xmm1=data5 + packssdw xmm3,xmm7 ; xmm3=data3 + + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3 + + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfss2int.asm b/simd/jfss2int.asm index 5e3f2aaa..d1bcb2ed 100644 --- a/simd/jfss2int.asm +++ b/simd/jfss2int.asm @@ -26,67 +26,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_islow_sse2) + alignz 16 + global EXTN(jconst_fdct_islow_sse2) EXTN(jconst_fdct_islow_sse2): -PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) -PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -94,541 +94,541 @@ PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) ; jsimd_fdct_islow_sse2 (DCTELEM * data) ; -%define data(b) (b)+8 ; DCTELEM * data +%define data(b) (b)+8 ; DCTELEM * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 6 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 - align 16 - global EXTN(jsimd_fdct_islow_sse2) + align 16 + global EXTN(jsimd_fdct_islow_sse2) EXTN(jsimd_fdct_islow_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; unused -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused - - get_GOT ebx ; get GOT address - - ; ---- Pass 1: process rows. - - mov edx, POINTER [data(eax)] ; (DCTELEM *) - - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] - movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] - - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] - - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) - - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 - - ; -- Even part - - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - paddw xmm3,xmm1 ; xmm3=tmp10 - paddw xmm6,xmm7 ; xmm6=tmp11 - psubw xmm4,xmm1 ; xmm4=tmp13 - psubw xmm0,xmm7 ; xmm0=tmp12 - - movdqa xmm1,xmm3 - paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 - psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 - - psllw xmm3,PASS1_BITS ; xmm3=data0 - psllw xmm1,PASS1_BITS ; xmm1=data4 - - movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 - movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 - - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - - movdqa xmm7,xmm4 ; xmm4=tmp13 - movdqa xmm6,xmm4 - punpcklwd xmm7,xmm0 ; xmm0=tmp12 - punpckhwd xmm6,xmm0 - movdqa xmm4,xmm7 - movdqa xmm0,xmm6 - pmaddwd xmm7,[GOTOFF(ebx,PW_F130_F054)] ; xmm7=data2L - pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=data2H - pmaddwd xmm4,[GOTOFF(ebx,PW_F054_MF130)] ; xmm4=data6L - pmaddwd xmm0,[GOTOFF(ebx,PW_F054_MF130)] ; xmm0=data6H - - paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm7,DESCALE_P1 - psrad xmm6,DESCALE_P1 - paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm4,DESCALE_P1 - psrad xmm0,DESCALE_P1 - - packssdw xmm7,xmm6 ; xmm7=data2 - packssdw xmm4,xmm0 ; xmm4=data6 - - movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 - movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 - - ; -- Odd part - - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 - - movdqa xmm6,xmm2 ; xmm2=tmp4 - movdqa xmm0,xmm5 ; xmm5=tmp5 - paddw xmm6,xmm3 ; xmm6=z3 - paddw xmm0,xmm1 ; xmm0=z4 - - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - - movdqa xmm7,xmm6 - movdqa xmm4,xmm6 - punpcklwd xmm7,xmm0 - punpckhwd xmm4,xmm0 - movdqa xmm6,xmm7 - movdqa xmm0,xmm4 - pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3L - pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3H - pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4L - pmaddwd xmm0,[GOTOFF(ebx,PW_F117_F078)] ; xmm0=z4H - - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H - - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; - - movdqa xmm7,xmm2 - movdqa xmm4,xmm2 - punpcklwd xmm7,xmm1 - punpckhwd xmm4,xmm1 - movdqa xmm2,xmm7 - movdqa xmm1,xmm4 - pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp4L - pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4H - pmaddwd xmm2,[GOTOFF(ebx,PW_MF089_F060)] ; xmm2=tmp7L - pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp7H - - paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L - paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H - paddd xmm2,xmm6 ; xmm2=data1L - paddd xmm1,xmm0 ; xmm1=data1H - - paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm7,DESCALE_P1 - psrad xmm4,DESCALE_P1 - paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm2,DESCALE_P1 - psrad xmm1,DESCALE_P1 - - packssdw xmm7,xmm4 ; xmm7=data7 - packssdw xmm2,xmm1 ; xmm2=data1 - - movdqa xmm4,xmm5 - movdqa xmm1,xmm5 - punpcklwd xmm4,xmm3 - punpckhwd xmm1,xmm3 - movdqa xmm5,xmm4 - movdqa xmm3,xmm1 - pmaddwd xmm4,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm4=tmp5L - pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5H - pmaddwd xmm5,[GOTOFF(ebx,PW_MF256_F050)] ; xmm5=tmp6L - pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6H - - paddd xmm4,xmm6 ; xmm4=data5L - paddd xmm1,xmm0 ; xmm1=data5H - paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L - paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H - - paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm4,DESCALE_P1 - psrad xmm1,DESCALE_P1 - paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P1)] - paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] - psrad xmm5,DESCALE_P1 - psrad xmm3,DESCALE_P1 - - packssdw xmm4,xmm1 ; xmm4=data5 - packssdw xmm5,xmm3 ; xmm5=data3 - - ; ---- Pass 2: process columns. - -; mov edx, POINTER [data(eax)] ; (DCTELEM *) - - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 - movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 - - ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) - ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) - - movdqa xmm1,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) - punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) - movdqa xmm3,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) - punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) - - movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 - movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 - - ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) - ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) - - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) - - movdqa xmm0,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) - punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) - movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) - punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) - - movdqa xmm4,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) - punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) - punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) - - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) - movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) - - movdqa xmm4,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) - punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) - movdqa xmm0,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) - punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) - - movdqa xmm5,xmm6 ; transpose coefficients(phase 3) - punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm3,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 - - movdqa xmm2,xmm5 - movdqa xmm7,xmm6 - psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 - psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 - paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 - paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 - - movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) - movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - - movdqa xmm5,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 - - movdqa xmm0,xmm5 - movdqa xmm3,xmm4 - paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 - paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 - psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 - psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 - - ; -- Even part - - movdqa xmm1,xmm7 - movdqa xmm6,xmm2 - paddw xmm7,xmm5 ; xmm7=tmp10 - paddw xmm2,xmm4 ; xmm2=tmp11 - psubw xmm1,xmm5 ; xmm1=tmp13 - psubw xmm6,xmm4 ; xmm6=tmp12 - - movdqa xmm5,xmm7 - paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 - psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 - - paddw xmm7,[GOTOFF(ebx,PW_DESCALE_P2X)] - paddw xmm5,[GOTOFF(ebx,PW_DESCALE_P2X)] - psraw xmm7,PASS1_BITS ; xmm7=data0 - psraw xmm5,PASS1_BITS ; xmm5=data4 - - movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm7 - movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm5 - - ; (Original) - ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; - ; - ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - - movdqa xmm4,xmm1 ; xmm1=tmp13 - movdqa xmm2,xmm1 - punpcklwd xmm4,xmm6 ; xmm6=tmp12 - punpckhwd xmm2,xmm6 - movdqa xmm1,xmm4 - movdqa xmm6,xmm2 - pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=data2L - pmaddwd xmm2,[GOTOFF(ebx,PW_F130_F054)] ; xmm2=data2H - pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=data6L - pmaddwd xmm6,[GOTOFF(ebx,PW_F054_MF130)] ; xmm6=data6H - - paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm4,DESCALE_P2 - psrad xmm2,DESCALE_P2 - paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm1,DESCALE_P2 - psrad xmm6,DESCALE_P2 - - packssdw xmm4,xmm2 ; xmm4=data2 - packssdw xmm1,xmm6 ; xmm1=data6 - - movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm1 - - ; -- Odd part - - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - - movdqa xmm2,xmm0 ; xmm0=tmp4 - movdqa xmm6,xmm3 ; xmm3=tmp5 - paddw xmm2,xmm7 ; xmm2=z3 - paddw xmm6,xmm5 ; xmm6=z4 - - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - - movdqa xmm4,xmm2 - movdqa xmm1,xmm2 - punpcklwd xmm4,xmm6 - punpckhwd xmm1,xmm6 - movdqa xmm2,xmm4 - movdqa xmm6,xmm1 - pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3L - pmaddwd xmm1,[GOTOFF(ebx,PW_MF078_F117)] ; xmm1=z3H - pmaddwd xmm2,[GOTOFF(ebx,PW_F117_F078)] ; xmm2=z4L - pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4H - - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H - - ; (Original) - ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; - ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; - ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; - ; - ; (This implementation) - ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; - ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; - ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); - ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; - - movdqa xmm4,xmm0 - movdqa xmm1,xmm0 - punpcklwd xmm4,xmm5 - punpckhwd xmm1,xmm5 - movdqa xmm0,xmm4 - movdqa xmm5,xmm1 - pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4L - pmaddwd xmm1,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm1=tmp4H - pmaddwd xmm0,[GOTOFF(ebx,PW_MF089_F060)] ; xmm0=tmp7L - pmaddwd xmm5,[GOTOFF(ebx,PW_MF089_F060)] ; xmm5=tmp7H - - paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L - paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H - paddd xmm0,xmm2 ; xmm0=data1L - paddd xmm5,xmm6 ; xmm5=data1H - - paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm4,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm0,DESCALE_P2 - psrad xmm5,DESCALE_P2 - - packssdw xmm4,xmm1 ; xmm4=data7 - packssdw xmm0,xmm5 ; xmm0=data1 - - movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm0 - - movdqa xmm1,xmm3 - movdqa xmm5,xmm3 - punpcklwd xmm1,xmm7 - punpckhwd xmm5,xmm7 - movdqa xmm3,xmm1 - movdqa xmm7,xmm5 - pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5L - pmaddwd xmm5,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm5=tmp5H - pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6L - pmaddwd xmm7,[GOTOFF(ebx,PW_MF256_F050)] ; xmm7=tmp6H - - paddd xmm1,xmm2 ; xmm1=data5L - paddd xmm5,xmm6 ; xmm5=data5H - paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L - paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H - - paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm1,DESCALE_P2 - psrad xmm5,DESCALE_P2 - paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P2)] - paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] - psrad xmm3,DESCALE_P2 - psrad xmm7,DESCALE_P2 - - packssdw xmm1,xmm5 ; xmm1=data5 - packssdw xmm3,xmm7 ; xmm3=data3 - - movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm3 - -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; unused - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused + + get_GOT ebx ; get GOT address + + ; ---- Pass 1: process rows. + + mov edx, POINTER [data(eax)] ; (DCTELEM *) + + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)] + movdqa xmm2, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)] + + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)] + + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) + + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + paddw xmm3,xmm1 ; xmm3=tmp10 + paddw xmm6,xmm7 ; xmm6=tmp11 + psubw xmm4,xmm1 ; xmm4=tmp13 + psubw xmm0,xmm7 ; xmm0=tmp12 + + movdqa xmm1,xmm3 + paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 + psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 + + psllw xmm3,PASS1_BITS ; xmm3=data0 + psllw xmm1,PASS1_BITS ; xmm1=data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm7,xmm4 ; xmm4=tmp13 + movdqa xmm6,xmm4 + punpcklwd xmm7,xmm0 ; xmm0=tmp12 + punpckhwd xmm6,xmm0 + movdqa xmm4,xmm7 + movdqa xmm0,xmm6 + pmaddwd xmm7,[GOTOFF(ebx,PW_F130_F054)] ; xmm7=data2L + pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=data2H + pmaddwd xmm4,[GOTOFF(ebx,PW_F054_MF130)] ; xmm4=data6L + pmaddwd xmm0,[GOTOFF(ebx,PW_F054_MF130)] ; xmm0=data6H + + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm7,DESCALE_P1 + psrad xmm6,DESCALE_P1 + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm4,DESCALE_P1 + psrad xmm0,DESCALE_P1 + + packssdw xmm7,xmm6 ; xmm7=data2 + packssdw xmm4,xmm0 ; xmm4=data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 + + ; -- Odd part + + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 + + movdqa xmm6,xmm2 ; xmm2=tmp4 + movdqa xmm0,xmm5 ; xmm5=tmp5 + paddw xmm6,xmm3 ; xmm6=z3 + paddw xmm0,xmm1 ; xmm0=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm7,xmm6 + movdqa xmm4,xmm6 + punpcklwd xmm7,xmm0 + punpckhwd xmm4,xmm0 + movdqa xmm6,xmm7 + movdqa xmm0,xmm4 + pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3H + pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4L + pmaddwd xmm0,[GOTOFF(ebx,PW_F117_F078)] ; xmm0=z4H + + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm7,xmm2 + movdqa xmm4,xmm2 + punpcklwd xmm7,xmm1 + punpckhwd xmm4,xmm1 + movdqa xmm2,xmm7 + movdqa xmm1,xmm4 + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp4L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4H + pmaddwd xmm2,[GOTOFF(ebx,PW_MF089_F060)] ; xmm2=tmp7L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp7H + + paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H + paddd xmm2,xmm6 ; xmm2=data1L + paddd xmm1,xmm0 ; xmm1=data1H + + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm7,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm2,DESCALE_P1 + psrad xmm1,DESCALE_P1 + + packssdw xmm7,xmm4 ; xmm7=data7 + packssdw xmm2,xmm1 ; xmm2=data1 + + movdqa xmm4,xmm5 + movdqa xmm1,xmm5 + punpcklwd xmm4,xmm3 + punpckhwd xmm1,xmm3 + movdqa xmm5,xmm4 + movdqa xmm3,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm4=tmp5L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5H + pmaddwd xmm5,[GOTOFF(ebx,PW_MF256_F050)] ; xmm5=tmp6L + pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6H + + paddd xmm4,xmm6 ; xmm4=data5L + paddd xmm1,xmm0 ; xmm1=data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm4,DESCALE_P1 + psrad xmm1,DESCALE_P1 + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P1)] + paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] + psrad xmm5,DESCALE_P1 + psrad xmm3,DESCALE_P1 + + packssdw xmm4,xmm1 ; xmm4=data5 + packssdw xmm5,xmm3 ; xmm5=data3 + + ; ---- Pass 2: process columns. + +; mov edx, POINTER [data(eax)] ; (DCTELEM *) + + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 + + ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) + ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) + + movdqa xmm1,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) + punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) + movdqa xmm3,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) + punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) + + movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 + + ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) + ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm0,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) + + movdqa xmm4,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) + punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) + punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) + + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) + + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) + punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) + punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) + + movdqa xmm5,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm2,xmm5 + movdqa xmm7,xmm6 + psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 + psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 + paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 + paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movdqa xmm5,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm0,xmm5 + movdqa xmm3,xmm4 + paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 + paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 + psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 + psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 + + ; -- Even part + + movdqa xmm1,xmm7 + movdqa xmm6,xmm2 + paddw xmm7,xmm5 ; xmm7=tmp10 + paddw xmm2,xmm4 ; xmm2=tmp11 + psubw xmm1,xmm5 ; xmm1=tmp13 + psubw xmm6,xmm4 ; xmm6=tmp12 + + movdqa xmm5,xmm7 + paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 + psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 + + paddw xmm7,[GOTOFF(ebx,PW_DESCALE_P2X)] + paddw xmm5,[GOTOFF(ebx,PW_DESCALE_P2X)] + psraw xmm7,PASS1_BITS ; xmm7=data0 + psraw xmm5,PASS1_BITS ; xmm5=data4 + + movdqa XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_DCTELEM)], xmm5 + + ; (Original) + ; z1 = (tmp12 + tmp13) * 0.541196100; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; + ; + ; (This implementation) + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + + movdqa xmm4,xmm1 ; xmm1=tmp13 + movdqa xmm2,xmm1 + punpcklwd xmm4,xmm6 ; xmm6=tmp12 + punpckhwd xmm2,xmm6 + movdqa xmm1,xmm4 + movdqa xmm6,xmm2 + pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=data2L + pmaddwd xmm2,[GOTOFF(ebx,PW_F130_F054)] ; xmm2=data2H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=data6L + pmaddwd xmm6,[GOTOFF(ebx,PW_F054_MF130)] ; xmm6=data6H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm4,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm1,DESCALE_P2 + psrad xmm6,DESCALE_P2 + + packssdw xmm4,xmm2 ; xmm4=data2 + packssdw xmm1,xmm6 ; xmm1=data6 + + movdqa XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_DCTELEM)], xmm1 + + ; -- Odd part + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + movdqa xmm2,xmm0 ; xmm0=tmp4 + movdqa xmm6,xmm3 ; xmm3=tmp5 + paddw xmm2,xmm7 ; xmm2=z3 + paddw xmm6,xmm5 ; xmm6=z4 + + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + + movdqa xmm4,xmm2 + movdqa xmm1,xmm2 + punpcklwd xmm4,xmm6 + punpckhwd xmm1,xmm6 + movdqa xmm2,xmm4 + movdqa xmm6,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF078_F117)] ; xmm4=z3L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF078_F117)] ; xmm1=z3H + pmaddwd xmm2,[GOTOFF(ebx,PW_F117_F078)] ; xmm2=z4L + pmaddwd xmm6,[GOTOFF(ebx,PW_F117_F078)] ; xmm6=z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H + + ; (Original) + ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; + ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; + ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; + ; (This implementation) + ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; + ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; + ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); + ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; + + movdqa xmm4,xmm0 + movdqa xmm1,xmm0 + punpcklwd xmm4,xmm5 + punpckhwd xmm1,xmm5 + movdqa xmm0,xmm4 + movdqa xmm5,xmm1 + pmaddwd xmm4,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm4=tmp4L + pmaddwd xmm1,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm1=tmp4H + pmaddwd xmm0,[GOTOFF(ebx,PW_MF089_F060)] ; xmm0=tmp7L + pmaddwd xmm5,[GOTOFF(ebx,PW_MF089_F060)] ; xmm5=tmp7H + + paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H + paddd xmm0,xmm2 ; xmm0=data1L + paddd xmm5,xmm6 ; xmm5=data1H + + paddd xmm4,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm4,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm0,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm0,DESCALE_P2 + psrad xmm5,DESCALE_P2 + + packssdw xmm4,xmm1 ; xmm4=data7 + packssdw xmm0,xmm5 ; xmm0=data1 + + movdqa XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1,xmm3 + movdqa xmm5,xmm3 + punpcklwd xmm1,xmm7 + punpckhwd xmm5,xmm7 + movdqa xmm3,xmm1 + movdqa xmm7,xmm5 + pmaddwd xmm1,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm1=tmp5L + pmaddwd xmm5,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm5=tmp5H + pmaddwd xmm3,[GOTOFF(ebx,PW_MF256_F050)] ; xmm3=tmp6L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF256_F050)] ; xmm7=tmp6H + + paddd xmm1,xmm2 ; xmm1=data5L + paddd xmm5,xmm6 ; xmm5=data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H + + paddd xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm1,DESCALE_P2 + psrad xmm5,DESCALE_P2 + paddd xmm3,[GOTOFF(ebx,PD_DESCALE_P2)] + paddd xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] + psrad xmm3,DESCALE_P2 + psrad xmm7,DESCALE_P2 + + packssdw xmm1,xmm5 ; xmm1=data5 + packssdw xmm3,xmm7 ; xmm3=data3 + + movdqa XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_DCTELEM)], xmm3 + +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfsseflt-64.asm b/simd/jfsseflt-64.asm index 07245d2d..be2f5777 100644 --- a/simd/jfsseflt-64.asm +++ b/simd/jfsseflt-64.asm @@ -26,32 +26,32 @@ ; -------------------------------------------------------------------------- -%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) - shufps %1,%2,0x44 +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 %endmacro -%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) - shufps %1,%2,0xEE +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE %endmacro ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_float_sse) + alignz 16 + global EXTN(jconst_fdct_float_sse) EXTN(jconst_fdct_float_sse): -PD_0_382 times 4 dd 0.382683432365089771728460 -PD_0_707 times 4 dd 0.707106781186547524400844 -PD_0_541 times 4 dd 0.541196100146196984399723 -PD_1_306 times 4 dd 1.306562964876376527856643 +PD_0_382 times 4 dd 0.382683432365089771728460 +PD_0_707 times 4 dd 0.707106781186547524400844 +PD_0_541 times 4 dd 0.541196100146196984399723 +PD_1_306 times 4 dd 1.306562964876376527856643 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform the forward DCT on one block of samples. ; @@ -61,298 +61,298 @@ PD_1_306 times 4 dd 1.306562964876376527856643 ; r10 = FAST_FLOAT * data -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_float_sse) + align 16 + global EXTN(jsimd_fdct_float_sse) EXTN(jsimd_fdct_float_sse): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov rdx, r10 ; (FAST_FLOAT *) - mov rcx, DCTSIZE/4 + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE/4 .rowloop: - movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)] - ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) - ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) + ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) + ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) - movaps xmm4,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) - unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) - movaps xmm5,xmm2 ; transpose coefficients(phase 1) - unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) - unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) + unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) + unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) - movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)] - ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) - ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) + ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) + ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) - movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) - movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) - movaps xmm4,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) - unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) - movaps xmm2,xmm1 ; transpose coefficients(phase 1) - unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) - unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) + unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) - movaps xmm7,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 - unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 - movaps xmm3,xmm2 ; transpose coefficients(phase 2) - unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 - unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 - movaps xmm0,xmm7 - movaps xmm5,xmm6 - subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 - subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 - addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 - addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 - movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) - movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) - movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 - movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - movaps xmm7,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 - unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 - movaps xmm6,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 - unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 - movaps xmm2,xmm7 - movaps xmm3,xmm4 - addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 - addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 - subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 - subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movaps xmm1,xmm5 - movaps xmm6,xmm0 - subps xmm5,xmm7 ; xmm5=tmp13 - subps xmm0,xmm4 ; xmm0=tmp12 - addps xmm1,xmm7 ; xmm1=tmp10 - addps xmm6,xmm4 ; xmm6=tmp11 + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 - addps xmm0,xmm5 - mulps xmm0,[rel PD_0_707] ; xmm0=z1 + addps xmm0,xmm5 + mulps xmm0,[rel PD_0_707] ; xmm0=z1 - movaps xmm7,xmm1 - movaps xmm4,xmm5 - subps xmm1,xmm6 ; xmm1=data4 - subps xmm5,xmm0 ; xmm5=data6 - addps xmm7,xmm6 ; xmm7=data0 - addps xmm4,xmm0 ; xmm4=data2 + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 - movaps XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(0,1,rdx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 - ; -- Odd part + ; -- Odd part - movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 - movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 - addps xmm2,xmm3 ; xmm2=tmp10 - addps xmm3,xmm6 ; xmm3=tmp11 - addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[rel PD_0_707] ; xmm3=z3 + mulps xmm3,[rel PD_0_707] ; xmm3=z3 - movaps xmm1,xmm2 ; xmm1=tmp10 - subps xmm2,xmm6 - mulps xmm2,[rel PD_0_382] ; xmm2=z5 - mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) - addps xmm1,xmm2 ; xmm1=z2 - addps xmm6,xmm2 ; xmm6=z4 + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[rel PD_0_382] ; xmm2=z5 + mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 - movaps xmm5,xmm0 - subps xmm0,xmm3 ; xmm0=z13 - addps xmm5,xmm3 ; xmm5=z11 + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 - movaps xmm7,xmm0 - movaps xmm4,xmm5 - subps xmm0,xmm1 ; xmm0=data3 - subps xmm5,xmm6 ; xmm5=data7 - addps xmm7,xmm1 ; xmm7=data5 - addps xmm4,xmm6 ; xmm4=data1 + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 - movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(3,1,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 - add rdx, 4*DCTSIZE*SIZEOF_FAST_FLOAT - dec rcx - jnz near .rowloop + add rdx, 4*DCTSIZE*SIZEOF_FAST_FLOAT + dec rcx + jnz near .rowloop - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - mov rdx, r10 ; (FAST_FLOAT *) - mov rcx, DCTSIZE/4 + mov rdx, r10 ; (FAST_FLOAT *) + mov rcx, DCTSIZE/4 .columnloop: - movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)] - ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) - ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) + ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) + ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) - movaps xmm4,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) - unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) - movaps xmm5,xmm2 ; transpose coefficients(phase 1) - unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) - unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) + unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) + unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) - movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)] - ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) - ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) + ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) + ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) - movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) - movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) - movaps xmm4,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) - unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) - movaps xmm2,xmm1 ; transpose coefficients(phase 1) - unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) - unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) + unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) + unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) - movaps xmm7,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 - unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 - movaps xmm3,xmm2 ; transpose coefficients(phase 2) - unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 - unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 - movaps xmm0,xmm7 - movaps xmm5,xmm6 - subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 - subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 - addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 - addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 - movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) - movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) - movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 - movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - movaps xmm7,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 - unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 - movaps xmm6,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 - unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 - movaps xmm2,xmm7 - movaps xmm3,xmm4 - addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 - addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 - subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 - subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movaps xmm1,xmm5 - movaps xmm6,xmm0 - subps xmm5,xmm7 ; xmm5=tmp13 - subps xmm0,xmm4 ; xmm0=tmp12 - addps xmm1,xmm7 ; xmm1=tmp10 - addps xmm6,xmm4 ; xmm6=tmp11 + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 - addps xmm0,xmm5 - mulps xmm0,[rel PD_0_707] ; xmm0=z1 + addps xmm0,xmm5 + mulps xmm0,[rel PD_0_707] ; xmm0=z1 - movaps xmm7,xmm1 - movaps xmm4,xmm5 - subps xmm1,xmm6 ; xmm1=data4 - subps xmm5,xmm0 ; xmm5=data6 - addps xmm7,xmm6 ; xmm7=data0 - addps xmm4,xmm0 ; xmm4=data2 + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 - movaps XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 - ; -- Odd part + ; -- Odd part - movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 - movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 - addps xmm2,xmm3 ; xmm2=tmp10 - addps xmm3,xmm6 ; xmm3=tmp11 - addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[rel PD_0_707] ; xmm3=z3 + mulps xmm3,[rel PD_0_707] ; xmm3=z3 - movaps xmm1,xmm2 ; xmm1=tmp10 - subps xmm2,xmm6 - mulps xmm2,[rel PD_0_382] ; xmm2=z5 - mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) - addps xmm1,xmm2 ; xmm1=z2 - addps xmm6,xmm2 ; xmm6=z4 + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[rel PD_0_382] ; xmm2=z5 + mulps xmm1,[rel PD_0_541] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[rel PD_1_306] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 - movaps xmm5,xmm0 - subps xmm0,xmm3 ; xmm0=z13 - addps xmm5,xmm3 ; xmm5=z11 + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 - movaps xmm7,xmm0 - movaps xmm4,xmm5 - subps xmm0,xmm1 ; xmm0=data3 - subps xmm5,xmm6 ; xmm5=data7 - addps xmm7,xmm1 ; xmm7=data5 - addps xmm4,xmm6 ; xmm4=data1 + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 - movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FAST_FLOAT)], xmm4 - add rdx, byte 4*SIZEOF_FAST_FLOAT - dec rcx - jnz near .columnloop + add rdx, byte 4*SIZEOF_FAST_FLOAT + dec rcx + jnz near .columnloop - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jfsseflt.asm b/simd/jfsseflt.asm index bc54cccd..5ece3f46 100644 --- a/simd/jfsseflt.asm +++ b/simd/jfsseflt.asm @@ -25,32 +25,32 @@ ; -------------------------------------------------------------------------- -%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) - shufps %1,%2,0x44 +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 %endmacro -%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) - shufps %1,%2,0xEE +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE %endmacro ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_fdct_float_sse) + alignz 16 + global EXTN(jconst_fdct_float_sse) EXTN(jconst_fdct_float_sse): -PD_0_382 times 4 dd 0.382683432365089771728460 -PD_0_707 times 4 dd 0.707106781186547524400844 -PD_0_541 times 4 dd 0.541196100146196984399723 -PD_1_306 times 4 dd 1.306562964876376527856643 +PD_0_382 times 4 dd 0.382683432365089771728460 +PD_0_707 times 4 dd 0.707106781186547524400844 +PD_0_541 times 4 dd 0.541196100146196984399723 +PD_1_306 times 4 dd 1.306562964876376527856643 - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform the forward DCT on one block of samples. ; @@ -58,313 +58,313 @@ PD_1_306 times 4 dd 1.306562964876376527856643 ; jsimd_fdct_float_sse (FAST_FLOAT * data) ; -%define data(b) (b)+8 ; FAST_FLOAT * data +%define data(b) (b)+8 ; FAST_FLOAT * data -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_fdct_float_sse) + align 16 + global EXTN(jsimd_fdct_float_sse) EXTN(jsimd_fdct_float_sse): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved -; push esi ; unused -; push edi ; unused + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused +; push edi ; unused - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process rows. + ; ---- Pass 1: process rows. - mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/4 + alignx 16,7 .rowloop: - movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)] - ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) - ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) + ; xmm0=(20 21 22 23), xmm2=(24 25 26 27) + ; xmm1=(30 31 32 33), xmm3=(34 35 36 37) - movaps xmm4,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) - unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) - movaps xmm5,xmm2 ; transpose coefficients(phase 1) - unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) - unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(20 30 21 31) + unpckhps xmm4,xmm1 ; xmm4=(22 32 23 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(24 34 25 35) + unpckhps xmm5,xmm3 ; xmm5=(26 36 27 37) - movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)] - ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) - ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) + ; xmm6=(00 01 02 03), xmm1=(04 05 06 07) + ; xmm7=(10 11 12 13), xmm3=(14 15 16 17) - movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) - movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 32 23 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(24 34 25 35) - movaps xmm4,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) - unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) - movaps xmm2,xmm1 ; transpose coefficients(phase 1) - unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) - unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm4,xmm7 ; xmm4=(02 12 03 13) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(04 14 05 15) + unpckhps xmm2,xmm3 ; xmm2=(06 16 07 17) - movaps xmm7,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 - unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 - movaps xmm3,xmm2 ; transpose coefficients(phase 2) - unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 - unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 10 20 30)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(01 11 21 31)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(06 16 26 36)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(07 17 27 37)=data7 - movaps xmm0,xmm7 - movaps xmm5,xmm6 - subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 - subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 - addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 - addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 - movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) - movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) - movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 - movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 32 23 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(24 34 25 35) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - movaps xmm7,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 - unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 - movaps xmm6,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 - unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(02 12 22 32)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(03 13 23 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(04 14 24 34)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(05 15 25 35)=data5 - movaps xmm2,xmm7 - movaps xmm3,xmm4 - addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 - addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 - subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 - subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movaps xmm1,xmm5 - movaps xmm6,xmm0 - subps xmm5,xmm7 ; xmm5=tmp13 - subps xmm0,xmm4 ; xmm0=tmp12 - addps xmm1,xmm7 ; xmm1=tmp10 - addps xmm6,xmm4 ; xmm6=tmp11 + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 - addps xmm0,xmm5 - mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 + addps xmm0,xmm5 + mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 - movaps xmm7,xmm1 - movaps xmm4,xmm5 - subps xmm1,xmm6 ; xmm1=data4 - subps xmm5,xmm0 ; xmm5=data6 - addps xmm7,xmm6 ; xmm7=data0 - addps xmm4,xmm0 ; xmm4=data2 + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 - movaps XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,1,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 - ; -- Odd part + ; -- Odd part - movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 - movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 - addps xmm2,xmm3 ; xmm2=tmp10 - addps xmm3,xmm6 ; xmm3=tmp11 - addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 + mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 - movaps xmm1,xmm2 ; xmm1=tmp10 - subps xmm2,xmm6 - mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 - mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) - addps xmm1,xmm2 ; xmm1=z2 - addps xmm6,xmm2 ; xmm6=z4 + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 + mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 - movaps xmm5,xmm0 - subps xmm0,xmm3 ; xmm0=z13 - addps xmm5,xmm3 ; xmm5=z11 + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 - movaps xmm7,xmm0 - movaps xmm4,xmm5 - subps xmm0,xmm1 ; xmm0=data3 - subps xmm5,xmm6 ; xmm5=data7 - addps xmm7,xmm1 ; xmm7=data5 - addps xmm4,xmm6 ; xmm4=data1 + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 - movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(3,1,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 - add edx, 4*DCTSIZE*SIZEOF_FAST_FLOAT - dec ecx - jnz near .rowloop + add edx, 4*DCTSIZE*SIZEOF_FAST_FLOAT + dec ecx + jnz near .rowloop - ; ---- Pass 2: process columns. + ; ---- Pass 2: process columns. - mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) - mov ecx, DCTSIZE/4 - alignx 16,7 + mov edx, POINTER [data(eax)] ; (FAST_FLOAT *) + mov ecx, DCTSIZE/4 + alignx 16,7 .columnloop: - movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)] - ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) - ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) + ; xmm0=(02 12 22 32), xmm2=(42 52 62 72) + ; xmm1=(03 13 23 33), xmm3=(43 53 63 73) - movaps xmm4,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) - unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) - movaps xmm5,xmm2 ; transpose coefficients(phase 1) - unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) - unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) + movaps xmm4,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm1 ; xmm0=(02 03 12 13) + unpckhps xmm4,xmm1 ; xmm4=(22 23 32 33) + movaps xmm5,xmm2 ; transpose coefficients(phase 1) + unpcklps xmm2,xmm3 ; xmm2=(42 43 52 53) + unpckhps xmm5,xmm3 ; xmm5=(62 63 72 73) - movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm7, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)] - ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) - ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) + ; xmm6=(00 10 20 30), xmm1=(40 50 60 70) + ; xmm7=(01 11 21 31), xmm3=(41 51 61 71) - movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) - movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm4 ; wk(0)=(22 23 32 33) + movaps XMMWORD [wk(1)], xmm2 ; wk(1)=(42 43 52 53) - movaps xmm4,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) - unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) - movaps xmm2,xmm1 ; transpose coefficients(phase 1) - unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) - unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) + movaps xmm4,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 01 10 11) + unpckhps xmm4,xmm7 ; xmm4=(20 21 30 31) + movaps xmm2,xmm1 ; transpose coefficients(phase 1) + unpcklps xmm1,xmm3 ; xmm1=(40 41 50 51) + unpckhps xmm2,xmm3 ; xmm2=(60 61 70 71) - movaps xmm7,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 - unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 - movaps xmm3,xmm2 ; transpose coefficients(phase 2) - unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 - unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 + movaps xmm7,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm0 ; xmm6=(00 01 02 03)=data0 + unpckhps2 xmm7,xmm0 ; xmm7=(10 11 12 13)=data1 + movaps xmm3,xmm2 ; transpose coefficients(phase 2) + unpcklps2 xmm2,xmm5 ; xmm2=(60 61 62 63)=data6 + unpckhps2 xmm3,xmm5 ; xmm3=(70 71 72 73)=data7 - movaps xmm0,xmm7 - movaps xmm5,xmm6 - subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 - subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 - addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 - addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 + movaps xmm0,xmm7 + movaps xmm5,xmm6 + subps xmm7,xmm2 ; xmm7=data1-data6=tmp6 + subps xmm6,xmm3 ; xmm6=data0-data7=tmp7 + addps xmm0,xmm2 ; xmm0=data1+data6=tmp1 + addps xmm5,xmm3 ; xmm5=data0+data7=tmp0 - movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) - movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) - movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 - movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + movaps xmm2, XMMWORD [wk(0)] ; xmm2=(22 23 32 33) + movaps xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53) + movaps XMMWORD [wk(0)], xmm7 ; wk(0)=tmp6 + movaps XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - movaps xmm7,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 - unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 - movaps xmm6,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 - unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 + movaps xmm7,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(20 21 22 23)=data2 + unpckhps2 xmm7,xmm2 ; xmm7=(30 31 32 33)=data3 + movaps xmm6,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm3 ; xmm1=(40 41 42 43)=data4 + unpckhps2 xmm6,xmm3 ; xmm6=(50 51 52 53)=data5 - movaps xmm2,xmm7 - movaps xmm3,xmm4 - addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 - addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 - subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 - subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 + movaps xmm2,xmm7 + movaps xmm3,xmm4 + addps xmm7,xmm1 ; xmm7=data3+data4=tmp3 + addps xmm4,xmm6 ; xmm4=data2+data5=tmp2 + subps xmm2,xmm1 ; xmm2=data3-data4=tmp4 + subps xmm3,xmm6 ; xmm3=data2-data5=tmp5 - ; -- Even part + ; -- Even part - movaps xmm1,xmm5 - movaps xmm6,xmm0 - subps xmm5,xmm7 ; xmm5=tmp13 - subps xmm0,xmm4 ; xmm0=tmp12 - addps xmm1,xmm7 ; xmm1=tmp10 - addps xmm6,xmm4 ; xmm6=tmp11 + movaps xmm1,xmm5 + movaps xmm6,xmm0 + subps xmm5,xmm7 ; xmm5=tmp13 + subps xmm0,xmm4 ; xmm0=tmp12 + addps xmm1,xmm7 ; xmm1=tmp10 + addps xmm6,xmm4 ; xmm6=tmp11 - addps xmm0,xmm5 - mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 + addps xmm0,xmm5 + mulps xmm0,[GOTOFF(ebx,PD_0_707)] ; xmm0=z1 - movaps xmm7,xmm1 - movaps xmm4,xmm5 - subps xmm1,xmm6 ; xmm1=data4 - subps xmm5,xmm0 ; xmm5=data6 - addps xmm7,xmm6 ; xmm7=data0 - addps xmm4,xmm0 ; xmm4=data2 + movaps xmm7,xmm1 + movaps xmm4,xmm5 + subps xmm1,xmm6 ; xmm1=data4 + subps xmm5,xmm0 ; xmm5=data6 + addps xmm7,xmm6 ; xmm7=data0 + addps xmm4,xmm0 ; xmm4=data2 - movaps XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FAST_FLOAT)], xmm4 - ; -- Odd part + ; -- Odd part - movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 - movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 + movaps xmm6, XMMWORD [wk(0)] ; xmm6=tmp6 + movaps xmm0, XMMWORD [wk(1)] ; xmm0=tmp7 - addps xmm2,xmm3 ; xmm2=tmp10 - addps xmm3,xmm6 ; xmm3=tmp11 - addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 + addps xmm2,xmm3 ; xmm2=tmp10 + addps xmm3,xmm6 ; xmm3=tmp11 + addps xmm6,xmm0 ; xmm6=tmp12, xmm0=tmp7 - mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 + mulps xmm3,[GOTOFF(ebx,PD_0_707)] ; xmm3=z3 - movaps xmm1,xmm2 ; xmm1=tmp10 - subps xmm2,xmm6 - mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 - mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) - mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) - addps xmm1,xmm2 ; xmm1=z2 - addps xmm6,xmm2 ; xmm6=z4 + movaps xmm1,xmm2 ; xmm1=tmp10 + subps xmm2,xmm6 + mulps xmm2,[GOTOFF(ebx,PD_0_382)] ; xmm2=z5 + mulps xmm1,[GOTOFF(ebx,PD_0_541)] ; xmm1=MULTIPLY(tmp10,FIX_0_541196) + mulps xmm6,[GOTOFF(ebx,PD_1_306)] ; xmm6=MULTIPLY(tmp12,FIX_1_306562) + addps xmm1,xmm2 ; xmm1=z2 + addps xmm6,xmm2 ; xmm6=z4 - movaps xmm5,xmm0 - subps xmm0,xmm3 ; xmm0=z13 - addps xmm5,xmm3 ; xmm5=z11 + movaps xmm5,xmm0 + subps xmm0,xmm3 ; xmm0=z13 + addps xmm5,xmm3 ; xmm5=z11 - movaps xmm7,xmm0 - movaps xmm4,xmm5 - subps xmm0,xmm1 ; xmm0=data3 - subps xmm5,xmm6 ; xmm5=data7 - addps xmm7,xmm1 ; xmm7=data5 - addps xmm4,xmm6 ; xmm4=data1 + movaps xmm7,xmm0 + movaps xmm4,xmm5 + subps xmm0,xmm1 ; xmm0=data3 + subps xmm5,xmm6 ; xmm5=data7 + addps xmm7,xmm1 ; xmm7=data5 + addps xmm4,xmm6 ; xmm4=data1 - movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], xmm7 - movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FAST_FLOAT)], xmm7 + movaps XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)], xmm4 - add edx, byte 4*SIZEOF_FAST_FLOAT - dec ecx - jnz near .columnloop + add edx, byte 4*SIZEOF_FAST_FLOAT + dec ecx + jnz near .columnloop -; pop edi ; unused -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret +; pop edi ; unused +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/ji3dnflt.asm b/simd/ji3dnflt.asm index dc2076f4..76303fa4 100644 --- a/simd/ji3dnflt.asm +++ b/simd/ji3dnflt.asm @@ -24,25 +24,25 @@ %include "jdct.inc" ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_float_3dnow) + alignz 16 + global EXTN(jconst_idct_float_3dnow) EXTN(jconst_idct_float_3dnow): -PD_1_414 times 2 dd 1.414213562373095048801689 -PD_1_847 times 2 dd 1.847759065022573512256366 -PD_1_082 times 2 dd 1.082392200292393968799446 -PD_2_613 times 2 dd 2.613125929752753055713286 -PD_RNDINT_MAGIC times 2 dd 100663296.0 ; (float)(0x00C00000 << 3) -PB_CENTERJSAMP times 8 db CENTERJSAMPLE +PD_1_414 times 2 dd 1.414213562373095048801689 +PD_1_847 times 2 dd 1.847759065022573512256366 +PD_1_082 times 2 dd 1.082392200292393968799446 +PD_2_613 times 2 dd 2.613125929752753055713286 +PD_RNDINT_MAGIC times 2 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -51,402 +51,402 @@ PB_CENTERJSAMP times 8 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT - ; FAST_FLOAT workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_float_3dnow) + align 16 + global EXTN(jsimd_idct_float_3dnow) EXTN(jsimd_idct_float_3dnow): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; FAST_FLOAT * wsptr - mov ecx, DCTSIZE/2 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/2 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_FLOAT_3DNOW - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT - pushpic ebx ; save GOT address - mov ebx, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] - mov eax, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] - or ebx, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] - or ebx, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] - or eax,ebx - poppic ebx ; restore GOT address - jnz short .columnDCT + pushpic ebx ; save GOT address + mov ebx, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] + mov eax, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] + or ebx, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] + or ebx, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] + or eax,ebx + poppic ebx ; restore GOT address + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] + movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] - punpcklwd mm0,mm0 - psrad mm0,(DWORD_BIT-WORD_BIT) - pi2fd mm0,mm0 + punpcklwd mm0,mm0 + psrad mm0,(DWORD_BIT-WORD_BIT) + pi2fd mm0,mm0 - pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movq mm1,mm0 - punpckldq mm0,mm0 - punpckhdq mm1,mm1 + movq mm1,mm0 + punpckldq mm0,mm0 + punpckhdq mm1,mm1 - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm1 - movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm1 - movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 - jmp near .nextcolumn - alignx 16,7 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm1 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] - movd mm1, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - movd mm2, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] - movd mm3, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] + movd mm0, DWORD [DWBLOCK(0,0,esi,SIZEOF_JCOEF)] + movd mm1, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + movd mm2, DWORD [DWBLOCK(4,0,esi,SIZEOF_JCOEF)] + movd mm3, DWORD [DWBLOCK(6,0,esi,SIZEOF_JCOEF)] - punpcklwd mm0,mm0 - punpcklwd mm1,mm1 - psrad mm0,(DWORD_BIT-WORD_BIT) - psrad mm1,(DWORD_BIT-WORD_BIT) - pi2fd mm0,mm0 - pi2fd mm1,mm1 + punpcklwd mm0,mm0 + punpcklwd mm1,mm1 + psrad mm0,(DWORD_BIT-WORD_BIT) + psrad mm1,(DWORD_BIT-WORD_BIT) + pi2fd mm0,mm0 + pi2fd mm1,mm1 - pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - pfmul mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - punpcklwd mm2,mm2 - punpcklwd mm3,mm3 - psrad mm2,(DWORD_BIT-WORD_BIT) - psrad mm3,(DWORD_BIT-WORD_BIT) - pi2fd mm2,mm2 - pi2fd mm3,mm3 + punpcklwd mm2,mm2 + punpcklwd mm3,mm3 + psrad mm2,(DWORD_BIT-WORD_BIT) + psrad mm3,(DWORD_BIT-WORD_BIT) + pi2fd mm2,mm2 + pi2fd mm3,mm3 - pfmul mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - pfmul mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movq mm4,mm0 - movq mm5,mm1 - pfsub mm0,mm2 ; mm0=tmp11 - pfsub mm1,mm3 - pfadd mm4,mm2 ; mm4=tmp10 - pfadd mm5,mm3 ; mm5=tmp13 + movq mm4,mm0 + movq mm5,mm1 + pfsub mm0,mm2 ; mm0=tmp11 + pfsub mm1,mm3 + pfadd mm4,mm2 ; mm4=tmp10 + pfadd mm5,mm3 ; mm5=tmp13 - pfmul mm1,[GOTOFF(ebx,PD_1_414)] - pfsub mm1,mm5 ; mm1=tmp12 + pfmul mm1,[GOTOFF(ebx,PD_1_414)] + pfsub mm1,mm5 ; mm1=tmp12 - movq mm6,mm4 - movq mm7,mm0 - pfsub mm4,mm5 ; mm4=tmp3 - pfsub mm0,mm1 ; mm0=tmp2 - pfadd mm6,mm5 ; mm6=tmp0 - pfadd mm7,mm1 ; mm7=tmp1 + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm5 ; mm4=tmp3 + pfsub mm0,mm1 ; mm0=tmp2 + pfadd mm6,mm5 ; mm6=tmp0 + pfadd mm7,mm1 ; mm7=tmp1 - movq MMWORD [wk(1)], mm4 ; tmp3 - movq MMWORD [wk(0)], mm0 ; tmp2 + movq MMWORD [wk(1)], mm4 ; tmp3 + movq MMWORD [wk(0)], mm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movd mm2, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - movd mm3, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] - movd mm5, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] - movd mm1, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] + movd mm2, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + movd mm3, DWORD [DWBLOCK(3,0,esi,SIZEOF_JCOEF)] + movd mm5, DWORD [DWBLOCK(5,0,esi,SIZEOF_JCOEF)] + movd mm1, DWORD [DWBLOCK(7,0,esi,SIZEOF_JCOEF)] - punpcklwd mm2,mm2 - punpcklwd mm3,mm3 - psrad mm2,(DWORD_BIT-WORD_BIT) - psrad mm3,(DWORD_BIT-WORD_BIT) - pi2fd mm2,mm2 - pi2fd mm3,mm3 + punpcklwd mm2,mm2 + punpcklwd mm3,mm3 + psrad mm2,(DWORD_BIT-WORD_BIT) + psrad mm3,(DWORD_BIT-WORD_BIT) + pi2fd mm2,mm2 + pi2fd mm3,mm3 - pfmul mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - pfmul mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - punpcklwd mm5,mm5 - punpcklwd mm1,mm1 - psrad mm5,(DWORD_BIT-WORD_BIT) - psrad mm1,(DWORD_BIT-WORD_BIT) - pi2fd mm5,mm5 - pi2fd mm1,mm1 + punpcklwd mm5,mm5 + punpcklwd mm1,mm1 + psrad mm5,(DWORD_BIT-WORD_BIT) + psrad mm1,(DWORD_BIT-WORD_BIT) + pi2fd mm5,mm5 + pi2fd mm1,mm1 - pfmul mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - pfmul mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + pfmul mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movq mm4,mm2 - movq mm0,mm5 - pfadd mm2,mm1 ; mm2=z11 - pfadd mm5,mm3 ; mm5=z13 - pfsub mm4,mm1 ; mm4=z12 - pfsub mm0,mm3 ; mm0=z10 + movq mm4,mm2 + movq mm0,mm5 + pfadd mm2,mm1 ; mm2=z11 + pfadd mm5,mm3 ; mm5=z13 + pfsub mm4,mm1 ; mm4=z12 + pfsub mm0,mm3 ; mm0=z10 - movq mm1,mm2 - pfsub mm2,mm5 - pfadd mm1,mm5 ; mm1=tmp7 + movq mm1,mm2 + pfsub mm2,mm5 + pfadd mm1,mm5 ; mm1=tmp7 - pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 + pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 - movq mm3,mm0 - pfadd mm0,mm4 - pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 - pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) - pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) - pfsubr mm3,mm0 ; mm3=tmp12 - pfsub mm4,mm0 ; mm4=tmp10 + movq mm3,mm0 + pfadd mm0,mm4 + pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 + pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) + pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) + pfsubr mm3,mm0 ; mm3=tmp12 + pfsub mm4,mm0 ; mm4=tmp10 - ; -- Final output stage + ; -- Final output stage - pfsub mm3,mm1 ; mm3=tmp6 - movq mm5,mm6 - movq mm0,mm7 - pfadd mm6,mm1 ; mm6=data0=(00 01) - pfadd mm7,mm3 ; mm7=data1=(10 11) - pfsub mm5,mm1 ; mm5=data7=(70 71) - pfsub mm0,mm3 ; mm0=data6=(60 61) - pfsub mm2,mm3 ; mm2=tmp5 + pfsub mm3,mm1 ; mm3=tmp6 + movq mm5,mm6 + movq mm0,mm7 + pfadd mm6,mm1 ; mm6=data0=(00 01) + pfadd mm7,mm3 ; mm7=data1=(10 11) + pfsub mm5,mm1 ; mm5=data7=(70 71) + pfsub mm0,mm3 ; mm0=data6=(60 61) + pfsub mm2,mm3 ; mm2=tmp5 - movq mm1,mm6 ; transpose coefficients - punpckldq mm6,mm7 ; mm6=(00 10) - punpckhdq mm1,mm7 ; mm1=(01 11) - movq mm3,mm0 ; transpose coefficients - punpckldq mm0,mm5 ; mm0=(60 70) - punpckhdq mm3,mm5 ; mm3=(61 71) + movq mm1,mm6 ; transpose coefficients + punpckldq mm6,mm7 ; mm6=(00 10) + punpckhdq mm1,mm7 ; mm1=(01 11) + movq mm3,mm0 ; transpose coefficients + punpckldq mm0,mm5 ; mm0=(60 70) + punpckhdq mm3,mm5 ; mm3=(61 71) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm6 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 - movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm3 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], mm6 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], mm1 + movq MMWORD [MMBLOCK(0,3,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(1,3,edi,SIZEOF_FAST_FLOAT)], mm3 - movq mm7, MMWORD [wk(0)] ; mm7=tmp2 - movq mm5, MMWORD [wk(1)] ; mm5=tmp3 + movq mm7, MMWORD [wk(0)] ; mm7=tmp2 + movq mm5, MMWORD [wk(1)] ; mm5=tmp3 - pfadd mm4,mm2 ; mm4=tmp4 - movq mm6,mm7 - movq mm1,mm5 - pfadd mm7,mm2 ; mm7=data2=(20 21) - pfadd mm5,mm4 ; mm5=data4=(40 41) - pfsub mm6,mm2 ; mm6=data5=(50 51) - pfsub mm1,mm4 ; mm1=data3=(30 31) + pfadd mm4,mm2 ; mm4=tmp4 + movq mm6,mm7 + movq mm1,mm5 + pfadd mm7,mm2 ; mm7=data2=(20 21) + pfadd mm5,mm4 ; mm5=data4=(40 41) + pfsub mm6,mm2 ; mm6=data5=(50 51) + pfsub mm1,mm4 ; mm1=data3=(30 31) - movq mm0,mm7 ; transpose coefficients - punpckldq mm7,mm1 ; mm7=(20 30) - punpckhdq mm0,mm1 ; mm0=(21 31) - movq mm3,mm5 ; transpose coefficients - punpckldq mm5,mm6 ; mm5=(40 50) - punpckhdq mm3,mm6 ; mm3=(41 51) + movq mm0,mm7 ; transpose coefficients + punpckldq mm7,mm1 ; mm7=(20 30) + punpckhdq mm0,mm1 ; mm0=(21 31) + movq mm3,mm5 ; transpose coefficients + punpckldq mm5,mm6 ; mm5=(40 50) + punpckhdq mm3,mm6 ; mm3=(41 51) - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm7 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm0 - movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 - movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm3 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], mm7 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], mm0 + movq MMWORD [MMBLOCK(0,2,edi,SIZEOF_FAST_FLOAT)], mm5 + movq MMWORD [MMBLOCK(1,2,edi,SIZEOF_FAST_FLOAT)], mm3 .nextcolumn: - add esi, byte 2*SIZEOF_JCOEF ; coef_block - add edx, byte 2*SIZEOF_FLOAT_MULT_TYPE ; quantptr - add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 2*SIZEOF_JCOEF ; coef_block + add edx, byte 2*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] - prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] - prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] - prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetch [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; FAST_FLOAT * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] - mov ecx, DCTSIZE/2 ; ctr - alignx 16,7 + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/2 ; ctr + alignx 16,7 .rowloop: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] - movq mm4,mm0 - movq mm5,mm1 - pfsub mm0,mm2 ; mm0=tmp11 - pfsub mm1,mm3 - pfadd mm4,mm2 ; mm4=tmp10 - pfadd mm5,mm3 ; mm5=tmp13 + movq mm4,mm0 + movq mm5,mm1 + pfsub mm0,mm2 ; mm0=tmp11 + pfsub mm1,mm3 + pfadd mm4,mm2 ; mm4=tmp10 + pfadd mm5,mm3 ; mm5=tmp13 - pfmul mm1,[GOTOFF(ebx,PD_1_414)] - pfsub mm1,mm5 ; mm1=tmp12 + pfmul mm1,[GOTOFF(ebx,PD_1_414)] + pfsub mm1,mm5 ; mm1=tmp12 - movq mm6,mm4 - movq mm7,mm0 - pfsub mm4,mm5 ; mm4=tmp3 - pfsub mm0,mm1 ; mm0=tmp2 - pfadd mm6,mm5 ; mm6=tmp0 - pfadd mm7,mm1 ; mm7=tmp1 + movq mm6,mm4 + movq mm7,mm0 + pfsub mm4,mm5 ; mm4=tmp3 + pfsub mm0,mm1 ; mm0=tmp2 + pfadd mm6,mm5 ; mm6=tmp0 + pfadd mm7,mm1 ; mm7=tmp1 - movq MMWORD [wk(1)], mm4 ; tmp3 - movq MMWORD [wk(0)], mm0 ; tmp2 + movq MMWORD [wk(1)], mm4 ; tmp3 + movq MMWORD [wk(0)], mm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] - movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] - movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] - movq mm4,mm2 - movq mm0,mm5 - pfadd mm2,mm1 ; mm2=z11 - pfadd mm5,mm3 ; mm5=z13 - pfsub mm4,mm1 ; mm4=z12 - pfsub mm0,mm3 ; mm0=z10 + movq mm4,mm2 + movq mm0,mm5 + pfadd mm2,mm1 ; mm2=z11 + pfadd mm5,mm3 ; mm5=z13 + pfsub mm4,mm1 ; mm4=z12 + pfsub mm0,mm3 ; mm0=z10 - movq mm1,mm2 - pfsub mm2,mm5 - pfadd mm1,mm5 ; mm1=tmp7 + movq mm1,mm2 + pfsub mm2,mm5 + pfadd mm1,mm5 ; mm1=tmp7 - pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 + pfmul mm2,[GOTOFF(ebx,PD_1_414)] ; mm2=tmp11 - movq mm3,mm0 - pfadd mm0,mm4 - pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 - pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) - pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) - pfsubr mm3,mm0 ; mm3=tmp12 - pfsub mm4,mm0 ; mm4=tmp10 + movq mm3,mm0 + pfadd mm0,mm4 + pfmul mm0,[GOTOFF(ebx,PD_1_847)] ; mm0=z5 + pfmul mm3,[GOTOFF(ebx,PD_2_613)] ; mm3=(z10 * 2.613125930) + pfmul mm4,[GOTOFF(ebx,PD_1_082)] ; mm4=(z12 * 1.082392200) + pfsubr mm3,mm0 ; mm3=tmp12 + pfsub mm4,mm0 ; mm4=tmp10 - ; -- Final output stage + ; -- Final output stage - pfsub mm3,mm1 ; mm3=tmp6 - movq mm5,mm6 - movq mm0,mm7 - pfadd mm6,mm1 ; mm6=data0=(00 10) - pfadd mm7,mm3 ; mm7=data1=(01 11) - pfsub mm5,mm1 ; mm5=data7=(07 17) - pfsub mm0,mm3 ; mm0=data6=(06 16) - pfsub mm2,mm3 ; mm2=tmp5 + pfsub mm3,mm1 ; mm3=tmp6 + movq mm5,mm6 + movq mm0,mm7 + pfadd mm6,mm1 ; mm6=data0=(00 10) + pfadd mm7,mm3 ; mm7=data1=(01 11) + pfsub mm5,mm1 ; mm5=data7=(07 17) + pfsub mm0,mm3 ; mm0=data6=(06 16) + pfsub mm2,mm3 ; mm2=tmp5 - movq mm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm1=[PD_RNDINT_MAGIC] - pcmpeqd mm3,mm3 - psrld mm3,WORD_BIT ; mm3={0xFFFF 0x0000 0xFFFF 0x0000} + movq mm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm1=[PD_RNDINT_MAGIC] + pcmpeqd mm3,mm3 + psrld mm3,WORD_BIT ; mm3={0xFFFF 0x0000 0xFFFF 0x0000} - pfadd mm6,mm1 ; mm6=roundint(data0/8)=(00 ** 10 **) - pfadd mm7,mm1 ; mm7=roundint(data1/8)=(01 ** 11 **) - pfadd mm0,mm1 ; mm0=roundint(data6/8)=(06 ** 16 **) - pfadd mm5,mm1 ; mm5=roundint(data7/8)=(07 ** 17 **) + pfadd mm6,mm1 ; mm6=roundint(data0/8)=(00 ** 10 **) + pfadd mm7,mm1 ; mm7=roundint(data1/8)=(01 ** 11 **) + pfadd mm0,mm1 ; mm0=roundint(data6/8)=(06 ** 16 **) + pfadd mm5,mm1 ; mm5=roundint(data7/8)=(07 ** 17 **) - pand mm6,mm3 ; mm6=(00 -- 10 --) - pslld mm7,WORD_BIT ; mm7=(-- 01 -- 11) - pand mm0,mm3 ; mm0=(06 -- 16 --) - pslld mm5,WORD_BIT ; mm5=(-- 07 -- 17) - por mm6,mm7 ; mm6=(00 01 10 11) - por mm0,mm5 ; mm0=(06 07 16 17) + pand mm6,mm3 ; mm6=(00 -- 10 --) + pslld mm7,WORD_BIT ; mm7=(-- 01 -- 11) + pand mm0,mm3 ; mm0=(06 -- 16 --) + pslld mm5,WORD_BIT ; mm5=(-- 07 -- 17) + por mm6,mm7 ; mm6=(00 01 10 11) + por mm0,mm5 ; mm0=(06 07 16 17) - movq mm1, MMWORD [wk(0)] ; mm1=tmp2 - movq mm3, MMWORD [wk(1)] ; mm3=tmp3 + movq mm1, MMWORD [wk(0)] ; mm1=tmp2 + movq mm3, MMWORD [wk(1)] ; mm3=tmp3 - pfadd mm4,mm2 ; mm4=tmp4 - movq mm7,mm1 - movq mm5,mm3 - pfadd mm1,mm2 ; mm1=data2=(02 12) - pfadd mm3,mm4 ; mm3=data4=(04 14) - pfsub mm7,mm2 ; mm7=data5=(05 15) - pfsub mm5,mm4 ; mm5=data3=(03 13) + pfadd mm4,mm2 ; mm4=tmp4 + movq mm7,mm1 + movq mm5,mm3 + pfadd mm1,mm2 ; mm1=data2=(02 12) + pfadd mm3,mm4 ; mm3=data4=(04 14) + pfsub mm7,mm2 ; mm7=data5=(05 15) + pfsub mm5,mm4 ; mm5=data3=(03 13) - movq mm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm2=[PD_RNDINT_MAGIC] - pcmpeqd mm4,mm4 - psrld mm4,WORD_BIT ; mm4={0xFFFF 0x0000 0xFFFF 0x0000} + movq mm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; mm2=[PD_RNDINT_MAGIC] + pcmpeqd mm4,mm4 + psrld mm4,WORD_BIT ; mm4={0xFFFF 0x0000 0xFFFF 0x0000} - pfadd mm3,mm2 ; mm3=roundint(data4/8)=(04 ** 14 **) - pfadd mm7,mm2 ; mm7=roundint(data5/8)=(05 ** 15 **) - pfadd mm1,mm2 ; mm1=roundint(data2/8)=(02 ** 12 **) - pfadd mm5,mm2 ; mm5=roundint(data3/8)=(03 ** 13 **) + pfadd mm3,mm2 ; mm3=roundint(data4/8)=(04 ** 14 **) + pfadd mm7,mm2 ; mm7=roundint(data5/8)=(05 ** 15 **) + pfadd mm1,mm2 ; mm1=roundint(data2/8)=(02 ** 12 **) + pfadd mm5,mm2 ; mm5=roundint(data3/8)=(03 ** 13 **) - pand mm3,mm4 ; mm3=(04 -- 14 --) - pslld mm7,WORD_BIT ; mm7=(-- 05 -- 15) - pand mm1,mm4 ; mm1=(02 -- 12 --) - pslld mm5,WORD_BIT ; mm5=(-- 03 -- 13) - por mm3,mm7 ; mm3=(04 05 14 15) - por mm1,mm5 ; mm1=(02 03 12 13) + pand mm3,mm4 ; mm3=(04 -- 14 --) + pslld mm7,WORD_BIT ; mm7=(-- 05 -- 15) + pand mm1,mm4 ; mm1=(02 -- 12 --) + pslld mm5,WORD_BIT ; mm5=(-- 03 -- 13) + por mm3,mm7 ; mm3=(04 05 14 15) + por mm1,mm5 ; mm1=(02 03 12 13) - movq mm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm2=[PB_CENTERJSAMP] + movq mm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm2=[PB_CENTERJSAMP] - packsswb mm6,mm3 ; mm6=(00 01 10 11 04 05 14 15) - packsswb mm1,mm0 ; mm1=(02 03 12 13 06 07 16 17) - paddb mm6,mm2 - paddb mm1,mm2 + packsswb mm6,mm3 ; mm6=(00 01 10 11 04 05 14 15) + packsswb mm1,mm0 ; mm1=(02 03 12 13 06 07 16 17) + paddb mm6,mm2 + paddb mm1,mm2 - movq mm4,mm6 ; transpose coefficients(phase 2) - punpcklwd mm6,mm1 ; mm6=(00 01 02 03 10 11 12 13) - punpckhwd mm4,mm1 ; mm4=(04 05 06 07 14 15 16 17) + movq mm4,mm6 ; transpose coefficients(phase 2) + punpcklwd mm6,mm1 ; mm6=(00 01 02 03 10 11 12 13) + punpckhwd mm4,mm1 ; mm4=(04 05 06 07 14 15 16 17) - movq mm7,mm6 ; transpose coefficients(phase 3) - punpckldq mm6,mm4 ; mm6=(00 01 02 03 04 05 06 07) - punpckhdq mm7,mm4 ; mm7=(10 11 12 13 14 15 16 17) + movq mm7,mm6 ; transpose coefficients(phase 3) + punpckldq mm6,mm4 ; mm6=(00 01 02 03 04 05 06 07) + punpckhdq mm7,mm4 ; mm7=(10 11 12 13 14 15 16 17) - pushpic ebx ; save GOT address + pushpic ebx ; save GOT address - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 - poppic ebx ; restore GOT address + poppic ebx ; restore GOT address - add esi, byte 2*SIZEOF_FAST_FLOAT ; wsptr - add edi, byte 2*SIZEOF_JSAMPROW - dec ecx ; ctr - jnz near .rowloop + add esi, byte 2*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 2*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop - femms ; empty MMX/3DNow! state + femms ; empty MMX/3DNow! state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jimmxfst.asm b/simd/jimmxfst.asm index 3b055727..a9eaa02e 100644 --- a/simd/jimmxfst.asm +++ b/simd/jimmxfst.asm @@ -26,31 +26,31 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. -%define PASS1_BITS 2 +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 %if IFAST_SCALE_BITS != PASS1_BITS %error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." %endif %if CONST_BITS == 8 -F_1_082 equ 277 ; FIX(1.082392200) -F_1_414 equ 362 ; FIX(1.414213562) -F_1_847 equ 473 ; FIX(1.847759065) -F_2_613 equ 669 ; FIX(2.613125930) -F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) %else ; NASM cannot do compile-time arithmetic on floating-point constants. -%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) -F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) -F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -58,22 +58,22 @@ F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_idct_ifast_mmx) + alignz 16 + global EXTN(jconst_idct_ifast_mmx) EXTN(jconst_idct_ifast_mmx): -PW_F1414 times 4 dw F_1_414 << CONST_SHIFT -PW_F1847 times 4 dw F_1_847 << CONST_SHIFT -PW_MF1613 times 4 dw -F_1_613 << CONST_SHIFT -PW_F1082 times 4 dw F_1_082 << CONST_SHIFT -PB_CENTERJSAMP times 8 db CENTERJSAMPLE +PW_F1414 times 4 dw F_1_414 << CONST_SHIFT +PW_F1847 times 4 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 4 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 4 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 8 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -82,419 +82,419 @@ PB_CENTERJSAMP times 8 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; jpeg_component_info * compptr -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF - ; JCOEF workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_ifast_mmx) + align 16 + global EXTN(jsimd_idct_ifast_mmx) EXTN(jsimd_idct_ifast_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; JCOEF * wsptr - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_IFAST_MMX - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por mm1,mm0 - packsswb mm1,mm1 - movd eax,mm1 - test eax,eax - jnz short .columnDCT + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movq mm2,mm0 ; mm0=in0=(00 01 02 03) - punpcklwd mm0,mm0 ; mm0=(00 00 01 01) - punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) - movq mm1,mm0 - punpckldq mm0,mm0 ; mm0=(00 00 00 00) - punpckhdq mm1,mm1 ; mm1=(01 01 01 01) - movq mm3,mm2 - punpckldq mm2,mm2 ; mm2=(02 02 02 02) - punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 - movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 - jmp near .nextcolumn - alignx 16,7 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movq mm4,mm0 - movq mm5,mm1 - psubw mm0,mm2 ; mm0=tmp11 - psubw mm1,mm3 - paddw mm4,mm2 ; mm4=tmp10 - paddw mm5,mm3 ; mm5=tmp13 + movq mm4,mm0 + movq mm5,mm1 + psubw mm0,mm2 ; mm0=tmp11 + psubw mm1,mm3 + paddw mm4,mm2 ; mm4=tmp10 + paddw mm5,mm3 ; mm5=tmp13 - psllw mm1,PRE_MULTIPLY_SCALE_BITS - pmulhw mm1,[GOTOFF(ebx,PW_F1414)] - psubw mm1,mm5 ; mm1=tmp12 + psllw mm1,PRE_MULTIPLY_SCALE_BITS + pmulhw mm1,[GOTOFF(ebx,PW_F1414)] + psubw mm1,mm5 ; mm1=tmp12 - movq mm6,mm4 - movq mm7,mm0 - psubw mm4,mm5 ; mm4=tmp3 - psubw mm0,mm1 ; mm0=tmp2 - paddw mm6,mm5 ; mm6=tmp0 - paddw mm7,mm1 ; mm7=tmp1 + movq mm6,mm4 + movq mm7,mm0 + psubw mm4,mm5 ; mm4=tmp3 + psubw mm0,mm1 ; mm0=tmp2 + paddw mm6,mm5 ; mm6=tmp0 + paddw mm7,mm1 ; mm7=tmp1 - movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 - movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 + movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 + movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 - ; -- Odd part + ; -- Odd part - movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm5, MMWORD [MMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movq mm4,mm2 - movq mm0,mm5 - psubw mm2,mm1 ; mm2=z12 - psubw mm5,mm3 ; mm5=z10 - paddw mm4,mm1 ; mm4=z11 - paddw mm0,mm3 ; mm0=z13 + movq mm4,mm2 + movq mm0,mm5 + psubw mm2,mm1 ; mm2=z12 + psubw mm5,mm3 ; mm5=z10 + paddw mm4,mm1 ; mm4=z11 + paddw mm0,mm3 ; mm0=z13 - movq mm1,mm5 ; mm1=z10(unscaled) - psllw mm2,PRE_MULTIPLY_SCALE_BITS - psllw mm5,PRE_MULTIPLY_SCALE_BITS + movq mm1,mm5 ; mm1=z10(unscaled) + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm5,PRE_MULTIPLY_SCALE_BITS - movq mm3,mm4 - psubw mm4,mm0 - paddw mm3,mm0 ; mm3=tmp7 + movq mm3,mm4 + psubw mm4,mm0 + paddw mm3,mm0 ; mm3=tmp7 - psllw mm4,PRE_MULTIPLY_SCALE_BITS - pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 + psllw mm4,PRE_MULTIPLY_SCALE_BITS + pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movq mm0,mm5 - paddw mm5,mm2 - pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 - pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] - pmulhw mm2,[GOTOFF(ebx,PW_F1082)] - psubw mm0,mm1 - psubw mm2,mm5 ; mm2=tmp10 - paddw mm0,mm5 ; mm0=tmp12 + movq mm0,mm5 + paddw mm5,mm2 + pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 + pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw mm2,[GOTOFF(ebx,PW_F1082)] + psubw mm0,mm1 + psubw mm2,mm5 ; mm2=tmp10 + paddw mm0,mm5 ; mm0=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw mm0,mm3 ; mm0=tmp6 - movq mm1,mm6 - movq mm5,mm7 - paddw mm6,mm3 ; mm6=data0=(00 01 02 03) - paddw mm7,mm0 ; mm7=data1=(10 11 12 13) - psubw mm1,mm3 ; mm1=data7=(70 71 72 73) - psubw mm5,mm0 ; mm5=data6=(60 61 62 63) - psubw mm4,mm0 ; mm4=tmp5 + psubw mm0,mm3 ; mm0=tmp6 + movq mm1,mm6 + movq mm5,mm7 + paddw mm6,mm3 ; mm6=data0=(00 01 02 03) + paddw mm7,mm0 ; mm7=data1=(10 11 12 13) + psubw mm1,mm3 ; mm1=data7=(70 71 72 73) + psubw mm5,mm0 ; mm5=data6=(60 61 62 63) + psubw mm4,mm0 ; mm4=tmp5 - movq mm3,mm6 ; transpose coefficients(phase 1) - punpcklwd mm6,mm7 ; mm6=(00 10 01 11) - punpckhwd mm3,mm7 ; mm3=(02 12 03 13) - movq mm0,mm5 ; transpose coefficients(phase 1) - punpcklwd mm5,mm1 ; mm5=(60 70 61 71) - punpckhwd mm0,mm1 ; mm0=(62 72 63 73) + movq mm3,mm6 ; transpose coefficients(phase 1) + punpcklwd mm6,mm7 ; mm6=(00 10 01 11) + punpckhwd mm3,mm7 ; mm3=(02 12 03 13) + movq mm0,mm5 ; transpose coefficients(phase 1) + punpcklwd mm5,mm1 ; mm5=(60 70 61 71) + punpckhwd mm0,mm1 ; mm0=(62 72 63 73) - movq mm7, MMWORD [wk(0)] ; mm7=tmp2 - movq mm1, MMWORD [wk(1)] ; mm1=tmp3 + movq mm7, MMWORD [wk(0)] ; mm7=tmp2 + movq mm1, MMWORD [wk(1)] ; mm1=tmp3 - movq MMWORD [wk(0)], mm5 ; wk(0)=(60 70 61 71) - movq MMWORD [wk(1)], mm0 ; wk(1)=(62 72 63 73) + movq MMWORD [wk(0)], mm5 ; wk(0)=(60 70 61 71) + movq MMWORD [wk(1)], mm0 ; wk(1)=(62 72 63 73) - paddw mm2,mm4 ; mm2=tmp4 - movq mm5,mm7 - movq mm0,mm1 - paddw mm7,mm4 ; mm7=data2=(20 21 22 23) - paddw mm1,mm2 ; mm1=data4=(40 41 42 43) - psubw mm5,mm4 ; mm5=data5=(50 51 52 53) - psubw mm0,mm2 ; mm0=data3=(30 31 32 33) + paddw mm2,mm4 ; mm2=tmp4 + movq mm5,mm7 + movq mm0,mm1 + paddw mm7,mm4 ; mm7=data2=(20 21 22 23) + paddw mm1,mm2 ; mm1=data4=(40 41 42 43) + psubw mm5,mm4 ; mm5=data5=(50 51 52 53) + psubw mm0,mm2 ; mm0=data3=(30 31 32 33) - movq mm4,mm7 ; transpose coefficients(phase 1) - punpcklwd mm7,mm0 ; mm7=(20 30 21 31) - punpckhwd mm4,mm0 ; mm4=(22 32 23 33) - movq mm2,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm5 ; mm1=(40 50 41 51) - punpckhwd mm2,mm5 ; mm2=(42 52 43 53) + movq mm4,mm7 ; transpose coefficients(phase 1) + punpcklwd mm7,mm0 ; mm7=(20 30 21 31) + punpckhwd mm4,mm0 ; mm4=(22 32 23 33) + movq mm2,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm5 ; mm1=(40 50 41 51) + punpckhwd mm2,mm5 ; mm2=(42 52 43 53) - movq mm0,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm7 ; mm6=(00 10 20 30) - punpckhdq mm0,mm7 ; mm0=(01 11 21 31) - movq mm5,mm3 ; transpose coefficients(phase 2) - punpckldq mm3,mm4 ; mm3=(02 12 22 32) - punpckhdq mm5,mm4 ; mm5=(03 13 23 33) + movq mm0,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm7 ; mm6=(00 10 20 30) + punpckhdq mm0,mm7 ; mm0=(01 11 21 31) + movq mm5,mm3 ; transpose coefficients(phase 2) + punpckldq mm3,mm4 ; mm3=(02 12 22 32) + punpckhdq mm5,mm4 ; mm5=(03 13 23 33) - movq mm7, MMWORD [wk(0)] ; mm7=(60 70 61 71) - movq mm4, MMWORD [wk(1)] ; mm4=(62 72 63 73) + movq mm7, MMWORD [wk(0)] ; mm7=(60 70 61 71) + movq mm4, MMWORD [wk(1)] ; mm4=(62 72 63 73) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm6 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm3 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 - movq mm6,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm7 ; mm1=(40 50 60 70) - punpckhdq mm6,mm7 ; mm6=(41 51 61 71) - movq mm0,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm4 ; mm2=(42 52 62 72) - punpckhdq mm0,mm4 ; mm0=(43 53 63 73) + movq mm6,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm7 ; mm1=(40 50 60 70) + punpckhdq mm6,mm7 ; mm6=(41 51 61 71) + movq mm0,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm4 ; mm2=(42 52 62 72) + punpckhdq mm0,mm4 ; mm0=(43 53 63 73) - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm6 - movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm0 .nextcolumn: - add esi, byte 4*SIZEOF_JCOEF ; coef_block - add edx, byte 4*SIZEOF_IFAST_MULT_TYPE ; quantptr - add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_IFAST_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; JCOEF * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .rowloop: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - movq mm4,mm0 - movq mm5,mm1 - psubw mm0,mm2 ; mm0=tmp11 - psubw mm1,mm3 - paddw mm4,mm2 ; mm4=tmp10 - paddw mm5,mm3 ; mm5=tmp13 + movq mm4,mm0 + movq mm5,mm1 + psubw mm0,mm2 ; mm0=tmp11 + psubw mm1,mm3 + paddw mm4,mm2 ; mm4=tmp10 + paddw mm5,mm3 ; mm5=tmp13 - psllw mm1,PRE_MULTIPLY_SCALE_BITS - pmulhw mm1,[GOTOFF(ebx,PW_F1414)] - psubw mm1,mm5 ; mm1=tmp12 + psllw mm1,PRE_MULTIPLY_SCALE_BITS + pmulhw mm1,[GOTOFF(ebx,PW_F1414)] + psubw mm1,mm5 ; mm1=tmp12 - movq mm6,mm4 - movq mm7,mm0 - psubw mm4,mm5 ; mm4=tmp3 - psubw mm0,mm1 ; mm0=tmp2 - paddw mm6,mm5 ; mm6=tmp0 - paddw mm7,mm1 ; mm7=tmp1 + movq mm6,mm4 + movq mm7,mm0 + psubw mm4,mm5 ; mm4=tmp3 + psubw mm0,mm1 ; mm0=tmp2 + paddw mm6,mm5 ; mm6=tmp0 + paddw mm7,mm1 ; mm7=tmp1 - movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 - movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 + movq MMWORD [wk(1)], mm4 ; wk(1)=tmp3 + movq MMWORD [wk(0)], mm0 ; wk(0)=tmp2 - ; -- Odd part + ; -- Odd part - movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - movq mm4,mm2 - movq mm0,mm5 - psubw mm2,mm1 ; mm2=z12 - psubw mm5,mm3 ; mm5=z10 - paddw mm4,mm1 ; mm4=z11 - paddw mm0,mm3 ; mm0=z13 + movq mm4,mm2 + movq mm0,mm5 + psubw mm2,mm1 ; mm2=z12 + psubw mm5,mm3 ; mm5=z10 + paddw mm4,mm1 ; mm4=z11 + paddw mm0,mm3 ; mm0=z13 - movq mm1,mm5 ; mm1=z10(unscaled) - psllw mm2,PRE_MULTIPLY_SCALE_BITS - psllw mm5,PRE_MULTIPLY_SCALE_BITS + movq mm1,mm5 ; mm1=z10(unscaled) + psllw mm2,PRE_MULTIPLY_SCALE_BITS + psllw mm5,PRE_MULTIPLY_SCALE_BITS - movq mm3,mm4 - psubw mm4,mm0 - paddw mm3,mm0 ; mm3=tmp7 + movq mm3,mm4 + psubw mm4,mm0 + paddw mm3,mm0 ; mm3=tmp7 - psllw mm4,PRE_MULTIPLY_SCALE_BITS - pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 + psllw mm4,PRE_MULTIPLY_SCALE_BITS + pmulhw mm4,[GOTOFF(ebx,PW_F1414)] ; mm4=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movq mm0,mm5 - paddw mm5,mm2 - pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 - pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] - pmulhw mm2,[GOTOFF(ebx,PW_F1082)] - psubw mm0,mm1 - psubw mm2,mm5 ; mm2=tmp10 - paddw mm0,mm5 ; mm0=tmp12 + movq mm0,mm5 + paddw mm5,mm2 + pmulhw mm5,[GOTOFF(ebx,PW_F1847)] ; mm5=z5 + pmulhw mm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw mm2,[GOTOFF(ebx,PW_F1082)] + psubw mm0,mm1 + psubw mm2,mm5 ; mm2=tmp10 + paddw mm0,mm5 ; mm0=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw mm0,mm3 ; mm0=tmp6 - movq mm1,mm6 - movq mm5,mm7 - paddw mm6,mm3 ; mm6=data0=(00 10 20 30) - paddw mm7,mm0 ; mm7=data1=(01 11 21 31) - psraw mm6,(PASS1_BITS+3) ; descale - psraw mm7,(PASS1_BITS+3) ; descale - psubw mm1,mm3 ; mm1=data7=(07 17 27 37) - psubw mm5,mm0 ; mm5=data6=(06 16 26 36) - psraw mm1,(PASS1_BITS+3) ; descale - psraw mm5,(PASS1_BITS+3) ; descale - psubw mm4,mm0 ; mm4=tmp5 + psubw mm0,mm3 ; mm0=tmp6 + movq mm1,mm6 + movq mm5,mm7 + paddw mm6,mm3 ; mm6=data0=(00 10 20 30) + paddw mm7,mm0 ; mm7=data1=(01 11 21 31) + psraw mm6,(PASS1_BITS+3) ; descale + psraw mm7,(PASS1_BITS+3) ; descale + psubw mm1,mm3 ; mm1=data7=(07 17 27 37) + psubw mm5,mm0 ; mm5=data6=(06 16 26 36) + psraw mm1,(PASS1_BITS+3) ; descale + psraw mm5,(PASS1_BITS+3) ; descale + psubw mm4,mm0 ; mm4=tmp5 - packsswb mm6,mm5 ; mm6=(00 10 20 30 06 16 26 36) - packsswb mm7,mm1 ; mm7=(01 11 21 31 07 17 27 37) + packsswb mm6,mm5 ; mm6=(00 10 20 30 06 16 26 36) + packsswb mm7,mm1 ; mm7=(01 11 21 31 07 17 27 37) - movq mm3, MMWORD [wk(0)] ; mm3=tmp2 - movq mm0, MMWORD [wk(1)] ; mm0=tmp3 + movq mm3, MMWORD [wk(0)] ; mm3=tmp2 + movq mm0, MMWORD [wk(1)] ; mm0=tmp3 - paddw mm2,mm4 ; mm2=tmp4 - movq mm5,mm3 - movq mm1,mm0 - paddw mm3,mm4 ; mm3=data2=(02 12 22 32) - paddw mm0,mm2 ; mm0=data4=(04 14 24 34) - psraw mm3,(PASS1_BITS+3) ; descale - psraw mm0,(PASS1_BITS+3) ; descale - psubw mm5,mm4 ; mm5=data5=(05 15 25 35) - psubw mm1,mm2 ; mm1=data3=(03 13 23 33) - psraw mm5,(PASS1_BITS+3) ; descale - psraw mm1,(PASS1_BITS+3) ; descale + paddw mm2,mm4 ; mm2=tmp4 + movq mm5,mm3 + movq mm1,mm0 + paddw mm3,mm4 ; mm3=data2=(02 12 22 32) + paddw mm0,mm2 ; mm0=data4=(04 14 24 34) + psraw mm3,(PASS1_BITS+3) ; descale + psraw mm0,(PASS1_BITS+3) ; descale + psubw mm5,mm4 ; mm5=data5=(05 15 25 35) + psubw mm1,mm2 ; mm1=data3=(03 13 23 33) + psraw mm5,(PASS1_BITS+3) ; descale + psraw mm1,(PASS1_BITS+3) ; descale - movq mm4,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm4=[PB_CENTERJSAMP] + movq mm4,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm4=[PB_CENTERJSAMP] - packsswb mm3,mm0 ; mm3=(02 12 22 32 04 14 24 34) - packsswb mm1,mm5 ; mm1=(03 13 23 33 05 15 25 35) + packsswb mm3,mm0 ; mm3=(02 12 22 32 04 14 24 34) + packsswb mm1,mm5 ; mm1=(03 13 23 33 05 15 25 35) - paddb mm6,mm4 - paddb mm7,mm4 - paddb mm3,mm4 - paddb mm1,mm4 + paddb mm6,mm4 + paddb mm7,mm4 + paddb mm3,mm4 + paddb mm1,mm4 - movq mm2,mm6 ; transpose coefficients(phase 1) - punpcklbw mm6,mm7 ; mm6=(00 01 10 11 20 21 30 31) - punpckhbw mm2,mm7 ; mm2=(06 07 16 17 26 27 36 37) - movq mm0,mm3 ; transpose coefficients(phase 1) - punpcklbw mm3,mm1 ; mm3=(02 03 12 13 22 23 32 33) - punpckhbw mm0,mm1 ; mm0=(04 05 14 15 24 25 34 35) + movq mm2,mm6 ; transpose coefficients(phase 1) + punpcklbw mm6,mm7 ; mm6=(00 01 10 11 20 21 30 31) + punpckhbw mm2,mm7 ; mm2=(06 07 16 17 26 27 36 37) + movq mm0,mm3 ; transpose coefficients(phase 1) + punpcklbw mm3,mm1 ; mm3=(02 03 12 13 22 23 32 33) + punpckhbw mm0,mm1 ; mm0=(04 05 14 15 24 25 34 35) - movq mm5,mm6 ; transpose coefficients(phase 2) - punpcklwd mm6,mm3 ; mm6=(00 01 02 03 10 11 12 13) - punpckhwd mm5,mm3 ; mm5=(20 21 22 23 30 31 32 33) - movq mm4,mm0 ; transpose coefficients(phase 2) - punpcklwd mm0,mm2 ; mm0=(04 05 06 07 14 15 16 17) - punpckhwd mm4,mm2 ; mm4=(24 25 26 27 34 35 36 37) + movq mm5,mm6 ; transpose coefficients(phase 2) + punpcklwd mm6,mm3 ; mm6=(00 01 02 03 10 11 12 13) + punpckhwd mm5,mm3 ; mm5=(20 21 22 23 30 31 32 33) + movq mm4,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm2 ; mm0=(04 05 06 07 14 15 16 17) + punpckhwd mm4,mm2 ; mm4=(24 25 26 27 34 35 36 37) - movq mm7,mm6 ; transpose coefficients(phase 3) - punpckldq mm6,mm0 ; mm6=(00 01 02 03 04 05 06 07) - punpckhdq mm7,mm0 ; mm7=(10 11 12 13 14 15 16 17) - movq mm1,mm5 ; transpose coefficients(phase 3) - punpckldq mm5,mm4 ; mm5=(20 21 22 23 24 25 26 27) - punpckhdq mm1,mm4 ; mm1=(30 31 32 33 34 35 36 37) + movq mm7,mm6 ; transpose coefficients(phase 3) + punpckldq mm6,mm0 ; mm6=(00 01 02 03 04 05 06 07) + punpckhdq mm7,mm0 ; mm7=(10 11 12 13 14 15 16 17) + movq mm1,mm5 ; transpose coefficients(phase 3) + punpckldq mm5,mm4 ; mm5=(20 21 22 23 24 25 26 27) + punpckhdq mm1,mm4 ; mm1=(30 31 32 33 34 35 36 37) - pushpic ebx ; save GOT address + pushpic ebx ; save GOT address - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 - mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm6 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm7 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 - poppic ebx ; restore GOT address + poppic ebx ; restore GOT address - add esi, byte 4*SIZEOF_JCOEF ; wsptr - add edi, byte 4*SIZEOF_JSAMPROW - dec ecx ; ctr - jnz near .rowloop + add esi, byte 4*SIZEOF_JCOEF ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jimmxint.asm b/simd/jimmxint.asm index 7b52fae3..75b9ea88 100644 --- a/simd/jimmxint.asm +++ b/simd/jimmxint.asm @@ -26,67 +26,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_islow_mmx) + alignz 16 + global EXTN(jconst_idct_islow_mmx) EXTN(jconst_idct_islow_mmx): -PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) -PB_CENTERJSAMP times 8 db CENTERJSAMPLE +PW_F130_F054 times 2 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 2 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 2 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 2 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 2 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 2 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 2 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 2 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -95,758 +95,758 @@ PB_CENTERJSAMP times 8 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; jpeg_component_info * compptr -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 12 -%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF - ; JCOEF workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 12 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_islow_mmx) + align 16 + global EXTN(jsimd_idct_islow_mmx) EXTN(jsimd_idct_islow_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; JCOEF * wsptr - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_ISLOW_MMX - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por mm1,mm0 - packsswb mm1,mm1 - movd eax,mm1 - test eax,eax - jnz short .columnDCT + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - psllw mm0,PASS1_BITS + psllw mm0,PASS1_BITS - movq mm2,mm0 ; mm0=in0=(00 01 02 03) - punpcklwd mm0,mm0 ; mm0=(00 00 01 01) - punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) - movq mm1,mm0 - punpckldq mm0,mm0 ; mm0=(00 00 00 00) - punpckhdq mm1,mm1 ; mm1=(01 01 01 01) - movq mm3,mm2 - punpckldq mm2,mm2 ; mm2=(02 02 02 02) - punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 - movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 - jmp near .nextcolumn - alignx 16,7 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movq mm4,mm1 ; mm1=in2=z2 - movq mm5,mm1 - punpcklwd mm4,mm3 ; mm3=in6=z3 - punpckhwd mm5,mm3 - movq mm1,mm4 - movq mm3,mm5 - pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L - pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H - pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L - pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H + movq mm4,mm1 ; mm1=in2=z2 + movq mm5,mm1 + punpcklwd mm4,mm3 ; mm3=in6=z3 + punpckhwd mm5,mm3 + movq mm1,mm4 + movq mm3,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L + pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H - movq mm6,mm0 - paddw mm0,mm2 ; mm0=in0+in4 - psubw mm6,mm2 ; mm6=in0-in4 + movq mm6,mm0 + paddw mm0,mm2 ; mm0=in0+in4 + psubw mm6,mm2 ; mm6=in0-in4 - pxor mm7,mm7 - pxor mm2,mm2 - punpcklwd mm7,mm0 ; mm7=tmp0L - punpckhwd mm2,mm0 ; mm2=tmp0H - psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS - psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS + pxor mm7,mm7 + pxor mm2,mm2 + punpcklwd mm7,mm0 ; mm7=tmp0L + punpckhwd mm2,mm0 ; mm2=tmp0H + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS - movq mm0,mm7 - paddd mm7,mm4 ; mm7=tmp10L - psubd mm0,mm4 ; mm0=tmp13L - movq mm4,mm2 - paddd mm2,mm5 ; mm2=tmp10H - psubd mm4,mm5 ; mm4=tmp13H + movq mm0,mm7 + paddd mm7,mm4 ; mm7=tmp10L + psubd mm0,mm4 ; mm0=tmp13L + movq mm4,mm2 + paddd mm2,mm5 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp13H - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L - movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H - movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L - movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L + movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H + movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L + movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H - pxor mm5,mm5 - pxor mm7,mm7 - punpcklwd mm5,mm6 ; mm5=tmp1L - punpckhwd mm7,mm6 ; mm7=tmp1H - psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS - psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + pxor mm5,mm5 + pxor mm7,mm7 + punpcklwd mm5,mm6 ; mm5=tmp1L + punpckhwd mm7,mm6 ; mm7=tmp1H + psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS - movq mm2,mm5 - paddd mm5,mm1 ; mm5=tmp11L - psubd mm2,mm1 ; mm2=tmp12L - movq mm0,mm7 - paddd mm7,mm3 ; mm7=tmp11H - psubd mm0,mm3 ; mm0=tmp12H + movq mm2,mm5 + paddd mm5,mm1 ; mm5=tmp11L + psubd mm2,mm1 ; mm2=tmp12L + movq mm0,mm7 + paddd mm7,mm3 ; mm7=tmp11H + psubd mm0,mm3 ; mm0=tmp12H - movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L - movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H - movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L - movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H + movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L + movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H + movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L + movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw mm4, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm6, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw mm1, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm4, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm6, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm1, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm5,mm6 - movq mm7,mm4 - paddw mm5,mm3 ; mm5=z3 - paddw mm7,mm1 ; mm7=z4 + movq mm5,mm6 + movq mm7,mm4 + paddw mm5,mm3 ; mm5=z3 + paddw mm7,mm1 ; mm7=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movq mm2,mm5 - movq mm0,mm5 - punpcklwd mm2,mm7 - punpckhwd mm0,mm7 - movq mm5,mm2 - movq mm7,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L - pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H - pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L - pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H + movq mm2,mm5 + movq mm0,mm5 + punpcklwd mm2,mm7 + punpckhwd mm0,mm7 + movq mm5,mm2 + movq mm7,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L + pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H + pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L + pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H - movq MMWORD [wk(10)], mm2 ; wk(10)=z3L - movq MMWORD [wk(11)], mm0 ; wk(11)=z3H + movq MMWORD [wk(10)], mm2 ; wk(10)=z3L + movq MMWORD [wk(11)], mm0 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movq mm2,mm3 - movq mm0,mm3 - punpcklwd mm2,mm4 - punpckhwd mm0,mm4 - movq mm3,mm2 - movq mm4,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L - pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H - pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L - pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H + movq mm2,mm3 + movq mm0,mm3 + punpcklwd mm2,mm4 + punpckhwd mm0,mm4 + movq mm3,mm2 + movq mm4,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L + pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H + pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L + pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H - paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L - paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H - paddd mm3,mm5 ; mm3=tmp3L - paddd mm4,mm7 ; mm4=tmp3H + paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L + paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H + paddd mm3,mm5 ; mm3=tmp3L + paddd mm4,mm7 ; mm4=tmp3H - movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L - movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H + movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L + movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H - movq mm2,mm1 - movq mm0,mm1 - punpcklwd mm2,mm6 - punpckhwd mm0,mm6 - movq mm1,mm2 - movq mm6,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L - pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H - pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L - pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H + movq mm2,mm1 + movq mm0,mm1 + punpcklwd mm2,mm6 + punpckhwd mm0,mm6 + movq mm1,mm2 + movq mm6,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L + pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H + pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L + pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H - paddd mm2,mm5 ; mm2=tmp1L - paddd mm0,mm7 ; mm0=tmp1H - paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L - paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H + paddd mm2,mm5 ; mm2=tmp1L + paddd mm0,mm7 ; mm0=tmp1H + paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L + paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H - movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L - movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H + movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L + movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movq mm5, MMWORD [wk(0)] ; mm5=tmp10L - movq mm7, MMWORD [wk(1)] ; mm7=tmp10H + movq mm5, MMWORD [wk(0)] ; mm5=tmp10L + movq mm7, MMWORD [wk(1)] ; mm7=tmp10H - movq mm2,mm5 - movq mm0,mm7 - paddd mm5,mm3 ; mm5=data0L - paddd mm7,mm4 ; mm7=data0H - psubd mm2,mm3 ; mm2=data7L - psubd mm0,mm4 ; mm0=data7H + movq mm2,mm5 + movq mm0,mm7 + paddd mm5,mm3 ; mm5=data0L + paddd mm7,mm4 ; mm7=data0H + psubd mm2,mm3 ; mm2=data7L + psubd mm0,mm4 ; mm0=data7H - movq mm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm3=[PD_DESCALE_P1] + movq mm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm3=[PD_DESCALE_P1] - paddd mm5,mm3 - paddd mm7,mm3 - psrad mm5,DESCALE_P1 - psrad mm7,DESCALE_P1 - paddd mm2,mm3 - paddd mm0,mm3 - psrad mm2,DESCALE_P1 - psrad mm0,DESCALE_P1 + paddd mm5,mm3 + paddd mm7,mm3 + psrad mm5,DESCALE_P1 + psrad mm7,DESCALE_P1 + paddd mm2,mm3 + paddd mm0,mm3 + psrad mm2,DESCALE_P1 + psrad mm0,DESCALE_P1 - packssdw mm5,mm7 ; mm5=data0=(00 01 02 03) - packssdw mm2,mm0 ; mm2=data7=(70 71 72 73) + packssdw mm5,mm7 ; mm5=data0=(00 01 02 03) + packssdw mm2,mm0 ; mm2=data7=(70 71 72 73) - movq mm4, MMWORD [wk(4)] ; mm4=tmp11L - movq mm3, MMWORD [wk(5)] ; mm3=tmp11H + movq mm4, MMWORD [wk(4)] ; mm4=tmp11L + movq mm3, MMWORD [wk(5)] ; mm3=tmp11H - movq mm7,mm4 - movq mm0,mm3 - paddd mm4,mm1 ; mm4=data1L - paddd mm3,mm6 ; mm3=data1H - psubd mm7,mm1 ; mm7=data6L - psubd mm0,mm6 ; mm0=data6H + movq mm7,mm4 + movq mm0,mm3 + paddd mm4,mm1 ; mm4=data1L + paddd mm3,mm6 ; mm3=data1H + psubd mm7,mm1 ; mm7=data6L + psubd mm0,mm6 ; mm0=data6H - movq mm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm1=[PD_DESCALE_P1] + movq mm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm1=[PD_DESCALE_P1] - paddd mm4,mm1 - paddd mm3,mm1 - psrad mm4,DESCALE_P1 - psrad mm3,DESCALE_P1 - paddd mm7,mm1 - paddd mm0,mm1 - psrad mm7,DESCALE_P1 - psrad mm0,DESCALE_P1 + paddd mm4,mm1 + paddd mm3,mm1 + psrad mm4,DESCALE_P1 + psrad mm3,DESCALE_P1 + paddd mm7,mm1 + paddd mm0,mm1 + psrad mm7,DESCALE_P1 + psrad mm0,DESCALE_P1 - packssdw mm4,mm3 ; mm4=data1=(10 11 12 13) - packssdw mm7,mm0 ; mm7=data6=(60 61 62 63) + packssdw mm4,mm3 ; mm4=data1=(10 11 12 13) + packssdw mm7,mm0 ; mm7=data6=(60 61 62 63) - movq mm6,mm5 ; transpose coefficients(phase 1) - punpcklwd mm5,mm4 ; mm5=(00 10 01 11) - punpckhwd mm6,mm4 ; mm6=(02 12 03 13) - movq mm1,mm7 ; transpose coefficients(phase 1) - punpcklwd mm7,mm2 ; mm7=(60 70 61 71) - punpckhwd mm1,mm2 ; mm1=(62 72 63 73) + movq mm6,mm5 ; transpose coefficients(phase 1) + punpcklwd mm5,mm4 ; mm5=(00 10 01 11) + punpckhwd mm6,mm4 ; mm6=(02 12 03 13) + movq mm1,mm7 ; transpose coefficients(phase 1) + punpcklwd mm7,mm2 ; mm7=(60 70 61 71) + punpckhwd mm1,mm2 ; mm1=(62 72 63 73) - movq mm3, MMWORD [wk(6)] ; mm3=tmp12L - movq mm0, MMWORD [wk(7)] ; mm0=tmp12H - movq mm4, MMWORD [wk(10)] ; mm4=tmp1L - movq mm2, MMWORD [wk(11)] ; mm2=tmp1H + movq mm3, MMWORD [wk(6)] ; mm3=tmp12L + movq mm0, MMWORD [wk(7)] ; mm0=tmp12H + movq mm4, MMWORD [wk(10)] ; mm4=tmp1L + movq mm2, MMWORD [wk(11)] ; mm2=tmp1H - movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 01 11) - movq MMWORD [wk(1)], mm6 ; wk(1)=(02 12 03 13) - movq MMWORD [wk(4)], mm7 ; wk(4)=(60 70 61 71) - movq MMWORD [wk(5)], mm1 ; wk(5)=(62 72 63 73) + movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 01 11) + movq MMWORD [wk(1)], mm6 ; wk(1)=(02 12 03 13) + movq MMWORD [wk(4)], mm7 ; wk(4)=(60 70 61 71) + movq MMWORD [wk(5)], mm1 ; wk(5)=(62 72 63 73) - movq mm5,mm3 - movq mm6,mm0 - paddd mm3,mm4 ; mm3=data2L - paddd mm0,mm2 ; mm0=data2H - psubd mm5,mm4 ; mm5=data5L - psubd mm6,mm2 ; mm6=data5H + movq mm5,mm3 + movq mm6,mm0 + paddd mm3,mm4 ; mm3=data2L + paddd mm0,mm2 ; mm0=data2H + psubd mm5,mm4 ; mm5=data5L + psubd mm6,mm2 ; mm6=data5H - movq mm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm7=[PD_DESCALE_P1] + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm7=[PD_DESCALE_P1] - paddd mm3,mm7 - paddd mm0,mm7 - psrad mm3,DESCALE_P1 - psrad mm0,DESCALE_P1 - paddd mm5,mm7 - paddd mm6,mm7 - psrad mm5,DESCALE_P1 - psrad mm6,DESCALE_P1 + paddd mm3,mm7 + paddd mm0,mm7 + psrad mm3,DESCALE_P1 + psrad mm0,DESCALE_P1 + paddd mm5,mm7 + paddd mm6,mm7 + psrad mm5,DESCALE_P1 + psrad mm6,DESCALE_P1 - packssdw mm3,mm0 ; mm3=data2=(20 21 22 23) - packssdw mm5,mm6 ; mm5=data5=(50 51 52 53) + packssdw mm3,mm0 ; mm3=data2=(20 21 22 23) + packssdw mm5,mm6 ; mm5=data5=(50 51 52 53) - movq mm1, MMWORD [wk(2)] ; mm1=tmp13L - movq mm4, MMWORD [wk(3)] ; mm4=tmp13H - movq mm2, MMWORD [wk(8)] ; mm2=tmp0L - movq mm7, MMWORD [wk(9)] ; mm7=tmp0H + movq mm1, MMWORD [wk(2)] ; mm1=tmp13L + movq mm4, MMWORD [wk(3)] ; mm4=tmp13H + movq mm2, MMWORD [wk(8)] ; mm2=tmp0L + movq mm7, MMWORD [wk(9)] ; mm7=tmp0H - movq mm0,mm1 - movq mm6,mm4 - paddd mm1,mm2 ; mm1=data3L - paddd mm4,mm7 ; mm4=data3H - psubd mm0,mm2 ; mm0=data4L - psubd mm6,mm7 ; mm6=data4H + movq mm0,mm1 + movq mm6,mm4 + paddd mm1,mm2 ; mm1=data3L + paddd mm4,mm7 ; mm4=data3H + psubd mm0,mm2 ; mm0=data4L + psubd mm6,mm7 ; mm6=data4H - movq mm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm2=[PD_DESCALE_P1] + movq mm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; mm2=[PD_DESCALE_P1] - paddd mm1,mm2 - paddd mm4,mm2 - psrad mm1,DESCALE_P1 - psrad mm4,DESCALE_P1 - paddd mm0,mm2 - paddd mm6,mm2 - psrad mm0,DESCALE_P1 - psrad mm6,DESCALE_P1 + paddd mm1,mm2 + paddd mm4,mm2 + psrad mm1,DESCALE_P1 + psrad mm4,DESCALE_P1 + paddd mm0,mm2 + paddd mm6,mm2 + psrad mm0,DESCALE_P1 + psrad mm6,DESCALE_P1 - packssdw mm1,mm4 ; mm1=data3=(30 31 32 33) - packssdw mm0,mm6 ; mm0=data4=(40 41 42 43) + packssdw mm1,mm4 ; mm1=data3=(30 31 32 33) + packssdw mm0,mm6 ; mm0=data4=(40 41 42 43) - movq mm7, MMWORD [wk(0)] ; mm7=(00 10 01 11) - movq mm2, MMWORD [wk(1)] ; mm2=(02 12 03 13) + movq mm7, MMWORD [wk(0)] ; mm7=(00 10 01 11) + movq mm2, MMWORD [wk(1)] ; mm2=(02 12 03 13) - movq mm4,mm3 ; transpose coefficients(phase 1) - punpcklwd mm3,mm1 ; mm3=(20 30 21 31) - punpckhwd mm4,mm1 ; mm4=(22 32 23 33) - movq mm6,mm0 ; transpose coefficients(phase 1) - punpcklwd mm0,mm5 ; mm0=(40 50 41 51) - punpckhwd mm6,mm5 ; mm6=(42 52 43 53) + movq mm4,mm3 ; transpose coefficients(phase 1) + punpcklwd mm3,mm1 ; mm3=(20 30 21 31) + punpckhwd mm4,mm1 ; mm4=(22 32 23 33) + movq mm6,mm0 ; transpose coefficients(phase 1) + punpcklwd mm0,mm5 ; mm0=(40 50 41 51) + punpckhwd mm6,mm5 ; mm6=(42 52 43 53) - movq mm1,mm7 ; transpose coefficients(phase 2) - punpckldq mm7,mm3 ; mm7=(00 10 20 30) - punpckhdq mm1,mm3 ; mm1=(01 11 21 31) - movq mm5,mm2 ; transpose coefficients(phase 2) - punpckldq mm2,mm4 ; mm2=(02 12 22 32) - punpckhdq mm5,mm4 ; mm5=(03 13 23 33) + movq mm1,mm7 ; transpose coefficients(phase 2) + punpckldq mm7,mm3 ; mm7=(00 10 20 30) + punpckhdq mm1,mm3 ; mm1=(01 11 21 31) + movq mm5,mm2 ; transpose coefficients(phase 2) + punpckldq mm2,mm4 ; mm2=(02 12 22 32) + punpckhdq mm5,mm4 ; mm5=(03 13 23 33) - movq mm3, MMWORD [wk(4)] ; mm3=(60 70 61 71) - movq mm4, MMWORD [wk(5)] ; mm4=(62 72 63 73) + movq mm3, MMWORD [wk(4)] ; mm3=(60 70 61 71) + movq mm4, MMWORD [wk(5)] ; mm4=(62 72 63 73) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm7 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm7 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm5 - movq mm7,mm0 ; transpose coefficients(phase 2) - punpckldq mm0,mm3 ; mm0=(40 50 60 70) - punpckhdq mm7,mm3 ; mm7=(41 51 61 71) - movq mm1,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm4 ; mm6=(42 52 62 72) - punpckhdq mm1,mm4 ; mm1=(43 53 63 73) + movq mm7,mm0 ; transpose coefficients(phase 2) + punpckldq mm0,mm3 ; mm0=(40 50 60 70) + punpckhdq mm7,mm3 ; mm7=(41 51 61 71) + movq mm1,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm4 ; mm6=(42 52 62 72) + punpckhdq mm1,mm4 ; mm1=(43 53 63 73) - movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm7 - movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm6 - movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(0,1,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,1,edi,SIZEOF_JCOEF)], mm7 + movq MMWORD [MMBLOCK(2,1,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(3,1,edi,SIZEOF_JCOEF)], mm1 .nextcolumn: - add esi, byte 4*SIZEOF_JCOEF ; coef_block - add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr - add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; JCOEF * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .rowloop: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movq mm4,mm1 ; mm1=in2=z2 - movq mm5,mm1 - punpcklwd mm4,mm3 ; mm3=in6=z3 - punpckhwd mm5,mm3 - movq mm1,mm4 - movq mm3,mm5 - pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L - pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H - pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L - pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H + movq mm4,mm1 ; mm1=in2=z2 + movq mm5,mm1 + punpcklwd mm4,mm3 ; mm3=in6=z3 + punpckhwd mm5,mm3 + movq mm1,mm4 + movq mm3,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F130_F054)] ; mm4=tmp3L + pmaddwd mm5,[GOTOFF(ebx,PW_F130_F054)] ; mm5=tmp3H + pmaddwd mm1,[GOTOFF(ebx,PW_F054_MF130)] ; mm1=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F054_MF130)] ; mm3=tmp2H - movq mm6,mm0 - paddw mm0,mm2 ; mm0=in0+in4 - psubw mm6,mm2 ; mm6=in0-in4 + movq mm6,mm0 + paddw mm0,mm2 ; mm0=in0+in4 + psubw mm6,mm2 ; mm6=in0-in4 - pxor mm7,mm7 - pxor mm2,mm2 - punpcklwd mm7,mm0 ; mm7=tmp0L - punpckhwd mm2,mm0 ; mm2=tmp0H - psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS - psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS + pxor mm7,mm7 + pxor mm2,mm2 + punpcklwd mm7,mm0 ; mm7=tmp0L + punpckhwd mm2,mm0 ; mm2=tmp0H + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + psrad mm2,(16-CONST_BITS) ; psrad mm2,16 & pslld mm2,CONST_BITS - movq mm0,mm7 - paddd mm7,mm4 ; mm7=tmp10L - psubd mm0,mm4 ; mm0=tmp13L - movq mm4,mm2 - paddd mm2,mm5 ; mm2=tmp10H - psubd mm4,mm5 ; mm4=tmp13H + movq mm0,mm7 + paddd mm7,mm4 ; mm7=tmp10L + psubd mm0,mm4 ; mm0=tmp13L + movq mm4,mm2 + paddd mm2,mm5 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp13H - movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L - movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H - movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L - movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H + movq MMWORD [wk(0)], mm7 ; wk(0)=tmp10L + movq MMWORD [wk(1)], mm2 ; wk(1)=tmp10H + movq MMWORD [wk(2)], mm0 ; wk(2)=tmp13L + movq MMWORD [wk(3)], mm4 ; wk(3)=tmp13H - pxor mm5,mm5 - pxor mm7,mm7 - punpcklwd mm5,mm6 ; mm5=tmp1L - punpckhwd mm7,mm6 ; mm7=tmp1H - psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS - psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS + pxor mm5,mm5 + pxor mm7,mm7 + punpcklwd mm5,mm6 ; mm5=tmp1L + punpckhwd mm7,mm6 ; mm7=tmp1H + psrad mm5,(16-CONST_BITS) ; psrad mm5,16 & pslld mm5,CONST_BITS + psrad mm7,(16-CONST_BITS) ; psrad mm7,16 & pslld mm7,CONST_BITS - movq mm2,mm5 - paddd mm5,mm1 ; mm5=tmp11L - psubd mm2,mm1 ; mm2=tmp12L - movq mm0,mm7 - paddd mm7,mm3 ; mm7=tmp11H - psubd mm0,mm3 ; mm0=tmp12H + movq mm2,mm5 + paddd mm5,mm1 ; mm5=tmp11L + psubd mm2,mm1 ; mm2=tmp12L + movq mm0,mm7 + paddd mm7,mm3 ; mm7=tmp11H + psubd mm0,mm3 ; mm0=tmp12H - movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L - movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H - movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L - movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H + movq MMWORD [wk(4)], mm5 ; wk(4)=tmp11L + movq MMWORD [wk(5)], mm7 ; wk(5)=tmp11H + movq MMWORD [wk(6)], mm2 ; wk(6)=tmp12L + movq MMWORD [wk(7)], mm0 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm6, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - movq mm5,mm6 - movq mm7,mm4 - paddw mm5,mm3 ; mm5=z3 - paddw mm7,mm1 ; mm7=z4 + movq mm5,mm6 + movq mm7,mm4 + paddw mm5,mm3 ; mm5=z3 + paddw mm7,mm1 ; mm7=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movq mm2,mm5 - movq mm0,mm5 - punpcklwd mm2,mm7 - punpckhwd mm0,mm7 - movq mm5,mm2 - movq mm7,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L - pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H - pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L - pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H + movq mm2,mm5 + movq mm0,mm5 + punpcklwd mm2,mm7 + punpckhwd mm0,mm7 + movq mm5,mm2 + movq mm7,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF078_F117)] ; mm2=z3L + pmaddwd mm0,[GOTOFF(ebx,PW_MF078_F117)] ; mm0=z3H + pmaddwd mm5,[GOTOFF(ebx,PW_F117_F078)] ; mm5=z4L + pmaddwd mm7,[GOTOFF(ebx,PW_F117_F078)] ; mm7=z4H - movq MMWORD [wk(10)], mm2 ; wk(10)=z3L - movq MMWORD [wk(11)], mm0 ; wk(11)=z3H + movq MMWORD [wk(10)], mm2 ; wk(10)=z3L + movq MMWORD [wk(11)], mm0 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movq mm2,mm3 - movq mm0,mm3 - punpcklwd mm2,mm4 - punpckhwd mm0,mm4 - movq mm3,mm2 - movq mm4,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L - pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H - pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L - pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H + movq mm2,mm3 + movq mm0,mm3 + punpcklwd mm2,mm4 + punpckhwd mm0,mm4 + movq mm3,mm2 + movq mm4,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF060_MF089)] ; mm2=tmp0L + pmaddwd mm0,[GOTOFF(ebx,PW_MF060_MF089)] ; mm0=tmp0H + pmaddwd mm3,[GOTOFF(ebx,PW_MF089_F060)] ; mm3=tmp3L + pmaddwd mm4,[GOTOFF(ebx,PW_MF089_F060)] ; mm4=tmp3H - paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L - paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H - paddd mm3,mm5 ; mm3=tmp3L - paddd mm4,mm7 ; mm4=tmp3H + paddd mm2, MMWORD [wk(10)] ; mm2=tmp0L + paddd mm0, MMWORD [wk(11)] ; mm0=tmp0H + paddd mm3,mm5 ; mm3=tmp3L + paddd mm4,mm7 ; mm4=tmp3H - movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L - movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H + movq MMWORD [wk(8)], mm2 ; wk(8)=tmp0L + movq MMWORD [wk(9)], mm0 ; wk(9)=tmp0H - movq mm2,mm1 - movq mm0,mm1 - punpcklwd mm2,mm6 - punpckhwd mm0,mm6 - movq mm1,mm2 - movq mm6,mm0 - pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L - pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H - pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L - pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H + movq mm2,mm1 + movq mm0,mm1 + punpcklwd mm2,mm6 + punpckhwd mm0,mm6 + movq mm1,mm2 + movq mm6,mm0 + pmaddwd mm2,[GOTOFF(ebx,PW_MF050_MF256)] ; mm2=tmp1L + pmaddwd mm0,[GOTOFF(ebx,PW_MF050_MF256)] ; mm0=tmp1H + pmaddwd mm1,[GOTOFF(ebx,PW_MF256_F050)] ; mm1=tmp2L + pmaddwd mm6,[GOTOFF(ebx,PW_MF256_F050)] ; mm6=tmp2H - paddd mm2,mm5 ; mm2=tmp1L - paddd mm0,mm7 ; mm0=tmp1H - paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L - paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H + paddd mm2,mm5 ; mm2=tmp1L + paddd mm0,mm7 ; mm0=tmp1H + paddd mm1, MMWORD [wk(10)] ; mm1=tmp2L + paddd mm6, MMWORD [wk(11)] ; mm6=tmp2H - movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L - movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H + movq MMWORD [wk(10)], mm2 ; wk(10)=tmp1L + movq MMWORD [wk(11)], mm0 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movq mm5, MMWORD [wk(0)] ; mm5=tmp10L - movq mm7, MMWORD [wk(1)] ; mm7=tmp10H + movq mm5, MMWORD [wk(0)] ; mm5=tmp10L + movq mm7, MMWORD [wk(1)] ; mm7=tmp10H - movq mm2,mm5 - movq mm0,mm7 - paddd mm5,mm3 ; mm5=data0L - paddd mm7,mm4 ; mm7=data0H - psubd mm2,mm3 ; mm2=data7L - psubd mm0,mm4 ; mm0=data7H + movq mm2,mm5 + movq mm0,mm7 + paddd mm5,mm3 ; mm5=data0L + paddd mm7,mm4 ; mm7=data0H + psubd mm2,mm3 ; mm2=data7L + psubd mm0,mm4 ; mm0=data7H - movq mm3,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm3=[PD_DESCALE_P2] + movq mm3,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm3=[PD_DESCALE_P2] - paddd mm5,mm3 - paddd mm7,mm3 - psrad mm5,DESCALE_P2 - psrad mm7,DESCALE_P2 - paddd mm2,mm3 - paddd mm0,mm3 - psrad mm2,DESCALE_P2 - psrad mm0,DESCALE_P2 + paddd mm5,mm3 + paddd mm7,mm3 + psrad mm5,DESCALE_P2 + psrad mm7,DESCALE_P2 + paddd mm2,mm3 + paddd mm0,mm3 + psrad mm2,DESCALE_P2 + psrad mm0,DESCALE_P2 - packssdw mm5,mm7 ; mm5=data0=(00 10 20 30) - packssdw mm2,mm0 ; mm2=data7=(07 17 27 37) + packssdw mm5,mm7 ; mm5=data0=(00 10 20 30) + packssdw mm2,mm0 ; mm2=data7=(07 17 27 37) - movq mm4, MMWORD [wk(4)] ; mm4=tmp11L - movq mm3, MMWORD [wk(5)] ; mm3=tmp11H + movq mm4, MMWORD [wk(4)] ; mm4=tmp11L + movq mm3, MMWORD [wk(5)] ; mm3=tmp11H - movq mm7,mm4 - movq mm0,mm3 - paddd mm4,mm1 ; mm4=data1L - paddd mm3,mm6 ; mm3=data1H - psubd mm7,mm1 ; mm7=data6L - psubd mm0,mm6 ; mm0=data6H + movq mm7,mm4 + movq mm0,mm3 + paddd mm4,mm1 ; mm4=data1L + paddd mm3,mm6 ; mm3=data1H + psubd mm7,mm1 ; mm7=data6L + psubd mm0,mm6 ; mm0=data6H - movq mm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm1=[PD_DESCALE_P2] + movq mm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm1=[PD_DESCALE_P2] - paddd mm4,mm1 - paddd mm3,mm1 - psrad mm4,DESCALE_P2 - psrad mm3,DESCALE_P2 - paddd mm7,mm1 - paddd mm0,mm1 - psrad mm7,DESCALE_P2 - psrad mm0,DESCALE_P2 + paddd mm4,mm1 + paddd mm3,mm1 + psrad mm4,DESCALE_P2 + psrad mm3,DESCALE_P2 + paddd mm7,mm1 + paddd mm0,mm1 + psrad mm7,DESCALE_P2 + psrad mm0,DESCALE_P2 - packssdw mm4,mm3 ; mm4=data1=(01 11 21 31) - packssdw mm7,mm0 ; mm7=data6=(06 16 26 36) + packssdw mm4,mm3 ; mm4=data1=(01 11 21 31) + packssdw mm7,mm0 ; mm7=data6=(06 16 26 36) - packsswb mm5,mm7 ; mm5=(00 10 20 30 06 16 26 36) - packsswb mm4,mm2 ; mm4=(01 11 21 31 07 17 27 37) + packsswb mm5,mm7 ; mm5=(00 10 20 30 06 16 26 36) + packsswb mm4,mm2 ; mm4=(01 11 21 31 07 17 27 37) - movq mm6, MMWORD [wk(6)] ; mm6=tmp12L - movq mm1, MMWORD [wk(7)] ; mm1=tmp12H - movq mm3, MMWORD [wk(10)] ; mm3=tmp1L - movq mm0, MMWORD [wk(11)] ; mm0=tmp1H + movq mm6, MMWORD [wk(6)] ; mm6=tmp12L + movq mm1, MMWORD [wk(7)] ; mm1=tmp12H + movq mm3, MMWORD [wk(10)] ; mm3=tmp1L + movq mm0, MMWORD [wk(11)] ; mm0=tmp1H - movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 20 30 06 16 26 36) - movq MMWORD [wk(1)], mm4 ; wk(1)=(01 11 21 31 07 17 27 37) + movq MMWORD [wk(0)], mm5 ; wk(0)=(00 10 20 30 06 16 26 36) + movq MMWORD [wk(1)], mm4 ; wk(1)=(01 11 21 31 07 17 27 37) - movq mm7,mm6 - movq mm2,mm1 - paddd mm6,mm3 ; mm6=data2L - paddd mm1,mm0 ; mm1=data2H - psubd mm7,mm3 ; mm7=data5L - psubd mm2,mm0 ; mm2=data5H + movq mm7,mm6 + movq mm2,mm1 + paddd mm6,mm3 ; mm6=data2L + paddd mm1,mm0 ; mm1=data2H + psubd mm7,mm3 ; mm7=data5L + psubd mm2,mm0 ; mm2=data5H - movq mm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm5=[PD_DESCALE_P2] + movq mm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm5=[PD_DESCALE_P2] - paddd mm6,mm5 - paddd mm1,mm5 - psrad mm6,DESCALE_P2 - psrad mm1,DESCALE_P2 - paddd mm7,mm5 - paddd mm2,mm5 - psrad mm7,DESCALE_P2 - psrad mm2,DESCALE_P2 + paddd mm6,mm5 + paddd mm1,mm5 + psrad mm6,DESCALE_P2 + psrad mm1,DESCALE_P2 + paddd mm7,mm5 + paddd mm2,mm5 + psrad mm7,DESCALE_P2 + psrad mm2,DESCALE_P2 - packssdw mm6,mm1 ; mm6=data2=(02 12 22 32) - packssdw mm7,mm2 ; mm7=data5=(05 15 25 35) + packssdw mm6,mm1 ; mm6=data2=(02 12 22 32) + packssdw mm7,mm2 ; mm7=data5=(05 15 25 35) - movq mm4, MMWORD [wk(2)] ; mm4=tmp13L - movq mm3, MMWORD [wk(3)] ; mm3=tmp13H - movq mm0, MMWORD [wk(8)] ; mm0=tmp0L - movq mm5, MMWORD [wk(9)] ; mm5=tmp0H + movq mm4, MMWORD [wk(2)] ; mm4=tmp13L + movq mm3, MMWORD [wk(3)] ; mm3=tmp13H + movq mm0, MMWORD [wk(8)] ; mm0=tmp0L + movq mm5, MMWORD [wk(9)] ; mm5=tmp0H - movq mm1,mm4 - movq mm2,mm3 - paddd mm4,mm0 ; mm4=data3L - paddd mm3,mm5 ; mm3=data3H - psubd mm1,mm0 ; mm1=data4L - psubd mm2,mm5 ; mm2=data4H + movq mm1,mm4 + movq mm2,mm3 + paddd mm4,mm0 ; mm4=data3L + paddd mm3,mm5 ; mm3=data3H + psubd mm1,mm0 ; mm1=data4L + psubd mm2,mm5 ; mm2=data4H - movq mm0,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm0=[PD_DESCALE_P2] + movq mm0,[GOTOFF(ebx,PD_DESCALE_P2)] ; mm0=[PD_DESCALE_P2] - paddd mm4,mm0 - paddd mm3,mm0 - psrad mm4,DESCALE_P2 - psrad mm3,DESCALE_P2 - paddd mm1,mm0 - paddd mm2,mm0 - psrad mm1,DESCALE_P2 - psrad mm2,DESCALE_P2 + paddd mm4,mm0 + paddd mm3,mm0 + psrad mm4,DESCALE_P2 + psrad mm3,DESCALE_P2 + paddd mm1,mm0 + paddd mm2,mm0 + psrad mm1,DESCALE_P2 + psrad mm2,DESCALE_P2 - movq mm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm5=[PB_CENTERJSAMP] + movq mm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm5=[PB_CENTERJSAMP] - packssdw mm4,mm3 ; mm4=data3=(03 13 23 33) - packssdw mm1,mm2 ; mm1=data4=(04 14 24 34) + packssdw mm4,mm3 ; mm4=data3=(03 13 23 33) + packssdw mm1,mm2 ; mm1=data4=(04 14 24 34) - movq mm0, MMWORD [wk(0)] ; mm0=(00 10 20 30 06 16 26 36) - movq mm3, MMWORD [wk(1)] ; mm3=(01 11 21 31 07 17 27 37) + movq mm0, MMWORD [wk(0)] ; mm0=(00 10 20 30 06 16 26 36) + movq mm3, MMWORD [wk(1)] ; mm3=(01 11 21 31 07 17 27 37) - packsswb mm6,mm1 ; mm6=(02 12 22 32 04 14 24 34) - packsswb mm4,mm7 ; mm4=(03 13 23 33 05 15 25 35) + packsswb mm6,mm1 ; mm6=(02 12 22 32 04 14 24 34) + packsswb mm4,mm7 ; mm4=(03 13 23 33 05 15 25 35) - paddb mm0,mm5 - paddb mm3,mm5 - paddb mm6,mm5 - paddb mm4,mm5 + paddb mm0,mm5 + paddb mm3,mm5 + paddb mm6,mm5 + paddb mm4,mm5 - movq mm2,mm0 ; transpose coefficients(phase 1) - punpcklbw mm0,mm3 ; mm0=(00 01 10 11 20 21 30 31) - punpckhbw mm2,mm3 ; mm2=(06 07 16 17 26 27 36 37) - movq mm1,mm6 ; transpose coefficients(phase 1) - punpcklbw mm6,mm4 ; mm6=(02 03 12 13 22 23 32 33) - punpckhbw mm1,mm4 ; mm1=(04 05 14 15 24 25 34 35) + movq mm2,mm0 ; transpose coefficients(phase 1) + punpcklbw mm0,mm3 ; mm0=(00 01 10 11 20 21 30 31) + punpckhbw mm2,mm3 ; mm2=(06 07 16 17 26 27 36 37) + movq mm1,mm6 ; transpose coefficients(phase 1) + punpcklbw mm6,mm4 ; mm6=(02 03 12 13 22 23 32 33) + punpckhbw mm1,mm4 ; mm1=(04 05 14 15 24 25 34 35) - movq mm7,mm0 ; transpose coefficients(phase 2) - punpcklwd mm0,mm6 ; mm0=(00 01 02 03 10 11 12 13) - punpckhwd mm7,mm6 ; mm7=(20 21 22 23 30 31 32 33) - movq mm5,mm1 ; transpose coefficients(phase 2) - punpcklwd mm1,mm2 ; mm1=(04 05 06 07 14 15 16 17) - punpckhwd mm5,mm2 ; mm5=(24 25 26 27 34 35 36 37) + movq mm7,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm6 ; mm0=(00 01 02 03 10 11 12 13) + punpckhwd mm7,mm6 ; mm7=(20 21 22 23 30 31 32 33) + movq mm5,mm1 ; transpose coefficients(phase 2) + punpcklwd mm1,mm2 ; mm1=(04 05 06 07 14 15 16 17) + punpckhwd mm5,mm2 ; mm5=(24 25 26 27 34 35 36 37) - movq mm3,mm0 ; transpose coefficients(phase 3) - punpckldq mm0,mm1 ; mm0=(00 01 02 03 04 05 06 07) - punpckhdq mm3,mm1 ; mm3=(10 11 12 13 14 15 16 17) - movq mm4,mm7 ; transpose coefficients(phase 3) - punpckldq mm7,mm5 ; mm7=(20 21 22 23 24 25 26 27) - punpckhdq mm4,mm5 ; mm4=(30 31 32 33 34 35 36 37) + movq mm3,mm0 ; transpose coefficients(phase 3) + punpckldq mm0,mm1 ; mm0=(00 01 02 03 04 05 06 07) + punpckhdq mm3,mm1 ; mm3=(10 11 12 13 14 15 16 17) + movq mm4,mm7 ; transpose coefficients(phase 3) + punpckldq mm7,mm5 ; mm7=(20 21 22 23 24 25 26 27) + punpckhdq mm4,mm5 ; mm4=(30 31 32 33 34 35 36 37) - pushpic ebx ; save GOT address + pushpic ebx ; save GOT address - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm3 - mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm7 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm3 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm7 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 - poppic ebx ; restore GOT address + poppic ebx ; restore GOT address - add esi, byte 4*SIZEOF_JCOEF ; wsptr - add edi, byte 4*SIZEOF_JSAMPROW - dec ecx ; ctr - jnz near .rowloop + add esi, byte 4*SIZEOF_JCOEF ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jimmxred.asm b/simd/jimmxred.asm index a2b7103d..5e248369 100644 --- a/simd/jimmxred.asm +++ b/simd/jimmxred.asm @@ -26,74 +26,74 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) -%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) -%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) -%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) %if CONST_BITS == 13 -F_0_211 equ 1730 ; FIX(0.211164243) -F_0_509 equ 4176 ; FIX(0.509795579) -F_0_601 equ 4926 ; FIX(0.601344887) -F_0_720 equ 5906 ; FIX(0.720959822) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_850 equ 6967 ; FIX(0.850430095) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_061 equ 8697 ; FIX(1.061594337) -F_1_272 equ 10426 ; FIX(1.272758580) -F_1_451 equ 11893 ; FIX(1.451774981) -F_1_847 equ 15137 ; FIX(1.847759065) -F_2_172 equ 17799 ; FIX(2.172734803) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_624 equ 29692 ; FIX(3.624509785) +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) -F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) -F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) -F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) -F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) -F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_red_mmx) + alignz 16 + global EXTN(jconst_idct_red_mmx) EXTN(jconst_idct_red_mmx): -PW_F184_MF076 times 2 dw F_1_847,-F_0_765 -PW_F256_F089 times 2 dw F_2_562, F_0_899 -PW_F106_MF217 times 2 dw F_1_061,-F_2_172 -PW_MF060_MF050 times 2 dw -F_0_601,-F_0_509 -PW_F145_MF021 times 2 dw F_1_451,-F_0_211 -PW_F362_MF127 times 2 dw F_3_624,-F_1_272 -PW_F085_MF072 times 2 dw F_0_850,-F_0_720 -PD_DESCALE_P1_4 times 2 dd 1 << (DESCALE_P1_4-1) -PD_DESCALE_P2_4 times 2 dd 1 << (DESCALE_P2_4-1) -PD_DESCALE_P1_2 times 2 dd 1 << (DESCALE_P1_2-1) -PD_DESCALE_P2_2 times 2 dd 1 << (DESCALE_P2_2-1) -PB_CENTERJSAMP times 8 db CENTERJSAMPLE +PW_F184_MF076 times 2 dw F_1_847,-F_0_765 +PW_F256_F089 times 2 dw F_2_562, F_0_899 +PW_F106_MF217 times 2 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 2 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 2 dw F_1_451,-F_0_211 +PW_F362_MF127 times 2 dw F_3_624,-F_1_272 +PW_F085_MF072 times 2 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 2 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 2 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 2 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 2 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 8 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 4x4 output block. @@ -103,388 +103,388 @@ PB_CENTERJSAMP times 8 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF - ; JCOEF workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_JCOEF + ; JCOEF workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_4x4_mmx) + align 16 + global EXTN(jsimd_idct_4x4_mmx) EXTN(jsimd_idct_4x4_mmx): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - pushpic ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + pushpic ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; JCOEF * wsptr - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; JCOEF * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_4X4_MMX - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por mm0,mm1 - packsswb mm0,mm0 - movd eax,mm0 - test eax,eax - jnz short .columnDCT + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm0,mm1 + packsswb mm0,mm0 + movd eax,mm0 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - psllw mm0,PASS1_BITS + psllw mm0,PASS1_BITS - movq mm2,mm0 ; mm0=in0=(00 01 02 03) - punpcklwd mm0,mm0 ; mm0=(00 00 01 01) - punpckhwd mm2,mm2 ; mm2=(02 02 03 03) + movq mm2,mm0 ; mm0=in0=(00 01 02 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm2,mm2 ; mm2=(02 02 03 03) - movq mm1,mm0 - punpckldq mm0,mm0 ; mm0=(00 00 00 00) - punpckhdq mm1,mm1 ; mm1=(01 01 01 01) - movq mm3,mm2 - punpckldq mm2,mm2 ; mm2=(02 02 02 02) - punpckhdq mm3,mm3 ; mm3=(03 03 03 03) + movq mm1,mm0 + punpckldq mm0,mm0 ; mm0=(00 00 00 00) + punpckhdq mm1,mm1 ; mm1=(01 01 01 01) + movq mm3,mm2 + punpckldq mm2,mm2 ; mm2=(02 02 02 02) + punpckhdq mm3,mm3 ; mm3=(03 03 03 03) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 - jmp near .nextcolumn - alignx 16,7 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm2 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Odd part + ; -- Odd part - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm4,mm0 - movq mm5,mm0 - punpcklwd mm4,mm1 - punpckhwd mm5,mm1 - movq mm0,mm4 - movq mm1,mm5 - pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) - pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) - pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) - pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) + movq mm4,mm0 + movq mm5,mm0 + punpcklwd mm4,mm1 + punpckhwd mm5,mm1 + movq mm0,mm4 + movq mm1,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) + pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) + pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) + pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) - movq mm6,mm2 - movq mm7,mm2 - punpcklwd mm6,mm3 - punpckhwd mm7,mm3 - movq mm2,mm6 - movq mm3,mm7 - pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) - pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) - pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) - pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) + movq mm6,mm2 + movq mm7,mm2 + punpcklwd mm6,mm3 + punpckhwd mm7,mm3 + movq mm2,mm6 + movq mm3,mm7 + pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) + pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) + pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) + pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) - paddd mm6,mm4 ; mm6=tmp2L - paddd mm7,mm5 ; mm7=tmp2H - paddd mm2,mm0 ; mm2=tmp0L - paddd mm3,mm1 ; mm3=tmp0H + paddd mm6,mm4 ; mm6=tmp2L + paddd mm7,mm5 ; mm7=tmp2H + paddd mm2,mm0 ; mm2=tmp0L + paddd mm3,mm1 ; mm3=tmp0H - movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L - movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H + movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L + movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H - ; -- Even part + ; -- Even part - movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw mm4, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm5, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm0, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw mm4, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm0, MMWORD [MMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pxor mm1,mm1 - pxor mm2,mm2 - punpcklwd mm1,mm4 ; mm1=tmp0L - punpckhwd mm2,mm4 ; mm2=tmp0H - psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 - psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 + pxor mm1,mm1 + pxor mm2,mm2 + punpcklwd mm1,mm4 ; mm1=tmp0L + punpckhwd mm2,mm4 ; mm2=tmp0H + psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 + psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 - movq mm3,mm5 ; mm5=in2=z2 - punpcklwd mm5,mm0 ; mm0=in6=z3 - punpckhwd mm3,mm0 - pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L - pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H + movq mm3,mm5 ; mm5=in2=z2 + punpcklwd mm5,mm0 ; mm0=in6=z3 + punpckhwd mm3,mm0 + pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H - movq mm4,mm1 - movq mm0,mm2 - paddd mm1,mm5 ; mm1=tmp10L - paddd mm2,mm3 ; mm2=tmp10H - psubd mm4,mm5 ; mm4=tmp12L - psubd mm0,mm3 ; mm0=tmp12H + movq mm4,mm1 + movq mm0,mm2 + paddd mm1,mm5 ; mm1=tmp10L + paddd mm2,mm3 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp12L + psubd mm0,mm3 ; mm0=tmp12H - ; -- Final output stage + ; -- Final output stage - movq mm5,mm1 - movq mm3,mm2 - paddd mm1,mm6 ; mm1=data0L - paddd mm2,mm7 ; mm2=data0H - psubd mm5,mm6 ; mm5=data3L - psubd mm3,mm7 ; mm3=data3H + movq mm5,mm1 + movq mm3,mm2 + paddd mm1,mm6 ; mm1=data0L + paddd mm2,mm7 ; mm2=data0H + psubd mm5,mm6 ; mm5=data3L + psubd mm3,mm7 ; mm3=data3H - movq mm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm6=[PD_DESCALE_P1_4] + movq mm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm6=[PD_DESCALE_P1_4] - paddd mm1,mm6 - paddd mm2,mm6 - psrad mm1,DESCALE_P1_4 - psrad mm2,DESCALE_P1_4 - paddd mm5,mm6 - paddd mm3,mm6 - psrad mm5,DESCALE_P1_4 - psrad mm3,DESCALE_P1_4 + paddd mm1,mm6 + paddd mm2,mm6 + psrad mm1,DESCALE_P1_4 + psrad mm2,DESCALE_P1_4 + paddd mm5,mm6 + paddd mm3,mm6 + psrad mm5,DESCALE_P1_4 + psrad mm3,DESCALE_P1_4 - packssdw mm1,mm2 ; mm1=data0=(00 01 02 03) - packssdw mm5,mm3 ; mm5=data3=(30 31 32 33) + packssdw mm1,mm2 ; mm1=data0=(00 01 02 03) + packssdw mm5,mm3 ; mm5=data3=(30 31 32 33) - movq mm7, MMWORD [wk(0)] ; mm7=tmp0L - movq mm6, MMWORD [wk(1)] ; mm6=tmp0H + movq mm7, MMWORD [wk(0)] ; mm7=tmp0L + movq mm6, MMWORD [wk(1)] ; mm6=tmp0H - movq mm2,mm4 - movq mm3,mm0 - paddd mm4,mm7 ; mm4=data1L - paddd mm0,mm6 ; mm0=data1H - psubd mm2,mm7 ; mm2=data2L - psubd mm3,mm6 ; mm3=data2H + movq mm2,mm4 + movq mm3,mm0 + paddd mm4,mm7 ; mm4=data1L + paddd mm0,mm6 ; mm0=data1H + psubd mm2,mm7 ; mm2=data2L + psubd mm3,mm6 ; mm3=data2H - movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm7=[PD_DESCALE_P1_4] + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; mm7=[PD_DESCALE_P1_4] - paddd mm4,mm7 - paddd mm0,mm7 - psrad mm4,DESCALE_P1_4 - psrad mm0,DESCALE_P1_4 - paddd mm2,mm7 - paddd mm3,mm7 - psrad mm2,DESCALE_P1_4 - psrad mm3,DESCALE_P1_4 + paddd mm4,mm7 + paddd mm0,mm7 + psrad mm4,DESCALE_P1_4 + psrad mm0,DESCALE_P1_4 + paddd mm2,mm7 + paddd mm3,mm7 + psrad mm2,DESCALE_P1_4 + psrad mm3,DESCALE_P1_4 - packssdw mm4,mm0 ; mm4=data1=(10 11 12 13) - packssdw mm2,mm3 ; mm2=data2=(20 21 22 23) + packssdw mm4,mm0 ; mm4=data1=(10 11 12 13) + packssdw mm2,mm3 ; mm2=data2=(20 21 22 23) - movq mm6,mm1 ; transpose coefficients(phase 1) - punpcklwd mm1,mm4 ; mm1=(00 10 01 11) - punpckhwd mm6,mm4 ; mm6=(02 12 03 13) - movq mm7,mm2 ; transpose coefficients(phase 1) - punpcklwd mm2,mm5 ; mm2=(20 30 21 31) - punpckhwd mm7,mm5 ; mm7=(22 32 23 33) + movq mm6,mm1 ; transpose coefficients(phase 1) + punpcklwd mm1,mm4 ; mm1=(00 10 01 11) + punpckhwd mm6,mm4 ; mm6=(02 12 03 13) + movq mm7,mm2 ; transpose coefficients(phase 1) + punpcklwd mm2,mm5 ; mm2=(20 30 21 31) + punpckhwd mm7,mm5 ; mm7=(22 32 23 33) - movq mm0,mm1 ; transpose coefficients(phase 2) - punpckldq mm1,mm2 ; mm1=(00 10 20 30) - punpckhdq mm0,mm2 ; mm0=(01 11 21 31) - movq mm3,mm6 ; transpose coefficients(phase 2) - punpckldq mm6,mm7 ; mm6=(02 12 22 32) - punpckhdq mm3,mm7 ; mm3=(03 13 23 33) + movq mm0,mm1 ; transpose coefficients(phase 2) + punpckldq mm1,mm2 ; mm1=(00 10 20 30) + punpckhdq mm0,mm2 ; mm0=(01 11 21 31) + movq mm3,mm6 ; transpose coefficients(phase 2) + punpckldq mm6,mm7 ; mm6=(02 12 22 32) + punpckhdq mm3,mm7 ; mm3=(03 13 23 33) - movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm1 - movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 - movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm6 - movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 + movq MMWORD [MMBLOCK(0,0,edi,SIZEOF_JCOEF)], mm1 + movq MMWORD [MMBLOCK(1,0,edi,SIZEOF_JCOEF)], mm0 + movq MMWORD [MMBLOCK(2,0,edi,SIZEOF_JCOEF)], mm6 + movq MMWORD [MMBLOCK(3,0,edi,SIZEOF_JCOEF)], mm3 .nextcolumn: - add esi, byte 4*SIZEOF_JCOEF ; coef_block - add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr - add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_ISLOW_MULT_TYPE ; quantptr + add edi, byte 4*DCTSIZE*SIZEOF_JCOEF ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; JCOEF * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] + mov eax, [original_ebp] + lea esi, [workspace] ; JCOEF * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] - ; -- Odd part + ; -- Odd part - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - movq mm4,mm0 - movq mm5,mm0 - punpcklwd mm4,mm1 - punpckhwd mm5,mm1 - movq mm0,mm4 - movq mm1,mm5 - pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) - pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) - pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) - pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) + movq mm4,mm0 + movq mm5,mm0 + punpcklwd mm4,mm1 + punpckhwd mm5,mm1 + movq mm0,mm4 + movq mm1,mm5 + pmaddwd mm4,[GOTOFF(ebx,PW_F256_F089)] ; mm4=(tmp2L) + pmaddwd mm5,[GOTOFF(ebx,PW_F256_F089)] ; mm5=(tmp2H) + pmaddwd mm0,[GOTOFF(ebx,PW_F106_MF217)] ; mm0=(tmp0L) + pmaddwd mm1,[GOTOFF(ebx,PW_F106_MF217)] ; mm1=(tmp0H) - movq mm6,mm2 - movq mm7,mm2 - punpcklwd mm6,mm3 - punpckhwd mm7,mm3 - movq mm2,mm6 - movq mm3,mm7 - pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) - pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) - pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) - pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) + movq mm6,mm2 + movq mm7,mm2 + punpcklwd mm6,mm3 + punpckhwd mm7,mm3 + movq mm2,mm6 + movq mm3,mm7 + pmaddwd mm6,[GOTOFF(ebx,PW_MF060_MF050)] ; mm6=(tmp2L) + pmaddwd mm7,[GOTOFF(ebx,PW_MF060_MF050)] ; mm7=(tmp2H) + pmaddwd mm2,[GOTOFF(ebx,PW_F145_MF021)] ; mm2=(tmp0L) + pmaddwd mm3,[GOTOFF(ebx,PW_F145_MF021)] ; mm3=(tmp0H) - paddd mm6,mm4 ; mm6=tmp2L - paddd mm7,mm5 ; mm7=tmp2H - paddd mm2,mm0 ; mm2=tmp0L - paddd mm3,mm1 ; mm3=tmp0H + paddd mm6,mm4 ; mm6=tmp2L + paddd mm7,mm5 ; mm7=tmp2H + paddd mm2,mm0 ; mm2=tmp0L + paddd mm3,mm1 ; mm3=tmp0H - movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L - movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H + movq MMWORD [wk(0)], mm2 ; wk(0)=tmp0L + movq MMWORD [wk(1)], mm3 ; wk(1)=tmp0H - ; -- Even part + ; -- Even part - movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq mm4, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pxor mm1,mm1 - pxor mm2,mm2 - punpcklwd mm1,mm4 ; mm1=tmp0L - punpckhwd mm2,mm4 ; mm2=tmp0H - psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 - psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 + pxor mm1,mm1 + pxor mm2,mm2 + punpcklwd mm1,mm4 ; mm1=tmp0L + punpckhwd mm2,mm4 ; mm2=tmp0H + psrad mm1,(16-CONST_BITS-1) ; psrad mm1,16 & pslld mm1,CONST_BITS+1 + psrad mm2,(16-CONST_BITS-1) ; psrad mm2,16 & pslld mm2,CONST_BITS+1 - movq mm3,mm5 ; mm5=in2=z2 - punpcklwd mm5,mm0 ; mm0=in6=z3 - punpckhwd mm3,mm0 - pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L - pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H + movq mm3,mm5 ; mm5=in2=z2 + punpcklwd mm5,mm0 ; mm0=in6=z3 + punpckhwd mm3,mm0 + pmaddwd mm5,[GOTOFF(ebx,PW_F184_MF076)] ; mm5=tmp2L + pmaddwd mm3,[GOTOFF(ebx,PW_F184_MF076)] ; mm3=tmp2H - movq mm4,mm1 - movq mm0,mm2 - paddd mm1,mm5 ; mm1=tmp10L - paddd mm2,mm3 ; mm2=tmp10H - psubd mm4,mm5 ; mm4=tmp12L - psubd mm0,mm3 ; mm0=tmp12H + movq mm4,mm1 + movq mm0,mm2 + paddd mm1,mm5 ; mm1=tmp10L + paddd mm2,mm3 ; mm2=tmp10H + psubd mm4,mm5 ; mm4=tmp12L + psubd mm0,mm3 ; mm0=tmp12H - ; -- Final output stage + ; -- Final output stage - movq mm5,mm1 - movq mm3,mm2 - paddd mm1,mm6 ; mm1=data0L - paddd mm2,mm7 ; mm2=data0H - psubd mm5,mm6 ; mm5=data3L - psubd mm3,mm7 ; mm3=data3H + movq mm5,mm1 + movq mm3,mm2 + paddd mm1,mm6 ; mm1=data0L + paddd mm2,mm7 ; mm2=data0H + psubd mm5,mm6 ; mm5=data3L + psubd mm3,mm7 ; mm3=data3H - movq mm6,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm6=[PD_DESCALE_P2_4] + movq mm6,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm6=[PD_DESCALE_P2_4] - paddd mm1,mm6 - paddd mm2,mm6 - psrad mm1,DESCALE_P2_4 - psrad mm2,DESCALE_P2_4 - paddd mm5,mm6 - paddd mm3,mm6 - psrad mm5,DESCALE_P2_4 - psrad mm3,DESCALE_P2_4 + paddd mm1,mm6 + paddd mm2,mm6 + psrad mm1,DESCALE_P2_4 + psrad mm2,DESCALE_P2_4 + paddd mm5,mm6 + paddd mm3,mm6 + psrad mm5,DESCALE_P2_4 + psrad mm3,DESCALE_P2_4 - packssdw mm1,mm2 ; mm1=data0=(00 10 20 30) - packssdw mm5,mm3 ; mm5=data3=(03 13 23 33) + packssdw mm1,mm2 ; mm1=data0=(00 10 20 30) + packssdw mm5,mm3 ; mm5=data3=(03 13 23 33) - movq mm7, MMWORD [wk(0)] ; mm7=tmp0L - movq mm6, MMWORD [wk(1)] ; mm6=tmp0H + movq mm7, MMWORD [wk(0)] ; mm7=tmp0L + movq mm6, MMWORD [wk(1)] ; mm6=tmp0H - movq mm2,mm4 - movq mm3,mm0 - paddd mm4,mm7 ; mm4=data1L - paddd mm0,mm6 ; mm0=data1H - psubd mm2,mm7 ; mm2=data2L - psubd mm3,mm6 ; mm3=data2H + movq mm2,mm4 + movq mm3,mm0 + paddd mm4,mm7 ; mm4=data1L + paddd mm0,mm6 ; mm0=data1H + psubd mm2,mm7 ; mm2=data2L + psubd mm3,mm6 ; mm3=data2H - movq mm7,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm7=[PD_DESCALE_P2_4] + movq mm7,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; mm7=[PD_DESCALE_P2_4] - paddd mm4,mm7 - paddd mm0,mm7 - psrad mm4,DESCALE_P2_4 - psrad mm0,DESCALE_P2_4 - paddd mm2,mm7 - paddd mm3,mm7 - psrad mm2,DESCALE_P2_4 - psrad mm3,DESCALE_P2_4 + paddd mm4,mm7 + paddd mm0,mm7 + psrad mm4,DESCALE_P2_4 + psrad mm0,DESCALE_P2_4 + paddd mm2,mm7 + paddd mm3,mm7 + psrad mm2,DESCALE_P2_4 + psrad mm3,DESCALE_P2_4 - packssdw mm4,mm0 ; mm4=data1=(01 11 21 31) - packssdw mm2,mm3 ; mm2=data2=(02 12 22 32) + packssdw mm4,mm0 ; mm4=data1=(01 11 21 31) + packssdw mm2,mm3 ; mm2=data2=(02 12 22 32) - movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] + movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] - packsswb mm1,mm2 ; mm1=(00 10 20 30 02 12 22 32) - packsswb mm4,mm5 ; mm4=(01 11 21 31 03 13 23 33) - paddb mm1,mm6 - paddb mm4,mm6 + packsswb mm1,mm2 ; mm1=(00 10 20 30 02 12 22 32) + packsswb mm4,mm5 ; mm4=(01 11 21 31 03 13 23 33) + paddb mm1,mm6 + paddb mm4,mm6 - movq mm7,mm1 ; transpose coefficients(phase 1) - punpcklbw mm1,mm4 ; mm1=(00 01 10 11 20 21 30 31) - punpckhbw mm7,mm4 ; mm7=(02 03 12 13 22 23 32 33) + movq mm7,mm1 ; transpose coefficients(phase 1) + punpcklbw mm1,mm4 ; mm1=(00 01 10 11 20 21 30 31) + punpckhbw mm7,mm4 ; mm7=(02 03 12 13 22 23 32 33) - movq mm0,mm1 ; transpose coefficients(phase 2) - punpcklwd mm1,mm7 ; mm1=(00 01 02 03 10 11 12 13) - punpckhwd mm0,mm7 ; mm0=(20 21 22 23 30 31 32 33) + movq mm0,mm1 ; transpose coefficients(phase 2) + punpcklwd mm1,mm7 ; mm1=(00 01 02 03 10 11 12 13) + punpckhwd mm0,mm7 ; mm0=(20 21 22 23 30 31 32 33) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 - movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 + movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 - psrlq mm1,4*BYTE_BIT - psrlq mm0,4*BYTE_BIT + psrlq mm1,4*BYTE_BIT + psrlq mm0,4*BYTE_BIT - mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 - movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movd DWORD [edx+eax*SIZEOF_JSAMPLE], mm1 + movd DWORD [esi+eax*SIZEOF_JSAMPLE], mm0 - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- @@ -497,210 +497,210 @@ EXTN(jsimd_idct_4x4_mmx): ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col - align 16 - global EXTN(jsimd_idct_2x2_mmx) + align 16 + global EXTN(jsimd_idct_2x2_mmx) EXTN(jsimd_idct_2x2_mmx): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov edx, POINTER [dct_table(ebp)] ; quantptr - mov esi, JCOEFPTR [coef_block(ebp)] ; inptr + mov edx, POINTER [dct_table(ebp)] ; quantptr + mov esi, JCOEFPTR [coef_block(ebp)] ; inptr - ; | input: | result: | - ; | 00 01 ** 03 ** 05 ** 07 | | - ; | 10 11 ** 13 ** 15 ** 17 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | - ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | - ; | 50 51 ** 53 ** 55 ** 57 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 70 71 ** 73 ** 75 ** 77 | | + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | - ; -- Odd part + ; -- Odd part - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw mm0, MMWORD [MMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm2, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw mm2, MMWORD [MMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; mm0=(10 11 ** 13), mm1=(30 31 ** 33) - ; mm2=(50 51 ** 53), mm3=(70 71 ** 73) + ; mm0=(10 11 ** 13), mm1=(30 31 ** 33) + ; mm2=(50 51 ** 53), mm3=(70 71 ** 73) - pcmpeqd mm7,mm7 - pslld mm7,WORD_BIT ; mm7={0x0000 0xFFFF 0x0000 0xFFFF} + pcmpeqd mm7,mm7 + pslld mm7,WORD_BIT ; mm7={0x0000 0xFFFF 0x0000 0xFFFF} - movq mm4,mm0 ; mm4=(10 11 ** 13) - movq mm5,mm2 ; mm5=(50 51 ** 53) - punpcklwd mm4,mm1 ; mm4=(10 30 11 31) - punpcklwd mm5,mm3 ; mm5=(50 70 51 71) - pmaddwd mm4,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] + movq mm4,mm0 ; mm4=(10 11 ** 13) + movq mm5,mm2 ; mm5=(50 51 ** 53) + punpcklwd mm4,mm1 ; mm4=(10 30 11 31) + punpcklwd mm5,mm3 ; mm5=(50 70 51 71) + pmaddwd mm4,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] - psrld mm0,WORD_BIT ; mm0=(11 -- 13 --) - pand mm1,mm7 ; mm1=(-- 31 -- 33) - psrld mm2,WORD_BIT ; mm2=(51 -- 53 --) - pand mm3,mm7 ; mm3=(-- 71 -- 73) - por mm0,mm1 ; mm0=(11 31 13 33) - por mm2,mm3 ; mm2=(51 71 53 73) - pmaddwd mm0,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd mm2,[GOTOFF(ebx,PW_F085_MF072)] + psrld mm0,WORD_BIT ; mm0=(11 -- 13 --) + pand mm1,mm7 ; mm1=(-- 31 -- 33) + psrld mm2,WORD_BIT ; mm2=(51 -- 53 --) + pand mm3,mm7 ; mm3=(-- 71 -- 73) + por mm0,mm1 ; mm0=(11 31 13 33) + por mm2,mm3 ; mm2=(51 71 53 73) + pmaddwd mm0,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm2,[GOTOFF(ebx,PW_F085_MF072)] - paddd mm4,mm5 ; mm4=tmp0[col0 col1] + paddd mm4,mm5 ; mm4=tmp0[col0 col1] - movq mm6, MMWORD [MMBLOCK(1,1,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(3,1,esi,SIZEOF_JCOEF)] - pmullw mm6, MMWORD [MMBLOCK(1,1,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm1, MMWORD [MMBLOCK(3,1,edx,SIZEOF_ISLOW_MULT_TYPE)] - movq mm3, MMWORD [MMBLOCK(5,1,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(7,1,esi,SIZEOF_JCOEF)] - pmullw mm3, MMWORD [MMBLOCK(5,1,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm5, MMWORD [MMBLOCK(7,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm6, MMWORD [MMBLOCK(1,1,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(3,1,esi,SIZEOF_JCOEF)] + pmullw mm6, MMWORD [MMBLOCK(1,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm1, MMWORD [MMBLOCK(3,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm3, MMWORD [MMBLOCK(5,1,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(7,1,esi,SIZEOF_JCOEF)] + pmullw mm3, MMWORD [MMBLOCK(5,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(7,1,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; mm6=(** 15 ** 17), mm1=(** 35 ** 37) - ; mm3=(** 55 ** 57), mm5=(** 75 ** 77) + ; mm6=(** 15 ** 17), mm1=(** 35 ** 37) + ; mm3=(** 55 ** 57), mm5=(** 75 ** 77) - psrld mm6,WORD_BIT ; mm6=(15 -- 17 --) - pand mm1,mm7 ; mm1=(-- 35 -- 37) - psrld mm3,WORD_BIT ; mm3=(55 -- 57 --) - pand mm5,mm7 ; mm5=(-- 75 -- 77) - por mm6,mm1 ; mm6=(15 35 17 37) - por mm3,mm5 ; mm3=(55 75 57 77) - pmaddwd mm6,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd mm3,[GOTOFF(ebx,PW_F085_MF072)] + psrld mm6,WORD_BIT ; mm6=(15 -- 17 --) + pand mm1,mm7 ; mm1=(-- 35 -- 37) + psrld mm3,WORD_BIT ; mm3=(55 -- 57 --) + pand mm5,mm7 ; mm5=(-- 75 -- 77) + por mm6,mm1 ; mm6=(15 35 17 37) + por mm3,mm5 ; mm3=(55 75 57 77) + pmaddwd mm6,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm3,[GOTOFF(ebx,PW_F085_MF072)] - paddd mm0,mm2 ; mm0=tmp0[col1 col3] - paddd mm6,mm3 ; mm6=tmp0[col5 col7] + paddd mm0,mm2 ; mm0=tmp0[col1 col3] + paddd mm6,mm3 ; mm6=tmp0[col5 col7] - ; -- Even part + ; -- Even part - movq mm1, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(0,1,esi,SIZEOF_JCOEF)] - pmullw mm1, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw mm5, MMWORD [MMBLOCK(0,1,edx,SIZEOF_ISLOW_MULT_TYPE)] + movq mm1, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(0,1,esi,SIZEOF_JCOEF)] + pmullw mm1, MMWORD [MMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw mm5, MMWORD [MMBLOCK(0,1,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; mm1=(00 01 ** 03), mm5=(** 05 ** 07) + ; mm1=(00 01 ** 03), mm5=(** 05 ** 07) - movq mm2,mm1 ; mm2=(00 01 ** 03) - pslld mm1,WORD_BIT ; mm1=(-- 00 -- **) - psrad mm1,(WORD_BIT-CONST_BITS-2) ; mm1=tmp10[col0 ****] + movq mm2,mm1 ; mm2=(00 01 ** 03) + pslld mm1,WORD_BIT ; mm1=(-- 00 -- **) + psrad mm1,(WORD_BIT-CONST_BITS-2) ; mm1=tmp10[col0 ****] - pand mm2,mm7 ; mm2=(-- 01 -- 03) - pand mm5,mm7 ; mm5=(-- 05 -- 07) - psrad mm2,(WORD_BIT-CONST_BITS-2) ; mm2=tmp10[col1 col3] - psrad mm5,(WORD_BIT-CONST_BITS-2) ; mm5=tmp10[col5 col7] + pand mm2,mm7 ; mm2=(-- 01 -- 03) + pand mm5,mm7 ; mm5=(-- 05 -- 07) + psrad mm2,(WORD_BIT-CONST_BITS-2) ; mm2=tmp10[col1 col3] + psrad mm5,(WORD_BIT-CONST_BITS-2) ; mm5=tmp10[col5 col7] - ; -- Final output stage + ; -- Final output stage - movq mm3,mm1 - paddd mm1,mm4 ; mm1=data0[col0 ****]=(A0 **) - psubd mm3,mm4 ; mm3=data1[col0 ****]=(B0 **) - punpckldq mm1,mm3 ; mm1=(A0 B0) + movq mm3,mm1 + paddd mm1,mm4 ; mm1=data0[col0 ****]=(A0 **) + psubd mm3,mm4 ; mm3=data1[col0 ****]=(B0 **) + punpckldq mm1,mm3 ; mm1=(A0 B0) - movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; mm7=[PD_DESCALE_P1_2] + movq mm7,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; mm7=[PD_DESCALE_P1_2] - movq mm4,mm2 - movq mm3,mm5 - paddd mm2,mm0 ; mm2=data0[col1 col3]=(A1 A3) - paddd mm5,mm6 ; mm5=data0[col5 col7]=(A5 A7) - psubd mm4,mm0 ; mm4=data1[col1 col3]=(B1 B3) - psubd mm3,mm6 ; mm3=data1[col5 col7]=(B5 B7) + movq mm4,mm2 + movq mm3,mm5 + paddd mm2,mm0 ; mm2=data0[col1 col3]=(A1 A3) + paddd mm5,mm6 ; mm5=data0[col5 col7]=(A5 A7) + psubd mm4,mm0 ; mm4=data1[col1 col3]=(B1 B3) + psubd mm3,mm6 ; mm3=data1[col5 col7]=(B5 B7) - paddd mm1,mm7 - psrad mm1,DESCALE_P1_2 + paddd mm1,mm7 + psrad mm1,DESCALE_P1_2 - paddd mm2,mm7 - paddd mm5,mm7 - psrad mm2,DESCALE_P1_2 - psrad mm5,DESCALE_P1_2 - paddd mm4,mm7 - paddd mm3,mm7 - psrad mm4,DESCALE_P1_2 - psrad mm3,DESCALE_P1_2 + paddd mm2,mm7 + paddd mm5,mm7 + psrad mm2,DESCALE_P1_2 + psrad mm5,DESCALE_P1_2 + paddd mm4,mm7 + paddd mm3,mm7 + psrad mm4,DESCALE_P1_2 + psrad mm3,DESCALE_P1_2 - ; ---- Pass 2: process rows, store into output array. + ; ---- Pass 2: process rows, store into output array. - mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(ebp)] + mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(ebp)] - ; | input:| result:| - ; | A0 B0 | | - ; | A1 B1 | C0 C1 | - ; | A3 B3 | D0 D1 | - ; | A5 B5 | | - ; | A7 B7 | | + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | - ; -- Odd part + ; -- Odd part - packssdw mm2,mm4 ; mm2=(A1 A3 B1 B3) - packssdw mm5,mm3 ; mm5=(A5 A7 B5 B7) - pmaddwd mm2,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] + packssdw mm2,mm4 ; mm2=(A1 A3 B1 B3) + packssdw mm5,mm3 ; mm5=(A5 A7 B5 B7) + pmaddwd mm2,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd mm5,[GOTOFF(ebx,PW_F085_MF072)] - paddd mm2,mm5 ; mm2=tmp0[row0 row1] + paddd mm2,mm5 ; mm2=tmp0[row0 row1] - ; -- Even part + ; -- Even part - pslld mm1,(CONST_BITS+2) ; mm1=tmp10[row0 row1] + pslld mm1,(CONST_BITS+2) ; mm1=tmp10[row0 row1] - ; -- Final output stage + ; -- Final output stage - movq mm0,[GOTOFF(ebx,PD_DESCALE_P2_2)] ; mm0=[PD_DESCALE_P2_2] + movq mm0,[GOTOFF(ebx,PD_DESCALE_P2_2)] ; mm0=[PD_DESCALE_P2_2] - movq mm6,mm1 - paddd mm1,mm2 ; mm1=data0[row0 row1]=(C0 C1) - psubd mm6,mm2 ; mm6=data1[row0 row1]=(D0 D1) + movq mm6,mm1 + paddd mm1,mm2 ; mm1=data0[row0 row1]=(C0 C1) + psubd mm6,mm2 ; mm6=data1[row0 row1]=(D0 D1) - paddd mm1,mm0 - paddd mm6,mm0 - psrad mm1,DESCALE_P2_2 - psrad mm6,DESCALE_P2_2 + paddd mm1,mm0 + paddd mm6,mm0 + psrad mm1,DESCALE_P2_2 + psrad mm6,DESCALE_P2_2 - movq mm7,mm1 ; transpose coefficients - punpckldq mm1,mm6 ; mm1=(C0 D0) - punpckhdq mm7,mm6 ; mm7=(C1 D1) + movq mm7,mm1 ; transpose coefficients + punpckldq mm1,mm6 ; mm1=(C0 D0) + punpckhdq mm7,mm6 ; mm7=(C1 D1) - packssdw mm1,mm7 ; mm1=(C0 D0 C1 D1) - packsswb mm1,mm1 ; mm1=(C0 D0 C1 D1 C0 D0 C1 D1) - paddb mm1,[GOTOFF(ebx,PB_CENTERJSAMP)] + packssdw mm1,mm7 ; mm1=(C0 D0 C1 D1) + packsswb mm1,mm1 ; mm1=(C0 D0 C1 D1 C0 D0 C1 D1) + paddb mm1,[GOTOFF(ebx,PB_CENTERJSAMP)] - movd ecx,mm1 - movd ebx,mm1 ; ebx=(C0 D0 C1 D1) - shr ecx,2*BYTE_BIT ; ecx=(C1 D1 -- --) + movd ecx,mm1 + movd ebx,mm1 ; ebx=(C0 D0 C1 D1) + shr ecx,2*BYTE_BIT ; ecx=(C1 D1 -- --) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov WORD [edx+eax*SIZEOF_JSAMPLE], bx - mov WORD [esi+eax*SIZEOF_JSAMPLE], cx + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov WORD [edx+eax*SIZEOF_JSAMPLE], bx + mov WORD [esi+eax*SIZEOF_JSAMPLE], cx - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2flt-64.asm b/simd/jiss2flt-64.asm index 6e7e6d42..6d57a018 100644 --- a/simd/jiss2flt-64.asm +++ b/simd/jiss2flt-64.asm @@ -26,34 +26,34 @@ ; -------------------------------------------------------------------------- -%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) - shufps %1,%2,0x44 +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 %endmacro -%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) - shufps %1,%2,0xEE +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE %endmacro ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_float_sse2) + alignz 16 + global EXTN(jconst_idct_float_sse2) EXTN(jconst_idct_float_sse2): -PD_1_414 times 4 dd 1.414213562373095048801689 -PD_1_847 times 4 dd 1.847759065022573512256366 -PD_1_082 times 4 dd 1.082392200292393968799446 -PD_M2_613 times 4 dd -2.613125929752753055713286 -PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -67,417 +67,417 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; r12 = JSAMPARRAY output_buf ; r13 = JDIMENSION output_col -%define original_rbp rbp+0 -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT - ; FAST_FLOAT workspace[DCTSIZE2] +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_float_sse2) + align 16 + global EXTN(jsimd_idct_float_sse2) EXTN(jsimd_idct_float_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [workspace] - collect_args - push rbx + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [workspace] + collect_args + push rbx - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. - mov rdx, r10 ; quantptr - mov rsi, r11 ; inptr - lea rdi, [workspace] ; FAST_FLOAT * wsptr - mov rcx, DCTSIZE/4 ; ctr + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr + lea rdi, [workspace] ; FAST_FLOAT * wsptr + mov rcx, DCTSIZE/4 ; ctr .columnloop: %ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE - mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT - movq xmm1, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movq xmm2, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - movq xmm4, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movq xmm6, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - movq xmm7, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - por xmm1,xmm2 - por xmm3,xmm4 - por xmm5,xmm6 - por xmm1,xmm3 - por xmm5,xmm7 - por xmm1,xmm5 - packsswb xmm1,xmm1 - movd eax,xmm1 - test rax,rax - jnz short .columnDCT + movq xmm1, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + movq xmm4, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movq xmm6, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + movq xmm7, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm2 + por xmm3,xmm4 + por xmm5,xmm6 + por xmm1,xmm3 + por xmm5,xmm7 + por xmm1,xmm5 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) - cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm1,xmm0 - movaps xmm2,xmm0 - movaps xmm3,xmm0 + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 - shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) - shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) - shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) - shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) - movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 - jmp near .nextcolumn + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn %endif .columnDCT: - ; -- Even part + ; -- Even part - movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - movq xmm1, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - movq xmm2, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) - psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) - psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) - cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) - cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) - punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) - punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) - psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) - psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) - cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) - cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) + punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) + punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) + cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) + cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[rel PD_1_414] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[rel PD_1_414] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movq xmm2, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movq xmm1, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) - punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) - psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) - psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) - cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) - cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) + punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) + punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) + cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) + cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) - punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) - punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) - psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) - psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) - cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) - cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) + punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) + punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) + psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) + cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) + cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) - mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 + mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[rel PD_1_847] ; xmm0=z5 - mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[rel PD_1_847] ; xmm0=z5 + mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) - addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) - subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) - subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) - unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) - movaps xmm3,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) - unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 - movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 - movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) - movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm0,xmm7 - movaps xmm3,xmm5 - addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) - addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) - subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) - subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) - movaps xmm2,xmm7 ; transpose coefficients(phase 1) - unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) - unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) - movaps xmm4,xmm5 ; transpose coefficients(phase 1) - unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) - unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) - movaps xmm3,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) - unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) - movaps xmm0,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) - unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) - movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) - movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,0,rdi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,rdi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,rdi,SIZEOF_FAST_FLOAT)], xmm0 - movaps xmm6,xmm5 ; transpose coefficients(phase 2) - unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) - unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) - movaps xmm3,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) - unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) - movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm4 - movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(0,1,rdi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,rdi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,rdi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,rdi,SIZEOF_FAST_FLOAT)], xmm3 .nextcolumn: - add rsi, byte 4*SIZEOF_JCOEF ; coef_block - add rdx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr - add rdi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr - dec rcx ; ctr - jnz near .columnloop + add rsi, byte 4*SIZEOF_JCOEF ; coef_block + add rdx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add rdi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec rcx ; ctr + jnz near .columnloop - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] - prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] - prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] - prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov rax, [original_rbp] - lea rsi, [workspace] ; FAST_FLOAT * wsptr - mov rdi, r12 ; (JSAMPROW *) - mov rax, r13 - mov rcx, DCTSIZE/4 ; ctr + mov rax, [original_rbp] + lea rsi, [workspace] ; FAST_FLOAT * wsptr + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 + mov rcx, DCTSIZE/4 ; ctr .rowloop: - ; -- Even part + ; -- Even part - movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[rel PD_1_414] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[rel PD_1_414] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 + mulps xmm2,[rel PD_1_414] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[rel PD_1_847] ; xmm0=z5 - mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[rel PD_1_847] ; xmm0=z5 + mulps xmm3,[rel PD_M2_613] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[rel PD_1_082] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) - addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) - subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) - subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,[rel PD_RNDINT_MAGIC] ; xmm1=[rel PD_RNDINT_MAGIC] - pcmpeqd xmm3,xmm3 - psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} + movaps xmm1,[rel PD_RNDINT_MAGIC] ; xmm1=[rel PD_RNDINT_MAGIC] + pcmpeqd xmm3,xmm3 + psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} - addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) - addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) - addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) - addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) + addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) + addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) + addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) + addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) - pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) - pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) - pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) - pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) - por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) - por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) + pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) + pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) + por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) + por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) - movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 - movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 + movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 + movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm7,xmm1 - movaps xmm5,xmm3 - addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) - addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) - subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) - subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm7,xmm1 + movaps xmm5,xmm3 + addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) + addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) + subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) + subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) - movaps xmm2,[rel PD_RNDINT_MAGIC] ; xmm2=[rel PD_RNDINT_MAGIC] - pcmpeqd xmm4,xmm4 - psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} + movaps xmm2,[rel PD_RNDINT_MAGIC] ; xmm2=[rel PD_RNDINT_MAGIC] + pcmpeqd xmm4,xmm4 + psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} - addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) - addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) - addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) - addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) + addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) + addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) + addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) + addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) - pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) - pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) - pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) - pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) - por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) - por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) + pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) + pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) + por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) + por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) - movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] + movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] - packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) - packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) - paddb xmm6,xmm2 - paddb xmm1,xmm2 + packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) + packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) + paddb xmm6,xmm2 + paddb xmm1,xmm2 - movdqa xmm4,xmm6 ; transpose coefficients(phase 2) - punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - movdqa xmm7,xmm6 ; transpose coefficients(phase 3) - punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm6 ; transpose coefficients(phase 3) + punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] - mov rbx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm7 - mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] - mov rbx, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 - movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm3 + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rbx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm7 + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rbx, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [rbx+rax*SIZEOF_JSAMPLE], xmm3 - add rsi, byte 4*SIZEOF_FAST_FLOAT ; wsptr - add rdi, byte 4*SIZEOF_JSAMPROW - dec rcx ; ctr - jnz near .rowloop + add rsi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add rdi, byte 4*SIZEOF_JSAMPROW + dec rcx ; ctr + jnz near .rowloop - pop rbx - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + pop rbx + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2flt.asm b/simd/jiss2flt.asm index 17bc3633..86c90561 100644 --- a/simd/jiss2flt.asm +++ b/simd/jiss2flt.asm @@ -25,34 +25,34 @@ ; -------------------------------------------------------------------------- -%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) - shufps %1,%2,0x44 +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 %endmacro -%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) - shufps %1,%2,0xEE +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE %endmacro ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_float_sse2) + alignz 16 + global EXTN(jconst_idct_float_sse2) EXTN(jconst_idct_float_sse2): -PD_1_414 times 4 dd 1.414213562373095048801689 -PD_1_847 times 4 dd 1.847759065022573512256366 -PD_1_082 times 4 dd 1.082392200292393968799446 -PD_M2_613 times 4 dd -2.613125929752753055713286 -PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -61,438 +61,438 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT - ; FAST_FLOAT workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_float_sse2) + align 16 + global EXTN(jsimd_idct_float_sse2) EXTN(jsimd_idct_float_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; FAST_FLOAT * wsptr - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT - movq xmm1, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq xmm2, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq xmm4, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq xmm6, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - movq xmm7, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por xmm1,xmm2 - por xmm3,xmm4 - por xmm5,xmm6 - por xmm1,xmm3 - por xmm5,xmm7 - por xmm1,xmm5 - packsswb xmm1,xmm1 - movd eax,xmm1 - test eax,eax - jnz short .columnDCT + movq xmm1, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq xmm4, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq xmm6, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq xmm7, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm2 + por xmm3,xmm4 + por xmm5,xmm6 + por xmm1,xmm3 + por xmm5,xmm7 + por xmm1,xmm5 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) - cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm1,xmm0 - movaps xmm2,xmm0 - movaps xmm3,xmm0 + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 - shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) - shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) - shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) - shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 - jmp near .nextcolumn - alignx 16,7 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq xmm1, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq xmm2, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) - psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) - psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) - cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) - cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpcklwd xmm1,xmm1 ; xmm1=(20 20 21 21 22 22 23 23) + psrad xmm0,(DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23) + cvtdq2ps xmm0,xmm0 ; xmm0=in0=(00 01 02 03) + cvtdq2ps xmm1,xmm1 ; xmm1=in2=(20 21 22 23) - punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) - punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) - psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) - psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) - cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) - cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) + punpcklwd xmm2,xmm2 ; xmm2=(40 40 41 41 42 42 43 43) + punpcklwd xmm3,xmm3 ; xmm3=(60 60 61 61 62 62 63 63) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63) + cvtdq2ps xmm2,xmm2 ; xmm2=in4=(40 41 42 43) + cvtdq2ps xmm3,xmm3 ; xmm3=in6=(60 61 62 63) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[GOTOFF(ebx,PD_1_414)] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movq xmm2, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq xmm1, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + movq xmm2, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq xmm1, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) - punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) - psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) - psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) - cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) - cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) + punpcklwd xmm2,xmm2 ; xmm2=(10 10 11 11 12 12 13 13) + punpcklwd xmm3,xmm3 ; xmm3=(30 30 31 31 32 32 33 33) + psrad xmm2,(DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13) + psrad xmm3,(DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33) + cvtdq2ps xmm2,xmm2 ; xmm2=in1=(10 11 12 13) + cvtdq2ps xmm3,xmm3 ; xmm3=in3=(30 31 32 33) - punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) - punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) - psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) - psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) - cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) - cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) + punpcklwd xmm5,xmm5 ; xmm5=(50 50 51 51 52 52 53 53) + punpcklwd xmm1,xmm1 ; xmm1=(70 70 71 71 72 72 73 73) + psrad xmm5,(DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53) + psrad xmm1,(DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73) + cvtdq2ps xmm5,xmm5 ; xmm5=in5=(50 51 52 53) + cvtdq2ps xmm1,xmm1 ; xmm1=in7=(70 71 72 73) - mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 - mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) - addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) - subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) - subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) - unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) - movaps xmm3,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) - unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 - movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 - movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) - movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm0,xmm7 - movaps xmm3,xmm5 - addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) - addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) - subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) - subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) - movaps xmm2,xmm7 ; transpose coefficients(phase 1) - unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) - unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) - movaps xmm4,xmm5 ; transpose coefficients(phase 1) - unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) - unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) - movaps xmm3,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) - unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) - movaps xmm0,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) - unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) - movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps xmm6,xmm5 ; transpose coefficients(phase 2) - unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) - unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) - movaps xmm3,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) - unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 - movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 .nextcolumn: - add esi, byte 4*SIZEOF_JCOEF ; coef_block - add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr - add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; FAST_FLOAT * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .rowloop: - ; -- Even part + ; -- Even part - movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[GOTOFF(ebx,PD_1_414)] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 - mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) - addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) - subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) - subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm1=[PD_RNDINT_MAGIC] - pcmpeqd xmm3,xmm3 - psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} + movaps xmm1,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm1=[PD_RNDINT_MAGIC] + pcmpeqd xmm3,xmm3 + psrld xmm3,WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..} - addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) - addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) - addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) - addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) + addps xmm6,xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **) + addps xmm7,xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **) + addps xmm0,xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **) + addps xmm5,xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **) - pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) - pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) - pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) - pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) - por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) - por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) + pand xmm6,xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31) + pand xmm0,xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37) + por xmm6,xmm7 ; xmm6=(00 01 10 11 20 21 30 31) + por xmm0,xmm5 ; xmm0=(06 07 16 17 26 27 36 37) - movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 - movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 + movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2 + movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3 - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm7,xmm1 - movaps xmm5,xmm3 - addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) - addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) - subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) - subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm7,xmm1 + movaps xmm5,xmm3 + addps xmm1,xmm2 ; xmm1=data2=(02 12 22 32) + addps xmm3,xmm4 ; xmm3=data4=(04 14 24 34) + subps xmm7,xmm2 ; xmm7=data5=(05 15 25 35) + subps xmm5,xmm4 ; xmm5=data3=(03 13 23 33) - movaps xmm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm2=[PD_RNDINT_MAGIC] - pcmpeqd xmm4,xmm4 - psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} + movaps xmm2,[GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm2=[PD_RNDINT_MAGIC] + pcmpeqd xmm4,xmm4 + psrld xmm4,WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..} - addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) - addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) - addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) - addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) + addps xmm3,xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **) + addps xmm7,xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **) + addps xmm1,xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **) + addps xmm5,xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **) - pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) - pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) - pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) - pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) - por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) - por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) + pand xmm3,xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --) + pslld xmm7,WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35) + pand xmm1,xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --) + pslld xmm5,WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33) + por xmm3,xmm7 ; xmm3=(04 05 14 15 24 25 34 35) + por xmm1,xmm5 ; xmm1=(02 03 12 13 22 23 32 33) - movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] + movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] - packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) - packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) - paddb xmm6,xmm2 - paddb xmm1,xmm2 + packsswb xmm6,xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35) + packsswb xmm1,xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37) + paddb xmm6,xmm2 + paddb xmm1,xmm2 - movdqa xmm4,xmm6 ; transpose coefficients(phase 2) - punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - movdqa xmm7,xmm6 ; transpose coefficients(phase 3) - punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm6 ; transpose coefficients(phase 3) + punpckldq xmm6,xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm7,xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm5,xmm6,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm3,xmm7,0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - pushpic ebx ; save GOT address + pushpic ebx ; save GOT address - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm7 - mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 - movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm3 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm7 + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm3 - poppic ebx ; restore GOT address + poppic ebx ; restore GOT address - add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr - add edi, byte 4*SIZEOF_JSAMPROW - dec ecx ; ctr - jnz near .rowloop + add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2fst-64.asm b/simd/jiss2fst-64.asm index 08875058..432e289d 100644 --- a/simd/jiss2fst-64.asm +++ b/simd/jiss2fst-64.asm @@ -27,31 +27,31 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. -%define PASS1_BITS 2 +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 %if IFAST_SCALE_BITS != PASS1_BITS %error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." %endif %if CONST_BITS == 8 -F_1_082 equ 277 ; FIX(1.082392200) -F_1_414 equ 362 ; FIX(1.414213562) -F_1_847 equ 473 ; FIX(1.847759065) -F_2_613 equ 669 ; FIX(2.613125930) -F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) %else ; NASM cannot do compile-time arithmetic on floating-point constants. -%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) -F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) -F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -59,22 +59,22 @@ F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_idct_ifast_sse2) + alignz 16 + global EXTN(jconst_idct_ifast_sse2) EXTN(jconst_idct_ifast_sse2): -PW_F1414 times 8 dw F_1_414 << CONST_SHIFT -PW_F1847 times 8 dw F_1_847 << CONST_SHIFT -PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT -PW_F1082 times 8 dw F_1_082 << CONST_SHIFT -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F1414 times 8 dw F_1_414 << CONST_SHIFT +PW_F1847 times 8 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 8 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -88,405 +88,405 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; r12 = JSAMPARRAY output_buf ; r13 = JDIMENSION output_col -%define original_rbp rbp+0 -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_idct_ifast_sse2) + align 16 + global EXTN(jsimd_idct_ifast_sse2) EXTN(jsimd_idct_ifast_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov rdx, r10 ; quantptr - mov rsi, r11 ; inptr + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr %ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 - mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - por xmm1,xmm0 - packsswb xmm1,xmm1 - packsswb xmm1,xmm1 - movd eax,xmm1 - test rax,rax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) + movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) - pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) - pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) - pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) - pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) - pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) - pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) - pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) - pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) + pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) + pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) + pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) + pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) + pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) + pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) + pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) + pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 - jmp near .column_end + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 + jmp near .column_end %endif .columnDCT: - ; -- Even part + ; -- Even part - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm4,xmm0 - movdqa xmm5,xmm1 - psubw xmm0,xmm2 ; xmm0=tmp11 - psubw xmm1,xmm3 - paddw xmm4,xmm2 ; xmm4=tmp10 - paddw xmm5,xmm3 ; xmm5=tmp13 + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + psubw xmm0,xmm2 ; xmm0=tmp11 + psubw xmm1,xmm3 + paddw xmm4,xmm2 ; xmm4=tmp10 + paddw xmm5,xmm3 ; xmm5=tmp13 - psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm1,[rel PW_F1414] - psubw xmm1,xmm5 ; xmm1=tmp12 + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[rel PW_F1414] + psubw xmm1,xmm5 ; xmm1=tmp12 - movdqa xmm6,xmm4 - movdqa xmm7,xmm0 - psubw xmm4,xmm5 ; xmm4=tmp3 - psubw xmm0,xmm1 ; xmm0=tmp2 - paddw xmm6,xmm5 ; xmm6=tmp0 - paddw xmm7,xmm1 ; xmm7=tmp1 + movdqa xmm6,xmm4 + movdqa xmm7,xmm0 + psubw xmm4,xmm5 ; xmm4=tmp3 + psubw xmm0,xmm1 ; xmm0=tmp2 + paddw xmm6,xmm5 ; xmm6=tmp0 + paddw xmm7,xmm1 ; xmm7=tmp1 - movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 - ; -- Odd part + ; -- Odd part - movdqa xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - pmullw xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm4,xmm2 - movdqa xmm0,xmm5 - psubw xmm2,xmm1 ; xmm2=z12 - psubw xmm5,xmm3 ; xmm5=z10 - paddw xmm4,xmm1 ; xmm4=z11 - paddw xmm0,xmm3 ; xmm0=z13 + movdqa xmm4,xmm2 + movdqa xmm0,xmm5 + psubw xmm2,xmm1 ; xmm2=z12 + psubw xmm5,xmm3 ; xmm5=z10 + paddw xmm4,xmm1 ; xmm4=z11 + paddw xmm0,xmm3 ; xmm0=z13 - movdqa xmm1,xmm5 ; xmm1=z10(unscaled) - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - psllw xmm5,PRE_MULTIPLY_SCALE_BITS + movdqa xmm1,xmm5 ; xmm1=z10(unscaled) + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm5,PRE_MULTIPLY_SCALE_BITS - movdqa xmm3,xmm4 - psubw xmm4,xmm0 - paddw xmm3,xmm0 ; xmm3=tmp7 + movdqa xmm3,xmm4 + psubw xmm4,xmm0 + paddw xmm3,xmm0 ; xmm3=tmp7 - psllw xmm4,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm4,[rel PW_F1414] ; xmm4=tmp11 + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm4,[rel PW_F1414] ; xmm4=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movdqa xmm0,xmm5 - paddw xmm5,xmm2 - pmulhw xmm5,[rel PW_F1847] ; xmm5=z5 - pmulhw xmm0,[rel PW_MF1613] - pmulhw xmm2,[rel PW_F1082] - psubw xmm0,xmm1 - psubw xmm2,xmm5 ; xmm2=tmp10 - paddw xmm0,xmm5 ; xmm0=tmp12 + movdqa xmm0,xmm5 + paddw xmm5,xmm2 + pmulhw xmm5,[rel PW_F1847] ; xmm5=z5 + pmulhw xmm0,[rel PW_MF1613] + pmulhw xmm2,[rel PW_F1082] + psubw xmm0,xmm1 + psubw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm0,xmm5 ; xmm0=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw xmm0,xmm3 ; xmm0=tmp6 - movdqa xmm1,xmm6 - movdqa xmm5,xmm7 - paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) - paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) - psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) - psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) - psubw xmm4,xmm0 ; xmm4=tmp5 + psubw xmm0,xmm3 ; xmm0=tmp6 + movdqa xmm1,xmm6 + movdqa xmm5,xmm7 + paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) + paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) + psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) + psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) + psubw xmm4,xmm0 ; xmm4=tmp5 - movdqa xmm3,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) - punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) - movdqa xmm0,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) - punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) + movdqa xmm3,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) + punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) + movdqa xmm0,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) - paddw xmm2,xmm4 ; xmm2=tmp4 - movdqa xmm5,xmm7 - movdqa xmm0,xmm1 - paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) - paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) - psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) - psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) + paddw xmm2,xmm4 ; xmm2=tmp4 + movdqa xmm5,xmm7 + movdqa xmm0,xmm1 + paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) + paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) + psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) + psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) - movdqa xmm4,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) - punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) - movdqa xmm2,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm4,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm2,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm0,xmm3 ; transpose coefficients(phase 2) - punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) - punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) - movdqa xmm5,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) - punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) + movdqa xmm0,xmm3 ; transpose coefficients(phase 2) + punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) + punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) + punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) - movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) - movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) - movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) + movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) - movdqa xmm3,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) - punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) - movdqa xmm0,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) + movdqa xmm3,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) + punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) + movdqa xmm0,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) - movdqa xmm4,xmm6 ; transpose coefficients(phase 3) - punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) - punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) - movdqa xmm7,xmm5 ; transpose coefficients(phase 3) - punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) - punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) + movdqa xmm4,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) + movdqa xmm7,xmm5 ; transpose coefficients(phase 3) + punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) - movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 - movdqa xmm4,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) - punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) - movdqa xmm7,xmm3 ; transpose coefficients(phase 3) - punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) - punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) + movdqa xmm7,xmm3 ; transpose coefficients(phase 3) + punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov rax, [original_rbp] - mov rdi, r12 ; (JSAMPROW *) - mov rax, r13 + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 - ; -- Even part + ; -- Even part - ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 + ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 - movdqa xmm2,xmm6 - movdqa xmm0,xmm5 - psubw xmm6,xmm1 ; xmm6=tmp11 - psubw xmm5,xmm3 - paddw xmm2,xmm1 ; xmm2=tmp10 - paddw xmm0,xmm3 ; xmm0=tmp13 + movdqa xmm2,xmm6 + movdqa xmm0,xmm5 + psubw xmm6,xmm1 ; xmm6=tmp11 + psubw xmm5,xmm3 + paddw xmm2,xmm1 ; xmm2=tmp10 + paddw xmm0,xmm3 ; xmm0=tmp13 - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[rel PW_F1414] - psubw xmm5,xmm0 ; xmm5=tmp12 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[rel PW_F1414] + psubw xmm5,xmm0 ; xmm5=tmp12 - movdqa xmm1,xmm2 - movdqa xmm3,xmm6 - psubw xmm2,xmm0 ; xmm2=tmp3 - psubw xmm6,xmm5 ; xmm6=tmp2 - paddw xmm1,xmm0 ; xmm1=tmp0 - paddw xmm3,xmm5 ; xmm3=tmp1 + movdqa xmm1,xmm2 + movdqa xmm3,xmm6 + psubw xmm2,xmm0 ; xmm2=tmp3 + psubw xmm6,xmm5 ; xmm6=tmp2 + paddw xmm1,xmm0 ; xmm1=tmp0 + paddw xmm3,xmm5 ; xmm3=tmp1 - movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 - ; -- Odd part + ; -- Odd part - ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 + ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 - movdqa xmm2,xmm0 - movdqa xmm6,xmm4 - psubw xmm0,xmm7 ; xmm0=z12 - psubw xmm4,xmm5 ; xmm4=z10 - paddw xmm2,xmm7 ; xmm2=z11 - paddw xmm6,xmm5 ; xmm6=z13 + movdqa xmm2,xmm0 + movdqa xmm6,xmm4 + psubw xmm0,xmm7 ; xmm0=z12 + psubw xmm4,xmm5 ; xmm4=z10 + paddw xmm2,xmm7 ; xmm2=z11 + paddw xmm6,xmm5 ; xmm6=z13 - movdqa xmm7,xmm4 ; xmm7=z10(unscaled) - psllw xmm0,PRE_MULTIPLY_SCALE_BITS - psllw xmm4,PRE_MULTIPLY_SCALE_BITS + movdqa xmm7,xmm4 ; xmm7=z10(unscaled) + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm4,PRE_MULTIPLY_SCALE_BITS - movdqa xmm5,xmm2 - psubw xmm2,xmm6 - paddw xmm5,xmm6 ; xmm5=tmp7 + movdqa xmm5,xmm2 + psubw xmm2,xmm6 + paddw xmm5,xmm6 ; xmm5=tmp7 - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm2,[rel PW_F1414] ; xmm2=tmp11 + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm2,[rel PW_F1414] ; xmm2=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movdqa xmm6,xmm4 - paddw xmm4,xmm0 - pmulhw xmm4,[rel PW_F1847] ; xmm4=z5 - pmulhw xmm6,[rel PW_MF1613] - pmulhw xmm0,[rel PW_F1082] - psubw xmm6,xmm7 - psubw xmm0,xmm4 ; xmm0=tmp10 - paddw xmm6,xmm4 ; xmm6=tmp12 + movdqa xmm6,xmm4 + paddw xmm4,xmm0 + pmulhw xmm4,[rel PW_F1847] ; xmm4=z5 + pmulhw xmm6,[rel PW_MF1613] + pmulhw xmm0,[rel PW_F1082] + psubw xmm6,xmm7 + psubw xmm0,xmm4 ; xmm0=tmp10 + paddw xmm6,xmm4 ; xmm6=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw xmm6,xmm5 ; xmm6=tmp6 - movdqa xmm7,xmm1 - movdqa xmm4,xmm3 - paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) - paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) - psraw xmm1,(PASS1_BITS+3) ; descale - psraw xmm3,(PASS1_BITS+3) ; descale - psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) - psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) - psraw xmm7,(PASS1_BITS+3) ; descale - psraw xmm4,(PASS1_BITS+3) ; descale - psubw xmm2,xmm6 ; xmm2=tmp5 + psubw xmm6,xmm5 ; xmm6=tmp6 + movdqa xmm7,xmm1 + movdqa xmm4,xmm3 + paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) + paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) + psraw xmm1,(PASS1_BITS+3) ; descale + psraw xmm3,(PASS1_BITS+3) ; descale + psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) + psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) + psraw xmm7,(PASS1_BITS+3) ; descale + psraw xmm4,(PASS1_BITS+3) ; descale + psubw xmm2,xmm6 ; xmm2=tmp5 - packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 - movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 - paddw xmm0,xmm2 ; xmm0=tmp4 - movdqa xmm4,xmm5 - movdqa xmm7,xmm6 - paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) - paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) - psraw xmm5,(PASS1_BITS+3) ; descale - psraw xmm6,(PASS1_BITS+3) ; descale - psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) - psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) - psraw xmm4,(PASS1_BITS+3) ; descale - psraw xmm7,(PASS1_BITS+3) ; descale + paddw xmm0,xmm2 ; xmm0=tmp4 + movdqa xmm4,xmm5 + movdqa xmm7,xmm6 + paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) + paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) + psraw xmm5,(PASS1_BITS+3) ; descale + psraw xmm6,(PASS1_BITS+3) ; descale + psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) + psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) + psraw xmm4,(PASS1_BITS+3) ; descale + psraw xmm7,(PASS1_BITS+3) ; descale - movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] + movdqa xmm2,[rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] - packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) - packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) - paddb xmm1,xmm2 - paddb xmm3,xmm2 - paddb xmm5,xmm2 - paddb xmm7,xmm2 + paddb xmm1,xmm2 + paddb xmm3,xmm2 + paddb xmm5,xmm2 + paddb xmm7,xmm2 - movdqa xmm0,xmm1 ; transpose coefficients(phase 1) - punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) - punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) - movdqa xmm6,xmm5 ; transpose coefficients(phase 1) - punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) - punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + movdqa xmm0,xmm1 ; transpose coefficients(phase 1) + punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) - movdqa xmm4,xmm1 ; transpose coefficients(phase 2) - punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) - movdqa xmm2,xmm6 ; transpose coefficients(phase 2) - punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + movdqa xmm4,xmm1 ; transpose coefficients(phase 2) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm2,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) - movdqa xmm3,xmm1 ; transpose coefficients(phase 3) - punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - movdqa xmm7,xmm4 ; transpose coefficients(phase 3) - punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) - punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + movdqa xmm3,xmm1 ; transpose coefficients(phase 3) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) - pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) - pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 - mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm7 + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm7 - mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 - mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 + mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret - ret + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2fst.asm b/simd/jiss2fst.asm index b53664d7..0312be20 100644 --- a/simd/jiss2fst.asm +++ b/simd/jiss2fst.asm @@ -26,31 +26,31 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 8 ; 14 is also OK. -%define PASS1_BITS 2 +%define CONST_BITS 8 ; 14 is also OK. +%define PASS1_BITS 2 %if IFAST_SCALE_BITS != PASS1_BITS %error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." %endif %if CONST_BITS == 8 -F_1_082 equ 277 ; FIX(1.082392200) -F_1_414 equ 362 ; FIX(1.414213562) -F_1_847 equ 473 ; FIX(1.847759065) -F_2_613 equ 669 ; FIX(2.613125930) -F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) +F_1_082 equ 277 ; FIX(1.082392200) +F_1_414 equ 362 ; FIX(1.414213562) +F_1_847 equ 473 ; FIX(1.847759065) +F_2_613 equ 669 ; FIX(2.613125930) +F_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) %else ; NASM cannot do compile-time arithmetic on floating-point constants. -%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) -F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) -F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) +%define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) +F_1_082 equ DESCALE(1162209775,30-CONST_BITS) ; FIX(1.082392200) +F_1_414 equ DESCALE(1518500249,30-CONST_BITS) ; FIX(1.414213562) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_613 equ DESCALE(2805822602,30-CONST_BITS) ; FIX(2.613125930) +F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST ; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) ; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) @@ -58,22 +58,22 @@ F_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) %define PRE_MULTIPLY_SCALE_BITS 2 %define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) - alignz 16 - global EXTN(jconst_idct_ifast_sse2) + alignz 16 + global EXTN(jconst_idct_ifast_sse2) EXTN(jconst_idct_ifast_sse2): -PW_F1414 times 8 dw F_1_414 << CONST_SHIFT -PW_F1847 times 8 dw F_1_847 << CONST_SHIFT -PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT -PW_F1082 times 8 dw F_1_082 << CONST_SHIFT -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F1414 times 8 dw F_1_414 << CONST_SHIFT +PW_F1847 times 8 dw F_1_847 << CONST_SHIFT +PW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT +PW_F1082 times 8 dw F_1_082 << CONST_SHIFT +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -82,421 +82,421 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; jpeg_component_info * compptr -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_idct_ifast_sse2) + align 16 + global EXTN(jsimd_idct_ifast_sse2) EXTN(jsimd_idct_ifast_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr %ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por xmm1,xmm0 - packsswb xmm1,xmm1 - packsswb xmm1,xmm1 - movd eax,xmm1 - test eax,eax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) + movdqa xmm7,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm7,xmm7 ; xmm7=(04 04 05 05 06 06 07 07) - pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) - pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) - pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) - pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) - pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) - pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) - pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) - pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) + pshufd xmm6,xmm0,0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) + pshufd xmm2,xmm0,0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) + pshufd xmm5,xmm0,0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) + pshufd xmm0,xmm0,0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) + pshufd xmm1,xmm7,0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) + pshufd xmm4,xmm7,0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) + pshufd xmm3,xmm7,0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) + pshufd xmm7,xmm7,0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 - jmp near .column_end - alignx 16,7 + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 + jmp near .column_end + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm4,xmm0 - movdqa xmm5,xmm1 - psubw xmm0,xmm2 ; xmm0=tmp11 - psubw xmm1,xmm3 - paddw xmm4,xmm2 ; xmm4=tmp10 - paddw xmm5,xmm3 ; xmm5=tmp13 + movdqa xmm4,xmm0 + movdqa xmm5,xmm1 + psubw xmm0,xmm2 ; xmm0=tmp11 + psubw xmm1,xmm3 + paddw xmm4,xmm2 ; xmm4=tmp10 + paddw xmm5,xmm3 ; xmm5=tmp13 - psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm1,[GOTOFF(ebx,PW_F1414)] - psubw xmm1,xmm5 ; xmm1=tmp12 + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[GOTOFF(ebx,PW_F1414)] + psubw xmm1,xmm5 ; xmm1=tmp12 - movdqa xmm6,xmm4 - movdqa xmm7,xmm0 - psubw xmm4,xmm5 ; xmm4=tmp3 - psubw xmm0,xmm1 ; xmm0=tmp2 - paddw xmm6,xmm5 ; xmm6=tmp0 - paddw xmm7,xmm1 ; xmm7=tmp1 + movdqa xmm6,xmm4 + movdqa xmm7,xmm0 + psubw xmm4,xmm5 ; xmm4=tmp3 + psubw xmm0,xmm1 ; xmm0=tmp2 + paddw xmm6,xmm5 ; xmm6=tmp0 + paddw xmm7,xmm1 ; xmm7=tmp1 - movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 - ; -- Odd part + ; -- Odd part - movdqa xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_IFAST_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_IFAST_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_IFAST_MULT_TYPE)] - movdqa xmm4,xmm2 - movdqa xmm0,xmm5 - psubw xmm2,xmm1 ; xmm2=z12 - psubw xmm5,xmm3 ; xmm5=z10 - paddw xmm4,xmm1 ; xmm4=z11 - paddw xmm0,xmm3 ; xmm0=z13 + movdqa xmm4,xmm2 + movdqa xmm0,xmm5 + psubw xmm2,xmm1 ; xmm2=z12 + psubw xmm5,xmm3 ; xmm5=z10 + paddw xmm4,xmm1 ; xmm4=z11 + paddw xmm0,xmm3 ; xmm0=z13 - movdqa xmm1,xmm5 ; xmm1=z10(unscaled) - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - psllw xmm5,PRE_MULTIPLY_SCALE_BITS + movdqa xmm1,xmm5 ; xmm1=z10(unscaled) + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm5,PRE_MULTIPLY_SCALE_BITS - movdqa xmm3,xmm4 - psubw xmm4,xmm0 - paddw xmm3,xmm0 ; xmm3=tmp7 + movdqa xmm3,xmm4 + psubw xmm4,xmm0 + paddw xmm3,xmm0 ; xmm3=tmp7 - psllw xmm4,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm4,[GOTOFF(ebx,PW_F1414)] ; xmm4=tmp11 + psllw xmm4,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm4,[GOTOFF(ebx,PW_F1414)] ; xmm4=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movdqa xmm0,xmm5 - paddw xmm5,xmm2 - pmulhw xmm5,[GOTOFF(ebx,PW_F1847)] ; xmm5=z5 - pmulhw xmm0,[GOTOFF(ebx,PW_MF1613)] - pmulhw xmm2,[GOTOFF(ebx,PW_F1082)] - psubw xmm0,xmm1 - psubw xmm2,xmm5 ; xmm2=tmp10 - paddw xmm0,xmm5 ; xmm0=tmp12 + movdqa xmm0,xmm5 + paddw xmm5,xmm2 + pmulhw xmm5,[GOTOFF(ebx,PW_F1847)] ; xmm5=z5 + pmulhw xmm0,[GOTOFF(ebx,PW_MF1613)] + pmulhw xmm2,[GOTOFF(ebx,PW_F1082)] + psubw xmm0,xmm1 + psubw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm0,xmm5 ; xmm0=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw xmm0,xmm3 ; xmm0=tmp6 - movdqa xmm1,xmm6 - movdqa xmm5,xmm7 - paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) - paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) - psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) - psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) - psubw xmm4,xmm0 ; xmm4=tmp5 + psubw xmm0,xmm3 ; xmm0=tmp6 + movdqa xmm1,xmm6 + movdqa xmm5,xmm7 + paddw xmm6,xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) + paddw xmm7,xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) + psubw xmm1,xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) + psubw xmm5,xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) + psubw xmm4,xmm0 ; xmm4=tmp5 - movdqa xmm3,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) - punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) - movdqa xmm0,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) - punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) + movdqa xmm3,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(00 10 01 11 02 12 03 13) + punpckhwd xmm3,xmm7 ; xmm3=(04 14 05 15 06 16 07 17) + movdqa xmm0,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm1 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm0,xmm1 ; xmm0=(64 74 65 75 66 76 67 77) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) - paddw xmm2,xmm4 ; xmm2=tmp4 - movdqa xmm5,xmm7 - movdqa xmm0,xmm1 - paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) - paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) - psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) - psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) + paddw xmm2,xmm4 ; xmm2=tmp4 + movdqa xmm5,xmm7 + movdqa xmm0,xmm1 + paddw xmm7,xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) + paddw xmm1,xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) + psubw xmm5,xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) + psubw xmm0,xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) - movdqa xmm4,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) - punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) - movdqa xmm2,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm4,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm0 ; xmm7=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm0 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm2,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm5 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm0,xmm3 ; transpose coefficients(phase 2) - punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) - punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) - movdqa xmm5,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) - punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) + movdqa xmm0,xmm3 ; transpose coefficients(phase 2) + punpckldq xmm3,xmm4 ; xmm3=(04 14 24 34 05 15 25 35) + punpckhdq xmm0,xmm4 ; xmm0=(06 16 26 36 07 17 27 37) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=(00 10 20 30 01 11 21 31) + punpckhdq xmm5,xmm7 ; xmm5=(02 12 22 32 03 13 23 33) - movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) - movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) + movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) - movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) + movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) - movdqa xmm3,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) - punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) - movdqa xmm0,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) + movdqa xmm3,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm4 ; xmm1=(40 50 60 70 41 51 61 71) + punpckhdq xmm3,xmm4 ; xmm3=(42 52 62 72 43 53 63 73) + movdqa xmm0,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm7 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm0,xmm7 ; xmm0=(46 56 66 76 47 57 67 77) - movdqa xmm4,xmm6 ; transpose coefficients(phase 3) - punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) - punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) - movdqa xmm7,xmm5 ; transpose coefficients(phase 3) - punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) - punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) + movdqa xmm4,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm4,xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) + movdqa xmm7,xmm5 ; transpose coefficients(phase 3) + punpcklqdq xmm5,xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm7,xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) - movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 - movdqa xmm4,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) - punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) - movdqa xmm7,xmm3 ; transpose coefficients(phase 3) - punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) - punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm4,xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) + movdqa xmm7,xmm3 ; transpose coefficients(phase 3) + punpcklqdq xmm3,xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm7,xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] - ; -- Even part + ; -- Even part - ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 + ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 - movdqa xmm2,xmm6 - movdqa xmm0,xmm5 - psubw xmm6,xmm1 ; xmm6=tmp11 - psubw xmm5,xmm3 - paddw xmm2,xmm1 ; xmm2=tmp10 - paddw xmm0,xmm3 ; xmm0=tmp13 + movdqa xmm2,xmm6 + movdqa xmm0,xmm5 + psubw xmm6,xmm1 ; xmm6=tmp11 + psubw xmm5,xmm3 + paddw xmm2,xmm1 ; xmm2=tmp10 + paddw xmm0,xmm3 ; xmm0=tmp13 - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[GOTOFF(ebx,PW_F1414)] - psubw xmm5,xmm0 ; xmm5=tmp12 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[GOTOFF(ebx,PW_F1414)] + psubw xmm5,xmm0 ; xmm5=tmp12 - movdqa xmm1,xmm2 - movdqa xmm3,xmm6 - psubw xmm2,xmm0 ; xmm2=tmp3 - psubw xmm6,xmm5 ; xmm6=tmp2 - paddw xmm1,xmm0 ; xmm1=tmp0 - paddw xmm3,xmm5 ; xmm3=tmp1 + movdqa xmm1,xmm2 + movdqa xmm3,xmm6 + psubw xmm2,xmm0 ; xmm2=tmp3 + psubw xmm6,xmm5 ; xmm6=tmp2 + paddw xmm1,xmm0 ; xmm1=tmp0 + paddw xmm3,xmm5 ; xmm3=tmp1 - movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 - ; -- Odd part + ; -- Odd part - ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 + ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 - movdqa xmm2,xmm0 - movdqa xmm6,xmm4 - psubw xmm0,xmm7 ; xmm0=z12 - psubw xmm4,xmm5 ; xmm4=z10 - paddw xmm2,xmm7 ; xmm2=z11 - paddw xmm6,xmm5 ; xmm6=z13 + movdqa xmm2,xmm0 + movdqa xmm6,xmm4 + psubw xmm0,xmm7 ; xmm0=z12 + psubw xmm4,xmm5 ; xmm4=z10 + paddw xmm2,xmm7 ; xmm2=z11 + paddw xmm6,xmm5 ; xmm6=z13 - movdqa xmm7,xmm4 ; xmm7=z10(unscaled) - psllw xmm0,PRE_MULTIPLY_SCALE_BITS - psllw xmm4,PRE_MULTIPLY_SCALE_BITS + movdqa xmm7,xmm4 ; xmm7=z10(unscaled) + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm4,PRE_MULTIPLY_SCALE_BITS - movdqa xmm5,xmm2 - psubw xmm2,xmm6 - paddw xmm5,xmm6 ; xmm5=tmp7 + movdqa xmm5,xmm2 + psubw xmm2,xmm6 + paddw xmm5,xmm6 ; xmm5=tmp7 - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm2,[GOTOFF(ebx,PW_F1414)] ; xmm2=tmp11 + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm2,[GOTOFF(ebx,PW_F1414)] ; xmm2=tmp11 - ; To avoid overflow... - ; - ; (Original) - ; tmp12 = -2.613125930 * z10 + z5; - ; - ; (This implementation) - ; tmp12 = (-1.613125930 - 1) * z10 + z5; - ; = -1.613125930 * z10 - z10 + z5; + ; To avoid overflow... + ; + ; (Original) + ; tmp12 = -2.613125930 * z10 + z5; + ; + ; (This implementation) + ; tmp12 = (-1.613125930 - 1) * z10 + z5; + ; = -1.613125930 * z10 - z10 + z5; - movdqa xmm6,xmm4 - paddw xmm4,xmm0 - pmulhw xmm4,[GOTOFF(ebx,PW_F1847)] ; xmm4=z5 - pmulhw xmm6,[GOTOFF(ebx,PW_MF1613)] - pmulhw xmm0,[GOTOFF(ebx,PW_F1082)] - psubw xmm6,xmm7 - psubw xmm0,xmm4 ; xmm0=tmp10 - paddw xmm6,xmm4 ; xmm6=tmp12 + movdqa xmm6,xmm4 + paddw xmm4,xmm0 + pmulhw xmm4,[GOTOFF(ebx,PW_F1847)] ; xmm4=z5 + pmulhw xmm6,[GOTOFF(ebx,PW_MF1613)] + pmulhw xmm0,[GOTOFF(ebx,PW_F1082)] + psubw xmm6,xmm7 + psubw xmm0,xmm4 ; xmm0=tmp10 + paddw xmm6,xmm4 ; xmm6=tmp12 - ; -- Final output stage + ; -- Final output stage - psubw xmm6,xmm5 ; xmm6=tmp6 - movdqa xmm7,xmm1 - movdqa xmm4,xmm3 - paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) - paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) - psraw xmm1,(PASS1_BITS+3) ; descale - psraw xmm3,(PASS1_BITS+3) ; descale - psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) - psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) - psraw xmm7,(PASS1_BITS+3) ; descale - psraw xmm4,(PASS1_BITS+3) ; descale - psubw xmm2,xmm6 ; xmm2=tmp5 + psubw xmm6,xmm5 ; xmm6=tmp6 + movdqa xmm7,xmm1 + movdqa xmm4,xmm3 + paddw xmm1,xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) + paddw xmm3,xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) + psraw xmm1,(PASS1_BITS+3) ; descale + psraw xmm3,(PASS1_BITS+3) ; descale + psubw xmm7,xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) + psubw xmm4,xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) + psraw xmm7,(PASS1_BITS+3) ; descale + psraw xmm4,(PASS1_BITS+3) ; descale + psubw xmm2,xmm6 ; xmm2=tmp5 - packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + packsswb xmm1,xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 - movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 - paddw xmm0,xmm2 ; xmm0=tmp4 - movdqa xmm4,xmm5 - movdqa xmm7,xmm6 - paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) - paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) - psraw xmm5,(PASS1_BITS+3) ; descale - psraw xmm6,(PASS1_BITS+3) ; descale - psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) - psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) - psraw xmm4,(PASS1_BITS+3) ; descale - psraw xmm7,(PASS1_BITS+3) ; descale + paddw xmm0,xmm2 ; xmm0=tmp4 + movdqa xmm4,xmm5 + movdqa xmm7,xmm6 + paddw xmm5,xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) + paddw xmm6,xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) + psraw xmm5,(PASS1_BITS+3) ; descale + psraw xmm6,(PASS1_BITS+3) ; descale + psubw xmm4,xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) + psubw xmm7,xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) + psraw xmm4,(PASS1_BITS+3) ; descale + psraw xmm7,(PASS1_BITS+3) ; descale - movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] + movdqa xmm2,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP] - packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) - packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + packsswb xmm5,xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm7,xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) - paddb xmm1,xmm2 - paddb xmm3,xmm2 - paddb xmm5,xmm2 - paddb xmm7,xmm2 + paddb xmm1,xmm2 + paddb xmm3,xmm2 + paddb xmm5,xmm2 + paddb xmm7,xmm2 - movdqa xmm0,xmm1 ; transpose coefficients(phase 1) - punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) - punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) - movdqa xmm6,xmm5 ; transpose coefficients(phase 1) - punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) - punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + movdqa xmm0,xmm1 ; transpose coefficients(phase 1) + punpcklbw xmm1,xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklbw xmm5,xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm6,xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) - movdqa xmm4,xmm1 ; transpose coefficients(phase 2) - punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) - movdqa xmm2,xmm6 ; transpose coefficients(phase 2) - punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + movdqa xmm4,xmm1 ; transpose coefficients(phase 2) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm2,xmm6 ; transpose coefficients(phase 2) + punpcklwd xmm6,xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm2,xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) - movdqa xmm3,xmm1 ; transpose coefficients(phase 3) - punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - movdqa xmm7,xmm4 ; transpose coefficients(phase 3) - punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) - punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + movdqa xmm3,xmm1 ; transpose coefficients(phase 3) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm3,xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm7,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm7,xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) - pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) - pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + pshufd xmm5,xmm1,0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm3,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm6,xmm4,0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm2,xmm7,0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 - mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm7 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm7 - mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 - mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 + mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2int-64.asm b/simd/jiss2int-64.asm index 13764d6a..10e95213 100644 --- a/simd/jiss2int-64.asm +++ b/simd/jiss2int-64.asm @@ -27,67 +27,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_islow_sse2) + alignz 16 + global EXTN(jconst_idct_islow_sse2) EXTN(jconst_idct_islow_sse2): -PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -101,748 +101,748 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; r12 = JSAMPARRAY output_buf ; r13 = JDIMENSION output_col -%define original_rbp rbp+0 -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 12 +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 12 - align 16 - global EXTN(jsimd_idct_islow_sse2) + align 16 + global EXTN(jsimd_idct_islow_sse2) EXTN(jsimd_idct_islow_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov rdx, r10 ; quantptr - mov rsi, r11 ; inptr + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr %ifndef NO_ZERO_COLUMN_TEST_ISLOW_SSE2 - mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz near .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - por xmm1,xmm0 - packsswb xmm1,xmm1 - packsswb xmm1,xmm1 - movd eax,xmm1 - test rax,rax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test rax,rax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm5, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - pmullw xmm5, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - psllw xmm5,PASS1_BITS + psllw xmm5,PASS1_BITS - movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) - punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) + movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) + punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) - pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) - pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) - pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) - pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) - pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) - pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) - pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) - pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) + pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) + pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) + pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) + pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) + pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) + pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) + pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) + pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) - movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 - movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 - movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 - movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 - jmp near .column_end + movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + jmp near .column_end %endif .columnDCT: - ; -- Even part + ; -- Even part - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movdqa xmm4,xmm1 ; xmm1=in2=z2 - movdqa xmm5,xmm1 - punpcklwd xmm4,xmm3 ; xmm3=in6=z3 - punpckhwd xmm5,xmm3 - movdqa xmm1,xmm4 - movdqa xmm3,xmm5 - pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=tmp3L - pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H - pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L - pmaddwd xmm3,[rel PW_F054_MF130] ; xmm3=tmp2H + movdqa xmm4,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm4,xmm3 ; xmm3=in6=z3 + punpckhwd xmm5,xmm3 + movdqa xmm1,xmm4 + movdqa xmm3,xmm5 + pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=tmp3L + pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm3,[rel PW_F054_MF130] ; xmm3=tmp2H - movdqa xmm6,xmm0 - paddw xmm0,xmm2 ; xmm0=in0+in4 - psubw xmm6,xmm2 ; xmm6=in0-in4 + movdqa xmm6,xmm0 + paddw xmm0,xmm2 ; xmm0=in0+in4 + psubw xmm6,xmm2 ; xmm6=in0-in4 - pxor xmm7,xmm7 - pxor xmm2,xmm2 - punpcklwd xmm7,xmm0 ; xmm7=tmp0L - punpckhwd xmm2,xmm0 ; xmm2=tmp0H - psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS - psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS + pxor xmm7,xmm7 + pxor xmm2,xmm2 + punpcklwd xmm7,xmm0 ; xmm7=tmp0L + punpckhwd xmm2,xmm0 ; xmm2=tmp0H + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS - movdqa xmm0,xmm7 - paddd xmm7,xmm4 ; xmm7=tmp10L - psubd xmm0,xmm4 ; xmm0=tmp13L - movdqa xmm4,xmm2 - paddd xmm2,xmm5 ; xmm2=tmp10H - psubd xmm4,xmm5 ; xmm4=tmp13H + movdqa xmm0,xmm7 + paddd xmm7,xmm4 ; xmm7=tmp10L + psubd xmm0,xmm4 ; xmm0=tmp13L + movdqa xmm4,xmm2 + paddd xmm2,xmm5 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp13H - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L - movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H - movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L - movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H - pxor xmm5,xmm5 - pxor xmm7,xmm7 - punpcklwd xmm5,xmm6 ; xmm5=tmp1L - punpckhwd xmm7,xmm6 ; xmm7=tmp1H - psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS - psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + pxor xmm5,xmm5 + pxor xmm7,xmm7 + punpcklwd xmm5,xmm6 ; xmm5=tmp1L + punpckhwd xmm7,xmm6 ; xmm7=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS - movdqa xmm2,xmm5 - paddd xmm5,xmm1 ; xmm5=tmp11L - psubd xmm2,xmm1 ; xmm2=tmp12L - movdqa xmm0,xmm7 - paddd xmm7,xmm3 ; xmm7=tmp11H - psubd xmm0,xmm3 ; xmm0=tmp12H + movdqa xmm2,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm2,xmm1 ; xmm2=tmp12L + movdqa xmm0,xmm7 + paddd xmm7,xmm3 ; xmm7=tmp11H + psubd xmm0,xmm3 ; xmm0=tmp12H - movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L - movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H - movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L - movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movdqa xmm4, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm6, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - pmullw xmm4, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm6, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - pmullw xmm1, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm4, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm6, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm6, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm1, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm5,xmm6 - movdqa xmm7,xmm4 - paddw xmm5,xmm3 ; xmm5=z3 - paddw xmm7,xmm1 ; xmm7=z4 + movdqa xmm5,xmm6 + movdqa xmm7,xmm4 + paddw xmm5,xmm3 ; xmm5=z3 + paddw xmm7,xmm1 ; xmm7=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm2,xmm5 - movdqa xmm0,xmm5 - punpcklwd xmm2,xmm7 - punpckhwd xmm0,xmm7 - movdqa xmm5,xmm2 - movdqa xmm7,xmm0 - pmaddwd xmm2,[rel PW_MF078_F117] ; xmm2=z3L - pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3H - pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L - pmaddwd xmm7,[rel PW_F117_F078] ; xmm7=z4H + movdqa xmm2,xmm5 + movdqa xmm0,xmm5 + punpcklwd xmm2,xmm7 + punpckhwd xmm0,xmm7 + movdqa xmm5,xmm2 + movdqa xmm7,xmm0 + pmaddwd xmm2,[rel PW_MF078_F117] ; xmm2=z3L + pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3H + pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L + pmaddwd xmm7,[rel PW_F117_F078] ; xmm7=z4H - movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L - movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movdqa xmm2,xmm3 - movdqa xmm0,xmm3 - punpcklwd xmm2,xmm4 - punpckhwd xmm0,xmm4 - movdqa xmm3,xmm2 - movdqa xmm4,xmm0 - pmaddwd xmm2,[rel PW_MF060_MF089] ; xmm2=tmp0L - pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0H - pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3L - pmaddwd xmm4,[rel PW_MF089_F060] ; xmm4=tmp3H + movdqa xmm2,xmm3 + movdqa xmm0,xmm3 + punpcklwd xmm2,xmm4 + punpckhwd xmm0,xmm4 + movdqa xmm3,xmm2 + movdqa xmm4,xmm0 + pmaddwd xmm2,[rel PW_MF060_MF089] ; xmm2=tmp0L + pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0H + pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3L + pmaddwd xmm4,[rel PW_MF089_F060] ; xmm4=tmp3H - paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L - paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H - paddd xmm3,xmm5 ; xmm3=tmp3L - paddd xmm4,xmm7 ; xmm4=tmp3H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L + paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H + paddd xmm3,xmm5 ; xmm3=tmp3L + paddd xmm4,xmm7 ; xmm4=tmp3H - movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L - movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H + movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H - movdqa xmm2,xmm1 - movdqa xmm0,xmm1 - punpcklwd xmm2,xmm6 - punpckhwd xmm0,xmm6 - movdqa xmm1,xmm2 - movdqa xmm6,xmm0 - pmaddwd xmm2,[rel PW_MF050_MF256] ; xmm2=tmp1L - pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1H - pmaddwd xmm1,[rel PW_MF256_F050] ; xmm1=tmp2L - pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H + movdqa xmm2,xmm1 + movdqa xmm0,xmm1 + punpcklwd xmm2,xmm6 + punpckhwd xmm0,xmm6 + movdqa xmm1,xmm2 + movdqa xmm6,xmm0 + pmaddwd xmm2,[rel PW_MF050_MF256] ; xmm2=tmp1L + pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1H + pmaddwd xmm1,[rel PW_MF256_F050] ; xmm1=tmp2L + pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H - paddd xmm2,xmm5 ; xmm2=tmp1L - paddd xmm0,xmm7 ; xmm0=tmp1H - paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L - paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + paddd xmm2,xmm5 ; xmm2=tmp1L + paddd xmm0,xmm7 ; xmm0=tmp1H + paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H - movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L - movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L - movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H - movdqa xmm2,xmm5 - movdqa xmm0,xmm7 - paddd xmm5,xmm3 ; xmm5=data0L - paddd xmm7,xmm4 ; xmm7=data0H - psubd xmm2,xmm3 ; xmm2=data7L - psubd xmm0,xmm4 ; xmm0=data7H + movdqa xmm2,xmm5 + movdqa xmm0,xmm7 + paddd xmm5,xmm3 ; xmm5=data0L + paddd xmm7,xmm4 ; xmm7=data0H + psubd xmm2,xmm3 ; xmm2=data7L + psubd xmm0,xmm4 ; xmm0=data7H - movdqa xmm3,[rel PD_DESCALE_P1] ; xmm3=[rel PD_DESCALE_P1] + movdqa xmm3,[rel PD_DESCALE_P1] ; xmm3=[rel PD_DESCALE_P1] - paddd xmm5,xmm3 - paddd xmm7,xmm3 - psrad xmm5,DESCALE_P1 - psrad xmm7,DESCALE_P1 - paddd xmm2,xmm3 - paddd xmm0,xmm3 - psrad xmm2,DESCALE_P1 - psrad xmm0,DESCALE_P1 + paddd xmm5,xmm3 + paddd xmm7,xmm3 + psrad xmm5,DESCALE_P1 + psrad xmm7,DESCALE_P1 + paddd xmm2,xmm3 + paddd xmm0,xmm3 + psrad xmm2,DESCALE_P1 + psrad xmm0,DESCALE_P1 - packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) - packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) + packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) + packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) - movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L - movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H + movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L + movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H - movdqa xmm7,xmm4 - movdqa xmm0,xmm3 - paddd xmm4,xmm1 ; xmm4=data1L - paddd xmm3,xmm6 ; xmm3=data1H - psubd xmm7,xmm1 ; xmm7=data6L - psubd xmm0,xmm6 ; xmm0=data6H + movdqa xmm7,xmm4 + movdqa xmm0,xmm3 + paddd xmm4,xmm1 ; xmm4=data1L + paddd xmm3,xmm6 ; xmm3=data1H + psubd xmm7,xmm1 ; xmm7=data6L + psubd xmm0,xmm6 ; xmm0=data6H - movdqa xmm1,[rel PD_DESCALE_P1] ; xmm1=[rel PD_DESCALE_P1] + movdqa xmm1,[rel PD_DESCALE_P1] ; xmm1=[rel PD_DESCALE_P1] - paddd xmm4,xmm1 - paddd xmm3,xmm1 - psrad xmm4,DESCALE_P1 - psrad xmm3,DESCALE_P1 - paddd xmm7,xmm1 - paddd xmm0,xmm1 - psrad xmm7,DESCALE_P1 - psrad xmm0,DESCALE_P1 + paddd xmm4,xmm1 + paddd xmm3,xmm1 + psrad xmm4,DESCALE_P1 + psrad xmm3,DESCALE_P1 + paddd xmm7,xmm1 + paddd xmm0,xmm1 + psrad xmm7,DESCALE_P1 + psrad xmm0,DESCALE_P1 - packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) - packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) + packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) - movdqa xmm6,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) - punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) - movdqa xmm1,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) - punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) + punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) - movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L - movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H - movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L - movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H + movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L + movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H + movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L + movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) - movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) - movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) - movdqa xmm5,xmm3 - movdqa xmm6,xmm0 - paddd xmm3,xmm4 ; xmm3=data2L - paddd xmm0,xmm2 ; xmm0=data2H - psubd xmm5,xmm4 ; xmm5=data5L - psubd xmm6,xmm2 ; xmm6=data5H + movdqa xmm5,xmm3 + movdqa xmm6,xmm0 + paddd xmm3,xmm4 ; xmm3=data2L + paddd xmm0,xmm2 ; xmm0=data2H + psubd xmm5,xmm4 ; xmm5=data5L + psubd xmm6,xmm2 ; xmm6=data5H - movdqa xmm7,[rel PD_DESCALE_P1] ; xmm7=[rel PD_DESCALE_P1] + movdqa xmm7,[rel PD_DESCALE_P1] ; xmm7=[rel PD_DESCALE_P1] - paddd xmm3,xmm7 - paddd xmm0,xmm7 - psrad xmm3,DESCALE_P1 - psrad xmm0,DESCALE_P1 - paddd xmm5,xmm7 - paddd xmm6,xmm7 - psrad xmm5,DESCALE_P1 - psrad xmm6,DESCALE_P1 + paddd xmm3,xmm7 + paddd xmm0,xmm7 + psrad xmm3,DESCALE_P1 + psrad xmm0,DESCALE_P1 + paddd xmm5,xmm7 + paddd xmm6,xmm7 + psrad xmm5,DESCALE_P1 + psrad xmm6,DESCALE_P1 - packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) - packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) + packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) + packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L - movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H - movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L - movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L + movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H + movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L + movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H - movdqa xmm0,xmm1 - movdqa xmm6,xmm4 - paddd xmm1,xmm2 ; xmm1=data3L - paddd xmm4,xmm7 ; xmm4=data3H - psubd xmm0,xmm2 ; xmm0=data4L - psubd xmm6,xmm7 ; xmm6=data4H + movdqa xmm0,xmm1 + movdqa xmm6,xmm4 + paddd xmm1,xmm2 ; xmm1=data3L + paddd xmm4,xmm7 ; xmm4=data3H + psubd xmm0,xmm2 ; xmm0=data4L + psubd xmm6,xmm7 ; xmm6=data4H - movdqa xmm2,[rel PD_DESCALE_P1] ; xmm2=[rel PD_DESCALE_P1] + movdqa xmm2,[rel PD_DESCALE_P1] ; xmm2=[rel PD_DESCALE_P1] - paddd xmm1,xmm2 - paddd xmm4,xmm2 - psrad xmm1,DESCALE_P1 - psrad xmm4,DESCALE_P1 - paddd xmm0,xmm2 - paddd xmm6,xmm2 - psrad xmm0,DESCALE_P1 - psrad xmm6,DESCALE_P1 + paddd xmm1,xmm2 + paddd xmm4,xmm2 + psrad xmm1,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm0,xmm2 + paddd xmm6,xmm2 + psrad xmm0,DESCALE_P1 + psrad xmm6,DESCALE_P1 - packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) - packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) + packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) + packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) - movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) + movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) - movdqa xmm4,xmm3 ; transpose coefficients(phase 1) - punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) - punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) - movdqa xmm6,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) - punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) + movdqa xmm4,xmm3 ; transpose coefficients(phase 1) + punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) + punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) - movdqa xmm1,xmm7 ; transpose coefficients(phase 2) - punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) - punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) - movdqa xmm5,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) - punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) + movdqa xmm1,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) + punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) + punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) - movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) - movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) + movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) - movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) - movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) - movdqa xmm2,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) - punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) - punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) + movdqa xmm2,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) + punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) + punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) - movdqa xmm3,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) - punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) - movdqa xmm4,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) - punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) + movdqa xmm3,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) - movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) - movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) + movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) - movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 - movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 + movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 - movdqa xmm3,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) - punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) - movdqa xmm4,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) - punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) + movdqa xmm4,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) - movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 - movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov rax, [original_rbp] - mov rdi, r12 ; (JSAMPROW *) - mov rax, r13 + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 - ; -- Even part + ; -- Even part - ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 + ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movdqa xmm6,xmm1 ; xmm1=in2=z2 - movdqa xmm5,xmm1 - punpcklwd xmm6,xmm2 ; xmm2=in6=z3 - punpckhwd xmm5,xmm2 - movdqa xmm1,xmm6 - movdqa xmm2,xmm5 - pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=tmp3L - pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H - pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L - pmaddwd xmm2,[rel PW_F054_MF130] ; xmm2=tmp2H + movdqa xmm6,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm6,xmm2 ; xmm2=in6=z3 + punpckhwd xmm5,xmm2 + movdqa xmm1,xmm6 + movdqa xmm2,xmm5 + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=tmp3L + pmaddwd xmm5,[rel PW_F130_F054] ; xmm5=tmp3H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=tmp2L + pmaddwd xmm2,[rel PW_F054_MF130] ; xmm2=tmp2H - movdqa xmm3,xmm7 - paddw xmm7,xmm0 ; xmm7=in0+in4 - psubw xmm3,xmm0 ; xmm3=in0-in4 + movdqa xmm3,xmm7 + paddw xmm7,xmm0 ; xmm7=in0+in4 + psubw xmm3,xmm0 ; xmm3=in0-in4 - pxor xmm4,xmm4 - pxor xmm0,xmm0 - punpcklwd xmm4,xmm7 ; xmm4=tmp0L - punpckhwd xmm0,xmm7 ; xmm0=tmp0H - psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS - psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS + pxor xmm4,xmm4 + pxor xmm0,xmm0 + punpcklwd xmm4,xmm7 ; xmm4=tmp0L + punpckhwd xmm0,xmm7 ; xmm0=tmp0H + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS - movdqa xmm7,xmm4 - paddd xmm4,xmm6 ; xmm4=tmp10L - psubd xmm7,xmm6 ; xmm7=tmp13L - movdqa xmm6,xmm0 - paddd xmm0,xmm5 ; xmm0=tmp10H - psubd xmm6,xmm5 ; xmm6=tmp13H + movdqa xmm7,xmm4 + paddd xmm4,xmm6 ; xmm4=tmp10L + psubd xmm7,xmm6 ; xmm7=tmp13L + movdqa xmm6,xmm0 + paddd xmm0,xmm5 ; xmm0=tmp10H + psubd xmm6,xmm5 ; xmm6=tmp13H - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H - movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L - movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H - pxor xmm5,xmm5 - pxor xmm4,xmm4 - punpcklwd xmm5,xmm3 ; xmm5=tmp1L - punpckhwd xmm4,xmm3 ; xmm4=tmp1H - psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS - psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + pxor xmm5,xmm5 + pxor xmm4,xmm4 + punpcklwd xmm5,xmm3 ; xmm5=tmp1L + punpckhwd xmm4,xmm3 ; xmm4=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS - movdqa xmm0,xmm5 - paddd xmm5,xmm1 ; xmm5=tmp11L - psubd xmm0,xmm1 ; xmm0=tmp12L - movdqa xmm7,xmm4 - paddd xmm4,xmm2 ; xmm4=tmp11H - psubd xmm7,xmm2 ; xmm7=tmp12H + movdqa xmm0,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm0,xmm1 ; xmm0=tmp12L + movdqa xmm7,xmm4 + paddd xmm4,xmm2 ; xmm4=tmp11H + psubd xmm7,xmm2 ; xmm7=tmp12H - movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L - movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L - movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 - movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 - movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 - movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 + movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 + movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 + movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 + movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 - movdqa xmm5,xmm6 - movdqa xmm4,xmm3 - paddw xmm5,xmm1 ; xmm5=z3 - paddw xmm4,xmm2 ; xmm4=z4 + movdqa xmm5,xmm6 + movdqa xmm4,xmm3 + paddw xmm5,xmm1 ; xmm5=z3 + paddw xmm4,xmm2 ; xmm4=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm0,xmm5 - movdqa xmm7,xmm5 - punpcklwd xmm0,xmm4 - punpckhwd xmm7,xmm4 - movdqa xmm5,xmm0 - movdqa xmm4,xmm7 - pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3L - pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3H - pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L - pmaddwd xmm4,[rel PW_F117_F078] ; xmm4=z4H + movdqa xmm0,xmm5 + movdqa xmm7,xmm5 + punpcklwd xmm0,xmm4 + punpckhwd xmm7,xmm4 + movdqa xmm5,xmm0 + movdqa xmm4,xmm7 + pmaddwd xmm0,[rel PW_MF078_F117] ; xmm0=z3L + pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3H + pmaddwd xmm5,[rel PW_F117_F078] ; xmm5=z4L + pmaddwd xmm4,[rel PW_F117_F078] ; xmm4=z4H - movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L - movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movdqa xmm0,xmm1 - movdqa xmm7,xmm1 - punpcklwd xmm0,xmm3 - punpckhwd xmm7,xmm3 - movdqa xmm1,xmm0 - movdqa xmm3,xmm7 - pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0L - pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp0H - pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp3L - pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3H + movdqa xmm0,xmm1 + movdqa xmm7,xmm1 + punpcklwd xmm0,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm1,xmm0 + movdqa xmm3,xmm7 + pmaddwd xmm0,[rel PW_MF060_MF089] ; xmm0=tmp0L + pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp0H + pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp3L + pmaddwd xmm3,[rel PW_MF089_F060] ; xmm3=tmp3H - paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L - paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H - paddd xmm1,xmm5 ; xmm1=tmp3L - paddd xmm3,xmm4 ; xmm3=tmp3H + paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L + paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H + paddd xmm1,xmm5 ; xmm1=tmp3L + paddd xmm3,xmm4 ; xmm3=tmp3H - movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L - movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H + movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H - movdqa xmm0,xmm2 - movdqa xmm7,xmm2 - punpcklwd xmm0,xmm6 - punpckhwd xmm7,xmm6 - movdqa xmm2,xmm0 - movdqa xmm6,xmm7 - pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1L - pmaddwd xmm7,[rel PW_MF050_MF256] ; xmm7=tmp1H - pmaddwd xmm2,[rel PW_MF256_F050] ; xmm2=tmp2L - pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H + movdqa xmm0,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm0,xmm6 + punpckhwd xmm7,xmm6 + movdqa xmm2,xmm0 + movdqa xmm6,xmm7 + pmaddwd xmm0,[rel PW_MF050_MF256] ; xmm0=tmp1L + pmaddwd xmm7,[rel PW_MF050_MF256] ; xmm7=tmp1H + pmaddwd xmm2,[rel PW_MF256_F050] ; xmm2=tmp2L + pmaddwd xmm6,[rel PW_MF256_F050] ; xmm6=tmp2H - paddd xmm0,xmm5 ; xmm0=tmp1L - paddd xmm7,xmm4 ; xmm7=tmp1H - paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L - paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + paddd xmm0,xmm5 ; xmm0=tmp1L + paddd xmm7,xmm4 ; xmm7=tmp1H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H - movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L - movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L - movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H - movdqa xmm0,xmm5 - movdqa xmm7,xmm4 - paddd xmm5,xmm1 ; xmm5=data0L - paddd xmm4,xmm3 ; xmm4=data0H - psubd xmm0,xmm1 ; xmm0=data7L - psubd xmm7,xmm3 ; xmm7=data7H + movdqa xmm0,xmm5 + movdqa xmm7,xmm4 + paddd xmm5,xmm1 ; xmm5=data0L + paddd xmm4,xmm3 ; xmm4=data0H + psubd xmm0,xmm1 ; xmm0=data7L + psubd xmm7,xmm3 ; xmm7=data7H - movdqa xmm1,[rel PD_DESCALE_P2] ; xmm1=[rel PD_DESCALE_P2] + movdqa xmm1,[rel PD_DESCALE_P2] ; xmm1=[rel PD_DESCALE_P2] - paddd xmm5,xmm1 - paddd xmm4,xmm1 - psrad xmm5,DESCALE_P2 - psrad xmm4,DESCALE_P2 - paddd xmm0,xmm1 - paddd xmm7,xmm1 - psrad xmm0,DESCALE_P2 - psrad xmm7,DESCALE_P2 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrad xmm5,DESCALE_P2 + psrad xmm4,DESCALE_P2 + paddd xmm0,xmm1 + paddd xmm7,xmm1 + psrad xmm0,DESCALE_P2 + psrad xmm7,DESCALE_P2 - packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) - packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) + packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) + packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) - movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L - movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L + movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H - movdqa xmm4,xmm3 - movdqa xmm7,xmm1 - paddd xmm3,xmm2 ; xmm3=data1L - paddd xmm1,xmm6 ; xmm1=data1H - psubd xmm4,xmm2 ; xmm4=data6L - psubd xmm7,xmm6 ; xmm7=data6H + movdqa xmm4,xmm3 + movdqa xmm7,xmm1 + paddd xmm3,xmm2 ; xmm3=data1L + paddd xmm1,xmm6 ; xmm1=data1H + psubd xmm4,xmm2 ; xmm4=data6L + psubd xmm7,xmm6 ; xmm7=data6H - movdqa xmm2,[rel PD_DESCALE_P2] ; xmm2=[rel PD_DESCALE_P2] + movdqa xmm2,[rel PD_DESCALE_P2] ; xmm2=[rel PD_DESCALE_P2] - paddd xmm3,xmm2 - paddd xmm1,xmm2 - psrad xmm3,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm4,xmm2 - paddd xmm7,xmm2 - psrad xmm4,DESCALE_P2 - psrad xmm7,DESCALE_P2 + paddd xmm3,xmm2 + paddd xmm1,xmm2 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm4,xmm2 + paddd xmm7,xmm2 + psrad xmm4,DESCALE_P2 + psrad xmm7,DESCALE_P2 - packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) - packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) + packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) + packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) - packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L - movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H - movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L - movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H + movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H + movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L + movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm4,xmm6 - movdqa xmm0,xmm2 - paddd xmm6,xmm1 ; xmm6=data2L - paddd xmm2,xmm7 ; xmm2=data2H - psubd xmm4,xmm1 ; xmm4=data5L - psubd xmm0,xmm7 ; xmm0=data5H + movdqa xmm4,xmm6 + movdqa xmm0,xmm2 + paddd xmm6,xmm1 ; xmm6=data2L + paddd xmm2,xmm7 ; xmm2=data2H + psubd xmm4,xmm1 ; xmm4=data5L + psubd xmm0,xmm7 ; xmm0=data5H - movdqa xmm5,[rel PD_DESCALE_P2] ; xmm5=[rel PD_DESCALE_P2] + movdqa xmm5,[rel PD_DESCALE_P2] ; xmm5=[rel PD_DESCALE_P2] - paddd xmm6,xmm5 - paddd xmm2,xmm5 - psrad xmm6,DESCALE_P2 - psrad xmm2,DESCALE_P2 - paddd xmm4,xmm5 - paddd xmm0,xmm5 - psrad xmm4,DESCALE_P2 - psrad xmm0,DESCALE_P2 + paddd xmm6,xmm5 + paddd xmm2,xmm5 + psrad xmm6,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm4,xmm5 + paddd xmm0,xmm5 + psrad xmm4,DESCALE_P2 + psrad xmm0,DESCALE_P2 - packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) - packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) + packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) + packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) - movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L - movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H - movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L - movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H + movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L + movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H + movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L + movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H - movdqa xmm2,xmm3 - movdqa xmm0,xmm1 - paddd xmm3,xmm7 ; xmm3=data3L - paddd xmm1,xmm5 ; xmm1=data3H - psubd xmm2,xmm7 ; xmm2=data4L - psubd xmm0,xmm5 ; xmm0=data4H + movdqa xmm2,xmm3 + movdqa xmm0,xmm1 + paddd xmm3,xmm7 ; xmm3=data3L + paddd xmm1,xmm5 ; xmm1=data3H + psubd xmm2,xmm7 ; xmm2=data4L + psubd xmm0,xmm5 ; xmm0=data4H - movdqa xmm7,[rel PD_DESCALE_P2] ; xmm7=[rel PD_DESCALE_P2] + movdqa xmm7,[rel PD_DESCALE_P2] ; xmm7=[rel PD_DESCALE_P2] - paddd xmm3,xmm7 - paddd xmm1,xmm7 - psrad xmm3,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm2,xmm7 - paddd xmm0,xmm7 - psrad xmm2,DESCALE_P2 - psrad xmm0,DESCALE_P2 + paddd xmm3,xmm7 + paddd xmm1,xmm7 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm2,xmm7 + paddd xmm0,xmm7 + psrad xmm2,DESCALE_P2 + psrad xmm0,DESCALE_P2 - movdqa xmm5,[rel PB_CENTERJSAMP] ; xmm5=[rel PB_CENTERJSAMP] + movdqa xmm5,[rel PB_CENTERJSAMP] ; xmm5=[rel PB_CENTERJSAMP] - packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) - packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) + packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) + packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) - packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) - paddb xmm7,xmm5 - paddb xmm1,xmm5 - paddb xmm6,xmm5 - paddb xmm3,xmm5 + paddb xmm7,xmm5 + paddb xmm1,xmm5 + paddb xmm6,xmm5 + paddb xmm3,xmm5 - movdqa xmm0,xmm7 ; transpose coefficients(phase 1) - punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) - punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) - punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) - movdqa xmm4,xmm7 ; transpose coefficients(phase 2) - punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) - movdqa xmm5,xmm2 ; transpose coefficients(phase 2) - punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + movdqa xmm4,xmm7 ; transpose coefficients(phase 2) + punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - movdqa xmm3,xmm4 ; transpose coefficients(phase 3) - punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) - punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm3,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) - pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) - pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm7 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm1 - mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm7 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm1 + mov rdx, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 - mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 - mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] - movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm2 - movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm5 + mov rdx, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 + mov rdx, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm5 - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2int.asm b/simd/jiss2int.asm index adf39fb3..e78f5ffa 100644 --- a/simd/jiss2int.asm +++ b/simd/jiss2int.asm @@ -26,67 +26,67 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1 (CONST_BITS-PASS1_BITS) -%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) +%define DESCALE_P1 (CONST_BITS-PASS1_BITS) +%define DESCALE_P2 (CONST_BITS+PASS1_BITS+3) %if CONST_BITS == 13 -F_0_298 equ 2446 ; FIX(0.298631336) -F_0_390 equ 3196 ; FIX(0.390180644) -F_0_541 equ 4433 ; FIX(0.541196100) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_175 equ 9633 ; FIX(1.175875602) -F_1_501 equ 12299 ; FIX(1.501321110) -F_1_847 equ 15137 ; FIX(1.847759065) -F_1_961 equ 16069 ; FIX(1.961570560) -F_2_053 equ 16819 ; FIX(2.053119869) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_072 equ 25172 ; FIX(3.072711026) +F_0_298 equ 2446 ; FIX(0.298631336) +F_0_390 equ 3196 ; FIX(0.390180644) +F_0_541 equ 4433 ; FIX(0.541196100) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_175 equ 9633 ; FIX(1.175875602) +F_1_501 equ 12299 ; FIX(1.501321110) +F_1_847 equ 15137 ; FIX(1.847759065) +F_1_961 equ 16069 ; FIX(1.961570560) +F_2_053 equ 16819 ; FIX(2.053119869) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) -F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) -F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) -F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) -F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) +F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) +F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) +F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) +F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) +F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_islow_sse2) + alignz 16 + global EXTN(jconst_idct_islow_sse2) EXTN(jconst_idct_islow_sse2): -PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 -PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) -PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 -PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) -PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 -PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) -PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 -PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) -PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) -PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F130_F054 times 4 dw (F_0_541+F_0_765), F_0_541 +PW_F054_MF130 times 4 dw F_0_541, (F_0_541-F_1_847) +PW_MF078_F117 times 4 dw (F_1_175-F_1_961), F_1_175 +PW_F117_F078 times 4 dw F_1_175, (F_1_175-F_0_390) +PW_MF060_MF089 times 4 dw (F_0_298-F_0_899),-F_0_899 +PW_MF089_F060 times 4 dw -F_0_899, (F_1_501-F_0_899) +PW_MF050_MF256 times 4 dw (F_2_053-F_2_562),-F_2_562 +PW_MF256_F050 times 4 dw -F_2_562, (F_3_072-F_2_562) +PD_DESCALE_P1 times 4 dd 1 << (DESCALE_P1-1) +PD_DESCALE_P2 times 4 dd 1 << (DESCALE_P2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -95,765 +95,765 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; jpeg_component_info * compptr -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; jpeg_component_info * compptr +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 12 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 12 - align 16 - global EXTN(jsimd_idct_islow_sse2) + align 16 + global EXTN(jsimd_idct_islow_sse2) EXTN(jsimd_idct_islow_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr %ifndef NO_ZERO_COLUMN_TEST_ISLOW_SSE2 - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por xmm1,xmm0 - packsswb xmm1,xmm1 - packsswb xmm1,xmm1 - movd eax,xmm1 - test eax,eax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm1,xmm0 + packsswb xmm1,xmm1 + packsswb xmm1,xmm1 + movd eax,xmm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm5, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw xmm5, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm5, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm5, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - psllw xmm5,PASS1_BITS + psllw xmm5,PASS1_BITS - movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) - punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) + movdqa xmm4,xmm5 ; xmm5=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm5,xmm5 ; xmm5=(00 00 01 01 02 02 03 03) + punpckhwd xmm4,xmm4 ; xmm4=(04 04 05 05 06 06 07 07) - pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) - pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) - pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) - pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) - pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) - pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) - pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) - pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) + pshufd xmm7,xmm5,0x00 ; xmm7=col0=(00 00 00 00 00 00 00 00) + pshufd xmm6,xmm5,0x55 ; xmm6=col1=(01 01 01 01 01 01 01 01) + pshufd xmm1,xmm5,0xAA ; xmm1=col2=(02 02 02 02 02 02 02 02) + pshufd xmm5,xmm5,0xFF ; xmm5=col3=(03 03 03 03 03 03 03 03) + pshufd xmm0,xmm4,0x00 ; xmm0=col4=(04 04 04 04 04 04 04 04) + pshufd xmm3,xmm4,0x55 ; xmm3=col5=(05 05 05 05 05 05 05 05) + pshufd xmm2,xmm4,0xAA ; xmm2=col6=(06 06 06 06 06 06 06 06) + pshufd xmm4,xmm4,0xFF ; xmm4=col7=(07 07 07 07 07 07 07 07) - movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 - movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 - movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 - movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 - jmp near .column_end - alignx 16,7 + movdqa XMMWORD [wk(8)], xmm6 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm5 ; wk(9)=col3 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + jmp near .column_end + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movdqa xmm4,xmm1 ; xmm1=in2=z2 - movdqa xmm5,xmm1 - punpcklwd xmm4,xmm3 ; xmm3=in6=z3 - punpckhwd xmm5,xmm3 - movdqa xmm1,xmm4 - movdqa xmm3,xmm5 - pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=tmp3L - pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H - pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L - pmaddwd xmm3,[GOTOFF(ebx,PW_F054_MF130)] ; xmm3=tmp2H + movdqa xmm4,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm4,xmm3 ; xmm3=in6=z3 + punpckhwd xmm5,xmm3 + movdqa xmm1,xmm4 + movdqa xmm3,xmm5 + pmaddwd xmm4,[GOTOFF(ebx,PW_F130_F054)] ; xmm4=tmp3L + pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L + pmaddwd xmm3,[GOTOFF(ebx,PW_F054_MF130)] ; xmm3=tmp2H - movdqa xmm6,xmm0 - paddw xmm0,xmm2 ; xmm0=in0+in4 - psubw xmm6,xmm2 ; xmm6=in0-in4 + movdqa xmm6,xmm0 + paddw xmm0,xmm2 ; xmm0=in0+in4 + psubw xmm6,xmm2 ; xmm6=in0-in4 - pxor xmm7,xmm7 - pxor xmm2,xmm2 - punpcklwd xmm7,xmm0 ; xmm7=tmp0L - punpckhwd xmm2,xmm0 ; xmm2=tmp0H - psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS - psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS + pxor xmm7,xmm7 + pxor xmm2,xmm2 + punpcklwd xmm7,xmm0 ; xmm7=tmp0L + punpckhwd xmm2,xmm0 ; xmm2=tmp0H + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + psrad xmm2,(16-CONST_BITS) ; psrad xmm2,16 & pslld xmm2,CONST_BITS - movdqa xmm0,xmm7 - paddd xmm7,xmm4 ; xmm7=tmp10L - psubd xmm0,xmm4 ; xmm0=tmp13L - movdqa xmm4,xmm2 - paddd xmm2,xmm5 ; xmm2=tmp10H - psubd xmm4,xmm5 ; xmm4=tmp13H + movdqa xmm0,xmm7 + paddd xmm7,xmm4 ; xmm7=tmp10L + psubd xmm0,xmm4 ; xmm0=tmp13L + movdqa xmm4,xmm2 + paddd xmm2,xmm5 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp13H - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L - movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H - movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L - movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm0 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm4 ; wk(3)=tmp13H - pxor xmm5,xmm5 - pxor xmm7,xmm7 - punpcklwd xmm5,xmm6 ; xmm5=tmp1L - punpckhwd xmm7,xmm6 ; xmm7=tmp1H - psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS - psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS + pxor xmm5,xmm5 + pxor xmm7,xmm7 + punpcklwd xmm5,xmm6 ; xmm5=tmp1L + punpckhwd xmm7,xmm6 ; xmm7=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm7,(16-CONST_BITS) ; psrad xmm7,16 & pslld xmm7,CONST_BITS - movdqa xmm2,xmm5 - paddd xmm5,xmm1 ; xmm5=tmp11L - psubd xmm2,xmm1 ; xmm2=tmp12L - movdqa xmm0,xmm7 - paddd xmm7,xmm3 ; xmm7=tmp11H - psubd xmm0,xmm3 ; xmm0=tmp12H + movdqa xmm2,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm2,xmm1 ; xmm2=tmp12L + movdqa xmm0,xmm7 + paddd xmm7,xmm3 ; xmm7=tmp11H + psubd xmm0,xmm3 ; xmm0=tmp12H - movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L - movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H - movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L - movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm7 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm0 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movdqa xmm4, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm6, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw xmm4, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm6, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw xmm1, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm4, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm6, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm6, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm1, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm5,xmm6 - movdqa xmm7,xmm4 - paddw xmm5,xmm3 ; xmm5=z3 - paddw xmm7,xmm1 ; xmm7=z4 + movdqa xmm5,xmm6 + movdqa xmm7,xmm4 + paddw xmm5,xmm3 ; xmm5=z3 + paddw xmm7,xmm1 ; xmm7=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm2,xmm5 - movdqa xmm0,xmm5 - punpcklwd xmm2,xmm7 - punpckhwd xmm0,xmm7 - movdqa xmm5,xmm2 - movdqa xmm7,xmm0 - pmaddwd xmm2,[GOTOFF(ebx,PW_MF078_F117)] ; xmm2=z3L - pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3H - pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L - pmaddwd xmm7,[GOTOFF(ebx,PW_F117_F078)] ; xmm7=z4H + movdqa xmm2,xmm5 + movdqa xmm0,xmm5 + punpcklwd xmm2,xmm7 + punpckhwd xmm0,xmm7 + movdqa xmm5,xmm2 + movdqa xmm7,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF078_F117)] ; xmm2=z3L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3H + pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L + pmaddwd xmm7,[GOTOFF(ebx,PW_F117_F078)] ; xmm7=z4H - movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L - movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movdqa xmm2,xmm3 - movdqa xmm0,xmm3 - punpcklwd xmm2,xmm4 - punpckhwd xmm0,xmm4 - movdqa xmm3,xmm2 - movdqa xmm4,xmm0 - pmaddwd xmm2,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm2=tmp0L - pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0H - pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3L - pmaddwd xmm4,[GOTOFF(ebx,PW_MF089_F060)] ; xmm4=tmp3H + movdqa xmm2,xmm3 + movdqa xmm0,xmm3 + punpcklwd xmm2,xmm4 + punpckhwd xmm0,xmm4 + movdqa xmm3,xmm2 + movdqa xmm4,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm2=tmp0L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0H + pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3L + pmaddwd xmm4,[GOTOFF(ebx,PW_MF089_F060)] ; xmm4=tmp3H - paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L - paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H - paddd xmm3,xmm5 ; xmm3=tmp3L - paddd xmm4,xmm7 ; xmm4=tmp3H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp0L + paddd xmm0, XMMWORD [wk(11)] ; xmm0=tmp0H + paddd xmm3,xmm5 ; xmm3=tmp3L + paddd xmm4,xmm7 ; xmm4=tmp3H - movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L - movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H + movdqa XMMWORD [wk(8)], xmm2 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm0 ; wk(9)=tmp0H - movdqa xmm2,xmm1 - movdqa xmm0,xmm1 - punpcklwd xmm2,xmm6 - punpckhwd xmm0,xmm6 - movdqa xmm1,xmm2 - movdqa xmm6,xmm0 - pmaddwd xmm2,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm2=tmp1L - pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1H - pmaddwd xmm1,[GOTOFF(ebx,PW_MF256_F050)] ; xmm1=tmp2L - pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H + movdqa xmm2,xmm1 + movdqa xmm0,xmm1 + punpcklwd xmm2,xmm6 + punpckhwd xmm0,xmm6 + movdqa xmm1,xmm2 + movdqa xmm6,xmm0 + pmaddwd xmm2,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm2=tmp1L + pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1H + pmaddwd xmm1,[GOTOFF(ebx,PW_MF256_F050)] ; xmm1=tmp2L + pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H - paddd xmm2,xmm5 ; xmm2=tmp1L - paddd xmm0,xmm7 ; xmm0=tmp1H - paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L - paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + paddd xmm2,xmm5 ; xmm2=tmp1L + paddd xmm0,xmm7 ; xmm0=tmp1H + paddd xmm1, XMMWORD [wk(10)] ; xmm1=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H - movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L - movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H + movdqa XMMWORD [wk(10)], xmm2 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm0 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L - movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm7, XMMWORD [wk(1)] ; xmm7=tmp10H - movdqa xmm2,xmm5 - movdqa xmm0,xmm7 - paddd xmm5,xmm3 ; xmm5=data0L - paddd xmm7,xmm4 ; xmm7=data0H - psubd xmm2,xmm3 ; xmm2=data7L - psubd xmm0,xmm4 ; xmm0=data7H + movdqa xmm2,xmm5 + movdqa xmm0,xmm7 + paddd xmm5,xmm3 ; xmm5=data0L + paddd xmm7,xmm4 ; xmm7=data0H + psubd xmm2,xmm3 ; xmm2=data7L + psubd xmm0,xmm4 ; xmm0=data7H - movdqa xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm3=[PD_DESCALE_P1] + movdqa xmm3,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm3=[PD_DESCALE_P1] - paddd xmm5,xmm3 - paddd xmm7,xmm3 - psrad xmm5,DESCALE_P1 - psrad xmm7,DESCALE_P1 - paddd xmm2,xmm3 - paddd xmm0,xmm3 - psrad xmm2,DESCALE_P1 - psrad xmm0,DESCALE_P1 + paddd xmm5,xmm3 + paddd xmm7,xmm3 + psrad xmm5,DESCALE_P1 + psrad xmm7,DESCALE_P1 + paddd xmm2,xmm3 + paddd xmm0,xmm3 + psrad xmm2,DESCALE_P1 + psrad xmm0,DESCALE_P1 - packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) - packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) + packssdw xmm5,xmm7 ; xmm5=data0=(00 01 02 03 04 05 06 07) + packssdw xmm2,xmm0 ; xmm2=data7=(70 71 72 73 74 75 76 77) - movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L - movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H + movdqa xmm4, XMMWORD [wk(4)] ; xmm4=tmp11L + movdqa xmm3, XMMWORD [wk(5)] ; xmm3=tmp11H - movdqa xmm7,xmm4 - movdqa xmm0,xmm3 - paddd xmm4,xmm1 ; xmm4=data1L - paddd xmm3,xmm6 ; xmm3=data1H - psubd xmm7,xmm1 ; xmm7=data6L - psubd xmm0,xmm6 ; xmm0=data6H + movdqa xmm7,xmm4 + movdqa xmm0,xmm3 + paddd xmm4,xmm1 ; xmm4=data1L + paddd xmm3,xmm6 ; xmm3=data1H + psubd xmm7,xmm1 ; xmm7=data6L + psubd xmm0,xmm6 ; xmm0=data6H - movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm1=[PD_DESCALE_P1] + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm1=[PD_DESCALE_P1] - paddd xmm4,xmm1 - paddd xmm3,xmm1 - psrad xmm4,DESCALE_P1 - psrad xmm3,DESCALE_P1 - paddd xmm7,xmm1 - paddd xmm0,xmm1 - psrad xmm7,DESCALE_P1 - psrad xmm0,DESCALE_P1 + paddd xmm4,xmm1 + paddd xmm3,xmm1 + psrad xmm4,DESCALE_P1 + psrad xmm3,DESCALE_P1 + paddd xmm7,xmm1 + paddd xmm0,xmm1 + psrad xmm7,DESCALE_P1 + psrad xmm0,DESCALE_P1 - packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) - packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) + packssdw xmm4,xmm3 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm7,xmm0 ; xmm7=data6=(60 61 62 63 64 65 66 67) - movdqa xmm6,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) - punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) - movdqa xmm1,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) - punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) + movdqa xmm6,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm4 ; xmm5=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm2 ; xmm7=(60 70 61 71 62 72 63 73) + punpckhwd xmm1,xmm2 ; xmm1=(64 74 65 75 66 76 67 77) - movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L - movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H - movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L - movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H + movdqa xmm3, XMMWORD [wk(6)] ; xmm3=tmp12L + movdqa xmm0, XMMWORD [wk(7)] ; xmm0=tmp12H + movdqa xmm4, XMMWORD [wk(10)] ; xmm4=tmp1L + movdqa xmm2, XMMWORD [wk(11)] ; xmm2=tmp1H - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) - movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) - movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 01 11 02 12 03 13) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=(04 14 05 15 06 16 07 17) + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=(60 70 61 71 62 72 63 73) + movdqa XMMWORD [wk(5)], xmm1 ; wk(5)=(64 74 65 75 66 76 67 77) - movdqa xmm5,xmm3 - movdqa xmm6,xmm0 - paddd xmm3,xmm4 ; xmm3=data2L - paddd xmm0,xmm2 ; xmm0=data2H - psubd xmm5,xmm4 ; xmm5=data5L - psubd xmm6,xmm2 ; xmm6=data5H + movdqa xmm5,xmm3 + movdqa xmm6,xmm0 + paddd xmm3,xmm4 ; xmm3=data2L + paddd xmm0,xmm2 ; xmm0=data2H + psubd xmm5,xmm4 ; xmm5=data5L + psubd xmm6,xmm2 ; xmm6=data5H - movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm7=[PD_DESCALE_P1] + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm7=[PD_DESCALE_P1] - paddd xmm3,xmm7 - paddd xmm0,xmm7 - psrad xmm3,DESCALE_P1 - psrad xmm0,DESCALE_P1 - paddd xmm5,xmm7 - paddd xmm6,xmm7 - psrad xmm5,DESCALE_P1 - psrad xmm6,DESCALE_P1 + paddd xmm3,xmm7 + paddd xmm0,xmm7 + psrad xmm3,DESCALE_P1 + psrad xmm0,DESCALE_P1 + paddd xmm5,xmm7 + paddd xmm6,xmm7 + psrad xmm5,DESCALE_P1 + psrad xmm6,DESCALE_P1 - packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) - packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) + packssdw xmm3,xmm0 ; xmm3=data2=(20 21 22 23 24 25 26 27) + packssdw xmm5,xmm6 ; xmm5=data5=(50 51 52 53 54 55 56 57) - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L - movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H - movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L - movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=tmp13L + movdqa xmm4, XMMWORD [wk(3)] ; xmm4=tmp13H + movdqa xmm2, XMMWORD [wk(8)] ; xmm2=tmp0L + movdqa xmm7, XMMWORD [wk(9)] ; xmm7=tmp0H - movdqa xmm0,xmm1 - movdqa xmm6,xmm4 - paddd xmm1,xmm2 ; xmm1=data3L - paddd xmm4,xmm7 ; xmm4=data3H - psubd xmm0,xmm2 ; xmm0=data4L - psubd xmm6,xmm7 ; xmm6=data4H + movdqa xmm0,xmm1 + movdqa xmm6,xmm4 + paddd xmm1,xmm2 ; xmm1=data3L + paddd xmm4,xmm7 ; xmm4=data3H + psubd xmm0,xmm2 ; xmm0=data4L + psubd xmm6,xmm7 ; xmm6=data4H - movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm2=[PD_DESCALE_P1] + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1)] ; xmm2=[PD_DESCALE_P1] - paddd xmm1,xmm2 - paddd xmm4,xmm2 - psrad xmm1,DESCALE_P1 - psrad xmm4,DESCALE_P1 - paddd xmm0,xmm2 - paddd xmm6,xmm2 - psrad xmm0,DESCALE_P1 - psrad xmm6,DESCALE_P1 + paddd xmm1,xmm2 + paddd xmm4,xmm2 + psrad xmm1,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm0,xmm2 + paddd xmm6,xmm2 + psrad xmm0,DESCALE_P1 + psrad xmm6,DESCALE_P1 - packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) - packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) + packssdw xmm1,xmm4 ; xmm1=data3=(30 31 32 33 34 35 36 37) + packssdw xmm0,xmm6 ; xmm0=data4=(40 41 42 43 44 45 46 47) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) - movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 01 11 02 12 03 13) + movdqa xmm2, XMMWORD [wk(1)] ; xmm2=(04 14 05 15 06 16 07 17) - movdqa xmm4,xmm3 ; transpose coefficients(phase 1) - punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) - punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) - movdqa xmm6,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) - punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) + movdqa xmm4,xmm3 ; transpose coefficients(phase 1) + punpcklwd xmm3,xmm1 ; xmm3=(20 30 21 31 22 32 23 33) + punpckhwd xmm4,xmm1 ; xmm4=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(40 50 41 51 42 52 43 53) + punpckhwd xmm6,xmm5 ; xmm6=(44 54 45 55 46 56 47 57) - movdqa xmm1,xmm7 ; transpose coefficients(phase 2) - punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) - punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) - movdqa xmm5,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) - punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) + movdqa xmm1,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm3 ; xmm7=(00 10 20 30 01 11 21 31) + punpckhdq xmm1,xmm3 ; xmm1=(02 12 22 32 03 13 23 33) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm4 ; xmm2=(04 14 24 34 05 15 25 35) + punpckhdq xmm5,xmm4 ; xmm5=(06 16 26 36 07 17 27 37) - movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) - movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=(60 70 61 71 62 72 63 73) + movdqa xmm4, XMMWORD [wk(5)] ; xmm4=(64 74 65 75 66 76 67 77) - movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) - movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) + movdqa XMMWORD [wk(6)], xmm2 ; wk(6)=(04 14 24 34 05 15 25 35) + movdqa XMMWORD [wk(7)], xmm5 ; wk(7)=(06 16 26 36 07 17 27 37) - movdqa xmm2,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) - punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) - punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) + movdqa xmm2,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(40 50 60 70 41 51 61 71) + punpckhdq xmm2,xmm3 ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm4 ; xmm6=(44 54 64 74 45 55 65 75) + punpckhdq xmm5,xmm4 ; xmm5=(46 56 66 76 47 57 67 77) - movdqa xmm3,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) - punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) - movdqa xmm4,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) - punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) + movdqa xmm3,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm0 ; xmm7=col0=(00 10 20 30 40 50 60 70) + punpckhqdq xmm3,xmm0 ; xmm3=col1=(01 11 21 31 41 51 61 71) + movdqa xmm4,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm2 ; xmm1=col2=(02 12 22 32 42 52 62 72) + punpckhqdq xmm4,xmm2 ; xmm4=col3=(03 13 23 33 43 53 63 73) - movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) - movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) + movdqa xmm0, XMMWORD [wk(6)] ; xmm0=(04 14 24 34 05 15 25 35) + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=(06 16 26 36 07 17 27 37) - movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 - movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 + movdqa XMMWORD [wk(8)], xmm3 ; wk(8)=col1 + movdqa XMMWORD [wk(9)], xmm4 ; wk(9)=col3 - movdqa xmm3,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) - punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) - movdqa xmm4,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) - punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=col4=(04 14 24 34 44 54 64 74) + punpckhqdq xmm3,xmm6 ; xmm3=col5=(05 15 25 35 45 55 65 75) + movdqa xmm4,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm5 ; xmm2=col6=(06 16 26 36 46 56 66 76) + punpckhqdq xmm4,xmm5 ; xmm4=col7=(07 17 27 37 47 57 67 77) - movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 - movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 + movdqa XMMWORD [wk(10)], xmm3 ; wk(10)=col5 + movdqa XMMWORD [wk(11)], xmm4 ; wk(11)=col7 .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] - ; -- Even part + ; -- Even part - ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 + ; xmm7=col0, xmm1=col2, xmm0=col4, xmm2=col6 - ; (Original) - ; z1 = (z2 + z3) * 0.541196100; - ; tmp2 = z1 + z3 * -1.847759065; - ; tmp3 = z1 + z2 * 0.765366865; - ; - ; (This implementation) - ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); - ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; + ; (Original) + ; z1 = (z2 + z3) * 0.541196100; + ; tmp2 = z1 + z3 * -1.847759065; + ; tmp3 = z1 + z2 * 0.765366865; + ; + ; (This implementation) + ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); + ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; - movdqa xmm6,xmm1 ; xmm1=in2=z2 - movdqa xmm5,xmm1 - punpcklwd xmm6,xmm2 ; xmm2=in6=z3 - punpckhwd xmm5,xmm2 - movdqa xmm1,xmm6 - movdqa xmm2,xmm5 - pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=tmp3L - pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H - pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L - pmaddwd xmm2,[GOTOFF(ebx,PW_F054_MF130)] ; xmm2=tmp2H + movdqa xmm6,xmm1 ; xmm1=in2=z2 + movdqa xmm5,xmm1 + punpcklwd xmm6,xmm2 ; xmm2=in6=z3 + punpckhwd xmm5,xmm2 + movdqa xmm1,xmm6 + movdqa xmm2,xmm5 + pmaddwd xmm6,[GOTOFF(ebx,PW_F130_F054)] ; xmm6=tmp3L + pmaddwd xmm5,[GOTOFF(ebx,PW_F130_F054)] ; xmm5=tmp3H + pmaddwd xmm1,[GOTOFF(ebx,PW_F054_MF130)] ; xmm1=tmp2L + pmaddwd xmm2,[GOTOFF(ebx,PW_F054_MF130)] ; xmm2=tmp2H - movdqa xmm3,xmm7 - paddw xmm7,xmm0 ; xmm7=in0+in4 - psubw xmm3,xmm0 ; xmm3=in0-in4 + movdqa xmm3,xmm7 + paddw xmm7,xmm0 ; xmm7=in0+in4 + psubw xmm3,xmm0 ; xmm3=in0-in4 - pxor xmm4,xmm4 - pxor xmm0,xmm0 - punpcklwd xmm4,xmm7 ; xmm4=tmp0L - punpckhwd xmm0,xmm7 ; xmm0=tmp0H - psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS - psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS + pxor xmm4,xmm4 + pxor xmm0,xmm0 + punpcklwd xmm4,xmm7 ; xmm4=tmp0L + punpckhwd xmm0,xmm7 ; xmm0=tmp0H + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + psrad xmm0,(16-CONST_BITS) ; psrad xmm0,16 & pslld xmm0,CONST_BITS - movdqa xmm7,xmm4 - paddd xmm4,xmm6 ; xmm4=tmp10L - psubd xmm7,xmm6 ; xmm7=tmp13L - movdqa xmm6,xmm0 - paddd xmm0,xmm5 ; xmm0=tmp10H - psubd xmm6,xmm5 ; xmm6=tmp13H + movdqa xmm7,xmm4 + paddd xmm4,xmm6 ; xmm4=tmp10L + psubd xmm7,xmm6 ; xmm7=tmp13L + movdqa xmm6,xmm0 + paddd xmm0,xmm5 ; xmm0=tmp10H + psubd xmm6,xmm5 ; xmm6=tmp13H - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H - movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L - movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=tmp10L + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp10H + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=tmp13L + movdqa XMMWORD [wk(3)], xmm6 ; wk(3)=tmp13H - pxor xmm5,xmm5 - pxor xmm4,xmm4 - punpcklwd xmm5,xmm3 ; xmm5=tmp1L - punpckhwd xmm4,xmm3 ; xmm4=tmp1H - psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS - psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS + pxor xmm5,xmm5 + pxor xmm4,xmm4 + punpcklwd xmm5,xmm3 ; xmm5=tmp1L + punpckhwd xmm4,xmm3 ; xmm4=tmp1H + psrad xmm5,(16-CONST_BITS) ; psrad xmm5,16 & pslld xmm5,CONST_BITS + psrad xmm4,(16-CONST_BITS) ; psrad xmm4,16 & pslld xmm4,CONST_BITS - movdqa xmm0,xmm5 - paddd xmm5,xmm1 ; xmm5=tmp11L - psubd xmm0,xmm1 ; xmm0=tmp12L - movdqa xmm7,xmm4 - paddd xmm4,xmm2 ; xmm4=tmp11H - psubd xmm7,xmm2 ; xmm7=tmp12H + movdqa xmm0,xmm5 + paddd xmm5,xmm1 ; xmm5=tmp11L + psubd xmm0,xmm1 ; xmm0=tmp12L + movdqa xmm7,xmm4 + paddd xmm4,xmm2 ; xmm4=tmp11H + psubd xmm7,xmm2 ; xmm7=tmp12H - movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L - movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L - movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H + movdqa XMMWORD [wk(4)], xmm5 ; wk(4)=tmp11L + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=tmp11H + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=tmp12L + movdqa XMMWORD [wk(7)], xmm7 ; wk(7)=tmp12H - ; -- Odd part + ; -- Odd part - movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 - movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 - movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 - movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 + movdqa xmm6, XMMWORD [wk(9)] ; xmm6=col3 + movdqa xmm3, XMMWORD [wk(8)] ; xmm3=col1 + movdqa xmm1, XMMWORD [wk(11)] ; xmm1=col7 + movdqa xmm2, XMMWORD [wk(10)] ; xmm2=col5 - movdqa xmm5,xmm6 - movdqa xmm4,xmm3 - paddw xmm5,xmm1 ; xmm5=z3 - paddw xmm4,xmm2 ; xmm4=z4 + movdqa xmm5,xmm6 + movdqa xmm4,xmm3 + paddw xmm5,xmm1 ; xmm5=z3 + paddw xmm4,xmm2 ; xmm4=z4 - ; (Original) - ; z5 = (z3 + z4) * 1.175875602; - ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; - ; z3 += z5; z4 += z5; - ; - ; (This implementation) - ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; - ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); + ; (Original) + ; z5 = (z3 + z4) * 1.175875602; + ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; + ; z3 += z5; z4 += z5; + ; + ; (This implementation) + ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; + ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm0,xmm5 - movdqa xmm7,xmm5 - punpcklwd xmm0,xmm4 - punpckhwd xmm7,xmm4 - movdqa xmm5,xmm0 - movdqa xmm4,xmm7 - pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3L - pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3H - pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L - pmaddwd xmm4,[GOTOFF(ebx,PW_F117_F078)] ; xmm4=z4H + movdqa xmm0,xmm5 + movdqa xmm7,xmm5 + punpcklwd xmm0,xmm4 + punpckhwd xmm7,xmm4 + movdqa xmm5,xmm0 + movdqa xmm4,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF078_F117)] ; xmm0=z3L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF078_F117)] ; xmm7=z3H + pmaddwd xmm5,[GOTOFF(ebx,PW_F117_F078)] ; xmm5=z4L + pmaddwd xmm4,[GOTOFF(ebx,PW_F117_F078)] ; xmm4=z4H - movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L - movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=z3L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=z3H - ; (Original) - ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; - ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; - ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; - ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; tmp0 += z1 + z3; tmp1 += z2 + z4; - ; tmp2 += z2 + z3; tmp3 += z1 + z4; - ; - ; (This implementation) - ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; - ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; - ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); - ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); - ; tmp0 += z3; tmp1 += z4; - ; tmp2 += z3; tmp3 += z4; + ; (Original) + ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; + ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; + ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; + ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; + ; tmp0 += z1 + z3; tmp1 += z2 + z4; + ; tmp2 += z2 + z3; tmp3 += z1 + z4; + ; + ; (This implementation) + ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; + ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; + ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); + ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); + ; tmp0 += z3; tmp1 += z4; + ; tmp2 += z3; tmp3 += z4; - movdqa xmm0,xmm1 - movdqa xmm7,xmm1 - punpcklwd xmm0,xmm3 - punpckhwd xmm7,xmm3 - movdqa xmm1,xmm0 - movdqa xmm3,xmm7 - pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0L - pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp0H - pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp3L - pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3H + movdqa xmm0,xmm1 + movdqa xmm7,xmm1 + punpcklwd xmm0,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm1,xmm0 + movdqa xmm3,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm0=tmp0L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF089)] ; xmm7=tmp0H + pmaddwd xmm1,[GOTOFF(ebx,PW_MF089_F060)] ; xmm1=tmp3L + pmaddwd xmm3,[GOTOFF(ebx,PW_MF089_F060)] ; xmm3=tmp3H - paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L - paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H - paddd xmm1,xmm5 ; xmm1=tmp3L - paddd xmm3,xmm4 ; xmm3=tmp3H + paddd xmm0, XMMWORD [wk(10)] ; xmm0=tmp0L + paddd xmm7, XMMWORD [wk(11)] ; xmm7=tmp0H + paddd xmm1,xmm5 ; xmm1=tmp3L + paddd xmm3,xmm4 ; xmm3=tmp3H - movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L - movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H + movdqa XMMWORD [wk(8)], xmm0 ; wk(8)=tmp0L + movdqa XMMWORD [wk(9)], xmm7 ; wk(9)=tmp0H - movdqa xmm0,xmm2 - movdqa xmm7,xmm2 - punpcklwd xmm0,xmm6 - punpckhwd xmm7,xmm6 - movdqa xmm2,xmm0 - movdqa xmm6,xmm7 - pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1L - pmaddwd xmm7,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm7=tmp1H - pmaddwd xmm2,[GOTOFF(ebx,PW_MF256_F050)] ; xmm2=tmp2L - pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H + movdqa xmm0,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm0,xmm6 + punpckhwd xmm7,xmm6 + movdqa xmm2,xmm0 + movdqa xmm6,xmm7 + pmaddwd xmm0,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm0=tmp1L + pmaddwd xmm7,[GOTOFF(ebx,PW_MF050_MF256)] ; xmm7=tmp1H + pmaddwd xmm2,[GOTOFF(ebx,PW_MF256_F050)] ; xmm2=tmp2L + pmaddwd xmm6,[GOTOFF(ebx,PW_MF256_F050)] ; xmm6=tmp2H - paddd xmm0,xmm5 ; xmm0=tmp1L - paddd xmm7,xmm4 ; xmm7=tmp1H - paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L - paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H + paddd xmm0,xmm5 ; xmm0=tmp1L + paddd xmm7,xmm4 ; xmm7=tmp1H + paddd xmm2, XMMWORD [wk(10)] ; xmm2=tmp2L + paddd xmm6, XMMWORD [wk(11)] ; xmm6=tmp2H - movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L - movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H + movdqa XMMWORD [wk(10)], xmm0 ; wk(10)=tmp1L + movdqa XMMWORD [wk(11)], xmm7 ; wk(11)=tmp1H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L - movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=tmp10L + movdqa xmm4, XMMWORD [wk(1)] ; xmm4=tmp10H - movdqa xmm0,xmm5 - movdqa xmm7,xmm4 - paddd xmm5,xmm1 ; xmm5=data0L - paddd xmm4,xmm3 ; xmm4=data0H - psubd xmm0,xmm1 ; xmm0=data7L - psubd xmm7,xmm3 ; xmm7=data7H + movdqa xmm0,xmm5 + movdqa xmm7,xmm4 + paddd xmm5,xmm1 ; xmm5=data0L + paddd xmm4,xmm3 ; xmm4=data0H + psubd xmm0,xmm1 ; xmm0=data7L + psubd xmm7,xmm3 ; xmm7=data7H - movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm1=[PD_DESCALE_P2] + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm1=[PD_DESCALE_P2] - paddd xmm5,xmm1 - paddd xmm4,xmm1 - psrad xmm5,DESCALE_P2 - psrad xmm4,DESCALE_P2 - paddd xmm0,xmm1 - paddd xmm7,xmm1 - psrad xmm0,DESCALE_P2 - psrad xmm7,DESCALE_P2 + paddd xmm5,xmm1 + paddd xmm4,xmm1 + psrad xmm5,DESCALE_P2 + psrad xmm4,DESCALE_P2 + paddd xmm0,xmm1 + paddd xmm7,xmm1 + psrad xmm0,DESCALE_P2 + psrad xmm7,DESCALE_P2 - packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) - packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) + packssdw xmm5,xmm4 ; xmm5=data0=(00 10 20 30 40 50 60 70) + packssdw xmm0,xmm7 ; xmm0=data7=(07 17 27 37 47 57 67 77) - movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L - movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H + movdqa xmm3, XMMWORD [wk(4)] ; xmm3=tmp11L + movdqa xmm1, XMMWORD [wk(5)] ; xmm1=tmp11H - movdqa xmm4,xmm3 - movdqa xmm7,xmm1 - paddd xmm3,xmm2 ; xmm3=data1L - paddd xmm1,xmm6 ; xmm1=data1H - psubd xmm4,xmm2 ; xmm4=data6L - psubd xmm7,xmm6 ; xmm7=data6H + movdqa xmm4,xmm3 + movdqa xmm7,xmm1 + paddd xmm3,xmm2 ; xmm3=data1L + paddd xmm1,xmm6 ; xmm1=data1H + psubd xmm4,xmm2 ; xmm4=data6L + psubd xmm7,xmm6 ; xmm7=data6H - movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm2=[PD_DESCALE_P2] + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm2=[PD_DESCALE_P2] - paddd xmm3,xmm2 - paddd xmm1,xmm2 - psrad xmm3,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm4,xmm2 - paddd xmm7,xmm2 - psrad xmm4,DESCALE_P2 - psrad xmm7,DESCALE_P2 + paddd xmm3,xmm2 + paddd xmm1,xmm2 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm4,xmm2 + paddd xmm7,xmm2 + psrad xmm4,DESCALE_P2 + psrad xmm7,DESCALE_P2 - packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) - packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) + packssdw xmm3,xmm1 ; xmm3=data1=(01 11 21 31 41 51 61 71) + packssdw xmm4,xmm7 ; xmm4=data6=(06 16 26 36 46 56 66 76) - packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + packsswb xmm5,xmm4 ; xmm5=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + packsswb xmm3,xmm0 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L - movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H - movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L - movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H + movdqa xmm6, XMMWORD [wk(6)] ; xmm6=tmp12L + movdqa xmm2, XMMWORD [wk(7)] ; xmm2=tmp12H + movdqa xmm1, XMMWORD [wk(10)] ; xmm1=tmp1L + movdqa xmm7, XMMWORD [wk(11)] ; xmm7=tmp1H - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - movdqa xmm4,xmm6 - movdqa xmm0,xmm2 - paddd xmm6,xmm1 ; xmm6=data2L - paddd xmm2,xmm7 ; xmm2=data2H - psubd xmm4,xmm1 ; xmm4=data5L - psubd xmm0,xmm7 ; xmm0=data5H + movdqa xmm4,xmm6 + movdqa xmm0,xmm2 + paddd xmm6,xmm1 ; xmm6=data2L + paddd xmm2,xmm7 ; xmm2=data2H + psubd xmm4,xmm1 ; xmm4=data5L + psubd xmm0,xmm7 ; xmm0=data5H - movdqa xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm5=[PD_DESCALE_P2] + movdqa xmm5,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm5=[PD_DESCALE_P2] - paddd xmm6,xmm5 - paddd xmm2,xmm5 - psrad xmm6,DESCALE_P2 - psrad xmm2,DESCALE_P2 - paddd xmm4,xmm5 - paddd xmm0,xmm5 - psrad xmm4,DESCALE_P2 - psrad xmm0,DESCALE_P2 + paddd xmm6,xmm5 + paddd xmm2,xmm5 + psrad xmm6,DESCALE_P2 + psrad xmm2,DESCALE_P2 + paddd xmm4,xmm5 + paddd xmm0,xmm5 + psrad xmm4,DESCALE_P2 + psrad xmm0,DESCALE_P2 - packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) - packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) + packssdw xmm6,xmm2 ; xmm6=data2=(02 12 22 32 42 52 62 72) + packssdw xmm4,xmm0 ; xmm4=data5=(05 15 25 35 45 55 65 75) - movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L - movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H - movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L - movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H + movdqa xmm3, XMMWORD [wk(2)] ; xmm3=tmp13L + movdqa xmm1, XMMWORD [wk(3)] ; xmm1=tmp13H + movdqa xmm7, XMMWORD [wk(8)] ; xmm7=tmp0L + movdqa xmm5, XMMWORD [wk(9)] ; xmm5=tmp0H - movdqa xmm2,xmm3 - movdqa xmm0,xmm1 - paddd xmm3,xmm7 ; xmm3=data3L - paddd xmm1,xmm5 ; xmm1=data3H - psubd xmm2,xmm7 ; xmm2=data4L - psubd xmm0,xmm5 ; xmm0=data4H + movdqa xmm2,xmm3 + movdqa xmm0,xmm1 + paddd xmm3,xmm7 ; xmm3=data3L + paddd xmm1,xmm5 ; xmm1=data3H + psubd xmm2,xmm7 ; xmm2=data4L + psubd xmm0,xmm5 ; xmm0=data4H - movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm7=[PD_DESCALE_P2] + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P2)] ; xmm7=[PD_DESCALE_P2] - paddd xmm3,xmm7 - paddd xmm1,xmm7 - psrad xmm3,DESCALE_P2 - psrad xmm1,DESCALE_P2 - paddd xmm2,xmm7 - paddd xmm0,xmm7 - psrad xmm2,DESCALE_P2 - psrad xmm0,DESCALE_P2 + paddd xmm3,xmm7 + paddd xmm1,xmm7 + psrad xmm3,DESCALE_P2 + psrad xmm1,DESCALE_P2 + paddd xmm2,xmm7 + paddd xmm0,xmm7 + psrad xmm2,DESCALE_P2 + psrad xmm0,DESCALE_P2 - movdqa xmm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm5=[PB_CENTERJSAMP] + movdqa xmm5,[GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm5=[PB_CENTERJSAMP] - packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) - packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) + packssdw xmm3,xmm1 ; xmm3=data3=(03 13 23 33 43 53 63 73) + packssdw xmm2,xmm0 ; xmm2=data4=(04 14 24 34 44 54 64 74) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) - packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) - packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) + packsswb xmm6,xmm2 ; xmm6=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) + packsswb xmm3,xmm4 ; xmm3=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) - paddb xmm7,xmm5 - paddb xmm1,xmm5 - paddb xmm6,xmm5 - paddb xmm3,xmm5 + paddb xmm7,xmm5 + paddb xmm1,xmm5 + paddb xmm6,xmm5 + paddb xmm3,xmm5 - movdqa xmm0,xmm7 ; transpose coefficients(phase 1) - punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) - punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) - punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklbw xmm7,xmm1 ; xmm7=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) + punpckhbw xmm0,xmm1 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklbw xmm6,xmm3 ; xmm6=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) + punpckhbw xmm2,xmm3 ; xmm2=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) - movdqa xmm4,xmm7 ; transpose coefficients(phase 2) - punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) - punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) - movdqa xmm5,xmm2 ; transpose coefficients(phase 2) - punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) - punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) + movdqa xmm4,xmm7 ; transpose coefficients(phase 2) + punpcklwd xmm7,xmm6 ; xmm7=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) + punpckhwd xmm4,xmm6 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) + movdqa xmm5,xmm2 ; transpose coefficients(phase 2) + punpcklwd xmm2,xmm0 ; xmm2=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) + punpckhwd xmm5,xmm0 ; xmm5=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) - punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) - movdqa xmm3,xmm4 ; transpose coefficients(phase 3) - punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) - punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpckldq xmm7,xmm2 ; xmm7=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) + punpckhdq xmm1,xmm2 ; xmm1=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) + movdqa xmm3,xmm4 ; transpose coefficients(phase 3) + punpckldq xmm4,xmm5 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) + punpckhdq xmm3,xmm5 ; xmm3=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) - pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) - pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) - pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) - pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) + pshufd xmm6,xmm7,0x4E ; xmm6=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) + pshufd xmm0,xmm1,0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) + pshufd xmm2,xmm4,0x4E ; xmm2=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) + pshufd xmm5,xmm3,0x4E ; xmm5=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm7 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm1 - mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm7 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm1 + mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+6*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 - mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 - mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] - movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm2 - movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm5 + mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm0 + mov edx, JSAMPROW [edi+5*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] + movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm2 + movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm5 - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2red-64.asm b/simd/jiss2red-64.asm index 6807f17c..bd7c35c4 100644 --- a/simd/jiss2red-64.asm +++ b/simd/jiss2red-64.asm @@ -27,74 +27,74 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) -%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) -%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) -%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) %if CONST_BITS == 13 -F_0_211 equ 1730 ; FIX(0.211164243) -F_0_509 equ 4176 ; FIX(0.509795579) -F_0_601 equ 4926 ; FIX(0.601344887) -F_0_720 equ 5906 ; FIX(0.720959822) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_850 equ 6967 ; FIX(0.850430095) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_061 equ 8697 ; FIX(1.061594337) -F_1_272 equ 10426 ; FIX(1.272758580) -F_1_451 equ 11893 ; FIX(1.451774981) -F_1_847 equ 15137 ; FIX(1.847759065) -F_2_172 equ 17799 ; FIX(2.172734803) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_624 equ 29692 ; FIX(3.624509785) +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) -F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) -F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) -F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) -F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) -F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_red_sse2) + alignz 16 + global EXTN(jconst_idct_red_sse2) EXTN(jconst_idct_red_sse2): -PW_F184_MF076 times 4 dw F_1_847,-F_0_765 -PW_F256_F089 times 4 dw F_2_562, F_0_899 -PW_F106_MF217 times 4 dw F_1_061,-F_2_172 -PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 -PW_F145_MF021 times 4 dw F_1_451,-F_0_211 -PW_F362_MF127 times 4 dw F_3_624,-F_1_272 -PW_F085_MF072 times 4 dw F_0_850,-F_0_720 -PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) -PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) -PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) -PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F184_MF076 times 4 dw F_1_847,-F_0_765 +PW_F256_F089 times 4 dw F_2_562, F_0_899 +PW_F106_MF217 times 4 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 4 dw F_1_451,-F_0_211 +PW_F362_MF127 times 4 dw F_3_624,-F_1_272 +PW_F085_MF072 times 4 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 64 + SECTION SEG_TEXT + BITS 64 ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 4x4 output block. @@ -109,292 +109,292 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; r12 = JSAMPARRAY output_buf ; r13 = JDIMENSION output_col -%define original_rbp rbp+0 -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_rbp rbp+0 +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_idct_4x4_sse2) + align 16 + global EXTN(jsimd_idct_4x4_sse2) EXTN(jsimd_idct_4x4_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] - collect_args + push rbp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] + collect_args - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov rdx, r10 ; quantptr - mov rsi, r11 ; inptr + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr %ifndef NO_ZERO_COLUMN_TEST_4X4_SSE2 - mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] + jnz short .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - por xmm0,xmm1 - packsswb xmm0,xmm0 - packsswb xmm0,xmm0 - movd eax,xmm0 - test rax,rax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + por xmm0,xmm1 + packsswb xmm0,xmm0 + packsswb xmm0,xmm0 + movd eax,xmm0 + test rax,rax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - psllw xmm0,PASS1_BITS + psllw xmm0,PASS1_BITS - movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) + movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) - pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) - pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) - pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) - pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) + pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) + pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) + pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) + pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) - jmp near .column_end + jmp near .column_end %endif .columnDCT: - ; -- Odd part + ; -- Odd part - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm4,xmm0 - movdqa xmm5,xmm0 - punpcklwd xmm4,xmm1 - punpckhwd xmm5,xmm1 - movdqa xmm0,xmm4 - movdqa xmm1,xmm5 - pmaddwd xmm4,[rel PW_F256_F089] ; xmm4=(tmp2L) - pmaddwd xmm5,[rel PW_F256_F089] ; xmm5=(tmp2H) - pmaddwd xmm0,[rel PW_F106_MF217] ; xmm0=(tmp0L) - pmaddwd xmm1,[rel PW_F106_MF217] ; xmm1=(tmp0H) + movdqa xmm4,xmm0 + movdqa xmm5,xmm0 + punpcklwd xmm4,xmm1 + punpckhwd xmm5,xmm1 + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + pmaddwd xmm4,[rel PW_F256_F089] ; xmm4=(tmp2L) + pmaddwd xmm5,[rel PW_F256_F089] ; xmm5=(tmp2H) + pmaddwd xmm0,[rel PW_F106_MF217] ; xmm0=(tmp0L) + pmaddwd xmm1,[rel PW_F106_MF217] ; xmm1=(tmp0H) - movdqa xmm6,xmm2 - movdqa xmm7,xmm2 - punpcklwd xmm6,xmm3 - punpckhwd xmm7,xmm3 - movdqa xmm2,xmm6 - movdqa xmm3,xmm7 - pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2L) - pmaddwd xmm7,[rel PW_MF060_MF050] ; xmm7=(tmp2H) - pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0L) - pmaddwd xmm3,[rel PW_F145_MF021] ; xmm3=(tmp0H) + movdqa xmm6,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm6,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2L) + pmaddwd xmm7,[rel PW_MF060_MF050] ; xmm7=(tmp2H) + pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0L) + pmaddwd xmm3,[rel PW_F145_MF021] ; xmm3=(tmp0H) - paddd xmm6,xmm4 ; xmm6=tmp2L - paddd xmm7,xmm5 ; xmm7=tmp2H - paddd xmm2,xmm0 ; xmm2=tmp0L - paddd xmm3,xmm1 ; xmm3=tmp0H + paddd xmm6,xmm4 ; xmm6=tmp2L + paddd xmm7,xmm5 ; xmm7=tmp2H + paddd xmm2,xmm0 ; xmm2=tmp0L + paddd xmm3,xmm1 ; xmm3=tmp0H - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H - ; -- Even part + ; -- Even part - movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - movdqa xmm5, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] - movdqa xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] - pmullw xmm4, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm5, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm0, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + movdqa xmm5, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] + movdqa xmm0, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm5, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm0, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pxor xmm1,xmm1 - pxor xmm2,xmm2 - punpcklwd xmm1,xmm4 ; xmm1=tmp0L - punpckhwd xmm2,xmm4 ; xmm2=tmp0H - psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 - psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 + pxor xmm1,xmm1 + pxor xmm2,xmm2 + punpcklwd xmm1,xmm4 ; xmm1=tmp0L + punpckhwd xmm2,xmm4 ; xmm2=tmp0H + psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 + psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 - movdqa xmm3,xmm5 ; xmm5=in2=z2 - punpcklwd xmm5,xmm0 ; xmm0=in6=z3 - punpckhwd xmm3,xmm0 - pmaddwd xmm5,[rel PW_F184_MF076] ; xmm5=tmp2L - pmaddwd xmm3,[rel PW_F184_MF076] ; xmm3=tmp2H + movdqa xmm3,xmm5 ; xmm5=in2=z2 + punpcklwd xmm5,xmm0 ; xmm0=in6=z3 + punpckhwd xmm3,xmm0 + pmaddwd xmm5,[rel PW_F184_MF076] ; xmm5=tmp2L + pmaddwd xmm3,[rel PW_F184_MF076] ; xmm3=tmp2H - movdqa xmm4,xmm1 - movdqa xmm0,xmm2 - paddd xmm1,xmm5 ; xmm1=tmp10L - paddd xmm2,xmm3 ; xmm2=tmp10H - psubd xmm4,xmm5 ; xmm4=tmp12L - psubd xmm0,xmm3 ; xmm0=tmp12H + movdqa xmm4,xmm1 + movdqa xmm0,xmm2 + paddd xmm1,xmm5 ; xmm1=tmp10L + paddd xmm2,xmm3 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp12L + psubd xmm0,xmm3 ; xmm0=tmp12H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5,xmm1 - movdqa xmm3,xmm2 - paddd xmm1,xmm6 ; xmm1=data0L - paddd xmm2,xmm7 ; xmm2=data0H - psubd xmm5,xmm6 ; xmm5=data3L - psubd xmm3,xmm7 ; xmm3=data3H + movdqa xmm5,xmm1 + movdqa xmm3,xmm2 + paddd xmm1,xmm6 ; xmm1=data0L + paddd xmm2,xmm7 ; xmm2=data0H + psubd xmm5,xmm6 ; xmm5=data3L + psubd xmm3,xmm7 ; xmm3=data3H - movdqa xmm6,[rel PD_DESCALE_P1_4] ; xmm6=[rel PD_DESCALE_P1_4] + movdqa xmm6,[rel PD_DESCALE_P1_4] ; xmm6=[rel PD_DESCALE_P1_4] - paddd xmm1,xmm6 - paddd xmm2,xmm6 - psrad xmm1,DESCALE_P1_4 - psrad xmm2,DESCALE_P1_4 - paddd xmm5,xmm6 - paddd xmm3,xmm6 - psrad xmm5,DESCALE_P1_4 - psrad xmm3,DESCALE_P1_4 + paddd xmm1,xmm6 + paddd xmm2,xmm6 + psrad xmm1,DESCALE_P1_4 + psrad xmm2,DESCALE_P1_4 + paddd xmm5,xmm6 + paddd xmm3,xmm6 + psrad xmm5,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 - packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) - packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) + packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) + packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H - movdqa xmm2,xmm4 - movdqa xmm3,xmm0 - paddd xmm4,xmm7 ; xmm4=data1L - paddd xmm0,xmm6 ; xmm0=data1H - psubd xmm2,xmm7 ; xmm2=data2L - psubd xmm3,xmm6 ; xmm3=data2H + movdqa xmm2,xmm4 + movdqa xmm3,xmm0 + paddd xmm4,xmm7 ; xmm4=data1L + paddd xmm0,xmm6 ; xmm0=data1H + psubd xmm2,xmm7 ; xmm2=data2L + psubd xmm3,xmm6 ; xmm3=data2H - movdqa xmm7,[rel PD_DESCALE_P1_4] ; xmm7=[rel PD_DESCALE_P1_4] + movdqa xmm7,[rel PD_DESCALE_P1_4] ; xmm7=[rel PD_DESCALE_P1_4] - paddd xmm4,xmm7 - paddd xmm0,xmm7 - psrad xmm4,DESCALE_P1_4 - psrad xmm0,DESCALE_P1_4 - paddd xmm2,xmm7 - paddd xmm3,xmm7 - psrad xmm2,DESCALE_P1_4 - psrad xmm3,DESCALE_P1_4 + paddd xmm4,xmm7 + paddd xmm0,xmm7 + psrad xmm4,DESCALE_P1_4 + psrad xmm0,DESCALE_P1_4 + paddd xmm2,xmm7 + paddd xmm3,xmm7 + psrad xmm2,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 - packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) - packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) + packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) - movdqa xmm6,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) - punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) - movdqa xmm7,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm7,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) - movdqa xmm0,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) - punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) - movdqa xmm3,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) - punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) + punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) + movdqa xmm3,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) + punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows, store into output array. + ; ---- Pass 2: process rows, store into output array. - mov rax, [original_rbp] - mov rdi, r12 ; (JSAMPROW *) - mov rax, r13 + mov rax, [original_rbp] + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 - ; -- Even part + ; -- Even part - pxor xmm4,xmm4 - punpcklwd xmm4,xmm1 ; xmm4=tmp0 - psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 + pxor xmm4,xmm4 + punpcklwd xmm4,xmm1 ; xmm4=tmp0 + psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 - ; -- Odd part + ; -- Odd part - punpckhwd xmm1,xmm0 - punpckhwd xmm6,xmm3 - movdqa xmm5,xmm1 - movdqa xmm2,xmm6 - pmaddwd xmm1,[rel PW_F256_F089] ; xmm1=(tmp2) - pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2) - pmaddwd xmm5,[rel PW_F106_MF217] ; xmm5=(tmp0) - pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0) + punpckhwd xmm1,xmm0 + punpckhwd xmm6,xmm3 + movdqa xmm5,xmm1 + movdqa xmm2,xmm6 + pmaddwd xmm1,[rel PW_F256_F089] ; xmm1=(tmp2) + pmaddwd xmm6,[rel PW_MF060_MF050] ; xmm6=(tmp2) + pmaddwd xmm5,[rel PW_F106_MF217] ; xmm5=(tmp0) + pmaddwd xmm2,[rel PW_F145_MF021] ; xmm2=(tmp0) - paddd xmm6,xmm1 ; xmm6=tmp2 - paddd xmm2,xmm5 ; xmm2=tmp0 + paddd xmm6,xmm1 ; xmm6=tmp2 + paddd xmm2,xmm5 ; xmm2=tmp0 - ; -- Even part + ; -- Even part - punpcklwd xmm0,xmm3 - pmaddwd xmm0,[rel PW_F184_MF076] ; xmm0=tmp2 + punpcklwd xmm0,xmm3 + pmaddwd xmm0,[rel PW_F184_MF076] ; xmm0=tmp2 - movdqa xmm7,xmm4 - paddd xmm4,xmm0 ; xmm4=tmp10 - psubd xmm7,xmm0 ; xmm7=tmp12 + movdqa xmm7,xmm4 + paddd xmm4,xmm0 ; xmm4=tmp10 + psubd xmm7,xmm0 ; xmm7=tmp12 - ; -- Final output stage + ; -- Final output stage - movdqa xmm1,[rel PD_DESCALE_P2_4] ; xmm1=[rel PD_DESCALE_P2_4] + movdqa xmm1,[rel PD_DESCALE_P2_4] ; xmm1=[rel PD_DESCALE_P2_4] - movdqa xmm5,xmm4 - movdqa xmm3,xmm7 - paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) - paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) - psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) - psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + movdqa xmm5,xmm4 + movdqa xmm3,xmm7 + paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) + paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) + psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) + psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) - paddd xmm4,xmm1 - paddd xmm7,xmm1 - psrad xmm4,DESCALE_P2_4 - psrad xmm7,DESCALE_P2_4 - paddd xmm5,xmm1 - paddd xmm3,xmm1 - psrad xmm5,DESCALE_P2_4 - psrad xmm3,DESCALE_P2_4 + paddd xmm4,xmm1 + paddd xmm7,xmm1 + psrad xmm4,DESCALE_P2_4 + psrad xmm7,DESCALE_P2_4 + paddd xmm5,xmm1 + paddd xmm3,xmm1 + psrad xmm5,DESCALE_P2_4 + psrad xmm3,DESCALE_P2_4 - packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) - packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) + packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) + packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) - punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) + punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) - punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) + punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) - packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) - paddb xmm4,[rel PB_CENTERJSAMP] + packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) + paddb xmm4,[rel PB_CENTERJSAMP] - pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) - pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) - pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) + pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) + pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) + pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] - movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 - movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 - mov rdx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] - movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 - movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 + movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 + mov rdx, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] + movd XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 + movd XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 - uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp - ret + uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp + pop rbp + ret ; -------------------------------------------------------------------------- @@ -412,165 +412,165 @@ EXTN(jsimd_idct_4x4_sse2): ; r12 = JSAMPARRAY output_buf ; r13 = JDIMENSION output_col - align 16 - global EXTN(jsimd_idct_2x2_sse2) + align 16 + global EXTN(jsimd_idct_2x2_sse2) EXTN(jsimd_idct_2x2_sse2): - push rbp - mov rax,rsp - mov rbp,rsp - collect_args - push rbx + push rbp + mov rax,rsp + mov rbp,rsp + collect_args + push rbx - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov rdx, r10 ; quantptr - mov rsi, r11 ; inptr + mov rdx, r10 ; quantptr + mov rsi, r11 ; inptr - ; | input: | result: | - ; | 00 01 ** 03 ** 05 ** 07 | | - ; | 10 11 ** 13 ** 15 ** 17 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | - ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | - ; | 50 51 ** 53 ** 55 ** 57 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 70 71 ** 73 ** 75 ** 77 | | + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | - ; -- Odd part + ; -- Odd part - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) - ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) + ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) + ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) - pcmpeqd xmm7,xmm7 - pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} + pcmpeqd xmm7,xmm7 + pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} - movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) - movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) - punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) - punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) - pmaddwd xmm4,[rel PW_F362_MF127] - pmaddwd xmm5,[rel PW_F085_MF072] + movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) + movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) + punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) + punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) + pmaddwd xmm4,[rel PW_F362_MF127] + pmaddwd xmm5,[rel PW_F085_MF072] - psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) - pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) - psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) - pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) - por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) - por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) - pmaddwd xmm0,[rel PW_F362_MF127] - pmaddwd xmm2,[rel PW_F085_MF072] + psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) + pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) + psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) + pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) + por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) + por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) + pmaddwd xmm0,[rel PW_F362_MF127] + pmaddwd xmm2,[rel PW_F085_MF072] - paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] - paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] + paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] + paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] - ; -- Even part + ; -- Even part - movdqa xmm6, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] - pmullw xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm6, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] + pmullw xmm6, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] - ; xmm6=(00 01 ** 03 ** 05 ** 07) + ; xmm6=(00 01 ** 03 ** 05 ** 07) - movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) - pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) - pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) - psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] - psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] + movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) + pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) + pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) + psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] + psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] - ; -- Final output stage + ; -- Final output stage - movdqa xmm3,xmm6 - movdqa xmm5,xmm1 - paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) - paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) - psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) - psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) + movdqa xmm3,xmm6 + movdqa xmm5,xmm1 + paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) + paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) + psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) + psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) - movdqa xmm2,[rel PD_DESCALE_P1_2] ; xmm2=[rel PD_DESCALE_P1_2] + movdqa xmm2,[rel PD_DESCALE_P1_2] ; xmm2=[rel PD_DESCALE_P1_2] - punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) + punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) - movdqa xmm7,xmm1 - punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) - punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) + movdqa xmm7,xmm1 + punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) + punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) - paddd xmm6,xmm2 - psrad xmm6,DESCALE_P1_2 + paddd xmm6,xmm2 + psrad xmm6,DESCALE_P1_2 - paddd xmm1,xmm2 - paddd xmm7,xmm2 - psrad xmm1,DESCALE_P1_2 - psrad xmm7,DESCALE_P1_2 + paddd xmm1,xmm2 + paddd xmm7,xmm2 + psrad xmm1,DESCALE_P1_2 + psrad xmm7,DESCALE_P1_2 - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows, store into output array. + ; ---- Pass 2: process rows, store into output array. - mov rdi, r12 ; (JSAMPROW *) - mov rax, r13 + mov rdi, r12 ; (JSAMPROW *) + mov rax, r13 - ; | input:| result:| - ; | A0 B0 | | - ; | A1 B1 | C0 C1 | - ; | A3 B3 | D0 D1 | - ; | A5 B5 | | - ; | A7 B7 | | + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | - ; -- Odd part + ; -- Odd part - packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) - packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) - pmaddwd xmm1,[rel PW_F362_MF127] - pmaddwd xmm7,[rel PW_F085_MF072] + packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) + packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) + pmaddwd xmm1,[rel PW_F362_MF127] + pmaddwd xmm7,[rel PW_F085_MF072] - paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] + paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] - ; -- Even part + ; -- Even part - pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] + pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] - ; -- Final output stage + ; -- Final output stage - movdqa xmm4,xmm6 - paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) - psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) + movdqa xmm4,xmm6 + paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) + psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) - punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) + punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) - paddd xmm6,[rel PD_DESCALE_P2_2] - psrad xmm6,DESCALE_P2_2 + paddd xmm6,[rel PD_DESCALE_P2_2] + psrad xmm6,DESCALE_P2_2 - packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) - packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) - paddb xmm6,[rel PB_CENTERJSAMP] + packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) + packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) + paddb xmm6,[rel PB_CENTERJSAMP] - pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) - pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) + pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) + pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) - mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] - mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] - mov WORD [rdx+rax*SIZEOF_JSAMPLE], bx - mov WORD [rsi+rax*SIZEOF_JSAMPLE], cx + mov rdx, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] + mov rsi, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] + mov WORD [rdx+rax*SIZEOF_JSAMPLE], bx + mov WORD [rsi+rax*SIZEOF_JSAMPLE], cx - pop rbx - uncollect_args - pop rbp - ret + pop rbx + uncollect_args + pop rbp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jiss2red.asm b/simd/jiss2red.asm index 238c61d0..886d79d7 100644 --- a/simd/jiss2red.asm +++ b/simd/jiss2red.asm @@ -26,74 +26,74 @@ ; -------------------------------------------------------------------------- -%define CONST_BITS 13 -%define PASS1_BITS 2 +%define CONST_BITS 13 +%define PASS1_BITS 2 -%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) -%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) -%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) -%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) +%define DESCALE_P1_4 (CONST_BITS-PASS1_BITS+1) +%define DESCALE_P2_4 (CONST_BITS+PASS1_BITS+3+1) +%define DESCALE_P1_2 (CONST_BITS-PASS1_BITS+2) +%define DESCALE_P2_2 (CONST_BITS+PASS1_BITS+3+2) %if CONST_BITS == 13 -F_0_211 equ 1730 ; FIX(0.211164243) -F_0_509 equ 4176 ; FIX(0.509795579) -F_0_601 equ 4926 ; FIX(0.601344887) -F_0_720 equ 5906 ; FIX(0.720959822) -F_0_765 equ 6270 ; FIX(0.765366865) -F_0_850 equ 6967 ; FIX(0.850430095) -F_0_899 equ 7373 ; FIX(0.899976223) -F_1_061 equ 8697 ; FIX(1.061594337) -F_1_272 equ 10426 ; FIX(1.272758580) -F_1_451 equ 11893 ; FIX(1.451774981) -F_1_847 equ 15137 ; FIX(1.847759065) -F_2_172 equ 17799 ; FIX(2.172734803) -F_2_562 equ 20995 ; FIX(2.562915447) -F_3_624 equ 29692 ; FIX(3.624509785) +F_0_211 equ 1730 ; FIX(0.211164243) +F_0_509 equ 4176 ; FIX(0.509795579) +F_0_601 equ 4926 ; FIX(0.601344887) +F_0_720 equ 5906 ; FIX(0.720959822) +F_0_765 equ 6270 ; FIX(0.765366865) +F_0_850 equ 6967 ; FIX(0.850430095) +F_0_899 equ 7373 ; FIX(0.899976223) +F_1_061 equ 8697 ; FIX(1.061594337) +F_1_272 equ 10426 ; FIX(1.272758580) +F_1_451 equ 11893 ; FIX(1.451774981) +F_1_847 equ 15137 ; FIX(1.847759065) +F_2_172 equ 17799 ; FIX(2.172734803) +F_2_562 equ 20995 ; FIX(2.562915447) +F_3_624 equ 29692 ; FIX(3.624509785) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) -F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) -F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) -F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) -F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) -F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) -F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) -F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) -F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) -F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) -F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) -F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) -F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) -F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) -F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) +F_0_211 equ DESCALE( 226735879,30-CONST_BITS) ; FIX(0.211164243) +F_0_509 equ DESCALE( 547388834,30-CONST_BITS) ; FIX(0.509795579) +F_0_601 equ DESCALE( 645689155,30-CONST_BITS) ; FIX(0.601344887) +F_0_720 equ DESCALE( 774124714,30-CONST_BITS) ; FIX(0.720959822) +F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) +F_0_850 equ DESCALE( 913142361,30-CONST_BITS) ; FIX(0.850430095) +F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) +F_1_061 equ DESCALE(1139878239,30-CONST_BITS) ; FIX(1.061594337) +F_1_272 equ DESCALE(1366614119,30-CONST_BITS) ; FIX(1.272758580) +F_1_451 equ DESCALE(1558831516,30-CONST_BITS) ; FIX(1.451774981) +F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) +F_2_172 equ DESCALE(2332956230,30-CONST_BITS) ; FIX(2.172734803) +F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) +F_3_624 equ DESCALE(3891787747,30-CONST_BITS) ; FIX(3.624509785) %endif ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_red_sse2) + alignz 16 + global EXTN(jconst_idct_red_sse2) EXTN(jconst_idct_red_sse2): -PW_F184_MF076 times 4 dw F_1_847,-F_0_765 -PW_F256_F089 times 4 dw F_2_562, F_0_899 -PW_F106_MF217 times 4 dw F_1_061,-F_2_172 -PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 -PW_F145_MF021 times 4 dw F_1_451,-F_0_211 -PW_F362_MF127 times 4 dw F_3_624,-F_1_272 -PW_F085_MF072 times 4 dw F_0_850,-F_0_720 -PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) -PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) -PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) -PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) -PB_CENTERJSAMP times 16 db CENTERJSAMPLE +PW_F184_MF076 times 4 dw F_1_847,-F_0_765 +PW_F256_F089 times 4 dw F_2_562, F_0_899 +PW_F106_MF217 times 4 dw F_1_061,-F_2_172 +PW_MF060_MF050 times 4 dw -F_0_601,-F_0_509 +PW_F145_MF021 times 4 dw F_1_451,-F_0_211 +PW_F362_MF127 times 4 dw F_3_624,-F_1_272 +PW_F085_MF072 times 4 dw F_0_850,-F_0_720 +PD_DESCALE_P1_4 times 4 dd 1 << (DESCALE_P1_4-1) +PD_DESCALE_P2_4 times 4 dd 1 << (DESCALE_P2_4-1) +PD_DESCALE_P1_2 times 4 dd 1 << (DESCALE_P1_2-1) +PD_DESCALE_P2_2 times 4 dd 1 << (DESCALE_P2_2-1) +PB_CENTERJSAMP times 16 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients, ; producing a reduced-size 4x4 output block. @@ -103,309 +103,309 @@ PB_CENTERJSAMP times 16 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 - align 16 - global EXTN(jsimd_idct_4x4_sse2) + align 16 + global EXTN(jsimd_idct_4x4_sse2) EXTN(jsimd_idct_4x4_sse2): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [wk(0)] - pushpic ebx -; push ecx ; unused -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [wk(0)] + pushpic ebx +; push ecx ; unused +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr %ifndef NO_ZERO_COLUMN_TEST_4X4_SSE2 - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz short .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz short .columnDCT - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por xmm0,xmm1 - packsswb xmm0,xmm0 - packsswb xmm0,xmm0 - movd eax,xmm0 - test eax,eax - jnz short .columnDCT + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por xmm0,xmm1 + packsswb xmm0,xmm0 + packsswb xmm0,xmm0 + movd eax,xmm0 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - psllw xmm0,PASS1_BITS + psllw xmm0,PASS1_BITS - movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) - punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) - punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) + movdqa xmm3,xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) + punpcklwd xmm0,xmm0 ; xmm0=(00 00 01 01 02 02 03 03) + punpckhwd xmm3,xmm3 ; xmm3=(04 04 05 05 06 06 07 07) - pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) - pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) - pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) - pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) + pshufd xmm1,xmm0,0x50 ; xmm1=[col0 col1]=(00 00 00 00 01 01 01 01) + pshufd xmm0,xmm0,0xFA ; xmm0=[col2 col3]=(02 02 02 02 03 03 03 03) + pshufd xmm6,xmm3,0x50 ; xmm6=[col4 col5]=(04 04 04 04 05 05 05 05) + pshufd xmm3,xmm3,0xFA ; xmm3=[col6 col7]=(06 06 06 06 07 07 07 07) - jmp near .column_end - alignx 16,7 + jmp near .column_end + alignx 16,7 %endif .columnDCT: - ; -- Odd part + ; -- Odd part - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm4,xmm0 - movdqa xmm5,xmm0 - punpcklwd xmm4,xmm1 - punpckhwd xmm5,xmm1 - movdqa xmm0,xmm4 - movdqa xmm1,xmm5 - pmaddwd xmm4,[GOTOFF(ebx,PW_F256_F089)] ; xmm4=(tmp2L) - pmaddwd xmm5,[GOTOFF(ebx,PW_F256_F089)] ; xmm5=(tmp2H) - pmaddwd xmm0,[GOTOFF(ebx,PW_F106_MF217)] ; xmm0=(tmp0L) - pmaddwd xmm1,[GOTOFF(ebx,PW_F106_MF217)] ; xmm1=(tmp0H) + movdqa xmm4,xmm0 + movdqa xmm5,xmm0 + punpcklwd xmm4,xmm1 + punpckhwd xmm5,xmm1 + movdqa xmm0,xmm4 + movdqa xmm1,xmm5 + pmaddwd xmm4,[GOTOFF(ebx,PW_F256_F089)] ; xmm4=(tmp2L) + pmaddwd xmm5,[GOTOFF(ebx,PW_F256_F089)] ; xmm5=(tmp2H) + pmaddwd xmm0,[GOTOFF(ebx,PW_F106_MF217)] ; xmm0=(tmp0L) + pmaddwd xmm1,[GOTOFF(ebx,PW_F106_MF217)] ; xmm1=(tmp0H) - movdqa xmm6,xmm2 - movdqa xmm7,xmm2 - punpcklwd xmm6,xmm3 - punpckhwd xmm7,xmm3 - movdqa xmm2,xmm6 - movdqa xmm3,xmm7 - pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2L) - pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm7=(tmp2H) - pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0L) - pmaddwd xmm3,[GOTOFF(ebx,PW_F145_MF021)] ; xmm3=(tmp0H) + movdqa xmm6,xmm2 + movdqa xmm7,xmm2 + punpcklwd xmm6,xmm3 + punpckhwd xmm7,xmm3 + movdqa xmm2,xmm6 + movdqa xmm3,xmm7 + pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2L) + pmaddwd xmm7,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm7=(tmp2H) + pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0L) + pmaddwd xmm3,[GOTOFF(ebx,PW_F145_MF021)] ; xmm3=(tmp0H) - paddd xmm6,xmm4 ; xmm6=tmp2L - paddd xmm7,xmm5 ; xmm7=tmp2H - paddd xmm2,xmm0 ; xmm2=tmp0L - paddd xmm3,xmm1 ; xmm3=tmp0H + paddd xmm6,xmm4 ; xmm6=tmp2L + paddd xmm7,xmm5 ; xmm7=tmp2H + paddd xmm2,xmm0 ; xmm2=tmp0L + paddd xmm3,xmm1 ; xmm3=tmp0H - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp0L + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=tmp0H - ; -- Even part + ; -- Even part - movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movdqa xmm5, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movdqa xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] - pmullw xmm4, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm5, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm0, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm4, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movdqa xmm5, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movdqa xmm0, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] + pmullw xmm4, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm5, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm0, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pxor xmm1,xmm1 - pxor xmm2,xmm2 - punpcklwd xmm1,xmm4 ; xmm1=tmp0L - punpckhwd xmm2,xmm4 ; xmm2=tmp0H - psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 - psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 + pxor xmm1,xmm1 + pxor xmm2,xmm2 + punpcklwd xmm1,xmm4 ; xmm1=tmp0L + punpckhwd xmm2,xmm4 ; xmm2=tmp0H + psrad xmm1,(16-CONST_BITS-1) ; psrad xmm1,16 & pslld xmm1,CONST_BITS+1 + psrad xmm2,(16-CONST_BITS-1) ; psrad xmm2,16 & pslld xmm2,CONST_BITS+1 - movdqa xmm3,xmm5 ; xmm5=in2=z2 - punpcklwd xmm5,xmm0 ; xmm0=in6=z3 - punpckhwd xmm3,xmm0 - pmaddwd xmm5,[GOTOFF(ebx,PW_F184_MF076)] ; xmm5=tmp2L - pmaddwd xmm3,[GOTOFF(ebx,PW_F184_MF076)] ; xmm3=tmp2H + movdqa xmm3,xmm5 ; xmm5=in2=z2 + punpcklwd xmm5,xmm0 ; xmm0=in6=z3 + punpckhwd xmm3,xmm0 + pmaddwd xmm5,[GOTOFF(ebx,PW_F184_MF076)] ; xmm5=tmp2L + pmaddwd xmm3,[GOTOFF(ebx,PW_F184_MF076)] ; xmm3=tmp2H - movdqa xmm4,xmm1 - movdqa xmm0,xmm2 - paddd xmm1,xmm5 ; xmm1=tmp10L - paddd xmm2,xmm3 ; xmm2=tmp10H - psubd xmm4,xmm5 ; xmm4=tmp12L - psubd xmm0,xmm3 ; xmm0=tmp12H + movdqa xmm4,xmm1 + movdqa xmm0,xmm2 + paddd xmm1,xmm5 ; xmm1=tmp10L + paddd xmm2,xmm3 ; xmm2=tmp10H + psubd xmm4,xmm5 ; xmm4=tmp12L + psubd xmm0,xmm3 ; xmm0=tmp12H - ; -- Final output stage + ; -- Final output stage - movdqa xmm5,xmm1 - movdqa xmm3,xmm2 - paddd xmm1,xmm6 ; xmm1=data0L - paddd xmm2,xmm7 ; xmm2=data0H - psubd xmm5,xmm6 ; xmm5=data3L - psubd xmm3,xmm7 ; xmm3=data3H + movdqa xmm5,xmm1 + movdqa xmm3,xmm2 + paddd xmm1,xmm6 ; xmm1=data0L + paddd xmm2,xmm7 ; xmm2=data0H + psubd xmm5,xmm6 ; xmm5=data3L + psubd xmm3,xmm7 ; xmm3=data3H - movdqa xmm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm6=[PD_DESCALE_P1_4] + movdqa xmm6,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm6=[PD_DESCALE_P1_4] - paddd xmm1,xmm6 - paddd xmm2,xmm6 - psrad xmm1,DESCALE_P1_4 - psrad xmm2,DESCALE_P1_4 - paddd xmm5,xmm6 - paddd xmm3,xmm6 - psrad xmm5,DESCALE_P1_4 - psrad xmm3,DESCALE_P1_4 + paddd xmm1,xmm6 + paddd xmm2,xmm6 + psrad xmm1,DESCALE_P1_4 + psrad xmm2,DESCALE_P1_4 + paddd xmm5,xmm6 + paddd xmm3,xmm6 + psrad xmm5,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 - packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) - packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) + packssdw xmm1,xmm2 ; xmm1=data0=(00 01 02 03 04 05 06 07) + packssdw xmm5,xmm3 ; xmm5=data3=(30 31 32 33 34 35 36 37) - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp0L + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp0H - movdqa xmm2,xmm4 - movdqa xmm3,xmm0 - paddd xmm4,xmm7 ; xmm4=data1L - paddd xmm0,xmm6 ; xmm0=data1H - psubd xmm2,xmm7 ; xmm2=data2L - psubd xmm3,xmm6 ; xmm3=data2H + movdqa xmm2,xmm4 + movdqa xmm3,xmm0 + paddd xmm4,xmm7 ; xmm4=data1L + paddd xmm0,xmm6 ; xmm0=data1H + psubd xmm2,xmm7 ; xmm2=data2L + psubd xmm3,xmm6 ; xmm3=data2H - movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm7=[PD_DESCALE_P1_4] + movdqa xmm7,[GOTOFF(ebx,PD_DESCALE_P1_4)] ; xmm7=[PD_DESCALE_P1_4] - paddd xmm4,xmm7 - paddd xmm0,xmm7 - psrad xmm4,DESCALE_P1_4 - psrad xmm0,DESCALE_P1_4 - paddd xmm2,xmm7 - paddd xmm3,xmm7 - psrad xmm2,DESCALE_P1_4 - psrad xmm3,DESCALE_P1_4 + paddd xmm4,xmm7 + paddd xmm0,xmm7 + psrad xmm4,DESCALE_P1_4 + psrad xmm0,DESCALE_P1_4 + paddd xmm2,xmm7 + paddd xmm3,xmm7 + psrad xmm2,DESCALE_P1_4 + psrad xmm3,DESCALE_P1_4 - packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) - packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) + packssdw xmm4,xmm0 ; xmm4=data1=(10 11 12 13 14 15 16 17) + packssdw xmm2,xmm3 ; xmm2=data2=(20 21 22 23 24 25 26 27) - movdqa xmm6,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) - punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) - movdqa xmm7,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) + movdqa xmm6,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm4 ; xmm1=(00 10 01 11 02 12 03 13) + punpckhwd xmm6,xmm4 ; xmm6=(04 14 05 15 06 16 07 17) + movdqa xmm7,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm5 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm7,xmm5 ; xmm7=(24 34 25 35 26 36 27 37) - movdqa xmm0,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) - punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) - movdqa xmm3,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) - punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm2 ; xmm1=[col0 col1]=(00 10 20 30 01 11 21 31) + punpckhdq xmm0,xmm2 ; xmm0=[col2 col3]=(02 12 22 32 03 13 23 33) + movdqa xmm3,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm7 ; xmm6=[col4 col5]=(04 14 24 34 05 15 25 35) + punpckhdq xmm3,xmm7 ; xmm3=[col6 col7]=(06 16 26 36 07 17 27 37) .column_end: - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows, store into output array. + ; ---- Pass 2: process rows, store into output array. - mov eax, [original_ebp] - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] + mov eax, [original_ebp] + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] - ; -- Even part + ; -- Even part - pxor xmm4,xmm4 - punpcklwd xmm4,xmm1 ; xmm4=tmp0 - psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 + pxor xmm4,xmm4 + punpcklwd xmm4,xmm1 ; xmm4=tmp0 + psrad xmm4,(16-CONST_BITS-1) ; psrad xmm4,16 & pslld xmm4,CONST_BITS+1 - ; -- Odd part + ; -- Odd part - punpckhwd xmm1,xmm0 - punpckhwd xmm6,xmm3 - movdqa xmm5,xmm1 - movdqa xmm2,xmm6 - pmaddwd xmm1,[GOTOFF(ebx,PW_F256_F089)] ; xmm1=(tmp2) - pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2) - pmaddwd xmm5,[GOTOFF(ebx,PW_F106_MF217)] ; xmm5=(tmp0) - pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0) + punpckhwd xmm1,xmm0 + punpckhwd xmm6,xmm3 + movdqa xmm5,xmm1 + movdqa xmm2,xmm6 + pmaddwd xmm1,[GOTOFF(ebx,PW_F256_F089)] ; xmm1=(tmp2) + pmaddwd xmm6,[GOTOFF(ebx,PW_MF060_MF050)] ; xmm6=(tmp2) + pmaddwd xmm5,[GOTOFF(ebx,PW_F106_MF217)] ; xmm5=(tmp0) + pmaddwd xmm2,[GOTOFF(ebx,PW_F145_MF021)] ; xmm2=(tmp0) - paddd xmm6,xmm1 ; xmm6=tmp2 - paddd xmm2,xmm5 ; xmm2=tmp0 + paddd xmm6,xmm1 ; xmm6=tmp2 + paddd xmm2,xmm5 ; xmm2=tmp0 - ; -- Even part + ; -- Even part - punpcklwd xmm0,xmm3 - pmaddwd xmm0,[GOTOFF(ebx,PW_F184_MF076)] ; xmm0=tmp2 + punpcklwd xmm0,xmm3 + pmaddwd xmm0,[GOTOFF(ebx,PW_F184_MF076)] ; xmm0=tmp2 - movdqa xmm7,xmm4 - paddd xmm4,xmm0 ; xmm4=tmp10 - psubd xmm7,xmm0 ; xmm7=tmp12 + movdqa xmm7,xmm4 + paddd xmm4,xmm0 ; xmm4=tmp10 + psubd xmm7,xmm0 ; xmm7=tmp12 - ; -- Final output stage + ; -- Final output stage - movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; xmm1=[PD_DESCALE_P2_4] + movdqa xmm1,[GOTOFF(ebx,PD_DESCALE_P2_4)] ; xmm1=[PD_DESCALE_P2_4] - movdqa xmm5,xmm4 - movdqa xmm3,xmm7 - paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) - paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) - psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) - psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + movdqa xmm5,xmm4 + movdqa xmm3,xmm7 + paddd xmm4,xmm6 ; xmm4=data0=(00 10 20 30) + paddd xmm7,xmm2 ; xmm7=data1=(01 11 21 31) + psubd xmm5,xmm6 ; xmm5=data3=(03 13 23 33) + psubd xmm3,xmm2 ; xmm3=data2=(02 12 22 32) - paddd xmm4,xmm1 - paddd xmm7,xmm1 - psrad xmm4,DESCALE_P2_4 - psrad xmm7,DESCALE_P2_4 - paddd xmm5,xmm1 - paddd xmm3,xmm1 - psrad xmm5,DESCALE_P2_4 - psrad xmm3,DESCALE_P2_4 + paddd xmm4,xmm1 + paddd xmm7,xmm1 + psrad xmm4,DESCALE_P2_4 + psrad xmm7,DESCALE_P2_4 + paddd xmm5,xmm1 + paddd xmm3,xmm1 + psrad xmm5,DESCALE_P2_4 + psrad xmm3,DESCALE_P2_4 - packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) - packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) + packssdw xmm4,xmm3 ; xmm4=(00 10 20 30 02 12 22 32) + packssdw xmm7,xmm5 ; xmm7=(01 11 21 31 03 13 23 33) - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) - punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm7 ; xmm4=(00 01 10 11 20 21 30 31) + punpckhwd xmm0,xmm7 ; xmm0=(02 03 12 13 22 23 32 33) - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) - punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(00 01 02 03 10 11 12 13) + punpckhdq xmm6,xmm0 ; xmm6=(20 21 22 23 30 31 32 33) - packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) - paddb xmm4,[GOTOFF(ebx,PB_CENTERJSAMP)] + packsswb xmm4,xmm6 ; xmm4=(00 01 02 03 10 11 12 13 20 ..) + paddb xmm4,[GOTOFF(ebx,PB_CENTERJSAMP)] - pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) - pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) - pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) + pshufd xmm2,xmm4,0x39 ; xmm2=(10 11 12 13 20 21 22 23 30 ..) + pshufd xmm1,xmm4,0x4E ; xmm1=(20 21 22 23 30 31 32 33 00 ..) + pshufd xmm3,xmm4,0x93 ; xmm3=(30 31 32 33 00 01 02 03 10 ..) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 - movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 - mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 - movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 + movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm2 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movd XMM_DWORD [edx+eax*SIZEOF_JSAMPLE], xmm1 + movd XMM_DWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; unused - poppic ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; unused + poppic ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; -------------------------------------------------------------------------- @@ -418,177 +418,177 @@ EXTN(jsimd_idct_4x4_sse2): ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col - align 16 - global EXTN(jsimd_idct_2x2_sse2) + align 16 + global EXTN(jsimd_idct_2x2_sse2) EXTN(jsimd_idct_2x2_sse2): - push ebp - mov ebp,esp - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov ebp,esp + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input. + ; ---- Pass 1: process columns from input. - mov edx, POINTER [dct_table(ebp)] ; quantptr - mov esi, JCOEFPTR [coef_block(ebp)] ; inptr + mov edx, POINTER [dct_table(ebp)] ; quantptr + mov esi, JCOEFPTR [coef_block(ebp)] ; inptr - ; | input: | result: | - ; | 00 01 ** 03 ** 05 ** 07 | | - ; | 10 11 ** 13 ** 15 ** 17 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | - ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | - ; | 50 51 ** 53 ** 55 ** 57 | | - ; | ** ** ** ** ** ** ** ** | | - ; | 70 71 ** 73 ** 75 ** 77 | | + ; | input: | result: | + ; | 00 01 ** 03 ** 05 ** 07 | | + ; | 10 11 ** 13 ** 15 ** 17 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 30 31 ** 33 ** 35 ** 37 | A0 A1 A3 A5 A7 | + ; | ** ** ** ** ** ** ** ** | B0 B1 B3 B5 B7 | + ; | 50 51 ** 53 ** 55 ** 57 | | + ; | ** ** ** ** ** ** ** ** | | + ; | 70 71 ** 73 ** 75 ** 77 | | - ; -- Odd part + ; -- Odd part - movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] - pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] - pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movdqa xmm1, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] + pmullw xmm0, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm1, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm2, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] + pmullw xmm2, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + pmullw xmm3, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) - ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) + ; xmm0=(10 11 ** 13 ** 15 ** 17), xmm1=(30 31 ** 33 ** 35 ** 37) + ; xmm2=(50 51 ** 53 ** 55 ** 57), xmm3=(70 71 ** 73 ** 75 ** 77) - pcmpeqd xmm7,xmm7 - pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} + pcmpeqd xmm7,xmm7 + pslld xmm7,WORD_BIT ; xmm7={0x0000 0xFFFF 0x0000 0xFFFF ..} - movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) - movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) - punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) - punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) - pmaddwd xmm4,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd xmm5,[GOTOFF(ebx,PW_F085_MF072)] + movdqa xmm4,xmm0 ; xmm4=(10 11 ** 13 ** 15 ** 17) + movdqa xmm5,xmm2 ; xmm5=(50 51 ** 53 ** 55 ** 57) + punpcklwd xmm4,xmm1 ; xmm4=(10 30 11 31 ** ** 13 33) + punpcklwd xmm5,xmm3 ; xmm5=(50 70 51 71 ** ** 53 73) + pmaddwd xmm4,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm5,[GOTOFF(ebx,PW_F085_MF072)] - psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) - pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) - psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) - pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) - por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) - por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) - pmaddwd xmm0,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd xmm2,[GOTOFF(ebx,PW_F085_MF072)] + psrld xmm0,WORD_BIT ; xmm0=(11 -- 13 -- 15 -- 17 --) + pand xmm1,xmm7 ; xmm1=(-- 31 -- 33 -- 35 -- 37) + psrld xmm2,WORD_BIT ; xmm2=(51 -- 53 -- 55 -- 57 --) + pand xmm3,xmm7 ; xmm3=(-- 71 -- 73 -- 75 -- 77) + por xmm0,xmm1 ; xmm0=(11 31 13 33 15 35 17 37) + por xmm2,xmm3 ; xmm2=(51 71 53 73 55 75 57 77) + pmaddwd xmm0,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm2,[GOTOFF(ebx,PW_F085_MF072)] - paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] - paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] + paddd xmm4,xmm5 ; xmm4=tmp0[col0 col1 **** col3] + paddd xmm0,xmm2 ; xmm0=tmp0[col1 col3 col5 col7] - ; -- Even part + ; -- Even part - movdqa xmm6, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] - pmullw xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] + movdqa xmm6, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] + pmullw xmm6, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] - ; xmm6=(00 01 ** 03 ** 05 ** 07) + ; xmm6=(00 01 ** 03 ** 05 ** 07) - movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) - pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) - pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) - psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] - psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] + movdqa xmm1,xmm6 ; xmm1=(00 01 ** 03 ** 05 ** 07) + pslld xmm6,WORD_BIT ; xmm6=(-- 00 -- ** -- ** -- **) + pand xmm1,xmm7 ; xmm1=(-- 01 -- 03 -- 05 -- 07) + psrad xmm6,(WORD_BIT-CONST_BITS-2) ; xmm6=tmp10[col0 **** **** ****] + psrad xmm1,(WORD_BIT-CONST_BITS-2) ; xmm1=tmp10[col1 col3 col5 col7] - ; -- Final output stage + ; -- Final output stage - movdqa xmm3,xmm6 - movdqa xmm5,xmm1 - paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) - paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) - psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) - psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) + movdqa xmm3,xmm6 + movdqa xmm5,xmm1 + paddd xmm6,xmm4 ; xmm6=data0[col0 **** **** ****]=(A0 ** ** **) + paddd xmm1,xmm0 ; xmm1=data0[col1 col3 col5 col7]=(A1 A3 A5 A7) + psubd xmm3,xmm4 ; xmm3=data1[col0 **** **** ****]=(B0 ** ** **) + psubd xmm5,xmm0 ; xmm5=data1[col1 col3 col5 col7]=(B1 B3 B5 B7) - movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; xmm2=[PD_DESCALE_P1_2] + movdqa xmm2,[GOTOFF(ebx,PD_DESCALE_P1_2)] ; xmm2=[PD_DESCALE_P1_2] - punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) + punpckldq xmm6,xmm3 ; xmm6=(A0 B0 ** **) - movdqa xmm7,xmm1 - punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) - punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) + movdqa xmm7,xmm1 + punpcklqdq xmm1,xmm5 ; xmm1=(A1 A3 B1 B3) + punpckhqdq xmm7,xmm5 ; xmm7=(A5 A7 B5 B7) - paddd xmm6,xmm2 - psrad xmm6,DESCALE_P1_2 + paddd xmm6,xmm2 + psrad xmm6,DESCALE_P1_2 - paddd xmm1,xmm2 - paddd xmm7,xmm2 - psrad xmm1,DESCALE_P1_2 - psrad xmm7,DESCALE_P1_2 + paddd xmm1,xmm2 + paddd xmm7,xmm2 + psrad xmm1,DESCALE_P1_2 + psrad xmm7,DESCALE_P1_2 - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows, store into output array. + ; ---- Pass 2: process rows, store into output array. - mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(ebp)] + mov edi, JSAMPARRAY [output_buf(ebp)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(ebp)] - ; | input:| result:| - ; | A0 B0 | | - ; | A1 B1 | C0 C1 | - ; | A3 B3 | D0 D1 | - ; | A5 B5 | | - ; | A7 B7 | | + ; | input:| result:| + ; | A0 B0 | | + ; | A1 B1 | C0 C1 | + ; | A3 B3 | D0 D1 | + ; | A5 B5 | | + ; | A7 B7 | | - ; -- Odd part + ; -- Odd part - packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) - packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) - pmaddwd xmm1,[GOTOFF(ebx,PW_F362_MF127)] - pmaddwd xmm7,[GOTOFF(ebx,PW_F085_MF072)] + packssdw xmm1,xmm1 ; xmm1=(A1 A3 B1 B3 A1 A3 B1 B3) + packssdw xmm7,xmm7 ; xmm7=(A5 A7 B5 B7 A5 A7 B5 B7) + pmaddwd xmm1,[GOTOFF(ebx,PW_F362_MF127)] + pmaddwd xmm7,[GOTOFF(ebx,PW_F085_MF072)] - paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] + paddd xmm1,xmm7 ; xmm1=tmp0[row0 row1 row0 row1] - ; -- Even part + ; -- Even part - pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] + pslld xmm6,(CONST_BITS+2) ; xmm6=tmp10[row0 row1 **** ****] - ; -- Final output stage + ; -- Final output stage - movdqa xmm4,xmm6 - paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) - psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) + movdqa xmm4,xmm6 + paddd xmm6,xmm1 ; xmm6=data0[row0 row1 **** ****]=(C0 C1 ** **) + psubd xmm4,xmm1 ; xmm4=data1[row0 row1 **** ****]=(D0 D1 ** **) - punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) + punpckldq xmm6,xmm4 ; xmm6=(C0 D0 C1 D1) - paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2_2)] - psrad xmm6,DESCALE_P2_2 + paddd xmm6,[GOTOFF(ebx,PD_DESCALE_P2_2)] + psrad xmm6,DESCALE_P2_2 - packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) - packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) - paddb xmm6,[GOTOFF(ebx,PB_CENTERJSAMP)] + packssdw xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1) + packsswb xmm6,xmm6 ; xmm6=(C0 D0 C1 D1 C0 D0 C1 D1 ..) + paddb xmm6,[GOTOFF(ebx,PB_CENTERJSAMP)] - pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) - pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) + pextrw ebx,xmm6,0x00 ; ebx=(C0 D0 -- --) + pextrw ecx,xmm6,0x01 ; ecx=(C1 D1 -- --) - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - mov WORD [edx+eax*SIZEOF_JSAMPLE], bx - mov WORD [esi+eax*SIZEOF_JSAMPLE], cx + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + mov WORD [edx+eax*SIZEOF_JSAMPLE], bx + mov WORD [esi+eax*SIZEOF_JSAMPLE], cx - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jisseflt.asm b/simd/jisseflt.asm index d6147c12..8b813555 100644 --- a/simd/jisseflt.asm +++ b/simd/jisseflt.asm @@ -25,34 +25,34 @@ ; -------------------------------------------------------------------------- -%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) - shufps %1,%2,0x44 +%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5) + shufps %1,%2,0x44 %endmacro -%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) - shufps %1,%2,0xEE +%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7) + shufps %1,%2,0xEE %endmacro ; -------------------------------------------------------------------------- - SECTION SEG_CONST + SECTION SEG_CONST - alignz 16 - global EXTN(jconst_idct_float_sse) + alignz 16 + global EXTN(jconst_idct_float_sse) EXTN(jconst_idct_float_sse): -PD_1_414 times 4 dd 1.414213562373095048801689 -PD_1_847 times 4 dd 1.847759065022573512256366 -PD_1_082 times 4 dd 1.082392200292393968799446 -PD_M2_613 times 4 dd -2.613125929752753055713286 -PD_0_125 times 4 dd 0.125 ; 1/8 -PB_CENTERJSAMP times 8 db CENTERJSAMPLE +PD_1_414 times 4 dd 1.414213562373095048801689 +PD_1_847 times 4 dd 1.847759065022573512256366 +PD_1_082 times 4 dd 1.082392200292393968799446 +PD_M2_613 times 4 dd -2.613125929752753055713286 +PD_0_125 times 4 dd 0.125 ; 1/8 +PB_CENTERJSAMP times 8 db CENTERJSAMPLE - alignz 16 + alignz 16 ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Perform dequantization and inverse DCT on one block of coefficients. ; @@ -61,512 +61,512 @@ PB_CENTERJSAMP times 8 db CENTERJSAMPLE ; JSAMPARRAY output_buf, JDIMENSION output_col) ; -%define dct_table(b) (b)+8 ; void * dct_table -%define coef_block(b) (b)+12 ; JCOEFPTR coef_block -%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf -%define output_col(b) (b)+20 ; JDIMENSION output_col +%define dct_table(b) (b)+8 ; void * dct_table +%define coef_block(b) (b)+12 ; JCOEFPTR coef_block +%define output_buf(b) (b)+16 ; JSAMPARRAY output_buf +%define output_col(b) (b)+20 ; JDIMENSION output_col -%define original_ebp ebp+0 -%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 -%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT - ; FAST_FLOAT workspace[DCTSIZE2] +%define original_ebp ebp+0 +%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 +%define workspace wk(0)-DCTSIZE2*SIZEOF_FAST_FLOAT + ; FAST_FLOAT workspace[DCTSIZE2] - align 16 - global EXTN(jsimd_idct_float_sse) + align 16 + global EXTN(jsimd_idct_float_sse) EXTN(jsimd_idct_float_sse): - push ebp - mov eax,esp ; eax = original ebp - sub esp, byte 4 - and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [esp],eax - mov ebp,esp ; ebp = aligned ebp - lea esp, [workspace] - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved - push esi - push edi + push ebp + mov eax,esp ; eax = original ebp + sub esp, byte 4 + and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [esp],eax + mov ebp,esp ; ebp = aligned ebp + lea esp, [workspace] + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved + push esi + push edi - get_GOT ebx ; get GOT address + get_GOT ebx ; get GOT address - ; ---- Pass 1: process columns from input, store into work array. + ; ---- Pass 1: process columns from input, store into work array. -; mov eax, [original_ebp] - mov edx, POINTER [dct_table(eax)] ; quantptr - mov esi, JCOEFPTR [coef_block(eax)] ; inptr - lea edi, [workspace] ; FAST_FLOAT * wsptr - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 +; mov eax, [original_ebp] + mov edx, POINTER [dct_table(eax)] ; quantptr + mov esi, JCOEFPTR [coef_block(eax)] ; inptr + lea edi, [workspace] ; FAST_FLOAT * wsptr + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .columnloop: %ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE - mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] - or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] - jnz near .columnDCT + mov eax, DWORD [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] + or eax, DWORD [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] + jnz near .columnDCT - movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - por mm1,mm0 - packsswb mm1,mm1 - movd eax,mm1 - test eax,eax - jnz short .columnDCT + movq mm0, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + por mm1, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + por mm0, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + por mm1,mm0 + packsswb mm1,mm1 + movd eax,mm1 + test eax,eax + jnz short .columnDCT - ; -- AC terms all zero + ; -- AC terms all zero - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - punpckhwd mm1,mm0 ; mm1=(** 02 ** 03) - punpcklwd mm0,mm0 ; mm0=(00 00 01 01) - psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in0H=(02 03) - psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) - cvtpi2ps xmm3,mm1 ; xmm3=(02 03 ** **) - cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) - movlhps xmm0,xmm3 ; xmm0=in0=(00 01 02 03) + punpckhwd mm1,mm0 ; mm1=(** 02 ** 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in0H=(02 03) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) + cvtpi2ps xmm3,mm1 ; xmm3=(02 03 ** **) + cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) + movlhps xmm0,xmm3 ; xmm0=in0=(00 01 02 03) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm1,xmm0 - movaps xmm2,xmm0 - movaps xmm3,xmm0 + movaps xmm1,xmm0 + movaps xmm2,xmm0 + movaps xmm3,xmm0 - shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) - shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) - shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) - shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) + shufps xmm0,xmm0,0x00 ; xmm0=(00 00 00 00) + shufps xmm1,xmm1,0x55 ; xmm1=(01 01 01 01) + shufps xmm2,xmm2,0xAA ; xmm2=(02 02 02 02) + shufps xmm3,xmm3,0xFF ; xmm3=(03 03 03 03) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 - movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 - jmp near .nextcolumn - alignx 16,7 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + jmp near .nextcolumn + alignx 16,7 %endif .columnDCT: - ; -- Even part + ; -- Even part - movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] - movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] - movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)] + movq mm2, MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)] + movq mm3, MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)] - punpckhwd mm4,mm0 ; mm4=(** 02 ** 03) - punpcklwd mm0,mm0 ; mm0=(00 00 01 01) - punpckhwd mm5,mm1 ; mm5=(** 22 ** 23) - punpcklwd mm1,mm1 ; mm1=(20 20 21 21) + punpckhwd mm4,mm0 ; mm4=(** 02 ** 03) + punpcklwd mm0,mm0 ; mm0=(00 00 01 01) + punpckhwd mm5,mm1 ; mm5=(** 22 ** 23) + punpcklwd mm1,mm1 ; mm1=(20 20 21 21) - psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in0H=(02 03) - psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) - cvtpi2ps xmm4,mm4 ; xmm4=(02 03 ** **) - cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) - psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in2H=(22 23) - psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in2L=(20 21) - cvtpi2ps xmm5,mm5 ; xmm5=(22 23 ** **) - cvtpi2ps xmm1,mm1 ; xmm1=(20 21 ** **) + psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in0H=(02 03) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in0L=(00 01) + cvtpi2ps xmm4,mm4 ; xmm4=(02 03 ** **) + cvtpi2ps xmm0,mm0 ; xmm0=(00 01 ** **) + psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in2H=(22 23) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in2L=(20 21) + cvtpi2ps xmm5,mm5 ; xmm5=(22 23 ** **) + cvtpi2ps xmm1,mm1 ; xmm1=(20 21 ** **) - punpckhwd mm6,mm2 ; mm6=(** 42 ** 43) - punpcklwd mm2,mm2 ; mm2=(40 40 41 41) - punpckhwd mm7,mm3 ; mm7=(** 62 ** 63) - punpcklwd mm3,mm3 ; mm3=(60 60 61 61) + punpckhwd mm6,mm2 ; mm6=(** 42 ** 43) + punpcklwd mm2,mm2 ; mm2=(40 40 41 41) + punpckhwd mm7,mm3 ; mm7=(** 62 ** 63) + punpcklwd mm3,mm3 ; mm3=(60 60 61 61) - psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in4H=(42 43) - psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in4L=(40 41) - cvtpi2ps xmm6,mm6 ; xmm6=(42 43 ** **) - cvtpi2ps xmm2,mm2 ; xmm2=(40 41 ** **) - psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in6H=(62 63) - psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in6L=(60 61) - cvtpi2ps xmm7,mm7 ; xmm7=(62 63 ** **) - cvtpi2ps xmm3,mm3 ; xmm3=(60 61 ** **) + psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in4H=(42 43) + psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in4L=(40 41) + cvtpi2ps xmm6,mm6 ; xmm6=(42 43 ** **) + cvtpi2ps xmm2,mm2 ; xmm2=(40 41 ** **) + psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in6H=(62 63) + psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in6L=(60 61) + cvtpi2ps xmm7,mm7 ; xmm7=(62 63 ** **) + cvtpi2ps xmm3,mm3 ; xmm3=(60 61 ** **) - movlhps xmm0,xmm4 ; xmm0=in0=(00 01 02 03) - movlhps xmm1,xmm5 ; xmm1=in2=(20 21 22 23) - mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + movlhps xmm0,xmm4 ; xmm0=in0=(00 01 02 03) + movlhps xmm1,xmm5 ; xmm1=in2=(20 21 22 23) + mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movlhps xmm2,xmm6 ; xmm2=in4=(40 41 42 43) - movlhps xmm3,xmm7 ; xmm3=in6=(60 61 62 63) - mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + movlhps xmm2,xmm6 ; xmm2=in4=(40 41 42 43) + movlhps xmm3,xmm7 ; xmm3=in6=(60 61 62 63) + mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[GOTOFF(ebx,PD_1_414)] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] - movq mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] - movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] - movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] + movq mm4, MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)] + movq mm0, MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)] + movq mm5, MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)] + movq mm1, MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)] - punpckhwd mm6,mm4 ; mm6=(** 12 ** 13) - punpcklwd mm4,mm4 ; mm4=(10 10 11 11) - punpckhwd mm2,mm0 ; mm2=(** 32 ** 33) - punpcklwd mm0,mm0 ; mm0=(30 30 31 31) + punpckhwd mm6,mm4 ; mm6=(** 12 ** 13) + punpcklwd mm4,mm4 ; mm4=(10 10 11 11) + punpckhwd mm2,mm0 ; mm2=(** 32 ** 33) + punpcklwd mm0,mm0 ; mm0=(30 30 31 31) - psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in1H=(12 13) - psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in1L=(10 11) - cvtpi2ps xmm4,mm6 ; xmm4=(12 13 ** **) - cvtpi2ps xmm2,mm4 ; xmm2=(10 11 ** **) - psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in3H=(32 33) - psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in3L=(30 31) - cvtpi2ps xmm0,mm2 ; xmm0=(32 33 ** **) - cvtpi2ps xmm3,mm0 ; xmm3=(30 31 ** **) + psrad mm6,(DWORD_BIT-WORD_BIT) ; mm6=in1H=(12 13) + psrad mm4,(DWORD_BIT-WORD_BIT) ; mm4=in1L=(10 11) + cvtpi2ps xmm4,mm6 ; xmm4=(12 13 ** **) + cvtpi2ps xmm2,mm4 ; xmm2=(10 11 ** **) + psrad mm2,(DWORD_BIT-WORD_BIT) ; mm2=in3H=(32 33) + psrad mm0,(DWORD_BIT-WORD_BIT) ; mm0=in3L=(30 31) + cvtpi2ps xmm0,mm2 ; xmm0=(32 33 ** **) + cvtpi2ps xmm3,mm0 ; xmm3=(30 31 ** **) - punpckhwd mm7,mm5 ; mm7=(** 52 ** 53) - punpcklwd mm5,mm5 ; mm5=(50 50 51 51) - punpckhwd mm3,mm1 ; mm3=(** 72 ** 73) - punpcklwd mm1,mm1 ; mm1=(70 70 71 71) + punpckhwd mm7,mm5 ; mm7=(** 52 ** 53) + punpcklwd mm5,mm5 ; mm5=(50 50 51 51) + punpckhwd mm3,mm1 ; mm3=(** 72 ** 73) + punpcklwd mm1,mm1 ; mm1=(70 70 71 71) - movlhps xmm2,xmm4 ; xmm2=in1=(10 11 12 13) - movlhps xmm3,xmm0 ; xmm3=in3=(30 31 32 33) + movlhps xmm2,xmm4 ; xmm2=in1=(10 11 12 13) + movlhps xmm3,xmm0 ; xmm3=in3=(30 31 32 33) - psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in5H=(52 53) - psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in5L=(50 51) - cvtpi2ps xmm4,mm7 ; xmm4=(52 53 ** **) - cvtpi2ps xmm5,mm5 ; xmm5=(50 51 ** **) - psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in7H=(72 73) - psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in7L=(70 71) - cvtpi2ps xmm0,mm3 ; xmm0=(72 73 ** **) - cvtpi2ps xmm1,mm1 ; xmm1=(70 71 ** **) + psrad mm7,(DWORD_BIT-WORD_BIT) ; mm7=in5H=(52 53) + psrad mm5,(DWORD_BIT-WORD_BIT) ; mm5=in5L=(50 51) + cvtpi2ps xmm4,mm7 ; xmm4=(52 53 ** **) + cvtpi2ps xmm5,mm5 ; xmm5=(50 51 ** **) + psrad mm3,(DWORD_BIT-WORD_BIT) ; mm3=in7H=(72 73) + psrad mm1,(DWORD_BIT-WORD_BIT) ; mm1=in7L=(70 71) + cvtpi2ps xmm0,mm3 ; xmm0=(72 73 ** **) + cvtpi2ps xmm1,mm1 ; xmm1=(70 71 ** **) - mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movlhps xmm5,xmm4 ; xmm5=in5=(50 51 52 53) - movlhps xmm1,xmm0 ; xmm1=in7=(70 71 72 73) - mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + movlhps xmm5,xmm4 ; xmm5=in5=(50 51 52 53) + movlhps xmm1,xmm0 ; xmm1=in7=(70 71 72 73) + mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)] + mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 - mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) - addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) - subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) - subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 01 02 03) + addps xmm7,xmm3 ; xmm7=data1=(10 11 12 13) + subps xmm5,xmm1 ; xmm5=data7=(70 71 72 73) + subps xmm0,xmm3 ; xmm0=data6=(60 61 62 63) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,xmm6 ; transpose coefficients(phase 1) - unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) - unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) - movaps xmm3,xmm0 ; transpose coefficients(phase 1) - unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) - unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) + movaps xmm1,xmm6 ; transpose coefficients(phase 1) + unpcklps xmm6,xmm7 ; xmm6=(00 10 01 11) + unpckhps xmm1,xmm7 ; xmm1=(02 12 03 13) + movaps xmm3,xmm0 ; transpose coefficients(phase 1) + unpcklps xmm0,xmm5 ; xmm0=(60 70 61 71) + unpckhps xmm3,xmm5 ; xmm3=(62 72 63 73) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 - movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 + movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 + movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3 - movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) - movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) + movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71) + movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73) - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm0,xmm7 - movaps xmm3,xmm5 - addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) - addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) - subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) - subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm0,xmm7 + movaps xmm3,xmm5 + addps xmm7,xmm2 ; xmm7=data2=(20 21 22 23) + addps xmm5,xmm4 ; xmm5=data4=(40 41 42 43) + subps xmm0,xmm2 ; xmm0=data5=(50 51 52 53) + subps xmm3,xmm4 ; xmm3=data3=(30 31 32 33) - movaps xmm2,xmm7 ; transpose coefficients(phase 1) - unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) - unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) - movaps xmm4,xmm5 ; transpose coefficients(phase 1) - unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) - unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) + movaps xmm2,xmm7 ; transpose coefficients(phase 1) + unpcklps xmm7,xmm3 ; xmm7=(20 30 21 31) + unpckhps xmm2,xmm3 ; xmm2=(22 32 23 33) + movaps xmm4,xmm5 ; transpose coefficients(phase 1) + unpcklps xmm5,xmm0 ; xmm5=(40 50 41 51) + unpckhps xmm4,xmm0 ; xmm4=(42 52 43 53) - movaps xmm3,xmm6 ; transpose coefficients(phase 2) - unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) - unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) - movaps xmm0,xmm1 ; transpose coefficients(phase 2) - unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) - unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) + movaps xmm3,xmm6 ; transpose coefficients(phase 2) + unpcklps2 xmm6,xmm7 ; xmm6=(00 10 20 30) + unpckhps2 xmm3,xmm7 ; xmm3=(01 11 21 31) + movaps xmm0,xmm1 ; transpose coefficients(phase 2) + unpcklps2 xmm1,xmm2 ; xmm1=(02 12 22 32) + unpckhps2 xmm0,xmm2 ; xmm0=(03 13 23 33) - movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) - movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) + movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71) + movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73) - movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 - movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 - movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 + movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1 + movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0 - movaps xmm6,xmm5 ; transpose coefficients(phase 2) - unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) - unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) - movaps xmm3,xmm4 ; transpose coefficients(phase 2) - unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) - unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) + movaps xmm6,xmm5 ; transpose coefficients(phase 2) + unpcklps2 xmm5,xmm7 ; xmm5=(40 50 60 70) + unpckhps2 xmm6,xmm7 ; xmm6=(41 51 61 71) + movaps xmm3,xmm4 ; transpose coefficients(phase 2) + unpcklps2 xmm4,xmm2 ; xmm4=(42 52 62 72) + unpckhps2 xmm3,xmm2 ; xmm3=(43 53 63 73) - movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 - movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 - movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 - movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 + movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5 + movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6 + movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4 + movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3 .nextcolumn: - add esi, byte 4*SIZEOF_JCOEF ; coef_block - add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr - add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr - dec ecx ; ctr - jnz near .columnloop + add esi, byte 4*SIZEOF_JCOEF ; coef_block + add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr + add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr + dec ecx ; ctr + jnz near .columnloop - ; -- Prefetch the next coefficient block + ; -- Prefetch the next coefficient block - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] - prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32] + prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32] - ; ---- Pass 2: process rows from work array, store into output array. + ; ---- Pass 2: process rows from work array, store into output array. - mov eax, [original_ebp] - lea esi, [workspace] ; FAST_FLOAT * wsptr - mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) - mov eax, JDIMENSION [output_col(eax)] - mov ecx, DCTSIZE/4 ; ctr - alignx 16,7 + mov eax, [original_ebp] + lea esi, [workspace] ; FAST_FLOAT * wsptr + mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) + mov eax, JDIMENSION [output_col(eax)] + mov ecx, DCTSIZE/4 ; ctr + alignx 16,7 .rowloop: - ; -- Even part + ; -- Even part - movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm0 - movaps xmm5,xmm1 - subps xmm0,xmm2 ; xmm0=tmp11 - subps xmm1,xmm3 - addps xmm4,xmm2 ; xmm4=tmp10 - addps xmm5,xmm3 ; xmm5=tmp13 + movaps xmm4,xmm0 + movaps xmm5,xmm1 + subps xmm0,xmm2 ; xmm0=tmp11 + subps xmm1,xmm3 + addps xmm4,xmm2 ; xmm4=tmp10 + addps xmm5,xmm3 ; xmm5=tmp13 - mulps xmm1,[GOTOFF(ebx,PD_1_414)] - subps xmm1,xmm5 ; xmm1=tmp12 + mulps xmm1,[GOTOFF(ebx,PD_1_414)] + subps xmm1,xmm5 ; xmm1=tmp12 - movaps xmm6,xmm4 - movaps xmm7,xmm0 - subps xmm4,xmm5 ; xmm4=tmp3 - subps xmm0,xmm1 ; xmm0=tmp2 - addps xmm6,xmm5 ; xmm6=tmp0 - addps xmm7,xmm1 ; xmm7=tmp1 + movaps xmm6,xmm4 + movaps xmm7,xmm0 + subps xmm4,xmm5 ; xmm4=tmp3 + subps xmm0,xmm1 ; xmm0=tmp2 + addps xmm6,xmm5 ; xmm6=tmp0 + addps xmm7,xmm1 ; xmm7=tmp1 - movaps XMMWORD [wk(1)], xmm4 ; tmp3 - movaps XMMWORD [wk(0)], xmm0 ; tmp2 + movaps XMMWORD [wk(1)], xmm4 ; tmp3 + movaps XMMWORD [wk(0)], xmm0 ; tmp2 - ; -- Odd part + ; -- Odd part - movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)] + movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)] - movaps xmm4,xmm2 - movaps xmm0,xmm5 - addps xmm2,xmm1 ; xmm2=z11 - addps xmm5,xmm3 ; xmm5=z13 - subps xmm4,xmm1 ; xmm4=z12 - subps xmm0,xmm3 ; xmm0=z10 + movaps xmm4,xmm2 + movaps xmm0,xmm5 + addps xmm2,xmm1 ; xmm2=z11 + addps xmm5,xmm3 ; xmm5=z13 + subps xmm4,xmm1 ; xmm4=z12 + subps xmm0,xmm3 ; xmm0=z10 - movaps xmm1,xmm2 - subps xmm2,xmm5 - addps xmm1,xmm5 ; xmm1=tmp7 + movaps xmm1,xmm2 + subps xmm2,xmm5 + addps xmm1,xmm5 ; xmm1=tmp7 - mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 + mulps xmm2,[GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11 - movaps xmm3,xmm0 - addps xmm0,xmm4 - mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 - mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) - mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) - addps xmm3,xmm0 ; xmm3=tmp12 - subps xmm4,xmm0 ; xmm4=tmp10 + movaps xmm3,xmm0 + addps xmm0,xmm4 + mulps xmm0,[GOTOFF(ebx,PD_1_847)] ; xmm0=z5 + mulps xmm3,[GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930) + mulps xmm4,[GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200) + addps xmm3,xmm0 ; xmm3=tmp12 + subps xmm4,xmm0 ; xmm4=tmp10 - ; -- Final output stage + ; -- Final output stage - subps xmm3,xmm1 ; xmm3=tmp6 - movaps xmm5,xmm6 - movaps xmm0,xmm7 - addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) - addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) - subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) - subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) - subps xmm2,xmm3 ; xmm2=tmp5 + subps xmm3,xmm1 ; xmm3=tmp6 + movaps xmm5,xmm6 + movaps xmm0,xmm7 + addps xmm6,xmm1 ; xmm6=data0=(00 10 20 30) + addps xmm7,xmm3 ; xmm7=data1=(01 11 21 31) + subps xmm5,xmm1 ; xmm5=data7=(07 17 27 37) + subps xmm0,xmm3 ; xmm0=data6=(06 16 26 36) + subps xmm2,xmm3 ; xmm2=tmp5 - movaps xmm1,[GOTOFF(ebx,PD_0_125)] ; xmm1=[PD_0_125] + movaps xmm1,[GOTOFF(ebx,PD_0_125)] ; xmm1=[PD_0_125] - mulps xmm6,xmm1 ; descale(1/8) - mulps xmm7,xmm1 ; descale(1/8) - mulps xmm5,xmm1 ; descale(1/8) - mulps xmm0,xmm1 ; descale(1/8) + mulps xmm6,xmm1 ; descale(1/8) + mulps xmm7,xmm1 ; descale(1/8) + mulps xmm5,xmm1 ; descale(1/8) + mulps xmm0,xmm1 ; descale(1/8) - movhlps xmm3,xmm6 - movhlps xmm1,xmm7 - cvtps2pi mm0,xmm6 ; round to int32, mm0=data0L=(00 10) - cvtps2pi mm1,xmm7 ; round to int32, mm1=data1L=(01 11) - cvtps2pi mm2,xmm3 ; round to int32, mm2=data0H=(20 30) - cvtps2pi mm3,xmm1 ; round to int32, mm3=data1H=(21 31) - packssdw mm0,mm2 ; mm0=data0=(00 10 20 30) - packssdw mm1,mm3 ; mm1=data1=(01 11 21 31) + movhlps xmm3,xmm6 + movhlps xmm1,xmm7 + cvtps2pi mm0,xmm6 ; round to int32, mm0=data0L=(00 10) + cvtps2pi mm1,xmm7 ; round to int32, mm1=data1L=(01 11) + cvtps2pi mm2,xmm3 ; round to int32, mm2=data0H=(20 30) + cvtps2pi mm3,xmm1 ; round to int32, mm3=data1H=(21 31) + packssdw mm0,mm2 ; mm0=data0=(00 10 20 30) + packssdw mm1,mm3 ; mm1=data1=(01 11 21 31) - movhlps xmm6,xmm5 - movhlps xmm7,xmm0 - cvtps2pi mm4,xmm5 ; round to int32, mm4=data7L=(07 17) - cvtps2pi mm5,xmm0 ; round to int32, mm5=data6L=(06 16) - cvtps2pi mm6,xmm6 ; round to int32, mm6=data7H=(27 37) - cvtps2pi mm7,xmm7 ; round to int32, mm7=data6H=(26 36) - packssdw mm4,mm6 ; mm4=data7=(07 17 27 37) - packssdw mm5,mm7 ; mm5=data6=(06 16 26 36) + movhlps xmm6,xmm5 + movhlps xmm7,xmm0 + cvtps2pi mm4,xmm5 ; round to int32, mm4=data7L=(07 17) + cvtps2pi mm5,xmm0 ; round to int32, mm5=data6L=(06 16) + cvtps2pi mm6,xmm6 ; round to int32, mm6=data7H=(27 37) + cvtps2pi mm7,xmm7 ; round to int32, mm7=data6H=(26 36) + packssdw mm4,mm6 ; mm4=data7=(07 17 27 37) + packssdw mm5,mm7 ; mm5=data6=(06 16 26 36) - packsswb mm0,mm5 ; mm0=(00 10 20 30 06 16 26 36) - packsswb mm1,mm4 ; mm1=(01 11 21 31 07 17 27 37) + packsswb mm0,mm5 ; mm0=(00 10 20 30 06 16 26 36) + packsswb mm1,mm4 ; mm1=(01 11 21 31 07 17 27 37) - movaps xmm3, XMMWORD [wk(0)] ; xmm3=tmp2 - movaps xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 + movaps xmm3, XMMWORD [wk(0)] ; xmm3=tmp2 + movaps xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 - movaps xmm6,[GOTOFF(ebx,PD_0_125)] ; xmm6=[PD_0_125] + movaps xmm6,[GOTOFF(ebx,PD_0_125)] ; xmm6=[PD_0_125] - addps xmm4,xmm2 ; xmm4=tmp4 - movaps xmm5,xmm3 - movaps xmm0,xmm1 - addps xmm3,xmm2 ; xmm3=data2=(02 12 22 32) - addps xmm1,xmm4 ; xmm1=data4=(04 14 24 34) - subps xmm5,xmm2 ; xmm5=data5=(05 15 25 35) - subps xmm0,xmm4 ; xmm0=data3=(03 13 23 33) + addps xmm4,xmm2 ; xmm4=tmp4 + movaps xmm5,xmm3 + movaps xmm0,xmm1 + addps xmm3,xmm2 ; xmm3=data2=(02 12 22 32) + addps xmm1,xmm4 ; xmm1=data4=(04 14 24 34) + subps xmm5,xmm2 ; xmm5=data5=(05 15 25 35) + subps xmm0,xmm4 ; xmm0=data3=(03 13 23 33) - mulps xmm3,xmm6 ; descale(1/8) - mulps xmm1,xmm6 ; descale(1/8) - mulps xmm5,xmm6 ; descale(1/8) - mulps xmm0,xmm6 ; descale(1/8) + mulps xmm3,xmm6 ; descale(1/8) + mulps xmm1,xmm6 ; descale(1/8) + mulps xmm5,xmm6 ; descale(1/8) + mulps xmm0,xmm6 ; descale(1/8) - movhlps xmm7,xmm3 - movhlps xmm2,xmm1 - cvtps2pi mm2,xmm3 ; round to int32, mm2=data2L=(02 12) - cvtps2pi mm3,xmm1 ; round to int32, mm3=data4L=(04 14) - cvtps2pi mm6,xmm7 ; round to int32, mm6=data2H=(22 32) - cvtps2pi mm7,xmm2 ; round to int32, mm7=data4H=(24 34) - packssdw mm2,mm6 ; mm2=data2=(02 12 22 32) - packssdw mm3,mm7 ; mm3=data4=(04 14 24 34) + movhlps xmm7,xmm3 + movhlps xmm2,xmm1 + cvtps2pi mm2,xmm3 ; round to int32, mm2=data2L=(02 12) + cvtps2pi mm3,xmm1 ; round to int32, mm3=data4L=(04 14) + cvtps2pi mm6,xmm7 ; round to int32, mm6=data2H=(22 32) + cvtps2pi mm7,xmm2 ; round to int32, mm7=data4H=(24 34) + packssdw mm2,mm6 ; mm2=data2=(02 12 22 32) + packssdw mm3,mm7 ; mm3=data4=(04 14 24 34) - movhlps xmm4,xmm5 - movhlps xmm6,xmm0 - cvtps2pi mm5,xmm5 ; round to int32, mm5=data5L=(05 15) - cvtps2pi mm4,xmm0 ; round to int32, mm4=data3L=(03 13) - cvtps2pi mm6,xmm4 ; round to int32, mm6=data5H=(25 35) - cvtps2pi mm7,xmm6 ; round to int32, mm7=data3H=(23 33) - packssdw mm5,mm6 ; mm5=data5=(05 15 25 35) - packssdw mm4,mm7 ; mm4=data3=(03 13 23 33) + movhlps xmm4,xmm5 + movhlps xmm6,xmm0 + cvtps2pi mm5,xmm5 ; round to int32, mm5=data5L=(05 15) + cvtps2pi mm4,xmm0 ; round to int32, mm4=data3L=(03 13) + cvtps2pi mm6,xmm4 ; round to int32, mm6=data5H=(25 35) + cvtps2pi mm7,xmm6 ; round to int32, mm7=data3H=(23 33) + packssdw mm5,mm6 ; mm5=data5=(05 15 25 35) + packssdw mm4,mm7 ; mm4=data3=(03 13 23 33) - movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] + movq mm6,[GOTOFF(ebx,PB_CENTERJSAMP)] ; mm6=[PB_CENTERJSAMP] - packsswb mm2,mm3 ; mm2=(02 12 22 32 04 14 24 34) - packsswb mm4,mm5 ; mm4=(03 13 23 33 05 15 25 35) + packsswb mm2,mm3 ; mm2=(02 12 22 32 04 14 24 34) + packsswb mm4,mm5 ; mm4=(03 13 23 33 05 15 25 35) - paddb mm0,mm6 - paddb mm1,mm6 - paddb mm2,mm6 - paddb mm4,mm6 + paddb mm0,mm6 + paddb mm1,mm6 + paddb mm2,mm6 + paddb mm4,mm6 - movq mm7,mm0 ; transpose coefficients(phase 1) - punpcklbw mm0,mm1 ; mm0=(00 01 10 11 20 21 30 31) - punpckhbw mm7,mm1 ; mm7=(06 07 16 17 26 27 36 37) - movq mm3,mm2 ; transpose coefficients(phase 1) - punpcklbw mm2,mm4 ; mm2=(02 03 12 13 22 23 32 33) - punpckhbw mm3,mm4 ; mm3=(04 05 14 15 24 25 34 35) + movq mm7,mm0 ; transpose coefficients(phase 1) + punpcklbw mm0,mm1 ; mm0=(00 01 10 11 20 21 30 31) + punpckhbw mm7,mm1 ; mm7=(06 07 16 17 26 27 36 37) + movq mm3,mm2 ; transpose coefficients(phase 1) + punpcklbw mm2,mm4 ; mm2=(02 03 12 13 22 23 32 33) + punpckhbw mm3,mm4 ; mm3=(04 05 14 15 24 25 34 35) - movq mm5,mm0 ; transpose coefficients(phase 2) - punpcklwd mm0,mm2 ; mm0=(00 01 02 03 10 11 12 13) - punpckhwd mm5,mm2 ; mm5=(20 21 22 23 30 31 32 33) - movq mm6,mm3 ; transpose coefficients(phase 2) - punpcklwd mm3,mm7 ; mm3=(04 05 06 07 14 15 16 17) - punpckhwd mm6,mm7 ; mm6=(24 25 26 27 34 35 36 37) + movq mm5,mm0 ; transpose coefficients(phase 2) + punpcklwd mm0,mm2 ; mm0=(00 01 02 03 10 11 12 13) + punpckhwd mm5,mm2 ; mm5=(20 21 22 23 30 31 32 33) + movq mm6,mm3 ; transpose coefficients(phase 2) + punpcklwd mm3,mm7 ; mm3=(04 05 06 07 14 15 16 17) + punpckhwd mm6,mm7 ; mm6=(24 25 26 27 34 35 36 37) - movq mm1,mm0 ; transpose coefficients(phase 3) - punpckldq mm0,mm3 ; mm0=(00 01 02 03 04 05 06 07) - punpckhdq mm1,mm3 ; mm1=(10 11 12 13 14 15 16 17) - movq mm4,mm5 ; transpose coefficients(phase 3) - punpckldq mm5,mm6 ; mm5=(20 21 22 23 24 25 26 27) - punpckhdq mm4,mm6 ; mm4=(30 31 32 33 34 35 36 37) + movq mm1,mm0 ; transpose coefficients(phase 3) + punpckldq mm0,mm3 ; mm0=(00 01 02 03 04 05 06 07) + punpckhdq mm1,mm3 ; mm1=(10 11 12 13 14 15 16 17) + movq mm4,mm5 ; transpose coefficients(phase 3) + punpckldq mm5,mm6 ; mm5=(20 21 22 23 24 25 26 27) + punpckhdq mm4,mm6 ; mm4=(30 31 32 33 34 35 36 37) - pushpic ebx ; save GOT address + pushpic ebx ; save GOT address - mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 - mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] - mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] - movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 - movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 + mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+1*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm0 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm1 + mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] + mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW] + movq MMWORD [edx+eax*SIZEOF_JSAMPLE], mm5 + movq MMWORD [ebx+eax*SIZEOF_JSAMPLE], mm4 - poppic ebx ; restore GOT address + poppic ebx ; restore GOT address - add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr - add edi, byte 4*SIZEOF_JSAMPROW - dec ecx ; ctr - jnz near .rowloop + add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr + add edi, byte 4*SIZEOF_JSAMPROW + dec ecx ; ctr + jnz near .rowloop - emms ; empty MMX state + emms ; empty MMX state - pop edi - pop esi -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - mov esp,ebp ; esp <- aligned ebp - pop esp ; esp <- original ebp - pop ebp - ret + pop edi + pop esi +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + mov esp,ebp ; esp <- aligned ebp + pop esp ; esp <- original ebp + pop ebp + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index 2d9e95ef..8806abc6 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -293,7 +293,7 @@ asm_function jsimd_idct_islow_neon mul v30.4h, v30.4h, v6.4h mul v31.4h, v31.4h, v7.4h ins v30.2d[1], v31.2d[0] /* 128 bit q15 */ - sub sp, sp, #32 + sub sp, sp, #32 st1 {v8.4h-v11.4h}, [sp] /* save NEON registers */ sub sp, sp, #32 st1 {v12.4h-v15.4h}, [sp] @@ -365,7 +365,7 @@ asm_function jsimd_idct_islow_neon add v10.4s, v2.4s, v8.4s orr x0, x4, x5 sub v6.4s, v2.4s, v8.4s - /* pop {x4, x5} */ + /* pop {x4, x5} */ ldp x4, x5, [sp], 16 rshrn ROW7L.4h, v4.4s, #11 rshrn ROW3L.4h, v10.4s, #11 @@ -1125,21 +1125,21 @@ jsimd_idct_4x4_neon_consts: smull v28.4s, \x4, v2.4h[2] smlal v28.4s, \x8, v0.4h[0] smlal v28.4s, \x14, v0.4h[1] - + smull v26.4s, \x16, v1.4h[2] smlal v26.4s, \x12, v1.4h[3] smlal v26.4s, \x10, v2.4h[0] smlal v26.4s, \x6, v2.4h[1] - + smull v30.4s, \x4, v2.4h[2] smlsl v30.4s, \x8, v0.4h[0] smlsl v30.4s, \x14, v0.4h[1] - + smull v24.4s, \x16, v0.4h[2] smlal v24.4s, \x12, v0.4h[3] smlal v24.4s, \x10, v1.4h[0] smlal v24.4s, \x6, v1.4h[1] - + add v20.4s, v28.4s, v26.4s sub v28.4s, v28.4s, v26.4s @@ -1148,11 +1148,11 @@ jsimd_idct_4x4_neon_consts: srshr v28.4s, v28.4s, #\shift xtn \y26, v20.4s xtn \y29, v28.4s -.else +.else rshrn \y26, v20.4s, #\shift rshrn \y29, v28.4s, #\shift -.endif - +.endif + add v20.4s, v30.4s, v24.4s sub v30.4s, v30.4s, v24.4s @@ -1279,7 +1279,7 @@ asm_function jsimd_idct_4x4_neon st1 {v27.b}[2], [TMP3], 1 st1 {v26.b}[3], [TMP1], 1 st1 {v27.b}[3], [TMP3], 1 - + st1 {v26.b}[4], [TMP2], 1 st1 {v27.b}[4], [TMP4], 1 st1 {v26.b}[5], [TMP2], 1 diff --git a/simd/jsimdcpu.asm b/simd/jsimdcpu.asm index bdbcc231..c42c4ad6 100644 --- a/simd/jsimdcpu.asm +++ b/simd/jsimdcpu.asm @@ -19,8 +19,8 @@ %include "jsimdext.inc" ; -------------------------------------------------------------------------- - SECTION SEG_TEXT - BITS 32 + SECTION SEG_TEXT + BITS 32 ; ; Check if the CPU supports SIMD instructions ; @@ -28,78 +28,78 @@ ; jpeg_simd_cpu_support (void) ; - align 16 - global EXTN(jpeg_simd_cpu_support) + align 16 + global EXTN(jpeg_simd_cpu_support) EXTN(jpeg_simd_cpu_support): - push ebx -; push ecx ; need not be preserved -; push edx ; need not be preserved -; push esi ; unused - push edi + push ebx +; push ecx ; need not be preserved +; push edx ; need not be preserved +; push esi ; unused + push edi - xor edi,edi ; simd support flag + xor edi,edi ; simd support flag - pushfd - pop eax - mov edx,eax - xor eax, 1<<21 ; flip ID bit in EFLAGS - push eax - popfd - pushfd - pop eax - xor eax,edx - jz short .return ; CPUID is not supported + pushfd + pop eax + mov edx,eax + xor eax, 1<<21 ; flip ID bit in EFLAGS + push eax + popfd + pushfd + pop eax + xor eax,edx + jz short .return ; CPUID is not supported - ; Check for MMX instruction support - xor eax,eax - cpuid - test eax,eax - jz short .return + ; Check for MMX instruction support + xor eax,eax + cpuid + test eax,eax + jz short .return - xor eax,eax - inc eax - cpuid - mov eax,edx ; eax = Standard feature flags + xor eax,eax + inc eax + cpuid + mov eax,edx ; eax = Standard feature flags - test eax, 1<<23 ; bit23:MMX - jz short .no_mmx - or edi, byte JSIMD_MMX + test eax, 1<<23 ; bit23:MMX + jz short .no_mmx + or edi, byte JSIMD_MMX .no_mmx: - test eax, 1<<25 ; bit25:SSE - jz short .no_sse - or edi, byte JSIMD_SSE + test eax, 1<<25 ; bit25:SSE + jz short .no_sse + or edi, byte JSIMD_SSE .no_sse: - test eax, 1<<26 ; bit26:SSE2 - jz short .no_sse2 - or edi, byte JSIMD_SSE2 + test eax, 1<<26 ; bit26:SSE2 + jz short .no_sse2 + or edi, byte JSIMD_SSE2 .no_sse2: - ; Check for 3DNow! instruction support - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000000 - jbe short .return + ; Check for 3DNow! instruction support + mov eax, 0x80000000 + cpuid + cmp eax, 0x80000000 + jbe short .return - mov eax, 0x80000001 - cpuid - mov eax,edx ; eax = Extended feature flags + mov eax, 0x80000001 + cpuid + mov eax,edx ; eax = Extended feature flags - test eax, 1<<31 ; bit31:3DNow!(vendor independent) - jz short .no_3dnow - or edi, byte JSIMD_3DNOW + test eax, 1<<31 ; bit31:3DNow!(vendor independent) + jz short .no_3dnow + or edi, byte JSIMD_3DNOW .no_3dnow: .return: - mov eax,edi + mov eax,edi - pop edi -; pop esi ; unused -; pop edx ; need not be preserved -; pop ecx ; need not be preserved - pop ebx - ret + pop edi +; pop esi ; unused +; pop edx ; need not be preserved +; pop ecx ; need not be preserved + pop ebx + ret ; For some reason, the OS X linker does not honor the request to align the ; segment unless we do this. - align 16 + align 16 diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 253b8972..0f1a8dac 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -30,7 +30,7 @@ ; ========================================================================== ; System-dependent configurations -%ifdef WIN32 ; ----(nasm -fwin32 -DWIN32 ...)-------- +%ifdef WIN32 ; ----(nasm -fwin32 -DWIN32 ...)-------- ; * Microsoft Visual C++ ; * MinGW (Minimalist GNU for Windows) ; * CygWin @@ -46,7 +46,7 @@ %define SEG_CONST .rdata align=16 public use32 class=CONST %endif -%elifdef WIN64 ; ----(nasm -fwin64 -DWIN64 ...)-------- +%elifdef WIN64 ; ----(nasm -fwin64 -DWIN64 ...)-------- ; * Microsoft Visual C++ ; -- segment definition -- @@ -58,9 +58,9 @@ %define SEG_TEXT .text align=16 public use64 class=CODE %define SEG_CONST .rdata align=16 public use64 class=CONST %endif -%define EXTN(name) name ; foo() -> foo +%define EXTN(name) name ; foo() -> foo -%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)---------- +%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)---------- ; * Borland C++ (Win32) ; -- segment definition -- @@ -68,7 +68,7 @@ %define SEG_TEXT .text align=16 public use32 class=CODE %define SEG_CONST .data align=16 public use32 class=DATA -%elifdef ELF ; ----(nasm -felf[64] -DELF ...)------------ +%elifdef ELF ; ----(nasm -felf[64] -DELF ...)------------ ; * Linux ; * *BSD family Unix using elf format ; * Unix System V, including Solaris x86, UnixWare and SCO Unix @@ -88,10 +88,10 @@ section .note.GNU-stack noalloc noexec nowrite progbits ; To make the code position-independent, append -DPIC to the commandline ; -%define GOT_SYMBOL _GLOBAL_OFFSET_TABLE_ ; ELF supports PIC -%define EXTN(name) name ; foo() -> foo +%define GOT_SYMBOL _GLOBAL_OFFSET_TABLE_ ; ELF supports PIC +%define EXTN(name) name ; foo() -> foo -%elifdef AOUT ; ----(nasm -faoutb/aout -DAOUT ...)---- +%elifdef AOUT ; ----(nasm -faoutb/aout -DAOUT ...)---- ; * Older Linux using a.out format (nasm -f aout -DAOUT ...) ; * *BSD family Unix using a.out format (nasm -f aoutb -DAOUT ...) @@ -102,29 +102,29 @@ section .note.GNU-stack noalloc noexec nowrite progbits ; To make the code position-independent, append -DPIC to the commandline ; -%define GOT_SYMBOL __GLOBAL_OFFSET_TABLE_ ; BSD-style a.out supports PIC +%define GOT_SYMBOL __GLOBAL_OFFSET_TABLE_ ; BSD-style a.out supports PIC -%elifdef MACHO ; ----(nasm -fmacho -DMACHO ...)-------- +%elifdef MACHO ; ----(nasm -fmacho -DMACHO ...)-------- ; * NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (Mach-O format) ; -- segment definition -- ; -%define SEG_TEXT .text ;align=16 ; nasm doesn't accept align=16. why? +%define SEG_TEXT .text ;align=16 ; nasm doesn't accept align=16. why? %define SEG_CONST .rodata align=16 ; The generation of position-independent code (PIC) is the default on Darwin. ; %define PIC -%define GOT_SYMBOL _MACHO_PIC_ ; Mach-O style code-relative addressing +%define GOT_SYMBOL _MACHO_PIC_ ; Mach-O style code-relative addressing -%else ; ----(Other case)---------------------- +%else ; ----(Other case)---------------------- ; -- segment definition -- ; %define SEG_TEXT .text %define SEG_CONST .data -%endif ; ---------------------------------------------- +%endif ; ---------------------------------------------- ; ========================================================================== @@ -179,7 +179,7 @@ section .note.GNU-stack noalloc noexec nowrite progbits ; External Symbol Name ; %ifndef EXTN -%define EXTN(name) _ %+ name ; foo() -> _foo +%define EXTN(name) _ %+ name ; foo() -> _foo %endif ; -------------------------------------------------------------------------- @@ -196,79 +196,79 @@ section .note.GNU-stack noalloc noexec nowrite progbits ; At present, nasm doesn't seem to support PIC generation for Mach-O. ; The PIC support code below is a little tricky. - SECTION SEG_CONST + SECTION SEG_CONST const_base: %define GOTOFF(got,sym) (got) + (sym) - const_base -%imacro get_GOT 1 - ; NOTE: this macro destroys ecx resister. - call %%geteip - add ecx, byte (%%ref - $) - jmp short %%adjust +%imacro get_GOT 1 + ; NOTE: this macro destroys ecx resister. + call %%geteip + add ecx, byte (%%ref - $) + jmp short %%adjust %%geteip: - mov ecx, POINTER [esp] - ret + mov ecx, POINTER [esp] + ret %%adjust: - push ebp - xor ebp,ebp ; ebp = 0 -%ifidni %1,ebx ; (%1 == ebx) - ; db 0x8D,0x9C + jmp near const_base = - ; lea ebx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,9C,E9,(offset32) - db 0x8D,0x9C ; 8D,9C - jmp near const_base ; E9,(const_base-%%ref) + push ebp + xor ebp,ebp ; ebp = 0 +%ifidni %1,ebx ; (%1 == ebx) + ; db 0x8D,0x9C + jmp near const_base = + ; lea ebx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,9C,E9,(offset32) + db 0x8D,0x9C ; 8D,9C + jmp near const_base ; E9,(const_base-%%ref) %%ref: %else ; (%1 != ebx) - ; db 0x8D,0x8C + jmp near const_base = - ; lea ecx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,8C,E9,(offset32) - db 0x8D,0x8C ; 8D,8C - jmp near const_base ; E9,(const_base-%%ref) -%%ref: mov %1, ecx + ; db 0x8D,0x8C + jmp near const_base = + ; lea ecx, [ecx+ebp*8+(const_base-%%ref)] ; 8D,8C,E9,(offset32) + db 0x8D,0x8C ; 8D,8C + jmp near const_base ; E9,(const_base-%%ref) +%%ref: mov %1, ecx %endif ; (%1 == ebx) - pop ebp + pop ebp %endmacro -%else ; GOT_SYMBOL != _MACHO_PIC_ ---------------- +%else ; GOT_SYMBOL != _MACHO_PIC_ ---------------- %define GOTOFF(got,sym) (got) + (sym) wrt ..gotoff -%imacro get_GOT 1 - extern GOT_SYMBOL - call %%geteip - add %1, GOT_SYMBOL + $$ - $ wrt ..gotpc - jmp short %%done +%imacro get_GOT 1 + extern GOT_SYMBOL + call %%geteip + add %1, GOT_SYMBOL + $$ - $ wrt ..gotpc + jmp short %%done %%geteip: - mov %1, POINTER [esp] - ret + mov %1, POINTER [esp] + ret %%done: %endmacro -%endif ; GOT_SYMBOL == _MACHO_PIC_ ---------------- +%endif ; GOT_SYMBOL == _MACHO_PIC_ ---------------- -%imacro pushpic 1.nolist - push %1 +%imacro pushpic 1.nolist + push %1 %endmacro -%imacro poppic 1.nolist - pop %1 +%imacro poppic 1.nolist + pop %1 %endmacro -%imacro movpic 2.nolist - mov %1,%2 +%imacro movpic 2.nolist + mov %1,%2 %endmacro -%else ; !PIC ----------------------------------------- +%else ; !PIC ----------------------------------------- %define GOTOFF(got,sym) (sym) -%imacro get_GOT 1.nolist +%imacro get_GOT 1.nolist %endmacro -%imacro pushpic 1.nolist +%imacro pushpic 1.nolist %endmacro -%imacro poppic 1.nolist +%imacro poppic 1.nolist %endmacro -%imacro movpic 2.nolist +%imacro movpic 2.nolist %endmacro -%endif ; PIC ----------------------------------------- +%endif ; PIC ----------------------------------------- ; -------------------------------------------------------------------------- ; Align the next instruction on {2,4,8,16,..}-byte boundary. @@ -278,28 +278,28 @@ const_base: %define FILLB(b,n) (($$-(b)) & ((n)-1)) %imacro alignx 1-2.nolist 0xFFFF -%%bs: times MSKLE(FILLB(%%bs,%1),%2) & MSKLE(16,FILLB($,%1)) & FILLB($,%1) \ - db 0x90 ; nop - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/9 \ - db 0x8D,0x9C,0x23,0x00,0x00,0x00,0x00 ; lea ebx,[ebx+0x00000000] - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/7 \ - db 0x8D,0xAC,0x25,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/6 \ - db 0x8D,0xAD,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/4 \ - db 0x8D,0x6C,0x25,0x00 ; lea ebp,[ebp+0x00] - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/3 \ - db 0x8D,0x6D,0x00 ; lea ebp,[ebp+0x00] - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/2 \ - db 0x8B,0xED ; mov ebp,ebp - times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/1 \ - db 0x90 ; nop +%%bs: times MSKLE(FILLB(%%bs,%1),%2) & MSKLE(16,FILLB($,%1)) & FILLB($,%1) \ + db 0x90 ; nop + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/9 \ + db 0x8D,0x9C,0x23,0x00,0x00,0x00,0x00 ; lea ebx,[ebx+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/7 \ + db 0x8D,0xAC,0x25,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/6 \ + db 0x8D,0xAD,0x00,0x00,0x00,0x00 ; lea ebp,[ebp+0x00000000] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/4 \ + db 0x8D,0x6C,0x25,0x00 ; lea ebp,[ebp+0x00] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/3 \ + db 0x8D,0x6D,0x00 ; lea ebp,[ebp+0x00] + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/2 \ + db 0x8B,0xED ; mov ebp,ebp + times MSKLE(FILLB(%%bs,%1),%2) & FILLB($,%1)/1 \ + db 0x90 ; nop %endmacro ; Align the next data on {2,4,8,16,..}-byte boundary. ; %imacro alignz 1.nolist - align %1, db 0 ; filling zeros + align %1, db 0 ; filling zeros %endmacro %ifdef __x86_64__ @@ -307,61 +307,61 @@ const_base: %ifdef WIN64 %imacro collect_args 0 - push r12 - push r13 - push r14 - push r15 - mov r10, rcx - mov r11, rdx - mov r12, r8 - mov r13, r9 - mov r14, [rax+48] - mov r15, [rax+56] - push rsi - push rdi - sub rsp, SIZEOF_XMMWORD - movaps XMMWORD [rsp], xmm6 - sub rsp, SIZEOF_XMMWORD - movaps XMMWORD [rsp], xmm7 + push r12 + push r13 + push r14 + push r15 + mov r10, rcx + mov r11, rdx + mov r12, r8 + mov r13, r9 + mov r14, [rax+48] + mov r15, [rax+56] + push rsi + push rdi + sub rsp, SIZEOF_XMMWORD + movaps XMMWORD [rsp], xmm6 + sub rsp, SIZEOF_XMMWORD + movaps XMMWORD [rsp], xmm7 %endmacro %imacro uncollect_args 0 - movaps xmm7, XMMWORD [rsp] - add rsp, SIZEOF_XMMWORD - movaps xmm6, XMMWORD [rsp] - add rsp, SIZEOF_XMMWORD - pop rdi - pop rsi - pop r15 - pop r14 - pop r13 - pop r12 + movaps xmm7, XMMWORD [rsp] + add rsp, SIZEOF_XMMWORD + movaps xmm6, XMMWORD [rsp] + add rsp, SIZEOF_XMMWORD + pop rdi + pop rsi + pop r15 + pop r14 + pop r13 + pop r12 %endmacro %else %imacro collect_args 0 - push r10 - push r11 - push r12 - push r13 - push r14 - push r15 - mov r10, rdi - mov r11, rsi - mov r12, rdx - mov r13, rcx - mov r14, r8 - mov r15, r9 + push r10 + push r11 + push r12 + push r13 + push r14 + push r15 + mov r10, rdi + mov r11, rsi + mov r12, rdx + mov r13, rcx + mov r14, r8 + mov r15, r9 %endmacro %imacro uncollect_args 0 - pop r15 - pop r14 - pop r13 - pop r12 - pop r11 - pop r10 + pop r15 + pop r14 + pop r13 + pop r12 + pop r11 + pop r10 %endmacro %endif diff --git a/structure.txt b/structure.txt index 12549e0f..21bbc7a0 100644 --- a/structure.txt +++ b/structure.txt @@ -24,8 +24,8 @@ In this document, JPEG-specific terminology follows the JPEG standard: A "coefficient" is a frequency coefficient (a DCT transform output number). A "block" is an 8x8 group of samples or coefficients. An "MCU" (minimum coded unit) is an interleaved set of blocks of size - determined by the sampling factors, or a single block in a - noninterleaved scan. + determined by the sampling factors, or a single block in a + noninterleaved scan. We do not use the terms "pixel" and "sample" interchangeably. When we say pixel, we mean an element of the full-size image, while a sample is an element of the downsampled image. Thus the number of samples may vary across @@ -264,14 +264,14 @@ responsibilities: 1B. Per-pass control. This determines how many passes will be performed and calls each active processing module to configure itself appropriately at the beginning of each pass. End-of-pass processing, - where necessary, is also invoked from the master control module. + where necessary, is also invoked from the master control module. Method selection is partially distributed, in that a particular processing module may contain several possible implementations of a particular method, which it will select among when given its initialization call. The master control code need only be concerned with decisions that affect more than one module. - + 2. Data buffering control. A separate control module exists for each inter-processing-step data buffer. This module is responsible for invoking the processing steps that write or read that data buffer. @@ -573,10 +573,10 @@ there isn't any real need for it. Arrays of pixel sample values use the following data structure: - typedef something JSAMPLE; a pixel component value, 0..MAXJSAMPLE - typedef JSAMPLE *JSAMPROW; ptr to a row of samples - typedef JSAMPROW *JSAMPARRAY; ptr to a list of rows - typedef JSAMPARRAY *JSAMPIMAGE; ptr to a list of color-component arrays + typedef something JSAMPLE; a pixel component value, 0..MAXJSAMPLE + typedef JSAMPLE *JSAMPROW; ptr to a row of samples + typedef JSAMPROW *JSAMPARRAY; ptr to a list of rows + typedef JSAMPARRAY *JSAMPIMAGE; ptr to a list of color-component arrays The basic element type JSAMPLE will typically be one of unsigned char, (signed) char, or short. Short will be used if samples wider than 8 bits are @@ -617,7 +617,7 @@ we can read or write each component to a temporary file independently, which is helpful when dealing with noninterleaved JPEG files. In general, a specific sample value is accessed by code such as - GETJSAMPLE(image[colorcomponent][row][col]) + GETJSAMPLE(image[colorcomponent][row][col]) where col is measured from the image left edge, but row is measured from the first sample row currently in memory. Either of the first two indexings can be precomputed by copying the relevant pointer. @@ -636,11 +636,11 @@ with component-wise storage.) Arrays of DCT-coefficient values use the following data structure: - typedef short JCOEF; a 16-bit signed integer - typedef JCOEF JBLOCK[DCTSIZE2]; an 8x8 block of coefficients - typedef JBLOCK *JBLOCKROW; ptr to one horizontal row of 8x8 blocks - typedef JBLOCKROW *JBLOCKARRAY; ptr to a list of such rows - typedef JBLOCKARRAY *JBLOCKIMAGE; ptr to a list of color component arrays + typedef short JCOEF; a 16-bit signed integer + typedef JCOEF JBLOCK[DCTSIZE2]; an 8x8 block of coefficients + typedef JBLOCK *JBLOCKROW; ptr to one horizontal row of 8x8 blocks + typedef JBLOCKROW *JBLOCKARRAY; ptr to a list of such rows + typedef JBLOCKARRAY *JBLOCKIMAGE; ptr to a list of color component arrays 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 @@ -759,8 +759,8 @@ can be freed at once. This approach helps prevent storage-leak bugs, and it speeds up operations whenever malloc/free are slow (as they often are). The pools can be regarded as lifetime identifiers for objects. Two pools/lifetimes are defined: - * JPOOL_PERMANENT lasts until master record is destroyed - * JPOOL_IMAGE lasts until done with image (JPEG datastream) + * JPOOL_PERMANENT lasts until master record is destroyed + * JPOOL_IMAGE lasts until done with image (JPEG datastream) Permanent lifetime is used for parameters and tables that should be carried across from one datastream to another; this includes all application-visible parameters. Image lifetime is used for everything else. (A third lifetime, @@ -857,20 +857,20 @@ outlined above are implemented by the front end. The back end provides the following routines for use by the front end (none of these routines are known to the rest of the JPEG code): -jpeg_mem_init, jpeg_mem_term system-dependent initialization/shutdown +jpeg_mem_init, jpeg_mem_term system-dependent initialization/shutdown -jpeg_get_small, jpeg_free_small interface to malloc and free library routines - (or their equivalents) +jpeg_get_small, jpeg_free_small interface to malloc and free library routines + (or their equivalents) -jpeg_get_large, jpeg_free_large interface to FAR malloc/free in MSDOS machines; - else usually the same as - jpeg_get_small/jpeg_free_small +jpeg_get_large, jpeg_free_large interface to FAR malloc/free in MSDOS machines; + else usually the same as + jpeg_get_small/jpeg_free_small -jpeg_mem_available estimate available memory +jpeg_mem_available estimate available memory -jpeg_open_backing_store create a backing-store object +jpeg_open_backing_store create a backing-store object -read_backing_store, manipulate a backing-store object +read_backing_store, manipulate a backing-store object write_backing_store, close_backing_store diff --git a/transupp.c b/transupp.c index a16b20a5..72ef8d81 100644 --- a/transupp.c +++ b/transupp.c @@ -21,9 +21,9 @@ #include "jinclude.h" #include "jpeglib.h" -#include "transupp.h" /* My own external interface */ +#include "transupp.h" /* My own external interface */ #include "jpegcomp.h" -#include /* to declare isdigit() */ +#include /* to declare isdigit() */ #if JPEG_LIB_VERSION >= 70 @@ -89,9 +89,9 @@ LOCAL(void) do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* Crop. This is only used when no rotate/flip is requested with the crop. */ { JDIMENSION dst_blk_y, x_crop_blocks, y_crop_blocks; @@ -107,18 +107,18 @@ do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_y + y_crop_blocks, - (JDIMENSION) compptr->v_samp_factor, FALSE); + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_y + y_crop_blocks, + (JDIMENSION) compptr->v_samp_factor, FALSE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - jcopy_block_row(src_buffer[offset_y] + x_crop_blocks, - dst_buffer[offset_y], - compptr->width_in_blocks); + jcopy_block_row(src_buffer[offset_y] + x_crop_blocks, + dst_buffer[offset_y], + compptr->width_in_blocks); } } } @@ -127,8 +127,8 @@ do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, - jvirt_barray_ptr *src_coef_arrays) + JDIMENSION x_crop_offset, + jvirt_barray_ptr *src_coef_arrays) /* Horizontal flip; done in-place, so no separate dest array is required. * NB: this only works when y_crop_offset is zero. */ @@ -153,39 +153,39 @@ do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, comp_width = MCU_cols * compptr->h_samp_factor; x_crop_blocks = x_crop_offset * compptr->h_samp_factor; for (blk_y = 0; blk_y < compptr->height_in_blocks; - blk_y += compptr->v_samp_factor) { + blk_y += compptr->v_samp_factor) { buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - /* Do the mirroring */ - for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) { - ptr1 = buffer[offset_y][blk_x]; - ptr2 = buffer[offset_y][comp_width - blk_x - 1]; - /* this unrolled loop doesn't need to know which row it's on... */ - for (k = 0; k < DCTSIZE2; k += 2) { - temp1 = *ptr1; /* swap even column */ - temp2 = *ptr2; - *ptr1++ = temp2; - *ptr2++ = temp1; - temp1 = *ptr1; /* swap odd column with sign change */ - temp2 = *ptr2; - *ptr1++ = -temp2; - *ptr2++ = -temp1; - } - } - if (x_crop_blocks > 0) { - /* Now left-justify the portion of the data to be kept. - * We can't use a single jcopy_block_row() call because that routine - * depends on memcpy(), whose behavior is unspecified for overlapping - * source and destination areas. Sigh. - */ - for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) { - jcopy_block_row(buffer[offset_y] + blk_x + x_crop_blocks, - buffer[offset_y] + blk_x, - (JDIMENSION) 1); - } - } + /* Do the mirroring */ + for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) { + ptr1 = buffer[offset_y][blk_x]; + ptr2 = buffer[offset_y][comp_width - blk_x - 1]; + /* this unrolled loop doesn't need to know which row it's on... */ + for (k = 0; k < DCTSIZE2; k += 2) { + temp1 = *ptr1; /* swap even column */ + temp2 = *ptr2; + *ptr1++ = temp2; + *ptr2++ = temp1; + temp1 = *ptr1; /* swap odd column with sign change */ + temp2 = *ptr2; + *ptr1++ = -temp2; + *ptr2++ = -temp1; + } + } + if (x_crop_blocks > 0) { + /* Now left-justify the portion of the data to be kept. + * We can't use a single jcopy_block_row() call because that routine + * depends on memcpy(), whose behavior is unspecified for overlapping + * source and destination areas. Sigh. + */ + for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) { + jcopy_block_row(buffer[offset_y] + blk_x + x_crop_blocks, + buffer[offset_y] + blk_x, + (JDIMENSION) 1); + } + } } } } @@ -194,9 +194,9 @@ do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* Horizontal flip in general cropping case */ { JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y; @@ -220,34 +220,34 @@ do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_y + y_crop_blocks, - (JDIMENSION) compptr->v_samp_factor, FALSE); + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_y + y_crop_blocks, + (JDIMENSION) compptr->v_samp_factor, FALSE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - dst_row_ptr = dst_buffer[offset_y]; - src_row_ptr = src_buffer[offset_y]; - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Do the mirrorable blocks */ - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; - /* this unrolled loop doesn't need to know which row it's on... */ - for (k = 0; k < DCTSIZE2; k += 2) { - *dst_ptr++ = *src_ptr++; /* copy even column */ - *dst_ptr++ = - *src_ptr++; /* copy odd column with sign change */ - } - } else { - /* Copy last partial block(s) verbatim */ - jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks, - dst_row_ptr + dst_blk_x, - (JDIMENSION) 1); - } - } + dst_row_ptr = dst_buffer[offset_y]; + src_row_ptr = src_buffer[offset_y]; + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Do the mirrorable blocks */ + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; + /* this unrolled loop doesn't need to know which row it's on... */ + for (k = 0; k < DCTSIZE2; k += 2) { + *dst_ptr++ = *src_ptr++; /* copy even column */ + *dst_ptr++ = - *src_ptr++; /* copy odd column with sign change */ + } + } else { + /* Copy last partial block(s) verbatim */ + jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks, + dst_row_ptr + dst_blk_x, + (JDIMENSION) 1); + } + } } } } @@ -256,9 +256,9 @@ do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* Vertical flip */ { JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; @@ -285,49 +285,49 @@ do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); if (y_crop_blocks + dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_height - y_crop_blocks - dst_blk_y - - (JDIMENSION) compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); + /* Row is within the mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_height - y_crop_blocks - dst_blk_y - + (JDIMENSION) compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); } else { - /* Bottom-edge blocks will be copied verbatim. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_y + y_crop_blocks, - (JDIMENSION) compptr->v_samp_factor, FALSE); + /* Bottom-edge blocks will be copied verbatim. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_y + y_crop_blocks, + (JDIMENSION) compptr->v_samp_factor, FALSE); } for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - if (y_crop_blocks + dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - dst_row_ptr = dst_buffer[offset_y]; - src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; - src_row_ptr += x_crop_blocks; - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[dst_blk_x]; - for (i = 0; i < DCTSIZE; i += 2) { - /* copy even row */ - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = *src_ptr++; - /* copy odd row with sign change */ - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = - *src_ptr++; - } - } - } else { - /* Just copy row verbatim. */ - jcopy_block_row(src_buffer[offset_y] + x_crop_blocks, - dst_buffer[offset_y], - compptr->width_in_blocks); - } + if (y_crop_blocks + dst_blk_y < comp_height) { + /* Row is within the mirrorable area. */ + dst_row_ptr = dst_buffer[offset_y]; + src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; + src_row_ptr += x_crop_blocks; + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[dst_blk_x]; + for (i = 0; i < DCTSIZE; i += 2) { + /* copy even row */ + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = *src_ptr++; + /* copy odd row with sign change */ + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = - *src_ptr++; + } + } + } else { + /* Just copy row verbatim. */ + jcopy_block_row(src_buffer[offset_y] + x_crop_blocks, + dst_buffer[offset_y], + compptr->width_in_blocks); + } } } } @@ -336,9 +336,9 @@ do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* Transpose source into destination */ { JDIMENSION dst_blk_x, dst_blk_y, x_crop_blocks, y_crop_blocks; @@ -357,25 +357,25 @@ do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_x + x_crop_blocks, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - src_ptr = src_buffer[offset_x][dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_x + x_crop_blocks, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + src_ptr = src_buffer[offset_x][dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } } } } @@ -384,9 +384,9 @@ do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* 90 degree rotation is equivalent to * 1. Transposing the image; * 2. Horizontal mirroring. @@ -413,50 +413,50 @@ do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_width - x_crop_blocks - dst_blk_x - - (JDIMENSION) compptr->h_samp_factor, - (JDIMENSION) compptr->h_samp_factor, FALSE); - } else { - /* Edge blocks are transposed but not mirrored. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_x + x_crop_blocks, - (JDIMENSION) compptr->h_samp_factor, FALSE); - } - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] - [dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - i++; - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } else { - /* Edge blocks are transposed but not mirrored. */ - src_ptr = src_buffer[offset_x] - [dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_width - x_crop_blocks - dst_blk_x - + (JDIMENSION) compptr->h_samp_factor, + (JDIMENSION) compptr->h_samp_factor, FALSE); + } else { + /* Edge blocks are transposed but not mirrored. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_x + x_crop_blocks, + (JDIMENSION) compptr->h_samp_factor, FALSE); + } + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] + [dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + i++; + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } else { + /* Edge blocks are transposed but not mirrored. */ + src_ptr = src_buffer[offset_x] + [dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } } } } @@ -465,9 +465,9 @@ do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* 270 degree rotation is equivalent to * 1. Horizontal mirroring; * 2. Transposing the image. @@ -494,40 +494,40 @@ do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_x + x_crop_blocks, - (JDIMENSION) compptr->h_samp_factor, FALSE); - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - if (y_crop_blocks + dst_blk_y < comp_height) { - /* Block is within the mirrorable area. */ - src_ptr = src_buffer[offset_x] - [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } - } else { - /* Edge blocks are transposed but not mirrored. */ - src_ptr = src_buffer[offset_x] - [dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_x + x_crop_blocks, + (JDIMENSION) compptr->h_samp_factor, FALSE); + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + if (y_crop_blocks + dst_blk_y < comp_height) { + /* Block is within the mirrorable area. */ + src_ptr = src_buffer[offset_x] + [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } + } else { + /* Edge blocks are transposed but not mirrored. */ + src_ptr = src_buffer[offset_x] + [dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } } } } @@ -536,9 +536,9 @@ do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* 180 degree rotation is equivalent to * 1. Vertical mirroring; * 2. Horizontal mirroring. @@ -565,77 +565,77 @@ do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); if (y_crop_blocks + dst_blk_y < comp_height) { - /* Row is within the vertically mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_height - y_crop_blocks - dst_blk_y - - (JDIMENSION) compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); + /* Row is within the vertically mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_height - y_crop_blocks - dst_blk_y - + (JDIMENSION) compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); } else { - /* Bottom-edge rows are only mirrored horizontally. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_y + y_crop_blocks, - (JDIMENSION) compptr->v_samp_factor, FALSE); + /* Bottom-edge rows are only mirrored horizontally. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_y + y_crop_blocks, + (JDIMENSION) compptr->v_samp_factor, FALSE); } for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - dst_row_ptr = dst_buffer[offset_y]; - if (y_crop_blocks + dst_blk_y < comp_height) { - /* Row is within the mirrorable area. */ - src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { - dst_ptr = dst_row_ptr[dst_blk_x]; - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Process the blocks that can be mirrored both ways. */ - src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; - for (i = 0; i < DCTSIZE; i += 2) { - /* For even row, negate every odd column. */ - for (j = 0; j < DCTSIZE; j += 2) { - *dst_ptr++ = *src_ptr++; - *dst_ptr++ = - *src_ptr++; - } - /* For odd row, negate every even column. */ - for (j = 0; j < DCTSIZE; j += 2) { - *dst_ptr++ = - *src_ptr++; - *dst_ptr++ = *src_ptr++; - } - } - } else { - /* Any remaining right-edge blocks are only mirrored vertically. */ - src_ptr = src_row_ptr[x_crop_blocks + dst_blk_x]; - for (i = 0; i < DCTSIZE; i += 2) { - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = *src_ptr++; - for (j = 0; j < DCTSIZE; j++) - *dst_ptr++ = - *src_ptr++; - } - } - } - } else { - /* Remaining rows are just mirrored horizontally. */ - src_row_ptr = src_buffer[offset_y]; - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Process the blocks that can be mirrored. */ - dst_ptr = dst_row_ptr[dst_blk_x]; - src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; - for (i = 0; i < DCTSIZE2; i += 2) { - *dst_ptr++ = *src_ptr++; - *dst_ptr++ = - *src_ptr++; - } - } else { - /* Any remaining right-edge blocks are only copied. */ - jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks, - dst_row_ptr + dst_blk_x, - (JDIMENSION) 1); - } - } - } + dst_row_ptr = dst_buffer[offset_y]; + if (y_crop_blocks + dst_blk_y < comp_height) { + /* Row is within the mirrorable area. */ + src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1]; + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { + dst_ptr = dst_row_ptr[dst_blk_x]; + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Process the blocks that can be mirrored both ways. */ + src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; + for (i = 0; i < DCTSIZE; i += 2) { + /* For even row, negate every odd column. */ + for (j = 0; j < DCTSIZE; j += 2) { + *dst_ptr++ = *src_ptr++; + *dst_ptr++ = - *src_ptr++; + } + /* For odd row, negate every even column. */ + for (j = 0; j < DCTSIZE; j += 2) { + *dst_ptr++ = - *src_ptr++; + *dst_ptr++ = *src_ptr++; + } + } + } else { + /* Any remaining right-edge blocks are only mirrored vertically. */ + src_ptr = src_row_ptr[x_crop_blocks + dst_blk_x]; + for (i = 0; i < DCTSIZE; i += 2) { + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = *src_ptr++; + for (j = 0; j < DCTSIZE; j++) + *dst_ptr++ = - *src_ptr++; + } + } + } + } else { + /* Remaining rows are just mirrored horizontally. */ + src_row_ptr = src_buffer[offset_y]; + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Process the blocks that can be mirrored. */ + dst_ptr = dst_row_ptr[dst_blk_x]; + src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1]; + for (i = 0; i < DCTSIZE2; i += 2) { + *dst_ptr++ = *src_ptr++; + *dst_ptr++ = - *src_ptr++; + } + } else { + /* Any remaining right-edge blocks are only copied. */ + jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks, + dst_row_ptr + dst_blk_x, + (JDIMENSION) 1); + } + } + } } } } @@ -644,9 +644,9 @@ do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, LOCAL(void) do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, - jvirt_barray_ptr *src_coef_arrays, - jvirt_barray_ptr *dst_coef_arrays) + JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, + jvirt_barray_ptr *src_coef_arrays, + jvirt_barray_ptr *dst_coef_arrays) /* Transverse transpose is equivalent to * 1. 180 degree rotation; * 2. Transposition; @@ -676,81 +676,81 @@ do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, x_crop_blocks = x_crop_offset * compptr->h_samp_factor; y_crop_blocks = y_crop_offset * compptr->v_samp_factor; for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; - dst_blk_y += compptr->v_samp_factor) { + dst_blk_y += compptr->v_samp_factor) { dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); + ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, + (JDIMENSION) compptr->v_samp_factor, TRUE); for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { - for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; - dst_blk_x += compptr->h_samp_factor) { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - comp_width - x_crop_blocks - dst_blk_x - - (JDIMENSION) compptr->h_samp_factor, - (JDIMENSION) compptr->h_samp_factor, FALSE); - } else { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_x + x_crop_blocks, - (JDIMENSION) compptr->h_samp_factor, FALSE); - } - for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { - dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; - if (y_crop_blocks + dst_blk_y < comp_height) { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Block is within the mirrorable area. */ - src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] - [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - i++; - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } else { - /* Right-edge blocks are mirrored in y only */ - src_ptr = src_buffer[offset_x] - [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) { - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - j++; - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } - } - } else { - if (x_crop_blocks + dst_blk_x < comp_width) { - /* Bottom-edge blocks are mirrored in x only */ - src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] - [dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - i++; - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; - } - } else { - /* At lower right corner, just transpose, no mirroring */ - src_ptr = src_buffer[offset_x] - [dst_blk_y + offset_y + y_crop_blocks]; - for (i = 0; i < DCTSIZE; i++) - for (j = 0; j < DCTSIZE; j++) - dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; - } - } - } - } + for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; + dst_blk_x += compptr->h_samp_factor) { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + comp_width - x_crop_blocks - dst_blk_x - + (JDIMENSION) compptr->h_samp_factor, + (JDIMENSION) compptr->h_samp_factor, FALSE); + } else { + src_buffer = (*srcinfo->mem->access_virt_barray) + ((j_common_ptr) srcinfo, src_coef_arrays[ci], + dst_blk_x + x_crop_blocks, + (JDIMENSION) compptr->h_samp_factor, FALSE); + } + for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) { + dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x]; + if (y_crop_blocks + dst_blk_y < comp_height) { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Block is within the mirrorable area. */ + src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] + [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + i++; + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } else { + /* Right-edge blocks are mirrored in y only */ + src_ptr = src_buffer[offset_x] + [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) { + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + j++; + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } + } + } else { + if (x_crop_blocks + dst_blk_x < comp_width) { + /* Bottom-edge blocks are mirrored in x only */ + src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1] + [dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) { + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + i++; + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = -src_ptr[i*DCTSIZE+j]; + } + } else { + /* At lower right corner, just transpose, no mirroring */ + src_ptr = src_buffer[offset_x] + [dst_blk_y + offset_y + y_crop_blocks]; + for (i = 0; i < DCTSIZE; i++) + for (j = 0; j < DCTSIZE; j++) + dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j]; + } + } + } + } } } } @@ -773,7 +773,7 @@ jt_read_integer (const char ** strptr, JDIMENSION * result) } *result = val; if (ptr == *strptr) - return FALSE; /* oops, no digits */ + return FALSE; /* oops, no digits */ *strptr = ptr; return TRUE; } @@ -783,7 +783,7 @@ jt_read_integer (const char ** strptr, JDIMENSION * result) * The routine returns TRUE if the spec string is valid, FALSE if not. * * The crop spec string should have the format - * [f]x[f]{+-}{+-} + * [f]x[f]{+-}{+-} * where width, height, xoffset, and yoffset are unsigned integers. * Each of the elements can be omitted to indicate a default value. * (A weakness of this style is that it is not possible to omit xoffset @@ -888,7 +888,7 @@ trim_bottom_edge (jpeg_transform_info *info, JDIMENSION full_height) GLOBAL(boolean) jtransform_request_workspace (j_decompress_ptr srcinfo, - jpeg_transform_info *info) + jpeg_transform_info *info) { jvirt_barray_ptr *coef_arrays; boolean need_workspace, transpose_it; @@ -921,18 +921,18 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, if (info->perfect) { if (info->num_components == 1) { if (!jtransform_perfect_transform(srcinfo->output_width, - srcinfo->output_height, - srcinfo->_min_DCT_h_scaled_size, - srcinfo->_min_DCT_v_scaled_size, - info->transform)) - return FALSE; + srcinfo->output_height, + srcinfo->_min_DCT_h_scaled_size, + srcinfo->_min_DCT_v_scaled_size, + info->transform)) + return FALSE; } else { if (!jtransform_perfect_transform(srcinfo->output_width, - srcinfo->output_height, - srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size, - srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size, - info->transform)) - return FALSE; + srcinfo->output_height, + srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size, + srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size, + info->transform)) + return FALSE; } } @@ -953,9 +953,9 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size; } else { info->iMCU_sample_width = - srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size; + srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size; info->iMCU_sample_height = - srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size; + srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size; } break; default: @@ -966,9 +966,9 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size; } else { info->iMCU_sample_width = - srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size; + srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size; info->iMCU_sample_height = - srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size; + srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size; } break; } @@ -979,11 +979,11 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, if (info->crop) { /* Insert default values for unset crop parameters */ if (info->crop_xoffset_set == JCROP_UNSET) - info->crop_xoffset = 0; /* default to +0 */ + info->crop_xoffset = 0; /* default to +0 */ if (info->crop_yoffset_set == JCROP_UNSET) - info->crop_yoffset = 0; /* default to +0 */ + info->crop_yoffset = 0; /* default to +0 */ if (info->crop_xoffset >= info->output_width || - info->crop_yoffset >= info->output_height) + info->crop_yoffset >= info->output_height) ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); if (info->crop_width_set == JCROP_UNSET) info->crop_width = info->output_width - info->crop_xoffset; @@ -991,9 +991,9 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, info->crop_height = info->output_height - info->crop_yoffset; /* Ensure parameters are valid */ if (info->crop_width <= 0 || info->crop_width > info->output_width || - info->crop_height <= 0 || info->crop_height > info->output_height || - info->crop_xoffset > info->output_width - info->crop_width || - info->crop_yoffset > info->output_height - info->crop_height) + info->crop_height <= 0 || info->crop_height > info->output_height || + info->crop_xoffset > info->output_width - info->crop_width || + info->crop_yoffset > info->output_height - info->crop_height) ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); /* Convert negative crop offsets into regular offsets */ if (info->crop_xoffset_set == JCROP_NEG) @@ -1093,30 +1093,30 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, if (need_workspace) { coef_arrays = (jvirt_barray_ptr *) (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, - SIZEOF(jvirt_barray_ptr) * info->num_components); + SIZEOF(jvirt_barray_ptr) * info->num_components); width_in_iMCUs = (JDIMENSION) jdiv_round_up((long) info->output_width, - (long) info->iMCU_sample_width); + (long) info->iMCU_sample_width); height_in_iMCUs = (JDIMENSION) jdiv_round_up((long) info->output_height, - (long) info->iMCU_sample_height); + (long) info->iMCU_sample_height); for (ci = 0; ci < info->num_components; ci++) { compptr = srcinfo->comp_info + ci; if (info->num_components == 1) { - /* we're going to force samp factors to 1x1 in this case */ - h_samp_factor = v_samp_factor = 1; + /* we're going to force samp factors to 1x1 in this case */ + h_samp_factor = v_samp_factor = 1; } else if (transpose_it) { - h_samp_factor = compptr->v_samp_factor; - v_samp_factor = compptr->h_samp_factor; + h_samp_factor = compptr->v_samp_factor; + v_samp_factor = compptr->h_samp_factor; } else { - h_samp_factor = compptr->h_samp_factor; - v_samp_factor = compptr->v_samp_factor; + h_samp_factor = compptr->h_samp_factor; + v_samp_factor = compptr->v_samp_factor; } width_in_blocks = width_in_iMCUs * h_samp_factor; height_in_blocks = height_in_iMCUs * v_samp_factor; coef_arrays[ci] = (*srcinfo->mem->request_virt_barray) - ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, - width_in_blocks, height_in_blocks, (JDIMENSION) v_samp_factor); + ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE, + width_in_blocks, height_in_blocks, (JDIMENSION) v_samp_factor); } info->workspace_coef_arrays = coef_arrays; } else @@ -1160,11 +1160,11 @@ transpose_critical_parameters (j_compress_ptr dstinfo) qtblptr = dstinfo->quant_tbl_ptrs[tblno]; if (qtblptr != NULL) { for (i = 0; i < DCTSIZE; i++) { - for (j = 0; j < i; j++) { - qtemp = qtblptr->quantval[i*DCTSIZE+j]; - qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i]; - qtblptr->quantval[j*DCTSIZE+i] = qtemp; - } + for (j = 0; j < i; j++) { + qtemp = qtblptr->quantval[i*DCTSIZE+j]; + qtblptr->quantval[i*DCTSIZE+j] = qtblptr->quantval[j*DCTSIZE+i]; + qtblptr->quantval[j*DCTSIZE+i] = qtemp; + } } } } @@ -1179,7 +1179,7 @@ transpose_critical_parameters (j_compress_ptr dstinfo) #if JPEG_LIB_VERSION >= 70 LOCAL(void) adjust_exif_parameters (JOCTET FAR * data, unsigned int length, - JDIMENSION new_width, JDIMENSION new_height) + JDIMENSION new_width, JDIMENSION new_height) { boolean is_motorola; /* Flag for byte order */ unsigned int number_of_tags, tagnum; @@ -1296,31 +1296,31 @@ adjust_exif_parameters (JOCTET FAR * data, unsigned int length, } if (tagnum == 0xA002 || tagnum == 0xA003) { if (tagnum == 0xA002) - new_value = new_width; /* ExifImageWidth Tag */ + new_value = new_width; /* ExifImageWidth Tag */ else - new_value = new_height; /* ExifImageHeight Tag */ + new_value = new_height; /* ExifImageHeight Tag */ if (is_motorola) { - data[offset+2] = 0; /* Format = unsigned long (4 octets) */ - data[offset+3] = 4; - data[offset+4] = 0; /* Number Of Components = 1 */ - data[offset+5] = 0; - data[offset+6] = 0; - data[offset+7] = 1; - data[offset+8] = 0; - data[offset+9] = 0; - data[offset+10] = (JOCTET)((new_value >> 8) & 0xFF); - data[offset+11] = (JOCTET)(new_value & 0xFF); + data[offset+2] = 0; /* Format = unsigned long (4 octets) */ + data[offset+3] = 4; + data[offset+4] = 0; /* Number Of Components = 1 */ + data[offset+5] = 0; + data[offset+6] = 0; + data[offset+7] = 1; + data[offset+8] = 0; + data[offset+9] = 0; + data[offset+10] = (JOCTET)((new_value >> 8) & 0xFF); + data[offset+11] = (JOCTET)(new_value & 0xFF); } else { - data[offset+2] = 4; /* Format = unsigned long (4 octets) */ - data[offset+3] = 0; - data[offset+4] = 1; /* Number Of Components = 1 */ - data[offset+5] = 0; - data[offset+6] = 0; - data[offset+7] = 0; - data[offset+8] = (JOCTET)(new_value & 0xFF); - data[offset+9] = (JOCTET)((new_value >> 8) & 0xFF); - data[offset+10] = 0; - data[offset+11] = 0; + data[offset+2] = 4; /* Format = unsigned long (4 octets) */ + data[offset+3] = 0; + data[offset+4] = 1; /* Number Of Components = 1 */ + data[offset+5] = 0; + data[offset+6] = 0; + data[offset+7] = 0; + data[offset+8] = (JOCTET)(new_value & 0xFF); + data[offset+9] = (JOCTET)((new_value >> 8) & 0xFF); + data[offset+10] = 0; + data[offset+11] = 0; } } offset += 12; @@ -1342,9 +1342,9 @@ adjust_exif_parameters (JOCTET FAR * data, unsigned int length, GLOBAL(jvirt_barray_ptr *) jtransform_adjust_parameters (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info) + j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info) { /* If force-to-grayscale is requested, adjust destination parameters */ if (info->force_grayscale) { @@ -1354,11 +1354,11 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, * isn't worth extra code space. But we check it to avoid crashing.) */ if (((dstinfo->jpeg_color_space == JCS_YCbCr && - dstinfo->num_components == 3) || - (dstinfo->jpeg_color_space == JCS_GRAYSCALE && - dstinfo->num_components == 1)) && - srcinfo->comp_info[0].h_samp_factor == srcinfo->max_h_samp_factor && - srcinfo->comp_info[0].v_samp_factor == srcinfo->max_v_samp_factor) { + dstinfo->num_components == 3) || + (dstinfo->jpeg_color_space == JCS_GRAYSCALE && + dstinfo->num_components == 1)) && + srcinfo->comp_info[0].h_samp_factor == srcinfo->max_h_samp_factor && + srcinfo->comp_info[0].v_samp_factor == srcinfo->max_v_samp_factor) { /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed * properly. Among other things, it sets the target h_samp_factor & * v_samp_factor to 1, which typically won't match the source. @@ -1423,11 +1423,11 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, #if JPEG_LIB_VERSION >= 70 /* Adjust Exif image parameters */ if (dstinfo->jpeg_width != srcinfo->image_width || - dstinfo->jpeg_height != srcinfo->image_height) + dstinfo->jpeg_height != srcinfo->image_height) /* Align data segment to start of TIFF structure for parsing */ adjust_exif_parameters(srcinfo->marker_list->data + 6, - srcinfo->marker_list->data_length - 6, - dstinfo->jpeg_width, dstinfo->jpeg_height); + srcinfo->marker_list->data_length - 6, + dstinfo->jpeg_width, dstinfo->jpeg_height); #endif } @@ -1449,9 +1449,9 @@ jtransform_adjust_parameters (j_decompress_ptr srcinfo, GLOBAL(void) jtransform_execute_transform (j_decompress_ptr srcinfo, - j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info) + j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info) { jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays; @@ -1462,39 +1462,39 @@ jtransform_execute_transform (j_decompress_ptr srcinfo, case JXFORM_NONE: if (info->x_crop_offset != 0 || info->y_crop_offset != 0) do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_FLIP_H: if (info->y_crop_offset != 0 || info->slow_hflip) do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); else do_flip_h_no_crop(srcinfo, dstinfo, info->x_crop_offset, - src_coef_arrays); + src_coef_arrays); break; case JXFORM_FLIP_V: do_flip_v(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_TRANSPOSE: do_transpose(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_TRANSVERSE: do_transverse(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_90: do_rot_90(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_180: do_rot_180(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; case JXFORM_ROT_270: do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); + src_coef_arrays, dst_coef_arrays); break; } } @@ -1522,8 +1522,8 @@ jtransform_execute_transform (j_decompress_ptr srcinfo, GLOBAL(boolean) jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height, - int MCU_width, int MCU_height, - JXFORM_CODE transform) + int MCU_width, int MCU_height, + JXFORM_CODE transform) { boolean result = TRUE; /* initialize TRUE */ @@ -1586,7 +1586,7 @@ jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option) GLOBAL(void) jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JCOPY_OPTION option) + JCOPY_OPTION option) { jpeg_saved_marker_ptr marker; @@ -1597,34 +1597,34 @@ jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, */ for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) { if (dstinfo->write_JFIF_header && - marker->marker == JPEG_APP0 && - marker->data_length >= 5 && - GETJOCTET(marker->data[0]) == 0x4A && - GETJOCTET(marker->data[1]) == 0x46 && - GETJOCTET(marker->data[2]) == 0x49 && - GETJOCTET(marker->data[3]) == 0x46 && - GETJOCTET(marker->data[4]) == 0) - continue; /* reject duplicate JFIF */ + marker->marker == JPEG_APP0 && + marker->data_length >= 5 && + GETJOCTET(marker->data[0]) == 0x4A && + GETJOCTET(marker->data[1]) == 0x46 && + GETJOCTET(marker->data[2]) == 0x49 && + GETJOCTET(marker->data[3]) == 0x46 && + GETJOCTET(marker->data[4]) == 0) + continue; /* reject duplicate JFIF */ if (dstinfo->write_Adobe_marker && - marker->marker == JPEG_APP0+14 && - marker->data_length >= 5 && - GETJOCTET(marker->data[0]) == 0x41 && - GETJOCTET(marker->data[1]) == 0x64 && - GETJOCTET(marker->data[2]) == 0x6F && - GETJOCTET(marker->data[3]) == 0x62 && - GETJOCTET(marker->data[4]) == 0x65) - continue; /* reject duplicate Adobe */ + marker->marker == JPEG_APP0+14 && + marker->data_length >= 5 && + GETJOCTET(marker->data[0]) == 0x41 && + GETJOCTET(marker->data[1]) == 0x64 && + GETJOCTET(marker->data[2]) == 0x6F && + GETJOCTET(marker->data[3]) == 0x62 && + GETJOCTET(marker->data[4]) == 0x65) + continue; /* reject duplicate Adobe */ #ifdef NEED_FAR_POINTERS /* We could use jpeg_write_marker if the data weren't FAR... */ { unsigned int i; jpeg_write_m_header(dstinfo, marker->marker, marker->data_length); for (i = 0; i < marker->data_length; i++) - jpeg_write_m_byte(dstinfo, marker->data[i]); + jpeg_write_m_byte(dstinfo, marker->data[i]); } #else jpeg_write_marker(dstinfo, marker->marker, - marker->data, marker->data_length); + marker->data, marker->data_length); #endif } } diff --git a/transupp.h b/transupp.h index cfbaca40..710b345b 100644 --- a/transupp.h +++ b/transupp.h @@ -19,7 +19,7 @@ /* If you happen not to want the image transform support, disable it here */ #ifndef TRANSFORMS_SUPPORTED -#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ +#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ #endif /* @@ -80,13 +80,13 @@ /* Short forms of external names for systems with brain-damaged linkers. */ #ifdef NEED_SHORT_EXTERNAL_NAMES -#define jtransform_parse_crop_spec jTrParCrop -#define jtransform_request_workspace jTrRequest -#define jtransform_adjust_parameters jTrAdjust -#define jtransform_execute_transform jTrExec -#define jtransform_perfect_transform jTrPerfect -#define jcopy_markers_setup jCMrkSetup -#define jcopy_markers_execute jCMrkExec +#define jtransform_parse_crop_spec jTrParCrop +#define jtransform_request_workspace jTrRequest +#define jtransform_adjust_parameters jTrAdjust +#define jtransform_execute_transform jTrExec +#define jtransform_perfect_transform jTrPerfect +#define jcopy_markers_setup jCMrkSetup +#define jcopy_markers_execute jCMrkExec #endif /* NEED_SHORT_EXTERNAL_NAMES */ @@ -95,14 +95,14 @@ */ typedef enum { - JXFORM_NONE, /* no transformation */ - JXFORM_FLIP_H, /* horizontal flip */ - JXFORM_FLIP_V, /* vertical flip */ - JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ - JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ - JXFORM_ROT_90, /* 90-degree clockwise rotation */ - JXFORM_ROT_180, /* 180-degree rotation */ - JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ + JXFORM_NONE, /* no transformation */ + JXFORM_FLIP_H, /* horizontal flip */ + JXFORM_FLIP_V, /* vertical flip */ + JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ + JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ + JXFORM_ROT_90, /* 90-degree clockwise rotation */ + JXFORM_ROT_180, /* 180-degree rotation */ + JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ } JXFORM_CODE; /* @@ -126,11 +126,11 @@ typedef enum { typedef struct { /* Options: set by caller */ - JXFORM_CODE transform; /* image transform operator */ - boolean perfect; /* if TRUE, fail if partial MCUs are requested */ - boolean trim; /* if TRUE, trim partial MCUs as needed */ - boolean force_grayscale; /* if TRUE, convert color image to grayscale */ - boolean crop; /* if TRUE, crop source image */ + JXFORM_CODE transform; /* image transform operator */ + boolean perfect; /* if TRUE, fail if partial MCUs are requested */ + boolean trim; /* if TRUE, trim partial MCUs as needed */ + boolean force_grayscale; /* if TRUE, convert color image to grayscale */ + boolean crop; /* if TRUE, crop source image */ boolean slow_hflip; /* For best performance, the JXFORM_FLIP_H transform normally modifies the source coefficients in place. Setting this to TRUE will instead use a slower, @@ -142,23 +142,23 @@ typedef struct { /* Crop parameters: application need not set these unless crop is TRUE. * These can be filled in by jtransform_parse_crop_spec(). */ - JDIMENSION crop_width; /* Width of selected region */ - JCROP_CODE crop_width_set; /* (forced disables adjustment) */ - JDIMENSION crop_height; /* Height of selected region */ - JCROP_CODE crop_height_set; /* (forced disables adjustment) */ - JDIMENSION crop_xoffset; /* X offset of selected region */ - JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */ - JDIMENSION crop_yoffset; /* Y offset of selected region */ - JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */ + JDIMENSION crop_width; /* Width of selected region */ + JCROP_CODE crop_width_set; /* (forced disables adjustment) */ + JDIMENSION crop_height; /* Height of selected region */ + JCROP_CODE crop_height_set; /* (forced disables adjustment) */ + JDIMENSION crop_xoffset; /* X offset of selected region */ + JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */ + JDIMENSION crop_yoffset; /* Y offset of selected region */ + JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */ /* Internal workspace: caller should not touch these */ - int num_components; /* # of components in workspace */ + int num_components; /* # of components in workspace */ jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ - JDIMENSION output_width; /* cropped destination dimensions */ + JDIMENSION output_width; /* cropped destination dimensions */ JDIMENSION output_height; - JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */ + JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */ JDIMENSION y_crop_offset; - int iMCU_sample_width; /* destination iMCU size */ + int iMCU_sample_width; /* destination iMCU size */ int iMCU_sample_height; } jpeg_transform_info; @@ -167,34 +167,34 @@ typedef struct { /* Parse a crop specification (written in X11 geometry style) */ EXTERN(boolean) jtransform_parse_crop_spec - JPP((jpeg_transform_info *info, const char *spec)); + JPP((jpeg_transform_info *info, const char *spec)); /* Request any required workspace */ EXTERN(boolean) jtransform_request_workspace - JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); + JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); /* Adjust output image parameters */ EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info)); /* Execute the actual transformation, if any */ EXTERN(void) jtransform_execute_transform - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, + jpeg_transform_info *info)); /* Determine whether lossless transformation is perfectly * possible for a specified image and transformation. */ EXTERN(boolean) jtransform_perfect_transform - JPP((JDIMENSION image_width, JDIMENSION image_height, - int MCU_width, int MCU_height, - JXFORM_CODE transform)); + JPP((JDIMENSION image_width, JDIMENSION image_height, + int MCU_width, int MCU_height, + JXFORM_CODE transform)); /* jtransform_execute_transform used to be called * jtransform_execute_transformation, but some compilers complain about * routine names that long. This macro is here to avoid breaking any * old source code that uses the original name... */ -#define jtransform_execute_transformation jtransform_execute_transform +#define jtransform_execute_transformation jtransform_execute_transform #endif /* TRANSFORMS_SUPPORTED */ @@ -204,17 +204,17 @@ EXTERN(boolean) jtransform_perfect_transform */ typedef enum { - JCOPYOPT_NONE, /* copy no optional markers */ - JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ - JCOPYOPT_ALL /* copy all optional markers */ + JCOPYOPT_NONE, /* copy no optional markers */ + JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ + JCOPYOPT_ALL /* copy all optional markers */ } JCOPY_OPTION; -#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ +#define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ /* Setup decompression object to save desired markers in memory */ EXTERN(void) jcopy_markers_setup - JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); + JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); /* Copy markers saved in the given source object to the destination object */ EXTERN(void) jcopy_markers_execute - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JCOPY_OPTION option)); + JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + JCOPY_OPTION option)); diff --git a/usage.txt b/usage.txt index 775a5440..14ab77b2 100644 --- a/usage.txt +++ b/usage.txt @@ -26,27 +26,27 @@ We provide two programs, cjpeg to compress an image file into JPEG format, and djpeg to decompress a JPEG file back into a conventional image format. On Unix-like systems, you say: - cjpeg [switches] [imagefile] >jpegfile + cjpeg [switches] [imagefile] >jpegfile or - djpeg [switches] [jpegfile] >imagefile + djpeg [switches] [jpegfile] >imagefile The programs read the specified input file, or standard input if none is named. They always write to standard output (with trace/error messages to standard error). These conventions are handy for piping images between programs. On most non-Unix systems, you say: - cjpeg [switches] imagefile jpegfile + cjpeg [switches] imagefile jpegfile or - djpeg [switches] jpegfile imagefile + djpeg [switches] jpegfile imagefile i.e., both the input and output files are named on the command line. This style is a little more foolproof, and it loses no functionality if you don't have pipes. (You can get this style on Unix too, if you prefer, by defining TWO_FILE_COMMANDLINE when you compile the programs; see install.txt.) You can also say: - cjpeg [switches] -outfile jpegfile imagefile + cjpeg [switches] -outfile jpegfile imagefile or - djpeg [switches] -outfile imagefile jpegfile + djpeg [switches] -outfile imagefile jpegfile This syntax works on all systems, so it is useful for scripts. The currently supported image file formats are: PPM (PBMPLUS color format), @@ -69,35 +69,35 @@ CJPEG DETAILS The basic command line switches for cjpeg are: - -quality N[,...] Scale quantization tables to adjust image quality. - Quality is 0 (worst) to 100 (best); default is 75. - (See below for more info.) + -quality N[,...] Scale quantization tables to adjust image quality. + Quality is 0 (worst) to 100 (best); default is 75. + (See below for more info.) - -grayscale Create monochrome JPEG file from color input. - Be sure to use this switch when compressing a grayscale - BMP file, because cjpeg isn't bright enough to notice - whether a BMP file uses only shades of gray. By - saying -grayscale, you'll get a smaller JPEG file that - takes less time to process. + -grayscale Create monochrome JPEG file from color input. + Be sure to use this switch when compressing a grayscale + BMP file, because cjpeg isn't bright enough to notice + whether a BMP file uses only shades of gray. By + saying -grayscale, you'll get a smaller JPEG file that + takes less time to process. - -rgb Create RGB JPEG file. - Using this switch suppresses the conversion from RGB - colorspace input to the default YCbCr JPEG colorspace. + -rgb Create RGB JPEG file. + Using this switch suppresses the conversion from RGB + colorspace input to the default YCbCr JPEG colorspace. - -optimize Perform optimization of entropy encoding parameters. - Without this, default encoding parameters are used. - -optimize usually makes the JPEG file a little smaller, - but cjpeg runs somewhat slower and needs much more - memory. Image quality and speed of decompression are - unaffected by -optimize. + -optimize Perform optimization of entropy encoding parameters. + Without this, default encoding parameters are used. + -optimize usually makes the JPEG file a little smaller, + but cjpeg runs somewhat slower and needs much more + memory. Image quality and speed of decompression are + unaffected by -optimize. - -progressive Create progressive JPEG file (see below). + -progressive Create progressive JPEG file (see below). - -targa Input file is Targa format. Targa files that contain - an "identification" field will not be automatically - recognized by cjpeg; for such files you must specify - -targa to make cjpeg treat the input as Targa format. - For most Targa files, you won't need this switch. + -targa Input file is Targa format. Targa files that contain + an "identification" field will not be automatically + recognized by cjpeg; for such files you must specify + -targa to make cjpeg treat the input as Targa format. + For most Targa files, you won't need this switch. The -quality switch lets you trade off compressed file size against quality of the reconstructed image: the higher the quality setting, the larger the JPEG @@ -164,38 +164,38 @@ file size is about the same --- often a little smaller. Switches for advanced users: - -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG - is not yet widely implemented, so many decoders will - be unable to view an arithmetic coded JPEG file at - all. + -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG + is not yet widely implemented, so many decoders will + be unable to view an arithmetic coded JPEG file at + all. - -dct int Use integer DCT method (default). - -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. + -dct int Use integer DCT method (default). + -dct fast Use fast integer DCT (less accurate). + -dct float Use floating-point DCT method. + The float method is very slightly more accurate than + the int method, but is much slower unless your machine + has very fast floating-point hardware. Also note that + results of the floating-point method may vary slightly + across machines, while the integer methods should give + the same results everywhere. The fast integer method + is much less accurate than the other two. - -restart N Emit a JPEG restart marker every N MCU rows, or every - N MCU blocks if "B" is attached to the number. - -restart 0 (the default) means no restart markers. + -restart N Emit a JPEG restart marker every N MCU rows, or every + N MCU blocks if "B" is attached to the number. + -restart 0 (the default) means no restart markers. - -smooth N Smooth the input image to eliminate dithering noise. - N, ranging from 1 to 100, indicates the strength of - smoothing. 0 (the default) means no smoothing. + -smooth N Smooth the input image to eliminate dithering noise. + N, ranging from 1 to 100, indicates the strength of + smoothing. 0 (the default) means no smoothing. - -maxmemory N Set limit for amount of memory to use in processing - large images. Value is in thousands of bytes, or - millions of bytes if "M" is attached to the number. - For example, -max 4m selects 4000000 bytes. If more - space is needed, temporary files will be used. + -maxmemory N Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -max 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. - -verbose Enable debug printout. More -v's give more printout. - or -debug Also, version information is printed at startup. + -verbose Enable debug printout. More -v's give more printout. + or -debug Also, version information is printed at startup. The -restart option inserts extra markers that allow a JPEG decoder to resynchronize after a transmission error. Without restart markers, any damage @@ -213,22 +213,22 @@ factor will visibly blur the image, however. Switches for wizards: - -baseline Force baseline-compatible quantization tables to be - generated. This clamps quantization values to 8 bits - even at low quality settings. (This switch is poorly - named, since it does not ensure that the output is - actually baseline JPEG. For example, you can use - -baseline and -progressive together.) + -baseline Force baseline-compatible quantization tables to be + generated. This clamps quantization values to 8 bits + even at low quality settings. (This switch is poorly + named, since it does not ensure that the output is + actually baseline JPEG. For example, you can use + -baseline and -progressive together.) - -qtables file Use the quantization tables given in the specified - text file. + -qtables file Use the quantization tables given in the specified + text file. - -qslots N[,...] Select which quantization table to use for each color - component. + -qslots N[,...] Select which quantization table to use for each color + component. - -sample HxV[,...] Set JPEG sampling factors for each color component. + -sample HxV[,...] Set JPEG sampling factors for each color component. - -scans file Use the scan script given in the specified text file. + -scans file Use the scan script given in the specified text file. The "wizard" switches are intended for experimentation with JPEG. If you don't know what you are doing, DON'T USE THEM. These switches are documented @@ -239,106 +239,106 @@ DJPEG DETAILS The basic command line switches for djpeg are: - -colors N Reduce image to at most N colors. This reduces the - or -quantize N number of colors used in the output image, so that it - can be displayed on a colormapped display or stored in - a colormapped file format. For example, if you have - an 8-bit display, you'd need to reduce to 256 or fewer - colors. (-colors is the recommended name, -quantize - is provided only for backwards compatibility.) + -colors N Reduce image to at most N colors. This reduces the + or -quantize N number of colors used in the output image, so that it + can be displayed on a colormapped display or stored in + a colormapped file format. For example, if you have + an 8-bit display, you'd need to reduce to 256 or fewer + colors. (-colors is the recommended name, -quantize + is provided only for backwards compatibility.) - -fast Select recommended processing options for fast, low - quality output. (The default options are chosen for - highest quality output.) Currently, this is equivalent - to "-dct fast -nosmooth -onepass -dither ordered". + -fast Select recommended processing options for fast, low + quality output. (The default options are chosen for + highest quality output.) Currently, this is equivalent + to "-dct fast -nosmooth -onepass -dither ordered". - -grayscale Force gray-scale output even if JPEG file is color. - Useful for viewing on monochrome displays; also, - djpeg runs noticeably faster in this mode. + -grayscale Force gray-scale output even if JPEG file is color. + Useful for viewing on monochrome displays; also, + djpeg runs noticeably faster in this mode. - -scale M/N Scale the output image by a factor M/N. Currently - the scale factor must be M/8, where M is an integer - between 1 and 16 inclusive, or any reduced fraction - thereof (such as 1/2, 3/4, etc. Scaling is handy if - the image is larger than your screen; also, djpeg runs - much faster when scaling down the output. + -scale M/N Scale the output image by a factor M/N. Currently + the scale factor must be M/8, where M is an integer + between 1 and 16 inclusive, or any reduced fraction + thereof (such as 1/2, 3/4, etc. Scaling is handy if + the image is larger than your screen; also, djpeg runs + much faster when scaling down the output. - -bmp Select BMP output format (Windows flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; - otherwise, 24-bit full-color format is emitted. + -bmp Select BMP output format (Windows flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is gray-scale; + otherwise, 24-bit full-color format is emitted. - -gif Select GIF output format. Since GIF does not support - more than 256 colors, -colors 256 is assumed (unless - you specify a smaller number of colors). If you - specify -fast, the default number of colors is 216. + -gif Select GIF output format. Since GIF does not support + more than 256 colors, -colors 256 is assumed (unless + you specify a smaller number of colors). If you + specify -fast, the default number of colors is 216. - -os2 Select BMP output format (OS/2 1.x flavor). 8-bit - colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; - otherwise, 24-bit full-color format is emitted. + -os2 Select BMP output format (OS/2 1.x flavor). 8-bit + colormapped format is emitted if -colors or -grayscale + is specified, or if the JPEG file is gray-scale; + otherwise, 24-bit full-color format is emitted. - -pnm Select PBMPLUS (PPM/PGM) output format (this is the - default format). PGM is emitted if the JPEG file is - gray-scale or if -grayscale is specified; otherwise - PPM is emitted. + -pnm Select PBMPLUS (PPM/PGM) output format (this is the + default format). PGM is emitted if the JPEG file is + gray-scale or if -grayscale is specified; otherwise + PPM is emitted. - -rle Select RLE output format. (Requires URT library.) + -rle Select RLE output format. (Requires URT library.) - -targa Select Targa output format. Gray-scale format is - emitted if the JPEG file is gray-scale or if - -grayscale is specified; otherwise, colormapped format - is emitted if -colors is specified; otherwise, 24-bit - full-color format is emitted. + -targa Select Targa output format. Gray-scale format is + emitted if the JPEG file is gray-scale or if + -grayscale is specified; otherwise, colormapped format + is emitted if -colors is specified; otherwise, 24-bit + full-color format is emitted. Switches for advanced users: - -dct int Use integer DCT method (default). - -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. + -dct int Use integer DCT method (default). + -dct fast Use fast integer DCT (less accurate). + -dct float Use floating-point DCT method. + The float method is very slightly more accurate than + the int method, but is much slower unless your machine + has very fast floating-point hardware. Also note that + results of the floating-point method may vary slightly + across machines, while the integer methods should give + the same results everywhere. The fast integer method + is much less accurate than the other two. - -dither fs Use Floyd-Steinberg dithering in color quantization. - -dither ordered Use ordered dithering in color quantization. - -dither none Do not use dithering in color quantization. - By default, Floyd-Steinberg dithering is applied when - quantizing colors; this is slow but usually produces - the best results. Ordered dither is a compromise - between speed and quality; no dithering is fast but - usually looks awful. Note that these switches have - no effect unless color quantization is being done. - Ordered dither is only available in -onepass mode. + -dither fs Use Floyd-Steinberg dithering in color quantization. + -dither ordered Use ordered dithering in color quantization. + -dither none Do not use dithering in color quantization. + By default, Floyd-Steinberg dithering is applied when + quantizing colors; this is slow but usually produces + the best results. Ordered dither is a compromise + between speed and quality; no dithering is fast but + usually looks awful. Note that these switches have + no effect unless color quantization is being done. + Ordered dither is only available in -onepass mode. - -map FILE Quantize to the colors used in the specified image - file. This is useful for producing multiple files - with identical color maps, or for forcing a predefined - set of colors to be used. The FILE must be a GIF - or PPM file. This option overrides -colors and - -onepass. + -map FILE Quantize to the colors used in the specified image + file. This is useful for producing multiple files + with identical color maps, or for forcing a predefined + set of colors to be used. The FILE must be a GIF + or PPM file. This option overrides -colors and + -onepass. - -nosmooth Use a faster, lower-quality upsampling routine. + -nosmooth Use a faster, lower-quality upsampling routine. - -onepass Use one-pass instead of two-pass color quantization. - The one-pass method is faster and needs less memory, - but it produces a lower-quality image. -onepass is - ignored unless you also say -colors N. Also, - the one-pass method is always used for gray-scale - output (the two-pass method is no improvement then). + -onepass Use one-pass instead of two-pass color quantization. + The one-pass method is faster and needs less memory, + but it produces a lower-quality image. -onepass is + ignored unless you also say -colors N. Also, + the one-pass method is always used for gray-scale + output (the two-pass method is no improvement then). - -maxmemory N Set limit for amount of memory to use in processing - large images. Value is in thousands of bytes, or - millions of bytes if "M" is attached to the number. - For example, -max 4m selects 4000000 bytes. If more - space is needed, temporary files will be used. + -maxmemory N Set limit for amount of memory to use in processing + large images. Value is in thousands of bytes, or + millions of bytes if "M" is attached to the number. + For example, -max 4m selects 4000000 bytes. If more + space is needed, temporary files will be used. - -verbose Enable debug printout. More -v's give more printout. - or -debug Also, version information is printed at startup. + -verbose Enable debug printout. More -v's give more printout. + or -debug Also, version information is printed at startup. HINTS FOR CJPEG @@ -446,31 +446,31 @@ quality. jpegtran uses a command line syntax similar to cjpeg or djpeg. On Unix-like systems, you say: - jpegtran [switches] [inputfile] >outputfile + jpegtran [switches] [inputfile] >outputfile On most non-Unix systems, you say: - jpegtran [switches] inputfile outputfile + jpegtran [switches] inputfile outputfile where both the input and output files are JPEG files. To specify the coded JPEG representation used in the output file, jpegtran accepts a subset of the switches recognized by cjpeg: - -optimize Perform optimization of entropy encoding parameters. - -progressive Create progressive JPEG file. - -arithmetic Use arithmetic coding. - -restart N Emit a JPEG restart marker every N MCU rows, or every - N MCU blocks if "B" is attached to the number. - -scans file Use the scan script given in the specified text file. + -optimize Perform optimization of entropy encoding parameters. + -progressive Create progressive JPEG file. + -arithmetic Use arithmetic coding. + -restart N Emit a JPEG restart marker every N MCU rows, or every + N MCU blocks if "B" is attached to the number. + -scans file Use the scan script given in the specified text file. See the previous discussion of cjpeg for more details about these switches. If you specify none of these switches, you get a plain baseline-JPEG output file. The quality setting and so forth are determined by the input file. The image can be losslessly transformed by giving one of these switches: - -flip horizontal Mirror image horizontally (left-right). - -flip vertical Mirror image vertically (top-bottom). - -rotate 90 Rotate image 90 degrees clockwise. - -rotate 180 Rotate image 180 degrees. - -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw). - -transpose Transpose image (across UL-to-LR axis). - -transverse Transverse transpose (across UR-to-LL axis). + -flip horizontal Mirror image horizontally (left-right). + -flip vertical Mirror image vertically (top-bottom). + -rotate 90 Rotate image 90 degrees clockwise. + -rotate 180 Rotate image 180 degrees. + -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw). + -transpose Transpose image (across UL-to-LR axis). + -transverse Transverse transpose (across UR-to-LL axis). The transpose transformation has no restrictions regarding image dimensions. The other transformations operate rather oddly if the image dimensions are not @@ -491,7 +491,7 @@ transpose-and-flip sequence. For practical use, you may prefer to discard any untransformable edge pixels rather than having a strange-looking strip along the right and/or bottom edges of a transformed image. To do this, add the -trim switch: - -trim Drop non-transformable edge blocks. + -trim Drop non-transformable edge blocks. Obviously, a transformation with -trim is not reversible, so strictly speaking jpegtran with this switch is not lossless. Also, the expected mathematical equivalences between the transformations no longer hold. For example, @@ -499,8 +499,8 @@ equivalences between the transformations no longer hold. For example, "-rot 180 -trim" trims both edges. If you are only interested in perfect transformations, add the -perfect switch: - -perfect Fail with an error if the transformation is not - perfect. + -perfect Fail with an error if the transformation is not + perfect. For example, you may want to do jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg to do a perfect rotation, if available, or an approximated one if not. @@ -513,12 +513,12 @@ boundary. If it doesn't, then it is silently moved up and/or left to the nearest iMCU boundary (the lower right corner is unchanged.) The image can be losslessly cropped by giving the switch: - -crop WxH+X+Y Crop to a rectangular region of width W and height H, - starting at point X,Y. + -crop WxH+X+Y Crop to a rectangular region of width W and height H, + starting at point X,Y. Other not-strictly-lossless transformation switches are: - -grayscale Force grayscale output. + -grayscale Force grayscale output. This option discards the chrominance channels if the input image is YCbCr (ie, a standard color JPEG), resulting in a grayscale JPEG file. The luminance channel is preserved exactly, so this is a better method of reducing @@ -530,24 +530,24 @@ a grayscale JPEG is substantially less than that for a color JPEG.) jpegtran also recognizes these switches that control what to do with "extra" markers, such as comment blocks: - -copy none Copy no extra markers from source file. This setting - suppresses all comments and other excess baggage - present in the source file. - -copy comments Copy only comment markers. This setting copies - comments from the source file but discards - any other data that is inessential for image display. - -copy all Copy all extra markers. This setting preserves - miscellaneous markers found in the source file, such - as JFIF thumbnails, Exif data, and Photoshop settings. - In some files, these extra markers can be sizable. + -copy none Copy no extra markers from source file. This setting + suppresses all comments and other excess baggage + present in the source file. + -copy comments Copy only comment markers. This setting copies + comments from the source file but discards + any other data that is inessential for image display. + -copy all Copy all extra markers. This setting preserves + miscellaneous markers found in the source file, such + as JFIF thumbnails, Exif data, and Photoshop settings. + In some files, these extra markers can be sizable. The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, jpegtran always did the equivalent of -copy none.) Additional switches recognized by jpegtran are: - -outfile filename - -maxmemory N - -verbose - -debug + -outfile filename + -maxmemory N + -verbose + -debug These work the same as in cjpeg or djpeg. @@ -566,7 +566,7 @@ blocks to a JPEG file. rdjpgcom searches a JPEG file and prints the contents of any COM blocks on standard output. The command line syntax is - rdjpgcom [-raw] [-verbose] [inputfilename] + rdjpgcom [-raw] [-verbose] [inputfilename] The switch "-raw" (or just "-r") causes rdjpgcom to output non-printable characters in JPEG comments. These characters are normally escaped for security reasons. @@ -584,18 +584,18 @@ just destroy your file. The command line syntax for wrjpgcom is similar to cjpeg's. On Unix-like systems, it is - wrjpgcom [switches] [inputfilename] + wrjpgcom [switches] [inputfilename] The output file is written to standard output. The input file comes from the named file, or from standard input if no input file is named. On most non-Unix systems, the syntax is - wrjpgcom [switches] inputfilename outputfilename + wrjpgcom [switches] inputfilename outputfilename where both input and output file names must be given explicitly. wrjpgcom understands three switches: - -replace Delete any existing COM blocks from the file. - -comment "Comment text" Supply new COM text on command line. - -cfile name Read text for new COM block from named file. + -replace Delete any existing COM blocks from the file. + -comment "Comment text" Supply new COM text on command line. + -cfile name Read text for new COM block from named file. (Switch names can be abbreviated.) If you have only one line of comment text to add, you can provide it on the command line with -comment. The comment text must be surrounded with quotes so that it is treated as a single diff --git a/wizard.txt b/wizard.txt index 54170b22..ede721e7 100644 --- a/wizard.txt +++ b/wizard.txt @@ -30,7 +30,7 @@ size, since more bits than necessary are expended on higher AC coefficients. You can substitute a different set of quantization values by using the -qtables switch: - -qtables file Use the quantization tables given in the named file. + -qtables file Use the quantization tables given in the named file. The specified file should be a text file containing decimal quantization values. The file should contain one to four tables, each of 64 elements. @@ -43,27 +43,27 @@ appear between numbers. Also, comments can be included: a comment starts with '#' and extends to the end of the line. Here is an example file that duplicates the default quantization tables: - # Quantization tables given in JPEG spec, section K.1 + # Quantization tables given in JPEG spec, section K.1 - # This is table 0 (the luminance table): - 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 + # This is table 0 (the luminance table): + 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 - # This is table 1 (the chrominance table): - 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 + # This is table 1 (the chrominance table): + 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 If the -qtables switch is used without -quality, then the specified tables are used exactly as-is. If both -qtables and -quality are used, then the @@ -75,8 +75,8 @@ By default, cjpeg will use quantization table 0 for luminance components and table 1 for chrominance components. To override this choice, use the -qslots switch: - -qslots N[,...] Select which quantization table to use for - each color component. + -qslots N[,...] Select which quantization table to use for + each color component. The -qslots switch specifies a quantization table number for each color component, in the order in which the components appear in the JPEG SOF marker. @@ -93,8 +93,8 @@ By default, cjpeg uses 2:1 horizontal and vertical downsampling when compressing YCbCr data, and no downsampling for all other color spaces. You can override this default with the -sample switch: - -sample HxV[,...] Set JPEG sampling factors for each color - component. + -sample HxV[,...] Set JPEG sampling factors for each color + component. The -sample switch specifies the JPEG sampling factors for each color component, in the order in which they appear in the JPEG SOF marker. @@ -119,7 +119,7 @@ of progression parameters. You can create multiple-scan sequential JPEG files or progressive JPEG files with custom progression parameters by using the -scans switch: - -scans file Use the scan sequence given in the named file. + -scans file Use the scan sequence given in the named file. The specified file should be a text file containing a "scan script". The script specifies the contents and ordering of the scans to be emitted. @@ -138,10 +138,10 @@ indexes are not the "component ID" codes assigned to the components, just positional indexes.) 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 + 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 @@ -156,52 +156,52 @@ comment starts with '#' and extends to the end of the line. For additional legibility, commas or dashes can be placed between values. (Actually, any single punctuation character other than ':' or ';' can be inserted.) For example, the following two scan definitions are equivalent: - 0 1 2: 0 63 0 0; - 0,1,2 : 0-63, 0,0 ; + 0 1 2: 0 63 0 0; + 0,1,2 : 0-63, 0,0 ; Here is an example of a scan script that generates a partially interleaved sequential JPEG file: - 0; # Y only in first scan - 1 2; # Cb and Cr in second scan + 0; # Y only in first scan + 1 2; # Cb and Cr in second scan Here is an example of a progressive scan script using only spectral selection (no successive approximation): - # Interleaved DC scan for Y,Cb,Cr: - 0,1,2: 0-0, 0, 0 ; - # AC scans: - 0: 1-2, 0, 0 ; # First two Y AC coefficients - 0: 3-5, 0, 0 ; # Three more - 1: 1-63, 0, 0 ; # All AC coefficients for Cb - 2: 1-63, 0, 0 ; # All AC coefficients for Cr - 0: 6-9, 0, 0 ; # More Y coefficients - 0: 10-63, 0, 0 ; # Remaining Y coefficients + # Interleaved DC scan for Y,Cb,Cr: + 0,1,2: 0-0, 0, 0 ; + # AC scans: + 0: 1-2, 0, 0 ; # First two Y AC coefficients + 0: 3-5, 0, 0 ; # Three more + 1: 1-63, 0, 0 ; # All AC coefficients for Cb + 2: 1-63, 0, 0 ; # All AC coefficients for Cr + 0: 6-9, 0, 0 ; # More Y coefficients + 0: 10-63, 0, 0 ; # Remaining Y coefficients Here is an example of a successive-approximation script. This is equivalent to the default script used by "cjpeg -progressive" for YCbCr images: - # Initial DC scan for Y,Cb,Cr (lowest bit not sent) - 0,1,2: 0-0, 0, 1 ; - # First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits: - 0: 1-5, 0, 2 ; - # Send all Cr,Cb AC coefficients, minus lowest bit: - # (chroma data is usually too small to be worth subdividing further; - # but note we send Cr first since eye is least sensitive to Cb) - 2: 1-63, 0, 1 ; - 1: 1-63, 0, 1 ; - # Send remaining Y AC coefficients, minus 2 lowest bits: - 0: 6-63, 0, 2 ; - # Send next-to-lowest bit of all Y AC coefficients: - 0: 1-63, 2, 1 ; - # At this point we've sent all but the lowest bit of all coefficients. - # Send lowest bit of DC coefficients - 0,1,2: 0-0, 1, 0 ; - # Send lowest bit of AC coefficients - 2: 1-63, 1, 0 ; - 1: 1-63, 1, 0 ; - # Y AC lowest bit scan is last; it's usually the largest scan - 0: 1-63, 1, 0 ; + # Initial DC scan for Y,Cb,Cr (lowest bit not sent) + 0,1,2: 0-0, 0, 1 ; + # First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits: + 0: 1-5, 0, 2 ; + # Send all Cr,Cb AC coefficients, minus lowest bit: + # (chroma data is usually too small to be worth subdividing further; + # but note we send Cr first since eye is least sensitive to Cb) + 2: 1-63, 0, 1 ; + 1: 1-63, 0, 1 ; + # Send remaining Y AC coefficients, minus 2 lowest bits: + 0: 6-63, 0, 2 ; + # Send next-to-lowest bit of all Y AC coefficients: + 0: 1-63, 2, 1 ; + # At this point we've sent all but the lowest bit of all coefficients. + # Send lowest bit of DC coefficients + 0,1,2: 0-0, 1, 0 ; + # Send lowest bit of AC coefficients + 2: 1-63, 1, 0 ; + 1: 1-63, 1, 0 ; + # Y AC lowest bit scan is last; it's usually the largest scan + 0: 1-63, 1, 0 ; It may be worth pointing out that this script is tuned for quality settings of around 50 to 75. For lower quality settings, you'd probably want to use diff --git a/wrbmp.c b/wrbmp.c index 3283b0f1..b8e213b2 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -17,7 +17,7 @@ * This code contributed by James Arthur Boucher. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef BMP_SUPPORTED @@ -42,15 +42,15 @@ /* Private version of data destination object */ typedef struct { - struct djpeg_dest_struct pub; /* public fields */ + struct djpeg_dest_struct pub; /* public fields */ - boolean is_os2; /* saves the OS2 format request flag */ + boolean is_os2; /* saves the OS2 format request flag */ - jvirt_sarray_ptr whole_image; /* needed to reverse row order */ - JDIMENSION data_width; /* JSAMPLEs per row */ - JDIMENSION row_width; /* physical width of one row in the BMP file */ - int pad_bytes; /* number of padding bytes needed per row */ - JDIMENSION cur_output_row; /* next row# to write to virtual array */ + jvirt_sarray_ptr whole_image; /* needed to reverse row order */ + JDIMENSION data_width; /* JSAMPLEs per row */ + JDIMENSION row_width; /* physical width of one row in the BMP file */ + int pad_bytes; /* number of padding bytes needed per row */ + JDIMENSION cur_output_row; /* next row# to write to virtual array */ } bmp_dest_struct; typedef bmp_dest_struct * bmp_dest_ptr; @@ -58,8 +58,8 @@ typedef bmp_dest_struct * bmp_dest_ptr; /* Forward declarations */ LOCAL(void) write_colormap - JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, - int map_colors, int map_entry_size)); + JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, + int map_colors, int map_entry_size)); /* @@ -69,7 +69,7 @@ LOCAL(void) write_colormap METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) /* This version is for writing 24-bit pixels */ { bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; @@ -90,7 +90,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, inptr = dest->pub.buffer[0]; outptr = image_ptr[0]; for (col = cinfo->output_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ + outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ outptr[1] = *inptr++; outptr[0] = *inptr++; outptr += 3; @@ -104,7 +104,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, METHODDEF(void) put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) /* This version is for grayscale OR quantized color output */ { bmp_dest_ptr dest = (bmp_dest_ptr) dinfo; @@ -123,7 +123,7 @@ put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, inptr = dest->pub.buffer[0]; outptr = image_ptr[0]; for (col = cinfo->output_width; col > 0; col--) { - *outptr++ = *inptr++; /* can omit GETJSAMPLE() safely */ + *outptr++ = *inptr++; /* can omit GETJSAMPLE() safely */ } /* Zero out the pad bytes. */ @@ -160,13 +160,13 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) char bmpfileheader[14]; char bmpinfoheader[40]; #define PUT_2B(array,offset,value) \ - (array[offset] = (char) ((value) & 0xFF), \ - array[offset+1] = (char) (((value) >> 8) & 0xFF)) + (array[offset] = (char) ((value) & 0xFF), \ + array[offset+1] = (char) (((value) >> 8) & 0xFF)) #define PUT_4B(array,offset,value) \ - (array[offset] = (char) ((value) & 0xFF), \ - array[offset+1] = (char) (((value) >> 8) & 0xFF), \ - array[offset+2] = (char) (((value) >> 16) & 0xFF), \ - array[offset+3] = (char) (((value) >> 24) & 0xFF)) + (array[offset] = (char) ((value) & 0xFF), \ + array[offset+1] = (char) (((value) >> 8) & 0xFF), \ + array[offset+2] = (char) (((value) >> 16) & 0xFF), \ + array[offset+3] = (char) (((value) >> 24) & 0xFF)) INT32 headersize, bfSize; int bits_per_pixel, cmap_entries; @@ -189,23 +189,23 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) /* File size */ headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */ bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; - + /* Set unused fields of header to 0 */ MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader)); /* Fill the file header */ - bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ + bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ bmpfileheader[1] = 0x4D; PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ /* we leave bfReserved1 & bfReserved2 = 0 */ PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ /* Fill the info header (Microsoft calls this a BITMAPINFOHEADER) */ - PUT_2B(bmpinfoheader, 0, 40); /* biSize */ + PUT_2B(bmpinfoheader, 0, 40); /* biSize */ PUT_4B(bmpinfoheader, 4, cinfo->output_width); /* biWidth */ PUT_4B(bmpinfoheader, 8, cinfo->output_height); /* biHeight */ - PUT_2B(bmpinfoheader, 12, 1); /* biPlanes - must be 1 */ + PUT_2B(bmpinfoheader, 12, 1); /* biPlanes - must be 1 */ PUT_2B(bmpinfoheader, 14, bits_per_pixel); /* biBitCount */ /* we leave biCompression = 0, for none */ /* we leave biSizeImage = 0; this is correct for uncompressed data */ @@ -254,23 +254,23 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) /* File size */ headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */ bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; - + /* Set unused fields of header to 0 */ MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader)); /* Fill the file header */ - bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ + bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ bmpfileheader[1] = 0x4D; PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */ /* we leave bfReserved1 & bfReserved2 = 0 */ PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */ /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */ - PUT_2B(bmpcoreheader, 0, 12); /* bcSize */ + PUT_2B(bmpcoreheader, 0, 12); /* bcSize */ PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */ PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */ - PUT_2B(bmpcoreheader, 8, 1); /* bcPlanes - must be 1 */ + PUT_2B(bmpcoreheader, 8, 1); /* bcPlanes - must be 1 */ PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */ if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14) @@ -290,7 +290,7 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) LOCAL(void) write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, - int map_colors, int map_entry_size) + int map_colors, int map_entry_size) { JSAMPARRAY colormap = cinfo->colormap; int num_colors = cinfo->actual_number_of_colors; @@ -301,20 +301,20 @@ write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, if (cinfo->out_color_components == 3) { /* Normal case with RGB colormap */ for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(colormap[2][i]), outfile); - putc(GETJSAMPLE(colormap[1][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - if (map_entry_size == 4) - putc(0, outfile); + putc(GETJSAMPLE(colormap[2][i]), outfile); + putc(GETJSAMPLE(colormap[1][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + if (map_entry_size == 4) + putc(0, outfile); } } else { /* Grayscale colormap (only happens with grayscale quantization) */ for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(colormap[0][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - putc(GETJSAMPLE(colormap[0][i]), outfile); - if (map_entry_size == 4) - putc(0, outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + putc(GETJSAMPLE(colormap[0][i]), outfile); + if (map_entry_size == 4) + putc(0, outfile); } } } else { @@ -324,10 +324,10 @@ write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest, putc(i, outfile); putc(i, outfile); if (map_entry_size == 4) - putc(0, outfile); + putc(0, outfile); } } - /* Pad colormap with zeros to ensure specified number of colormap entries */ + /* Pad colormap with zeros to ensure specified number of colormap entries */ if (i > map_colors) ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, i); for (; i < map_colors; i++) { @@ -395,7 +395,7 @@ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) /* Create module interface object, fill in method pointers */ dest = (bmp_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_dest_struct)); + SIZEOF(bmp_dest_struct)); dest->pub.start_output = start_output_bmp; dest->pub.finish_output = finish_output_bmp; dest->is_os2 = is_os2; diff --git a/wrgif.c b/wrgif.c index 5fe83283..0533f642 100644 --- a/wrgif.c +++ b/wrgif.c @@ -37,7 +37,7 @@ * CompuServe Incorporated." */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef GIF_SUPPORTED @@ -45,31 +45,31 @@ /* Private version of data destination object */ typedef struct { - struct djpeg_dest_struct pub; /* public fields */ + struct djpeg_dest_struct pub; /* public fields */ - j_decompress_ptr cinfo; /* back link saves passing separate parm */ + j_decompress_ptr cinfo; /* back link saves passing separate parm */ /* State for packing variable-width codes into a bitstream */ - int n_bits; /* current number of bits/code */ - int maxcode; /* maximum code, given n_bits */ - INT32 cur_accum; /* holds bits not yet output */ - int cur_bits; /* # of bits in cur_accum */ + int n_bits; /* current number of bits/code */ + int maxcode; /* maximum code, given n_bits */ + INT32 cur_accum; /* holds bits not yet output */ + int cur_bits; /* # of bits in cur_accum */ /* State for GIF code assignment */ - int ClearCode; /* clear code (doesn't change) */ - int EOFCode; /* EOF code (ditto) */ - int code_counter; /* counts output symbols */ + int ClearCode; /* clear code (doesn't change) */ + int EOFCode; /* EOF code (ditto) */ + int code_counter; /* counts output symbols */ /* GIF data packet construction buffer */ - int bytesinpkt; /* # of bytes in current packet */ - char packetbuf[256]; /* workspace for accumulating packet */ + int bytesinpkt; /* # of bytes in current packet */ + char packetbuf[256]; /* workspace for accumulating packet */ } gif_dest_struct; typedef gif_dest_struct * gif_dest_ptr; /* Largest value that will fit in N bits */ -#define MAXCODE(n_bits) ((1 << (n_bits)) - 1) +#define MAXCODE(n_bits) ((1 << (n_bits)) - 1) /* @@ -81,10 +81,10 @@ LOCAL(void) flush_packet (gif_dest_ptr dinfo) /* flush any accumulated data */ { - if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */ + if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */ dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++; if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt) - != (size_t) dinfo->bytesinpkt) + != (size_t) dinfo->bytesinpkt) ERREXIT(dinfo->cinfo, JERR_FILE_WRITE); dinfo->bytesinpkt = 0; } @@ -93,10 +93,10 @@ flush_packet (gif_dest_ptr dinfo) /* Add a character to current packet; flush to disk if necessary */ #define CHAR_OUT(dinfo,c) \ - { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \ - if ((dinfo)->bytesinpkt >= 255) \ - flush_packet(dinfo); \ - } + { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \ + if ((dinfo)->bytesinpkt >= 255) \ + flush_packet(dinfo); \ + } /* Routine to convert variable-width codes into a byte stream */ @@ -173,7 +173,7 @@ compress_pixel (gif_dest_ptr dinfo, int c) dinfo->code_counter++; } else { output(dinfo, dinfo->ClearCode); - dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */ + dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */ } } @@ -248,9 +248,9 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) /* Write the Logical Screen Descriptor */ put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); - FlagByte = 0x80; /* Yes, there is a global color table */ + FlagByte = 0x80; /* Yes, there is a global color table */ FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */ - FlagByte |= (BitsPerPixel-1); /* size of global color table */ + FlagByte |= (BitsPerPixel-1); /* size of global color table */ putc(FlagByte, dinfo->pub.output_file); putc(0, dinfo->pub.output_file); /* Background color index */ putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */ @@ -260,18 +260,18 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) for (i=0; i < ColorMapSize; i++) { if (i < num_colors) { if (colormap != NULL) { - if (dinfo->cinfo->out_color_space == JCS_RGB) { - /* Normal case: RGB color map */ - putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file); - putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file); - putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file); - } else { - /* Grayscale "color map": possible if quantizing grayscale image */ - put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); - } + if (dinfo->cinfo->out_color_space == JCS_RGB) { + /* Normal case: RGB color map */ + putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file); + putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file); + putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file); + } else { + /* Grayscale "color map": possible if quantizing grayscale image */ + put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); + } } else { - /* Create a gray-scale map of num_colors values, range 0..255 */ - put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); + /* Create a gray-scale map of num_colors values, range 0..255 */ + put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); } } else { /* fill out the map to a power of 2 */ @@ -280,7 +280,7 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) } /* Write image separator and Image Descriptor */ putc(',', dinfo->pub.output_file); /* separator */ - put_word(dinfo, 0); /* left/top offset */ + put_word(dinfo, 0); /* left/top offset */ put_word(dinfo, 0); put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */ put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); @@ -317,7 +317,7 @@ start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) { gif_dest_ptr dest = (gif_dest_ptr) dinfo; register JSAMPROW ptr; @@ -364,8 +364,8 @@ jinit_write_gif (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (gif_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(gif_dest_struct)); - dest->cinfo = cinfo; /* make back link for subroutines */ + SIZEOF(gif_dest_struct)); + dest->cinfo = cinfo; /* make back link for subroutines */ dest->pub.start_output = start_output_gif; dest->pub.put_pixel_rows = put_pixel_rows; dest->pub.finish_output = finish_output_gif; diff --git a/wrjpgcom.c b/wrjpgcom.c index 8c04b055..1055d862 100644 --- a/wrjpgcom.c +++ b/wrjpgcom.c @@ -11,48 +11,48 @@ * JPEG markers. */ -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jinclude.h" /* get auto-config symbols, */ +#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ +#include "jinclude.h" /* get auto-config symbols, */ -#ifndef HAVE_STDLIB_H /* should declare malloc() */ +#ifndef HAVE_STDLIB_H /* should declare malloc() */ extern void * malloc (); #endif -#include /* to declare isupper(), tolower() */ +#include /* to declare isupper(), tolower() */ #ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ +#include /* to declare setmode()'s parameter macros */ /* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ +#include /* to declare setmode() */ #endif -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ #ifdef __MWERKS__ #include /* Metrowerks needs this */ -#include /* ... and this */ +#include /* ... and this */ #endif #ifdef THINK_C -#include /* Think declares it here */ +#include /* Think declares it here */ #endif #endif -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" #endif #endif -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS #ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ #else #define EXIT_SUCCESS 0 #endif @@ -63,7 +63,7 @@ extern void * malloc (); */ #ifndef MAX_COM_LENGTH -#define MAX_COM_LENGTH 65000L /* must be <= 65533 in any case */ +#define MAX_COM_LENGTH 65000L /* must be <= 65533 in any case */ #endif @@ -72,12 +72,12 @@ extern void * malloc (); * To reuse this code in another application, you might need to change these. */ -static FILE * infile; /* input JPEG file */ +static FILE * infile; /* input JPEG file */ /* Return next input byte, or EOF if no more */ #define NEXTBYTE() getc(infile) -static FILE * outfile; /* output JPEG file */ +static FILE * outfile; /* output JPEG file */ /* Emit an output byte */ #define PUTBYTE(x) putc((x), outfile) @@ -154,11 +154,11 @@ copy_rest_of_file (void) * in this program. (See jdmarker.c for a more complete list.) */ -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ #define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ #define M_SOF6 0xC6 #define M_SOF7 0xC7 #define M_SOF9 0xC9 @@ -167,10 +167,10 @@ copy_rest_of_file (void) #define M_SOF13 0xCD #define M_SOF14 0xCE #define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_COM 0xFE /* COMment */ +#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_COM 0xFE /* COMment */ /* @@ -302,40 +302,40 @@ scan_JPEG_header (int keep_COM) /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, * treated as SOFn. C4 in particular is actually DHT. */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ + case M_SOF2: /* Progressive, Huffman */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_SOF9: /* Extended sequential, arithmetic */ + case M_SOF10: /* Progressive, arithmetic */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ return marker; - case M_SOS: /* should not see compressed data before SOF */ + case M_SOS: /* should not see compressed data before SOF */ ERREXIT("SOS without prior SOFn"); break; - case M_EOI: /* in case it's a tables-only JPEG stream */ + case M_EOI: /* in case it's a tables-only JPEG stream */ return marker; - case M_COM: /* Existing COM: conditionally discard */ + case M_COM: /* Existing COM: conditionally discard */ if (keep_COM) { - write_marker(marker); - copy_variable(); + write_marker(marker); + copy_variable(); } else { - skip_variable(); + skip_variable(); } break; - default: /* Anything else just gets copied */ + default: /* Anything else just gets copied */ write_marker(marker); - copy_variable(); /* we assume it has a parameter count... */ + copy_variable(); /* we assume it has a parameter count... */ break; } } /* end loop */ @@ -344,7 +344,7 @@ scan_JPEG_header (int keep_COM) /* Command line parsing code */ -static const char * progname; /* program name for error messages */ +static const char * progname; /* program name for error messages */ static void @@ -370,7 +370,7 @@ usage (void) fprintf(stderr, "If you do not give either -comment or -cfile on the command line,\n"); fprintf(stderr, "then the comment text is read from standard input.\n"); fprintf(stderr, "It can be multiple lines, up to %u characters total.\n", - (unsigned int) MAX_COM_LENGTH); + (unsigned int) MAX_COM_LENGTH); #ifndef TWO_FILE_COMMANDLINE fprintf(stderr, "You must specify an input JPEG file name when supplying\n"); fprintf(stderr, "comment text from standard input.\n"); @@ -391,17 +391,17 @@ keymatch (char * arg, const char * keyword, int minchars) while ((ca = *arg++) != '\0') { if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ + return 0; /* arg longer than keyword, no good */ + if (isupper(ca)) /* force arg to lcase (assume ck is already) */ ca = tolower(ca); if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ + return 0; /* no good */ + nmatched++; /* count matched characters */ } /* reached end of argument; fail if it's too short for unique abbrev */ if (nmatched < minchars) return 0; - return 1; /* A-OK */ + return 1; /* A-OK */ } @@ -427,21 +427,21 @@ main (int argc, char **argv) progname = argv[0]; if (progname == NULL || progname[0] == 0) - progname = "wrjpgcom"; /* in case C library doesn't provide it */ + progname = "wrjpgcom"; /* in case C library doesn't provide it */ /* Parse switches, if any */ for (argn = 1; argn < argc; argn++) { arg = argv[argn]; if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ + break; /* not switch, must be file name */ + arg++; /* advance over '-' */ if (keymatch(arg, "replace", 1)) { keep_COM = 0; } else if (keymatch(arg, "cfile", 2)) { if (++argn >= argc) usage(); if ((comment_file = fopen(argv[argn], "r")) == NULL) { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); + exit(EXIT_FAILURE); } } else if (keymatch(arg, "comment", 1)) { if (++argn >= argc) usage(); @@ -450,21 +450,21 @@ main (int argc, char **argv) * under MS-DOG and must parse out the quoted string ourselves. Sigh. */ if (comment_arg[0] == '"') { - comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); - if (comment_arg == NULL) - ERREXIT("Insufficient memory"); - strcpy(comment_arg, argv[argn]+1); - for (;;) { - comment_length = (unsigned int) strlen(comment_arg); - if (comment_length > 0 && comment_arg[comment_length-1] == '"') { - comment_arg[comment_length-1] = '\0'; /* zap terminating quote */ - break; - } - if (++argn >= argc) - ERREXIT("Missing ending quote mark"); - strcat(comment_arg, " "); - strcat(comment_arg, argv[argn]); - } + comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); + if (comment_arg == NULL) + ERREXIT("Insufficient memory"); + strcpy(comment_arg, argv[argn]+1); + for (;;) { + comment_length = (unsigned int) strlen(comment_arg); + if (comment_length > 0 && comment_arg[comment_length-1] == '"') { + comment_arg[comment_length-1] = '\0'; /* zap terminating quote */ + break; + } + if (++argn >= argc) + ERREXIT("Missing ending quote mark"); + strcat(comment_arg, " "); + strcat(comment_arg, argv[argn]); + } } comment_length = (unsigned int) strlen(comment_arg); } else @@ -488,10 +488,10 @@ main (int argc, char **argv) } } else { /* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ +#ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdin), O_BINARY); #endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) { fprintf(stderr, "%s: can't open stdin\n", progname); exit(EXIT_FAILURE); @@ -506,7 +506,7 @@ main (int argc, char **argv) /* Must have explicit output file name */ if (argn != argc-2) { fprintf(stderr, "%s: must name one input and one output file\n", - progname); + progname); usage(); } if ((outfile = fopen(argv[argn+1], WRITE_BINARY)) == NULL) { @@ -520,10 +520,10 @@ main (int argc, char **argv) usage(); } /* default output file is stdout */ -#ifdef USE_SETMODE /* need to hack file mode? */ +#ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdout), O_BINARY); #endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((outfile = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { fprintf(stderr, "%s: can't open stdout\n", progname); exit(EXIT_FAILURE); @@ -545,9 +545,9 @@ main (int argc, char **argv) src_file = (comment_file != NULL ? comment_file : stdin); while ((c = getc(src_file)) != EOF) { if (comment_length >= (unsigned int) MAX_COM_LENGTH) { - fprintf(stderr, "Comment text may not exceed %u bytes\n", - (unsigned int) MAX_COM_LENGTH); - exit(EXIT_FAILURE); + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); } comment_arg[comment_length++] = (char) c; } @@ -579,5 +579,5 @@ main (int argc, char **argv) /* All done. */ exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ + return 0; /* suppress no-return-value warnings */ } diff --git a/wrppm.c b/wrppm.c index 68e0c85c..6b7ebf42 100644 --- a/wrppm.c +++ b/wrppm.c @@ -16,7 +16,7 @@ * an ordinary stdio stream. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef PPM_SUPPORTED @@ -42,11 +42,11 @@ #define PPM_MAXVAL 255 #else /* The word-per-sample format always puts the MSB first. */ -#define PUTPPMSAMPLE(ptr,v) \ - { register int val_ = v; \ - *ptr++ = (char) ((val_ >> 8) & 0xFF); \ - *ptr++ = (char) (val_ & 0xFF); \ - } +#define PUTPPMSAMPLE(ptr,v) \ + { register int val_ = v; \ + *ptr++ = (char) ((val_ >> 8) & 0xFF); \ + *ptr++ = (char) (val_ & 0xFF); \ + } #define BYTESPERSAMPLE 2 #define PPM_MAXVAL ((1<pub.output_file, "P5\n%ld %ld\n%d\n", - (long) cinfo->output_width, (long) cinfo->output_height, - PPM_MAXVAL); + (long) cinfo->output_width, (long) cinfo->output_height, + PPM_MAXVAL); break; case JCS_RGB: /* emit header for raw PPM format */ fprintf(dest->pub.output_file, "P6\n%ld %ld\n%d\n", - (long) cinfo->output_width, (long) cinfo->output_height, - PPM_MAXVAL); + (long) cinfo->output_width, (long) cinfo->output_height, + PPM_MAXVAL); break; default: ERREXIT(cinfo, JERR_PPM_COLORSPACE); @@ -224,7 +224,7 @@ jinit_write_ppm (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (ppm_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_dest_struct)); + SIZEOF(ppm_dest_struct)); dest->pub.start_output = start_output_ppm; dest->pub.finish_output = finish_output_ppm; diff --git a/wrrle.c b/wrrle.c index a4e73372..4fdf372a 100644 --- a/wrrle.c +++ b/wrrle.c @@ -16,7 +16,7 @@ * with updates from Robert Hutchinson. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef RLE_SUPPORTED @@ -47,15 +47,15 @@ * though not all of the entries need be used. */ -#define CMAPBITS 8 -#define CMAPLENGTH (1<<(CMAPBITS)) +#define CMAPBITS 8 +#define CMAPLENGTH (1<<(CMAPBITS)) typedef struct { struct djpeg_dest_struct pub; /* public fields */ - jvirt_sarray_ptr image; /* virtual array to store the output image */ - rle_map *colormap; /* RLE-style color map, or NULL if none */ - rle_pixel **rle_row; /* To pass rows to rle_putrow() */ + jvirt_sarray_ptr image; /* virtual array to store the output image */ + rle_map *colormap; /* RLE-style color map, or NULL if none */ + rle_pixel **rle_row; /* To pass rows to rle_putrow() */ } rle_dest_struct; @@ -64,7 +64,7 @@ typedef rle_dest_struct * rle_dest_ptr; /* Forward declarations */ METHODDEF(void) rle_put_pixel_rows JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); + JDIMENSION rows_supplied)); /* @@ -97,8 +97,8 @@ start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) */ if (cinfo->output_width > 32767 || cinfo->output_height > 32767) - ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width, - cinfo->output_height); + ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width, + cinfo->output_height); if (cinfo->out_color_space != JCS_GRAYSCALE && cinfo->out_color_space != JCS_RGB) @@ -151,7 +151,7 @@ start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) METHODDEF(void) rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) { rle_dest_ptr dest = (rle_dest_ptr) dinfo; @@ -172,7 +172,7 @@ METHODDEF(void) finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) { rle_dest_ptr dest = (rle_dest_ptr) dinfo; - rle_hdr header; /* Output file information */ + rle_hdr header; /* Output file information */ rle_pixel **rle_row, *red, *green, *blue; JSAMPROW output_row; char cmapcomment[80]; @@ -223,7 +223,7 @@ finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) for (row = cinfo->output_height-1; row >= 0; row--) { rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, dest->image, - (JDIMENSION) row, (JDIMENSION) 1, FALSE); + (JDIMENSION) row, (JDIMENSION) 1, FALSE); rle_putrow(rle_row, (int) cinfo->output_width, &header); #ifdef PROGRESS_REPORT if (progress != NULL) { @@ -237,7 +237,7 @@ finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) rle_row = (rle_pixel **) dest->rle_row; output_row = * (*cinfo->mem->access_virt_sarray) ((j_common_ptr) cinfo, dest->image, - (JDIMENSION) row, (JDIMENSION) 1, FALSE); + (JDIMENSION) row, (JDIMENSION) 1, FALSE); red = rle_row[0]; green = rle_row[1]; blue = rle_row[2]; diff --git a/wrtarga.c b/wrtarga.c index cf104d2d..84084be2 100644 --- a/wrtarga.c +++ b/wrtarga.c @@ -14,7 +14,7 @@ * Based on code contributed by Lee Daniel Crocker. */ -#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #ifdef TARGA_SUPPORTED @@ -41,10 +41,10 @@ /* Private version of data destination object */ typedef struct { - struct djpeg_dest_struct pub; /* public fields */ + struct djpeg_dest_struct pub; /* public fields */ - char *iobuffer; /* physical I/O buffer */ - JDIMENSION buffer_width; /* width of one row */ + char *iobuffer; /* physical I/O buffer */ + JDIMENSION buffer_width; /* width of one row */ } tga_dest_struct; typedef tga_dest_struct * tga_dest_ptr; @@ -60,27 +60,27 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) MEMZERO(targaheader, SIZEOF(targaheader)); if (num_colors > 0) { - targaheader[1] = 1; /* color map type 1 */ + targaheader[1] = 1; /* color map type 1 */ targaheader[5] = (char) (num_colors & 0xFF); targaheader[6] = (char) (num_colors >> 8); - targaheader[7] = 24; /* 24 bits per cmap entry */ + targaheader[7] = 24; /* 24 bits per cmap entry */ } targaheader[12] = (char) (cinfo->output_width & 0xFF); targaheader[13] = (char) (cinfo->output_width >> 8); targaheader[14] = (char) (cinfo->output_height & 0xFF); targaheader[15] = (char) (cinfo->output_height >> 8); - targaheader[17] = 0x20; /* Top-down, non-interlaced */ + targaheader[17] = 0x20; /* Top-down, non-interlaced */ if (cinfo->out_color_space == JCS_GRAYSCALE) { - targaheader[2] = 3; /* image type = uncompressed gray-scale */ - targaheader[16] = 8; /* bits per pixel */ - } else { /* must be RGB */ + targaheader[2] = 3; /* image type = uncompressed gray-scale */ + targaheader[16] = 8; /* bits per pixel */ + } else { /* must be RGB */ if (num_colors > 0) { - targaheader[2] = 1; /* image type = colormapped RGB */ + targaheader[2] = 1; /* image type = colormapped RGB */ targaheader[16] = 8; } else { - targaheader[2] = 2; /* image type = uncompressed RGB */ + targaheader[2] = 2; /* image type = uncompressed RGB */ targaheader[16] = 24; } } @@ -97,7 +97,7 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) METHODDEF(void) put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) /* used for unquantized full-color output */ { tga_dest_ptr dest = (tga_dest_ptr) dinfo; @@ -118,7 +118,7 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, METHODDEF(void) put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) /* used for grayscale OR quantized color output */ { tga_dest_ptr dest = (tga_dest_ptr) dinfo; @@ -142,7 +142,7 @@ put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, METHODDEF(void) put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied) + JDIMENSION rows_supplied) { tga_dest_ptr dest = (tga_dest_ptr) dinfo; register JSAMPROW inptr; @@ -183,14 +183,14 @@ start_output_tga (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) /* We only support 8-bit colormap indexes, so only 256 colors */ num_colors = cinfo->actual_number_of_colors; if (num_colors > 256) - ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors); + ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, num_colors); write_header(cinfo, dinfo, num_colors); /* Write the colormap. Note Targa uses BGR byte order */ outfile = dest->pub.output_file; for (i = 0; i < num_colors; i++) { - putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile); - putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile); - putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile); + putc(GETJSAMPLE(cinfo->colormap[2][i]), outfile); + putc(GETJSAMPLE(cinfo->colormap[1][i]), outfile); + putc(GETJSAMPLE(cinfo->colormap[0][i]), outfile); } dest->pub.put_pixel_rows = put_gray_rows; } else { @@ -229,7 +229,7 @@ jinit_write_targa (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (tga_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_dest_struct)); + SIZEOF(tga_dest_struct)); dest->pub.start_output = start_output_tga; dest->pub.finish_output = finish_output_tga; @@ -240,7 +240,7 @@ jinit_write_targa (j_decompress_ptr cinfo) dest->buffer_width = cinfo->output_width * cinfo->output_components; dest->iobuffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (dest->buffer_width * SIZEOF(char))); + (size_t) (dest->buffer_width * SIZEOF(char))); /* Create decompressor output buffer. */ dest->pub.buffer = (*cinfo->mem->alloc_sarray) From 0d25e8657443ee9e349362f781851156e978a780 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 9 May 2014 18:06:58 +0000 Subject: [PATCH 908/985] Remove trailing spaces (+ one additional tab in TJUnitTest.java that was missed in the previous commit) --- bmp.c | 2 +- java/TJUnitTest.java | 4 ++-- jsimd.h | 2 +- jsimd_none.c | 10 +++++----- jsimddct.h | 2 +- simd/Makefile.am | 2 +- simd/jsimd_arm.c | 8 ++++---- simd/jsimd_arm64.c | 8 ++++---- simd/jsimd_i386.c | 10 +++++----- simd/jsimd_x86_64.c | 10 +++++----- tjbench.c | 2 +- tjbenchtest.java.in | 2 +- turbojpeg-jni.c | 4 ++-- turbojpeg-mapfile.jni | 2 +- turbojpeg.h | 4 ++-- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bmp.c b/bmp.c index fa4479da..4986055c 100644 --- a/bmp.c +++ b/bmp.c @@ -98,7 +98,7 @@ static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup, } -int loadbmp(char *filename, unsigned char **buf, int *w, int *h, +int loadbmp(char *filename, unsigned char **buf, int *w, int *h, int dstpf, int bottomup) { int retval=0, dstps, srcpf, tempc; diff --git a/java/TJUnitTest.java b/java/TJUnitTest.java index d8b5c854..ab539c4f 100644 --- a/java/TJUnitTest.java +++ b/java/TJUnitTest.java @@ -324,7 +324,7 @@ public class TJUnitTest { index = row * w + col; byte c = buf[index * ps]; byte m = buf[index * ps + 1]; - byte y = buf[index * ps + 2]; + byte y = buf[index * ps + 2]; byte k = buf[index * ps + 3]; checkVal255(row, col, c, "C"); if (((row / blockSize) + (col / blockSize)) % 2 == 0) { @@ -673,7 +673,7 @@ public class TJUnitTest { tjc.setSubsamp(subsamp); tjc.setJPEGQuality(jpegQual); if (doYUV) { - System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong, + System.out.format("%s %s -> YUV %s ... ", pfStrLong, buStrLong, subNameLong[subsamp]); YUVImage yuvImage = tjc.encodeYUV(pad, flags); if (checkBufYUV(yuvImage.getBuf(), yuvImage.getSize(), w, h, subsamp, diff --git a/jsimd.h b/jsimd.h index 3fa2c432..ae072157 100644 --- a/jsimd.h +++ b/jsimd.h @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2011 D. R. Commander - * + * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc diff --git a/jsimd_none.c b/jsimd_none.c index 882fc087..7b2e9651 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2009-2011 D. R. Commander - * + * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc @@ -95,7 +95,7 @@ jsimd_can_h2v1_upsample (void) GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -103,7 +103,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -123,7 +123,7 @@ jsimd_can_h2v1_fancy_upsample (void) GLOBAL(void) jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -131,7 +131,7 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { diff --git a/jsimddct.h b/jsimddct.h index 9d2d9455..d962b9b1 100644 --- a/jsimddct.h +++ b/jsimddct.h @@ -2,7 +2,7 @@ * jsimddct.h * * Copyright 2009 Pierre Ossman for Cendio AB - * + * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc diff --git a/simd/Makefile.am b/simd/Makefile.am index be2f0a5f..5e977c16 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -70,7 +70,7 @@ libsimd_la_SOURCES = jsimd_mips.c jsimd_mips_dspr2_asm.h jsimd_mips_dspr2.S endif -AM_CPPFLAGS = -I$(top_srcdir) +AM_CPPFLAGS = -I$(top_srcdir) .asm.lo: $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@ diff --git a/simd/jsimd_arm.c b/simd/jsimd_arm.c index c6fa4caa..9f9bf5ac 100644 --- a/simd/jsimd_arm.c +++ b/simd/jsimd_arm.c @@ -311,7 +311,7 @@ jsimd_can_h2v1_upsample (void) GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -319,7 +319,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -352,7 +352,7 @@ jsimd_can_h2v1_fancy_upsample (void) GLOBAL(void) jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -360,7 +360,7 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { diff --git a/simd/jsimd_arm64.c b/simd/jsimd_arm64.c index d280d621..d217cf6b 100644 --- a/simd/jsimd_arm64.c +++ b/simd/jsimd_arm64.c @@ -266,7 +266,7 @@ jsimd_can_h2v1_upsample (void) GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -274,7 +274,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -298,7 +298,7 @@ jsimd_can_h2v1_fancy_upsample (void) GLOBAL(void) jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -306,7 +306,7 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c index b731edb4..1037fd9f 100644 --- a/simd/jsimd_i386.c +++ b/simd/jsimd_i386.c @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2009-2011, 2013 D. R. Commander - * + * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc @@ -395,7 +395,7 @@ jsimd_can_h2v1_upsample (void) GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -409,7 +409,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -463,7 +463,7 @@ jsimd_can_h2v1_fancy_upsample (void) GLOBAL(void) jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -478,7 +478,7 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c index 8d17db30..afaea4b9 100644 --- a/simd/jsimd_x86_64.c +++ b/simd/jsimd_x86_64.c @@ -3,7 +3,7 @@ * * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2009-2011 D. R. Commander - * + * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. * For conditions of distribution and use, see copyright notice in jsimdext.inc @@ -269,7 +269,7 @@ jsimd_can_h2v1_upsample (void) GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -280,7 +280,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -321,7 +321,7 @@ jsimd_can_h2v1_fancy_upsample (void) GLOBAL(void) jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { @@ -332,7 +332,7 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(void) jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, - jpeg_component_info * compptr, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { diff --git a/tjbench.c b/tjbench.c index ff09cb77..14ccd00e 100644 --- a/tjbench.c +++ b/tjbench.c @@ -251,7 +251,7 @@ int decomp(unsigned char *srcbuf, unsigned char **jpegbuf, dstbuf[bindex]=abs(dstbuf[bindex]-y); } } - } + } else { for(row=0; rowGetPrimitiveArrayCritical(env, src, 0)); - if(tjDecompressHeader3(handle, jpegBuf, (unsigned long)jpegSize, + if(tjDecompressHeader3(handle, jpegBuf, (unsigned long)jpegSize, &width, &height, &jpegSubsamp, &jpegColorspace)==-1) { (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); @@ -550,7 +550,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress { Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII (env, obj, src, jpegSize, dst, 0, 0, width, stride, height, pf, flags); - + } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni index 283e01f8..f9fc7e53 100755 --- a/turbojpeg-mapfile.jni +++ b/turbojpeg-mapfile.jni @@ -49,7 +49,7 @@ TURBOJPEG_1.2 Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII; Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII; Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI; - Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy; Java_org_libjpegturbo_turbojpeg_TJTransformer_init; Java_org_libjpegturbo_turbojpeg_TJTransformer_transform; } TURBOJPEG_1.1; diff --git a/turbojpeg.h b/turbojpeg.h index 6c13851a..818ca6e0 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -563,7 +563,7 @@ typedef void* tjhandle; /** * Compute the scaled value of dimension using the given scaling * factor. This macro performs the integer equivalent of ceil(dimension * - * scalingFactor). + * scalingFactor)
    . */ #define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \ + scalingFactor.denom - 1) / scalingFactor.denom) @@ -1063,7 +1063,7 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle handle); * (re)allocation (by setting #TJFLAG_NOREALLOC.) * * @param bytes the number of bytes to allocate - * + * * @return a pointer to a newly-allocated buffer with the specified number of * bytes * From 6af3f00efab829dad98d758c38c3c6ce4157eb58 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 9 May 2014 20:14:26 +0000 Subject: [PATCH 909/985] Re-organize the x86/x86-64 SIMD routines into separate folders by instruction set so we can name each routine similarly to its corresponding C file. This also makes it easier to add support for new instruction sets. --- simd/Makefile.am | 70 ++++++++++--------- .../{jf3dnflt.asm => i386-3dnow/jfdctflt.asm} | 2 +- .../{ji3dnflt.asm => i386-3dnow/jidctflt.asm} | 2 +- simd/{jcqnt3dn.asm => i386-3dnow/jquant.asm} | 2 +- simd/{jcclrmmx.asm => i386-mmx/jccolext.asm} | 2 +- simd/{jccolmmx.asm => i386-mmx/jccolor.asm} | 16 ++--- simd/{jcgrammx.asm => i386-mmx/jcgray.asm} | 16 ++--- simd/{jcgrymmx.asm => i386-mmx/jcgryext.asm} | 2 +- simd/{jcsammmx.asm => i386-mmx/jcsample.asm} | 2 +- simd/{jdclrmmx.asm => i386-mmx/jdcolext.asm} | 2 +- simd/{jdcolmmx.asm => i386-mmx/jdcolor.asm} | 16 ++--- simd/{jdmermmx.asm => i386-mmx/jdmerge.asm} | 16 ++--- simd/{jdmrgmmx.asm => i386-mmx/jdmrgext.asm} | 2 +- simd/{jdsammmx.asm => i386-mmx/jdsample.asm} | 2 +- simd/{jfmmxfst.asm => i386-mmx/jfdctfst.asm} | 2 +- simd/{jfmmxint.asm => i386-mmx/jfdctint.asm} | 2 +- simd/{jimmxfst.asm => i386-mmx/jidctfst.asm} | 2 +- simd/{jimmxint.asm => i386-mmx/jidctint.asm} | 2 +- simd/{jimmxred.asm => i386-mmx/jidctred.asm} | 2 +- simd/{jcqntmmx.asm => i386-mmx/jquant.asm} | 2 +- simd/{jfsseflt.asm => i386-sse/jfdctflt.asm} | 2 +- simd/{jisseflt.asm => i386-sse/jidctflt.asm} | 2 +- simd/{jcqntsse.asm => i386-sse/jquant.asm} | 2 +- simd/{jcclrss2.asm => i386-sse2/jccolext.asm} | 2 +- simd/{jccolss2.asm => i386-sse2/jccolor.asm} | 16 ++--- simd/{jcgrass2.asm => i386-sse2/jcgray.asm} | 16 ++--- simd/{jcgryss2.asm => i386-sse2/jcgryext.asm} | 2 +- simd/{jcsamss2.asm => i386-sse2/jcsample.asm} | 2 +- simd/{jdclrss2.asm => i386-sse2/jdcolext.asm} | 2 +- simd/{jdcolss2.asm => i386-sse2/jdcolor.asm} | 16 ++--- simd/{jdmerss2.asm => i386-sse2/jdmerge.asm} | 16 ++--- simd/{jdmrgss2.asm => i386-sse2/jdmrgext.asm} | 2 +- simd/{jdsamss2.asm => i386-sse2/jdsample.asm} | 2 +- simd/{jfss2fst.asm => i386-sse2/jfdctfst.asm} | 2 +- simd/{jfss2int.asm => i386-sse2/jfdctint.asm} | 2 +- simd/{jiss2flt.asm => i386-sse2/jidctflt.asm} | 2 +- simd/{jiss2fst.asm => i386-sse2/jidctfst.asm} | 2 +- simd/{jiss2int.asm => i386-sse2/jidctint.asm} | 2 +- simd/{jiss2red.asm => i386-sse2/jidctred.asm} | 2 +- simd/{jcqnts2f.asm => i386-sse2/jquantf.asm} | 2 +- simd/{jcqnts2i.asm => i386-sse2/jquanti.asm} | 2 +- .../jfdctflt.asm} | 2 +- .../jccolext.asm} | 2 +- .../jccolor.asm} | 16 ++--- .../jcgray.asm} | 16 ++--- .../jcgryext.asm} | 2 +- .../jcsample.asm} | 2 +- .../jdcolext.asm} | 2 +- .../jdcolor.asm} | 16 ++--- .../jdmerge.asm} | 16 ++--- .../jdmrgext.asm} | 2 +- .../jdsample.asm} | 2 +- .../jfdctfst.asm} | 2 +- .../jfdctint.asm} | 2 +- .../jidctflt.asm} | 2 +- .../jidctfst.asm} | 2 +- .../jidctint.asm} | 2 +- .../jidctred.asm} | 2 +- .../jquantf.asm} | 2 +- .../jquanti.asm} | 2 +- 60 files changed, 181 insertions(+), 175 deletions(-) rename simd/{jf3dnflt.asm => i386-3dnow/jfdctflt.asm} (99%) rename simd/{ji3dnflt.asm => i386-3dnow/jidctflt.asm} (99%) rename simd/{jcqnt3dn.asm => i386-3dnow/jquant.asm} (99%) rename simd/{jcclrmmx.asm => i386-mmx/jccolext.asm} (99%) rename simd/{jccolmmx.asm => i386-mmx/jccolor.asm} (92%) rename simd/{jcgrammx.asm => i386-mmx/jcgray.asm} (91%) rename simd/{jcgrymmx.asm => i386-mmx/jcgryext.asm} (99%) rename simd/{jcsammmx.asm => i386-mmx/jcsample.asm} (99%) rename simd/{jdclrmmx.asm => i386-mmx/jdcolext.asm} (99%) rename simd/{jdcolmmx.asm => i386-mmx/jdcolor.asm} (92%) rename simd/{jdmermmx.asm => i386-mmx/jdmerge.asm} (93%) rename simd/{jdmrgmmx.asm => i386-mmx/jdmrgext.asm} (99%) rename simd/{jdsammmx.asm => i386-mmx/jdsample.asm} (99%) rename simd/{jfmmxfst.asm => i386-mmx/jfdctfst.asm} (99%) rename simd/{jfmmxint.asm => i386-mmx/jfdctint.asm} (99%) rename simd/{jimmxfst.asm => i386-mmx/jidctfst.asm} (99%) rename simd/{jimmxint.asm => i386-mmx/jidctint.asm} (99%) rename simd/{jimmxred.asm => i386-mmx/jidctred.asm} (99%) rename simd/{jcqntmmx.asm => i386-mmx/jquant.asm} (99%) rename simd/{jfsseflt.asm => i386-sse/jfdctflt.asm} (99%) rename simd/{jisseflt.asm => i386-sse/jidctflt.asm} (99%) rename simd/{jcqntsse.asm => i386-sse/jquant.asm} (99%) rename simd/{jcclrss2.asm => i386-sse2/jccolext.asm} (99%) rename simd/{jccolss2.asm => i386-sse2/jccolor.asm} (92%) rename simd/{jcgrass2.asm => i386-sse2/jcgray.asm} (91%) rename simd/{jcgryss2.asm => i386-sse2/jcgryext.asm} (99%) rename simd/{jcsamss2.asm => i386-sse2/jcsample.asm} (99%) rename simd/{jdclrss2.asm => i386-sse2/jdcolext.asm} (99%) rename simd/{jdcolss2.asm => i386-sse2/jdcolor.asm} (92%) rename simd/{jdmerss2.asm => i386-sse2/jdmerge.asm} (92%) rename simd/{jdmrgss2.asm => i386-sse2/jdmrgext.asm} (99%) rename simd/{jdsamss2.asm => i386-sse2/jdsample.asm} (99%) rename simd/{jfss2fst.asm => i386-sse2/jfdctfst.asm} (99%) rename simd/{jfss2int.asm => i386-sse2/jfdctint.asm} (99%) rename simd/{jiss2flt.asm => i386-sse2/jidctflt.asm} (99%) rename simd/{jiss2fst.asm => i386-sse2/jidctfst.asm} (99%) rename simd/{jiss2int.asm => i386-sse2/jidctint.asm} (99%) rename simd/{jiss2red.asm => i386-sse2/jidctred.asm} (99%) rename simd/{jcqnts2f.asm => i386-sse2/jquantf.asm} (98%) rename simd/{jcqnts2i.asm => i386-sse2/jquanti.asm} (99%) rename simd/{jfsseflt-64.asm => x86_64-sse/jfdctflt.asm} (99%) rename simd/{jcclrss2-64.asm => x86_64-sse2/jccolext.asm} (99%) rename simd/{jccolss2-64.asm => x86_64-sse2/jccolor.asm} (91%) rename simd/{jcgrass2-64.asm => x86_64-sse2/jcgray.asm} (90%) rename simd/{jcgryss2-64.asm => x86_64-sse2/jcgryext.asm} (99%) rename simd/{jcsamss2-64.asm => x86_64-sse2/jcsample.asm} (99%) rename simd/{jdclrss2-64.asm => x86_64-sse2/jdcolext.asm} (99%) rename simd/{jdcolss2-64.asm => x86_64-sse2/jdcolor.asm} (91%) rename simd/{jdmerss2-64.asm => x86_64-sse2/jdmerge.asm} (92%) rename simd/{jdmrgss2-64.asm => x86_64-sse2/jdmrgext.asm} (99%) rename simd/{jdsamss2-64.asm => x86_64-sse2/jdsample.asm} (99%) rename simd/{jfss2fst-64.asm => x86_64-sse2/jfdctfst.asm} (99%) rename simd/{jfss2int-64.asm => x86_64-sse2/jfdctint.asm} (99%) rename simd/{jiss2flt-64.asm => x86_64-sse2/jidctflt.asm} (99%) rename simd/{jiss2fst-64.asm => x86_64-sse2/jidctfst.asm} (99%) rename simd/{jiss2int-64.asm => x86_64-sse2/jidctint.asm} (99%) rename simd/{jiss2red-64.asm => x86_64-sse2/jidctred.asm} (99%) rename simd/{jcqnts2f-64.asm => x86_64-sse2/jquantf.asm} (98%) rename simd/{jcqnts2i-64.asm => x86_64-sse2/jquanti.asm} (98%) diff --git a/simd/Makefile.am b/simd/Makefile.am index 5e977c16..4da172aa 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -2,26 +2,31 @@ noinst_LTLIBRARIES = libsimd.la BUILT_SOURCES = jsimdcfg.inc -EXTRA_DIST = nasm_lt.sh jcclrmmx.asm jcclrss2.asm jdclrmmx.asm jdclrss2.asm \ - jdmrgmmx.asm jdmrgss2.asm jcclrss2-64.asm jdclrss2-64.asm \ - jdmrgss2-64.asm jcgryss2-64.asm jcgrymmx.asm jcgryss2.asm CMakeLists.txt +EXTRA_DIST = nasm_lt.sh CMakeLists.txt \ + i386-mmx/jccolext.asm i386-mmx/jcgryext.asm i386-mmx/jdcolext.asm \ + i386-mmx/jdmrgext.asm \ + i386-sse2/jccolext.asm i386-sse2/jcgryext.asm i386-sse2/jdcolext.asm \ + i386-sse2/jdmrgext.asm \ + x86_64-sse2/jccolext.asm x86_64-sse2/jcgryext.asm x86_64-sse2/jdcolext.asm \ + x86_64-sse2/jdmrgext.asm if SIMD_X86_64 libsimd_la_SOURCES = jsimd_x86_64.c \ jsimd.h jsimdcfg.inc.h \ jsimdext.inc jcolsamp.inc jdct.inc \ - jfsseflt-64.asm jcgrass2-64.asm \ - jccolss2-64.asm jdcolss2-64.asm \ - jcsamss2-64.asm jdsamss2-64.asm jdmerss2-64.asm \ - jcqnts2i-64.asm jfss2fst-64.asm jfss2int-64.asm \ - jiss2red-64.asm jiss2int-64.asm jiss2fst-64.asm \ - jcqnts2f-64.asm jiss2flt-64.asm + x86_64-sse/jfdctflt.asm x86_64-sse2/jcgray.asm \ + x86_64-sse2/jccolor.asm x86_64-sse2/jdcolor.asm \ + x86_64-sse2/jcsample.asm x86_64-sse2/jdsample.asm x86_64-sse2/jdmerge.asm \ + x86_64-sse2/jquanti.asm x86_64-sse2/jfdctfst.asm x86_64-sse2/jfdctint.asm \ + x86_64-sse2/jidctred.asm x86_64-sse2/jidctint.asm x86_64-sse2/jidctfst.asm \ + x86_64-sse2/jquantf.asm x86_64-sse2/jidctflt.asm + +x86_64-sse2/jccolor.lo: x86_64-sse2/jccolext.asm +x86_64-sse2/jcgray.lo: x86_64-sse2/jcgryext.asm +x86_64-sse2/jdcolor.lo: x86_64-sse2/jdcolext.asm +x86_64-sse2/jdmerge.lo: x86_64-sse2/jdmrgext.asm -jccolss2-64.lo: jcclrss2-64.asm -jdcolss2-64.lo: jdclrss2-64.asm -jcgrass2-64.lo: jcgryss2-64.asm -jdmerss2-64.lo: jdmrgss2-64.asm endif if SIMD_I386 @@ -30,26 +35,27 @@ libsimd_la_SOURCES = jsimd_i386.c \ jsimd.h jsimdcfg.inc.h \ jsimdext.inc jcolsamp.inc jdct.inc \ jsimdcpu.asm \ - jccolmmx.asm jdcolmmx.asm jcgrammx.asm \ - jcsammmx.asm jdsammmx.asm jdmermmx.asm \ - jcqntmmx.asm jfmmxfst.asm jfmmxint.asm \ - jimmxred.asm jimmxint.asm jimmxfst.asm \ - jcqnt3dn.asm jf3dnflt.asm ji3dnflt.asm \ - jcqntsse.asm jfsseflt.asm jisseflt.asm \ - jccolss2.asm jdcolss2.asm jcgrass2.asm \ - jcsamss2.asm jdsamss2.asm jdmerss2.asm \ - jcqnts2i.asm jfss2fst.asm jfss2int.asm \ - jiss2red.asm jiss2int.asm jiss2fst.asm \ - jcqnts2f.asm jiss2flt.asm + i386-mmx/jccolor.asm i386-mmx/jdcolor.asm i386-mmx/jcgray.asm \ + i386-mmx/jcsample.asm i386-mmx/jdsample.asm i386-mmx/jdmerge.asm \ + i386-mmx/jquant.asm i386-mmx/jfdctfst.asm i386-mmx/jfdctint.asm \ + i386-mmx/jidctred.asm i386-mmx/jidctint.asm i386-mmx/jidctfst.asm \ + i386-3dnow/jquant.asm i386-3dnow/jfdctflt.asm i386-3dnow/jidctflt.asm \ + i386-sse/jquant.asm i386-sse/jfdctflt.asm i386-sse/jidctflt.asm \ + i386-sse2/jccolor.asm i386-sse2/jdcolor.asm i386-sse2/jcgray.asm \ + i386-sse2/jcsample.asm i386-sse2/jdsample.asm i386-sse2/jdmerge.asm \ + i386-sse2/jquanti.asm i386-sse2/jfdctfst.asm i386-sse2/jfdctint.asm \ + i386-sse2/jidctred.asm i386-sse2/jidctint.asm i386-sse2/jidctfst.asm \ + i386-sse2/jquantf.asm i386-sse2/jidctflt.asm + +i386-mmx/jccolor.lo: i386-mmx/jccolext.asm +i386-mmx/jcgray.lo: i386-mmx/jcgryext.asm +i386-mmx/jdcolor.lo: i386-mmx/jdcolext.asm +i386-mmx/jdmerge.lo: i386-mmx/jdmrgext.asm +i386-sse2/jccolor.lo: i386-sse2/jccolext.asm +i386-sse2/jcgray.lo: i386-sse2/jcgryext.asm +i386-sse2/jdcolor.lo: i386-sse2/jdcolext.asm +i386-sse2/jdmerge.lo: i386-sse2/jdmrgext.asm -jccolmmx.lo: jcclrmmx.asm -jcgrammx.lo: jcgrymmx.asm -jccolss2.lo: jcclrss2.asm -jcgrass2.lo: jcgryss2.asm -jdcolmmx.lo: jdclrmmx.asm -jdcolss2.lo: jdclrss2.asm -jdmermmx.lo: jdmrgmmx.asm -jdmerss2.lo: jdmrgss2.asm endif if SIMD_ARM diff --git a/simd/jf3dnflt.asm b/simd/i386-3dnow/jfdctflt.asm similarity index 99% rename from simd/jf3dnflt.asm rename to simd/i386-3dnow/jfdctflt.asm index 06712e8e..e23c5218 100644 --- a/simd/jf3dnflt.asm +++ b/simd/i386-3dnow/jfdctflt.asm @@ -1,5 +1,5 @@ ; -; jf3dnflt.asm - floating-point FDCT (3DNow!) +; jfdctflt.asm - floating-point FDCT (3DNow!) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/ji3dnflt.asm b/simd/i386-3dnow/jidctflt.asm similarity index 99% rename from simd/ji3dnflt.asm rename to simd/i386-3dnow/jidctflt.asm index 76303fa4..ea2e2701 100644 --- a/simd/ji3dnflt.asm +++ b/simd/i386-3dnow/jidctflt.asm @@ -1,5 +1,5 @@ ; -; ji3dnflt.asm - floating-point IDCT (3DNow! & MMX) +; jidctflt.asm - floating-point IDCT (3DNow! & MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcqnt3dn.asm b/simd/i386-3dnow/jquant.asm similarity index 99% rename from simd/jcqnt3dn.asm rename to simd/i386-3dnow/jquant.asm index 0b8ec17e..76e19f70 100644 --- a/simd/jcqnt3dn.asm +++ b/simd/i386-3dnow/jquant.asm @@ -1,5 +1,5 @@ ; -; jcqnt3dn.asm - sample data conversion and quantization (3DNow! & MMX) +; jquant.asm - sample data conversion and quantization (3DNow! & MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcclrmmx.asm b/simd/i386-mmx/jccolext.asm similarity index 99% rename from simd/jcclrmmx.asm rename to simd/i386-mmx/jccolext.asm index f34104f3..d3d47a56 100644 --- a/simd/jcclrmmx.asm +++ b/simd/i386-mmx/jccolext.asm @@ -1,5 +1,5 @@ ; -; jcclrmmx.asm - colorspace conversion (MMX) +; jccolext.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jccolmmx.asm b/simd/i386-mmx/jccolor.asm similarity index 92% rename from simd/jccolmmx.asm rename to simd/i386-mmx/jccolor.asm index 87058ee1..85e17e11 100644 --- a/simd/jccolmmx.asm +++ b/simd/i386-mmx/jccolor.asm @@ -1,5 +1,5 @@ ; -; jccolmmx.asm - colorspace conversion (MMX) +; jccolor.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -54,7 +54,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -65,7 +65,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgb_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -76,7 +76,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgbx_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgr_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -98,7 +98,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgrx_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -109,7 +109,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxbgr_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -120,4 +120,4 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxrgb_ycc_convert_mmx -%include "jcclrmmx.asm" +%include "i386-mmx/jccolext.asm" diff --git a/simd/jcgrammx.asm b/simd/i386-mmx/jcgray.asm similarity index 91% rename from simd/jcgrammx.asm rename to simd/i386-mmx/jcgray.asm index 43ffd0f3..9863e74d 100644 --- a/simd/jcgrammx.asm +++ b/simd/i386-mmx/jcgray.asm @@ -1,5 +1,5 @@ ; -; jcgrammx.asm - grayscale colorspace conversion (MMX) +; jcgray.asm - grayscale colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2011 D. R. Commander @@ -47,7 +47,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -58,7 +58,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgb_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -69,7 +69,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgbx_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -80,7 +80,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgr_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -91,7 +91,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgrx_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -102,7 +102,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxbgr_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -113,4 +113,4 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxrgb_gray_convert_mmx -%include "jcgrymmx.asm" +%include "i386-mmx/jcgryext.asm" diff --git a/simd/jcgrymmx.asm b/simd/i386-mmx/jcgryext.asm similarity index 99% rename from simd/jcgrymmx.asm rename to simd/i386-mmx/jcgryext.asm index cbe56222..13b96008 100644 --- a/simd/jcgrymmx.asm +++ b/simd/i386-mmx/jcgryext.asm @@ -1,5 +1,5 @@ ; -; jcgrymmx.asm - grayscale colorspace conversion (MMX) +; jcgryext.asm - grayscale colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2011 D. R. Commander diff --git a/simd/jcsammmx.asm b/simd/i386-mmx/jcsample.asm similarity index 99% rename from simd/jcsammmx.asm rename to simd/i386-mmx/jcsample.asm index 9ab1518f..6881a56d 100644 --- a/simd/jcsammmx.asm +++ b/simd/i386-mmx/jcsample.asm @@ -1,5 +1,5 @@ ; -; jcsammmx.asm - downsampling (MMX) +; jcsample.asm - downsampling (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jdclrmmx.asm b/simd/i386-mmx/jdcolext.asm similarity index 99% rename from simd/jdclrmmx.asm rename to simd/i386-mmx/jdcolext.asm index bb1d2fa0..de1f00f1 100644 --- a/simd/jdclrmmx.asm +++ b/simd/i386-mmx/jdcolext.asm @@ -1,5 +1,5 @@ ; -; jdclrmmx.asm - colorspace conversion (MMX) +; jdcolext.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jdcolmmx.asm b/simd/i386-mmx/jdcolor.asm similarity index 92% rename from simd/jdcolmmx.asm rename to simd/i386-mmx/jdcolor.asm index d2966fe2..f2bc1bb3 100644 --- a/simd/jdcolmmx.asm +++ b/simd/i386-mmx/jdcolor.asm @@ -1,5 +1,5 @@ ; -; jdcolmmx.asm - colorspace conversion (MMX) +; jdcolor.asm - colorspace conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgb_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgbx_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgr_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgrx_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxbgr_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxrgb_convert_mmx -%include "jdclrmmx.asm" +%include "i386-mmx/jdcolext.asm" diff --git a/simd/jdmermmx.asm b/simd/i386-mmx/jdmerge.asm similarity index 93% rename from simd/jdmermmx.asm rename to simd/i386-mmx/jdmerge.asm index c2093c2c..84deaed9 100644 --- a/simd/jdmermmx.asm +++ b/simd/i386-mmx/jdmerge.asm @@ -1,5 +1,5 @@ ; -; jdmermmx.asm - merged upsampling/color conversion (MMX) +; jdmerge.asm - merged upsampling/color conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgb_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgbx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgbx_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgr_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgrx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgrx_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxbgr_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxrgb_merged_upsample_mmx -%include "jdmrgmmx.asm" +%include "i386-mmx/jdmrgext.asm" diff --git a/simd/jdmrgmmx.asm b/simd/i386-mmx/jdmrgext.asm similarity index 99% rename from simd/jdmrgmmx.asm rename to simd/i386-mmx/jdmrgext.asm index 136f12cf..a92e9341 100644 --- a/simd/jdmrgmmx.asm +++ b/simd/i386-mmx/jdmrgext.asm @@ -1,5 +1,5 @@ ; -; jdmrgmmx.asm - merged upsampling/color conversion (MMX) +; jdmrgext.asm - merged upsampling/color conversion (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jdsammmx.asm b/simd/i386-mmx/jdsample.asm similarity index 99% rename from simd/jdsammmx.asm rename to simd/i386-mmx/jdsample.asm index 823fe191..88564e43 100644 --- a/simd/jdsammmx.asm +++ b/simd/i386-mmx/jdsample.asm @@ -1,5 +1,5 @@ ; -; jdsammmx.asm - upsampling (MMX) +; jdsample.asm - upsampling (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfmmxfst.asm b/simd/i386-mmx/jfdctfst.asm similarity index 99% rename from simd/jfmmxfst.asm rename to simd/i386-mmx/jfdctfst.asm index d8cd4b9e..2c2d20c2 100644 --- a/simd/jfmmxfst.asm +++ b/simd/i386-mmx/jfdctfst.asm @@ -1,5 +1,5 @@ ; -; jfmmxfst.asm - fast integer FDCT (MMX) +; jfdctfst.asm - fast integer FDCT (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfmmxint.asm b/simd/i386-mmx/jfdctint.asm similarity index 99% rename from simd/jfmmxint.asm rename to simd/i386-mmx/jfdctint.asm index c16f2621..8536ae2c 100644 --- a/simd/jfmmxint.asm +++ b/simd/i386-mmx/jfdctint.asm @@ -1,5 +1,5 @@ ; -; jfmmxint.asm - accurate integer FDCT (MMX) +; jfdctint.asm - accurate integer FDCT (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jimmxfst.asm b/simd/i386-mmx/jidctfst.asm similarity index 99% rename from simd/jimmxfst.asm rename to simd/i386-mmx/jidctfst.asm index a9eaa02e..d97c02a2 100644 --- a/simd/jimmxfst.asm +++ b/simd/i386-mmx/jidctfst.asm @@ -1,5 +1,5 @@ ; -; jimmxfst.asm - fast integer IDCT (MMX) +; jidctfst.asm - fast integer IDCT (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jimmxint.asm b/simd/i386-mmx/jidctint.asm similarity index 99% rename from simd/jimmxint.asm rename to simd/i386-mmx/jidctint.asm index 75b9ea88..7e25b820 100644 --- a/simd/jimmxint.asm +++ b/simd/i386-mmx/jidctint.asm @@ -1,5 +1,5 @@ ; -; jimmxint.asm - accurate integer IDCT (MMX) +; jidctint.asm - accurate integer IDCT (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jimmxred.asm b/simd/i386-mmx/jidctred.asm similarity index 99% rename from simd/jimmxred.asm rename to simd/i386-mmx/jidctred.asm index 5e248369..1c939013 100644 --- a/simd/jimmxred.asm +++ b/simd/i386-mmx/jidctred.asm @@ -1,5 +1,5 @@ ; -; jimmxred.asm - reduced-size IDCT (MMX) +; jidctred.asm - reduced-size IDCT (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcqntmmx.asm b/simd/i386-mmx/jquant.asm similarity index 99% rename from simd/jcqntmmx.asm rename to simd/i386-mmx/jquant.asm index ae837d2b..822c7ee5 100644 --- a/simd/jcqntmmx.asm +++ b/simd/i386-mmx/jquant.asm @@ -1,5 +1,5 @@ ; -; jcqntmmx.asm - sample data conversion and quantization (MMX) +; jquant.asm - sample data conversion and quantization (MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfsseflt.asm b/simd/i386-sse/jfdctflt.asm similarity index 99% rename from simd/jfsseflt.asm rename to simd/i386-sse/jfdctflt.asm index 5ece3f46..477f5c83 100644 --- a/simd/jfsseflt.asm +++ b/simd/i386-sse/jfdctflt.asm @@ -1,5 +1,5 @@ ; -; jfsseflt.asm - floating-point FDCT (SSE) +; jfdctflt.asm - floating-point FDCT (SSE) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jisseflt.asm b/simd/i386-sse/jidctflt.asm similarity index 99% rename from simd/jisseflt.asm rename to simd/i386-sse/jidctflt.asm index 8b813555..6160e417 100644 --- a/simd/jisseflt.asm +++ b/simd/i386-sse/jidctflt.asm @@ -1,5 +1,5 @@ ; -; jisseflt.asm - floating-point IDCT (SSE & MMX) +; jidctflt.asm - floating-point IDCT (SSE & MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcqntsse.asm b/simd/i386-sse/jquant.asm similarity index 99% rename from simd/jcqntsse.asm rename to simd/i386-sse/jquant.asm index 2e32d0cb..3f7fa5d3 100644 --- a/simd/jcqntsse.asm +++ b/simd/i386-sse/jquant.asm @@ -1,5 +1,5 @@ ; -; jcqntsse.asm - sample data conversion and quantization (SSE & MMX) +; jquant.asm - sample data conversion and quantization (SSE & MMX) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcclrss2.asm b/simd/i386-sse2/jccolext.asm similarity index 99% rename from simd/jcclrss2.asm rename to simd/i386-sse2/jccolext.asm index 220d016f..cc38e98a 100644 --- a/simd/jcclrss2.asm +++ b/simd/i386-sse2/jccolext.asm @@ -1,5 +1,5 @@ ; -; jcclrss2.asm - colorspace conversion (SSE2) +; jccolext.asm - colorspace conversion (SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/simd/jccolss2.asm b/simd/i386-sse2/jccolor.asm similarity index 92% rename from simd/jccolss2.asm rename to simd/i386-sse2/jccolor.asm index 2b8faef7..9a9c0e60 100644 --- a/simd/jccolss2.asm +++ b/simd/i386-sse2/jccolor.asm @@ -1,5 +1,5 @@ ; -; jccolss2.asm - colorspace conversion (SSE2) +; jccolor.asm - colorspace conversion (SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 -%include "jcclrss2.asm" +%include "i386-sse2/jccolext.asm" diff --git a/simd/jcgrass2.asm b/simd/i386-sse2/jcgray.asm similarity index 91% rename from simd/jcgrass2.asm rename to simd/i386-sse2/jcgray.asm index f5bd93dd..b0211d09 100644 --- a/simd/jcgrass2.asm +++ b/simd/i386-sse2/jcgray.asm @@ -1,5 +1,5 @@ ; -; jcgrass2.asm - grayscale colorspace conversion (SSE2) +; jcgray.asm - grayscale colorspace conversion (SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -44,7 +44,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -55,7 +55,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -66,7 +66,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -77,7 +77,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -88,7 +88,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -110,4 +110,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 -%include "jcgryss2.asm" +%include "i386-sse2/jcgryext.asm" diff --git a/simd/jcgryss2.asm b/simd/i386-sse2/jcgryext.asm similarity index 99% rename from simd/jcgryss2.asm rename to simd/i386-sse2/jcgryext.asm index b5125c1b..1097b29d 100644 --- a/simd/jcgryss2.asm +++ b/simd/i386-sse2/jcgryext.asm @@ -1,5 +1,5 @@ ; -; jcgryss2.asm - grayscale colorspace conversion (SSE2) +; jcgryext.asm - grayscale colorspace conversion (SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/simd/jcsamss2.asm b/simd/i386-sse2/jcsample.asm similarity index 99% rename from simd/jcsamss2.asm rename to simd/i386-sse2/jcsample.asm index 73618435..11202dbf 100644 --- a/simd/jcsamss2.asm +++ b/simd/i386-sse2/jcsample.asm @@ -1,5 +1,5 @@ ; -; jcsamss2.asm - downsampling (SSE2) +; jcsample.asm - downsampling (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jdclrss2.asm b/simd/i386-sse2/jdcolext.asm similarity index 99% rename from simd/jdclrss2.asm rename to simd/i386-sse2/jdcolext.asm index 07b4fcf4..54ae4db5 100644 --- a/simd/jdclrss2.asm +++ b/simd/i386-sse2/jdcolext.asm @@ -1,5 +1,5 @@ ; -; jdclrss2.asm - colorspace conversion (SSE2) +; jdcolext.asm - colorspace conversion (SSE2) ; ; Copyright 2009, 2012 Pierre Ossman for Cendio AB ; Copyright 2012 D. R. Commander diff --git a/simd/jdcolss2.asm b/simd/i386-sse2/jdcolor.asm similarity index 92% rename from simd/jdcolss2.asm rename to simd/i386-sse2/jdcolor.asm index 38ed4164..1ea73169 100644 --- a/simd/jdcolss2.asm +++ b/simd/i386-sse2/jdcolor.asm @@ -1,5 +1,5 @@ ; -; jdcolss2.asm - colorspace conversion (SSE2) +; jdcolor.asm - colorspace conversion (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 -%include "jdclrss2.asm" +%include "i386-sse2/jdcolext.asm" diff --git a/simd/jdmerss2.asm b/simd/i386-sse2/jdmerge.asm similarity index 92% rename from simd/jdmerss2.asm rename to simd/i386-sse2/jdmerge.asm index 60d0ebb7..c9795051 100644 --- a/simd/jdmerss2.asm +++ b/simd/i386-sse2/jdmerge.asm @@ -1,5 +1,5 @@ ; -; jdmerss2.asm - merged upsampling/color conversion (SSE2) +; jdmerge.asm - merged upsampling/color conversion (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 -%include "jdmrgss2.asm" +%include "i386-sse2/jdmrgext.asm" diff --git a/simd/jdmrgss2.asm b/simd/i386-sse2/jdmrgext.asm similarity index 99% rename from simd/jdmrgss2.asm rename to simd/i386-sse2/jdmrgext.asm index 0206f62b..c47916f6 100644 --- a/simd/jdmrgss2.asm +++ b/simd/i386-sse2/jdmrgext.asm @@ -1,5 +1,5 @@ ; -; jdmrgss2.asm - merged upsampling/color conversion (SSE2) +; jdmrgext.asm - merged upsampling/color conversion (SSE2) ; ; Copyright 2009, 2012 Pierre Ossman for Cendio AB ; Copyright 2012 D. R. Commander diff --git a/simd/jdsamss2.asm b/simd/i386-sse2/jdsample.asm similarity index 99% rename from simd/jdsamss2.asm rename to simd/i386-sse2/jdsample.asm index 2259026b..51176d45 100644 --- a/simd/jdsamss2.asm +++ b/simd/i386-sse2/jdsample.asm @@ -1,5 +1,5 @@ ; -; jdsamss2.asm - upsampling (SSE2) +; jdsample.asm - upsampling (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfss2fst.asm b/simd/i386-sse2/jfdctfst.asm similarity index 99% rename from simd/jfss2fst.asm rename to simd/i386-sse2/jfdctfst.asm index 8bc05f4f..e6e4b72f 100644 --- a/simd/jfss2fst.asm +++ b/simd/i386-sse2/jfdctfst.asm @@ -1,5 +1,5 @@ ; -; jfss2fst.asm - fast integer FDCT (SSE2) +; jfdctfst.asm - fast integer FDCT (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfss2int.asm b/simd/i386-sse2/jfdctint.asm similarity index 99% rename from simd/jfss2int.asm rename to simd/i386-sse2/jfdctint.asm index d1bcb2ed..85133f80 100644 --- a/simd/jfss2int.asm +++ b/simd/i386-sse2/jfdctint.asm @@ -1,5 +1,5 @@ ; -; jfss2int.asm - accurate integer FDCT (SSE2) +; jfdctint.asm - accurate integer FDCT (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jiss2flt.asm b/simd/i386-sse2/jidctflt.asm similarity index 99% rename from simd/jiss2flt.asm rename to simd/i386-sse2/jidctflt.asm index 86c90561..de2cd1f6 100644 --- a/simd/jiss2flt.asm +++ b/simd/i386-sse2/jidctflt.asm @@ -1,5 +1,5 @@ ; -; jiss2flt.asm - floating-point IDCT (SSE & SSE2) +; jidctflt.asm - floating-point IDCT (SSE & SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jiss2fst.asm b/simd/i386-sse2/jidctfst.asm similarity index 99% rename from simd/jiss2fst.asm rename to simd/i386-sse2/jidctfst.asm index 0312be20..4658be3e 100644 --- a/simd/jiss2fst.asm +++ b/simd/i386-sse2/jidctfst.asm @@ -1,5 +1,5 @@ ; -; jiss2fst.asm - fast integer IDCT (SSE2) +; jidctfst.asm - fast integer IDCT (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jiss2int.asm b/simd/i386-sse2/jidctint.asm similarity index 99% rename from simd/jiss2int.asm rename to simd/i386-sse2/jidctint.asm index e78f5ffa..4a35f3df 100644 --- a/simd/jiss2int.asm +++ b/simd/i386-sse2/jidctint.asm @@ -1,5 +1,5 @@ ; -; jiss2int.asm - accurate integer IDCT (SSE2) +; jidctint.asm - accurate integer IDCT (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jiss2red.asm b/simd/i386-sse2/jidctred.asm similarity index 99% rename from simd/jiss2red.asm rename to simd/i386-sse2/jidctred.asm index 886d79d7..06dade8a 100644 --- a/simd/jiss2red.asm +++ b/simd/i386-sse2/jidctred.asm @@ -1,5 +1,5 @@ ; -; jiss2red.asm - reduced-size IDCT (SSE2) +; jidctred.asm - reduced-size IDCT (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcqnts2f.asm b/simd/i386-sse2/jquantf.asm similarity index 98% rename from simd/jcqnts2f.asm rename to simd/i386-sse2/jquantf.asm index 0df2df78..b1d3efcc 100644 --- a/simd/jcqnts2f.asm +++ b/simd/i386-sse2/jquantf.asm @@ -1,5 +1,5 @@ ; -; jcqnts2f.asm - sample data conversion and quantization (SSE & SSE2) +; jquantf.asm - sample data conversion and quantization (SSE & SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jcqnts2i.asm b/simd/i386-sse2/jquanti.asm similarity index 99% rename from simd/jcqnts2i.asm rename to simd/i386-sse2/jquanti.asm index 07cdc685..79ca3db4 100644 --- a/simd/jcqnts2i.asm +++ b/simd/i386-sse2/jquanti.asm @@ -1,5 +1,5 @@ ; -; jcqnts2i.asm - sample data conversion and quantization (SSE2) +; jquanti.asm - sample data conversion and quantization (SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; diff --git a/simd/jfsseflt-64.asm b/simd/x86_64-sse/jfdctflt.asm similarity index 99% rename from simd/jfsseflt-64.asm rename to simd/x86_64-sse/jfdctflt.asm index be2f5777..4184e95f 100644 --- a/simd/jfsseflt-64.asm +++ b/simd/x86_64-sse/jfdctflt.asm @@ -1,5 +1,5 @@ ; -; jfsseflt-64.asm - floating-point FDCT (64-bit SSE) +; jfdctflt.asm - floating-point FDCT (64-bit SSE) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jcclrss2-64.asm b/simd/x86_64-sse2/jccolext.asm similarity index 99% rename from simd/jcclrss2-64.asm rename to simd/x86_64-sse2/jccolext.asm index 1cdae27f..7bd6d016 100644 --- a/simd/jcclrss2-64.asm +++ b/simd/x86_64-sse2/jccolext.asm @@ -1,5 +1,5 @@ ; -; jcclrss2-64.asm - colorspace conversion (64-bit SSE2) +; jccolext.asm - colorspace conversion (64-bit SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/simd/jccolss2-64.asm b/simd/x86_64-sse2/jccolor.asm similarity index 91% rename from simd/jccolss2-64.asm rename to simd/x86_64-sse2/jccolor.asm index 5b1ee78a..0027ffd8 100644 --- a/simd/jccolss2-64.asm +++ b/simd/x86_64-sse2/jccolor.asm @@ -1,5 +1,5 @@ ; -; jccolss2-64.asm - colorspace conversion (64-bit SSE2) +; jccolor.asm - colorspace conversion (64-bit SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 64 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 -%include "jcclrss2-64.asm" +%include "x86_64-sse2/jccolext.asm" diff --git a/simd/jcgrass2-64.asm b/simd/x86_64-sse2/jcgray.asm similarity index 90% rename from simd/jcgrass2-64.asm rename to simd/x86_64-sse2/jcgray.asm index 39236ffd..bf3cd64f 100644 --- a/simd/jcgrass2-64.asm +++ b/simd/x86_64-sse2/jcgray.asm @@ -1,5 +1,5 @@ ; -; jcgrass2-64.asm - grayscale colorspace conversion (64-bit SSE2) +; jcgray.asm - grayscale colorspace conversion (64-bit SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -44,7 +44,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 64 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -55,7 +55,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -66,7 +66,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -77,7 +77,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -88,7 +88,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" %undef RGB_RED %undef RGB_GREEN @@ -110,4 +110,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 -%include "jcgryss2-64.asm" +%include "x86_64-sse2/jcgryext.asm" diff --git a/simd/jcgryss2-64.asm b/simd/x86_64-sse2/jcgryext.asm similarity index 99% rename from simd/jcgryss2-64.asm rename to simd/x86_64-sse2/jcgryext.asm index 2308129e..5af02e04 100644 --- a/simd/jcgryss2-64.asm +++ b/simd/x86_64-sse2/jcgryext.asm @@ -1,5 +1,5 @@ ; -; jcgryss2-64.asm - grayscale colorspace conversion (64-bit SSE2) +; jcgryext.asm - grayscale colorspace conversion (64-bit SSE2) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/simd/jcsamss2-64.asm b/simd/x86_64-sse2/jcsample.asm similarity index 99% rename from simd/jcsamss2-64.asm rename to simd/x86_64-sse2/jcsample.asm index 6c50d9c5..f32fb4fc 100644 --- a/simd/jcsamss2-64.asm +++ b/simd/x86_64-sse2/jcsample.asm @@ -1,5 +1,5 @@ ; -; jcsamss2-64.asm - downsampling (64-bit SSE2) +; jcsample.asm - downsampling (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jdclrss2-64.asm b/simd/x86_64-sse2/jdcolext.asm similarity index 99% rename from simd/jdclrss2-64.asm rename to simd/x86_64-sse2/jdcolext.asm index 88a9f1e4..bfd1f35d 100644 --- a/simd/jdclrss2-64.asm +++ b/simd/x86_64-sse2/jdcolext.asm @@ -1,5 +1,5 @@ ; -; jdclrss2-64.asm - colorspace conversion (64-bit SSE2) +; jdcolext.asm - colorspace conversion (64-bit SSE2) ; ; Copyright 2009, 2012 Pierre Ossman for Cendio AB ; Copyright 2009, 2012 D. R. Commander diff --git a/simd/jdcolss2-64.asm b/simd/x86_64-sse2/jdcolor.asm similarity index 91% rename from simd/jdcolss2-64.asm rename to simd/x86_64-sse2/jdcolor.asm index b484618d..bd733d73 100644 --- a/simd/jdcolss2-64.asm +++ b/simd/x86_64-sse2/jdcolor.asm @@ -1,5 +1,5 @@ ; -; jdcolss2-64.asm - colorspace conversion (64-bit SSE2) +; jdcolor.asm - colorspace conversion (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 64 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 -%include "jdclrss2-64.asm" +%include "x86_64-sse2/jdcolext.asm" diff --git a/simd/jdmerss2-64.asm b/simd/x86_64-sse2/jdmerge.asm similarity index 92% rename from simd/jdmerss2-64.asm rename to simd/x86_64-sse2/jdmerge.asm index 1f0b3398..3be0d27f 100644 --- a/simd/jdmerss2-64.asm +++ b/simd/x86_64-sse2/jdmerge.asm @@ -1,5 +1,5 @@ ; -; jdmerss2-64.asm - merged upsampling/color conversion (64-bit SSE2) +; jdmerge.asm - merged upsampling/color conversion (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 64 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 -%include "jdmrgss2-64.asm" +%include "x86_64-sse2/jdmrgext.asm" diff --git a/simd/jdmrgss2-64.asm b/simd/x86_64-sse2/jdmrgext.asm similarity index 99% rename from simd/jdmrgss2-64.asm rename to simd/x86_64-sse2/jdmrgext.asm index d0e1ea70..ff127b57 100644 --- a/simd/jdmrgss2-64.asm +++ b/simd/x86_64-sse2/jdmrgext.asm @@ -1,5 +1,5 @@ ; -; jdmrgss2-64.asm - merged upsampling/color conversion (64-bit SSE2) +; jdmrgext.asm - merged upsampling/color conversion (64-bit SSE2) ; ; Copyright 2009, 2012 Pierre Ossman for Cendio AB ; Copyright 2009, 2012 D. R. Commander diff --git a/simd/jdsamss2-64.asm b/simd/x86_64-sse2/jdsample.asm similarity index 99% rename from simd/jdsamss2-64.asm rename to simd/x86_64-sse2/jdsample.asm index a41d0593..335ce2aa 100644 --- a/simd/jdsamss2-64.asm +++ b/simd/x86_64-sse2/jdsample.asm @@ -1,5 +1,5 @@ ; -; jdsamss2-64.asm - upsampling (64-bit SSE2) +; jdsample.asm - upsampling (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jfss2fst-64.asm b/simd/x86_64-sse2/jfdctfst.asm similarity index 99% rename from simd/jfss2fst-64.asm rename to simd/x86_64-sse2/jfdctfst.asm index 41483bf6..13c4efc0 100644 --- a/simd/jfss2fst-64.asm +++ b/simd/x86_64-sse2/jfdctfst.asm @@ -1,5 +1,5 @@ ; -; jfss2fst-64.asm - fast integer FDCT (64-bit SSE2) +; jfdctfst.asm - fast integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jfss2int-64.asm b/simd/x86_64-sse2/jfdctint.asm similarity index 99% rename from simd/jfss2int-64.asm rename to simd/x86_64-sse2/jfdctint.asm index f5ec3465..53ec5276 100644 --- a/simd/jfss2int-64.asm +++ b/simd/x86_64-sse2/jfdctint.asm @@ -1,5 +1,5 @@ ; -; jfss2int-64.asm - accurate integer FDCT (64-bit SSE2) +; jfdctint.asm - accurate integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jiss2flt-64.asm b/simd/x86_64-sse2/jidctflt.asm similarity index 99% rename from simd/jiss2flt-64.asm rename to simd/x86_64-sse2/jidctflt.asm index 6d57a018..32e4ec22 100644 --- a/simd/jiss2flt-64.asm +++ b/simd/x86_64-sse2/jidctflt.asm @@ -1,5 +1,5 @@ ; -; jiss2flt-64.asm - floating-point IDCT (64-bit SSE & SSE2) +; jidctflt.asm - floating-point IDCT (64-bit SSE & SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jiss2fst-64.asm b/simd/x86_64-sse2/jidctfst.asm similarity index 99% rename from simd/jiss2fst-64.asm rename to simd/x86_64-sse2/jidctfst.asm index 432e289d..85669527 100644 --- a/simd/jiss2fst-64.asm +++ b/simd/x86_64-sse2/jidctfst.asm @@ -1,5 +1,5 @@ ; -; jiss2fst-64.asm - fast integer IDCT (64-bit SSE2) +; jidctfst.asm - fast integer IDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jiss2int-64.asm b/simd/x86_64-sse2/jidctint.asm similarity index 99% rename from simd/jiss2int-64.asm rename to simd/x86_64-sse2/jidctint.asm index 10e95213..32bbfd8d 100644 --- a/simd/jiss2int-64.asm +++ b/simd/x86_64-sse2/jidctint.asm @@ -1,5 +1,5 @@ ; -; jiss2int-64.asm - accurate integer IDCT (64-bit SSE2) +; jidctint.asm - accurate integer IDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jiss2red-64.asm b/simd/x86_64-sse2/jidctred.asm similarity index 99% rename from simd/jiss2red-64.asm rename to simd/x86_64-sse2/jidctred.asm index bd7c35c4..dad43d90 100644 --- a/simd/jiss2red-64.asm +++ b/simd/x86_64-sse2/jidctred.asm @@ -1,5 +1,5 @@ ; -; jiss2red-64.asm - reduced-size IDCT (64-bit SSE2) +; jidctred.asm - reduced-size IDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jcqnts2f-64.asm b/simd/x86_64-sse2/jquantf.asm similarity index 98% rename from simd/jcqnts2f-64.asm rename to simd/x86_64-sse2/jquantf.asm index 0752542f..20e815f7 100644 --- a/simd/jcqnts2f-64.asm +++ b/simd/x86_64-sse2/jquantf.asm @@ -1,5 +1,5 @@ ; -; jcqnts2f-64.asm - sample data conversion and quantization (64-bit SSE & SSE2) +; jquantf.asm - sample data conversion and quantization (64-bit SSE & SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander diff --git a/simd/jcqnts2i-64.asm b/simd/x86_64-sse2/jquanti.asm similarity index 98% rename from simd/jcqnts2i-64.asm rename to simd/x86_64-sse2/jquanti.asm index 5de8062f..50b8dce7 100644 --- a/simd/jcqnts2i-64.asm +++ b/simd/x86_64-sse2/jquanti.asm @@ -1,5 +1,5 @@ ; -; jcqnts2i-64.asm - sample data conversion and quantization (64-bit SSE2) +; jquanti.asm - sample data conversion and quantization (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB ; Copyright 2009 D. R. Commander From 1bd801a872dc4731ef110513caf1f5409b4916ec Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 10 May 2014 09:53:34 +0000 Subject: [PATCH 910/985] Using subdirectories unfortunately opened up a can of worms. In order to prevent object name conflicts, it is necessary to use the subdir-objects automake directive, but it simply doesn't work right on some of the versions of automake we still have to support. Another option would be to add a separate Makefile.am file to each subdirectory, but that requires maintaining a completely different set of build rules for each one. Fortunately, however, we're in the 21st century now, so we can use filenames longer than 8.3. --- simd/Makefile.am | 78 +++++++++---------- .../jccolext.asm => jccolext-mmx.asm} | 0 .../jccolext.asm => jccolext-sse2-64.asm} | 0 .../jccolext.asm => jccolext-sse2.asm} | 0 .../{i386-mmx/jccolor.asm => jccolor-mmx.asm} | 14 ++-- .../jccolor.asm => jccolor-sse2-64.asm} | 14 ++-- .../jccolor.asm => jccolor-sse2.asm} | 14 ++-- simd/{i386-mmx/jcgray.asm => jcgray-mmx.asm} | 14 ++-- .../jcgray.asm => jcgray-sse2-64.asm} | 14 ++-- .../{i386-sse2/jcgray.asm => jcgray-sse2.asm} | 14 ++-- .../jcgryext.asm => jcgryext-mmx.asm} | 0 .../jcgryext.asm => jcgryext-sse2-64.asm} | 0 .../jcgryext.asm => jcgryext-sse2.asm} | 0 .../jcsample.asm => jcsample-mmx.asm} | 0 .../jcsample.asm => jcsample-sse2-64.asm} | 0 .../jcsample.asm => jcsample-sse2.asm} | 0 .../jdcolext.asm => jdcolext-mmx.asm} | 0 .../jdcolext.asm => jdcolext-sse2-64.asm} | 0 .../jdcolext.asm => jdcolext-sse2.asm} | 0 .../{i386-mmx/jdcolor.asm => jdcolor-mmx.asm} | 14 ++-- .../jdcolor.asm => jdcolor-sse2-64.asm} | 14 ++-- .../jdcolor.asm => jdcolor-sse2.asm} | 14 ++-- .../{i386-mmx/jdmerge.asm => jdmerge-mmx.asm} | 14 ++-- .../jdmerge.asm => jdmerge-sse2-64.asm} | 14 ++-- .../jdmerge.asm => jdmerge-sse2.asm} | 14 ++-- .../jdmrgext.asm => jdmrgext-mmx.asm} | 0 .../jdmrgext.asm => jdmrgext-sse2-64.asm} | 0 .../jdmrgext.asm => jdmrgext-sse2.asm} | 0 .../jdsample.asm => jdsample-mmx.asm} | 0 .../jdsample.asm => jdsample-sse2-64.asm} | 0 .../jdsample.asm => jdsample-sse2.asm} | 0 .../jfdctflt.asm => jfdctflt-3dn.asm} | 0 .../jfdctflt.asm => jfdctflt-sse-64.asm} | 0 .../jfdctflt.asm => jfdctflt-sse.asm} | 0 .../jfdctfst.asm => jfdctfst-mmx.asm} | 0 .../jfdctfst.asm => jfdctfst-sse2-64.asm} | 0 .../jfdctfst.asm => jfdctfst-sse2.asm} | 0 .../jfdctint.asm => jfdctint-mmx.asm} | 0 .../jfdctint.asm => jfdctint-sse2-64.asm} | 0 .../jfdctint.asm => jfdctint-sse2.asm} | 0 .../jidctflt.asm => jidctflt-3dn.asm} | 0 .../jidctflt.asm => jidctflt-sse.asm} | 0 .../jidctflt.asm => jidctflt-sse2-64.asm} | 0 .../jidctflt.asm => jidctflt-sse2.asm} | 0 .../jidctfst.asm => jidctfst-mmx.asm} | 0 .../jidctfst.asm => jidctfst-sse2-64.asm} | 0 .../jidctfst.asm => jidctfst-sse2.asm} | 0 .../jidctint.asm => jidctint-mmx.asm} | 0 .../jidctint.asm => jidctint-sse2-64.asm} | 0 .../jidctint.asm => jidctint-sse2.asm} | 0 .../jidctred.asm => jidctred-mmx.asm} | 0 .../jidctred.asm => jidctred-sse2-64.asm} | 0 .../jidctred.asm => jidctred-sse2.asm} | 0 .../{i386-3dnow/jquant.asm => jquant-3dn.asm} | 0 simd/{i386-mmx/jquant.asm => jquant-mmx.asm} | 0 simd/{i386-sse/jquant.asm => jquant-sse.asm} | 0 .../jquantf.asm => jquantf-sse2-64.asm} | 0 .../jquantf.asm => jquantf-sse2.asm} | 0 .../jquanti.asm => jquanti-sse2-64.asm} | 0 .../jquanti.asm => jquanti-sse2.asm} | 0 60 files changed, 120 insertions(+), 126 deletions(-) rename simd/{i386-mmx/jccolext.asm => jccolext-mmx.asm} (100%) rename simd/{x86_64-sse2/jccolext.asm => jccolext-sse2-64.asm} (100%) rename simd/{i386-sse2/jccolext.asm => jccolext-sse2.asm} (100%) rename simd/{i386-mmx/jccolor.asm => jccolor-mmx.asm} (93%) rename simd/{x86_64-sse2/jccolor.asm => jccolor-sse2-64.asm} (93%) rename simd/{i386-sse2/jccolor.asm => jccolor-sse2.asm} (93%) rename simd/{i386-mmx/jcgray.asm => jcgray-mmx.asm} (93%) rename simd/{x86_64-sse2/jcgray.asm => jcgray-sse2-64.asm} (92%) rename simd/{i386-sse2/jcgray.asm => jcgray-sse2.asm} (92%) rename simd/{i386-mmx/jcgryext.asm => jcgryext-mmx.asm} (100%) rename simd/{x86_64-sse2/jcgryext.asm => jcgryext-sse2-64.asm} (100%) rename simd/{i386-sse2/jcgryext.asm => jcgryext-sse2.asm} (100%) rename simd/{i386-mmx/jcsample.asm => jcsample-mmx.asm} (100%) rename simd/{x86_64-sse2/jcsample.asm => jcsample-sse2-64.asm} (100%) rename simd/{i386-sse2/jcsample.asm => jcsample-sse2.asm} (100%) rename simd/{i386-mmx/jdcolext.asm => jdcolext-mmx.asm} (100%) rename simd/{x86_64-sse2/jdcolext.asm => jdcolext-sse2-64.asm} (100%) rename simd/{i386-sse2/jdcolext.asm => jdcolext-sse2.asm} (100%) rename simd/{i386-mmx/jdcolor.asm => jdcolor-mmx.asm} (93%) rename simd/{x86_64-sse2/jdcolor.asm => jdcolor-sse2-64.asm} (92%) rename simd/{i386-sse2/jdcolor.asm => jdcolor-sse2.asm} (93%) rename simd/{i386-mmx/jdmerge.asm => jdmerge-mmx.asm} (94%) rename simd/{x86_64-sse2/jdmerge.asm => jdmerge-sse2-64.asm} (93%) rename simd/{i386-sse2/jdmerge.asm => jdmerge-sse2.asm} (94%) rename simd/{i386-mmx/jdmrgext.asm => jdmrgext-mmx.asm} (100%) rename simd/{x86_64-sse2/jdmrgext.asm => jdmrgext-sse2-64.asm} (100%) rename simd/{i386-sse2/jdmrgext.asm => jdmrgext-sse2.asm} (100%) rename simd/{i386-mmx/jdsample.asm => jdsample-mmx.asm} (100%) rename simd/{x86_64-sse2/jdsample.asm => jdsample-sse2-64.asm} (100%) rename simd/{i386-sse2/jdsample.asm => jdsample-sse2.asm} (100%) rename simd/{i386-3dnow/jfdctflt.asm => jfdctflt-3dn.asm} (100%) rename simd/{x86_64-sse/jfdctflt.asm => jfdctflt-sse-64.asm} (100%) rename simd/{i386-sse/jfdctflt.asm => jfdctflt-sse.asm} (100%) rename simd/{i386-mmx/jfdctfst.asm => jfdctfst-mmx.asm} (100%) rename simd/{x86_64-sse2/jfdctfst.asm => jfdctfst-sse2-64.asm} (100%) rename simd/{i386-sse2/jfdctfst.asm => jfdctfst-sse2.asm} (100%) rename simd/{i386-mmx/jfdctint.asm => jfdctint-mmx.asm} (100%) rename simd/{x86_64-sse2/jfdctint.asm => jfdctint-sse2-64.asm} (100%) rename simd/{i386-sse2/jfdctint.asm => jfdctint-sse2.asm} (100%) rename simd/{i386-3dnow/jidctflt.asm => jidctflt-3dn.asm} (100%) rename simd/{i386-sse/jidctflt.asm => jidctflt-sse.asm} (100%) rename simd/{x86_64-sse2/jidctflt.asm => jidctflt-sse2-64.asm} (100%) rename simd/{i386-sse2/jidctflt.asm => jidctflt-sse2.asm} (100%) rename simd/{i386-mmx/jidctfst.asm => jidctfst-mmx.asm} (100%) rename simd/{x86_64-sse2/jidctfst.asm => jidctfst-sse2-64.asm} (100%) rename simd/{i386-sse2/jidctfst.asm => jidctfst-sse2.asm} (100%) rename simd/{i386-mmx/jidctint.asm => jidctint-mmx.asm} (100%) rename simd/{x86_64-sse2/jidctint.asm => jidctint-sse2-64.asm} (100%) rename simd/{i386-sse2/jidctint.asm => jidctint-sse2.asm} (100%) rename simd/{i386-mmx/jidctred.asm => jidctred-mmx.asm} (100%) rename simd/{x86_64-sse2/jidctred.asm => jidctred-sse2-64.asm} (100%) rename simd/{i386-sse2/jidctred.asm => jidctred-sse2.asm} (100%) rename simd/{i386-3dnow/jquant.asm => jquant-3dn.asm} (100%) rename simd/{i386-mmx/jquant.asm => jquant-mmx.asm} (100%) rename simd/{i386-sse/jquant.asm => jquant-sse.asm} (100%) rename simd/{x86_64-sse2/jquantf.asm => jquantf-sse2-64.asm} (100%) rename simd/{i386-sse2/jquantf.asm => jquantf-sse2.asm} (100%) rename simd/{x86_64-sse2/jquanti.asm => jquanti-sse2-64.asm} (100%) rename simd/{i386-sse2/jquanti.asm => jquanti-sse2.asm} (100%) diff --git a/simd/Makefile.am b/simd/Makefile.am index 4da172aa..f4d44c3b 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -3,58 +3,52 @@ noinst_LTLIBRARIES = libsimd.la BUILT_SOURCES = jsimdcfg.inc EXTRA_DIST = nasm_lt.sh CMakeLists.txt \ - i386-mmx/jccolext.asm i386-mmx/jcgryext.asm i386-mmx/jdcolext.asm \ - i386-mmx/jdmrgext.asm \ - i386-sse2/jccolext.asm i386-sse2/jcgryext.asm i386-sse2/jdcolext.asm \ - i386-sse2/jdmrgext.asm \ - x86_64-sse2/jccolext.asm x86_64-sse2/jcgryext.asm x86_64-sse2/jdcolext.asm \ - x86_64-sse2/jdmrgext.asm + jccolext-mmx.asm jcgryext-mmx.asm jdcolext-mmx.asm jdmrgext-mmx.asm \ + jccolext-sse2.asm jcgryext-sse2.asm jdcolext-sse2.asm jdmrgext-sse2.asm \ + jccolext-sse2-64.asm jcgryext-sse2-64.asm jdcolext-sse2-64.asm \ + jdmrgext-sse2-64.asm if SIMD_X86_64 -libsimd_la_SOURCES = jsimd_x86_64.c \ - jsimd.h jsimdcfg.inc.h \ - jsimdext.inc jcolsamp.inc jdct.inc \ - x86_64-sse/jfdctflt.asm x86_64-sse2/jcgray.asm \ - x86_64-sse2/jccolor.asm x86_64-sse2/jdcolor.asm \ - x86_64-sse2/jcsample.asm x86_64-sse2/jdsample.asm x86_64-sse2/jdmerge.asm \ - x86_64-sse2/jquanti.asm x86_64-sse2/jfdctfst.asm x86_64-sse2/jfdctint.asm \ - x86_64-sse2/jidctred.asm x86_64-sse2/jidctint.asm x86_64-sse2/jidctfst.asm \ - x86_64-sse2/jquantf.asm x86_64-sse2/jidctflt.asm +libsimd_la_SOURCES = jsimd_x86_64.c jsimd.h jsimdcfg.inc.h jsimdext.inc \ + jcolsamp.inc jdct.inc jfdctflt-sse-64.asm \ + jccolor-sse2-64.asm jcgray-sse2-64.asm jcsample-sse2-64.asm \ + jdcolor-sse2-64.asm jdmerge-sse2-64.asm jdsample-sse2-64.asm \ + jfdctfst-sse2-64.asm jfdctint-sse2-64.asm jidctflt-sse2-64.asm \ + jidctfst-sse2-64.asm jidctint-sse2-64.asm jidctred-sse2-64.asm \ + jquantf-sse2-64.asm jquanti-sse2-64.asm -x86_64-sse2/jccolor.lo: x86_64-sse2/jccolext.asm -x86_64-sse2/jcgray.lo: x86_64-sse2/jcgryext.asm -x86_64-sse2/jdcolor.lo: x86_64-sse2/jdcolext.asm -x86_64-sse2/jdmerge.lo: x86_64-sse2/jdmrgext.asm +jccolor-sse2-64.lo: jccolext-sse2-64.asm +jcgray-sse2-64.lo: jcgryext-sse2-64.asm +jdcolor-sse2-64.lo: jdcolext-sse2-64.asm +jdmerge-sse2-64.lo: jdmrgext-sse2-64.asm endif if SIMD_I386 -libsimd_la_SOURCES = jsimd_i386.c \ - jsimd.h jsimdcfg.inc.h \ - jsimdext.inc jcolsamp.inc jdct.inc \ - jsimdcpu.asm \ - i386-mmx/jccolor.asm i386-mmx/jdcolor.asm i386-mmx/jcgray.asm \ - i386-mmx/jcsample.asm i386-mmx/jdsample.asm i386-mmx/jdmerge.asm \ - i386-mmx/jquant.asm i386-mmx/jfdctfst.asm i386-mmx/jfdctint.asm \ - i386-mmx/jidctred.asm i386-mmx/jidctint.asm i386-mmx/jidctfst.asm \ - i386-3dnow/jquant.asm i386-3dnow/jfdctflt.asm i386-3dnow/jidctflt.asm \ - i386-sse/jquant.asm i386-sse/jfdctflt.asm i386-sse/jidctflt.asm \ - i386-sse2/jccolor.asm i386-sse2/jdcolor.asm i386-sse2/jcgray.asm \ - i386-sse2/jcsample.asm i386-sse2/jdsample.asm i386-sse2/jdmerge.asm \ - i386-sse2/jquanti.asm i386-sse2/jfdctfst.asm i386-sse2/jfdctint.asm \ - i386-sse2/jidctred.asm i386-sse2/jidctint.asm i386-sse2/jidctfst.asm \ - i386-sse2/jquantf.asm i386-sse2/jidctflt.asm +libsimd_la_SOURCES = jsimd_i386.c jsimd.h jsimdcfg.inc.h jsimdext.inc \ + jcolsamp.inc jdct.inc jsimdcpu.asm \ + jfdctflt-3dn.asm jidctflt-3dn.asm jquant-3dn.asm \ + jccolor-mmx.asm jcgray-mmx.asm jcsample-mmx.asm \ + jdcolor-mmx.asm jdmerge-mmx.asm jdsample-mmx.asm \ + jfdctfst-mmx.asm jfdctint-mmx.asm jidctfst-mmx.asm \ + jidctint-mmx.asm jidctred-mmx.asm jquant-mmx.asm \ + jfdctflt-sse.asm jidctflt-sse.asm jquant-sse.asm \ + jccolor-sse2.asm jcgray-sse2.asm jcsample-sse2.asm \ + jdcolor-sse2.asm jdmerge-sse2.asm jdsample-sse2.asm \ + jfdctfst-sse2.asm jfdctint-sse2.asm jidctflt-sse2.asm \ + jidctfst-sse2.asm jidctint-sse2.asm jidctred-sse2.asm \ + jquantf-sse2.asm jquanti-sse2.asm -i386-mmx/jccolor.lo: i386-mmx/jccolext.asm -i386-mmx/jcgray.lo: i386-mmx/jcgryext.asm -i386-mmx/jdcolor.lo: i386-mmx/jdcolext.asm -i386-mmx/jdmerge.lo: i386-mmx/jdmrgext.asm -i386-sse2/jccolor.lo: i386-sse2/jccolext.asm -i386-sse2/jcgray.lo: i386-sse2/jcgryext.asm -i386-sse2/jdcolor.lo: i386-sse2/jdcolext.asm -i386-sse2/jdmerge.lo: i386-sse2/jdmrgext.asm +jccolor-mmx.lo: jccolext-mmx.asm +jcgray.-mmx.lo: jcgryext-mmx.asm +jdcolor-mmx.lo: jdcolext-mmx.asm +jdmerge-mmx.lo: jdmrgext-mmx.asm +jccolor-sse2.lo: jccolext-sse2.asm +jcgray-sse2.lo: jcgryext-sse2.asm +jdcolor-sse2.lo: jdcolext-sse2.asm +jdmerge-sse2.lo: jdmrgext-sse2.asm endif diff --git a/simd/i386-mmx/jccolext.asm b/simd/jccolext-mmx.asm similarity index 100% rename from simd/i386-mmx/jccolext.asm rename to simd/jccolext-mmx.asm diff --git a/simd/x86_64-sse2/jccolext.asm b/simd/jccolext-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jccolext.asm rename to simd/jccolext-sse2-64.asm diff --git a/simd/i386-sse2/jccolext.asm b/simd/jccolext-sse2.asm similarity index 100% rename from simd/i386-sse2/jccolext.asm rename to simd/jccolext-sse2.asm diff --git a/simd/i386-mmx/jccolor.asm b/simd/jccolor-mmx.asm similarity index 93% rename from simd/i386-mmx/jccolor.asm rename to simd/jccolor-mmx.asm index 85e17e11..c5d37644 100644 --- a/simd/i386-mmx/jccolor.asm +++ b/simd/jccolor-mmx.asm @@ -54,7 +54,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -65,7 +65,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgb_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -76,7 +76,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extrgbx_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgr_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -98,7 +98,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extbgrx_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -109,7 +109,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxbgr_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -120,4 +120,4 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_mmx jsimd_extxrgb_ycc_convert_mmx -%include "i386-mmx/jccolext.asm" +%include "jccolext-mmx.asm" diff --git a/simd/x86_64-sse2/jccolor.asm b/simd/jccolor-sse2-64.asm similarity index 93% rename from simd/x86_64-sse2/jccolor.asm rename to simd/jccolor-sse2-64.asm index 0027ffd8..55c7e12e 100644 --- a/simd/x86_64-sse2/jccolor.asm +++ b/simd/jccolor-sse2-64.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 64 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 -%include "x86_64-sse2/jccolext.asm" +%include "jccolext-sse2-64.asm" diff --git a/simd/i386-sse2/jccolor.asm b/simd/jccolor-sse2.asm similarity index 93% rename from simd/i386-sse2/jccolor.asm rename to simd/jccolor-sse2.asm index 9a9c0e60..890e2a3b 100644 --- a/simd/i386-sse2/jccolor.asm +++ b/simd/jccolor-sse2.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2 -%include "i386-sse2/jccolext.asm" +%include "jccolext-sse2.asm" diff --git a/simd/i386-mmx/jcgray.asm b/simd/jcgray-mmx.asm similarity index 93% rename from simd/i386-mmx/jcgray.asm rename to simd/jcgray-mmx.asm index 9863e74d..b2708ad4 100644 --- a/simd/i386-mmx/jcgray.asm +++ b/simd/jcgray-mmx.asm @@ -47,7 +47,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -58,7 +58,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgb_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -69,7 +69,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extrgbx_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -80,7 +80,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgr_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -91,7 +91,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extbgrx_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -102,7 +102,7 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxbgr_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -113,4 +113,4 @@ PD_ONEHALF times 2 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_mmx jsimd_extxrgb_gray_convert_mmx -%include "i386-mmx/jcgryext.asm" +%include "jcgryext-mmx.asm" diff --git a/simd/x86_64-sse2/jcgray.asm b/simd/jcgray-sse2-64.asm similarity index 92% rename from simd/x86_64-sse2/jcgray.asm rename to simd/jcgray-sse2-64.asm index bf3cd64f..dfc05776 100644 --- a/simd/x86_64-sse2/jcgray.asm +++ b/simd/jcgray-sse2-64.asm @@ -44,7 +44,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 64 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -55,7 +55,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -66,7 +66,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -77,7 +77,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -88,7 +88,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -110,4 +110,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 -%include "x86_64-sse2/jcgryext.asm" +%include "jcgryext-sse2-64.asm" diff --git a/simd/i386-sse2/jcgray.asm b/simd/jcgray-sse2.asm similarity index 92% rename from simd/i386-sse2/jcgray.asm rename to simd/jcgray-sse2.asm index b0211d09..5fa72736 100644 --- a/simd/i386-sse2/jcgray.asm +++ b/simd/jcgray-sse2.asm @@ -44,7 +44,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) SECTION SEG_TEXT BITS 32 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -55,7 +55,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -66,7 +66,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -77,7 +77,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -88,7 +88,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -110,4 +110,4 @@ PD_ONEHALF times 4 dd (1 << (SCALEBITS-1)) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2 -%include "i386-sse2/jcgryext.asm" +%include "jcgryext-sse2.asm" diff --git a/simd/i386-mmx/jcgryext.asm b/simd/jcgryext-mmx.asm similarity index 100% rename from simd/i386-mmx/jcgryext.asm rename to simd/jcgryext-mmx.asm diff --git a/simd/x86_64-sse2/jcgryext.asm b/simd/jcgryext-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jcgryext.asm rename to simd/jcgryext-sse2-64.asm diff --git a/simd/i386-sse2/jcgryext.asm b/simd/jcgryext-sse2.asm similarity index 100% rename from simd/i386-sse2/jcgryext.asm rename to simd/jcgryext-sse2.asm diff --git a/simd/i386-mmx/jcsample.asm b/simd/jcsample-mmx.asm similarity index 100% rename from simd/i386-mmx/jcsample.asm rename to simd/jcsample-mmx.asm diff --git a/simd/x86_64-sse2/jcsample.asm b/simd/jcsample-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jcsample.asm rename to simd/jcsample-sse2-64.asm diff --git a/simd/i386-sse2/jcsample.asm b/simd/jcsample-sse2.asm similarity index 100% rename from simd/i386-sse2/jcsample.asm rename to simd/jcsample-sse2.asm diff --git a/simd/i386-mmx/jdcolext.asm b/simd/jdcolext-mmx.asm similarity index 100% rename from simd/i386-mmx/jdcolext.asm rename to simd/jdcolext-mmx.asm diff --git a/simd/x86_64-sse2/jdcolext.asm b/simd/jdcolext-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jdcolext.asm rename to simd/jdcolext-sse2-64.asm diff --git a/simd/i386-sse2/jdcolext.asm b/simd/jdcolext-sse2.asm similarity index 100% rename from simd/i386-sse2/jdcolext.asm rename to simd/jdcolext-sse2.asm diff --git a/simd/i386-mmx/jdcolor.asm b/simd/jdcolor-mmx.asm similarity index 93% rename from simd/i386-mmx/jdcolor.asm rename to simd/jdcolor-mmx.asm index f2bc1bb3..6730e485 100644 --- a/simd/i386-mmx/jdcolor.asm +++ b/simd/jdcolor-mmx.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgb_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgbx_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgr_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgrx_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxbgr_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxrgb_convert_mmx -%include "i386-mmx/jdcolext.asm" +%include "jdcolext-mmx.asm" diff --git a/simd/x86_64-sse2/jdcolor.asm b/simd/jdcolor-sse2-64.asm similarity index 92% rename from simd/x86_64-sse2/jdcolor.asm rename to simd/jdcolor-sse2-64.asm index bd733d73..e9277f1d 100644 --- a/simd/x86_64-sse2/jdcolor.asm +++ b/simd/jdcolor-sse2-64.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 64 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 -%include "x86_64-sse2/jdcolext.asm" +%include "jdcolext-sse2-64.asm" diff --git a/simd/i386-sse2/jdcolor.asm b/simd/jdcolor-sse2.asm similarity index 93% rename from simd/i386-sse2/jdcolor.asm rename to simd/jdcolor-sse2.asm index 1ea73169..c122cc75 100644 --- a/simd/i386-sse2/jdcolor.asm +++ b/simd/jdcolor-sse2.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -62,7 +62,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGB_BLUE %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -73,7 +73,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_RGBX_BLUE %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -84,7 +84,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGR_BLUE %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -95,7 +95,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_BGRX_BLUE %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -106,7 +106,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XBGR_BLUE %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -117,4 +117,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_BLUE EXT_XRGB_BLUE %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2 -%include "i386-sse2/jdcolext.asm" +%include "jdcolext-sse2.asm" diff --git a/simd/i386-mmx/jdmerge.asm b/simd/jdmerge-mmx.asm similarity index 94% rename from simd/i386-mmx/jdmerge.asm rename to simd/jdmerge-mmx.asm index 84deaed9..2daa7faf 100644 --- a/simd/i386-mmx/jdmerge.asm +++ b/simd/jdmerge-mmx.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgb_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgbx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgbx_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgr_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgrx_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgrx_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxbgr_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxbgr_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 2 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxrgb_merged_upsample_mmx %define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxrgb_merged_upsample_mmx -%include "i386-mmx/jdmrgext.asm" +%include "jdmrgext-mmx.asm" diff --git a/simd/x86_64-sse2/jdmerge.asm b/simd/jdmerge-sse2-64.asm similarity index 93% rename from simd/x86_64-sse2/jdmerge.asm rename to simd/jdmerge-sse2-64.asm index 3be0d27f..8f953c71 100644 --- a/simd/x86_64-sse2/jdmerge.asm +++ b/simd/jdmerge-sse2-64.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 64 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 -%include "x86_64-sse2/jdmrgext.asm" +%include "jdmrgext-sse2-64.asm" diff --git a/simd/i386-sse2/jdmerge.asm b/simd/jdmerge-sse2.asm similarity index 94% rename from simd/i386-sse2/jdmerge.asm rename to simd/jdmerge-sse2.asm index c9795051..d22e8281 100644 --- a/simd/i386-sse2/jdmerge.asm +++ b/simd/jdmerge-sse2.asm @@ -51,7 +51,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) SECTION SEG_TEXT BITS 32 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -63,7 +63,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -75,7 +75,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -87,7 +87,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -99,7 +99,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -111,7 +111,7 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" %undef RGB_RED %undef RGB_GREEN @@ -123,4 +123,4 @@ PD_ONEHALF times 4 dd 1 << (SCALEBITS-1) %define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE %define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2 %define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2 -%include "i386-sse2/jdmrgext.asm" +%include "jdmrgext-sse2.asm" diff --git a/simd/i386-mmx/jdmrgext.asm b/simd/jdmrgext-mmx.asm similarity index 100% rename from simd/i386-mmx/jdmrgext.asm rename to simd/jdmrgext-mmx.asm diff --git a/simd/x86_64-sse2/jdmrgext.asm b/simd/jdmrgext-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jdmrgext.asm rename to simd/jdmrgext-sse2-64.asm diff --git a/simd/i386-sse2/jdmrgext.asm b/simd/jdmrgext-sse2.asm similarity index 100% rename from simd/i386-sse2/jdmrgext.asm rename to simd/jdmrgext-sse2.asm diff --git a/simd/i386-mmx/jdsample.asm b/simd/jdsample-mmx.asm similarity index 100% rename from simd/i386-mmx/jdsample.asm rename to simd/jdsample-mmx.asm diff --git a/simd/x86_64-sse2/jdsample.asm b/simd/jdsample-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jdsample.asm rename to simd/jdsample-sse2-64.asm diff --git a/simd/i386-sse2/jdsample.asm b/simd/jdsample-sse2.asm similarity index 100% rename from simd/i386-sse2/jdsample.asm rename to simd/jdsample-sse2.asm diff --git a/simd/i386-3dnow/jfdctflt.asm b/simd/jfdctflt-3dn.asm similarity index 100% rename from simd/i386-3dnow/jfdctflt.asm rename to simd/jfdctflt-3dn.asm diff --git a/simd/x86_64-sse/jfdctflt.asm b/simd/jfdctflt-sse-64.asm similarity index 100% rename from simd/x86_64-sse/jfdctflt.asm rename to simd/jfdctflt-sse-64.asm diff --git a/simd/i386-sse/jfdctflt.asm b/simd/jfdctflt-sse.asm similarity index 100% rename from simd/i386-sse/jfdctflt.asm rename to simd/jfdctflt-sse.asm diff --git a/simd/i386-mmx/jfdctfst.asm b/simd/jfdctfst-mmx.asm similarity index 100% rename from simd/i386-mmx/jfdctfst.asm rename to simd/jfdctfst-mmx.asm diff --git a/simd/x86_64-sse2/jfdctfst.asm b/simd/jfdctfst-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jfdctfst.asm rename to simd/jfdctfst-sse2-64.asm diff --git a/simd/i386-sse2/jfdctfst.asm b/simd/jfdctfst-sse2.asm similarity index 100% rename from simd/i386-sse2/jfdctfst.asm rename to simd/jfdctfst-sse2.asm diff --git a/simd/i386-mmx/jfdctint.asm b/simd/jfdctint-mmx.asm similarity index 100% rename from simd/i386-mmx/jfdctint.asm rename to simd/jfdctint-mmx.asm diff --git a/simd/x86_64-sse2/jfdctint.asm b/simd/jfdctint-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jfdctint.asm rename to simd/jfdctint-sse2-64.asm diff --git a/simd/i386-sse2/jfdctint.asm b/simd/jfdctint-sse2.asm similarity index 100% rename from simd/i386-sse2/jfdctint.asm rename to simd/jfdctint-sse2.asm diff --git a/simd/i386-3dnow/jidctflt.asm b/simd/jidctflt-3dn.asm similarity index 100% rename from simd/i386-3dnow/jidctflt.asm rename to simd/jidctflt-3dn.asm diff --git a/simd/i386-sse/jidctflt.asm b/simd/jidctflt-sse.asm similarity index 100% rename from simd/i386-sse/jidctflt.asm rename to simd/jidctflt-sse.asm diff --git a/simd/x86_64-sse2/jidctflt.asm b/simd/jidctflt-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jidctflt.asm rename to simd/jidctflt-sse2-64.asm diff --git a/simd/i386-sse2/jidctflt.asm b/simd/jidctflt-sse2.asm similarity index 100% rename from simd/i386-sse2/jidctflt.asm rename to simd/jidctflt-sse2.asm diff --git a/simd/i386-mmx/jidctfst.asm b/simd/jidctfst-mmx.asm similarity index 100% rename from simd/i386-mmx/jidctfst.asm rename to simd/jidctfst-mmx.asm diff --git a/simd/x86_64-sse2/jidctfst.asm b/simd/jidctfst-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jidctfst.asm rename to simd/jidctfst-sse2-64.asm diff --git a/simd/i386-sse2/jidctfst.asm b/simd/jidctfst-sse2.asm similarity index 100% rename from simd/i386-sse2/jidctfst.asm rename to simd/jidctfst-sse2.asm diff --git a/simd/i386-mmx/jidctint.asm b/simd/jidctint-mmx.asm similarity index 100% rename from simd/i386-mmx/jidctint.asm rename to simd/jidctint-mmx.asm diff --git a/simd/x86_64-sse2/jidctint.asm b/simd/jidctint-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jidctint.asm rename to simd/jidctint-sse2-64.asm diff --git a/simd/i386-sse2/jidctint.asm b/simd/jidctint-sse2.asm similarity index 100% rename from simd/i386-sse2/jidctint.asm rename to simd/jidctint-sse2.asm diff --git a/simd/i386-mmx/jidctred.asm b/simd/jidctred-mmx.asm similarity index 100% rename from simd/i386-mmx/jidctred.asm rename to simd/jidctred-mmx.asm diff --git a/simd/x86_64-sse2/jidctred.asm b/simd/jidctred-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jidctred.asm rename to simd/jidctred-sse2-64.asm diff --git a/simd/i386-sse2/jidctred.asm b/simd/jidctred-sse2.asm similarity index 100% rename from simd/i386-sse2/jidctred.asm rename to simd/jidctred-sse2.asm diff --git a/simd/i386-3dnow/jquant.asm b/simd/jquant-3dn.asm similarity index 100% rename from simd/i386-3dnow/jquant.asm rename to simd/jquant-3dn.asm diff --git a/simd/i386-mmx/jquant.asm b/simd/jquant-mmx.asm similarity index 100% rename from simd/i386-mmx/jquant.asm rename to simd/jquant-mmx.asm diff --git a/simd/i386-sse/jquant.asm b/simd/jquant-sse.asm similarity index 100% rename from simd/i386-sse/jquant.asm rename to simd/jquant-sse.asm diff --git a/simd/x86_64-sse2/jquantf.asm b/simd/jquantf-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jquantf.asm rename to simd/jquantf-sse2-64.asm diff --git a/simd/i386-sse2/jquantf.asm b/simd/jquantf-sse2.asm similarity index 100% rename from simd/i386-sse2/jquantf.asm rename to simd/jquantf-sse2.asm diff --git a/simd/x86_64-sse2/jquanti.asm b/simd/jquanti-sse2-64.asm similarity index 100% rename from simd/x86_64-sse2/jquanti.asm rename to simd/jquanti-sse2-64.asm diff --git a/simd/i386-sse2/jquanti.asm b/simd/jquanti-sse2.asm similarity index 100% rename from simd/i386-sse2/jquanti.asm rename to simd/jquanti-sse2.asm From 84f9fbfe3ec2510d6e0e2aadd326e846dcb05569 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 10 May 2014 10:10:03 +0000 Subject: [PATCH 911/985] Modify Windows build system to take into account new assembly file names --- simd/CMakeLists.txt | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt index fc2ce992..4ec5ade0 100755 --- a/simd/CMakeLists.txt +++ b/simd/CMakeLists.txt @@ -18,16 +18,18 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug" endif() if(SIMD_X86_64) - set(SIMD_BASENAMES jfsseflt-64 jccolss2-64 jdcolss2-64 jcgrass2-64 - jcsamss2-64 jdsamss2-64 jdmerss2-64 jcqnts2i-64 jfss2fst-64 jfss2int-64 - jiss2red-64 jiss2int-64 jiss2fst-64 jcqnts2f-64 jiss2flt-64) + set(SIMD_BASENAMES jfdctflt-sse-64 jccolor-sse2-64 jcgray-sse2-64 + jcsample-sse2-64 jdcolor-sse2-64 jdmerge-sse2-64 jdsample-sse2-64 + jfdctfst-sse2-64 jfdctint-sse2-64 jidctflt-sse2-64 jidctfst-sse2-64 + jidctint-sse2-64 jidctred-sse2-64 jquantf-sse2-64 jquanti-sse2-64) message(STATUS "Building x86_64 SIMD extensions") else() - set(SIMD_BASENAMES jsimdcpu jccolmmx jcgrammx jdcolmmx jcsammmx jdsammmx - jdmermmx jcqntmmx jfmmxfst jfmmxint jimmxred jimmxint jimmxfst jcqnt3dn - jf3dnflt ji3dnflt jcqntsse jfsseflt jisseflt jccolss2 jcgrass2 jdcolss2 - jcsamss2 jdsamss2 jdmerss2 jcqnts2i jfss2fst jfss2int jiss2red jiss2int - jiss2fst jcqnts2f jiss2flt) + set(SIMD_BASENAMES jsimdcpu jfdctflt-3dn jidctflt-3dn jquant-3dn jccolor-mmx + jcgray-mmx jcsample-mmx jdcolor-mmx jdmerge-mmx jdsample-mmx jfdctfst-mmx + jfdctint-mmx jidctfst-mmx jidctint-mmx jidctred-mmx jquant-mmx jfdctflt-sse + jidctflt-sse jquant-sse jccolor-sse2 jcgray-sse2 jcsample-sse2 jdcolor-sse2 + jdmerge-sse2 jdsample-sse2 jfdctfst-sse2 jfdctint-sse2 jidctflt-sse2 + jidctfst-sse2 jidctint-sse2 jidctred-sse2 jquantf-sse2 jquanti-sse2) message(STATUS "Building i386 SIMD extensions") endif() @@ -42,19 +44,24 @@ file(GLOB INC_FILES *.inc) foreach(file ${SIMD_BASENAMES}) set(DEPFILE "") set(SIMD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${file}.asm) - if(${file} MATCHES col) + if(${file} MATCHES jccolor) set(DEPFILE ${file}) - string(REGEX REPLACE "col" "clr" DEPFILE ${DEPFILE}) + string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${DEPFILE}) set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) endif() - if(${file} MATCHES mer) + if(${file} MATCHES jcgray) set(DEPFILE ${file}) - string(REGEX REPLACE "mer" "mrg" DEPFILE ${DEPFILE}) + string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${DEPFILE}) set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) endif() - if(${file} MATCHES gra) + if(${file} MATCHES jdcolor) set(DEPFILE ${file}) - string(REGEX REPLACE "gra" "gry" DEPFILE ${DEPFILE}) + string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${DEPFILE}) + set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) + endif() + if(${file} MATCHES jdmerge) + set(DEPFILE ${file}) + string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${DEPFILE}) set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) endif() set(SIMD_OBJ ${OBJDIR}/${file}.obj) From e7fe0653e51c107ce20c875e6e1831770c1445a4 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 11 May 2014 09:48:11 +0000 Subject: [PATCH 912/985] Provide a more thorough description of the trade-offs between the various DCT/IDCT algorithms, based on new resarch --- README-turbo.txt | 22 +++++++++++----- cjpeg.1 | 23 +++++++++++----- djpeg.1 | 26 +++++++++++++----- libjpeg.txt | 55 +++++++++++++++++++++++++++++++-------- usage.txt | 68 ++++++++++++++++++++++++++++++++++-------------- 5 files changed, 144 insertions(+), 50 deletions(-) diff --git a/README-turbo.txt b/README-turbo.txt index 24e86ed2..944e1b94 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -294,10 +294,16 @@ details. For the most part, libjpeg-turbo should produce identical output to libjpeg v6b. The one exception to this is when using the floating point DCT/IDCT, in -which case the outputs of libjpeg v6b and libjpeg-turbo are not guaranteed to -be identical (the accuracy of the floating point DCT/IDCT is constant when -using libjpeg-turbo's SIMD extensions, but otherwise, it can depend heavily on -the compiler and compiler settings.) +which case the outputs of libjpeg v6b and libjpeg-turbo can differ for the +following reasons: + +-- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever so + slightly more accurate than the implementation in libjpeg v6b, but not by + any amount perceptible to human vision (generally in the range of 0.01 to + 0.08 dB gain in PNSR.) +-- When not using the SIMD extensions, then the accuracy of the floating point + DCT/IDCT can depend on the compiler and compiler settings. + While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood, it is still using the same algorithms as libjpeg v6b, so there are several specific @@ -305,12 +311,14 @@ cases in which libjpeg-turbo cannot be expected to produce the same output as libjpeg v8: -- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8 - implements those scaling algorithms a bit differently than libjpeg v6b does, - and libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior. + implements those scaling algorithms differently than libjpeg v6b does, and + libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior. -- When using chrominance subsampling, because libjpeg v8 implements this with its DCT/IDCT scaling algorithms rather than with a separate - downsampling/upsampling algorithm. + downsampling/upsampling algorithm. In our testing, the subsampled/upsampled + output of libjpeg v8 is less accurate than that of libjpeg v6b for this + reason. -- When using the floating point IDCT, for the reasons stated above and also because the floating point IDCT algorithm was modified in libjpeg v8a to diff --git a/cjpeg.1 b/cjpeg.1 index 113efd52..b4edf623 100644 --- a/cjpeg.1 +++ b/cjpeg.1 @@ -1,4 +1,4 @@ -.TH CJPEG 1 "18 January 2013" +.TH CJPEG 1 "11 May 2014" .SH NAME cjpeg \- compress an image file to a JPEG file .SH SYNOPSIS @@ -166,14 +166,25 @@ Use integer DCT method (default). .TP .B \-dct fast Use fast integer DCT (less accurate). +In libjpeg-turbo, the fast method is generally about 5-15% faster than the int +method when using the x86/x86-64 SIMD extensions (results may vary with other +SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) +For quality levels of 90 and below, there should be little or no perceptible +difference between the two algorithms. For quality levels above 90, however, +the difference between the fast and the int methods becomes more pronounced. +With quality=97, for instance, the fast method incurs generally about a 1-3 dB +loss (in PSNR) relative to the int method, but this can be larger for some +images. Do not use the fast method with quality levels above 97. The +algorithm often degenerates at quality=98 and above and can actually produce a +more lossy image than if lower quality levels had been used. .TP .B \-dct float Use floating-point DCT method. -The float method is very slightly more accurate than the int method, but is -much slower unless your machine has very fast floating-point hardware. Also -note that results of the floating-point method may vary slightly across -machines, while the integer methods should give the same results everywhere. -The fast integer method is much less accurate than the other two. +The float method is mostly a legacy feature. It does not produce significantly +more accurate results than the int method, and it is much slower. The float +method may also give different results on different machines due to varying +roundoff behavior, whereas the integer methods should give the same results on +all machines. .TP .BI \-restart " N" Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is diff --git a/djpeg.1 b/djpeg.1 index 8bb7d278..d77e7edd 100644 --- a/djpeg.1 +++ b/djpeg.1 @@ -1,4 +1,4 @@ -.TH DJPEG 1 "18 January 2013" +.TH DJPEG 1 "11 May 2014" .SH NAME djpeg \- decompress a JPEG file to an image file .SH SYNOPSIS @@ -115,14 +115,28 @@ Use integer DCT method (default). .TP .B \-dct fast Use fast integer DCT (less accurate). +In libjpeg-turbo, the fast method is generally about 5-15% faster than the int +method when using the x86/x86-64 SIMD extensions (results may vary with other +SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) If +the JPEG image was compressed using a quality level of 85 or below, then there +should be little or no perceptible difference between the two algorithms. When +decompressing images that were compressed using quality levels above 85, +however, the difference between the fast and int methods becomes more +pronounced. With images compressed using quality=97, for instance, the fast +method incurs generally about a 4-6 dB loss (in PSNR) relative to the int +method, but this can be larger for some images. If you can avoid it, do not +use the fast method when decompressing images that were compressed using +quality levels above 97. The algorithm often degenerates for such images and +can actually produce a more lossy output image than if the JPEG image had been +compressed using lower quality levels. .TP .B \-dct float Use floating-point DCT method. -The float method is very slightly more accurate than the int method, but is -much slower unless your machine has very fast floating-point hardware. Also -note that results of the floating-point method may vary slightly across -machines, while the integer methods should give the same results everywhere. -The fast integer method is much less accurate than the other two. +The float method is mostly a legacy feature. It does not produce significantly +more accurate results than the int method, and it is much slower. The float +method may also give different results on different machines due to varying +roundoff behavior, whereas the integer methods should give the same results on +all machines. .TP .B \-dither fs Use Floyd-Steinberg dithering in color quantization. diff --git a/libjpeg.txt b/libjpeg.txt index d1107380..afc002ba 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -3,7 +3,7 @@ USING THE IJG JPEG LIBRARY This file was part of the Independent JPEG Group's software: Copyright (C) 1994-2011, Thomas G. Lane, Guido Vollbeding. Modifications: -Copyright (C) 2010, D. R. Commander. +Copyright (C) 2010, 2014, D. R. Commander. For conditions of distribution and use, see the accompanying README file. @@ -886,14 +886,23 @@ J_DCT_METHOD dct_method JDCT_FLOAT: floating-point method JDCT_DEFAULT: default method (normally JDCT_ISLOW) JDCT_FASTEST: fastest method (normally JDCT_IFAST) - The FLOAT method is very slightly more accurate than the ISLOW method, - but may give different results on different machines due to varying - roundoff behavior. The integer methods should give the same results - on all machines. On machines with sufficiently fast FP hardware, the - floating-point method may also be the fastest. The IFAST method is - considerably less accurate than the other two; its use is not - recommended if high quality is a concern. JDCT_DEFAULT and - JDCT_FASTEST are macros configurable by each installation. + In libjpeg-turbo, JDCT_IFAST is generally about 5-15% faster than + JDCT_ISLOW when using the x86/x86-64 SIMD extensions (results may vary + with other SIMD implementations, or when using libjpeg-turbo without + SIMD extensions.) For quality levels of 90 and below, there should be + little or no perceptible difference between the two algorithms. For + quality levels above 90, however, the difference between JDCT_IFAST and + JDCT_ISLOW becomes more pronounced. With quality=97, for instance, + JDCT_IFAST incurs generally about a 1-3 dB loss (in PSNR) relative to + JDCT_ISLOW, but this can be larger for some images. Do not use + JDCT_IFAST with quality levels above 97. The algorithm often + degenerates at quality=98 and above and can actually produce a more + lossy image than if lower quality levels had been used. JDCT_FLOAT is + mostly a legacy feature. It does not produce significantly more + accurate results than the ISLOW method, and it is much slower. The + FLOAT method may also give different results on different machines due + to varying roundoff behavior, whereas the integer methods should give + the same results on all machines. J_COLOR_SPACE jpeg_color_space int num_components @@ -1170,8 +1179,32 @@ int actual_number_of_colors Additional decompression parameters that the application may set include: J_DCT_METHOD dct_method - Selects the algorithm used for the DCT step. Choices are the same - as described above for compression. + Selects the algorithm used for the DCT step. Choices are: + JDCT_ISLOW: slow but accurate integer algorithm + JDCT_IFAST: faster, less accurate integer method + JDCT_FLOAT: floating-point method + JDCT_DEFAULT: default method (normally JDCT_ISLOW) + JDCT_FASTEST: fastest method (normally JDCT_IFAST) + In libjpeg-turbo, JDCT_IFAST is generally about 5-15% faster than + JDCT_ISLOW when using the x86/x86-64 SIMD extensions (results may vary + with other SIMD implementations, or when using libjpeg-turbo without + SIMD extensions.) If the JPEG image was compressed using a quality + level of 85 or below, then there should be little or no perceptible + difference between the two algorithms. When decompressing images that + were compressed using quality levels above 85, however, the difference + between JDCT_IFAST and JDCT_ISLOW becomes more pronounced. With images + compressed using quality=97, for instance, JDCT_IFAST incurs generally + about a 4-6 dB loss (in PSNR) relative to JDCT_ISLOW, but this can be + larger for some images. If you can avoid it, do not use JDCT_IFAST + when decompressing images that were compressed using quality levels + above 97. The algorithm often degenerates for such images and can + actually produce a more lossy output image than if the JPEG image had + been compressed using lower quality levels. JDCT_FLOAT is mostly a + legacy feature. It does not produce significantly more accurate + results than the ISLOW method, and it is much slower. The FLOAT method + may also give different results on different machines due to varying + roundoff behavior, whereas the integer methods should give the same + results on all machines. boolean do_fancy_upsampling If TRUE, do careful upsampling of chroma components. If FALSE, diff --git a/usage.txt b/usage.txt index 14ab77b2..b328a21c 100644 --- a/usage.txt +++ b/usage.txt @@ -172,13 +172,28 @@ Switches for advanced users: -dct int Use integer DCT method (default). -dct fast Use fast integer DCT (less accurate). -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. + In libjpeg-turbo, the fast method is generally about + 5-15% faster than the int method when using the + x86/x86-64 SIMD extensions (results may vary with other + SIMD implementations, or when using libjpeg-turbo + without SIMD extensions.) For quality levels of 90 and + below, there should be little or no perceptible + difference between the two algorithms. For quality + levels above 90, however, the difference between + the fast and the int methods becomes more pronounced. + With quality=97, for instance, the fast method incurs + generally about a 1-3 dB loss (in PSNR) relative to + the int method, but this can be larger for some images. + Do not use the fast method with quality levels above + 97. The algorithm often degenerates at quality=98 and + above and can actually produce a more lossy image than + if lower quality levels had been used. The float + method is mostly a legacy feature. It does not produce + significantly more accurate results than the int + method, and it is much slower. The float method may + also give different results on different machines due + to varying roundoff behavior, whereas the integer + methods should give the same results on all machines. -restart N Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is attached to the number. @@ -296,13 +311,32 @@ Switches for advanced users: -dct int Use integer DCT method (default). -dct fast Use fast integer DCT (less accurate). -dct float Use floating-point DCT method. - The float method is very slightly more accurate than - the int method, but is much slower unless your machine - has very fast floating-point hardware. Also note that - results of the floating-point method may vary slightly - across machines, while the integer methods should give - the same results everywhere. The fast integer method - is much less accurate than the other two. + In libjpeg-turbo, the fast method is generally about + 5-15% faster than the int method when using the + x86/x86-64 SIMD extensions (results may vary with other + SIMD implementations, or when using libjpeg-turbo + without SIMD extensions.) If the JPEG image was + compressed using a quality level of 85 or below, then + there should be little or no perceptible difference + between the two algorithms. When decompressing images + that were compressed using quality levels above 85, + however, the difference between the fast and int + methods becomes more pronounced. With images + compressed using quality=97, for instance, the fast + method incurs generally about a 4-6 dB loss (in PSNR) + relative to the int method, but this can be larger for + some images. If you can avoid it, do not use the fast + method when decompressing images that were compressed + using quality levels above 97. The algorithm often + degenerates for such images and can actually produce + a more lossy output image than if the JPEG image had + been compressed using lower quality levels. The float + method is mostly a legacy feature. It does not produce + significantly more accurate results than the int + method, and it is much slower. The float method may + also give different results on different machines due + to varying roundoff behavior, whereas the integer + methods should give the same results on all machines. -dither fs Use Floyd-Steinberg dithering in color quantization. -dither ordered Use ordered dithering in color quantization. @@ -381,12 +415,6 @@ When producing a color-quantized image, "-onepass -dither ordered" is fast but much lower quality than the default behavior. "-dither none" may give acceptable results in two-pass mode, but is seldom tolerable in one-pass mode. -If you are fortunate enough to have very fast floating point hardware, -"-dct float" may be even faster than "-dct fast". But on most machines -"-dct float" is slower than "-dct int"; in this case it is not worth using, -because its theoretical accuracy advantage is too small to be significant -in practice. - Two-pass color quantization requires a good deal of memory; on MS-DOS machines it may run out of memory even with -maxmemory 0. In that case you can still decompress, with some loss of image quality, by specifying -onepass for From 8b11360a8be8179e77a7453b33c569cfb8da123d Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 11 May 2014 10:09:07 +0000 Subject: [PATCH 913/985] Port the more accurate (and slightly faster) floating point IDCT implementation from jpeg-8a and later. New research revealed that the SSE/SSE2 floating point IDCT implementation was actually more accurate than the jpeg-6b implementation, not less, which is why its mathematical results have always differed from those of the jpeg-6b implementation. This patch brings the accuracy of the C code in line with that of the SSE/SSE2 code. --- CMakeLists.txt | 2 +- ChangeLog.txt | 8 +++++ Makefile.am | 6 ++-- README-turbo.txt | 15 ++++++--- jidctflt.c | 79 +++++++++++++++++++++++------------------------- 5 files changed, 59 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7c9b7a..40e1433c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,7 +300,7 @@ set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) else() set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) -set(MD5_PPM_3x2_FLOAT ef6a420e369440edd6b918a0cf54ba3f) +set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) endif() set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) diff --git a/ChangeLog.txt b/ChangeLog.txt index 84842e50..f68a9884 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -54,6 +54,14 @@ if compiler optimization was enabled when libjpeg-turbo was built. This caused the regression tests to fail when doing a release build under Visual C++ 2010 and later. +[7] Improved the accuracy and performance of the non-SIMD implementation of the +floating point inverse DCT (using code borrowed from libjpeg v8a and later.) +The accuracy of this implementation now matches the accuracy of the SSE/SSE2 +implementation. Note, however, that the floating point DCT/IDCT algorithms are +mainly a legacy feature. They generally do not produce significantly better +accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit +slower. + 1.3.1 ===== diff --git a/Makefile.am b/Makefile.am index f14ddbf7..1844672d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,15 +175,13 @@ MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed MD5_PPM_GRAY_RGB_ISLOW = 116424ac07b79e5e801f00508eab48ec MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 -# The SSE/SSE2 DCT/IDCT implementation has always produced a slight round-off -# error relative to the C code, so in this case, we just test for regression -# rather than verifying that the output matches libjpeg. +# See README-turbo.txt for more details on why this next bit is necessary. if WITH_SSE_FLOAT_DCT MD5_JPEG_3x2_FLOAT_PROG = 343e3f8caf8af5986ebaf0bdc13b5c71 MD5_PPM_3x2_FLOAT = 1a75f36e5904d6fc3a85a43da9ad89bb else MD5_JPEG_3x2_FLOAT_PROG = 9bca803d2042bd1eb03819e2bf92b3e5 -MD5_PPM_3x2_FLOAT = ef6a420e369440edd6b918a0cf54ba3f +MD5_PPM_3x2_FLOAT = f6bfab038438ed8f5522fbd33595dcdc endif MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1 MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617 diff --git a/README-turbo.txt b/README-turbo.txt index 944e1b94..f5cd613c 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -301,10 +301,19 @@ following reasons: slightly more accurate than the implementation in libjpeg v6b, but not by any amount perceptible to human vision (generally in the range of 0.01 to 0.08 dB gain in PNSR.) +-- When not using the SIMD extensions, libjpeg-turbo uses the more accurate + (and slightly faster) floating point IDCT algorithm introduced in libjpeg + v8a as opposed to the algorithm used in libjpeg v6b. It should be noted, + however, that this algorithm basically brings the accuracy of the floating + point IDCT in line with the accuracy of the slow integer IDCT. The floating + point DCT/IDCT algorithms are mainly a legacy feature, and they do not + produce significantly more accuracy than the slow integer algorithms (to put + numbers on this, the typical difference in PNSR between the two algorithms + is less than 0.10 dB, whereas changing the quality level by 1 in the upper + range of the quality scale is typically more like a 1.0 dB difference.) -- When not using the SIMD extensions, then the accuracy of the floating point DCT/IDCT can depend on the compiler and compiler settings. - While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood, it is still using the same algorithms as libjpeg v6b, so there are several specific cases in which libjpeg-turbo cannot be expected to produce the same output as @@ -320,10 +329,6 @@ libjpeg v8: output of libjpeg v8 is less accurate than that of libjpeg v6b for this reason. --- When using the floating point IDCT, for the reasons stated above and also - because the floating point IDCT algorithm was modified in libjpeg v8a to - improve accuracy. - -- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or "non-smooth") chrominance upsampling, because libjpeg v8 does not support merged upsampling with scaling factors > 1. diff --git a/jidctflt.c b/jidctflt.c index c172ea1f..2b2e2282 100644 --- a/jidctflt.c +++ b/jidctflt.c @@ -1,9 +1,12 @@ /* * jidctflt.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1998, 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. + * Modified 2010 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2014, D. R. Commander. + * For conditions of distribution and use, see the accompanying README file. * * This file contains a floating-point implementation of the * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine @@ -76,10 +79,10 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, FLOAT_MULT_TYPE * quantptr; FAST_FLOAT * wsptr; JSAMPROW outptr; - JSAMPLE *range_limit = IDCT_range_limit(cinfo); + JSAMPLE *range_limit = cinfo->sample_range_limit; int ctr; FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ - SHIFT_TEMPS + #define _0_125 ((FLOAT_MULT_TYPE)0.125) /* Pass 1: process columns from input, store into work array. */ @@ -101,7 +104,8 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ - FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], + quantptr[DCTSIZE*0] * _0_125); wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; @@ -120,10 +124,10 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part */ - tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); - tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0] * _0_125); + tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2] * _0_125); + tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4] * _0_125); + tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6] * _0_125); tmp10 = tmp0 + tmp2; /* phase 3 */ tmp11 = tmp0 - tmp2; @@ -138,10 +142,10 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Odd part */ - tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); - tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); - tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); - tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1] * _0_125); + tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3] * _0_125); + tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5] * _0_125); + tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7] * _0_125); z13 = tmp6 + tmp5; /* phase 6 */ z10 = tmp6 - tmp5; @@ -152,12 +156,12 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ - tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ - tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ + tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */ + tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; + tmp4 = tmp10 - tmp5; wsptr[DCTSIZE*0] = tmp0 + tmp7; wsptr[DCTSIZE*7] = tmp0 - tmp7; @@ -165,8 +169,8 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, wsptr[DCTSIZE*6] = tmp1 - tmp6; wsptr[DCTSIZE*2] = tmp2 + tmp5; wsptr[DCTSIZE*5] = tmp2 - tmp5; - wsptr[DCTSIZE*4] = tmp3 + tmp4; - wsptr[DCTSIZE*3] = tmp3 - tmp4; + wsptr[DCTSIZE*3] = tmp3 + tmp4; + wsptr[DCTSIZE*4] = tmp3 - tmp4; inptr++; /* advance pointers to next column */ quantptr++; @@ -174,7 +178,6 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, } /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3. */ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { @@ -187,8 +190,10 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part */ - tmp10 = wsptr[0] + wsptr[4]; - tmp11 = wsptr[0] - wsptr[4]; + /* Apply signed->unsigned and prepare float->int conversion */ + z5 = wsptr[0] + ((FAST_FLOAT) CENTERJSAMPLE + (FAST_FLOAT) 0.5); + tmp10 = z5 + wsptr[4]; + tmp11 = z5 - wsptr[4]; tmp13 = wsptr[2] + wsptr[6]; tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; @@ -209,31 +214,23 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ - tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ - tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ + tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */ + tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7; tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; + tmp4 = tmp10 - tmp5; - /* Final output stage: scale down by a factor of 8 and range-limit */ + /* Final output stage: float->int conversion and range-limit */ - outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3) - & RANGE_MASK]; - outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) - & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) - & RANGE_MASK]; - outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) - & RANGE_MASK]; - outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) - & RANGE_MASK]; - outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) - & RANGE_MASK]; - outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) - & RANGE_MASK]; - outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) - & RANGE_MASK]; + outptr[0] = range_limit[((int) (tmp0 + tmp7)) & RANGE_MASK]; + outptr[7] = range_limit[((int) (tmp0 - tmp7)) & RANGE_MASK]; + outptr[1] = range_limit[((int) (tmp1 + tmp6)) & RANGE_MASK]; + outptr[6] = range_limit[((int) (tmp1 - tmp6)) & RANGE_MASK]; + outptr[2] = range_limit[((int) (tmp2 + tmp5)) & RANGE_MASK]; + outptr[5] = range_limit[((int) (tmp2 - tmp5)) & RANGE_MASK]; + outptr[3] = range_limit[((int) (tmp3 + tmp4)) & RANGE_MASK]; + outptr[4] = range_limit[((int) (tmp3 - tmp4)) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ } From 1d434bfdc9b3369a0724a86c4efad785970c94e1 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 11 May 2014 23:15:52 +0000 Subject: [PATCH 914/985] Document the fact that the fast integer FDCT is not fully accelerated for quality levels above 97 + additional wordsmithing --- cjpeg.1 | 6 ++++-- djpeg.1 | 2 +- libjpeg.txt | 16 +++++++++------- usage.txt | 37 +++++++++++++++++++++---------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/cjpeg.1 b/cjpeg.1 index b4edf623..51fe7c56 100644 --- a/cjpeg.1 +++ b/cjpeg.1 @@ -176,11 +176,13 @@ With quality=97, for instance, the fast method incurs generally about a 1-3 dB loss (in PSNR) relative to the int method, but this can be larger for some images. Do not use the fast method with quality levels above 97. The algorithm often degenerates at quality=98 and above and can actually produce a -more lossy image than if lower quality levels had been used. +more lossy image than if lower quality levels had been used. Also, in +libjpeg-turbo, the fast method is not fully accelerated for quality levels +above 97, so it will be slower than the int method. .TP .B \-dct float Use floating-point DCT method. -The float method is mostly a legacy feature. It does not produce significantly +The float method is mainly a legacy feature. It does not produce significantly more accurate results than the int method, and it is much slower. The float method may also give different results on different machines due to varying roundoff behavior, whereas the integer methods should give the same results on diff --git a/djpeg.1 b/djpeg.1 index d77e7edd..37646ee5 100644 --- a/djpeg.1 +++ b/djpeg.1 @@ -132,7 +132,7 @@ compressed using lower quality levels. .TP .B \-dct float Use floating-point DCT method. -The float method is mostly a legacy feature. It does not produce significantly +The float method is mainly a legacy feature. It does not produce significantly more accurate results than the int method, and it is much slower. The float method may also give different results on different machines due to varying roundoff behavior, whereas the integer methods should give the same results on diff --git a/libjpeg.txt b/libjpeg.txt index afc002ba..5f203d6d 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -897,12 +897,14 @@ J_DCT_METHOD dct_method JDCT_ISLOW, but this can be larger for some images. Do not use JDCT_IFAST with quality levels above 97. The algorithm often degenerates at quality=98 and above and can actually produce a more - lossy image than if lower quality levels had been used. JDCT_FLOAT is - mostly a legacy feature. It does not produce significantly more - accurate results than the ISLOW method, and it is much slower. The - FLOAT method may also give different results on different machines due - to varying roundoff behavior, whereas the integer methods should give - the same results on all machines. + lossy image than if lower quality levels had been used. Also, in + libjpeg-turbo, JDCT_IFAST is not fully accelerated for quality levels + above 97, so it will be slower than JDCT_ISLOW. JDCT_FLOAT is mainly a + legacy feature. It does not produce significantly more accurate + results than the ISLOW method, and it is much slower. The FLOAT method + may also give different results on different machines due to varying + roundoff behavior, whereas the integer methods should give the same + results on all machines. J_COLOR_SPACE jpeg_color_space int num_components @@ -1199,7 +1201,7 @@ J_DCT_METHOD dct_method when decompressing images that were compressed using quality levels above 97. The algorithm often degenerates for such images and can actually produce a more lossy output image than if the JPEG image had - been compressed using lower quality levels. JDCT_FLOAT is mostly a + been compressed using lower quality levels. JDCT_FLOAT is mainly a legacy feature. It does not produce significantly more accurate results than the ISLOW method, and it is much slower. The FLOAT method may also give different results on different machines due to varying diff --git a/usage.txt b/usage.txt index b328a21c..38f11b2e 100644 --- a/usage.txt +++ b/usage.txt @@ -171,7 +171,6 @@ Switches for advanced users: -dct int Use integer DCT method (default). -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. In libjpeg-turbo, the fast method is generally about 5-15% faster than the int method when using the x86/x86-64 SIMD extensions (results may vary with other @@ -187,13 +186,18 @@ Switches for advanced users: Do not use the fast method with quality levels above 97. The algorithm often degenerates at quality=98 and above and can actually produce a more lossy image than - if lower quality levels had been used. The float - method is mostly a legacy feature. It does not produce - significantly more accurate results than the int - method, and it is much slower. The float method may - also give different results on different machines due - to varying roundoff behavior, whereas the integer - methods should give the same results on all machines. + if lower quality levels had been used. Also, in + libjpeg-turbo, the fast method is not fully accerated + for quality levels above 97, so it will be slower than + the int method. + -dct float Use floating-point DCT method. + The float method is mainly a legacy feature. It does + not produce significantly more accurate results than + the int method, and it is much slower. The float + method may also give different results on different + machines due to varying roundoff behavior, whereas the + integer methods should give the same results on all + machines. -restart N Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is attached to the number. @@ -310,7 +314,6 @@ Switches for advanced users: -dct int Use integer DCT method (default). -dct fast Use fast integer DCT (less accurate). - -dct float Use floating-point DCT method. In libjpeg-turbo, the fast method is generally about 5-15% faster than the int method when using the x86/x86-64 SIMD extensions (results may vary with other @@ -330,13 +333,15 @@ Switches for advanced users: using quality levels above 97. The algorithm often degenerates for such images and can actually produce a more lossy output image than if the JPEG image had - been compressed using lower quality levels. The float - method is mostly a legacy feature. It does not produce - significantly more accurate results than the int - method, and it is much slower. The float method may - also give different results on different machines due - to varying roundoff behavior, whereas the integer - methods should give the same results on all machines. + been compressed using lower quality levels. + -dct float Use floating-point DCT method. + The float method is mainly a legacy feature. It does +  not produce significantly more accurate results than + the int method, and it is much slower. The float + method may also give different results on different + machines due to varying roundoff behavior, whereas the + integer methods should give the same results on all + machines. -dither fs Use Floyd-Steinberg dithering in color quantization. -dither ordered Use ordered dithering in color quantization. From f413bb5fb7fb6c7574dca8b9066118e8cb5d20ba Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 12 May 2014 00:34:58 +0000 Subject: [PATCH 915/985] Use 2-space indentation for the enums, to be consistent with the structs --- jpegint.h | 12 +++++------ jpeglib.h | 59 +++++++++++++++++++++++++++--------------------------- transupp.h | 30 +++++++++++++-------------- 3 files changed, 50 insertions(+), 51 deletions(-) diff --git a/jpegint.h b/jpegint.h index fcacef39..44a330d0 100644 --- a/jpegint.h +++ b/jpegint.h @@ -14,12 +14,12 @@ /* Declarations for both compression & decompression */ -typedef enum { /* Operating modes for buffer controllers */ - JBUF_PASS_THRU, /* Plain stripwise operation */ - /* Remaining modes require a full-image buffer to have been created */ - JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ - JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ - JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ +typedef enum { /* Operating modes for buffer controllers */ + JBUF_PASS_THRU, /* Plain stripwise operation */ + /* Remaining modes require a full-image buffer to have been created */ + JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ + JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ + JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ } J_BUF_MODE; /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ diff --git a/jpeglib.h b/jpeglib.h index e5329cff..55c6abcf 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -215,38 +215,37 @@ struct jpeg_marker_struct { #define JCS_ALPHA_EXTENSIONS 1 typedef enum { - JCS_UNKNOWN, /* error/unspecified */ - JCS_GRAYSCALE, /* monochrome */ - JCS_RGB, /* red/green/blue as specified by the RGB_RED, RGB_GREEN, - RGB_BLUE, and RGB_PIXELSIZE macros */ - JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ - JCS_CMYK, /* C/M/Y/K */ - JCS_YCCK, /* Y/Cb/Cr/K */ - JCS_EXT_RGB, /* red/green/blue */ - JCS_EXT_RGBX, /* red/green/blue/x */ - JCS_EXT_BGR, /* blue/green/red */ - JCS_EXT_BGRX, /* blue/green/red/x */ - JCS_EXT_XBGR, /* x/blue/green/red */ - JCS_EXT_XRGB, /* x/red/green/blue */ - /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, - JCS_EXT_XBGR, or JCS_EXT_XRGB during decompression, the X byte is - undefined, and in order to ensure the best performance, - libjpeg-turbo can set that byte to whatever value it wishes. Use - the following colorspace constants to ensure that the X byte is set - to 0xFF, so that it can be interpreted as an opaque alpha - channel. */ - JCS_EXT_RGBA, /* red/green/blue/alpha */ - JCS_EXT_BGRA, /* blue/green/red/alpha */ - JCS_EXT_ABGR, /* alpha/blue/green/red */ - JCS_EXT_ARGB /* alpha/red/green/blue */ + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue as specified by the RGB_RED, + RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK, /* Y/Cb/Cr/K */ + JCS_EXT_RGB, /* red/green/blue */ + JCS_EXT_RGBX, /* red/green/blue/x */ + JCS_EXT_BGR, /* blue/green/red */ + JCS_EXT_BGRX, /* blue/green/red/x */ + JCS_EXT_XBGR, /* x/blue/green/red */ + JCS_EXT_XRGB, /* x/red/green/blue */ + /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, + or JCS_EXT_XRGB during decompression, the X byte is undefined, and in + order to ensure the best performance, libjpeg-turbo can set that byte to + whatever value it wishes. Use the following colorspace constants to + ensure that the X byte is set to 0xFF, so that it can be interpreted as an + opaque alpha channel. */ + JCS_EXT_RGBA, /* red/green/blue/alpha */ + JCS_EXT_BGRA, /* blue/green/red/alpha */ + JCS_EXT_ABGR, /* alpha/blue/green/red */ + JCS_EXT_ARGB /* alpha/red/green/blue */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ typedef enum { - JDCT_ISLOW, /* slow but accurate integer algorithm */ - JDCT_IFAST, /* faster, less accurate integer method */ - JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ } J_DCT_METHOD; #ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ @@ -259,9 +258,9 @@ typedef enum { /* Dithering options for decompression. */ typedef enum { - JDITHER_NONE, /* no dithering */ - JDITHER_ORDERED, /* simple ordered dither */ - JDITHER_FS /* Floyd-Steinberg error diffusion dither */ + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ } J_DITHER_MODE; diff --git a/transupp.h b/transupp.h index 710b345b..5b0e1bbc 100644 --- a/transupp.h +++ b/transupp.h @@ -95,14 +95,14 @@ */ typedef enum { - JXFORM_NONE, /* no transformation */ - JXFORM_FLIP_H, /* horizontal flip */ - JXFORM_FLIP_V, /* vertical flip */ - JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ - JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ - JXFORM_ROT_90, /* 90-degree clockwise rotation */ - JXFORM_ROT_180, /* 180-degree rotation */ - JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ + JXFORM_NONE, /* no transformation */ + JXFORM_FLIP_H, /* horizontal flip */ + JXFORM_FLIP_V, /* vertical flip */ + JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ + JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ + JXFORM_ROT_90, /* 90-degree clockwise rotation */ + JXFORM_ROT_180, /* 180-degree rotation */ + JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ } JXFORM_CODE; /* @@ -112,10 +112,10 @@ typedef enum { */ typedef enum { - JCROP_UNSET, - JCROP_POS, - JCROP_NEG, - JCROP_FORCE + JCROP_UNSET, + JCROP_POS, + JCROP_NEG, + JCROP_FORCE } JCROP_CODE; /* @@ -204,9 +204,9 @@ EXTERN(boolean) jtransform_perfect_transform */ typedef enum { - JCOPYOPT_NONE, /* copy no optional markers */ - JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ - JCOPYOPT_ALL /* copy all optional markers */ + JCOPYOPT_NONE, /* copy no optional markers */ + JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ + JCOPYOPT_ALL /* copy all optional markers */ } JCOPY_OPTION; #define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ From e99d13577426695d2c64fca3f2b7cd73fa460482 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 12 May 2014 09:09:40 +0000 Subject: [PATCH 916/985] Document -rgb option in djpeg man page; "gray-scale"="grayscale" --- README | 2 +- cjpeg.1 | 2 +- djpeg.1 | 17 ++++++++++------- usage.txt | 18 +++++++++--------- wrgif.c | 4 ++-- wrtarga.c | 2 +- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/README b/README index 91008698..44e69d39 100644 --- a/README +++ b/README @@ -62,7 +62,7 @@ OVERVIEW This package contains C software to implement JPEG image encoding, decoding, and transcoding. JPEG (pronounced "jay-peg") is a standardized compression -method for full-color and gray-scale images. JPEG's strong suit is compressing +method for full-color and grayscale images. JPEG's strong suit is compressing photographic images or other types of images that have smooth color and brightness transitions between neighboring pixels. Images with sharp lines or other abrupt features may not compress well with JPEG, and a higher JPEG diff --git a/cjpeg.1 b/cjpeg.1 index 51fe7c56..5f5090cf 100644 --- a/cjpeg.1 +++ b/cjpeg.1 @@ -16,7 +16,7 @@ cjpeg \- compress an image file to a JPEG file compresses the named image file, or the standard input if no file is named, and produces a JPEG/JFIF file on the standard output. The currently supported input file formats are: PPM (PBMPLUS color -format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster +format), PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit format). (RLE is supported only if the URT library is available.) .SH OPTIONS All switch names may be abbreviated; for example, diff --git a/djpeg.1 b/djpeg.1 index 37646ee5..9b040ae9 100644 --- a/djpeg.1 +++ b/djpeg.1 @@ -55,11 +55,14 @@ default options are chosen for highest quality output.) Currently, this is equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR. .TP .B \-grayscale -Force gray-scale output even if JPEG file is color. Useful for viewing on +Force grayscale output even if JPEG file is color. Useful for viewing on monochrome displays; also, .B djpeg runs noticeably faster in this mode. .TP +.B \-rgb +Force RGB output even if JPEG file is grayscale. +.TP .BI \-scale " M/N" Scale the output image by a factor M/N. Currently the scale factor must be M/8, where M is an integer between 1 and 16 inclusive, or any reduced fraction @@ -74,7 +77,7 @@ emitted if .B \-colors or .B \-grayscale -is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color +is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. .TP .B \-gif @@ -88,12 +91,12 @@ emitted if .B \-colors or .B \-grayscale -is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color +is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. .TP .B \-pnm Select PBMPLUS (PPM/PGM) output format (this is the default format). -PGM is emitted if the JPEG file is gray-scale or if +PGM is emitted if the JPEG file is grayscale or if .B \-grayscale is specified; otherwise PPM is emitted. .TP @@ -101,8 +104,8 @@ is specified; otherwise PPM is emitted. Select RLE output format. (Requires URT library.) .TP .B \-targa -Select Targa output format. Gray-scale format is emitted if the JPEG file is -gray-scale or if +Select Targa output format. Grayscale format is emitted if the JPEG file is +grayscale or if .B \-grayscale is specified; otherwise, colormapped format is emitted if .B \-colors @@ -174,7 +177,7 @@ faster and needs less memory, but it produces a lower-quality image. is ignored unless you also say .B \-colors .IR N . -Also, the one-pass method is always used for gray-scale output (the two-pass +Also, the one-pass method is always used for grayscale output (the two-pass method is no improvement then). .TP .BI \-maxmemory " N" diff --git a/usage.txt b/usage.txt index 38f11b2e..ef8e6d09 100644 --- a/usage.txt +++ b/usage.txt @@ -17,7 +17,7 @@ INTRODUCTION These programs implement JPEG image encoding, decoding, and transcoding. JPEG (pronounced "jay-peg") is a standardized compression method for -full-color and gray-scale images. +full-color and grayscale images. GENERAL USAGE @@ -50,7 +50,7 @@ or This syntax works on all systems, so it is useful for scripts. The currently supported image file formats are: PPM (PBMPLUS color format), -PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit +PGM (PBMPLUS grayscale format), BMP, Targa, and RLE (Utah Raster Toolkit format). (RLE is supported only if the URT library is available.) cjpeg recognizes the input image format automatically, with the exception of some Targa-format files. You have to tell djpeg which format to generate. @@ -271,7 +271,7 @@ The basic command line switches for djpeg are: highest quality output.) Currently, this is equivalent to "-dct fast -nosmooth -onepass -dither ordered". - -grayscale Force gray-scale output even if JPEG file is color. + -grayscale Force grayscale output even if JPEG file is color. Useful for viewing on monochrome displays; also, djpeg runs noticeably faster in this mode. @@ -284,7 +284,7 @@ The basic command line switches for djpeg are: -bmp Select BMP output format (Windows flavor). 8-bit colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; + is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. -gif Select GIF output format. Since GIF does not support @@ -294,18 +294,18 @@ The basic command line switches for djpeg are: -os2 Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is emitted if -colors or -grayscale - is specified, or if the JPEG file is gray-scale; + is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. -pnm Select PBMPLUS (PPM/PGM) output format (this is the default format). PGM is emitted if the JPEG file is - gray-scale or if -grayscale is specified; otherwise + grayscale or if -grayscale is specified; otherwise PPM is emitted. -rle Select RLE output format. (Requires URT library.) - -targa Select Targa output format. Gray-scale format is - emitted if the JPEG file is gray-scale or if + -targa Select Targa output format. Grayscale format is + emitted if the JPEG file is grayscale or if -grayscale is specified; otherwise, colormapped format is emitted if -colors is specified; otherwise, 24-bit full-color format is emitted. @@ -367,7 +367,7 @@ Switches for advanced users: The one-pass method is faster and needs less memory, but it produces a lower-quality image. -onepass is ignored unless you also say -colors N. Also, - the one-pass method is always used for gray-scale + the one-pass method is always used for grayscale output (the two-pass method is no improvement then). -maxmemory N Set limit for amount of memory to use in processing diff --git a/wrgif.c b/wrgif.c index 0533f642..193f7b58 100644 --- a/wrgif.c +++ b/wrgif.c @@ -218,7 +218,7 @@ put_3bytes (gif_dest_ptr dinfo, int val) 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 */ +/* If colormap==NULL, synthesize a grayscale colormap */ { int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; int cshift = dinfo->cinfo->data_precision - 8; @@ -270,7 +270,7 @@ emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); } } else { - /* Create a gray-scale map of num_colors values, range 0..255 */ + /* Create a grayscale map of num_colors values, range 0..255 */ put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); } } else { diff --git a/wrtarga.c b/wrtarga.c index 84084be2..ffdce631 100644 --- a/wrtarga.c +++ b/wrtarga.c @@ -73,7 +73,7 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) targaheader[17] = 0x20; /* Top-down, non-interlaced */ if (cinfo->out_color_space == JCS_GRAYSCALE) { - targaheader[2] = 3; /* image type = uncompressed gray-scale */ + targaheader[2] = 3; /* image type = uncompressed grayscale */ targaheader[16] = 8; /* bits per pixel */ } else { /* must be RGB */ if (num_colors > 0) { From cfbb147aad8acac85aa0638a905837864b7a182d Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 12 May 2014 09:23:57 +0000 Subject: [PATCH 917/985] Add support for decompressing to RGB565 (16-bit) pixels --- CMakeLists.txt | 122 +++++++++++++-- ChangeLog.txt | 3 + Makefile.am | 102 +++++++++---- djpeg.c | 7 +- jdcol565.c | 408 +++++++++++++++++++++++++++++++++++++++++++++++++ jdcolor.c | 30 ++++ jdmaster.c | 14 +- jdmerge.c | 387 +++++++++++++++++++++++++++++++++++++++++++++- jmorecfg.h | 16 +- jpeglib.h | 5 +- wrbmp.c | 63 ++++++-- 11 files changed, 1092 insertions(+), 65 deletions(-) create mode 100644 jdcol565.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e1433c..307c495e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,15 +285,21 @@ enable_testing() set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) +set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) +set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) +set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) +set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) -set(MD5_PPM_GRAY_RGB_ISLOW 116424ac07b79e5e801f00508eab48ec) +set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) +set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) +set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) if(WITH_SIMD) set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) @@ -319,6 +325,10 @@ set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) +set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) +set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) +set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) +set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) if(WITH_JAVA) @@ -379,6 +389,22 @@ foreach(libtype shared static) add_test(djpeg${suffix}-rgb-islow-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} + -DFILE=testout_rgb_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} + -DFILE=testout_rgb_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff add_test(cjpeg${suffix}-422-ifast-opt @@ -398,15 +424,31 @@ foreach(libtype shared static) -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff add_test(djpeg${suffix}-422m-ifast - ${dir}djpeg${suffix} -nosmooth -dct fast -outfile testout_422m_ifast.ppm + ${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg) add_test(djpeg${suffix}-422m-ifast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast-565 + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp + -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} + -DFILE=testout_422m_ifast_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast-565D + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp + -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} + -DFILE=testout_422m_ifast_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff add_test(cjpeg${suffix}-420-q100-ifast-prog - ${dir}cjpeg${suffix} -sample 2x2 -dct fast -quality 100 -prog + ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp @@ -423,7 +465,7 @@ foreach(libtype shared static) -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff add_test(djpeg${suffix}-420m-q100-ifast-prog - ${dir}djpeg${suffix} -nosmooth -dct fast + ${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} @@ -438,7 +480,7 @@ foreach(libtype shared static) ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} -DFILE=testout_gray_islow.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->Gray SAMP: fullsize FDCT: islow ENT: huff + # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff add_test(djpeg${suffix}-gray-islow ${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg) @@ -446,13 +488,29 @@ foreach(libtype shared static) ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} -DFILE=testout_gray_islow.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff - add_test(djpeg${suffix}-gray-rgb-islow - ${dir}djpeg${suffix} -rgb -dct int -outfile testout_gray_rgb_islow.ppm + # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-rgb + ${dir}djpeg${suffix} -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg) - add_test(cjpeg${suffix}-gray-rgb-islow-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_RGB_ISLOW} - -DFILE=testout_gray_rgb_islow.ppm + add_test(cjpeg${suffix}-gray-islow-rgb-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW_RGB} + -DFILE=testout_gray_islow_rgb.ppm + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} + -DFILE=testout_gray_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} + -DFILE=testout_gray_islow_565D.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow @@ -502,7 +560,7 @@ foreach(libtype shared static) -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith add_test(cjpeg${suffix}-444-islow-progari - ${dir}cjpeg${suffix} -dct int -progressive -arithmetic -sample 1x1 + ${dir}cjpeg${suffix} -sample 1x1 -dct int -progressive -arithmetic -outfile testout_444_islow_progari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) add_test(cjpeg${suffix}-444-islow-progari-cmp @@ -550,7 +608,7 @@ foreach(libtype shared static) foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) string(REGEX REPLACE "_" "/" scalearg ${scale}) add_test(djpeg${suffix}-420m-islow-${scale} - ${dir}djpeg${suffix} -dct int -nosmooth -scale ${scalearg} -ppm + ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm -outfile testout_420m_islow_${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) add_test(djpeg${suffix}-420m-islow-${scale}-cmp @@ -561,13 +619,49 @@ foreach(libtype shared static) # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff add_test(djpeg${suffix}-420-islow-256 - ${dir}djpeg${suffix} -dct int -bmp -colors 256 + ${dir}djpeg${suffix} -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) add_test(djpeg${suffix}-420-islow-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} -DFILE=testout_420_islow_256.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_420_islow_565.bmp + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} + -DFILE=testout_420_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_420_islow_565D.bmp + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} + -DFILE=testout_420_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff + add_test(djpeg${suffix}-420m-islow-565 + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp + -outfile testout_420m_islow_565.bmp + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420m-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} + -DFILE=testout_420m_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff + add_test(djpeg${suffix}-420m-islow-565D + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp + -outfile testout_420m_islow_565D.bmp + ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + add_test(djpeg${suffix}-420m-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} + -DFILE=testout_420m_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) add_test(jpegtran${suffix}-crop ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect diff --git a/ChangeLog.txt b/ChangeLog.txt index f68a9884..e59939f7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -62,6 +62,9 @@ mainly a legacy feature. They generally do not produce significantly better accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit slower. +[8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows +for decompressing JPEG images into RGB565 (16-bit) pixels. + 1.3.1 ===== diff --git a/Makefile.am b/Makefile.am index 1844672d..cee54eb3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,7 +155,7 @@ dist_example_DATA = example.c EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ - jccolext.c jdcolext.c jdmrgext.c jstdhuff.c + jccolext.c jdcolext.c jdcol565.c jdmrgext.c jstdhuff.c dist-hook: rm -rf `find $(distdir) -name .svn` @@ -165,15 +165,21 @@ SUBDIRS += md5 MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291 +MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be +MD5_BMP_RGB_ISLOW_565D = 4cfa0928ef3e6bb626d7728c924cfda4 MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8 MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d +MD5_BMP_422M_IFAST_565 = 3294bd4d9a1f2b3d08ea6020d0db7065 +MD5_BMP_422M_IFAST_565D = da98c9c7b6039511be4a79a878a9abc1 MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294 MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1 MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed -MD5_PPM_GRAY_RGB_ISLOW = 116424ac07b79e5e801f00508eab48ec +MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec +MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc +MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8 # See README-turbo.txt for more details on why this next bit is necessary. if WITH_SSE_FLOAT_DCT @@ -200,6 +206,10 @@ MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996 MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6 +MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb +MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2 +MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f +MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d test: testclean all @@ -230,7 +240,15 @@ endif # CC: null SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm - rm testout_rgb_islow.ppm testout_rgb_islow.jpg + rm testout_rgb_islow.ppm +# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg + md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp + rm testout_rgb_islow_565.bmp +# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg + md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp + rm testout_rgb_islow_565D.bmp testout_rgb_islow.jpg # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm @@ -240,33 +258,49 @@ endif md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm rm testout_422_ifast.ppm # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff - ./djpeg -nosmooth -dct fast -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg + ./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm - rm testout_422m_ifast.ppm testout_422_ifast_opt.jpg + rm testout_422m_ifast.ppm +# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp + rm testout_422m_ifast_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg + md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp + rm testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff - ./cjpeg -sample 2x2 -dct fast -quality 100 -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm + ./cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff ./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm rm testout_420_q100_ifast.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff - ./djpeg -nosmooth -dct fast -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg + ./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm rm testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff ./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg -# CC: Gray->Gray SAMP: fullsize FDCT: islow ENT: huff +# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm rm testout_gray_islow.ppm -# CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff - ./djpeg -rgb -dct int -outfile testout_gray_rgb_islow.ppm testout_gray_islow.jpg - md5/md5cmp $(MD5_PPM_GRAY_RGB_ISLOW) testout_gray_rgb_islow.ppm - rm testout_gray_rgb_islow.ppm testout_gray_islow.jpg +# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg + md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm + rm testout_gray_islow_rgb.ppm +# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg + md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp + rm testout_gray_islow_565.bmp +# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg + md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp + rm testout_gray_islow_565D.bmp testout_gray_islow.jpg # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff @@ -291,7 +325,7 @@ if WITH_ARITH_ENC md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg rm testout_420_islow_ari.jpg # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith - ./cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm + ./cjpeg -sample 1x1 -dct int -progressive -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg rm testout_444_islow_progari.jpg endif @@ -306,57 +340,73 @@ if WITH_ARITH_DEC endif # CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 2/1 -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm rm testout_420m_islow_2_1.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 15/8 -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm rm testout_420m_islow_15_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 13/8 -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm rm testout_420m_islow_13_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 11/8 -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm rm testout_420m_islow_11_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 9/8 -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm rm testout_420m_islow_9_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 7/8 -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm rm testout_420m_islow_7_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 3/4 -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm rm testout_420m_islow_3_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 5/8 -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm rm testout_420m_islow_5_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 1/2 -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm rm testout_420m_islow_1_2.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 3/8 -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm rm testout_420m_islow_3_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 1/4 -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm rm testout_420m_islow_1_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff - ./djpeg -dct int -nosmooth -scale 1/8 -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm rm testout_420m_islow_1_8.ppm # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -bmp -colors 256 -outfile testout_420_islow_256.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp rm testout_420_islow_256.bmp +# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp + rm testout_420_islow_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp + rm testout_420_islow_565D.bmp +# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp + rm testout_420m_islow_565.bmp +# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff + ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/testorig.jpg + md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp + rm testout_420m_islow_565D.bmp ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/testorig.jpg md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg diff --git a/djpeg.c b/djpeg.c index 7a2eaa07..9b95e3cd 100644 --- a/djpeg.c +++ b/djpeg.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2010-2011, 2013, D. R. Commander. + * Copyright (C) 2010-2011, 2013-2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains a command-line user interface for the JPEG decompressor. @@ -107,6 +107,7 @@ usage (void) fprintf(stderr, " -fast Fast, low-quality processing\n"); fprintf(stderr, " -grayscale Force grayscale output\n"); fprintf(stderr, " -rgb Force RGB output\n"); + fprintf(stderr, " -rgb565 Force RGB565 output\n"); #ifdef IDCT_SCALING_SUPPORTED fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); #endif @@ -281,6 +282,10 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, /* Force RGB output. */ cinfo->out_color_space = JCS_RGB; + } else if (keymatch(arg, "rgb565", 2)) { + /* Force RGB565 output. */ + cinfo->out_color_space = JCS_RGB565; + } else if (keymatch(arg, "map", 3)) { /* Quantize to a color map taken from an input file. */ if (++argn >= argc) /* advance to next argument */ diff --git a/jdcol565.c b/jdcol565.c new file mode 100644 index 00000000..a2c98f30 --- /dev/null +++ b/jdcol565.c @@ -0,0 +1,408 @@ +/* + * jdcol565.c + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modifications: + * Copyright (C) 2013, Linaro Limited. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains output colorspace conversion routines. + */ + +/* This file is included by jdcolor.c */ + + +#define PACK_SHORT_565(r, g, b) ((((r) << 8) & 0xf800) | \ + (((g) << 3) & 0x7E0) | ((b) >> 3)) +#define PACK_TWO_PIXELS(l, r) ((r << 16) | l) +#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3) + +#define WRITE_TWO_PIXELS(addr, pixels) { \ + ((INT16*)(addr))[0] = (pixels); \ + ((INT16*)(addr))[1] = (pixels) >> 16; \ +} +#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32 *)(addr)) = pixels) + +#define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF)) +#define DITHER_565_G(g, dither) ((g) + (((dither) & 0xFF) >> 1)) +#define DITHER_565_B(b, dither) ((b) + ((dither) & 0xFF)) + + +/* Declarations for ordered dithering + * + * We use a 4x4 ordered dither array packed into 32 bits. This array is + * sufficent for dithering RGB888 to RGB565. + */ + +#define DITHER_MASK 0x3 +#define DITHER_ROTATE(x) (((x) << 24) | (((x) >> 8) & 0x00FFFFFF)) +static const INT32 dither_matrix[4] = { + 0x0008020A, + 0x0C040E06, + 0x030B0109, + 0x0F070D05 +}; + + +METHODDEF(void) +ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + register int * Crrtab = cconvert->Cr_r_tab; + register int * Cbbtab = cconvert->Cb_b_tab; + register INT32 * Crgtab = cconvert->Cr_g_tab; + register INT32 * Cbgtab = cconvert->Cb_g_tab; + SHIFT_TEMPS + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int r, g, b; + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + + if (PACK_NEED_ALIGNMENT(outptr)) { + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + y = GETJSAMPLE(*inptr0); + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + r = range_limit[y + Crrtab[cr]]; + g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + b = range_limit[y + Cbbtab[cb]]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } + } +} + + +METHODDEF(void) +ycc_rgb565D_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + register int * Crrtab = cconvert->Cr_r_tab; + register int * Cbbtab = cconvert->Cb_b_tab; + register INT32 * Crgtab = cconvert->Cr_g_tab; + register INT32 * Cbgtab = cconvert->Cb_g_tab; + INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + SHIFT_TEMPS + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr0++); + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + y = GETJSAMPLE(*inptr0); + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)]; + g = range_limit[DITHER_565_G(y + + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)), d0)]; + b = range_limit[DITHER_565_B(y + Cbbtab[cb], d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } + } +} + + +METHODDEF(void) +rgb_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + SHIFT_TEMPS + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + r = GETJSAMPLE(*inptr0++); + g = GETJSAMPLE(*inptr1++); + b = GETJSAMPLE(*inptr2++); + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + r = GETJSAMPLE(*inptr0++); + g = GETJSAMPLE(*inptr1++); + b = GETJSAMPLE(*inptr2++); + rgb = PACK_SHORT_565(r, g, b); + + r = GETJSAMPLE(*inptr0++); + g = GETJSAMPLE(*inptr1++); + b = GETJSAMPLE(*inptr2++); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + r = GETJSAMPLE(*inptr0); + g = GETJSAMPLE(*inptr1); + b = GETJSAMPLE(*inptr2); + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } + } +} + + +METHODDEF(void) +rgb_rgb565D_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + register JSAMPLE * range_limit = cinfo->sample_range_limit; + JDIMENSION num_cols = cinfo->output_width; + INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + SHIFT_TEMPS + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int r, g, b; + + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)]; + g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)]; + b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)]; + g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)]; + b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)]; + g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)]; + b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0), d0)]; + g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1), d0)]; + b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2), d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } + } +} + + +METHODDEF(void) +gray_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int g; + + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + g = *inptr++; + rgb = PACK_SHORT_565(g, g, g); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + g = *inptr++; + rgb = PACK_SHORT_565(g, g, g); + g = *inptr++; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g)); + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + g = *inptr; + rgb = PACK_SHORT_565(g, g, g); + *(INT16*)outptr = rgb; + } + } +} + + +METHODDEF(void) +gray_rgb565D_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + register JSAMPLE * range_limit = cinfo->sample_range_limit; + JDIMENSION num_cols = cinfo->output_width; + INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + + while (--num_rows >= 0) { + INT32 rgb; + unsigned int g; + + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + if (PACK_NEED_ALIGNMENT(outptr)) { + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + *(INT16*)outptr = rgb; + outptr += 2; + num_cols--; + } + for (col = 0; col < (num_cols >> 1); col++) { + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + d0 = DITHER_ROTATE(d0); + + g = *inptr++; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(g, g, g)); + d0 = DITHER_ROTATE(d0); + + WRITE_TWO_ALIGNED_PIXELS(outptr, rgb); + outptr += 4; + } + if (num_cols & 1) { + g = *inptr; + g = range_limit[DITHER_565_R(g, d0)]; + rgb = PACK_SHORT_565(g, g, g); + *(INT16*)outptr = rgb; + } + } +} diff --git a/jdcolor.c b/jdcolor.c index 8dae08df..932c2534 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -7,6 +7,7 @@ * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB * Copyright (C) 2009, 2011-2012, D. R. Commander. + * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * * This file contains output colorspace conversion routines. @@ -543,6 +544,9 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, } +#include "jdcol565.c" + + /* * Empty method for start_pass. */ @@ -649,6 +653,32 @@ jinit_color_deconverter (j_decompress_ptr cinfo) ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; + case JCS_RGB565: + cinfo->out_color_components = 3; + if (cinfo->dither_mode == JDITHER_NONE) { + if (cinfo->jpeg_color_space == JCS_YCbCr) { + cconvert->pub.color_convert = ycc_rgb565_convert; + build_ycc_rgb_table(cinfo); + } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { + cconvert->pub.color_convert = gray_rgb565_convert; + } else if (cinfo->jpeg_color_space == JCS_RGB) { + cconvert->pub.color_convert = rgb_rgb565_convert; + } else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + } else { + /* only ordered dithering is supported */ + if (cinfo->jpeg_color_space == JCS_YCbCr) { + cconvert->pub.color_convert = ycc_rgb565D_convert; + build_ycc_rgb_table(cinfo); + } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { + cconvert->pub.color_convert = gray_rgb565D_convert; + } else if (cinfo->jpeg_color_space == JCS_RGB) { + cconvert->pub.color_convert = rgb_rgb565D_convert; + } else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + } + break; + case JCS_CMYK: cinfo->out_color_components = 4; if (cinfo->jpeg_color_space == JCS_YCCK) { diff --git a/jdmaster.c b/jdmaster.c index b9f78fd0..30be6cf4 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -6,6 +6,8 @@ * Modified 2002-2009 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2009-2011, D. R. Commander. + * Copyright (C) 2013, Linaro Limited. + * For conditions of distribution and use, see the accompanying README file. * * This file contains master control logic for the JPEG decompressor. @@ -51,9 +53,10 @@ use_merged_upsample (j_decompress_ptr cinfo) /* Merging is the equivalent of plain box-filter upsampling */ if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) return FALSE; - /* jdmerge.c only supports YCC=>RGB color conversion */ + /* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */ if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || (cinfo->out_color_space != JCS_RGB && + cinfo->out_color_space != JCS_RGB565 && cinfo->out_color_space != JCS_EXT_RGB && cinfo->out_color_space != JCS_EXT_RGBX && cinfo->out_color_space != JCS_EXT_BGR && @@ -63,8 +66,12 @@ use_merged_upsample (j_decompress_ptr cinfo) cinfo->out_color_space != JCS_EXT_RGBA && cinfo->out_color_space != JCS_EXT_BGRA && cinfo->out_color_space != JCS_EXT_ABGR && - cinfo->out_color_space != JCS_EXT_ARGB) || - cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]) + cinfo->out_color_space != JCS_EXT_ARGB)) + return FALSE; + if ((cinfo->out_color_space == JCS_RGB565 && + cinfo->out_color_components != 3) || + (cinfo->out_color_space != JCS_RGB565 && + cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space])) return FALSE; /* and it only handles 2h1v or 2h2v sampling ratios */ if (cinfo->comp_info[0].h_samp_factor != 2 || @@ -352,6 +359,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space]; break; case JCS_YCbCr: + case JCS_RGB565: cinfo->out_color_components = 3; break; case JCS_CMYK: diff --git a/jdmerge.c b/jdmerge.c index c669b179..b82fe474 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -6,6 +6,7 @@ * Copyright 2009 Pierre Ossman for Cendio AB * libjpeg-turbo Modifications: * Copyright (C) 2009, 2011, D. R. Commander. + * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * * This file contains code for merged upsampling/color conversion. @@ -44,6 +45,38 @@ #ifdef UPSAMPLE_MERGING_SUPPORTED +#define PACK_SHORT_565(r, g, b) ((((r) << 8) & 0xf800) | \ + (((g) << 3) & 0x7E0) | ((b) >> 3)) +#define PACK_TWO_PIXELS(l, r) ((r << 16) | l) +#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3) + +#define WRITE_TWO_PIXELS(addr, pixels) { \ + ((INT16*)(addr))[0] = (pixels); \ + ((INT16*)(addr))[1] = (pixels) >> 16; \ +} +#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32 *)(addr)) = pixels) + +#define DITHER_565_R(r, dither) ((r) + ((dither) & 0xFF)) +#define DITHER_565_G(g, dither) ((g) + (((dither) & 0xFF) >> 1)) +#define DITHER_565_B(b, dither) ((b) + ((dither) & 0xFF)) + + +/* Declarations for ordered dithering + * + * We use a 4x4 ordered dither array packed into 32 bits. This array is + * sufficent for dithering RGB888 to RGB565. + */ + +#define DITHER_MASK 0x3 +#define DITHER_ROTATE(x) (((x) << 24) | (((x) >> 8) & 0x00FFFFFF)) +static const INT32 dither_matrix[4] = { + 0x0008020A, + 0x0C040E06, + 0x030B0109, + 0x0F070D05 +}; + + /* Private subobject */ typedef struct { @@ -260,8 +293,11 @@ merged_2v_upsample (j_decompress_ptr cinfo, if (upsample->spare_full) { /* If we have a spare row saved from a previous cycle, just return it. */ + JDIMENSION size = upsample->out_row_width; + if (cinfo->out_color_space == JCS_RGB565) + size = cinfo->output_width * 2; jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, - 1, upsample->out_row_width); + 1, size); num_rows = 1; upsample->spare_full = FALSE; } else { @@ -416,6 +452,341 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, } +METHODDEF(void) +h2v1_merged_upsample_565 (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + unsigned int r, g, b; + INT32 rgb; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 2 Y values and emit 2 pixels */ + y = GETJSAMPLE(*inptr0++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr0++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr, rgb); + outptr += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr0); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } + } + + +METHODDEF(void) +h2v1_merged_upsample_565D (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + unsigned int r, g, b; + INT32 rgb; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 2 Y values and emit 2 pixels */ + y = GETJSAMPLE(*inptr0++); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr0++); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr, rgb); + outptr += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr0); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr = rgb; + } +} + + +METHODDEF(void) +h2v2_merged_upsample_565 (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + unsigned int r, g, b; + INT32 rgb; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr * 2]; + inptr01 = input_buf[0][in_row_group_ctr * 2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 4 Y values and emit 4 pixels */ + y = GETJSAMPLE(*inptr00++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr00++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr0, rgb); + outptr0 += 4; + + y = GETJSAMPLE(*inptr01++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr01++); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr1, rgb); + outptr1 += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + y = GETJSAMPLE(*inptr00); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr0 = rgb; + + y = GETJSAMPLE(*inptr01); + r = range_limit[y + cred]; + g = range_limit[y + cgreen]; + b = range_limit[y + cblue]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr1 = rgb; + } +} + + +METHODDEF(void) +h2v2_merged_upsample_565D (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + INT32 d0 = dither_matrix[cinfo->output_scanline & DITHER_MASK]; + INT32 d1 = dither_matrix[(cinfo->output_scanline+1) & DITHER_MASK]; + unsigned int r, g, b; + INT32 rgb; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr*2]; + inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + /* Fetch 4 Y values and emit 4 pixels */ + y = GETJSAMPLE(*inptr00++); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr00++); + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + d1 = DITHER_ROTATE(d1); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr0, rgb); + outptr0 += 4; + + y = GETJSAMPLE(*inptr01++); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + d0 = DITHER_ROTATE(d0); + rgb = PACK_SHORT_565(r, g, b); + + y = GETJSAMPLE(*inptr01++); + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + d1 = DITHER_ROTATE(d1); + rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); + + WRITE_TWO_PIXELS(outptr1, rgb); + outptr1 += 4; + } + + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + + y = GETJSAMPLE(*inptr00); + r = range_limit[DITHER_565_R(y + cred, d0)]; + g = range_limit[DITHER_565_G(y + cgreen, d0)]; + b = range_limit[DITHER_565_B(y + cblue, d0)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr0 = rgb; + + y = GETJSAMPLE(*inptr01); + r = range_limit[DITHER_565_R(y + cred, d1)]; + g = range_limit[DITHER_565_G(y + cgreen, d1)]; + b = range_limit[DITHER_565_B(y + cblue, d1)]; + rgb = PACK_SHORT_565(r, g, b); + *(INT16*)outptr1 = rgb; + } +} + + /* * Module initialization routine for merged upsampling/color conversion. * @@ -444,6 +815,13 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) upsample->upmethod = jsimd_h2v2_merged_upsample; else upsample->upmethod = h2v2_merged_upsample; + if (cinfo->out_color_space == JCS_RGB565) { + if (cinfo->dither_mode != JDITHER_NONE) { + upsample->upmethod = h2v2_merged_upsample_565D; + } else { + upsample->upmethod = h2v2_merged_upsample_565; + } + } /* Allocate a spare row buffer */ upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, @@ -454,6 +832,13 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) upsample->upmethod = jsimd_h2v1_merged_upsample; else upsample->upmethod = h2v1_merged_upsample; + if (cinfo->out_color_space == JCS_RGB565) { + if (cinfo->dither_mode != JDITHER_NONE) { + upsample->upmethod = h2v1_merged_upsample_565D; + } else { + upsample->upmethod = h2v1_merged_upsample_565; + } + } /* No spare row needed */ upsample->spare_row = NULL; } diff --git a/jmorecfg.h b/jmorecfg.h index f41eccf0..71ecb757 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * Modifications: - * Copyright (C) 2009, 2011, D. R. Commander. + * Copyright (C) 2009, 2011, 2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains additional configuration options that customize the @@ -317,7 +317,7 @@ typedef int boolean; #define RGB_BLUE 2 /* Offset of Blue */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ -#define JPEG_NUMCS 16 +#define JPEG_NUMCS 17 #define EXT_RGB_RED 0 #define EXT_RGB_GREEN 1 @@ -352,25 +352,29 @@ typedef int boolean; static const int rgb_red[JPEG_NUMCS] = { -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, - EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED + EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, + -1 }; static const int rgb_green[JPEG_NUMCS] = { -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, - EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN + EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, + -1 }; static const int rgb_blue[JPEG_NUMCS] = { -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, - EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE + EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, + -1 }; static const int rgb_pixelsize[JPEG_NUMCS] = { -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, - EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE + EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, + -1 }; /* Definitions for speed-related optimizations. */ diff --git a/jpeglib.h b/jpeglib.h index 55c6abcf..ee757b9d 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -5,7 +5,7 @@ * Copyright (C) 1991-1998, Thomas G. Lane. * Modified 2002-2009 by Guido Vollbeding. * Modifications: - * Copyright (C) 2009-2011, 2013, D. R. Commander. + * Copyright (C) 2009-2011, 2013-2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file defines the application interface for the JPEG library. @@ -237,7 +237,8 @@ typedef enum { JCS_EXT_RGBA, /* red/green/blue/alpha */ JCS_EXT_BGRA, /* blue/green/red/alpha */ JCS_EXT_ABGR, /* alpha/blue/green/red */ - JCS_EXT_ARGB /* alpha/red/green/blue */ + JCS_EXT_ARGB, /* alpha/red/green/blue */ + JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */ } J_COLOR_SPACE; /* DCT/IDCT algorithm options. */ diff --git a/wrbmp.c b/wrbmp.c index b8e213b2..d769404f 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -1,8 +1,10 @@ /* * wrbmp.c * + * This file was part of the Independent JPEG Group's software. * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * Modifications: + * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in Microsoft "BMP" @@ -89,11 +91,30 @@ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, */ inptr = dest->pub.buffer[0]; outptr = image_ptr[0]; - for (col = cinfo->output_width; col > 0; col--) { - outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ - outptr[1] = *inptr++; - outptr[0] = *inptr++; - outptr += 3; + + if(cinfo->out_color_space == JCS_RGB565) { + #define red_mask 0xF800 + #define green_mask 0x7E0 + #define blue_mask 0x1F + unsigned char r, g, b; + unsigned short *inptr2 = (unsigned short *)inptr; + for (col = cinfo->output_width; col > 0; col--) { + r = (*inptr2 & red_mask) >> 11; + g = (*inptr2 & green_mask) >> 5; + b = (*inptr2 & blue_mask); + outptr[0] = b << 3; + outptr[1] = g << 2; + outptr[2] = r << 3; + outptr += 3; + inptr2++; + } + } else { + for (col = cinfo->output_width; col > 0; col--) { + outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */ + outptr[1] = *inptr++; + outptr[0] = *inptr++; + outptr += 3; + } } /* Zero out the pad bytes. */ @@ -181,6 +202,9 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) bits_per_pixel = 24; cmap_entries = 0; } + } else if (cinfo->out_color_space == JCS_RGB565) { + bits_per_pixel = 24; + cmap_entries = 0; } else { /* Grayscale output. We need to fake a 256-entry colormap. */ bits_per_pixel = 8; @@ -246,6 +270,9 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) bits_per_pixel = 24; cmap_entries = 0; } + } else if (cinfo->out_color_space == JCS_RGB565) { + bits_per_pixel = 24; + cmap_entries = 0; } else { /* Grayscale output. We need to fake a 256-entry colormap. */ bits_per_pixel = 8; @@ -407,6 +434,8 @@ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) dest->pub.put_pixel_rows = put_gray_rows; else dest->pub.put_pixel_rows = put_pixel_rows; + } else if(cinfo->out_color_space == JCS_RGB565 ) { + dest->pub.put_pixel_rows = put_pixel_rows; } else { ERREXIT(cinfo, JERR_BMP_COLORSPACE); } @@ -415,16 +444,26 @@ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) jpeg_calc_output_dimensions(cinfo); /* Determine width of rows in the BMP file (padded to 4-byte boundary). */ - row_width = cinfo->output_width * cinfo->output_components; - dest->data_width = row_width; - while ((row_width & 3) != 0) row_width++; - dest->row_width = row_width; - dest->pad_bytes = (int) (row_width - dest->data_width); + if (cinfo->out_color_space == JCS_RGB565) { + row_width = cinfo->output_width * 2; + dest->row_width = dest->data_width = cinfo->output_width * 3; + } else { + row_width = cinfo->output_width * cinfo->output_components; + dest->row_width = dest->data_width = row_width; + } + while ((dest->row_width & 3) != 0) dest->row_width++; + dest->pad_bytes = (int) (dest->row_width - dest->data_width); + if (cinfo->out_color_space == JCS_RGB565) { + while ((row_width & 3) != 0) row_width++; + } else { + row_width = dest->row_width; + } + /* Allocate space for inversion array, prepare for write pass */ dest->whole_image = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - row_width, cinfo->output_height, (JDIMENSION) 1); + dest->row_width, cinfo->output_height, (JDIMENSION) 1); dest->cur_output_row = 0; if (cinfo->progress != NULL) { cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress; From 0297e2a61d4ce6f450b577cd83432ed1965e7cac Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 13 May 2014 18:38:36 +0000 Subject: [PATCH 918/985] The x86/x86-64 SIMD extensions were originally designed to accommodate changing the value of RGB_*, but this apparently broke when RGB-to-gray colorspace conversion was accelerated. Further, the ARM NEON extensions have always assumed that JCS_RGB behaves identically to JCS_EXT_RGB. Rather than fix these issues, it makes more sense to just stop claiming that we support changing the values of RGB_*, since doing so is no longer necessary. --- jmorecfg.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/jmorecfg.h b/jmorecfg.h index 71ecb757..1894e0fc 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -298,18 +298,24 @@ typedef int boolean; /* - * Ordering of RGB data in scanlines passed to or from the application. - * If your application wants to deal with data in the order B,G,R, just - * change these macros. You can also deal with formats such as R,G,B,X - * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing - * the offsets will also change the order in which colormap data is organized. - * RESTRICTIONS: - * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. - * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not - * useful if you are using JPEG color spaces other than YCbCr or grayscale. - * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE - * is not 3 (they don't understand about dummy color components!). So you - * can't use color quantization if you change that value. + * The RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros are a vestigial + * feature of libjpeg. The idea was that, if an application developer needed + * to compress from/decompress to a BGR/BGRX/RGBX/XBGR/XRGB buffer, they could + * change these macros, rebuild libjpeg, and link their application statically + * with it. In reality, few people ever did this, because there were some + * severe restrictions involved (cjpeg and djpeg no longer worked properly, + * compressing/decompressing RGB JPEGs no longer worked properly, and the color + * quantizer wouldn't work with pixel sizes other than 3.) Further, since all + * of the O/S-supplied versions of libjpeg were built with the default values + * of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications have + * come to regard these values as immutable. + * + * The libjpeg-turbo colorspace extensions provide a much cleaner way of + * compressing from/decompressing to buffers with arbitrary component orders + * and pixel sizes. Thus, we do not support changing the values of RGB_RED, + * RGB_GREEN, RGB_BLUE, or RGB_PIXELSIZE. In addition to the restrictions + * listed above, changing these values will also break the SIMD extensions and + * the regression tests. */ #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ From 38bfd451d543df5a7ae5ef9938a82481176c5f4a Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 13 May 2014 18:40:14 +0000 Subject: [PATCH 919/985] SIMD-accelerated merged upsampling routines for MIPS DSPr2 --- simd/jsimd.h | 57 ++++++ simd/jsimd_mips.c | 82 +++++++++ simd/jsimd_mips_dspr2.S | 389 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 527 insertions(+), 1 deletion(-) diff --git a/simd/jsimd.h b/simd/jsimd.h index 6d4178be..dc227edd 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -631,6 +631,63 @@ EXTERN(void) jsimd_h2v2_fancy_upsample_mips_dspr2 JPP((int max_v_samp_factor, JDIMENSION downsampled_width, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +EXTERN(void) jsimd_h2v2_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2 + JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, + JSAMPLE* range)); + EXTERN(void) jsimd_h2v2_upsample_mips_dspr2 JPP((int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index e7b8c5e4..63a25cb9 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -425,12 +425,28 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, GLOBAL(int) jsimd_can_h2v2_merged_upsample (void) { + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + return 0; } GLOBAL(int) jsimd_can_h2v1_merged_upsample (void) { + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + return 0; } @@ -440,6 +456,39 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { + void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); + + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + mipsdspr2fct=jsimd_h2v2_extrgbx_merged_upsample_mips_dspr2; + break; + case JCS_EXT_BGR: + mipsdspr2fct=jsimd_h2v2_extbgr_merged_upsample_mips_dspr2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + mipsdspr2fct=jsimd_h2v2_extbgrx_merged_upsample_mips_dspr2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + mipsdspr2fct=jsimd_h2v2_extxbgr_merged_upsample_mips_dspr2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + mipsdspr2fct=jsimd_h2v2_extxrgb_merged_upsample_mips_dspr2; + break; + default: + mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2; + break; + } + + mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, + output_buf, cinfo->sample_range_limit); } GLOBAL(void) @@ -448,6 +497,39 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { + void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); + + switch(cinfo->out_color_space) + { + case JCS_EXT_RGB: + mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2; + break; + case JCS_EXT_RGBX: + case JCS_EXT_RGBA: + mipsdspr2fct=jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2; + break; + case JCS_EXT_BGR: + mipsdspr2fct=jsimd_h2v1_extbgr_merged_upsample_mips_dspr2; + break; + case JCS_EXT_BGRX: + case JCS_EXT_BGRA: + mipsdspr2fct=jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2; + break; + case JCS_EXT_XBGR: + case JCS_EXT_ABGR: + mipsdspr2fct=jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2; + break; + case JCS_EXT_XRGB: + case JCS_EXT_ARGB: + mipsdspr2fct=jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2; + break; + default: + mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2; + break; + } + + mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, + output_buf, cinfo->sample_range_limit); } GLOBAL(int) diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index 96aafd4d..d7d76f7c 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -1,7 +1,7 @@ /* * MIPS DSPr2 optimizations for libjpeg-turbo * - * Copyright (C) 2013, MIPS Technologies, Inc., California. + * Copyright (C) 2013-2014, MIPS Technologies, Inc., California. * All rights reserved. * Authors: Teodora Novkovic (teodora.novkovic@imgtec.com) * Darko Laus (darko.laus@imgtec.com) @@ -376,6 +376,393 @@ GENERATE_JSIMD_RGB_GRAY_CONVERT_MIPS_DSPR2 extbgrx, 4, 2, 1, 0 GENERATE_JSIMD_RGB_GRAY_CONVERT_MIPS_DSPR2 extxbgr, 4, 3, 2, 1 GENERATE_JSIMD_RGB_GRAY_CONVERT_MIPS_DSPR2 extxrgb, 4, 1, 2, 3 /*****************************************************************************/ +/* + * jsimd_h2v2_merged_upsample_mips_dspr2 + * jsimd_h2v2_extrgb_merged_upsample_mips_dspr2 + * jsimd_h2v2_extrgbx_merged_upsample_mips_dspr2 + * jsimd_h2v2_extbgr_merged_upsample_mips_dspr2 + * jsimd_h2v2_extbgrx_merged_upsample_mips_dspr2 + * jsimd_h2v2_extxbgr_merged_upsample_mips_dspr2 + * jsimd_h2v2_extxrgb_merged_upsample_mips_dspr2 + * + * Merged h2v2 upsample routines + */ +.macro GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 colorid, \ + pixel_size, \ + r1_offs, \ + g1_offs, \ + b1_offs, \ + a1_offs, \ + r2_offs, \ + g2_offs, \ + b2_offs, \ + a2_offs + +.macro STORE_H2V2_2_PIXELS scratch0 \ + scratch1 \ + scratch2 \ + scratch3 \ + scratch4 \ + scratch5 \ + outptr + sb \scratch0, \r1_offs(\outptr) + sb \scratch1, \g1_offs(\outptr) + sb \scratch2, \b1_offs(\outptr) + sb \scratch3, \r2_offs(\outptr) + sb \scratch4, \g2_offs(\outptr) + sb \scratch5, \b2_offs(\outptr) +.if (\pixel_size == 8) + li \scratch0, 0xFF + sb \scratch0, \a1_offs(\outptr) + sb \scratch0, \a2_offs(\outptr) +.endif + addiu \outptr, \pixel_size +.endm + +.macro STORE_H2V2_1_PIXEL scratch0 \ + scratch1 \ + scratch2 \ + outptr + sb \scratch0, \r1_offs(\outptr) + sb \scratch1, \g1_offs(\outptr) + sb \scratch2, \b1_offs(\outptr) + +.if (\pixel_size == 8) + li t0, 0xFF + sb t0, \a1_offs(\outptr) +.endif +.endm + +LEAF_MIPS_DSPR2(jsimd_h2v2_\colorid\()_merged_upsample_mips_dspr2) +/* + * a0 - cinfo->output_width + * a1 - input_buf + * a2 - in_row_group_ctr + * a3 - output_buf + * 16(sp) - cinfo->sample_range_limit + */ + + SAVE_REGS_ON_STACK 40, s0, s1, s2, s3, s4, s5, s6, s7, ra + + lw t9, 56(sp) // cinfo->sample_range_limit + lw v0, 0(a1) + lw v1, 4(a1) + lw t0, 8(a1) + sll t1, a2, 3 + addiu t2, t1, 4 + sll t3, a2, 2 + lw t4, 0(a3) // t4 = output_buf[0] + lwx t1, t1(v0) // t1 = input_buf[0][in_row_group_ctr*2] + lwx t2, t2(v0) // t2 = input_buf[0][in_row_group_ctr*2 + 1] + lwx t5, t3(v1) // t5 = input_buf[1][in_row_group_ctr] + lwx t6, t3(t0) // t6 = input_buf[2][in_row_group_ctr] + lw t7, 4(a3) // t7 = output_buf[1] + li s1, 0xe6ea + addiu t8, s1, 0x7fff // t8 = 0x166e9 [FIX(1.40200)] + addiu s0, t8, 0x5eb9 // s0 = 0x1c5a2 [FIX(1.77200)] + addiu s1, zero, 0xa7e6 // s4 = 0xffffa7e6 [-FIX(0.34414)] + xori s2, s1, 0xeec8 // s3 = 0xffff492e [-FIX(0.71414)] + srl t3, a0, 1 + blez t3, 2f + addu t0, t5, t3 // t0 = end address + 1: + lbu t3, 0(t5) + lbu s3, 0(t6) + addiu t5, t5, 1 + addiu t3, t3, -128 // (cb - 128) + addiu s3, s3, -128 // (cr - 128) + mult $ac1, s1, t3 + madd $ac1, s2, s3 + sll s3, s3, 15 + sll t3, t3, 15 + mulq_rs.w s4, t8, s3 // s4 = (C1 * cr + ONE_HALF)>> SCALEBITS + extr_r.w s5, $ac1, 16 + mulq_rs.w s6, s0, t3 // s6 = (C2 * cb + ONE_HALF)>> SCALEBITS + lbu v0, 0(t1) + addiu t6, t6, 1 + addiu t1, t1, 2 + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu AT, 0(t3) + lbu s7, 0(s3) + lbu ra, 0(v1) + lbu v0, -1(t1) + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu t3, 0(t3) + lbu s3, 0(s3) + lbu v1, 0(v1) + lbu v0, 0(t2) + + STORE_H2V2_2_PIXELS AT, s7, ra, t3, s3, v1, t4 + + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu AT, 0(t3) + lbu s7, 0(s3) + lbu ra, 0(v1) + lbu v0, 1(t2) + addiu t2, t2, 2 + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu t3, 0(t3) + lbu s3, 0(s3) + lbu v1, 0(v1) + + STORE_H2V2_2_PIXELS AT, s7, ra, t3, s3, v1, t7 + + bne t0, t5, 1b + nop +2: + andi t0, a0, 1 + beqz t0, 4f + lbu t3, 0(t5) + lbu s3, 0(t6) + addiu t3, t3, -128 // (cb - 128) + addiu s3, s3, -128 // (cr - 128) + mult $ac1, s1, t3 + madd $ac1, s2, s3 + sll s3, s3, 15 + sll t3, t3, 15 + lbu v0, 0(t1) + extr_r.w s5, $ac1, 16 + mulq_rs.w s4, t8, s3 // s4 = (C1 * cr + ONE_HALF)>> SCALEBITS + mulq_rs.w s6, s0, t3 // s6 = (C2 * cb + ONE_HALF)>> SCALEBITS + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu t3, 0(t3) + lbu s3, 0(s3) + lbu v1, 0(v1) + lbu v0, 0(t2) + + STORE_H2V2_1_PIXEL t3, s3, v1, t4 + + addu t3, v0, s4 // y+cred + addu s3, v0, s5 // y+cgreen + addu v1, v0, s6 // y+cblue + addu t3, t9, t3 // y+cred + addu s3, t9, s3 // y+cgreen + addu v1, t9, v1 // y+cblue + lbu t3, 0(t3) + lbu s3, 0(s3) + lbu v1, 0(v1) + + STORE_H2V2_1_PIXEL t3, s3, v1, t7 +4: + RESTORE_REGS_FROM_STACK 40, s0, s1, s2, s3, s4, s5, s6, s7, ra + + j ra + nop + +END(jsimd_h2v2_\colorid\()_merged_upsample_mips_dspr2) + +.purgem STORE_H2V2_1_PIXEL +.purgem STORE_H2V2_2_PIXELS +.endm + +/*-----------------------------------------id -- pix R1 G1 B1 A1 R2 G2 B2 A2 */ +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extrgb, 6, 0, 1, 2, 6, 3, 4, 5, 6 +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extbgr, 6, 2, 1, 0, 3, 5, 4, 3, 6 +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extrgbx, 8, 0, 1, 2, 3, 4, 5, 6, 7 +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extbgrx, 8, 2, 1, 0, 3, 6, 5, 4, 7 +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extxbgr, 8, 3, 2, 1, 0, 7, 6, 5, 4 +GENERATE_H2V2_MERGED_UPSAMPLE_MIPS_DSPR2 extxrgb, 8, 1, 2, 3, 0, 5, 6, 7, 4 +/*****************************************************************************/ +/* + * jsimd_h2v1_merged_upsample_mips_dspr2 + * jsimd_h2v1_extrgb_merged_upsample_mips_dspr2 + * jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2 + * jsimd_h2v1_extbgr_merged_upsample_mips_dspr2 + * jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2 + * jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2 + * jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2 + * + * Merged h2v1 upsample routines + */ + +.macro GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 colorid, \ + pixel_size, \ + r1_offs, \ + g1_offs, \ + b1_offs, \ + a1_offs, \ + r2_offs, \ + g2_offs, \ + b2_offs, \ + a2_offs + +.macro STORE_H2V1_2_PIXELS scratch0 \ + scratch1 \ + scratch2 \ + scratch3 \ + scratch4 \ + scratch5 \ + outptr + sb \scratch0, \r1_offs(\outptr) + sb \scratch1, \g1_offs(\outptr) + sb \scratch2, \b1_offs(\outptr) + sb \scratch3, \r2_offs(\outptr) + sb \scratch4, \g2_offs(\outptr) + sb \scratch5, \b2_offs(\outptr) +.if (\pixel_size == 8) + li t0, 0xFF + sb t0, \a1_offs(\outptr) + sb t0, \a2_offs(\outptr) +.endif + addiu \outptr, \pixel_size +.endm + +.macro STORE_H2V1_1_PIXEL scratch0 \ + scratch1 \ + scratch2 \ + outptr + sb \scratch0, \r1_offs(\outptr) + sb \scratch1, \g1_offs(\outptr) + sb \scratch2, \b1_offs(\outptr) +.if (\pixel_size == 8) + li t0, 0xFF + sb t0, \a1_offs(\outptr) +.endif +.endm + +LEAF_MIPS_DSPR2(jsimd_h2v1_\colorid\()_merged_upsample_mips_dspr2) +/* + * a0 - cinfo->output_width + * a1 - input_buf + * a2 - in_row_group_ctr + * a3 - output_buf + * 16(sp) - range_limit + */ + + SAVE_REGS_ON_STACK 40, s0, s1, s2, s3, s4, s5, s6, s7, ra + + li t0, 0xe6ea + lw t1, 0(a1) // t1 = input_buf[0] + lw t2, 4(a1) // t2 = input_buf[1] + lw t3, 8(a1) // t3 = input_buf[2] + lw t8, 56(sp) // t8 = range_limit + addiu s1, t0, 0x7fff // s1 = 0x166e9 [FIX(1.40200)] + addiu s2, s1, 0x5eb9 // s2 = 0x1c5a2 [FIX(1.77200)] + addiu s0, t0, 0x9916 // s0 = 0x8000 + addiu s4, zero, 0xa7e6 // s4 = 0xffffa7e6 [-FIX(0.34414)] + xori s3, s4, 0xeec8 // s3 = 0xffff492e [-FIX(0.71414)] + srl t0, a0, 1 + sll t4, a2, 2 + lwx s5, t4(t1) // s5 = inptr0 + lwx s6, t4(t2) // s6 = inptr1 + lwx s7, t4(t3) // s7 = inptr2 + lw t7, 0(a3) // t7 = outptr + blez t0, 2f + addu t9, s6, t0 // t9 = end address +1: + lbu t2, 0(s6) // t2 = cb + lbu t0, 0(s7) // t0 = cr + lbu t1, 0(s5) // t1 = y + addiu t2, t2, -128 // t2 = cb - 128 + addiu t0, t0, -128 // t0 = cr - 128 + mult $ac1, s4, t2 + madd $ac1, s3, t0 + sll t0, t0, 15 + sll t2, t2, 15 + mulq_rs.w t0, s1, t0 // t0 = (C1*cr + ONE_HALF)>> SCALEBITS + extr_r.w t5, $ac1, 16 + mulq_rs.w t6, s2, t2 // t6 = (C2*cb + ONE_HALF)>> SCALEBITS + addiu s7, s7, 1 + addiu s6, s6, 1 + addu t2, t1, t0 // t2 = y + cred + addu t3, t1, t5 // t3 = y + cgreen + addu t4, t1, t6 // t4 = y + cblue + addu t2, t8, t2 + addu t3, t8, t3 + addu t4, t8, t4 + lbu t1, 1(s5) + lbu v0, 0(t2) + lbu v1, 0(t3) + lbu ra, 0(t4) + addu t2, t1, t0 + addu t3, t1, t5 + addu t4, t1, t6 + addu t2, t8, t2 + addu t3, t8, t3 + addu t4, t8, t4 + lbu t2, 0(t2) + lbu t3, 0(t3) + lbu t4, 0(t4) + + STORE_H2V1_2_PIXELS v0, v1, ra, t2, t3, t4, t7 + + bne t9, s6, 1b + addiu s5, s5, 2 +2: + andi t0, a0, 1 + beqz t0, 4f + nop +3: + lbu t2, 0(s6) + lbu t0, 0(s7) + lbu t1, 0(s5) + addiu t2, t2, -128 //(cb - 128) + addiu t0, t0, -128 //(cr - 128) + mul t3, s4, t2 + mul t4, s3, t0 + sll t0, t0, 15 + sll t2, t2, 15 + mulq_rs.w t0, s1, t0 // (C1*cr + ONE_HALF)>> SCALEBITS + mulq_rs.w t6, s2, t2 // (C2*cb + ONE_HALF)>> SCALEBITS + addu t3, t3, s0 + addu t3, t4, t3 + sra t5, t3, 16 // (C4*cb + ONE_HALF + C3*cr)>> SCALEBITS + addu t2, t1, t0 // y + cred + addu t3, t1, t5 // y + cgreen + addu t4, t1, t6 // y + cblue + addu t2, t8, t2 + addu t3, t8, t3 + addu t4, t8, t4 + lbu t2, 0(t2) + lbu t3, 0(t3) + lbu t4, 0(t4) + + STORE_H2V1_1_PIXEL t2, t3, t4, t7 +4: + RESTORE_REGS_FROM_STACK 40, s0, s1, s2, s3, s4, s5, s6, s7, ra + + j ra + nop + +END(jsimd_h2v1_\colorid\()_merged_upsample_mips_dspr2) + +.purgem STORE_H2V1_1_PIXEL +.purgem STORE_H2V1_2_PIXELS +.endm + +/*-----------------------------------------id -- pix R1 G1 B1 A1 R2 G2 B2 A2 */ +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extrgb, 6, 0, 1, 2, 6, 3, 4, 5, 6 +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extbgr, 6, 2, 1, 0, 3, 5, 4, 3, 6 +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extrgbx, 8, 0, 1, 2, 3, 4, 5, 6, 7 +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extbgrx, 8, 2, 1, 0, 3, 6, 5, 4, 7 +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extxbgr, 8, 3, 2, 1, 0, 7, 6, 5, 4 +GENERATE_H2V1_MERGED_UPSAMPLE_MIPS_DSPR2 extxrgb, 8, 1, 2, 3, 0, 5, 6, 7, 4 +/*****************************************************************************/ /* * jsimd_h2v2_fancy_upsample_mips_dspr2 * From f66c307c2ec44926e9313af65be5240a74810da3 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 14 May 2014 14:57:43 +0000 Subject: [PATCH 920/985] Minor tweak to improve code readability --- jcsample.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jcsample.c b/jcsample.c index 4662bee3..76dcfcd4 100644 --- a/jcsample.c +++ b/jcsample.c @@ -506,12 +506,13 @@ jinit_downsampler (j_compress_ptr cinfo) if (cinfo->smoothing_factor) { downsample->methods[ci] = h2v2_smooth_downsample; downsample->pub.need_context_rows = TRUE; - } else + } else { #endif if (jsimd_can_h2v2_downsample()) downsample->methods[ci] = jsimd_h2v2_downsample; else downsample->methods[ci] = h2v2_downsample; + } } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { smoothok = FALSE; From c4c3ac6305e0f5be65cd903425dc134df2066acc Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 14 May 2014 15:00:10 +0000 Subject: [PATCH 921/985] SIMD-accelerated h2v2 smooth downsampling routine for MIPS DSPr2 --- jcsample.c | 5 +- jsimd.h | 7 + jsimd_none.c | 12 ++ simd/jsimd.h | 5 + simd/jsimd_mips.c | 28 ++++ simd/jsimd_mips_dspr2.S | 300 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 356 insertions(+), 1 deletion(-) diff --git a/jcsample.c b/jcsample.c index 76dcfcd4..36ae7846 100644 --- a/jcsample.c +++ b/jcsample.c @@ -504,7 +504,10 @@ jinit_downsampler (j_compress_ptr cinfo) compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { - downsample->methods[ci] = h2v2_smooth_downsample; + if (jsimd_can_h2v2_smooth_downsample()) + downsample->methods[ci] = jsimd_h2v2_smooth_downsample; + else + downsample->methods[ci] = h2v2_smooth_downsample; downsample->pub.need_context_rows = TRUE; } else { #endif diff --git a/jsimd.h b/jsimd.h index ae072157..2817137d 100644 --- a/jsimd.h +++ b/jsimd.h @@ -60,6 +60,13 @@ EXTERN(int) jsimd_can_h2v1_downsample JPP((void)); EXTERN(void) jsimd_h2v2_downsample JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)); + +EXTERN(int) jsimd_can_h2v2_smooth_downsample JPP((void)); + +EXTERN(void) jsimd_h2v2_smooth_downsample + JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data)); + EXTERN(void) jsimd_h2v1_downsample JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)); diff --git a/jsimd_none.c b/jsimd_none.c index 7b2e9651..a6e82759 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -69,12 +69,24 @@ jsimd_can_h2v1_downsample (void) return 0; } +GLOBAL(int) +jsimd_can_h2v2_smooth_downsample (void) +{ + return 0; +} + GLOBAL(void) jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { } +GLOBAL(void) +jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ +} + GLOBAL(void) jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) diff --git a/simd/jsimd.h b/simd/jsimd.h index dc227edd..7067a2d7 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -498,6 +498,11 @@ EXTERN(void) jsimd_h2v2_downsample_mips_dspr2 JPP((JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, JDIMENSION width_blocks, JSAMPARRAY input_data, JSAMPARRAY output_data)); +EXTERN(void) jsimd_h2v2_smooth_downsample_mips_dspr2 + JPP((JSAMPARRAY input_data, JSAMPARRAY output_data, + JDIMENSION v_samp_factor, int max_v_samp_factor, + int smoothing_factor, JDIMENSION width_blocks, + JDIMENSION image_width)); EXTERN(void) jsimd_h2v1_downsample_mips_dspr2 JPP((JDIMENSION image_width, int max_v_samp_factor, JDIMENSION v_samp_factor, JDIMENSION width_blocks, diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index 63a25cb9..aebd549a 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -278,6 +278,24 @@ jsimd_can_h2v2_downsample (void) return 0; } +GLOBAL(int) +jsimd_can_h2v2_smooth_downsample (void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if(DCTSIZE != 8) + return 0; + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + + return 0; +} + GLOBAL(int) jsimd_can_h2v1_downsample (void) { @@ -304,6 +322,16 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, compptr->width_in_blocks, input_data, output_data); } +GLOBAL(void) +jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + jsimd_h2v2_smooth_downsample_mips_dspr2(input_data, output_data, + compptr->v_samp_factor, cinfo->max_v_samp_factor, + cinfo->smoothing_factor, compptr->width_in_blocks, + cinfo->image_width); +} + GLOBAL(void) jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index d7d76f7c..725b5589 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -1210,6 +1210,306 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_downsample_mips_dspr2) nop END(jsimd_h2v2_downsample_mips_dspr2) /*****************************************************************************/ +LEAF_MIPS_DSPR2(jsimd_h2v2_smooth_downsample_mips_dspr2) +/* + * a0 - input_data + * a1 - output_data + * a2 - compptr->v_samp_factor + * a3 - cinfo->max_v_samp_factor + * 16(sp) - cinfo->smoothing_factor + * 20(sp) - compptr->width_in_blocks + * 24(sp) - cinfo->image_width + */ + + .set at + + SAVE_REGS_ON_STACK 32, s0, s1, s2, s3, s4, s5, s6, s7 + + lw s7, 52(sp) // compptr->width_in_blocks + lw s0, 56(sp) // cinfo->image_width + lw s6, 48(sp) // cinfo->smoothing_factor + sll s7, 3 // output_cols = width_in_blocks * DCTSIZE + sll v0, s7, 1 + subu v0, v0, s0 + blez v0, 2f + move v1, zero + addiu t0, a3, 2 // t0 = cinfo->max_v_samp_factor + 2 +0: + addiu t1, a0, -4 + sll t2, v1, 2 + lwx t1, t2(t1) + move t3, v0 + addu t1, t1, s0 + lbu t2, -1(t1) +1: + addiu t3, t3, -1 + sb t2, 0(t1) + bgtz t3, 1b + addiu t1, t1, 1 + addiu v1, v1, 1 + bne v1, t0, 0b + nop +2: + li v0, 80 + mul v0, s6, v0 + li v1, 16384 + move t4, zero + move t5, zero + subu t6, v1, v0 // t6 = 16384 - tmp_smoot_f * 80 + sll t7, s6, 4 // t7 = tmp_smoot_f * 16 +3: +/* Special case for first column: pretend column -1 is same as column 0 */ + sll v0, t4, 2 + lwx t8, v0(a1) // outptr = output_data[outrow] + sll v1, t5, 2 + addiu t9, v1, 4 + addiu s0, v1, -4 + addiu s1, v1, 8 + lwx s2, v1(a0) // inptr0 = input_data[inrow] + lwx t9, t9(a0) // inptr1 = input_data[inrow+1] + lwx s0, s0(a0) // above_ptr = input_data[inrow-1] + lwx s1, s1(a0) // below_ptr = input_data[inrow+2] + lh v0, 0(s2) + lh v1, 0(t9) + lh t0, 0(s0) + lh t1, 0(s1) + ins v0, v1, 16, 16 + ins t0, t1, 16, 16 + raddu.w.qb t2, v0 + raddu.w.qb s3, t0 + lbu v0, 0(s2) + lbu v1, 2(s2) + lbu t0, 0(t9) + lbu t1, 2(t9) + addu v0, v0, v1 + mult $ac1,t2, t6 + addu t0, t0, t1 + lbu t2, 2(s0) + addu t0, t0, v0 + lbu t3, 2(s1) + addu s3, t0, s3 + lbu v0, 0(s0) + lbu t0, 0(s1) + sll s3, s3, 1 + addu v0, v0, t2 + addu t0, t0, t3 + addu t0, t0, v0 + addu s3, t0, s3 + madd $ac1,s3, t7 + extr_r.w v0, $ac1, 16 + addiu t8, t8, 1 + addiu s2, s2, 2 + addiu t9, t9, 2 + addiu s0, s0, 2 + addiu s1, s1, 2 + sb v0, -1(t8) + addiu s4, s7, -2 + and s4, s4, 3 + addu s5, s4, t8 //end adress +4: + lh v0, 0(s2) + lh v1, 0(t9) + lh t0, 0(s0) + lh t1, 0(s1) + ins v0, v1, 16, 16 + ins t0, t1, 16, 16 + raddu.w.qb t2, v0 + raddu.w.qb s3, t0 + lbu v0, -1(s2) + lbu v1, 2(s2) + lbu t0, -1(t9) + lbu t1, 2(t9) + addu v0, v0, v1 + mult $ac1, t2, t6 + addu t0, t0, t1 + lbu t2, 2(s0) + addu t0, t0, v0 + lbu t3, 2(s1) + addu s3, t0, s3 + lbu v0, -1(s0) + lbu t0, -1(s1) + sll s3, s3, 1 + addu v0, v0, t2 + addu t0, t0, t3 + addu t0, t0, v0 + addu s3, t0, s3 + madd $ac1, s3, t7 + extr_r.w t2, $ac1, 16 + addiu t8, t8, 1 + addiu s2, s2, 2 + addiu t9, t9, 2 + addiu s0, s0, 2 + sb t2, -1(t8) + bne s5, t8, 4b + addiu s1, s1, 2 + addiu s5, s7, -2 + subu s5, s5, s4 + addu s5, s5, t8 //end adress +5: + lh v0, 0(s2) + lh v1, 0(t9) + lh t0, 0(s0) + lh t1, 0(s1) + ins v0, v1, 16, 16 + ins t0, t1, 16, 16 + raddu.w.qb t2, v0 + raddu.w.qb s3, t0 + lbu v0, -1(s2) + lbu v1, 2(s2) + lbu t0, -1(t9) + lbu t1, 2(t9) + addu v0, v0, v1 + mult $ac1, t2, t6 + addu t0, t0, t1 + lbu t2, 2(s0) + addu t0, t0, v0 + lbu t3, 2(s1) + addu s3, t0, s3 + lbu v0, -1(s0) + lbu t0, -1(s1) + sll s3, s3, 1 + addu v0, v0, t2 + addu t0, t0, t3 + lh v1, 2(t9) + addu t0, t0, v0 + lh v0, 2(s2) + addu s3, t0, s3 + lh t0, 2(s0) + lh t1, 2(s1) + madd $ac1, s3, t7 + extr_r.w t2, $ac1, 16 + ins t0, t1, 16, 16 + ins v0, v1, 16, 16 + raddu.w.qb s3, t0 + lbu v1, 4(s2) + lbu t0, 1(t9) + lbu t1, 4(t9) + sb t2, 0(t8) + raddu.w.qb t3, v0 + lbu v0, 1(s2) + addu t0, t0, t1 + mult $ac1, t3, t6 + addu v0, v0, v1 + lbu t2, 4(s0) + addu t0, t0, v0 + lbu v0, 1(s0) + addu s3, t0, s3 + lbu t0, 1(s1) + lbu t3, 4(s1) + addu v0, v0, t2 + sll s3, s3, 1 + addu t0, t0, t3 + lh v1, 4(t9) + addu t0, t0, v0 + lh v0, 4(s2) + addu s3, t0, s3 + lh t0, 4(s0) + lh t1, 4(s1) + madd $ac1, s3, t7 + extr_r.w t2, $ac1, 16 + ins t0, t1, 16, 16 + ins v0, v1, 16, 16 + raddu.w.qb s3, t0 + lbu v1, 6(s2) + lbu t0, 3(t9) + lbu t1, 6(t9) + sb t2, 1(t8) + raddu.w.qb t3, v0 + lbu v0, 3(s2) + addu t0, t0,t1 + mult $ac1, t3, t6 + addu v0, v0, v1 + lbu t2, 6(s0) + addu t0, t0, v0 + lbu v0, 3(s0) + addu s3, t0, s3 + lbu t0, 3(s1) + lbu t3, 6(s1) + addu v0, v0, t2 + sll s3, s3, 1 + addu t0, t0, t3 + lh v1, 6(t9) + addu t0, t0, v0 + lh v0, 6(s2) + addu s3, t0, s3 + lh t0, 6(s0) + lh t1, 6(s1) + madd $ac1, s3, t7 + extr_r.w t3, $ac1, 16 + ins t0, t1, 16, 16 + ins v0, v1, 16, 16 + raddu.w.qb s3, t0 + lbu v1, 8(s2) + lbu t0, 5(t9) + lbu t1, 8(t9) + sb t3, 2(t8) + raddu.w.qb t2, v0 + lbu v0, 5(s2) + addu t0, t0, t1 + mult $ac1, t2, t6 + addu v0, v0, v1 + lbu t2, 8(s0) + addu t0, t0, v0 + lbu v0, 5(s0) + addu s3, t0, s3 + lbu t0, 5(s1) + lbu t3, 8(s1) + addu v0, v0, t2 + sll s3, s3, 1 + addu t0, t0, t3 + addiu t8, t8, 4 + addu t0, t0, v0 + addiu s2, s2, 8 + addu s3, t0, s3 + addiu t9, t9, 8 + madd $ac1, s3, t7 + extr_r.w t1, $ac1, 16 + addiu s0, s0, 8 + addiu s1, s1, 8 + bne s5, t8, 5b + sb t1, -1(t8) +/* Special case for last column */ + lh v0, 0(s2) + lh v1, 0(t9) + lh t0, 0(s0) + lh t1, 0(s1) + ins v0, v1, 16, 16 + ins t0, t1, 16, 16 + raddu.w.qb t2, v0 + raddu.w.qb s3, t0 + lbu v0, -1(s2) + lbu v1, 1(s2) + lbu t0, -1(t9) + lbu t1, 1(t9) + addu v0, v0, v1 + mult $ac1, t2, t6 + addu t0, t0, t1 + lbu t2, 1(s0) + addu t0, t0, v0 + lbu t3, 1(s1) + addu s3, t0, s3 + lbu v0, -1(s0) + lbu t0, -1(s1) + sll s3, s3, 1 + addu v0, v0, t2 + addu t0, t0, t3 + addu t0, t0, v0 + addu s3, t0, s3 + madd $ac1, s3, t7 + extr_r.w t0, $ac1, 16 + addiu t5, t5, 2 + sb t0, 0(t8) + addiu t4, t4, 1 + bne t4, a2, 3b + addiu t5, t5, 2 + + RESTORE_REGS_FROM_STACK 32, s0, s1, s2, s3, s4, s5, s6, s7 + + j ra + nop + +END(jsimd_h2v2_downsample_mips_dspr2) +/*****************************************************************************/ LEAF_MIPS_DSPR2(jsimd_h2v1_upsample_mips_dspr2) /* * a0 - cinfo->max_v_samp_factor From a37736dd434e66a86b8f337617a880d5d2cf1195 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 15 May 2014 17:10:39 +0000 Subject: [PATCH 922/985] Fix error in MIPS DSPr2 accelerated smooth downsample routine --- simd/jsimd_mips_dspr2.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index 725b5589..fa8f0c23 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -1508,7 +1508,7 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_smooth_downsample_mips_dspr2) j ra nop -END(jsimd_h2v2_downsample_mips_dspr2) +END(jsimd_h2v2_smooth_downsample_mips_dspr2) /*****************************************************************************/ LEAF_MIPS_DSPR2(jsimd_h2v1_upsample_mips_dspr2) /* From b70fe7221e630f0ef730bbe9941d377028544dc0 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 15 May 2014 18:22:24 +0000 Subject: [PATCH 923/985] Fix build, which was broken by the checkin of the MIPS DSPr2 accelerated smooth downsampling routine. Until/unless other platforms include SIMD support for that function, it's just easier to #ifdef around it rather than adding stubs for the other platforms. --- jcsample.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jcsample.c b/jcsample.c index 36ae7846..e1b45e77 100644 --- a/jcsample.c +++ b/jcsample.c @@ -504,9 +504,11 @@ jinit_downsampler (j_compress_ptr cinfo) compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { #ifdef INPUT_SMOOTHING_SUPPORTED if (cinfo->smoothing_factor) { +#if defined(__mips__) if (jsimd_can_h2v2_smooth_downsample()) downsample->methods[ci] = jsimd_h2v2_smooth_downsample; else +#endif downsample->methods[ci] = h2v2_smooth_downsample; downsample->pub.need_context_rows = TRUE; } else { From 99de998e2cd65b854d752fedf8f06cc63e82bb42 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 15 May 2014 18:26:01 +0000 Subject: [PATCH 924/985] SIMD-accelerated NULL convert routine for MIPS DSPr2 --- jccolor.c | 71 ++++++++++++++++++--------- jsimd.h | 5 ++ jsimd_none.c | 13 +++++ simd/jsimd.h | 5 ++ simd/jsimd_mips.c | 26 ++++++++++ simd/jsimd_mips_dspr2.S | 104 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 201 insertions(+), 23 deletions(-) diff --git a/jccolor.c b/jccolor.c index fe9422a9..f32dcfa1 100644 --- a/jccolor.c +++ b/jccolor.c @@ -587,19 +587,24 @@ jinit_color_converter (j_compress_ptr cinfo) if (rgb_red[cinfo->in_color_space] == 0 && rgb_green[cinfo->in_color_space] == 1 && rgb_blue[cinfo->in_color_space] == 2 && - rgb_pixelsize[cinfo->in_color_space] == 3) - cconvert->pub.color_convert = null_convert; - else if (cinfo->in_color_space == JCS_RGB || - cinfo->in_color_space == JCS_EXT_RGB || - cinfo->in_color_space == JCS_EXT_RGBX || - cinfo->in_color_space == JCS_EXT_BGR || - cinfo->in_color_space == JCS_EXT_BGRX || - cinfo->in_color_space == JCS_EXT_XBGR || - cinfo->in_color_space == JCS_EXT_XRGB || - cinfo->in_color_space == JCS_EXT_RGBA || - cinfo->in_color_space == JCS_EXT_BGRA || - cinfo->in_color_space == JCS_EXT_ABGR || - cinfo->in_color_space == JCS_EXT_ARGB) + rgb_pixelsize[cinfo->in_color_space] == 3) { +#if defined(__mips__) + if (jsimd_c_can_null_convert()) + cconvert->pub.color_convert = jsimd_c_null_convert; + else +#endif + cconvert->pub.color_convert = null_convert; + } else if (cinfo->in_color_space == JCS_RGB || + cinfo->in_color_space == JCS_EXT_RGB || + cinfo->in_color_space == JCS_EXT_RGBX || + cinfo->in_color_space == JCS_EXT_BGR || + cinfo->in_color_space == JCS_EXT_BGRX || + cinfo->in_color_space == JCS_EXT_XBGR || + cinfo->in_color_space == JCS_EXT_XRGB || + cinfo->in_color_space == JCS_EXT_RGBA || + cinfo->in_color_space == JCS_EXT_BGRA || + cinfo->in_color_space == JCS_EXT_ABGR || + cinfo->in_color_space == JCS_EXT_ARGB) cconvert->pub.color_convert = rgb_rgb_convert; else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); @@ -625,18 +630,28 @@ jinit_color_converter (j_compress_ptr cinfo) cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = rgb_ycc_convert; } - } else if (cinfo->in_color_space == JCS_YCbCr) - cconvert->pub.color_convert = null_convert; - else + } else if (cinfo->in_color_space == JCS_YCbCr) { +#if defined(__mips__) + if (jsimd_c_can_null_convert()) + cconvert->pub.color_convert = jsimd_c_null_convert; + else +#endif + cconvert->pub.color_convert = null_convert; + } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; case JCS_CMYK: if (cinfo->num_components != 4) ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); - if (cinfo->in_color_space == JCS_CMYK) - cconvert->pub.color_convert = null_convert; - else + if (cinfo->in_color_space == JCS_CMYK) { +#if defined(__mips__) + if (jsimd_c_can_null_convert()) + cconvert->pub.color_convert = jsimd_c_null_convert; + else +#endif + cconvert->pub.color_convert = null_convert; + } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; @@ -646,9 +661,14 @@ jinit_color_converter (j_compress_ptr cinfo) if (cinfo->in_color_space == JCS_CMYK) { cconvert->pub.start_pass = rgb_ycc_start; cconvert->pub.color_convert = cmyk_ycck_convert; - } else if (cinfo->in_color_space == JCS_YCCK) - cconvert->pub.color_convert = null_convert; - else + } else if (cinfo->in_color_space == JCS_YCCK) { +#if defined(__mips__) + if (jsimd_c_can_null_convert()) + cconvert->pub.color_convert = jsimd_c_null_convert; + else +#endif + cconvert->pub.color_convert = null_convert; + } else ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); break; @@ -656,7 +676,12 @@ jinit_color_converter (j_compress_ptr cinfo) if (cinfo->jpeg_color_space != cinfo->in_color_space || cinfo->num_components != cinfo->input_components) ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); - cconvert->pub.color_convert = null_convert; +#if defined(__mips__) + if (jsimd_c_can_null_convert()) + cconvert->pub.color_convert = jsimd_c_null_convert; + else +#endif + cconvert->pub.color_convert = null_convert; break; } } diff --git a/jsimd.h b/jsimd.h index 2817137d..2b683e8a 100644 --- a/jsimd.h +++ b/jsimd.h @@ -40,6 +40,7 @@ EXTERN(int) jsimd_can_rgb_ycc JPP((void)); EXTERN(int) jsimd_can_rgb_gray JPP((void)); EXTERN(int) jsimd_can_ycc_rgb JPP((void)); +EXTERN(int) jsimd_c_can_null_convert JPP((void)); EXTERN(void) jsimd_rgb_ycc_convert JPP((j_compress_ptr cinfo, @@ -53,6 +54,10 @@ EXTERN(void) jsimd_ycc_rgb_convert JPP((j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_c_null_convert + JPP((j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); EXTERN(int) jsimd_can_h2v2_downsample JPP((void)); EXTERN(int) jsimd_can_h2v1_downsample JPP((void)); diff --git a/jsimd_none.c b/jsimd_none.c index a6e82759..ac126e01 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -36,6 +36,12 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_c_can_null_convert (void) +{ + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -57,6 +63,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { } +GLOBAL(void) +jsimd_c_null_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { diff --git a/simd/jsimd.h b/simd/jsimd.h index 7067a2d7..504429cb 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -475,6 +475,11 @@ EXTERN(void) jsimd_ycc_extxrgb_convert_mips_dspr2 JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_c_null_convert_mips_dspr2 + JPP((JDIMENSION img_width, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows, int num_components)); + /* SIMD Downsample */ EXTERN(void) jsimd_h2v2_downsample_mmx JPP((JDIMENSION image_width, int max_v_samp_factor, diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index aebd549a..62244ffb 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -139,6 +139,22 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_c_can_null_convert (void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -262,6 +278,16 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, input_row, output_buf, num_rows); } +GLOBAL(void) +jsimd_c_null_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + if (simd_support & JSIMD_MIPS_DSPR2) + jsimd_null_convert_compr_mips_dspr2 (cinfo->image_width, input_buf, + output_buf, output_row, num_rows, cinfo->num_components); +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index fa8f0c23..532966a5 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -24,6 +24,110 @@ #include "jsimd_mips_dspr2_asm.h" +/*****************************************************************************/ +LEAF_MIPS_DSPR2(jsimd_c_null_convert_mips_dspr2) +/* + * a0 - cinfo->image_width + * a1 - input_buf + * a2 - output_buf + * a3 - output_row + * 16(sp) - num_rows + * 20(sp) - cinfo->num_components + * + * Null conversion for compression + */ + + SAVE_REGS_ON_STACK 8, s0, s1 + + lw t9, 24(sp) // t9 = num_rows + lw s0, 28(sp) // s0 = cinfo->num_components + andi t0, a0, 3 // t0 = cinfo->image_width & 3 + beqz t0, 4f // no residual + nop +0: + addiu t9, t9, -1 + bltz t9, 7f + li t1, 0 +1: + sll t3, t1, 2 + lwx t5, t3(a2) // t5 = outptr = output_buf[ci] + lw t2, 0(a1) // t2 = inptr = *input_buf + sll t4, a3, 2 + lwx t5, t4(t5) // t5 = outptr = output_buf[ci][output_row] + addu t2, t2, t1 + addu s1, t5, a0 + addu t6, t5, t0 +2: + lbu t3, 0(t2) + addiu t5, t5, 1 + sb t3, -1(t5) + bne t6, t5, 2b + addu t2, t2, s0 +3: + lbu t3, 0(t2) + addu t4, t2, s0 + addu t7, t4, s0 + addu t8, t7, s0 + addu t2, t8, s0 + lbu t4, 0(t4) + lbu t7, 0(t7) + lbu t8, 0(t8) + addiu t5, t5, 4 + sb t3, -4(t5) + sb t4, -3(t5) + sb t7, -2(t5) + bne s1, t5, 3b + sb t8, -1(t5) + addiu t1, t1, 1 + bne t1, s0, 1b + nop + addiu a1, a1, 4 + bgez t9, 0b + addiu a3, a3, 1 + b 7f + nop +4: + addiu t9, t9, -1 + bltz t9, 7f + li t1, 0 +5: + sll t3, t1, 2 + lwx t5, t3(a2) // t5 = outptr = output_buf[ci] + lw t2, 0(a1) // t2 = inptr = *input_buf + sll t4, a3, 2 + lwx t5, t4(t5) // t5 = outptr = output_buf[ci][output_row] + addu t2, t2, t1 + addu s1, t5, a0 + addu t6, t5, t0 +6: + lbu t3, 0(t2) + addu t4, t2, s0 + addu t7, t4, s0 + addu t8, t7, s0 + addu t2, t8, s0 + lbu t4, 0(t4) + lbu t7, 0(t7) + lbu t8, 0(t8) + addiu t5, t5, 4 + sb t3, -4(t5) + sb t4, -3(t5) + sb t7, -2(t5) + bne s1, t5, 6b + sb t8, -1(t5) + addiu t1, t1, 1 + bne t1, s0, 5b + nop + addiu a1, a1, 4 + bgez t9, 4b + addiu a3, a3, 1 +7: + RESTORE_REGS_FROM_STACK 8, s0, s1 + + j ra + nop + +END(jsimd_c_null_convert_mips_dspr2) + /*****************************************************************************/ /* * jsimd_extrgb_ycc_convert_mips_dspr2 From 5d5b9a497b4b9300b8949b6e0cd0e78b508157de Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 15 May 2014 19:45:11 +0000 Subject: [PATCH 925/985] Clean up code formatting in the SIMD interface functions --- jsimd_none.c | 12 ++-- simd/jsimd_arm.c | 61 +++++++++--------- simd/jsimd_arm64.c | 52 +++++++-------- simd/jsimd_i386.c | 133 +++++++++++++++++++-------------------- simd/jsimd_mips.c | 150 +++++++++++++++++++++++++------------------- simd/jsimd_x86_64.c | 65 +++++++++---------- 6 files changed, 242 insertions(+), 231 deletions(-) diff --git a/jsimd_none.c b/jsimd_none.c index ac126e01..bdba6930 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -343,22 +343,22 @@ jsimd_can_idct_float (void) GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } diff --git a/simd/jsimd_arm.c b/simd/jsimd_arm.c index 9f9bf5ac..aefb1e67 100644 --- a/simd/jsimd_arm.c +++ b/simd/jsimd_arm.c @@ -9,10 +9,8 @@ * For conditions of distribution and use, see copyright notice in jsimdext.inc * * This file contains the interface between the "normal" portions - * of the library and the SIMD implementations when running on - * ARM architecture. - * - * Based on the stubs from 'jsimd_none.c' + * of the library and the SIMD implementations when running on a + * 32-bit ARM architecture. */ #define JPEG_INTERNALS @@ -170,6 +168,7 @@ jsimd_can_ycc_rgb (void) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if (simd_support & JSIMD_ARM_NEON) return 1; @@ -183,8 +182,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, { void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + switch(cinfo->in_color_space) { case JCS_EXT_RGB: neonfct=jsimd_extrgb_ycc_convert_neon; break; @@ -213,8 +211,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, } if (simd_support & JSIMD_ARM_NEON) - neonfct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + neonfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); } GLOBAL(void) @@ -231,8 +228,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: neonfct=jsimd_ycc_extrgb_convert_neon; break; @@ -261,8 +257,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, } if (simd_support & JSIMD_ARM_NEON) - neonfct(cinfo->output_width, input_buf, - input_row, output_buf, num_rows); + neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } GLOBAL(int) @@ -366,7 +361,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, { if (simd_support & JSIMD_ARM_NEON) jsimd_h2v1_fancy_upsample_neon(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); } GLOBAL(int) @@ -552,7 +548,7 @@ jsimd_can_idct_2x2 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -575,7 +571,7 @@ jsimd_can_idct_4x4 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -586,8 +582,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) @@ -595,8 +592,9 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(int) @@ -641,7 +639,7 @@ jsimd_can_idct_ifast (void) if (IFAST_SCALE_BITS != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -657,26 +655,27 @@ jsimd_can_idct_float (void) GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } - diff --git a/simd/jsimd_arm64.c b/simd/jsimd_arm64.c index d217cf6b..988023a6 100644 --- a/simd/jsimd_arm64.c +++ b/simd/jsimd_arm64.c @@ -9,10 +9,8 @@ * For conditions of distribution and use, see copyright notice in jsimdext.inc * * This file contains the interface between the "normal" portions - * of the library and the SIMD implementations when running on - * ARM architecture. - * - * Based on the stubs from 'jsimd_none.c' + * of the library and the SIMD implementations when running on a + * 64-bit ARM architecture. */ #define JPEG_INTERNALS @@ -159,6 +157,7 @@ jsimd_can_ycc_rgb (void) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if (simd_support & JSIMD_ARM_NEON) return 1; @@ -186,8 +185,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: neonfct=jsimd_ycc_extrgb_convert_neon; break; @@ -216,8 +214,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, } if (simd_support & JSIMD_ARM_NEON) - neonfct(cinfo->output_width, input_buf, - input_row, output_buf, num_rows); + neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } GLOBAL(int) @@ -456,7 +453,7 @@ jsimd_can_idct_2x2 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -479,7 +476,7 @@ jsimd_can_idct_4x4 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -490,8 +487,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) @@ -499,8 +497,9 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(int) @@ -545,7 +544,7 @@ jsimd_can_idct_ifast (void) if (IFAST_SCALE_BITS != 2) return 0; - if ((simd_support & JSIMD_ARM_NEON)) + if (simd_support & JSIMD_ARM_NEON) return 1; return 0; @@ -561,26 +560,27 @@ jsimd_can_idct_float (void) GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - if ((simd_support & JSIMD_ARM_NEON)) - jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col); + if (simd_support & JSIMD_ARM_NEON) + jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } - diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c index 1037fd9f..c173e740 100644 --- a/simd/jsimd_i386.c +++ b/simd/jsimd_i386.c @@ -138,8 +138,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_ycc_convert_sse2; mmxfct=jsimd_extrgb_ycc_convert_mmx; @@ -176,11 +175,9 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_rgb_ycc_convert_sse2)) - sse2fct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); else if (simd_support & JSIMD_MMX) - mmxfct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); } GLOBAL(void) @@ -191,8 +188,7 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo, void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_gray_convert_sse2; mmxfct=jsimd_extrgb_gray_convert_mmx; @@ -229,11 +225,9 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2)) - sse2fct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); else if (simd_support & JSIMD_MMX) - mmxfct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + mmxfct(cinfo->image_width, input_buf, output_buf, output_row, num_rows); } GLOBAL(void) @@ -244,8 +238,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_ycc_extrgb_convert_sse2; mmxfct=jsimd_ycc_extrgb_convert_mmx; @@ -282,11 +275,9 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) - sse2fct(cinfo->output_width, input_buf, - input_row, output_buf, num_rows); + sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); else if (simd_support & JSIMD_MMX) - mmxfct(cinfo->output_width, input_buf, - input_row, output_buf, num_rows); + mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } GLOBAL(int) @@ -333,12 +324,13 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, { if (simd_support & JSIMD_SSE2) jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, - compptr->v_samp_factor, compptr->width_in_blocks, - input_data, output_data); + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); else if (simd_support & JSIMD_MMX) jsimd_h2v2_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, - compptr->v_samp_factor, compptr->width_in_blocks, - input_data, output_data); + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); } GLOBAL(void) @@ -347,12 +339,13 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, { if (simd_support & JSIMD_SSE2) jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, - compptr->v_samp_factor, compptr->width_in_blocks, - input_data, output_data); + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); else if (simd_support & JSIMD_MMX) jsimd_h2v1_downsample_mmx(cinfo->image_width, cinfo->max_v_samp_factor, - compptr->v_samp_factor, compptr->width_in_blocks, - input_data, output_data); + compptr->v_samp_factor, compptr->width_in_blocks, + input_data, output_data); } GLOBAL(int) @@ -400,11 +393,11 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { if (simd_support & JSIMD_SSE2) - jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) - jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + jsimd_h2v2_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); } GLOBAL(void) @@ -414,11 +407,11 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { if (simd_support & JSIMD_SSE2) - jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); else if (simd_support & JSIMD_MMX) - jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + jsimd_h2v1_upsample_mmx(cinfo->max_v_samp_factor, cinfo->output_width, + input_data, output_data_ptr); } GLOBAL(int) @@ -470,10 +463,12 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); else if (simd_support & JSIMD_MMX) jsimd_h2v2_fancy_upsample_mmx(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); } GLOBAL(void) @@ -485,10 +480,12 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); else if (simd_support & JSIMD_MMX) jsimd_h2v1_fancy_upsample_mmx(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); } GLOBAL(int) @@ -540,8 +537,7 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; mmxfct=jsimd_h2v2_extrgb_merged_upsample_mmx; @@ -578,11 +574,9 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) - sse2fct(cinfo->output_width, input_buf, - in_row_group_ctr, output_buf); + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) - mmxfct(cinfo->output_width, input_buf, - in_row_group_ctr, output_buf); + mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); } GLOBAL(void) @@ -594,8 +588,7 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); void (*mmxfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; mmxfct=jsimd_h2v1_extrgb_merged_upsample_mmx; @@ -632,11 +625,9 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_merged_upsample_sse2)) - sse2fct(cinfo->output_width, input_buf, - in_row_group_ctr, output_buf); + sse2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); else if (simd_support & JSIMD_MMX) - mmxfct(cinfo->output_width, input_buf, - in_row_group_ctr, output_buf); + mmxfct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf); } GLOBAL(int) @@ -915,7 +906,8 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) - jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_2x2_sse2(compptr->dct_table, coef_block, output_buf, + output_col); else if (simd_support & JSIMD_MMX) jsimd_idct_2x2_mmx(compptr->dct_table, coef_block, output_buf, output_col); } @@ -926,7 +918,8 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_red_sse2)) - jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_4x4_sse2(compptr->dct_table, coef_block, output_buf, + output_col); else if (simd_support & JSIMD_MMX) jsimd_idct_4x4_mmx(compptr->dct_table, coef_block, output_buf, output_col); } @@ -1013,39 +1006,43 @@ jsimd_can_idct_float (void) GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2)) - jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, + output_col); else if (simd_support & JSIMD_MMX) - jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_islow_mmx(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_ifast_sse2)) - jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, + output_col); else if (simd_support & JSIMD_MMX) - jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_ifast_mmx(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_float_sse2)) - jsimd_idct_float_sse2(compptr->dct_table, coef_block, - output_buf, output_col); + jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf, + output_col); else if ((simd_support & JSIMD_SSE) && IS_ALIGNED_SSE(jconst_idct_float_sse)) - jsimd_idct_float_sse(compptr->dct_table, coef_block, - output_buf, output_col); + jsimd_idct_float_sse(compptr->dct_table, coef_block, output_buf, + output_col); else if (simd_support & JSIMD_3DNOW) - jsimd_idct_float_3dnow(compptr->dct_table, coef_block, - output_buf, output_col); + jsimd_idct_float_3dnow(compptr->dct_table, coef_block, output_buf, + output_col); } diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index 62244ffb..336b2dba 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -10,10 +10,8 @@ * For conditions of distribution and use, see copyright notice in jsimdext.inc * * This file contains the interface between the "normal" portions - * of the library and the SIMD implementations when running on + * of the library and the SIMD implementations when running on a * MIPS architecture. - * - * Based on the stubs from 'jsimd_none.c' */ #define JPEG_INTERNALS @@ -53,6 +51,7 @@ parse_proc_cpuinfo(const char* search_string) /* Did not find string in the proc file, or not Linux ELF. */ return 0; } + #endif /* @@ -78,6 +77,7 @@ init_simd (void) return; #endif } + static const int mips_idct_ifast_coefs[4] = { 0x45404540, // FIX( 1.082392200 / 2) = 17734 = 0x4546 0x5A805A80, // FIX( 1.414213562 / 2) = 23170 = 0x5A82 @@ -97,6 +97,7 @@ jsimd_can_rgb_ycc (void) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -115,6 +116,7 @@ jsimd_can_rgb_gray (void) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -133,6 +135,7 @@ jsimd_can_ycc_rgb (void) return 0; if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4)) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -149,6 +152,7 @@ jsimd_c_can_null_convert (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -161,8 +165,8 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + + switch(cinfo->in_color_space) { case JCS_EXT_RGB: mipsdspr2fct=jsimd_extrgb_ycc_convert_mips_dspr2; break; @@ -192,8 +196,8 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, } if (simd_support & JSIMD_MIPS_DSPR2) - mipsdspr2fct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); + mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row, + num_rows); } GLOBAL(void) @@ -202,8 +206,8 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { void (*mipsdspr2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + + switch(cinfo->in_color_space) { case JCS_EXT_RGB: mipsdspr2fct=jsimd_extrgb_gray_convert_mips_dspr2; break; @@ -232,9 +236,8 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo, } if (simd_support & JSIMD_MIPS_DSPR2) - mipsdspr2fct(cinfo->image_width, input_buf, - output_buf, output_row, num_rows); - + mipsdspr2fct(cinfo->image_width, input_buf, output_buf, output_row, + num_rows); } GLOBAL(void) @@ -244,8 +247,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: mipsdspr2fct=jsimd_ycc_extrgb_convert_mips_dspr2; break; @@ -274,8 +276,8 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, } if (simd_support & JSIMD_MIPS_DSPR2) - mipsdspr2fct(cinfo->output_width, input_buf, - input_row, output_buf, num_rows); + mipsdspr2fct(cinfo->output_width, input_buf, input_row, output_buf, + num_rows); } GLOBAL(void) @@ -284,8 +286,9 @@ jsimd_c_null_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { if (simd_support & JSIMD_MIPS_DSPR2) - jsimd_null_convert_compr_mips_dspr2 (cinfo->image_width, input_buf, - output_buf, output_row, num_rows, cinfo->num_components); + jsimd_null_convert_compr_mips_dspr2(cinfo->image_width, input_buf, + output_buf, output_row, num_rows, + cinfo->num_components); } GLOBAL(int) @@ -298,6 +301,7 @@ jsimd_can_h2v2_downsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -316,6 +320,7 @@ jsimd_can_h2v2_smooth_downsample (void) return 0; if(DCTSIZE != 8) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -332,6 +337,7 @@ jsimd_can_h2v1_downsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -344,18 +350,23 @@ jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v2_downsample_mips_dspr2(cinfo->image_width, - cinfo->max_v_samp_factor, compptr->v_samp_factor, - compptr->width_in_blocks, input_data, output_data); + cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, input_data, + output_data); } GLOBAL(void) -jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, +jsimd_h2v2_smooth_downsample (j_compress_ptr cinfo, + jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { jsimd_h2v2_smooth_downsample_mips_dspr2(input_data, output_data, - compptr->v_samp_factor, cinfo->max_v_samp_factor, - cinfo->smoothing_factor, compptr->width_in_blocks, - cinfo->image_width); + compptr->v_samp_factor, + cinfo->max_v_samp_factor, + cinfo->smoothing_factor, + compptr->width_in_blocks, + cinfo->image_width); } GLOBAL(void) @@ -364,8 +375,10 @@ jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v1_downsample_mips_dspr2(cinfo->image_width, - cinfo->max_v_samp_factor, compptr->v_samp_factor, - compptr->width_in_blocks, input_data, output_data); + cinfo->max_v_samp_factor, + compptr->v_samp_factor, + compptr->width_in_blocks, + input_data, output_data); } GLOBAL(int) @@ -378,6 +391,7 @@ jsimd_can_h2v2_upsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -394,6 +408,7 @@ jsimd_can_h2v1_upsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -408,7 +423,8 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v2_upsample_mips_dspr2(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + cinfo->output_width, input_data, + output_data_ptr); } GLOBAL(void) @@ -419,7 +435,8 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v1_upsample_mips_dspr2(cinfo->max_v_samp_factor, - cinfo->output_width, input_data, output_data_ptr); + cinfo->output_width, input_data, + output_data_ptr); } GLOBAL(int) @@ -432,6 +449,7 @@ jsimd_can_h2v2_fancy_upsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -448,6 +466,7 @@ jsimd_can_h2v1_fancy_upsample (void) return 0; if (sizeof(JDIMENSION) != 4) return 0; + if (simd_support & JSIMD_MIPS_DSPR2) return 1; @@ -462,7 +481,8 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v2_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, + input_data, output_data_ptr); } GLOBAL(void) @@ -473,7 +493,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, { if (simd_support & JSIMD_MIPS_DSPR2) jsimd_h2v1_fancy_upsample_mips_dspr2(cinfo->max_v_samp_factor, - compptr->downsampled_width, input_data, output_data_ptr); + compptr->downsampled_width, + input_data, output_data_ptr); } GLOBAL(int) @@ -510,10 +531,10 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { - void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); + void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, + JSAMPLE *); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: mipsdspr2fct=jsimd_h2v2_extrgb_merged_upsample_mips_dspr2; break; @@ -541,8 +562,8 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, break; } - mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, - output_buf, cinfo->sample_range_limit); + mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf, + cinfo->sample_range_limit); } GLOBAL(void) @@ -551,10 +572,10 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { - void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, JSAMPLE *); + void (*mipsdspr2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, + JSAMPLE *); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: mipsdspr2fct=jsimd_h2v1_extrgb_merged_upsample_mips_dspr2; break; @@ -582,8 +603,8 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, break; } - mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, - output_buf, cinfo->sample_range_limit); + mipsdspr2fct(cinfo->output_width, input_buf, in_row_group_ctr, output_buf, + cinfo->sample_range_limit); } GLOBAL(int) @@ -624,7 +645,7 @@ jsimd_can_convsamp_float (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -683,6 +704,8 @@ jsimd_can_fdct_ifast (void) GLOBAL(int) jsimd_can_fdct_float (void) { + init_simd(); + return 0; } @@ -741,7 +764,7 @@ jsimd_can_quantize_float (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -759,7 +782,7 @@ GLOBAL(void) jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace) { - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) jsimd_quantize_float_mips_dspr2(coef_block, divisors, workspace); } @@ -780,7 +803,7 @@ jsimd_can_idct_2x2 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -803,7 +826,7 @@ jsimd_can_idct_4x4 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -826,7 +849,7 @@ jsimd_can_idct_6x6 (void) if (sizeof(ISLOW_MULT_TYPE) != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -859,9 +882,9 @@ jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_MIPS_DSPR2)) - jsimd_idct_2x2_mips_dspr2(compptr->dct_table, coef_block, - output_buf, output_col); + if (simd_support & JSIMD_MIPS_DSPR2) + jsimd_idct_2x2_mips_dspr2(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) @@ -869,11 +892,10 @@ jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_MIPS_DSPR2)) - { + if (simd_support & JSIMD_MIPS_DSPR2) { int workspace[DCTSIZE*4]; /* buffers data between passes */ - jsimd_idct_4x4_mips_dspr2(compptr->dct_table, coef_block, - output_buf, output_col, workspace); + jsimd_idct_4x4_mips_dspr2(compptr->dct_table, coef_block, output_buf, + output_col, workspace); } } @@ -882,9 +904,9 @@ jsimd_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - if ((simd_support & JSIMD_MIPS_DSPR2)) - jsimd_idct_6x6_mips_dspr2(compptr->dct_table, coef_block, - output_buf, output_col); + if (simd_support & JSIMD_MIPS_DSPR2) + jsimd_idct_6x6_mips_dspr2(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) @@ -908,8 +930,8 @@ jsimd_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, (int)(output_buf[10] + output_col), (int)(output_buf[11] + output_col), }; - jsimd_idct_12x12_pass1_mips_dspr2(coef_block, - compptr->dct_table, workspace); + jsimd_idct_12x12_pass1_mips_dspr2(coef_block, compptr->dct_table, + workspace); jsimd_idct_12x12_pass2_mips_dspr2(workspace, output); } } @@ -956,7 +978,7 @@ jsimd_can_idct_ifast (void) if (IFAST_SCALE_BITS != 2) return 0; - if ((simd_support & JSIMD_MIPS_DSPR2)) + if (simd_support & JSIMD_MIPS_DSPR2) return 1; return 0; @@ -965,13 +987,15 @@ jsimd_can_idct_ifast (void) GLOBAL(int) jsimd_can_idct_float (void) { + init_simd(); + return 0; } GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { if (simd_support & JSIMD_MIPS_DSPR2) { int output[8] = { @@ -1019,7 +1043,7 @@ jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { } diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c index afaea4b9..87c9d56f 100644 --- a/simd/jsimd_x86_64.c +++ b/simd/jsimd_x86_64.c @@ -10,7 +10,7 @@ * * This file contains the interface between the "normal" portions * of the library and the SIMD implementations when running on a - * x86_64 architecture. + * 64-bit x86 architecture. */ #define JPEG_INTERNALS @@ -87,8 +87,7 @@ jsimd_rgb_ycc_convert (j_compress_ptr cinfo, { void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_ycc_convert_sse2; break; @@ -126,8 +125,7 @@ jsimd_rgb_gray_convert (j_compress_ptr cinfo, { void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int); - switch(cinfo->in_color_space) - { + switch(cinfo->in_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_extrgb_gray_convert_sse2; break; @@ -165,8 +163,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_ycc_extrgb_convert_sse2; break; @@ -225,10 +222,8 @@ GLOBAL(void) jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { - jsimd_h2v2_downsample_sse2(cinfo->image_width, - cinfo->max_v_samp_factor, - compptr->v_samp_factor, - compptr->width_in_blocks, + jsimd_h2v2_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); } @@ -236,10 +231,8 @@ GLOBAL(void) jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) { - jsimd_h2v1_downsample_sse2(cinfo->image_width, - cinfo->max_v_samp_factor, - compptr->v_samp_factor, - compptr->width_in_blocks, + jsimd_h2v1_downsample_sse2(cinfo->image_width, cinfo->max_v_samp_factor, + compptr->v_samp_factor, compptr->width_in_blocks, input_data, output_data); } @@ -273,8 +266,7 @@ jsimd_h2v2_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { - jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, - cinfo->output_width, + jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); } @@ -284,8 +276,7 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) { - jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, - cinfo->output_width, + jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width, input_data, output_data_ptr); } @@ -326,8 +317,8 @@ jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor, - compptr->downsampled_width, - input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); } GLOBAL(void) @@ -337,8 +328,8 @@ jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, JSAMPARRAY * output_data_ptr) { jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor, - compptr->downsampled_width, - input_data, output_data_ptr); + compptr->downsampled_width, input_data, + output_data_ptr); } GLOBAL(int) @@ -379,8 +370,7 @@ jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v2_extrgb_merged_upsample_sse2; break; @@ -419,8 +409,7 @@ jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, { void (*sse2fct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY); - switch(cinfo->out_color_space) - { + switch(cinfo->out_color_space) { case JCS_EXT_RGB: sse2fct=jsimd_h2v1_extrgb_merged_upsample_sse2; break; @@ -728,26 +717,28 @@ jsimd_can_idct_float (void) GLOBAL(void) jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, output_col); + jsimd_idct_ifast_sse2(compptr->dct_table, coef_block, output_buf, + output_col); } GLOBAL(void) jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col) + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col) { - jsimd_idct_float_sse2(compptr->dct_table, coef_block, - output_buf, output_col); + jsimd_idct_float_sse2(compptr->dct_table, coef_block, output_buf, + output_col); } From 2c0b793539132ad6a6c82ccfb013cd1205582a55 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 15 May 2014 20:30:16 +0000 Subject: [PATCH 926/985] Remove all of the NEED_SHORT_EXTERNAL_NAMES stuff. There is scant information available as to which linkers ever had a 15-character global symbol name limit. AFAICT, it might have been a VMS and/or a.out BSD thing, but none of those platforms have ever been supported by libjpeg-turbo (nor are such systems supported by other open source libraries of this nature.) --- cdjpeg.h | 26 --------- coderules.txt | 4 +- configure.ac | 10 ---- jchuff.h | 7 --- jconfig.h.in | 4 -- jconfig.txt | 5 -- jdct.h | 26 --------- jdhuff.h | 8 --- jerror.c | 4 -- jmemsys.h | 14 ----- jpegint.h | 42 --------------- jpeglib.h | 72 ------------------------- jsimd.h | 27 ---------- jsimddct.h | 29 ---------- libjpeg.txt | 10 +--- simd/jsimd.h | 128 -------------------------------------------- simd/jsimdcfg.inc.h | 66 ----------------------- transupp.h | 13 ----- win/jconfig.h.in | 1 - 19 files changed, 2 insertions(+), 494 deletions(-) diff --git a/cdjpeg.h b/cdjpeg.h index 0a8f197d..6eec62ff 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -89,32 +89,6 @@ struct cdjpeg_progress_mgr { typedef struct cdjpeg_progress_mgr * cd_progress_ptr; -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_read_bmp jIRdBMP -#define jinit_write_bmp jIWrBMP -#define jinit_read_gif jIRdGIF -#define jinit_write_gif jIWrGIF -#define jinit_read_ppm jIRdPPM -#define jinit_write_ppm jIWrPPM -#define jinit_read_rle jIRdRLE -#define jinit_write_rle jIWrRLE -#define jinit_read_targa jIRdTarga -#define jinit_write_targa jIWrTarga -#define read_quant_tables RdQTables -#define read_scan_script RdScnScript -#define set_quality_ratings SetQRates -#define set_quant_slots SetQSlots -#define set_sample_factors SetSFacts -#define read_color_map RdCMap -#define enable_signal_catcher EnSigCatcher -#define start_progress_monitor StProgMon -#define end_progress_monitor EnProgMon -#define read_stdin RdStdin -#define write_stdout WrStdout -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - /* Module selection routines for I/O modules. */ EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); diff --git a/coderules.txt b/coderules.txt index ea8fcc08..6ee7f5e9 100644 --- a/coderules.txt +++ b/coderules.txt @@ -94,9 +94,7 @@ pass these through the common routines provided. wherever possible. (Note that our method-based calling conventions help this a lot: in many modules only the initialization function will ever need to be called directly, so only that function need be externally visible.) All -global function names should begin with "jpeg_", and should have an -abbreviated name (unique in the first six characters) substituted by macro -when NEED_SHORT_EXTERNAL_NAMES is set. +global function names should begin with "jpeg_". 3. Don't use global variables; anything that must be used in another module should be in the common data structures. diff --git a/configure.ac b/configure.ac index 8c3093cc..12724f72 100644 --- a/configure.ac +++ b/configure.ac @@ -136,16 +136,6 @@ AC_TRY_RUN( [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)]) -# test whether global names are unique to at least 15 chars -AC_MSG_CHECKING([for short external names]) -AC_TRY_LINK( - [int possibly_duplicate_function () { return 0; } - int possibly_dupli_function () { return 1; }], [ ], - [AC_MSG_RESULT(ok)], - [AC_MSG_RESULT(short) - AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1, - [Define if linker requires that the first 15 characters of global names be unique.])]) - # Checks for library functions. AC_CHECK_FUNCS([memset memcpy], [], [AC_DEFINE([NEED_BSD_STRINGS], 1, diff --git a/jchuff.h b/jchuff.h index a1a5280d..c4199230 100644 --- a/jchuff.h +++ b/jchuff.h @@ -30,13 +30,6 @@ typedef struct { /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ } c_derived_tbl; -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_c_derived_tbl jMkCDerived -#define jpeg_gen_optimal_table jGenOptTbl -#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, boolean isDC, int tblno, diff --git a/jconfig.h.in b/jconfig.h.in index 78023c17..73a523da 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -40,10 +40,6 @@ memset/memcpy in . */ #undef NEED_BSD_STRINGS -/* Define if linker requires that the first 15 characters of global names be - unique. */ -#undef NEED_SHORT_EXTERNAL_NAMES - /* Define if you need to include to get size_t. */ #undef NEED_SYS_TYPES_H diff --git a/jconfig.txt b/jconfig.txt index ba829ad2..631c7a0f 100644 --- a/jconfig.txt +++ b/jconfig.txt @@ -77,11 +77,6 @@ */ #undef NEED_FAR_POINTERS -/* Define this if your linker needs global names to be unique in less - * than the first 15 characters. - */ -#undef NEED_SHORT_EXTERNAL_NAMES - /* Although a real ANSI C compiler can deal perfectly well with pointers to * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, diff --git a/jdct.h b/jdct.h index 310f2ca5..b8d6e9cd 100644 --- a/jdct.h +++ b/jdct.h @@ -86,32 +86,6 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_fdct_islow jFDislow -#define jpeg_fdct_ifast jFDifast -#define jpeg_fdct_float jFDfloat -#define jpeg_idct_islow jRDislow -#define jpeg_idct_ifast jRDifast -#define jpeg_idct_float jRDfloat -#define jpeg_idct_7x7 jRD7x7 -#define jpeg_idct_6x6 jRD6x6 -#define jpeg_idct_5x5 jRD5x5 -#define jpeg_idct_4x4 jRD4x4 -#define jpeg_idct_3x3 jRD3x3 -#define jpeg_idct_2x2 jRD2x2 -#define jpeg_idct_1x1 jRD1x1 -#define jpeg_idct_9x9 jRD9x9 -#define jpeg_idct_10x10 jRD10x10 -#define jpeg_idct_11x11 jRD11x11 -#define jpeg_idct_12x12 jRD12x12 -#define jpeg_idct_13x13 jRD13x13 -#define jpeg_idct_14x14 jRD14x14 -#define jpeg_idct_15x15 jRD15x15 -#define jpeg_idct_16x16 jRD16x16 -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - /* Extern declarations for the forward and inverse DCT routines. */ EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); diff --git a/jdhuff.h b/jdhuff.h index 8d2c6545..18fdcb81 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -12,14 +12,6 @@ * progressive decoder (jdphuff.c). No other modules need to see these. */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_make_d_derived_tbl jMkDDerived -#define jpeg_fill_bit_buffer jFilBitBuf -#define jpeg_huff_decode jHufDecode -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - /* Derived data constructed for each Huffman table */ diff --git a/jerror.c b/jerror.c index cd4c2a3c..ca4f3a52 100644 --- a/jerror.c +++ b/jerror.c @@ -41,10 +41,6 @@ * want to refer to it directly. */ -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_message_table jMsgTable -#endif - #define JMESSAGE(code,string) string , const char * const jpeg_std_message_table[] = { diff --git a/jmemsys.h b/jmemsys.h index 5b6b7c4e..2a8c4692 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -19,20 +19,6 @@ */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_get_small jGetSmall -#define jpeg_free_small jFreeSmall -#define jpeg_get_large jGetLarge -#define jpeg_free_large jFreeLarge -#define jpeg_mem_available jMemAvail -#define jpeg_open_backing_store jOpenBackStore -#define jpeg_mem_init jMemInit -#define jpeg_mem_term jMemTerm -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - /* * These two functions are used to allocate and release small chunks of * memory. (Typically the total amount requested through jpeg_get_small is diff --git a/jpegint.h b/jpegint.h index 44a330d0..cfb59563 100644 --- a/jpegint.h +++ b/jpegint.h @@ -292,48 +292,6 @@ struct jpeg_color_quantizer { #endif -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jinit_compress_master jICompress -#define jinit_c_master_control jICMaster -#define jinit_c_main_controller jICMainC -#define jinit_c_prep_controller jICPrepC -#define jinit_c_coef_controller jICCoefC -#define jinit_color_converter jICColor -#define jinit_downsampler jIDownsampler -#define jinit_forward_dct jIFDCT -#define jinit_huff_encoder jIHEncoder -#define jinit_phuff_encoder jIPHEncoder -#define jinit_arith_encoder jIAEncoder -#define jinit_marker_writer jIMWriter -#define jinit_master_decompress jIDMaster -#define jinit_d_main_controller jIDMainC -#define jinit_d_coef_controller jIDCoefC -#define jinit_d_post_controller jIDPostC -#define jinit_input_controller jIInCtlr -#define jinit_marker_reader jIMReader -#define jinit_huff_decoder jIHDecoder -#define jinit_phuff_decoder jIPHDecoder -#define jinit_arith_decoder jIADecoder -#define jinit_inverse_dct jIIDCT -#define jinit_upsampler jIUpsampler -#define jinit_color_deconverter jIDColor -#define jinit_1pass_quantizer jI1Quant -#define jinit_2pass_quantizer jI2Quant -#define jinit_merged_upsampler jIMUpsampler -#define jinit_memory_mgr jIMemMgr -#define jdiv_round_up jDivRound -#define jround_up jRound -#define jcopy_sample_rows jCopySamples -#define jcopy_block_row jCopyBlocks -#define jzero_far jZeroFar -#define jpeg_zigzag_order jZIGTable -#define jpeg_natural_order jZAGTable -#define jpeg_aritab jAriTab -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - /* 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, diff --git a/jpeglib.h b/jpeglib.h index ee757b9d..612f74aa 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -898,78 +898,6 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); #endif -/* Short forms of external names for systems with brain-damaged linkers. - * We shorten external names to be unique in the first six letters, which - * is good enough for all known systems. - * (If your compiler itself needs names to be unique in less than 15 - * characters, you are out of luck. Get a better compiler.) - */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_std_error jStdError -#define jpeg_CreateCompress jCreaCompress -#define jpeg_CreateDecompress jCreaDecompress -#define jpeg_destroy_compress jDestCompress -#define jpeg_destroy_decompress jDestDecompress -#define jpeg_stdio_dest jStdDest -#define jpeg_stdio_src jStdSrc -#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) -#define jpeg_mem_dest jMemDest -#define jpeg_mem_src jMemSrc -#endif -#define jpeg_set_defaults jSetDefaults -#define jpeg_set_colorspace jSetColorspace -#define jpeg_default_colorspace jDefColorspace -#define jpeg_set_quality jSetQuality -#define jpeg_set_linear_quality jSetLQuality -#if JPEG_LIB_VERSION >= 70 -#define jpeg_default_qtables jDefQTables -#endif -#define jpeg_add_quant_table jAddQuantTable -#define jpeg_quality_scaling jQualityScaling -#define jpeg_simple_progression jSimProgress -#define jpeg_suppress_tables jSuppressTables -#define jpeg_alloc_quant_table jAlcQTable -#define jpeg_alloc_huff_table jAlcHTable -#define jpeg_start_compress jStrtCompress -#define jpeg_write_scanlines jWrtScanlines -#define jpeg_finish_compress jFinCompress -#if JPEG_LIB_VERSION >= 70 -#define jpeg_calc_jpeg_dimensions jCjpegDimensions -#endif -#define jpeg_write_raw_data jWrtRawData -#define jpeg_write_marker jWrtMarker -#define jpeg_write_m_header jWrtMHeader -#define jpeg_write_m_byte jWrtMByte -#define jpeg_write_tables jWrtTables -#define jpeg_read_header jReadHeader -#define jpeg_start_decompress jStrtDecompress -#define jpeg_read_scanlines jReadScanlines -#define jpeg_finish_decompress jFinDecompress -#define jpeg_read_raw_data jReadRawData -#define jpeg_has_multiple_scans jHasMultScn -#define jpeg_start_output jStrtOutput -#define jpeg_finish_output jFinOutput -#define jpeg_input_complete jInComplete -#define jpeg_new_colormap jNewCMap -#define jpeg_consume_input jConsumeInput -#if JPEG_LIB_VERSION >= 80 -#define jpeg_core_output_dimensions jCoreDimensions -#endif -#define jpeg_calc_output_dimensions jCalcDimensions -#define jpeg_save_markers jSaveMarkers -#define jpeg_set_marker_processor jSetMarker -#define jpeg_read_coefficients jReadCoefs -#define jpeg_write_coefficients jWrtCoefs -#define jpeg_copy_critical_parameters jCopyCrit -#define jpeg_abort_compress jAbrtCompress -#define jpeg_abort_decompress jAbrtDecompress -#define jpeg_abort jAbort -#define jpeg_destroy jDestroy -#define jpeg_resync_to_restart jResyncRestart -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - /* Default error-management setup */ EXTERN(struct jpeg_error_mgr *) jpeg_std_error JPP((struct jpeg_error_mgr * err)); diff --git a/jsimd.h b/jsimd.h index 2b683e8a..80bc20bc 100644 --- a/jsimd.h +++ b/jsimd.h @@ -10,33 +10,6 @@ * */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jsimd_can_rgb_ycc jSCanRgbYcc -#define jsimd_can_rgb_gray jSCanRgbGry -#define jsimd_can_ycc_rgb jSCanYccRgb -#define jsimd_rgb_ycc_convert jSRgbYccConv -#define jsimd_rgb_gray_convert jSRgbGryConv -#define jsimd_ycc_rgb_convert jSYccRgbConv -#define jsimd_can_h2v2_downsample jSCanH2V2Down -#define jsimd_can_h2v1_downsample jSCanH2V1Down -#define jsimd_h2v2_downsample jSH2V2Down -#define jsimd_h2v1_downsample jSH2V1Down -#define jsimd_can_h2v2_upsample jSCanH2V2Up -#define jsimd_can_h2v1_upsample jSCanH2V1Up -#define jsimd_h2v2_upsample jSH2V2Up -#define jsimd_h2v1_upsample jSH2V1Up -#define jsimd_can_h2v2_fancy_upsample jSCanH2V2FUp -#define jsimd_can_h2v1_fancy_upsample jSCanH2V1FUp -#define jsimd_h2v2_fancy_upsample jSH2V2FUp -#define jsimd_h2v1_fancy_upsample jSH2V1FUp -#define jsimd_can_h2v2_merged_upsample jSCanH2V2MUp -#define jsimd_can_h2v1_merged_upsample jSCanH2V1MUp -#define jsimd_h2v2_merged_upsample jSH2V2MUp -#define jsimd_h2v1_merged_upsample jSH2V1MUp -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - EXTERN(int) jsimd_can_rgb_ycc JPP((void)); EXTERN(int) jsimd_can_rgb_gray JPP((void)); EXTERN(int) jsimd_can_ycc_rgb JPP((void)); diff --git a/jsimddct.h b/jsimddct.h index d962b9b1..928d6d33 100644 --- a/jsimddct.h +++ b/jsimddct.h @@ -9,35 +9,6 @@ * */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jsimd_can_convsamp jSCanConv -#define jsimd_can_convsamp_float jSCanConvF -#define jsimd_convsamp jSConv -#define jsimd_convsamp_float jSConvF -#define jsimd_can_fdct_islow jSCanFDCTIS -#define jsimd_can_fdct_ifast jSCanFDCTIF -#define jsimd_can_fdct_float jSCanFDCTFl -#define jsimd_fdct_islow jSFDCTIS -#define jsimd_fdct_ifast jSFDCTIF -#define jsimd_fdct_float jSFDCTFl -#define jsimd_can_quantize jSCanQuant -#define jsimd_can_quantize_float jSCanQuantF -#define jsimd_quantize jSQuant -#define jsimd_quantize_float jSQuantF -#define jsimd_can_idct_2x2 jSCanIDCT22 -#define jsimd_can_idct_4x4 jSCanIDCT44 -#define jsimd_idct_2x2 jSIDCT22 -#define jsimd_idct_4x4 jSIDCT44 -#define jsimd_can_idct_islow jSCanIDCTIS -#define jsimd_can_idct_ifast jSCanIDCTIF -#define jsimd_can_idct_float jSCanIDCTFl -#define jsimd_idct_islow jSIDCTIS -#define jsimd_idct_ifast jSIDCTIF -#define jsimd_idct_float jSIDCTFl -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - EXTERN(int) jsimd_can_convsamp JPP((void)); EXTERN(int) jsimd_can_convsamp_float JPP((void)); diff --git a/libjpeg.txt b/libjpeg.txt index 5f203d6d..73c5e1d7 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -2949,11 +2949,7 @@ The sample applications cjpeg and djpeg can support 12-bit mode only for PPM and GIF file formats; you must disable the other file formats to compile a 12-bit cjpeg or djpeg. (install.txt has more information about that.) At present, a 12-bit library can handle *only* 12-bit images, not both -precisions. (If you need to include both 8- and 12-bit libraries in a single -application, you could probably do it by defining NEED_SHORT_EXTERNAL_NAMES -for just one of the copies. You'd have to access the 8-bit and 12-bit copies -from separate application source files. This is untested ... if you try it, -we'd like to hear whether it works!) +precisions. Note that a 12-bit library always compresses in Huffman optimization mode, in order to generate valid Huffman tables. This is necessary because our @@ -3035,10 +3031,6 @@ heavily dependent on stdio.) malloc and free are called only from the memory manager "back end" module, so you can use a different memory allocator by replacing that one file. -The code generally assumes that C names must be unique in the first 15 -characters. However, global function names can be made unique in the -first 6 characters by defining NEED_SHORT_EXTERNAL_NAMES. - More info about porting the code may be gleaned by reading jconfig.txt, jmorecfg.h, and jinclude.h. diff --git a/simd/jsimd.h b/simd/jsimd.h index 504429cb..572da813 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -21,134 +21,6 @@ #define JSIMD_ARM_NEON 0x10 #define JSIMD_MIPS_DSPR2 0x20 -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jpeg_simd_cpu_support jSiCpuSupport -#define jsimd_rgb_ycc_convert_mmx jSRGBYCCM -#define jsimd_extrgb_ycc_convert_mmx jSEXTRGBYCCM -#define jsimd_extrgbx_ycc_convert_mmx jSEXTRGBXYCCM -#define jsimd_extbgr_ycc_convert_mmx jSEXTBGRYCCM -#define jsimd_extbgrx_ycc_convert_mmx jSEXTBGRXYCCM -#define jsimd_extxbgr_ycc_convert_mmx jSEXTXBGRYCCM -#define jsimd_extxrgb_ycc_convert_mmx jSEXTXRGBYCCM -#define jsimd_rgb_gray_convert_mmx jSRGBGRYM -#define jsimd_extrgb_gray_convert_mmx jSEXTRGBGRYM -#define jsimd_extrgbx_gray_convert_mmx jSEXTRGBXGRYM -#define jsimd_extbgr_gray_convert_mmx jSEXTBGRGRYM -#define jsimd_extbgrx_gray_convert_mmx jSEXTBGRXGRYM -#define jsimd_extxbgr_gray_convert_mmx jSEXTXBGRGRYM -#define jsimd_extxrgb_gray_convert_mmx jSEXTXRGBGRYM -#define jsimd_ycc_rgb_convert_mmx jSYCCRGBM -#define jsimd_ycc_extrgb_convert_mmx jSYCCEXTRGBM -#define jsimd_ycc_extrgbx_convert_mmx jSYCCEXTRGBXM -#define jsimd_ycc_extbgr_convert_mmx jSYCCEXTBGRM -#define jsimd_ycc_extbgrx_convert_mmx jSYCCEXTBGRXM -#define jsimd_ycc_extxbgr_convert_mmx jSYCCEXTXBGRM -#define jsimd_ycc_extxrgb_convert_mmx jSYCCEXTXRGBM -#define jconst_rgb_ycc_convert_sse2 jSCRGBYCCS2 -#define jsimd_rgb_ycc_convert_sse2 jSRGBYCCS2 -#define jsimd_extrgb_ycc_convert_sse2 jSEXTRGBYCCS2 -#define jsimd_extrgbx_ycc_convert_sse2 jSEXTRGBXYCCS2 -#define jsimd_extbgr_ycc_convert_sse2 jSEXTBGRYCCS2 -#define jsimd_extbgrx_ycc_convert_sse2 jSEXTBGRXYCCS2 -#define jsimd_extxbgr_ycc_convert_sse2 jSEXTXBGRYCCS2 -#define jsimd_extxrgb_ycc_convert_sse2 jSEXTXRGBYCCS2 -#define jconst_rgb_gray_convert_sse2 jSCRGBGRYS2 -#define jsimd_rgb_gray_convert_sse2 jSRGBGRYS2 -#define jsimd_extrgb_gray_convert_sse2 jSEXTRGBGRYS2 -#define jsimd_extrgbx_gray_convert_sse2 jSEXTRGBXGRYS2 -#define jsimd_extbgr_gray_convert_sse2 jSEXTBGRGRYS2 -#define jsimd_extbgrx_gray_convert_sse2 jSEXTBGRXGRYS2 -#define jsimd_extxbgr_gray_convert_sse2 jSEXTXBGRGRYS2 -#define jsimd_extxrgb_gray_convert_sse2 jSEXTXRGBGRYS2 -#define jconst_ycc_rgb_convert_sse2 jSCYCCRGBS2 -#define jsimd_ycc_rgb_convert_sse2 jSYCCRGBS2 -#define jsimd_ycc_extrgb_convert_sse2 jSYCCEXTRGBS2 -#define jsimd_ycc_extrgbx_convert_sse2 jSYCCEXTRGBXS2 -#define jsimd_ycc_extbgr_convert_sse2 jSYCCEXTBGRS2 -#define jsimd_ycc_extbgrx_convert_sse2 jSYCCEXTBGRXS2 -#define jsimd_ycc_extxbgr_convert_sse2 jSYCCEXTXBGRS2 -#define jsimd_ycc_extxrgb_convert_sse2 jSYCCEXTXRGBS2 -#define jsimd_h2v2_downsample_mmx jSDnH2V2M -#define jsimd_h2v1_downsample_mmx jSDnH2V1M -#define jsimd_h2v2_downsample_sse2 jSDnH2V2S2 -#define jsimd_h2v1_downsample_sse2 jSDnH2V1S2 -#define jsimd_h2v2_upsample_mmx jSUpH2V2M -#define jsimd_h2v1_upsample_mmx jSUpH2V1M -#define jsimd_h2v2_fancy_upsample_mmx jSFUpH2V2M -#define jsimd_h2v1_fancy_upsample_mmx jSFUpH2V1M -#define jsimd_h2v2_merged_upsample_mmx jSMUpH2V2M -#define jsimd_h2v2_extrgb_merged_upsample_mmx jSMUpH2V2EXTRGBM -#define jsimd_h2v2_extrgbx_merged_upsample_mmx jSMUpH2V2EXTRGBXM -#define jsimd_h2v2_extbgr_merged_upsample_mmx jSMUpH2V2EXTBGRM -#define jsimd_h2v2_extbgrx_merged_upsample_mmx jSMUpH2V2EXTBGRXM -#define jsimd_h2v2_extxbgr_merged_upsample_mmx jSMUpH2V2EXTXBGRM -#define jsimd_h2v2_extxrgb_merged_upsample_mmx jSMUpH2V2EXTXRGBM -#define jsimd_h2v1_merged_upsample_mmx jSMUpH2V1M -#define jsimd_h2v1_extrgb_merged_upsample_mmx jSMUpH2V1EXTRGBM -#define jsimd_h2v1_extrgbx_merged_upsample_mmx jSMUpH2V1EXTRGBXM -#define jsimd_h2v1_extbgr_merged_upsample_mmx jSMUpH2V1EXTBGRM -#define jsimd_h2v1_extbgrx_merged_upsample_mmx jSMUpH2V1EXTBGRXM -#define jsimd_h2v1_extxbgr_merged_upsample_mmx jSMUpH2V1EXTXBGRM -#define jsimd_h2v1_extxrgb_merged_upsample_mmx jSMUpH2V1EXTXRGBM -#define jsimd_h2v2_upsample_sse2 jSUpH2V2S2 -#define jsimd_h2v1_upsample_sse2 jSUpH2V1S2 -#define jconst_fancy_upsample_sse2 jSCFUpS2 -#define jsimd_h2v2_fancy_upsample_sse2 jSFUpH2V2S2 -#define jsimd_h2v1_fancy_upsample_sse2 jSFUpH2V1S2 -#define jconst_merged_upsample_sse2 jSCMUpS2 -#define jsimd_h2v2_merged_upsample_sse2 jSMUpH2V2S2 -#define jsimd_h2v2_extrgb_merged_upsample_sse2 jSMUpH2V2EXTRGBS2 -#define jsimd_h2v2_extrgbx_merged_upsample_sse2 jSMUpH2V2EXTRGBXS2 -#define jsimd_h2v2_extbgr_merged_upsample_sse2 jSMUpH2V2EXTBGRS2 -#define jsimd_h2v2_extbgrx_merged_upsample_sse2 jSMUpH2V2EXTBGRXS2 -#define jsimd_h2v2_extxbgr_merged_upsample_sse2 jSMUpH2V2EXTXBGRS2 -#define jsimd_h2v2_extxrgb_merged_upsample_sse2 jSMUpH2V2EXTXRGBS2 -#define jsimd_h2v1_merged_upsample_sse2 jSMUpH2V1S2 -#define jsimd_h2v1_extrgb_merged_upsample_sse2 jSMUpH2V1EXTRGBS2 -#define jsimd_h2v1_extrgbx_merged_upsample_sse2 jSMUpH2V1EXTRGBXS2 -#define jsimd_h2v1_extbgr_merged_upsample_sse2 jSMUpH2V1EXTBGRS2 -#define jsimd_h2v1_extbgrx_merged_upsample_sse2 jSMUpH2V1EXTBGRXS2 -#define jsimd_h2v1_extxbgr_merged_upsample_sse2 jSMUpH2V1EXTXBGRS2 -#define jsimd_h2v1_extxrgb_merged_upsample_sse2 jSMUpH2V1EXTXRGBS2 -#define jsimd_convsamp_mmx jSConvM -#define jsimd_convsamp_sse2 jSConvS2 -#define jsimd_convsamp_float_3dnow jSConvF3D -#define jsimd_convsamp_float_sse jSConvFS -#define jsimd_convsamp_float_sse2 jSConvFS2 -#define jsimd_fdct_islow_mmx jSFDMIS -#define jsimd_fdct_ifast_mmx jSFDMIF -#define jconst_fdct_islow_sse2 jSCFDS2IS -#define jsimd_fdct_islow_sse2 jSFDS2IS -#define jconst_fdct_ifast_sse2 jSCFDS2IF -#define jsimd_fdct_ifast_sse2 jSFDS2IF -#define jsimd_fdct_float_3dnow jSFD3DF -#define jconst_fdct_float_sse jSCFDSF -#define jsimd_fdct_float_sse jSFDSF -#define jsimd_quantize_mmx jSQuantM -#define jsimd_quantize_sse2 jSQuantS2 -#define jsimd_quantize_float_3dnow jSQuantF3D -#define jsimd_quantize_float_sse jSQuantFS -#define jsimd_quantize_float_sse2 jSQuantFS2 -#define jsimd_idct_2x2_mmx jSIDM22 -#define jsimd_idct_4x4_mmx jSIDM44 -#define jconst_idct_red_sse2 jSCIDS2R -#define jsimd_idct_2x2_sse2 jSIDS222 -#define jsimd_idct_4x4_sse2 jSIDS244 -#define jsimd_idct_islow_mmx jSIDMIS -#define jsimd_idct_ifast_mmx jSIDMIF -#define jconst_idct_islow_sse2 jSCIDS2IS -#define jsimd_idct_islow_sse2 jSIDS2IS -#define jconst_idct_ifast_sse2 jSCIDS2IF -#define jsimd_idct_ifast_sse2 jSIDS2IF -#define jsimd_idct_float_3dnow jSID3DF -#define jconst_fdct_float_sse jSCIDSF -#define jsimd_idct_float_sse jSIDSF -#define jconst_fdct_float_sse2 jSCIDS2F -#define jsimd_idct_float_sse2 jSIDS2F -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - /* SIMD Ext: retrieve SIMD/CPU information */ EXTERN(unsigned int) jpeg_simd_cpu_support JPP((void)); diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index 583b7e32..a3450aa4 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -128,69 +128,3 @@ %define _cpp_protection_JSIMD_3DNOW JSIMD_3DNOW %define _cpp_protection_JSIMD_SSE JSIMD_SSE %define _cpp_protection_JSIMD_SSE2 JSIMD_SSE2 - -; Short forms of external names for systems with brain-damaged linkers. -; -#ifdef NEED_SHORT_EXTERNAL_NAMES -%define _cpp_protection_jpeg_simd_cpu_support jpeg_simd_cpu_support -%define _cpp_protection_jsimd_rgb_ycc_convert_mmx jsimd_rgb_ycc_convert_mmx -%define _cpp_protection_jsimd_ycc_rgb_convert_mmx jsimd_ycc_rgb_convert_mmx -%define _cpp_protection_jconst_rgb_ycc_convert_sse2 jconst_rgb_ycc_convert_sse2 -%define _cpp_protection_jsimd_rgb_ycc_convert_sse2 jsimd_rgb_ycc_convert_sse2 -%define _cpp_protection_jconst_ycc_rgb_convert_sse2 jconst_ycc_rgb_convert_sse2 -%define _cpp_protection_jsimd_ycc_rgb_convert_sse2 jsimd_ycc_rgb_convert_sse2 -%define _cpp_protection_jsimd_h2v2_downsample_mmx jsimd_h2v2_downsample_mmx -%define _cpp_protection_jsimd_h2v1_downsample_mmx jsimd_h2v1_downsample_mmx -%define _cpp_protection_jsimd_h2v2_downsample_sse2 jsimd_h2v2_downsample_sse2 -%define _cpp_protection_jsimd_h2v1_downsample_sse2 jsimd_h2v1_downsample_sse2 -%define _cpp_protection_jsimd_h2v2_upsample_mmx jsimd_h2v2_upsample_mmx -%define _cpp_protection_jsimd_h2v1_upsample_mmx jsimd_h2v1_upsample_mmx -%define _cpp_protection_jsimd_h2v1_fancy_upsample_mmx jsimd_h2v1_fancy_upsample_mmx -%define _cpp_protection_jsimd_h2v2_fancy_upsample_mmx jsimd_h2v2_fancy_upsample_mmx -%define _cpp_protection_jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_merged_upsample_mmx -%define _cpp_protection_jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_merged_upsample_mmx -%define _cpp_protection_jsimd_h2v2_upsample_sse2 jsimd_h2v2_upsample_sse2 -%define _cpp_protection_jsimd_h2v1_upsample_sse2 jsimd_h2v1_upsample_sse2 -%define _cpp_protection_jconst_fancy_upsample_sse2 jconst_fancy_upsample_sse2 -%define _cpp_protection_jsimd_h2v1_fancy_upsample_sse2 jsimd_h2v1_fancy_upsample_sse2 -%define _cpp_protection_jsimd_h2v2_fancy_upsample_sse2 jsimd_h2v2_fancy_upsample_sse2 -%define _cpp_protection_jconst_merged_upsample_sse2 jconst_merged_upsample_sse2 -%define _cpp_protection_jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_merged_upsample_sse2 -%define _cpp_protection_jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_merged_upsample_sse2 -%define _cpp_protection_jsimd_convsamp_mmx jsimd_convsamp_mmx -%define _cpp_protection_jsimd_convsamp_sse2 jsimd_convsamp_sse2 -%define _cpp_protection_jsimd_convsamp_float_3dnow jsimd_convsamp_float_3dnow -%define _cpp_protection_jsimd_convsamp_float_sse jsimd_convsamp_float_sse -%define _cpp_protection_jsimd_convsamp_float_sse2 jsimd_convsamp_float_sse2 -%define _cpp_protection_jsimd_fdct_islow_mmx jsimd_fdct_islow_mmx -%define _cpp_protection_jsimd_fdct_ifast_mmx jsimd_fdct_ifast_mmx -%define _cpp_protection_jconst_fdct_islow_sse2 jconst_fdct_islow_sse2 -%define _cpp_protection_jsimd_fdct_islow_sse2 jsimd_fdct_islow_sse2 -%define _cpp_protection_jconst_fdct_ifast_sse2 jconst_fdct_ifast_sse2 -%define _cpp_protection_jsimd_fdct_ifast_sse2 jsimd_fdct_ifast_sse2 -%define _cpp_protection_jsimd_fdct_float_3dnow jsimd_fdct_float_3dnow -%define _cpp_protection_jconst_fdct_float_sse jconst_fdct_float_sse -%define _cpp_protection_jsimd_fdct_float_sse jsimd_fdct_float_sse -%define _cpp_protection_jsimd_quantize_mmx jsimd_quantize_mmx -%define _cpp_protection_jsimd_quantize_sse2 jsimd_quantize_sse2 -%define _cpp_protection_jsimd_quantize_float_3dnow jsimd_quantize_float_3dnow -%define _cpp_protection_jsimd_quantize_float_sse jsimd_quantize_float_sse -%define _cpp_protection_jsimd_quantize_float_sse2 jsimd_quantize_float_sse2 -%define _cpp_protection_jsimd_idct_2x2_mmx jsimd_idct_2x2_mmx -%define _cpp_protection_jsimd_idct_4x4_mmx jsimd_idct_4x4_mmx -%define _cpp_protection_jconst_idct_red_sse2 jconst_idct_red_sse2 -%define _cpp_protection_jsimd_idct_2x2_sse2 jsimd_idct_2x2_sse2 -%define _cpp_protection_jsimd_idct_4x4_sse2 jsimd_idct_4x4_sse2 -%define _cpp_protection_jsimd_idct_islow_mmx jsimd_idct_islow_mmx -%define _cpp_protection_jsimd_idct_ifast_mmx jsimd_idct_ifast_mmx -%define _cpp_protection_jconst_idct_islow_sse2 jconst_idct_islow_sse2 -%define _cpp_protection_jsimd_idct_islow_sse2 jsimd_idct_islow_sse2 -%define _cpp_protection_jconst_idct_ifast_sse2 jconst_idct_ifast_sse2 -%define _cpp_protection_jsimd_idct_ifast_sse2 jsimd_idct_ifast_sse2 -%define _cpp_protection_jsimd_idct_float_3dnow jsimd_idct_float_3dnow -%define _cpp_protection_jconst_idct_float_sse jconst_idct_float_sse -%define _cpp_protection_jsimd_idct_float_sse jsimd_idct_float_sse -%define _cpp_protection_jconst_idct_float_sse2 jconst_idct_float_sse2 -%define _cpp_protection_jsimd_idct_float_sse2 jsimd_idct_float_sse2 -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - diff --git a/transupp.h b/transupp.h index 5b0e1bbc..19a7cffd 100644 --- a/transupp.h +++ b/transupp.h @@ -77,19 +77,6 @@ */ -/* Short forms of external names for systems with brain-damaged linkers. */ - -#ifdef NEED_SHORT_EXTERNAL_NAMES -#define jtransform_parse_crop_spec jTrParCrop -#define jtransform_request_workspace jTrRequest -#define jtransform_adjust_parameters jTrAdjust -#define jtransform_execute_transform jTrExec -#define jtransform_perfect_transform jTrPerfect -#define jcopy_markers_setup jCMrkSetup -#define jcopy_markers_execute jCMrkExec -#endif /* NEED_SHORT_EXTERNAL_NAMES */ - - /* * Codes for supported types of image transformations. */ diff --git a/win/jconfig.h.in b/win/jconfig.h.in index 516ca597..f87bef55 100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@ -18,7 +18,6 @@ #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN /* Define "boolean" as unsigned char, not int, per Windows custom */ From f8301c92dd51332914f2538b83e4330dcd8d05a8 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 16 May 2014 10:43:44 +0000 Subject: [PATCH 927/985] Get rid of the HAVE_PROTOTYPES configuration option, as well as the related JMETHOD and JPP macros. libjpeg-turbo has never supported compilers that don't handle prototypes. Doing so requires ansi2knr, which isn't even supported in the IJG code anymore. --- cdjpeg.h | 72 ++- coderules.txt | 53 +-- configure.ac | 3 - jcapimin.c | 2 +- jccoefct.c | 6 +- jcdctmgr.c | 27 +- jchuff.c | 11 +- jchuff.h | 6 +- jcmainct.c | 8 +- jconfig.h.in | 3 - jconfig.txt | 5 - jcphuff.c | 20 +- jcsample.c | 7 +- jctrans.c | 4 +- jdapistd.c | 2 +- jdatadst-tj.c | 4 +- jdatadst.c | 4 +- jdcoefct.c | 8 +- jdct.h | 78 ++-- jdhuff.h | 12 +- jdinput.c | 2 +- jdmainct.c | 12 +- jdmerge.c | 5 +- jdphuff.c | 16 +- jdpostct.c | 27 +- jdsample.c | 7 +- jdtrans.c | 2 +- jmemmgr.c | 2 +- jmemnobs.c | 4 +- jmemsys.h | 47 +- jmorecfg.h | 20 - jpegint.h | 262 +++++------ jpeglib.h | 271 +++++------ jsimd.h | 85 ++-- jsimddct.h | 119 +++-- rdtarga.c | 5 +- simd/jsimd.h | 1150 +++++++++++++++++++++------------------------- transupp.h | 25 +- turbojpeg.c | 4 +- win/jconfig.h.in | 1 - wrbmp.c | 4 +- wrrle.c | 4 +- 42 files changed, 1077 insertions(+), 1332 deletions(-) diff --git a/cdjpeg.h b/cdjpeg.h index 6eec62ff..400cb691 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -24,12 +24,9 @@ typedef struct cjpeg_source_struct * cjpeg_source_ptr; struct cjpeg_source_struct { - JMETHOD(void, start_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); - JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); - JMETHOD(void, finish_input, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + void (*start_input) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); + JDIMENSION (*get_pixel_rows) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); + void (*finish_input) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); FILE *input_file; @@ -48,15 +45,12 @@ struct djpeg_dest_struct { /* start_output is called after jpeg_start_decompress finishes. * The color map will be ready at this time, if one is needed. */ - JMETHOD(void, start_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); + void (*start_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo); /* Emit the specified number of pixel rows from the buffer. */ - JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); + void (*put_pixel_rows) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied); /* Finish up at the end of the image. */ - JMETHOD(void, finish_output, (j_decompress_ptr cinfo, - djpeg_dest_ptr dinfo)); + void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo); /* Target file spec; filled in by djpeg.c after object is created. */ FILE * output_file; @@ -91,41 +85,41 @@ 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 (j_compress_ptr cinfo); +EXTERN(djpeg_dest_ptr) jinit_write_bmp (j_decompress_ptr cinfo, + boolean is_os2); +EXTERN(cjpeg_source_ptr) jinit_read_gif (j_compress_ptr cinfo); +EXTERN(djpeg_dest_ptr) jinit_write_gif (j_decompress_ptr cinfo); +EXTERN(cjpeg_source_ptr) jinit_read_ppm (j_compress_ptr cinfo); +EXTERN(djpeg_dest_ptr) jinit_write_ppm (j_decompress_ptr cinfo); +EXTERN(cjpeg_source_ptr) jinit_read_rle (j_compress_ptr cinfo); +EXTERN(djpeg_dest_ptr) jinit_write_rle (j_decompress_ptr cinfo); +EXTERN(cjpeg_source_ptr) jinit_read_targa (j_compress_ptr cinfo); +EXTERN(djpeg_dest_ptr) jinit_write_targa (j_decompress_ptr cinfo); /* cjpeg support routines (in rdswitch.c) */ -EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, - boolean force_baseline)); -EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); -EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg, - boolean force_baseline)); -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 (j_compress_ptr cinfo, char * filename, + boolean force_baseline); +EXTERN(boolean) read_scan_script (j_compress_ptr cinfo, char * filename); +EXTERN(boolean) set_quality_ratings (j_compress_ptr cinfo, char *arg, + boolean force_baseline); +EXTERN(boolean) set_quant_slots (j_compress_ptr cinfo, char *arg); +EXTERN(boolean) set_sample_factors (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 (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 (j_common_ptr cinfo); +EXTERN(void) start_progress_monitor (j_common_ptr cinfo, + cd_progress_ptr progress); +EXTERN(void) end_progress_monitor (j_common_ptr cinfo); +EXTERN(boolean) keymatch (char * arg, const char * keyword, int minchars); +EXTERN(FILE *) read_stdin (void); +EXTERN(FILE *) write_stdout (void); /* miscellaneous useful macros */ diff --git a/coderules.txt b/coderules.txt index 6ee7f5e9..f36d5f89 100644 --- a/coderules.txt +++ b/coderules.txt @@ -1,7 +1,11 @@ + + IJG JPEG LIBRARY: CODING RULES Copyright (C) 1991-1996, Thomas G. Lane. -This file is part of the Independent JPEG Group's software. +This file was part of the Independent JPEG Group's software. +It was modified by The libjpeg-turbo Project to include only information +relevant to libjpeg-turbo. For conditions of distribution and use, see the accompanying README file. @@ -32,22 +36,7 @@ handled automatically by GNU Emacs and many other text editors.) Multi-word names should be written in lower case with underscores, e.g., multi_word_name (not multiWordName). Preprocessor symbols and enum constants are similar but upper case (MULTI_WORD_NAME). Names should be unique within -the first fifteen characters. (On some older systems, global names must be -unique within six characters. We accommodate this without cluttering the -source code by using macros to substitute shorter names.) - -We use function prototypes everywhere; we rely on automatic source code -transformation to feed prototype-less C compilers. Transformation is done -by the simple and portable tool 'ansi2knr.c' (courtesy of Ghostscript). -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 *) -function_name (int a, char *b) -{ - code... -} +the first fifteen characters. 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 @@ -55,27 +44,8 @@ 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 - #ifdef HAVE_PROTOTYPES - #define JMETHOD(type,methodname,arglist) type (*methodname) arglist - #else - #define JMETHOD(type,methodname,arglist) type (*methodname) () - #endif -which is used like this: - struct function_pointers { - JMETHOD(void, init_entropy_encoder, (int somearg, jparms *jp)); - JMETHOD(void, term_entropy_encoder, (void)); - }; -Note the set of parentheses surrounding the parameter list. - -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 -explicit casts on actual parameters whenever the actual parameter type is not -identical to the formal parameter. Beware of implicit conversions to "int". +A similar solution is used for external function declarations (see the EXTERN +macro.) It seems there are some non-ANSI compilers in which the sizeof() operator is defined to return int, yet size_t is defined as long. Needless to say, @@ -105,10 +75,9 @@ the system architecture document, structure.txt). 5. Source file names should begin with "j" for files that are part of the library proper; source files that are not part of the library, such as cjpeg.c -and djpeg.c, do not begin with "j". Keep source file names to eight -characters (plus ".c" or ".h", etc) to make life easy for MS-DOSers. Keep -compression and decompression code in separate source files --- some -applications may want only one half of the library. +and djpeg.c, do not begin with "j". Keep compression and decompression code in +separate source files --- some applications may want only one half of the +library. Note: these rules (particularly #4) are not followed religiously in the modules that are used in cjpeg/djpeg but are not part of the JPEG library diff --git a/configure.ac b/configure.ac index 12724f72..53f7e302 100644 --- a/configure.ac +++ b/configure.ac @@ -8,9 +8,6 @@ BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) AC_PREFIX_DEFAULT(/opt/libjpeg-turbo) -# Always build with prototypes -AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes]) - m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Checks for programs. diff --git a/jcapimin.c b/jcapimin.c index 601bb71d..cbd9bd27 100644 --- a/jcapimin.c +++ b/jcapimin.c @@ -204,7 +204,7 @@ GLOBAL(void) jpeg_write_marker (j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen) { - JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); + void (*write_marker_byte) (j_compress_ptr info, int val); if (cinfo->next_scanline != 0 || (cinfo->global_state != CSTATE_SCANNING && diff --git a/jccoefct.c b/jccoefct.c index ffc9b7ec..faca94e0 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -59,12 +59,12 @@ typedef my_coef_controller * my_coef_ptr; /* Forward declarations */ METHODDEF(boolean) compress_data - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); + (j_compress_ptr cinfo, JSAMPIMAGE input_buf); #ifdef FULL_COEF_BUFFER_SUPPORTED METHODDEF(boolean) compress_first_pass - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); + (j_compress_ptr cinfo, JSAMPIMAGE input_buf); METHODDEF(boolean) compress_output - JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); + (j_compress_ptr cinfo, JSAMPIMAGE input_buf); #endif diff --git a/jcdctmgr.c b/jcdctmgr.c index bf40ff76..3066d52e 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -24,22 +24,21 @@ /* Private subobject for this module */ -typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); -typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); +typedef void (*forward_DCT_method_ptr) (DCTELEM * data); +typedef void (*float_DCT_method_ptr) (FAST_FLOAT * data); -typedef JMETHOD(void, convsamp_method_ptr, - (JSAMPARRAY sample_data, JDIMENSION start_col, - DCTELEM * workspace)); -typedef JMETHOD(void, float_convsamp_method_ptr, - (JSAMPARRAY sample_data, JDIMENSION start_col, - FAST_FLOAT *workspace)); +typedef void (*convsamp_method_ptr) (JSAMPARRAY sample_data, + JDIMENSION start_col, + DCTELEM * workspace); +typedef void (*float_convsamp_method_ptr) (JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT *workspace); -typedef JMETHOD(void, quantize_method_ptr, - (JCOEFPTR coef_block, DCTELEM * divisors, - DCTELEM * workspace)); -typedef JMETHOD(void, float_quantize_method_ptr, - (JCOEFPTR coef_block, FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +typedef void (*quantize_method_ptr) (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace); +typedef void (*float_quantize_method_ptr) (JCOEFPTR coef_block, + FAST_FLOAT * divisors, + FAST_FLOAT * workspace); METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *); diff --git a/jchuff.c b/jchuff.c index b205cf98..e316f730 100644 --- a/jchuff.c +++ b/jchuff.c @@ -123,13 +123,12 @@ 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 (j_compress_ptr cinfo, JBLOCKROW *MCU_data); +METHODDEF(void) finish_pass_huff (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 (j_compress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(void) finish_pass_gather (j_compress_ptr cinfo); #endif diff --git a/jchuff.h b/jchuff.h index c4199230..c247e6f2 100644 --- a/jchuff.h +++ b/jchuff.h @@ -32,9 +32,9 @@ typedef struct { /* Expand a Huffman table definition into the derived format */ EXTERN(void) jpeg_make_c_derived_tbl - JPP((j_compress_ptr cinfo, boolean isDC, int tblno, - c_derived_tbl ** pdtbl)); + (j_compress_ptr cinfo, boolean isDC, int tblno, + 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[])); + (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]); diff --git a/jcmainct.c b/jcmainct.c index 5a0549a1..62f13c98 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -52,12 +52,12 @@ typedef my_main_controller * my_main_ptr; /* Forward declarations */ METHODDEF(void) process_data_simple_main - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); + (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 - JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); + (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail); #endif diff --git a/jconfig.h.in b/jconfig.h.in index 73a523da..cdca01f3 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -15,9 +15,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H -/* Define if your compiler supports prototypes */ -#undef HAVE_PROTOTYPES - /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H diff --git a/jconfig.txt b/jconfig.txt index 631c7a0f..bf89a836 100644 --- a/jconfig.txt +++ b/jconfig.txt @@ -23,11 +23,6 @@ * #define the symbol if yes, #undef it if no. */ -/* Does your compiler support function prototypes? - * (If not, you also need to use ansi2knr, see install.txt) - */ -#define HAVE_PROTOTYPES - /* Does your compiler support the declaration "unsigned char" ? * How about "unsigned short" ? */ diff --git a/jcphuff.c b/jcphuff.c index b764b650..a95e94c7 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -86,16 +86,16 @@ 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, - 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)); +METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) encode_mcu_AC_first (j_compress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) encode_mcu_AC_refine (j_compress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo); +METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo); /* diff --git a/jcsample.c b/jcsample.c index e1b45e77..4bc2b23e 100644 --- a/jcsample.c +++ b/jcsample.c @@ -53,9 +53,10 @@ /* Pointer to routine to downsample a single component */ -typedef JMETHOD(void, downsample1_ptr, - (j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); +typedef void (*downsample1_ptr) (j_compress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY output_data); /* Private subobject */ diff --git a/jctrans.c b/jctrans.c index c3532939..62d43962 100644 --- a/jctrans.c +++ b/jctrans.c @@ -18,9 +18,9 @@ /* Forward declarations */ LOCAL(void) transencode_master_selection - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); + (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays); LOCAL(void) transencode_coef_controller - JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); + (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays); /* diff --git a/jdapistd.c b/jdapistd.c index f4ac50d1..3be527cb 100644 --- a/jdapistd.c +++ b/jdapistd.c @@ -23,7 +23,7 @@ /* Forward declarations */ -LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); +LOCAL(boolean) output_pass_setup (j_decompress_ptr cinfo); /* diff --git a/jdatadst-tj.c b/jdatadst-tj.c index 95d98235..786a7522 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -23,8 +23,8 @@ #include "jerror.h" #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); +extern void * malloc (size_t size); +extern void free (void *ptr); #endif diff --git a/jdatadst.c b/jdatadst.c index 3fbc449b..436e6638 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -23,8 +23,8 @@ #include "jerror.h" #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); +extern void * malloc (size_t size); +extern void free (void *ptr); #endif diff --git a/jdcoefct.c b/jdcoefct.c index 1d18a744..775bcdf4 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -69,15 +69,15 @@ typedef my_coef_controller * my_coef_ptr; /* Forward declarations */ METHODDEF(int) decompress_onepass - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); #ifdef D_MULTISCAN_FILES_SUPPORTED METHODDEF(int) decompress_data - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); #endif #ifdef BLOCK_SMOOTHING_SUPPORTED -LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); +LOCAL(boolean) smoothing_ok (j_decompress_ptr cinfo); METHODDEF(int) decompress_smooth_data - JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); + (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); #endif diff --git a/jdct.h b/jdct.h index b8d6e9cd..0c70c5b9 100644 --- a/jdct.h +++ b/jdct.h @@ -88,64 +88,64 @@ 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 (DCTELEM * data); +EXTERN(void) jpeg_fdct_ifast (DCTELEM * data); +EXTERN(void) jpeg_fdct_float (FAST_FLOAT * data); EXTERN(void) jpeg_idct_islow - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_ifast - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_float - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_7x7 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_6x6 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_5x5 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_4x4 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_3x3 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_2x2 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_1x1 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_9x9 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_10x10 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_11x11 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_12x12 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_13x13 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_14x14 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_15x15 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); EXTERN(void) jpeg_idct_16x16 - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); /* diff --git a/jdhuff.h b/jdhuff.h index 18fdcb81..788f36dc 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -45,8 +45,8 @@ typedef struct { /* Expand a Huffman table definition into the derived format */ EXTERN(void) jpeg_make_d_derived_tbl - JPP((j_decompress_ptr cinfo, boolean isDC, int tblno, - d_derived_tbl ** pdtbl)); + (j_decompress_ptr cinfo, boolean isDC, int tblno, + d_derived_tbl ** pdtbl); /* @@ -159,8 +159,8 @@ typedef struct { /* Bitreading working state within an MCU */ /* 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)); + (bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, int nbits); /* @@ -223,5 +223,5 @@ 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)); + (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 4afb0742..e3df0c10 100644 --- a/jdinput.c +++ b/jdinput.c @@ -31,7 +31,7 @@ typedef my_input_controller * my_inputctl_ptr; /* Forward declarations */ -METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); +METHODDEF(int) consume_markers (j_decompress_ptr cinfo); /* diff --git a/jdmainct.c b/jdmainct.c index 922f649a..b4d4a22c 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -144,15 +144,15 @@ typedef my_main_controller * my_main_ptr; /* Forward declarations */ METHODDEF(void) process_data_simple_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + (j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); METHODDEF(void) process_data_context_main - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + (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 - JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, - JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); + (j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); #endif diff --git a/jdmerge.c b/jdmerge.c index b82fe474..60d0f5c1 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -83,9 +83,8 @@ typedef struct { struct jpeg_upsampler pub; /* public fields */ /* Pointer to routine to do actual upsampling/conversion of one row group */ - JMETHOD(void, upmethod, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf)); + void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); /* Private state for YCC->RGB conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */ diff --git a/jdphuff.c b/jdphuff.c index 783d8a8f..cd8f0b28 100644 --- a/jdphuff.c +++ b/jdphuff.c @@ -74,14 +74,14 @@ 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, - JBLOCKROW *MCU_data)); -METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_DC_first (j_decompress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) decode_mcu_AC_first (j_decompress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) decode_mcu_DC_refine (j_decompress_ptr cinfo, + JBLOCKROW *MCU_data); +METHODDEF(boolean) decode_mcu_AC_refine (j_decompress_ptr cinfo, + JBLOCKROW *MCU_data); /* diff --git a/jdpostct.c b/jdpostct.c index aa2af07d..2e8f28c7 100644 --- a/jdpostct.c +++ b/jdpostct.c @@ -44,24 +44,21 @@ typedef my_post_controller * my_post_ptr; /* Forward declarations */ 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)); + (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 - 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)); + (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 - 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)); + (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); #endif diff --git a/jdsample.c b/jdsample.c index 3da1d064..a1d19e7b 100644 --- a/jdsample.c +++ b/jdsample.c @@ -29,9 +29,10 @@ /* Pointer to routine to upsample a single component */ -typedef JMETHOD(void, upsample1_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +typedef void (*upsample1_ptr) (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); /* Private subobject */ diff --git a/jdtrans.c b/jdtrans.c index 0a163c04..85b60b89 100644 --- a/jdtrans.c +++ b/jdtrans.c @@ -16,7 +16,7 @@ /* Forward declarations */ -LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); +LOCAL(void) transdecode_master_selection (j_decompress_ptr cinfo); /* diff --git a/jmemmgr.c b/jmemmgr.c index 15b6325f..8e33318f 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -32,7 +32,7 @@ #ifndef NO_GETENV #ifndef HAVE_STDLIB_H /* should declare getenv() */ -extern char * getenv JPP((const char * name)); +extern char * getenv (const char * name); #endif #endif diff --git a/jmemnobs.c b/jmemnobs.c index 2e4de090..e81b0165 100644 --- a/jmemnobs.c +++ b/jmemnobs.c @@ -21,8 +21,8 @@ #include "jmemsys.h" /* import the system-dependent declarations */ #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ -extern void * malloc JPP((size_t size)); -extern void free JPP((void *ptr)); +extern void * malloc (size_t size); +extern void free (void *ptr); #endif diff --git a/jmemsys.h b/jmemsys.h index 2a8c4692..b32f80cd 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -30,9 +30,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 (j_common_ptr cinfo, size_t sizeofobject); +EXTERN(void) jpeg_free_small (j_common_ptr cinfo, void * object, + size_t sizeofobject); /* * These two functions are used to allocate and release large chunks of @@ -43,10 +43,9 @@ 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 (j_common_ptr cinfo, size_t sizeofobject); +EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, + size_t sizeofobject); /* * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may @@ -86,10 +85,9 @@ 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(size_t) jpeg_mem_available JPP((j_common_ptr cinfo, - size_t min_bytes_needed, - size_t max_bytes_needed, - size_t already_allocated)); +EXTERN(size_t) jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed, + size_t max_bytes_needed, + size_t already_allocated); /* @@ -124,16 +122,13 @@ typedef struct backing_store_struct * backing_store_ptr; typedef struct backing_store_struct { /* Methods for reading/writing/closing this backing-store object */ - JMETHOD(void, read_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); - JMETHOD(void, write_backing_store, (j_common_ptr cinfo, - backing_store_ptr info, - void FAR * buffer_address, - long file_offset, long byte_count)); - JMETHOD(void, close_backing_store, (j_common_ptr cinfo, - backing_store_ptr info)); + void (*read_backing_store) (j_common_ptr cinfo, backing_store_ptr info, + void FAR * buffer_address, long file_offset, + long byte_count); + void (*write_backing_store) (j_common_ptr cinfo, backing_store_ptr info, + void FAR * buffer_address, long file_offset, + long byte_count); + void (*close_backing_store) (j_common_ptr cinfo, backing_store_ptr info); /* Private fields for system-dependent backing-store management */ #ifdef USE_MSDOS_MEMMGR @@ -163,9 +158,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 (j_common_ptr cinfo, + backing_store_ptr info, + long total_bytes_needed); /* @@ -180,5 +175,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 (j_common_ptr cinfo); +EXTERN(void) jpeg_mem_term (j_common_ptr cinfo); diff --git a/jmorecfg.h b/jmorecfg.h index 1894e0fc..11307b43 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -192,19 +192,6 @@ typedef unsigned int JDIMENSION; #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" * on 80x86 machines. Most of the specialized coding for 80x86 is handled * by just saying "FAR *" where such a pointer is needed. In a few places @@ -402,17 +389,10 @@ static const int rgb_pixelsize[JPEG_NUMCS] = { /* FAST_FLOAT should be either float or double, whichever is done faster * by your compiler. (Note that this type is only used in the floating point * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) - * Typically, float is faster in ANSI C compilers, while double is faster in - * pre-ANSI compilers (because they insist on converting to double anyway). - * The code below therefore chooses float if we have ANSI-style prototypes. */ #ifndef FAST_FLOAT -#ifdef HAVE_PROTOTYPES #define FAST_FLOAT float -#else -#define FAST_FLOAT double -#endif #endif #endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/jpegint.h b/jpegint.h index cfb59563..51c11c31 100644 --- a/jpegint.h +++ b/jpegint.h @@ -44,9 +44,9 @@ typedef enum { /* Operating modes for buffer controllers */ /* Master control module */ struct jpeg_comp_master { - JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); - JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); + void (*prepare_for_pass) (j_compress_ptr cinfo); + void (*pass_startup) (j_compress_ptr cinfo); + void (*finish_pass) (j_compress_ptr cinfo); /* State variables made visible to other modules */ boolean call_pass_startup; /* True if pass_startup must be called */ @@ -55,80 +55,74 @@ struct jpeg_comp_master { /* Main buffer control (downsampled-data buffer) */ struct jpeg_c_main_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail)); + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + void (*process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail); }; /* Compression preprocessing (downsampling input buffer control) */ struct jpeg_c_prep_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, - JDIMENSION *in_row_ctr, - JDIMENSION in_rows_avail, - JSAMPIMAGE output_buf, - JDIMENSION *out_row_group_ctr, - JDIMENSION out_row_groups_avail)); + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + void (*pre_process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, + JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail); }; /* Coefficient buffer control */ struct jpeg_c_coef_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf)); + void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); + boolean (*compress_data) (j_compress_ptr cinfo, JSAMPIMAGE input_buf); }; /* Colorspace conversion */ struct jpeg_color_converter { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, color_convert, (j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + void (*start_pass) (j_compress_ptr cinfo); + void (*color_convert) (j_compress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPIMAGE output_buf, JDIMENSION output_row, + int num_rows); }; /* Downsampling */ struct jpeg_downsampler { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, downsample, (j_compress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_index, - JSAMPIMAGE output_buf, - JDIMENSION out_row_group_index)); + void (*start_pass) (j_compress_ptr cinfo); + void (*downsample) (j_compress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_index, JSAMPIMAGE output_buf, + JDIMENSION out_row_group_index); boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Forward DCT (also controls coefficient quantization) */ struct jpeg_forward_dct { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); + void (*start_pass) (j_compress_ptr cinfo); /* perhaps this should be an array??? */ - JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, - jpeg_component_info * compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks)); + void (*forward_DCT) (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks); }; /* Entropy encoding */ struct jpeg_entropy_encoder { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); - JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); + void (*start_pass) (j_compress_ptr cinfo, boolean gather_statistics); + boolean (*encode_mcu) (j_compress_ptr cinfo, JBLOCKROW *MCU_data); + void (*finish_pass) (j_compress_ptr cinfo); }; /* Marker writing */ struct jpeg_marker_writer { - JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); - JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); + void (*write_file_header) (j_compress_ptr cinfo); + void (*write_frame_header) (j_compress_ptr cinfo); + void (*write_scan_header) (j_compress_ptr cinfo); + void (*write_file_trailer) (j_compress_ptr cinfo); + void (*write_tables_only) (j_compress_ptr cinfo); /* These routines are exported to allow insertion of extra markers */ /* Probably only COM and APPn markers should be written this way */ - JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, - unsigned int datalen)); - JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); + void (*write_marker_header) (j_compress_ptr cinfo, int marker, + unsigned int datalen); + void (*write_marker_byte) (j_compress_ptr cinfo, int val); }; @@ -136,8 +130,8 @@ struct jpeg_marker_writer { /* Master control module */ struct jpeg_decomp_master { - JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); + void (*prepare_for_output_pass) (j_decompress_ptr cinfo); + void (*finish_output_pass) (j_decompress_ptr cinfo); /* State variables made visible to other modules */ boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ @@ -145,10 +139,10 @@ struct jpeg_decomp_master { /* Input control module */ struct jpeg_input_controller { - JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); - JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); + int (*consume_input) (j_decompress_ptr cinfo); + void (*reset_input_controller) (j_decompress_ptr cinfo); + void (*start_input_pass) (j_decompress_ptr cinfo); + void (*finish_input_pass) (j_decompress_ptr cinfo); /* State variables made visible to other modules */ boolean has_multiple_scans; /* True if file has multiple scans */ @@ -157,43 +151,39 @@ struct jpeg_input_controller { /* Main buffer control (downsampled-data buffer) */ struct jpeg_d_main_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_decompress_ptr cinfo, - JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, - JDIMENSION out_rows_avail)); + void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); + void (*process_data) (j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); }; /* Coefficient buffer control */ struct jpeg_d_coef_controller { - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); - JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); - JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, - JSAMPIMAGE output_buf)); + void (*start_input_pass) (j_decompress_ptr cinfo); + int (*consume_data) (j_decompress_ptr cinfo); + void (*start_output_pass) (j_decompress_ptr cinfo); + int (*decompress_data) (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); /* Pointer to array of coefficient virtual arrays, or NULL if none */ jvirt_barray_ptr *coef_arrays; }; /* Decompression postprocessing (color quantization buffer control) */ struct jpeg_d_post_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, post_process_data, (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)); + void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); + void (*post_process_data) (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); }; /* Marker reading & parsing */ struct jpeg_marker_reader { - JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); + void (*reset_marker_reader) (j_decompress_ptr cinfo); /* Read markers until SOS or EOI. * Returns same codes as are defined for jpeg_consume_input: * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. */ - JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); + int (*read_markers) (j_decompress_ptr cinfo); /* Read a restart marker --- exported for use by entropy decoder only */ jpeg_marker_parser_method read_restart_marker; @@ -208,9 +198,8 @@ struct jpeg_marker_reader { /* Entropy decoding */ struct jpeg_entropy_decoder { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, - JBLOCKROW *MCU_data)); + void (*start_pass) (j_decompress_ptr cinfo); + boolean (*decode_mcu) (j_decompress_ptr cinfo, JBLOCKROW *MCU_data); /* This is here to share code between baseline and progressive decoders; */ /* other modules probably should not use it */ @@ -218,47 +207,44 @@ struct jpeg_entropy_decoder { }; /* Inverse DCT (also performs dequantization) */ -typedef JMETHOD(void, inverse_DCT_method_ptr, - (j_decompress_ptr cinfo, jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, JDIMENSION output_col)); +typedef void (*inverse_DCT_method_ptr) (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, + JDIMENSION output_col); struct jpeg_inverse_dct { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + void (*start_pass) (j_decompress_ptr cinfo); /* It is useful to allow each component to have a separate IDCT method. */ inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; }; /* Upsampling (note that upsampler must also call color converter) */ struct jpeg_upsampler { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, upsample, (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)); + void (*start_pass) (j_decompress_ptr cinfo); + void (*upsample) (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); boolean need_context_rows; /* TRUE if need rows above & below */ }; /* Colorspace conversion */ struct jpeg_color_deconverter { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, color_convert, (j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + void (*start_pass) (j_decompress_ptr cinfo); + void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION input_row, JSAMPARRAY output_buf, + int num_rows); }; /* Color quantization or color precision reduction */ struct jpeg_color_quantizer { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); - JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPARRAY output_buf, - int num_rows)); - JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); + void (*start_pass) (j_decompress_ptr cinfo, boolean is_pre_scan); + void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows); + void (*finish_pass) (j_decompress_ptr cinfo); + void (*new_color_map) (j_decompress_ptr cinfo); }; @@ -293,53 +279,53 @@ 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_arith_encoder JPP((j_compress_ptr cinfo)); -EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_compress_master (j_compress_ptr cinfo); +EXTERN(void) jinit_c_master_control (j_compress_ptr cinfo, + boolean transcode_only); +EXTERN(void) jinit_c_main_controller (j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_c_prep_controller (j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_c_coef_controller (j_compress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_color_converter (j_compress_ptr cinfo); +EXTERN(void) jinit_downsampler (j_compress_ptr cinfo); +EXTERN(void) jinit_forward_dct (j_compress_ptr cinfo); +EXTERN(void) jinit_huff_encoder (j_compress_ptr cinfo); +EXTERN(void) jinit_phuff_encoder (j_compress_ptr cinfo); +EXTERN(void) jinit_arith_encoder (j_compress_ptr cinfo); +EXTERN(void) jinit_marker_writer (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_arith_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 (j_decompress_ptr cinfo); +EXTERN(void) jinit_d_main_controller (j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_d_coef_controller (j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_d_post_controller (j_decompress_ptr cinfo, + boolean need_full_buffer); +EXTERN(void) jinit_input_controller (j_decompress_ptr cinfo); +EXTERN(void) jinit_marker_reader (j_decompress_ptr cinfo); +EXTERN(void) jinit_huff_decoder (j_decompress_ptr cinfo); +EXTERN(void) jinit_phuff_decoder (j_decompress_ptr cinfo); +EXTERN(void) jinit_arith_decoder (j_decompress_ptr cinfo); +EXTERN(void) jinit_inverse_dct (j_decompress_ptr cinfo); +EXTERN(void) jinit_upsampler (j_decompress_ptr cinfo); +EXTERN(void) jinit_color_deconverter (j_decompress_ptr cinfo); +EXTERN(void) jinit_1pass_quantizer (j_decompress_ptr cinfo); +EXTERN(void) jinit_2pass_quantizer (j_decompress_ptr cinfo); +EXTERN(void) jinit_merged_upsampler (j_decompress_ptr cinfo); /* Memory manager initialization */ -EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); +EXTERN(void) jinit_memory_mgr (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 (long a, long b); +EXTERN(long) jround_up (long a, long b); +EXTERN(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols); +EXTERN(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, + JDIMENSION num_blocks); +EXTERN(void) jzero_far (void FAR * target, size_t bytestozero); /* Constant tables in jutils.c */ #if 0 /* This table is not actually needed in v6a */ extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ diff --git a/jpeglib.h b/jpeglib.h index 612f74aa..437d65ed 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -719,16 +719,16 @@ struct jpeg_decompress_struct { struct jpeg_error_mgr { /* Error exit handler: does not return to caller */ - JMETHOD(void, error_exit, (j_common_ptr cinfo)); + void (*error_exit) (j_common_ptr cinfo); /* Conditionally emit a trace or warning message */ - JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); + void (*emit_message) (j_common_ptr cinfo, int msg_level); /* Routine that actually outputs a trace or error message */ - JMETHOD(void, output_message, (j_common_ptr cinfo)); + void (*output_message) (j_common_ptr cinfo); /* Format a message string for the most recent JPEG error or message */ - JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); + void (*format_message) (j_common_ptr cinfo, char * buffer); #define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ /* Reset error state variables at start of a new image */ - JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); + void (*reset_error_mgr) (j_common_ptr cinfo); /* The message ID code and any parameters are saved here. * A message can have one string parameter or up to 8 int parameters. @@ -776,7 +776,7 @@ struct jpeg_error_mgr { /* Progress monitor object */ struct jpeg_progress_mgr { - JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); + void (*progress_monitor) (j_common_ptr cinfo); long pass_counter; /* work units completed in this pass */ long pass_limit; /* total number of work units in this pass */ @@ -791,9 +791,9 @@ struct jpeg_destination_mgr { JOCTET * next_output_byte; /* => next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - JMETHOD(void, init_destination, (j_compress_ptr cinfo)); - JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); - JMETHOD(void, term_destination, (j_compress_ptr cinfo)); + void (*init_destination) (j_compress_ptr cinfo); + boolean (*empty_output_buffer) (j_compress_ptr cinfo); + void (*term_destination) (j_compress_ptr cinfo); }; @@ -803,11 +803,11 @@ struct jpeg_source_mgr { const JOCTET * next_input_byte; /* => next byte to read from buffer */ size_t bytes_in_buffer; /* # of bytes remaining in buffer */ - JMETHOD(void, init_source, (j_decompress_ptr cinfo)); - JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); - JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); - JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); - JMETHOD(void, term_source, (j_decompress_ptr cinfo)); + void (*init_source) (j_decompress_ptr cinfo); + boolean (*fill_input_buffer) (j_decompress_ptr cinfo); + void (*skip_input_data) (j_decompress_ptr cinfo, long num_bytes); + boolean (*resync_to_restart) (j_decompress_ptr cinfo, int desired); + void (*term_source) (j_decompress_ptr cinfo); }; @@ -832,41 +832,32 @@ typedef struct jvirt_barray_control * jvirt_barray_ptr; struct jpeg_memory_mgr { /* Method pointers */ - JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, - size_t sizeofobject)); - JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, - JDIMENSION samplesperrow, - JDIMENSION numrows)); - JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, - JDIMENSION blocksperrow, - JDIMENSION numrows)); - JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION samplesperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, - int pool_id, - boolean pre_zero, - JDIMENSION blocksperrow, - JDIMENSION numrows, - JDIMENSION maxaccess)); - JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); - JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, - jvirt_sarray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); - JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, - jvirt_barray_ptr ptr, - JDIMENSION start_row, - JDIMENSION num_rows, - boolean writable)); - JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); - JMETHOD(void, self_destruct, (j_common_ptr cinfo)); + void * (*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject); + void FAR * (*alloc_large) (j_common_ptr cinfo, int pool_id, + size_t sizeofobject); + JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, JDIMENSION numrows); + JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, JDIMENSION numrows); + jvirt_sarray_ptr (*request_virt_sarray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + jvirt_barray_ptr (*request_virt_barray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + void (*realize_virt_arrays) (j_common_ptr cinfo); + JSAMPARRAY (*access_virt_sarray) (j_common_ptr cinfo, jvirt_sarray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + JBLOCKARRAY (*access_virt_barray) (j_common_ptr cinfo, jvirt_barray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + void (*free_pool) (j_common_ptr cinfo, int pool_id); + void (*self_destruct) (j_common_ptr cinfo); /* Limit on memory allocation for this JPEG object. (Note that this is * merely advisory, not a guaranteed maximum; it only affects the space @@ -883,24 +874,11 @@ struct jpeg_memory_mgr { /* Routine signature for application-supplied marker processing methods. * Need not pass marker code since it is stored in cinfo->unread_marker. */ -typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); - - -/* Declarations for routines called by application. - * The JPP macro hides prototype parameters from compilers that can't cope. - * Note JPP requires double parentheses. - */ - -#ifdef HAVE_PROTOTYPES -#define JPP(arglist) arglist -#else -#define JPP(arglist) () -#endif +typedef 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 (struct jpeg_error_mgr * err); /* Initialization of JPEG compression objects. * jpeg_create_compress() and jpeg_create_decompress() are the exported @@ -915,89 +893,80 @@ EXTERN(struct jpeg_error_mgr *) jpeg_std_error #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)); +EXTERN(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version, + size_t structsize); +EXTERN(void) jpeg_CreateDecompress (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)); +EXTERN(void) jpeg_destroy_compress (j_compress_ptr cinfo); +EXTERN(void) jpeg_destroy_decompress (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 (j_compress_ptr cinfo, FILE * outfile); +EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile); #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) /* Data source and destination managers: memory buffers. */ -EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, - unsigned char ** outbuffer, - unsigned long * outsize)); -EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, - unsigned char * inbuffer, - unsigned long insize)); +EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer, + unsigned long * outsize); +EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * inbuffer, + unsigned long insize); #endif /* Default parameter setup for compression */ -EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_defaults (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_set_colorspace (j_compress_ptr cinfo, + J_COLOR_SPACE colorspace); +EXTERN(void) jpeg_default_colorspace (j_compress_ptr cinfo); +EXTERN(void) jpeg_set_quality (j_compress_ptr cinfo, int quality, + boolean force_baseline); +EXTERN(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, + boolean force_baseline); #if JPEG_LIB_VERSION >= 70 -EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, - boolean force_baseline)); +EXTERN(void) jpeg_default_qtables (j_compress_ptr cinfo, + boolean force_baseline); #endif -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_add_quant_table (j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, boolean force_baseline); +EXTERN(int) jpeg_quality_scaling (int quality); +EXTERN(void) jpeg_simple_progression (j_compress_ptr cinfo); +EXTERN(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table (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 (j_compress_ptr cinfo, + boolean write_all_tables); +EXTERN(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines); +EXTERN(void) jpeg_finish_compress (j_compress_ptr cinfo); #if JPEG_LIB_VERSION >= 70 /* Precalculate JPEG dimensions for current compression parameters. */ -EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo); #endif /* 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 (j_compress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION num_lines); /* Write a special marker. See libjpeg.txt 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 (j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen); /* Same, but piecemeal. */ -EXTERN(void) jpeg_write_m_header - JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); -EXTERN(void) jpeg_write_m_byte - JPP((j_compress_ptr cinfo, int val)); +EXTERN(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker, + unsigned int datalen); +EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val); /* Alternate compression function: just write an abbreviated table file */ -EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_write_tables (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 (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 */ @@ -1009,25 +978,23 @@ 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 (j_decompress_ptr cinfo); +EXTERN(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines); +EXTERN(boolean) jpeg_finish_decompress (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 (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 (j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number); +EXTERN(boolean) jpeg_finish_output (j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_input_complete (j_decompress_ptr cinfo); +EXTERN(void) jpeg_new_colormap (j_decompress_ptr cinfo); +EXTERN(int) jpeg_consume_input (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 */ @@ -1037,26 +1004,25 @@ EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); /* Precalculate output dimensions for current decompression parameters. */ #if JPEG_LIB_VERSION >= 80 -EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_core_output_dimensions (j_decompress_ptr cinfo); #endif -EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo); /* Control saving of COM and APPn markers into marker_list. */ -EXTERN(void) jpeg_save_markers - JPP((j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit)); +EXTERN(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit); /* 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 (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 (j_decompress_ptr cinfo); +EXTERN(void) jpeg_write_coefficients (j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays); +EXTERN(void) jpeg_copy_critical_parameters (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, @@ -1064,18 +1030,17 @@ 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 (j_compress_ptr cinfo); +EXTERN(void) jpeg_abort_decompress (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 (j_common_ptr cinfo); +EXTERN(void) jpeg_destroy (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 (j_decompress_ptr cinfo, int desired); /* These marker codes are exported since applications and data source modules diff --git a/jsimd.h b/jsimd.h index 80bc20bc..663c9693 100644 --- a/jsimd.h +++ b/jsimd.h @@ -10,74 +10,67 @@ * */ -EXTERN(int) jsimd_can_rgb_ycc JPP((void)); -EXTERN(int) jsimd_can_rgb_gray JPP((void)); -EXTERN(int) jsimd_can_ycc_rgb JPP((void)); -EXTERN(int) jsimd_c_can_null_convert JPP((void)); +EXTERN(int) jsimd_can_rgb_ycc (void); +EXTERN(int) jsimd_can_rgb_gray (void); +EXTERN(int) jsimd_can_ycc_rgb (void); +EXTERN(int) jsimd_c_can_null_convert (void); EXTERN(void) jsimd_rgb_ycc_convert - JPP((j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_rgb_gray_convert - JPP((j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_ycc_rgb_convert - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_c_null_convert - JPP((j_compress_ptr cinfo, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); -EXTERN(int) jsimd_can_h2v2_downsample JPP((void)); -EXTERN(int) jsimd_can_h2v1_downsample JPP((void)); +EXTERN(int) jsimd_can_h2v2_downsample (void); +EXTERN(int) jsimd_can_h2v1_downsample (void); EXTERN(void) jsimd_h2v2_downsample - JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data); -EXTERN(int) jsimd_can_h2v2_smooth_downsample JPP((void)); +EXTERN(int) jsimd_can_h2v2_smooth_downsample (void); EXTERN(void) jsimd_h2v2_smooth_downsample - JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data); EXTERN(void) jsimd_h2v1_downsample - JPP((j_compress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data); -EXTERN(int) jsimd_can_h2v2_upsample JPP((void)); -EXTERN(int) jsimd_can_h2v1_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v2_upsample (void); +EXTERN(int) jsimd_can_h2v1_upsample (void); EXTERN(void) jsimd_h2v2_upsample - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(void) jsimd_h2v1_upsample - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); -EXTERN(int) jsimd_can_h2v2_fancy_upsample JPP((void)); -EXTERN(int) jsimd_can_h2v1_fancy_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v2_fancy_upsample (void); +EXTERN(int) jsimd_can_h2v1_fancy_upsample (void); EXTERN(void) jsimd_h2v2_fancy_upsample - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(void) jsimd_h2v1_fancy_upsample - JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); -EXTERN(int) jsimd_can_h2v2_merged_upsample JPP((void)); -EXTERN(int) jsimd_can_h2v1_merged_upsample JPP((void)); +EXTERN(int) jsimd_can_h2v2_merged_upsample (void); +EXTERN(int) jsimd_can_h2v1_merged_upsample (void); EXTERN(void) jsimd_h2v2_merged_upsample - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf)); + (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); EXTERN(void) jsimd_h2v1_merged_upsample - JPP((j_decompress_ptr cinfo, - JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, - JSAMPARRAY output_buf)); - + (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); diff --git a/jsimddct.h b/jsimddct.h index 928d6d33..aa421fb1 100644 --- a/jsimddct.h +++ b/jsimddct.h @@ -9,77 +9,66 @@ * */ -EXTERN(int) jsimd_can_convsamp JPP((void)); -EXTERN(int) jsimd_can_convsamp_float JPP((void)); +EXTERN(int) jsimd_can_convsamp (void); +EXTERN(int) jsimd_can_convsamp_float (void); -EXTERN(void) jsimd_convsamp JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - DCTELEM * workspace)); -EXTERN(void) jsimd_convsamp_float JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, + DCTELEM * workspace); +EXTERN(void) jsimd_convsamp_float (JSAMPARRAY sample_data, + JDIMENSION start_col, + FAST_FLOAT * workspace); -EXTERN(int) jsimd_can_fdct_islow JPP((void)); -EXTERN(int) jsimd_can_fdct_ifast JPP((void)); -EXTERN(int) jsimd_can_fdct_float JPP((void)); +EXTERN(int) jsimd_can_fdct_islow (void); +EXTERN(int) jsimd_can_fdct_ifast (void); +EXTERN(int) jsimd_can_fdct_float (void); -EXTERN(void) jsimd_fdct_islow JPP((DCTELEM * data)); -EXTERN(void) jsimd_fdct_ifast JPP((DCTELEM * data)); -EXTERN(void) jsimd_fdct_float JPP((FAST_FLOAT * data)); +EXTERN(void) jsimd_fdct_islow (DCTELEM * data); +EXTERN(void) jsimd_fdct_ifast (DCTELEM * data); +EXTERN(void) jsimd_fdct_float (FAST_FLOAT * data); -EXTERN(int) jsimd_can_quantize JPP((void)); -EXTERN(int) jsimd_can_quantize_float JPP((void)); +EXTERN(int) jsimd_can_quantize (void); +EXTERN(int) jsimd_can_quantize_float (void); -EXTERN(void) jsimd_quantize JPP((JCOEFPTR coef_block, - DCTELEM * divisors, - DCTELEM * workspace)); -EXTERN(void) jsimd_quantize_float JPP((JCOEFPTR coef_block, - FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors, + DCTELEM * workspace); +EXTERN(void) jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors, + FAST_FLOAT * workspace); -EXTERN(int) jsimd_can_idct_2x2 JPP((void)); -EXTERN(int) jsimd_can_idct_4x4 JPP((void)); -EXTERN(int) jsimd_can_idct_6x6 JPP((void)); -EXTERN(int) jsimd_can_idct_12x12 JPP((void)); +EXTERN(int) jsimd_can_idct_2x2 (void); +EXTERN(int) jsimd_can_idct_4x4 (void); +EXTERN(int) jsimd_can_idct_6x6 (void); +EXTERN(int) jsimd_can_idct_12x12 (void); -EXTERN(void) jsimd_idct_2x2 JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_4x4 JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_6x6 JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_12x12 JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_2x2 (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4 (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_6x6 (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_12x12 (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); -EXTERN(int) jsimd_can_idct_islow JPP((void)); -EXTERN(int) jsimd_can_idct_ifast JPP((void)); -EXTERN(int) jsimd_can_idct_float JPP((void)); - -EXTERN(void) jsimd_idct_islow JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_ifast JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_float JPP((j_decompress_ptr cinfo, - jpeg_component_info * compptr, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(int) jsimd_can_idct_islow (void); +EXTERN(int) jsimd_can_idct_ifast (void); +EXTERN(int) jsimd_can_idct_float (void); +EXTERN(void) jsimd_idct_islow (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_ifast (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_float (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); diff --git a/rdtarga.c b/rdtarga.c index e8bbaf64..38c85148 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -56,7 +56,7 @@ typedef struct _tga_source_struct { JDIMENSION current_row; /* Current logical row number to read */ /* Pointer to routine to extract next Targa pixel from input file */ - JMETHOD(void, read_pixel, (tga_source_ptr sinfo)); + void (*read_pixel) (tga_source_ptr sinfo); /* Result of read_pixel is delivered here: */ U_CHAR tga_pixel[4]; @@ -68,8 +68,7 @@ typedef struct _tga_source_struct { int dup_pixel_count; /* # of times to duplicate previous pixel */ /* This saves the correct pixel-row-expansion method for preload_image */ - JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, - cjpeg_source_ptr sinfo)); + JDIMENSION (*get_pixel_rows) (j_compress_ptr cinfo, cjpeg_source_ptr sinfo); } tga_source_struct; diff --git a/simd/jsimd.h b/simd/jsimd.h index 572da813..8cd4473e 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -22,751 +22,645 @@ #define JSIMD_MIPS_DSPR2 0x20 /* SIMD Ext: retrieve SIMD/CPU information */ -EXTERN(unsigned int) jpeg_simd_cpu_support JPP((void)); +EXTERN(unsigned int) jpeg_simd_cpu_support (void); -/* SIMD Color Space Conversion */ +/* RGB & extended RGB --> YCC Colorspace Conversion */ EXTERN(void) jsimd_rgb_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgb_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgbx_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgr_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgrx_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxbgr_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxrgb_ycc_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); - -EXTERN(void) jsimd_rgb_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgb_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgbx_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgr_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgrx_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxbgr_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxrgb_gray_convert_mmx - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); - -EXTERN(void) jsimd_ycc_rgb_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extrgb_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extrgbx_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extbgr_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extbgrx_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extxbgr_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); -EXTERN(void) jsimd_ycc_extxrgb_convert_mmx - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); extern const int jconst_rgb_ycc_convert_sse2[]; EXTERN(void) jsimd_rgb_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgb_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgbx_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgr_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgrx_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxbgr_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxrgb_ycc_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_neon + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_ycc_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* RGB & extended RGB --> Grayscale Colorspace Conversion */ +EXTERN(void) jsimd_rgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mmx + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); extern const int jconst_rgb_gray_convert_sse2[]; EXTERN(void) jsimd_rgb_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgb_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extrgbx_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgr_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extbgrx_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxbgr_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); EXTERN(void) jsimd_extxrgb_gray_convert_sse2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +EXTERN(void) jsimd_rgb_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgb_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extrgbx_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgr_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extbgrx_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxbgr_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); +EXTERN(void) jsimd_extxrgb_gray_convert_mips_dspr2 + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows); + +/* YCC --> RGB & extended RGB Colorspace Conversion */ +EXTERN(void) jsimd_ycc_rgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extrgbx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extbgrx_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxbgr_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_extxrgb_convert_mmx + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); extern const int jconst_ycc_rgb_convert_sse2[]; EXTERN(void) jsimd_ycc_rgb_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgb_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgbx_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgr_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgrx_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxbgr_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxrgb_convert_sse2 - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); - -EXTERN(void) jsimd_rgb_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgb_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgbx_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgr_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgrx_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxbgr_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxrgb_ycc_convert_neon - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_rgb_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgb_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgbx_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgr_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgrx_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxbgr_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxrgb_convert_neon - JPP((JDIMENSION out_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); -EXTERN(void) jsimd_rgb_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgb_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgbx_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgr_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgrx_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxbgr_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxrgb_ycc_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); - -EXTERN(void) jsimd_rgb_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgb_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extrgbx_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgr_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extbgrx_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxbgr_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); -EXTERN(void) jsimd_extxrgb_gray_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPARRAY input_buf, JSAMPIMAGE output_buf, - JDIMENSION output_row, int num_rows)); - -EXTERN (void) jsimd_ycc_rgb_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); +EXTERN(void) jsimd_ycc_rgb_convert_mips_dspr2 + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgb_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extrgbx_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgr_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extbgrx_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxbgr_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_extxrgb_convert_mips_dspr2 - JPP((JDIMENSION img_width, - JSAMPIMAGE input_buf, JDIMENSION input_row, - JSAMPARRAY output_buf, int num_rows)); + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +/* NULL Colorspace Conversion */ EXTERN(void) jsimd_c_null_convert_mips_dspr2 - JPP((JDIMENSION img_width, JSAMPARRAY input_buf, - JSAMPIMAGE output_buf, JDIMENSION output_row, - int num_rows, int num_components)); + (JDIMENSION img_width, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows, int num_components); -/* SIMD Downsample */ -EXTERN(void) jsimd_h2v2_downsample_mmx - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); +/* h2v1 Downsampling */ EXTERN(void) jsimd_h2v1_downsample_mmx - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_sse2 + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); + +EXTERN(void) jsimd_h2v1_downsample_mips_dspr2 + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Downsampling */ +EXTERN(void) jsimd_h2v2_downsample_mmx + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); EXTERN(void) jsimd_h2v2_downsample_sse2 - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); -EXTERN(void) jsimd_h2v1_downsample_sse2 - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); EXTERN(void) jsimd_h2v2_downsample_mips_dspr2 - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); + +/* h2v2 Smooth Downsampling */ EXTERN(void) jsimd_h2v2_smooth_downsample_mips_dspr2 - JPP((JSAMPARRAY input_data, JSAMPARRAY output_data, - JDIMENSION v_samp_factor, int max_v_samp_factor, - int smoothing_factor, JDIMENSION width_blocks, - JDIMENSION image_width)); -EXTERN(void) jsimd_h2v1_downsample_mips_dspr2 - JPP((JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data)); + (JDIMENSION image_width, int max_v_samp_factor, + JDIMENSION v_samp_factor, JDIMENSION width_blocks, + JSAMPARRAY input_data, JSAMPARRAY output_data); -/* SIMD Upsample */ -EXTERN(void) jsimd_h2v2_upsample_mmx - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +/* Upsampling */ EXTERN(void) jsimd_h2v1_upsample_mmx - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_mmx + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); -EXTERN(void) jsimd_h2v2_fancy_upsample_mmx - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); -EXTERN(void) jsimd_h2v1_fancy_upsample_mmx - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); - -EXTERN(void) jsimd_h2v2_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmx - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); - -EXTERN(void) jsimd_h2v2_upsample_sse2 - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); EXTERN(void) jsimd_h2v1_upsample_sse2 - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_sse2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); + +EXTERN(void) jsimd_h2v1_upsample_mips_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_h2v2_upsample_mips_dspr2 + (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); + +/* Fancy Upsampling */ +EXTERN(void) jsimd_h2v1_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_mmx + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); extern const int jconst_fancy_upsample_sse2[]; -EXTERN(void) jsimd_h2v2_fancy_upsample_sse2 - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); EXTERN(void) jsimd_h2v1_fancy_upsample_sse2 - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); - -extern const int jconst_merged_upsample_sse2[]; -EXTERN(void) jsimd_h2v2_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); -EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_sse2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)); + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_h2v2_fancy_upsample_sse2 + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(void) jsimd_h2v1_fancy_upsample_neon - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(void) jsimd_h2v1_fancy_upsample_mips_dspr2 - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(void) jsimd_h2v2_fancy_upsample_mips_dspr2 - JPP((int max_v_samp_factor, JDIMENSION downsampled_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + (int max_v_samp_factor, JDIMENSION downsampled_width, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); + +/* Merged Upsampling */ +EXTERN(void) jsimd_h2v1_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mmx + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); + +extern const int jconst_merged_upsample_sse2[]; +EXTERN(void) jsimd_h2v1_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v2_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); +EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_sse2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); + +EXTERN(void) jsimd_h2v1_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); +EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2 + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extrgb_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extrgbx_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extbgr_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extbgrx_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extxbgr_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); EXTERN(void) jsimd_h2v2_extxrgb_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extrgb_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extrgbx_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extbgr_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extbgrx_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extxbgr_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); -EXTERN(void) jsimd_h2v1_extxrgb_merged_upsample_mips_dspr2 - JPP((JDIMENSION output_width, JSAMPIMAGE input_buf, - JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, - JSAMPLE* range)); + (JDIMENSION output_width, JSAMPIMAGE input_buf, + JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf, JSAMPLE* range); -EXTERN(void) jsimd_h2v2_upsample_mips_dspr2 - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); -EXTERN(void) jsimd_h2v1_upsample_mips_dspr2 - JPP((int max_v_samp_factor, JDIMENSION output_width, - JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); +/* Sample Conversion */ +EXTERN(void) jsimd_convsamp_mmx + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace); -/* SIMD Sample Conversion */ -EXTERN(void) jsimd_convsamp_mmx JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace); -EXTERN(void) jsimd_convsamp_sse2 JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_neon + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace); -EXTERN(void) jsimd_convsamp_neon JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - DCTELEM * workspace)); +EXTERN(void) jsimd_convsamp_mips_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM * workspace); -EXTERN(void) jsimd_convsamp_mips_dspr2 JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - DCTELEM * workspace)); +/* Floating Point Sample Conversion */ +EXTERN(void) jsimd_convsamp_float_3dnow + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace); -EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp_float_sse + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace); -EXTERN(void) jsimd_convsamp_float_sse JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp_float_sse2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace); -EXTERN(void) jsimd_convsamp_float_sse2 JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_convsamp_float_mips_dspr2 + (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT * workspace); -EXTERN(void) jsimd_convsamp_float_mips_dspr2 JPP((JSAMPARRAY sample_data, - JDIMENSION start_col, - FAST_FLOAT * workspace)); +/* Slow Integer Forward DCT */ +EXTERN(void) jsimd_fdct_islow_mmx (DCTELEM * data); -/* SIMD Forward DCT */ -EXTERN(void) jsimd_fdct_islow_mmx JPP((DCTELEM * data)); -EXTERN(void) jsimd_fdct_ifast_mmx JPP((DCTELEM * data)); +extern const int jconst_fdct_islow_sse2[]; +EXTERN(void) jsimd_fdct_islow_sse2 (DCTELEM * data); + +EXTERN(void) jsimd_fdct_islow_mips_dspr2 (DCTELEM * data); + +/* Fast Integer Forward DCT */ +EXTERN(void) jsimd_fdct_ifast_mmx (DCTELEM * data); extern const int jconst_fdct_ifast_sse2[]; -EXTERN(void) jsimd_fdct_islow_sse2 JPP((DCTELEM * data)); -extern const int jconst_fdct_islow_sse2[]; -EXTERN(void) jsimd_fdct_ifast_sse2 JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_ifast_sse2 (DCTELEM * data); -EXTERN(void) jsimd_fdct_ifast_neon JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_ifast_neon (DCTELEM * data); -EXTERN(void) jsimd_fdct_islow_mips_dspr2 JPP((DCTELEM * data)); -EXTERN(void) jsimd_fdct_ifast_mips_dspr2 JPP((DCTELEM * data)); +EXTERN(void) jsimd_fdct_ifast_mips_dspr2 (DCTELEM * data); -EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data)); +/* Floating Point Forward DCT */ +EXTERN(void) jsimd_fdct_float_3dnow (FAST_FLOAT * data); extern const int jconst_fdct_float_sse[]; -EXTERN(void) jsimd_fdct_float_sse JPP((FAST_FLOAT * data)); +EXTERN(void) jsimd_fdct_float_sse (FAST_FLOAT * data); -/* SIMD Quantization */ -EXTERN(void) jsimd_quantize_mmx JPP((JCOEFPTR coef_block, - DCTELEM * divisors, - DCTELEM * workspace)); +/* Quantization */ +EXTERN(void) jsimd_quantize_mmx + (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace); -EXTERN(void) jsimd_quantize_sse2 JPP((JCOEFPTR coef_block, - DCTELEM * divisors, - DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_sse2 + (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace); -EXTERN(void) jsimd_quantize_neon JPP((JCOEFPTR coef_block, - DCTELEM * divisors, - DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_neon + (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace); -EXTERN(void) jsimd_quantize_mips_dspr2 JPP((JCOEFPTR coef_block, - DCTELEM * divisors, - DCTELEM * workspace)); +EXTERN(void) jsimd_quantize_mips_dspr2 + (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace); -EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block, - FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +/* Floating Point Quantization */ +EXTERN(void) jsimd_quantize_float_3dnow + (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace); -EXTERN(void) jsimd_quantize_float_sse JPP((JCOEFPTR coef_block, - FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize_float_sse + (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace); -EXTERN(void) jsimd_quantize_float_sse2 JPP((JCOEFPTR coef_block, - FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize_float_sse2 + (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace); -EXTERN(void) jsimd_quantize_float_mips_dspr2 JPP((JCOEFPTR coef_block, - FAST_FLOAT * divisors, - FAST_FLOAT * workspace)); +EXTERN(void) jsimd_quantize_float_mips_dspr2 + (JCOEFPTR coef_block, FAST_FLOAT * divisors, FAST_FLOAT * workspace); -/* SIMD Reduced Inverse DCT */ -EXTERN(void) jsimd_idct_2x2_mmx JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_4x4_mmx JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +/* Scaled Inverse DCT */ +EXTERN(void) jsimd_idct_2x2_mmx + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_mmx + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); extern const int jconst_idct_red_sse2[]; -EXTERN(void) jsimd_idct_2x2_sse2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_4x4_sse2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_2x2_sse2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_sse2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); -EXTERN(void) jsimd_idct_2x2_neon JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_4x4_neon JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_2x2_neon + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_neon + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); -EXTERN(void) jsimd_idct_2x2_mips_dspr2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_4x4_mips_dspr2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col, - int * workspace)); -EXTERN(void) jsimd_idct_6x6_mips_dspr2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_12x12_pass1_mips_dspr2 JPP((JCOEFPTR coef_block, - void * dct_table, - int * workspace)); -EXTERN(void) jsimd_idct_12x12_pass2_mips_dspr2 JPP((int * workspace, - int * output)); +EXTERN(void) jsimd_idct_2x2_mips_dspr2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_4x4_mips_dspr2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col, int * workspace); +EXTERN(void) jsimd_idct_6x6_mips_dspr2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); +EXTERN(void) jsimd_idct_12x12_pass1_mips_dspr2 + (JCOEFPTR coef_block, void * dct_table, int * workspace); +EXTERN(void) jsimd_idct_12x12_pass2_mips_dspr2 + (int * workspace, int * output); -/* SIMD Inverse DCT */ -EXTERN(void) jsimd_idct_islow_mmx JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_ifast_mmx JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +/* Slow Integer Inverse DCT */ +EXTERN(void) jsimd_idct_islow_mmx + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); extern const int jconst_idct_islow_sse2[]; -EXTERN(void) jsimd_idct_islow_sse2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_islow_sse2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_neon + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +EXTERN(void) jsimd_idct_islow_mips_dspr2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + +/* Fast Integer Inverse DCT */ +EXTERN(void) jsimd_idct_ifast_mmx + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); + extern const int jconst_idct_ifast_sse2[]; -EXTERN(void) jsimd_idct_ifast_sse2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_ifast_sse2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); -EXTERN(void) jsimd_idct_islow_neon JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); -EXTERN(void) jsimd_idct_ifast_neon JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_ifast_neon + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); -EXTERN(void) jsimd_idct_islow_mips_dspr2 JPP((void * dct_table, - JCOEFPTR coef_block, - int * output_buf, - JSAMPLE * output_col)); -EXTERN(void) jsimd_idct_ifast_cols_mips_dspr2 JPP((JCOEF * inptr, - IFAST_MULT_TYPE * quantptr, - DCTELEM * wsptr, - const int * idct_coefs)); -EXTERN(void) jsimd_idct_ifast_rows_mips_dspr2 JPP((DCTELEM * wsptr, - JSAMPARRAY output_buf, - JDIMENSION output_col, - const int * idct_coefs)); +EXTERN(void) jsimd_idct_ifast_cols_mips_dspr2 + (JCOEF * inptr, IFAST_MULT_TYPE * quantptr, DCTELEM * wsptr, + const int * idct_coefs); +EXTERN(void) jsimd_idct_ifast_rows_mips_dspr2 + (DCTELEM * wsptr, JSAMPARRAY output_buf, JDIMENSION output_col, + const int * idct_coefs); -EXTERN(void) jsimd_idct_float_3dnow JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +/* Floating Point Inverse DCT */ +EXTERN(void) jsimd_idct_float_3dnow + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); extern const int jconst_idct_float_sse[]; -EXTERN(void) jsimd_idct_float_sse JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); +EXTERN(void) jsimd_idct_float_sse + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); extern const int jconst_idct_float_sse2[]; -EXTERN(void) jsimd_idct_float_sse2 JPP((void * dct_table, - JCOEFPTR coef_block, - JSAMPARRAY output_buf, - JDIMENSION output_col)); - +EXTERN(void) jsimd_idct_float_sse2 + (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, + JDIMENSION output_col); diff --git a/transupp.h b/transupp.h index 19a7cffd..c5bfa91e 100644 --- a/transupp.h +++ b/transupp.h @@ -154,27 +154,24 @@ typedef struct { /* Parse a crop specification (written in X11 geometry style) */ EXTERN(boolean) jtransform_parse_crop_spec - JPP((jpeg_transform_info *info, const char *spec)); + (jpeg_transform_info *info, const char *spec); /* Request any required workspace */ EXTERN(boolean) jtransform_request_workspace - JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); + (j_decompress_ptr srcinfo, jpeg_transform_info *info); /* Adjust output image parameters */ EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); + (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info); /* Execute the actual transformation, if any */ EXTERN(void) jtransform_execute_transform - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - jvirt_barray_ptr *src_coef_arrays, - jpeg_transform_info *info)); + (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, jpeg_transform_info *info); /* Determine whether lossless transformation is perfectly * possible for a specified image and transformation. */ EXTERN(boolean) jtransform_perfect_transform - JPP((JDIMENSION image_width, JDIMENSION image_height, - int MCU_width, int MCU_height, - JXFORM_CODE transform)); + (JDIMENSION image_width, JDIMENSION image_height, int MCU_width, + int MCU_height, JXFORM_CODE transform); /* jtransform_execute_transform used to be called * jtransform_execute_transformation, but some compilers complain about @@ -200,8 +197,8 @@ typedef enum { /* Setup decompression object to save desired markers in memory */ EXTERN(void) jcopy_markers_setup - JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); + (j_decompress_ptr srcinfo, JCOPY_OPTION option); /* Copy markers saved in the given source object to the destination object */ EXTERN(void) jcopy_markers_execute - JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JCOPY_OPTION option)); + (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + JCOPY_OPTION option); diff --git a/turbojpeg.c b/turbojpeg.c index 648744cb..6e86e26e 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1311,8 +1311,8 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; unsigned char *_dstBuf=NULL; int _pitch=0; #endif - JMETHOD(int, old_read_markers, (j_decompress_ptr)); - JMETHOD(void, old_reset_marker_reader, (j_decompress_ptr)); + int (*old_read_markers)(j_decompress_ptr); + void (*old_reset_marker_reader)(j_decompress_ptr); getdinstance(handle); diff --git a/win/jconfig.h.in b/win/jconfig.h.in index f87bef55..6865fafe 100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@ -7,7 +7,6 @@ #cmakedefine D_ARITH_CODING_SUPPORTED #cmakedefine MEM_SRCDST_SUPPORTED -#define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ diff --git a/wrbmp.c b/wrbmp.c index d769404f..a82824dc 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -60,8 +60,8 @@ typedef bmp_dest_struct * bmp_dest_ptr; /* Forward declarations */ LOCAL(void) write_colormap - JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest, - int map_colors, int map_entry_size)); + (j_decompress_ptr cinfo, bmp_dest_ptr dest, int map_colors, + int map_entry_size); /* diff --git a/wrrle.c b/wrrle.c index 4fdf372a..fbc2fb07 100644 --- a/wrrle.c +++ b/wrrle.c @@ -63,8 +63,8 @@ typedef rle_dest_struct * rle_dest_ptr; /* Forward declarations */ METHODDEF(void) rle_put_pixel_rows - JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, - JDIMENSION rows_supplied)); + (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied); /* From 44e609fa3a5959a487a52c827a81a79d5f9edbef Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 17:52:06 +0000 Subject: [PATCH 928/985] Further copyright header cleanup --- jcsample.c | 3 ++- jdhuff.h | 2 +- jmorecfg.h | 2 +- jpeglib.h | 2 +- jversion.h | 2 +- libjpeg.txt | 2 +- structure.txt | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/jcsample.c b/jcsample.c index 4bc2b23e..de7f3477 100644 --- a/jcsample.c +++ b/jcsample.c @@ -1,9 +1,10 @@ /* * jcsample.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. + * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB - * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains downsampling routines. diff --git a/jdhuff.h b/jdhuff.h index 788f36dc..f2805e46 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -3,7 +3,7 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * Modifications: + * libjpeg-turbo Modifications: * Copyright (C) 2010-2011, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jmorecfg.h b/jmorecfg.h index 11307b43..47767578 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -3,7 +3,7 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * Modifications: + * libjpeg-turbo Modifications: * Copyright (C) 2009, 2011, 2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jpeglib.h b/jpeglib.h index 437d65ed..484c78a9 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1998, Thomas G. Lane. * Modified 2002-2009 by Guido Vollbeding. - * Modifications: + * libjpeg-turbo Modifications: * Copyright (C) 2009-2011, 2013-2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jversion.h b/jversion.h index 5ddadc81..7ab28870 100644 --- a/jversion.h +++ b/jversion.h @@ -3,7 +3,7 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. - * Modifications: + * libjpeg-turbo Modifications: * Copyright (C) 2010, 2012-2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * diff --git a/libjpeg.txt b/libjpeg.txt index 73c5e1d7..84965fca 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -2,7 +2,7 @@ USING THE IJG JPEG LIBRARY This file was part of the Independent JPEG Group's software: Copyright (C) 1994-2011, Thomas G. Lane, Guido Vollbeding. -Modifications: +libjpeg-turbo Modifications: Copyright (C) 2010, 2014, D. R. Commander. For conditions of distribution and use, see the accompanying README file. diff --git a/structure.txt b/structure.txt index 21bbc7a0..60457845 100644 --- a/structure.txt +++ b/structure.txt @@ -1,7 +1,7 @@ IJG JPEG LIBRARY: SYSTEM ARCHITECTURE +This file was part of the Independent JPEG Group's software: Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding. -This file was part of the Independent JPEG Group's software. It was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo. For conditions of distribution and use, see the accompanying README file. From 814fb5628257fe23486064129790f70bda1d2515 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 18:17:01 +0000 Subject: [PATCH 929/985] Further copyright header cleanup --- wrbmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrbmp.c b/wrbmp.c index a82824dc..0949dd77 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -1,9 +1,9 @@ /* * wrbmp.c * - * This file was part of the Independent JPEG Group's software. + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. - * Modifications: + * libjpeg-turbo Modifications: * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * From 144e7b79e4566419bfd49fc05e47b9278dba8ae3 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 18:33:44 +0000 Subject: [PATCH 930/985] Remove MS-DOS code and information, and adjust copyright headers to reflect the removal of features in r1307 and r1308. libjpeg-turbo has never supported MS-DOS, nor is it even possible for us to do so. --- ChangeLog.txt | 5 ++++ cdjpeg.c | 44 +++---------------------------- cdjpeg.h | 4 ++- cjpeg.c | 5 ---- coderules.txt | 4 +-- djpeg.c | 5 ---- jcapimin.c | 4 ++- jccoefct.c | 19 +++++++------- jchuff.h | 4 ++- jcmainct.c | 4 ++- jconfig.txt | 18 +++---------- jcphuff.c | 4 ++- jctrans.c | 6 +++-- jdcoefct.c | 5 +--- jdct.h | 4 ++- jdmarker.c | 12 ++++----- jdmaster.c | 4 --- jdphuff.c | 4 ++- jdpostct.c | 4 ++- jdtrans.c | 4 ++- jerror.c | 4 ++- jmemmgr.c | 35 ++++++++++++------------- jmemnobs.c | 13 +++++----- jmemsys.h | 28 ++++++++++---------- jmorecfg.h | 16 ------------ jpegint.h | 6 +++-- jpeglib.h | 16 +++++------- jpegtran.c | 7 ----- jquant1.c | 21 ++++++--------- jquant2.c | 28 +++++++++----------- jutils.c | 63 ++++++--------------------------------------- libjpeg.txt | 62 -------------------------------------------- rdppm.c | 21 +++++---------- rdrle.c | 7 ++--- rdtarga.c | 4 ++- simd/jsimdcfg.inc.h | 4 +-- structure.txt | 58 ++++++----------------------------------- transupp.c | 12 +-------- transupp.h | 4 ++- wrppm.c | 14 ++++------ wrrle.c | 7 ++--- wrtarga.c | 15 +++-------- 42 files changed, 177 insertions(+), 431 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e59939f7..c8476df6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -65,6 +65,11 @@ slower. [8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows for decompressing JPEG images into RGB565 (16-bit) pixels. +[9] Numerous obsolete features, such as support for compilers that can't +handle prototypes and support for the MS-DOS memory model, were removed from +the libjpeg code, greatly improving its readability and making it easier to +maintain and extend. + 1.3.1 ===== diff --git a/cdjpeg.c b/cdjpeg.c index 17f1de7d..7cc0d6e8 100644 --- a/cdjpeg.c +++ b/cdjpeg.c @@ -1,8 +1,10 @@ /* * cdjpeg.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains common support routines used by the IJG application @@ -11,9 +13,6 @@ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include /* to declare isupper(), tolower() */ -#ifdef NEED_SIGNAL_CATCHER -#include /* to declare signal() */ -#endif #ifdef USE_SETMODE #include /* to declare setmode()'s parameter macros */ /* If you have setmode() but not , just delete this line: */ @@ -21,43 +20,6 @@ #endif -/* - * Signal catcher to ensure that temporary files are removed before aborting. - * NB: for Amiga Manx C this is actually a global routine named _abort(); - * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... - */ - -#ifdef NEED_SIGNAL_CATCHER - -static j_common_ptr sig_cinfo; - -void /* must be global for Manx C */ -signal_catcher (int signum) -{ - if (sig_cinfo != NULL) { - if (sig_cinfo->err != NULL) /* turn off trace output */ - sig_cinfo->err->trace_level = 0; - jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ - } - exit(EXIT_FAILURE); -} - - -GLOBAL(void) -enable_signal_catcher (j_common_ptr cinfo) -{ - sig_cinfo = cinfo; -#ifdef SIGINT /* not all systems have SIGINT */ - signal(SIGINT, signal_catcher); -#endif -#ifdef SIGTERM /* not all systems have SIGTERM */ - signal(SIGTERM, signal_catcher); -#endif -} - -#endif - - /* * Optional progress monitor: display a percent-done figure on stderr. */ diff --git a/cdjpeg.h b/cdjpeg.h index 400cb691..c633f3f8 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -1,8 +1,10 @@ /* * cdjpeg.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains common declarations for the sample applications diff --git a/cjpeg.c b/cjpeg.c index 4429c49d..a7d25047 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -510,11 +510,6 @@ main (int argc, char **argv) jerr.first_addon_message = JMSG_FIRSTADDONCODE; jerr.last_addon_message = JMSG_LASTADDONCODE; - /* Now safe to enable signal catcher. */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &cinfo); -#endif - /* Initialize JPEG parameters. * Much of this may be overridden later. * In particular, we don't yet know the input file's color space, diff --git a/coderules.txt b/coderules.txt index f36d5f89..c87e6d2b 100644 --- a/coderules.txt +++ b/coderules.txt @@ -1,9 +1,7 @@ - - IJG JPEG LIBRARY: CODING RULES +This file was part of the Independent JPEG Group's software: Copyright (C) 1991-1996, Thomas G. Lane. -This file was part of the Independent JPEG Group's software. It was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo. For conditions of distribution and use, see the accompanying README file. diff --git a/djpeg.c b/djpeg.c index 9b95e3cd..7c63f250 100644 --- a/djpeg.c +++ b/djpeg.c @@ -495,11 +495,6 @@ main (int argc, char **argv) jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker); jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker); - /* Now safe to enable signal catcher. */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &cinfo); -#endif - /* Scan command line to find file names. */ /* It is convenient to use just one switch-parsing routine, but the switch * values read here are ignored; we will rescan the switches after opening diff --git a/jcapimin.c b/jcapimin.c index cbd9bd27..60f57372 100644 --- a/jcapimin.c +++ b/jcapimin.c @@ -1,9 +1,11 @@ /* * jcapimin.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1998, Thomas G. Lane. * Modified 2003-2010 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the compression half diff --git a/jccoefct.c b/jccoefct.c index faca94e0..d17b75c1 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -1,8 +1,10 @@ /* * jccoefct.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains the coefficient buffer controller for compression. @@ -42,11 +44,8 @@ typedef struct { /* For single-pass compression, it's sufficient to buffer just one MCU * (although this may prove a bit slow in practice). We allocate a * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each - * MCU constructed and sent. (On 80x86, the workspace is FAR even though - * it's not really very big; this is to keep the module interfaces unchanged - * when a large coefficient buffer is necessary.) - * In multi-pass modes, this array points to the current MCU's blocks - * within the virtual arrays. + * MCU constructed and sent. In multi-pass modes, this array points to the + * current MCU's blocks within the virtual arrays. */ JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; @@ -180,7 +179,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) ypos, xpos, (JDIMENSION) blockcnt); if (blockcnt < compptr->MCU_width) { /* Create some dummy blocks at the right edge of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], + jzero_far((void *) coef->MCU_buffer[blkn + blockcnt], (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); for (bi = blockcnt; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; @@ -188,7 +187,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) } } else { /* Create a row of dummy blocks at the bottom of the image. */ - jzero_far((void FAR *) coef->MCU_buffer[blkn], + jzero_far((void *) coef->MCU_buffer[blkn], compptr->MCU_width * SIZEOF(JBLOCK)); for (bi = 0; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; @@ -286,7 +285,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) if (ndummy > 0) { /* Create dummy blocks at the right edge of the image. */ thisblockrow += blocks_across; /* => first dummy block */ - jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); + jzero_far((void *) thisblockrow, ndummy * SIZEOF(JBLOCK)); lastDC = thisblockrow[-1][0]; for (bi = 0; bi < ndummy; bi++) { thisblockrow[bi][0] = lastDC; @@ -305,7 +304,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) block_row++) { thisblockrow = buffer[block_row]; lastblockrow = buffer[block_row-1]; - jzero_far((void FAR *) thisblockrow, + jzero_far((void *) thisblockrow, (size_t) (blocks_across * SIZEOF(JBLOCK))); for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { lastDC = lastblockrow[h_samp_factor-1][0]; diff --git a/jchuff.h b/jchuff.h index c247e6f2..d49a992b 100644 --- a/jchuff.h +++ b/jchuff.h @@ -1,8 +1,10 @@ /* * jchuff.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains declarations for Huffman entropy encoding routines diff --git a/jcmainct.c b/jcmainct.c index 62f13c98..20ef398b 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -1,8 +1,10 @@ /* * jcmainct.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains the main buffer controller for compression. diff --git a/jconfig.txt b/jconfig.txt index bf89a836..8acd8dd8 100644 --- a/jconfig.txt +++ b/jconfig.txt @@ -1,8 +1,10 @@ /* * jconfig.txt * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1994, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file documents the configuration options that are required to @@ -64,14 +66,6 @@ */ #undef NEED_SYS_TYPES_H -/* For 80x86 machines, you need to define NEED_FAR_POINTERS, - * unless you are using a large-data memory model or 80386 flat-memory mode. - * On less brain-damaged CPUs this symbol must not be defined. - * (Defining this symbol causes large data structures to be referenced through - * "far" pointers and to be allocated with a special version of malloc.) - */ -#undef NEED_FAR_POINTERS - /* Although a real ANSI C compiler can deal perfectly well with pointers to * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, @@ -133,12 +127,6 @@ typedef unsigned char boolean; */ #undef TWO_FILE_COMMANDLINE -/* Define this if your system needs explicit cleanup of temporary files. - * This is crucial under MS-DOS, where the temporary "files" may be areas - * of extended memory; on most other systems it's not as important. - */ -#undef NEED_SIGNAL_CATCHER - /* By default, we open image files with fopen(...,"rb") or fopen(...,"wb"). * This is necessary on systems that distinguish text files from binary files, * and is harmless on most systems that don't. If you have one of the rare diff --git a/jcphuff.c b/jcphuff.c index a95e94c7..85d89047 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -1,8 +1,10 @@ /* * jcphuff.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines for progressive JPEG. diff --git a/jctrans.c b/jctrans.c index 62d43962..85725a92 100644 --- a/jctrans.c +++ b/jctrans.c @@ -1,9 +1,11 @@ /* * jctrans.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-1998, Thomas G. Lane. * Modified 2000-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains library routines for transcoding compression, @@ -392,7 +394,7 @@ transencode_coef_controller (j_compress_ptr cinfo, buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->dummy_buffer[i] = buffer + i; } diff --git a/jdcoefct.c b/jdcoefct.c index 775bcdf4..c1a168a2 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -42,9 +42,6 @@ typedef struct { /* In single-pass modes, it's sufficient to buffer just one MCU. * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, * and let the entropy decoder write into that workspace each time. - * (On 80x86, the workspace is FAR even though it's not really very big; - * this is to keep the module interfaces unchanged when a large coefficient - * buffer is necessary.) * In multi-pass modes, this array points to the current MCU's blocks * within the virtual arrays; it is used only by the input side. */ @@ -168,7 +165,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; MCU_col_num++) { /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ - jzero_far((void FAR *) coef->MCU_buffer[0], + jzero_far((void *) coef->MCU_buffer[0], (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ diff --git a/jdct.h b/jdct.h index 0c70c5b9..c06bf9dc 100644 --- a/jdct.h +++ b/jdct.h @@ -1,8 +1,10 @@ /* * jdct.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This include file contains common declarations for the forward and diff --git a/jdmarker.c b/jdmarker.c index d996f6b3..fbcf554c 100644 --- a/jdmarker.c +++ b/jdmarker.c @@ -597,7 +597,7 @@ get_dri (j_decompress_ptr cinfo) LOCAL(void) -examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, +examine_app0 (j_decompress_ptr cinfo, JOCTET * data, unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP0. * Take appropriate action if it is a JFIF marker. @@ -673,7 +673,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, LOCAL(void) -examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, +examine_app14 (j_decompress_ptr cinfo, JOCTET * data, unsigned int datalen, INT32 remaining) /* Examine first few bytes from an APP14. * Take appropriate action if it is an Adobe marker. @@ -729,10 +729,10 @@ get_interesting_appn (j_decompress_ptr cinfo) /* process it */ switch (cinfo->unread_marker) { case M_APP0: - examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length); + examine_app0(cinfo, (JOCTET *) b, numtoread, length); break; case M_APP14: - examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length); + examine_app14(cinfo, (JOCTET *) b, numtoread, length); break; default: /* can't get here unless jpeg_save_markers chooses wrong processor */ @@ -758,7 +758,7 @@ save_marker (j_decompress_ptr cinfo) my_marker_ptr marker = (my_marker_ptr) cinfo->marker; jpeg_saved_marker_ptr cur_marker = marker->cur_marker; unsigned int bytes_read, data_length; - JOCTET FAR * data; + JOCTET * data; INT32 length = 0; INPUT_VARS(cinfo); @@ -784,7 +784,7 @@ save_marker (j_decompress_ptr cinfo) cur_marker->original_length = (unsigned int) length; cur_marker->data_length = limit; /* data area is just beyond the jpeg_marker_struct */ - data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1); + data = cur_marker->data = (JOCTET *) (cur_marker + 1); marker->cur_marker = cur_marker; marker->bytes_read = 0; bytes_read = 0; diff --git a/jdmaster.c b/jdmaster.c index 30be6cf4..e1f02907 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -7,7 +7,6 @@ * libjpeg-turbo Modifications: * Copyright (C) 2009-2011, D. R. Commander. * Copyright (C) 2013, Linaro Limited. - * For conditions of distribution and use, see the accompanying README file. * * This file contains master control logic for the JPEG decompressor. @@ -419,9 +418,6 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) * We can save some space by overlapping the start of the post-IDCT table * with the simpler range limiting table. The post-IDCT table begins at * sample_range_limit + CENTERJSAMPLE. - * - * Note that the table is allocated in near data space on PCs; it's small - * enough and used often enough to justify this. */ LOCAL(void) diff --git a/jdphuff.c b/jdphuff.c index cd8f0b28..e52aa7b9 100644 --- a/jdphuff.c +++ b/jdphuff.c @@ -1,8 +1,10 @@ /* * jdphuff.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy decoding routines for progressive JPEG. diff --git a/jdpostct.c b/jdpostct.c index 2e8f28c7..38438316 100644 --- a/jdpostct.c +++ b/jdpostct.c @@ -1,8 +1,10 @@ /* * jdpostct.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains the decompression postprocessing controller. diff --git a/jdtrans.c b/jdtrans.c index 85b60b89..86fda3b8 100644 --- a/jdtrans.c +++ b/jdtrans.c @@ -1,8 +1,10 @@ /* * jdtrans.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains library routines for transcoding decompression, diff --git a/jerror.c b/jerror.c index ca4f3a52..cd3098da 100644 --- a/jerror.c +++ b/jerror.c @@ -1,8 +1,10 @@ /* * jerror.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains simple error-reporting and trace-message routines. diff --git a/jmemmgr.c b/jmemmgr.c index 8e33318f..c721c46f 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -1,8 +1,10 @@ /* * jmemmgr.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains the JPEG system-independent memory management @@ -91,8 +93,7 @@ round_up_pow2 (size_t a, size_t b) * request to jpeg_get_small() or jpeg_get_large(). There is no per-object * overhead within a pool, except for alignment padding. Each pool has a * header with a link to the next pool of the same class. - * Small and large pool headers are identical except that the latter's - * link pointer must be FAR on 80x86 machines. + * Small and large pool headers are identical. */ typedef struct small_pool_struct * small_pool_ptr; @@ -103,7 +104,7 @@ typedef struct small_pool_struct { size_t bytes_left; /* bytes still available in this pool */ } small_pool_hdr; -typedef struct large_pool_struct FAR * large_pool_ptr; +typedef struct large_pool_struct * large_pool_ptr; typedef struct large_pool_struct { large_pool_ptr next; /* next in list of pools */ @@ -339,9 +340,8 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* * Allocation of "large" objects. * - * The external semantics of these are the same as "small" objects, - * except that FAR pointers are used on 80x86. However the pool - * management heuristics are quite different. We assume that each + * The external semantics of these are the same as "small" objects. However, + * the pool management heuristics are quite different. We assume that each * request is large enough that it may as well be passed directly to * jpeg_get_large; the pool management just links everything together * so that we can free it all on demand. @@ -350,13 +350,13 @@ 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 *) alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Allocate a "large" object */ { my_mem_ptr mem = (my_mem_ptr) cinfo->mem; large_pool_ptr hdr_ptr; - char FAR * data_ptr; + char * data_ptr; /* * Round up the requested size to a multiple of ALIGN_SIZE so that @@ -394,13 +394,12 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */ data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE; - return (void FAR *) data_ptr; + return (void *) data_ptr; } /* * Creation of 2-D sample arrays. - * The pointers are in near heap, the samples themselves in FAR heap. * * To minimize allocation overhead and to allow I/O of large contiguous * blocks, we allocate the sample rows in groups of as many rows as possible @@ -741,11 +740,11 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], + (void *) ptr->mem_buffer[i], file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], + (void *) ptr->mem_buffer[i], file_offset, byte_count); file_offset += byte_count; } @@ -774,11 +773,11 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) byte_count = rows * bytesperrow; if (writing) (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], + (void *) ptr->mem_buffer[i], file_offset, byte_count); else (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, - (void FAR *) ptr->mem_buffer[i], + (void *) ptr->mem_buffer[i], file_offset, byte_count); file_offset += byte_count; } @@ -854,7 +853,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow); undef_row++; } } else { @@ -939,7 +938,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { - jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + jzero_far((void *) ptr->mem_buffer[undef_row], bytesperrow); undef_row++; } } else { @@ -1005,7 +1004,7 @@ free_pool (j_common_ptr cinfo, int pool_id) space_freed = lhdr_ptr->bytes_used + lhdr_ptr->bytes_left + SIZEOF(large_pool_hdr); - jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); + jpeg_free_large(cinfo, (void *) lhdr_ptr, space_freed); mem->total_space_allocated -= space_freed; lhdr_ptr = next_lhdr_ptr; } diff --git a/jmemnobs.c b/jmemnobs.c index e81b0165..62828327 100644 --- a/jmemnobs.c +++ b/jmemnobs.c @@ -1,8 +1,10 @@ /* * jmemnobs.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1992-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file provides a really simple implementation of the system- @@ -46,19 +48,16 @@ jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) /* * "Large" objects are treated the same as "small" ones. - * NB: although we include FAR keywords in the routine declarations, - * this file won't actually work in 80x86 small/medium model; at least, - * you probably won't be able to process useful-size images in only 64KB. */ -GLOBAL(void FAR *) +GLOBAL(void *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { - return (void FAR *) malloc(sizeofobject); + return (void *) malloc(sizeofobject); } GLOBAL(void) -jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) +jpeg_free_large (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); } diff --git a/jmemsys.h b/jmemsys.h index b32f80cd..5026c7c7 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -1,8 +1,10 @@ /* * jmemsys.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1992-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This include file defines the interface between the system-independent @@ -14,8 +16,7 @@ * in the IJG distribution. You may need to modify it if you write a * custom memory manager. If system-dependent changes are needed in * this file, the best method is to #ifdef them based on a configuration - * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR - * and USE_MAC_MEMMGR. + * symbol supplied in jconfig.h. */ @@ -27,7 +28,6 @@ * and free; in particular, jpeg_get_small must return NULL on failure. * On most systems, these ARE malloc and free. jpeg_free_small is passed the * size of the object being freed, just in case it's needed. - * On an 80x86 machine using small-data memory model, these manage near heap. */ EXTERN(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject); @@ -37,23 +37,21 @@ EXTERN(void) jpeg_free_small (j_common_ptr cinfo, void * object, /* * These two functions are used to allocate and release large chunks of * memory (up to the total free space designated by jpeg_mem_available). - * The interface is the same as above, except that on an 80x86 machine, - * far pointers are used. On most other machines these are identical to - * the jpeg_get/free_small routines; but we keep them separate anyway, - * in case a different allocation strategy is desirable for large chunks. + * These are identical to the jpeg_get/free_small routines; but we keep them + * separate anyway, in case a different allocation strategy is desirable for + * large chunks. */ -EXTERN(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject); -EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, +EXTERN(void *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject); +EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void * object, size_t sizeofobject); /* * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may * be requested in a single call to jpeg_get_large (and jpeg_get_small for that - * matter, but that case should never come into play). This macro is needed + * matter, but that case should never come into play). This macro was needed * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. - * On those machines, we expect that jconfig.h will provide a proper value. - * On machines with 32-bit flat address spaces, any large constant may be used. + * On machines with flat address spaces, any large constant may be used. * * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type * size_t and will be a multiple of sizeof(align_type). @@ -123,10 +121,10 @@ typedef struct backing_store_struct * backing_store_ptr; typedef struct backing_store_struct { /* Methods for reading/writing/closing this backing-store object */ void (*read_backing_store) (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, long file_offset, + void * buffer_address, long file_offset, long byte_count); void (*write_backing_store) (j_common_ptr cinfo, backing_store_ptr info, - void FAR * buffer_address, long file_offset, + void * buffer_address, long file_offset, long byte_count); void (*close_backing_store) (j_common_ptr cinfo, backing_store_ptr info); diff --git a/jmorecfg.h b/jmorecfg.h index 47767578..91fbd15f 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -192,22 +192,6 @@ typedef unsigned int JDIMENSION; #define EXTERN(type) extern type -/* Here is the pseudo-keyword for declaring pointers that must be "far" - * on 80x86 machines. Most of the specialized coding for 80x86 is handled - * by just saying "FAR *" where such a pointer is needed. In a few places - * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. - */ - -#ifdef NEED_FAR_POINTERS -#ifndef FAR -#define FAR far -#endif -#else -#undef FAR -#define FAR -#endif - - /* * On a few systems, type boolean and/or its values FALSE, TRUE may appear * in standard header files. Or you may have conflicts with application- diff --git a/jpegint.h b/jpegint.h index 51c11c31..025accd9 100644 --- a/jpegint.h +++ b/jpegint.h @@ -1,9 +1,11 @@ /* * jpegint.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * Modified 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file provides common declarations for the various JPEG modules. @@ -325,7 +327,7 @@ EXTERN(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, int num_rows, JDIMENSION num_cols); EXTERN(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks); -EXTERN(void) jzero_far (void FAR * target, size_t bytestozero); +EXTERN(void) jzero_far (void * target, size_t bytestozero); /* Constant tables in jutils.c */ #if 0 /* This table is not actually needed in v6a */ extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ diff --git a/jpeglib.h b/jpeglib.h index 484c78a9..27045a42 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -62,20 +62,18 @@ extern "C" { /* 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. */ -typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */ typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ -typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */ typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ -typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ +typedef JCOEF *JCOEFPTR; /* useful in a couple of places */ /* Types for JPEG compression parameters and working tables. */ @@ -198,14 +196,14 @@ typedef struct { /* The decompressor can save APPn and COM markers in a list of these: */ -typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; +typedef struct jpeg_marker_struct * jpeg_saved_marker_ptr; struct jpeg_marker_struct { jpeg_saved_marker_ptr next; /* next in list, or NULL */ UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ unsigned int original_length; /* # bytes of data in the file */ unsigned int data_length; /* # bytes of data saved at data[] */ - JOCTET FAR * data; /* the data contained in the marker */ + JOCTET * data; /* the data contained in the marker */ /* the marker length word is not counted in data_length or original_length */ }; @@ -833,8 +831,8 @@ typedef struct jvirt_barray_control * jvirt_barray_ptr; struct jpeg_memory_mgr { /* Method pointers */ void * (*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject); - void FAR * (*alloc_large) (j_common_ptr cinfo, int pool_id, - size_t sizeofobject); + void * (*alloc_large) (j_common_ptr cinfo, int pool_id, + size_t sizeofobject); JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow, JDIMENSION numrows); JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id, diff --git a/jpegtran.c b/jpegtran.c index c7906f4d..6b40de39 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -395,13 +395,6 @@ main (int argc, char **argv) dstinfo.err = jpeg_std_error(&jdsterr); jpeg_create_compress(&dstinfo); - /* Now safe to enable signal catcher. - * Note: we assume only the decompression object will have virtual arrays. - */ -#ifdef NEED_SIGNAL_CATCHER - enable_signal_catcher((j_common_ptr) &srcinfo); -#endif - /* Scan command line to find file names. * It is convenient to use just one switch-parsing routine, but the switch * values read here are mostly ignored; we will rescan the switches after diff --git a/jquant1.c b/jquant1.c index dbcdd277..2fd3037b 100644 --- a/jquant1.c +++ b/jquant1.c @@ -121,9 +121,6 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { * The fserrors[] array is indexed [component#][position]. * We provide (#columns + 2) entries per component; the extra entry at each * end saves us from special-casing the first and last pixels. - * - * Note: on a wide image, we might not have enough room in a PC's near data - * segment to hold the error array; so it is allocated with alloc_large. */ #if BITS_IN_JSAMPLE == 8 @@ -134,7 +131,7 @@ typedef INT32 FSERROR; /* may need more than 16 bits */ typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif -typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ +typedef FSERROR *FSERRPTR; /* pointer to error array */ /* Private subobject */ @@ -535,8 +532,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ - jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); + jzero_far((void *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); row_index = cquantize->row_index; for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; @@ -640,8 +636,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ - jzero_far((void FAR *) output_buf[row], - (size_t) (width * SIZEOF(JSAMPLE))); + jzero_far((void *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; output_ptr = output_buf[row]; @@ -786,7 +781,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) /* Initialize the propagated errors to zero. */ arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); for (i = 0; i < cinfo->out_color_components; i++) - jzero_far((void FAR *) cquantize->fserrors[i], arraysize); + jzero_far((void *) cquantize->fserrors[i], arraysize); break; default: ERREXIT(cinfo, JERR_NOT_COMPILED); @@ -849,10 +844,10 @@ jinit_1pass_quantizer (j_decompress_ptr cinfo) create_colorindex(cinfo); /* Allocate Floyd-Steinberg workspace now if requested. - * We do this now since it is FAR storage and may affect the memory - * manager's space calculations. If the user changes to FS dither - * mode in a later pass, we will allocate the space then, and will - * possibly overrun the max_memory_to_use setting. + * We do this now since it may affect the memory manager's space + * calculations. If the user changes to FS dither mode in a later pass, we + * will allocate the space then, and will possibly overrun the + * max_memory_to_use setting. */ if (cinfo->dither_mode == JDITHER_FS) alloc_fs_workspace(cinfo); diff --git a/jquant2.c b/jquant2.c index 0fdb1975..a9c78454 100644 --- a/jquant2.c +++ b/jquant2.c @@ -102,9 +102,7 @@ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE}; * machines, we can't just allocate the histogram in one chunk. Instead * of a true 3-D array, we use a row of pointers to 2-D arrays. Each * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and - * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that - * on 80x86 machines, the pointer row is in near memory but the actual - * arrays are in far memory (same arrangement as we use for image arrays). + * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. */ #define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ @@ -129,10 +127,10 @@ static const int c_scales[3]={R_SCALE, G_SCALE, B_SCALE}; typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */ -typedef histcell FAR * histptr; /* for pointers to histogram cells */ +typedef histcell * histptr; /* for pointers to histogram cells */ typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */ -typedef hist1d FAR * hist2d; /* type for the 2nd-level pointers */ +typedef hist1d * hist2d; /* type for the 2nd-level pointers */ typedef hist2d * hist3d; /* type for top-level pointer */ @@ -155,9 +153,6 @@ typedef hist2d * hist3d; /* type for top-level pointer */ * The fserrors[] array has (#columns + 2) entries; the extra entry at * each end saves us from special-casing the first and last pixels. * Each entry is three values long, one value for each color component. - * - * Note: on a wide image, we might not have enough room in a PC's near data - * segment to hold the error array; so it is allocated with alloc_large. */ #if BITS_IN_JSAMPLE == 8 @@ -168,7 +163,7 @@ typedef INT32 FSERROR; /* may need more than 16 bits */ typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif -typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ +typedef FSERROR *FSERRPTR; /* pointer to error array */ /* Private subobject */ @@ -1178,7 +1173,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); /* Initialize the propagated errors to zero. */ - jzero_far((void FAR *) cquantize->fserrors, arraysize); + jzero_far((void *) cquantize->fserrors, arraysize); /* Make the error-limit table if we didn't already. */ if (cquantize->error_limiter == NULL) init_error_limit(cinfo); @@ -1189,7 +1184,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) /* Zero the histogram or inverse color map, if necessary */ if (cquantize->needs_zeroed) { for (i = 0; i < HIST_C0_ELEMS; i++) { - jzero_far((void FAR *) histogram[i], + jzero_far((void *) histogram[i], HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); } cquantize->needs_zeroed = FALSE; @@ -1245,8 +1240,8 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) cquantize->needs_zeroed = TRUE; /* histogram is garbage now */ /* Allocate storage for the completed colormap, if required. - * We do this now since it is FAR storage and may affect - * the memory manager's space calculations. + * We do this now since it may affect the memory manager's space + * calculations. */ if (cinfo->enable_2pass_quant) { /* Make sure color count is acceptable */ @@ -1269,9 +1264,10 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) cinfo->dither_mode = JDITHER_FS; /* Allocate Floyd-Steinberg workspace if necessary. - * This isn't really needed until pass 2, but again it is FAR storage. - * Although we will cope with a later change in dither_mode, - * we do not promise to honor max_memory_to_use if dither_mode changes. + * This isn't really needed until pass 2, but again it may affect the memory + * manager's space calculations. Although we will cope with a later change + * in dither_mode, we do not promise to honor max_memory_to_use if + * dither_mode changes. */ if (cinfo->dither_mode == JDITHER_FS) { cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) diff --git a/jutils.c b/jutils.c index b9997a39..7955d23c 100644 --- a/jutils.c +++ b/jutils.c @@ -1,8 +1,10 @@ /* * jutils.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code + * relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains tables and miscellaneous utility routines needed @@ -87,26 +89,6 @@ jround_up (long a, long b) } -/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays - * and coefficient-block arrays. This won't work on 80x86 because the arrays - * are FAR and we're assuming a small-pointer memory model. However, some - * DOS compilers provide far-pointer versions of memcpy() and memset() even - * in the small-model libraries. These will be used if USE_FMEM is defined. - * Otherwise, the routines below do it the hard way. (The performance cost - * is not all that great, because these routines aren't very heavily used.) - */ - -#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ -#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) -#define FMEMZERO(target,size) MEMZERO(target,size) -#else /* 80x86 case, define if we can */ -#ifdef USE_FMEM -#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) -#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) -#endif -#endif - - GLOBAL(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, @@ -118,11 +100,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, */ { register JSAMPROW inptr, outptr; -#ifdef FMEMCOPY register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); -#else - register JDIMENSION count; -#endif register int row; input_array += source_row; @@ -131,12 +109,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, for (row = num_rows; row > 0; row--) { inptr = *input_array++; outptr = *output_array++; -#ifdef FMEMCOPY - FMEMCOPY(outptr, inptr, count); -#else - for (count = num_cols; count > 0; count--) - *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ -#endif + MEMCOPY(outptr, inptr, count); } } @@ -146,34 +119,14 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks) /* Copy a row of coefficient blocks from one place to another. */ { -#ifdef FMEMCOPY - FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); -#else - register JCOEFPTR inptr, outptr; - register long count; - - inptr = (JCOEFPTR) input_row; - outptr = (JCOEFPTR) output_row; - for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) { - *outptr++ = *inptr++; - } -#endif + MEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); } GLOBAL(void) -jzero_far (void FAR * target, size_t bytestozero) -/* Zero out a chunk of FAR memory. */ +jzero_far (void * target, size_t bytestozero) +/* Zero out a chunk of memory. */ /* This might be sample-array data, block-array data, or alloc_large data. */ { -#ifdef FMEMZERO - FMEMZERO(target, bytestozero); -#else - register char FAR * ptr = (char FAR *) target; - register size_t count; - - for (count = bytestozero; count > 0; count--) { - *ptr++ = 0; - } -#endif + MEMZERO(target, bytestozero); } diff --git a/libjpeg.txt b/libjpeg.txt index 84965fca..edc61b71 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -52,7 +52,6 @@ Advanced features: Memory usage Library compile-time options Portability considerations - Notes for MS-DOS implementors You should read at least the overview and basic usage sections before trying to program with the library. The sections on advanced features can be read @@ -764,12 +763,6 @@ compatible across versions; we only try to ensure source-code compatibility. applications and introduce a ton of access functions instead. Too late now, however.) -On some systems your application may need to set up a signal handler to ensure -that temporary files are deleted if the program is interrupted. This is most -critical if you are on MS-DOS and use the jmemdos.c memory manager back end; -it will try to grab extended memory for temp files, and that space will NOT be -freed automatically. See cjpeg.c or djpeg.c for an example signal handler. - It may be worth pointing out that the core JPEG library does not actually require the stdio library: only the default source/destination managers and error handler need it. You can use the library in a stdio-less environment @@ -2877,18 +2870,6 @@ that space allocated with alloc_small() is ignored, on the assumption that it's too small to be worth worrying about; so a reasonable safety margin should be left when setting max_memory_to_use. -If you use the jmemname.c or jmemdos.c memory manager back end, it is -important to clean up the JPEG object properly to ensure that the temporary -files get deleted. (This is especially crucial with jmemdos.c, where the -"temporary files" may be extended-memory segments; if they are not freed, -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 or jmemmac.c either, -since the C library is supposed to take care of deleting files made with -tmpfile(). - Memory usage ------------ @@ -3033,46 +3014,3 @@ replacing that one file. More info about porting the code may be gleaned by reading jconfig.txt, jmorecfg.h, and jinclude.h. - - -Notes for MS-DOS implementors ------------------------------ - -The IJG code is designed to work efficiently in 80x86 "small" or "medium" -memory models (i.e., data pointers are 16 bits unless explicitly declared -"far"; code pointers can be either size). You may be able to use small -model to compile cjpeg or djpeg by itself, but you will probably have to use -medium model for any larger application. This won't make much difference in -performance. You *will* take a noticeable performance hit if you use a -large-data memory model (perhaps 10%-25%), and you should avoid "huge" model -if at all possible. - -The JPEG library typically needs 2Kb-3Kb of stack space. It will also -malloc about 20K-30K of near heap space while executing (and lots of far -heap, but that doesn't count in this calculation). This figure will vary -depending on selected operating mode, and to a lesser extent on image size. -There is also about 5Kb-6Kb of constant data which will be allocated in the -near data segment (about 4Kb of this is the error message table). -Thus you have perhaps 20K available for other modules' static data and near -heap space before you need to go to a larger memory model. The C library's -static data will account for several K of this, but that still leaves a good -deal for your needs. (If you are tight on space, you could reduce the sizes -of the I/O buffers allocated by jdatasrc.c and jdatadst.c, say from 4K to -1K. Another possibility is to move the error message table to far memory; -this should be doable with only localized hacking on jerror.c.) - -About 2K of the near heap space is "permanent" memory that will not be -released until you destroy the JPEG object. This is only an issue if you -save a JPEG object between compression or decompression operations. - -Far data space may also be a tight resource when you are dealing with large -images. The most memory-intensive case is decompression with two-pass color -quantization, or single-pass quantization to an externally supplied color -map. This requires a 128Kb color lookup table plus strip buffers amounting -to about 40 bytes per column for typical sampling ratios (eg, about 25600 -bytes for a 640-pixel-wide image). You may not be able to process wide -images if you have large data structures of your own. - -Of course, all of these concerns vanish if you use a 32-bit flat-memory-model -compiler, such as DJGPP or Watcom C. We highly recommend flat model if you -can use it; the JPEG library is significantly faster in flat model. diff --git a/rdppm.c b/rdppm.c index c55ab2b6..0bc6d35a 100644 --- a/rdppm.c +++ b/rdppm.c @@ -1,9 +1,11 @@ /* * rdppm.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * Modified 2009 by Bill Allombert, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to read input images in PPM/PGM format. @@ -56,24 +58,14 @@ typedef char U_CHAR; #define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) -/* - * On most systems, reading individual bytes with getc() is drastically less - * efficient than buffering a row at a time with fread(). On PCs, we must - * allocate the buffer in near data space, because we are assuming small-data - * memory model, wherein fread() can't reach far memory. If you need to - * process very wide images on a PC, you might have to compile in large-memory - * model, or else replace fread() with a getc() loop --- which will be much - * slower. - */ - - /* Private version of data source object */ typedef struct { struct cjpeg_source_struct pub; /* public fields */ - U_CHAR *iobuffer; /* non-FAR pointer to I/O buffer */ - JSAMPROW pixrow; /* FAR pointer to same */ + /* Usually these two pointers point to the same place: */ + U_CHAR *iobuffer; /* fread's I/O buffer */ + JSAMPROW pixrow; /* compressor input buffer */ size_t buffer_width; /* width of I/O buffer */ JSAMPLE *rescale; /* => maxval-remapping array, or NULL */ } ppm_source_struct; @@ -396,7 +388,6 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) if (use_raw_buffer) { /* For unscaled raw-input case, we can just map it onto the I/O buffer. */ /* Synthesize a JSAMPARRAY pointer structure */ - /* Cast here implies near->far pointer conversion on PCs */ source->pixrow = (JSAMPROW) source->iobuffer; source->pub.buffer = & source->pixrow; source->pub.buffer_height = 1; diff --git a/rdrle.c b/rdrle.c index f8b3587f..a82cc3a3 100644 --- a/rdrle.c +++ b/rdrle.c @@ -1,8 +1,10 @@ /* * rdrle.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only information + * relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to read input images in Utah RLE format. @@ -254,8 +256,7 @@ load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) rle_row = source->rle_row; /* Read the RLE data into our virtual array. - * We assume here that (a) rle_pixel is represented the same as JSAMPLE, - * and (b) we are not on a machine where FAR pointers differ from regular. + * We assume here that rle_pixel is represented the same as JSAMPLE. */ RLE_CLR_BIT(source->header, RLE_ALPHA); /* don't read the alpha channel */ diff --git a/rdtarga.c b/rdtarga.c index 38c85148..3f35d3d4 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -1,8 +1,10 @@ /* * rdtarga.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to read input images in Targa format. diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h index a3450aa4..d2b499fa 100644 --- a/simd/jsimdcfg.inc.h +++ b/simd/jsimdcfg.inc.h @@ -84,10 +84,10 @@ %define JDIMENSION dword ; unsigned int %define SIZEOF_JDIMENSION SIZEOF_DWORD ; sizeof(JDIMENSION) -%define JSAMPROW POINTER ; JSAMPLE FAR * (jpeglib.h) +%define JSAMPROW POINTER ; JSAMPLE * (jpeglib.h) %define JSAMPARRAY POINTER ; JSAMPROW * (jpeglib.h) %define JSAMPIMAGE POINTER ; JSAMPARRAY * (jpeglib.h) -%define JCOEFPTR POINTER ; JCOEF FAR * (jpeglib.h) +%define JCOEFPTR POINTER ; JCOEF * (jpeglib.h) %define SIZEOF_JSAMPROW SIZEOF_POINTER ; sizeof(JSAMPROW) %define SIZEOF_JSAMPARRAY SIZEOF_POINTER ; sizeof(JSAMPARRAY) %define SIZEOF_JSAMPIMAGE SIZEOF_POINTER ; sizeof(JSAMPIMAGE) diff --git a/structure.txt b/structure.txt index 60457845..4c9fe398 100644 --- a/structure.txt +++ b/structure.txt @@ -84,36 +84,6 @@ low-quality modes may not meet the JPEG standard's accuracy requirements; nonetheless, they are useful for viewers. -*** Portability issues *** - -Portability is an essential requirement for the library. The key portability -issues that show up at the level of system architecture are: - -1. Memory usage. We want the code to be able to run on PC-class machines -with limited memory. Images should therefore be processed sequentially (in -strips), to avoid holding the whole image in memory at once. Where a -full-image buffer is necessary, we should be able to use either virtual memory -or temporary files. - -2. Near/far pointer distinction. To run efficiently on 80x86 machines, the -code should distinguish "small" objects (kept in near data space) from -"large" ones (kept in far data space). This is an annoying restriction, but -fortunately it does not impact code quality for less brain-damaged machines, -and the source code clutter turns out to be minimal with sufficient use of -pointer typedefs. - -3. Data precision. We assume that "char" is at least 8 bits, "short" and -"int" at least 16, "long" at least 32. The code will work fine with larger -data sizes, although memory may be used inefficiently in some cases. However, -the JPEG compressed datastream must ultimately appear on external storage as a -sequence of 8-bit bytes if it is to conform to the standard. This may pose a -problem on machines where char is wider than 8 bits. The library represents -compressed data as an array of values of typedef JOCTET. If no data type -exactly 8 bits wide is available, custom data source and data destination -modules must be written to unpack and pack the chosen JOCTET datatype into -8-bit external representation. - - *** System overview *** The compressor and decompressor are each divided into two main sections: @@ -661,17 +631,6 @@ 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 samples, and for the same reasons. -On machines where malloc() can't handle a request bigger than 64Kb, this data -structure limits us to rows of less than 512 JBLOCKs, or a picture width of -4000+ pixels. This seems an acceptable restriction. - - -On 80x86 machines, the bottom-level pointer types (JSAMPROW and JBLOCKROW) -must be declared as "far" pointers, but the upper levels can be "near" -(implying that the pointer lists are allocated in the DS segment). -We use a #define symbol FAR, which expands to the "far" keyword when -compiling on 80x86 machines and to nothing elsewhere. - *** Suspendable processing *** @@ -773,12 +732,11 @@ The memory manager deals with three kinds of object: 1. "Small" objects. Typically these require no more than 10K-20K total. 2. "Large" objects. These may require tens to hundreds of K depending on image size. Semantically they behave the same as small objects, but we - distinguish them for two reasons: - * On MS-DOS machines, large objects are referenced by FAR pointers, - small objects by NEAR pointers. - * Pool allocation heuristics may differ for large and small objects. - Note that individual "large" objects cannot exceed the size allowed by - type size_t, which may be 64K or less on some machines. + distinguish them because pool allocation heuristics may differ for large and + small objects (historically, large objects were also referenced by far + pointers on MS-DOS machines.) Note that individual "large" objects cannot + exceed the size allowed by type size_t, which may be 64K or less on some + machines. 3. "Virtual" objects. These are large 2-D arrays of JSAMPLEs or JBLOCKs (typically large enough for the entire image being processed). The memory manager provides stripwise access to these arrays. On machines @@ -862,9 +820,9 @@ jpeg_mem_init, jpeg_mem_term system-dependent initialization/shutdown jpeg_get_small, jpeg_free_small interface to malloc and free library routines (or their equivalents) -jpeg_get_large, jpeg_free_large interface to FAR malloc/free in MSDOS machines; - else usually the same as - jpeg_get_small/jpeg_free_small +jpeg_get_large, jpeg_free_large historically was used to interface with + FAR malloc/free on MS-DOS machines; now the + same as jpeg_get_small/jpeg_free_small jpeg_mem_available estimate available memory diff --git a/transupp.c b/transupp.c index 72ef8d81..20c8d594 100644 --- a/transupp.c +++ b/transupp.c @@ -1178,7 +1178,7 @@ transpose_critical_parameters (j_compress_ptr dstinfo) #if JPEG_LIB_VERSION >= 70 LOCAL(void) -adjust_exif_parameters (JOCTET FAR * data, unsigned int length, +adjust_exif_parameters (JOCTET * data, unsigned int length, JDIMENSION new_width, JDIMENSION new_height) { boolean is_motorola; /* Flag for byte order */ @@ -1614,17 +1614,7 @@ jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, GETJOCTET(marker->data[3]) == 0x62 && GETJOCTET(marker->data[4]) == 0x65) continue; /* reject duplicate Adobe */ -#ifdef NEED_FAR_POINTERS - /* We could use jpeg_write_marker if the data weren't FAR... */ - { - unsigned int i; - jpeg_write_m_header(dstinfo, marker->marker, marker->data_length); - for (i = 0; i < marker->data_length; i++) - jpeg_write_m_byte(dstinfo, marker->data[i]); - } -#else jpeg_write_marker(dstinfo, marker->marker, marker->data, marker->data_length); -#endif } } diff --git a/transupp.h b/transupp.h index c5bfa91e..8fe90710 100644 --- a/transupp.h +++ b/transupp.h @@ -1,8 +1,10 @@ /* * transupp.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains declarations for image transformation routines and diff --git a/wrppm.c b/wrppm.c index 6b7ebf42..6acf2043 100644 --- a/wrppm.c +++ b/wrppm.c @@ -1,9 +1,11 @@ /* * wrppm.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. * Modified 2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only information + * relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in PPM/PGM format. @@ -55,12 +57,7 @@ /* * When JSAMPLE is the same size as char, we can just fwrite() the - * decompressed data to the PPM or PGM file. On PCs, in order to make this - * work the output buffer must be allocated in near data space, because we are - * assuming small-data memory model wherein fwrite() can't reach far memory. - * If you need to process very wide images on a PC, you might have to compile - * in large-memory model, or else replace fwrite() with a putc() loop --- - * which will be much slower. + * decompressed data to the PPM or PGM file. */ @@ -231,7 +228,7 @@ jinit_write_ppm (j_decompress_ptr cinfo) /* Calculate output image dimensions so we can allocate space */ jpeg_calc_output_dimensions(cinfo); - /* Create physical I/O buffer. Note we make this near on a PC. */ + /* Create physical I/O buffer */ dest->samples_per_row = cinfo->output_width * cinfo->out_color_components; dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char)); dest->iobuffer = (char *) (*cinfo->mem->alloc_small) @@ -256,7 +253,6 @@ jinit_write_ppm (j_decompress_ptr cinfo) } else { /* We will fwrite() directly from decompressor output buffer. */ /* Synthesize a JSAMPARRAY pointer structure */ - /* Cast here implies near->far pointer conversion on PCs */ dest->pixrow = (JSAMPROW) dest->iobuffer; dest->pub.buffer = & dest->pixrow; dest->pub.buffer_height = 1; diff --git a/wrrle.c b/wrrle.c index fbc2fb07..7560d161 100644 --- a/wrrle.c +++ b/wrrle.c @@ -1,8 +1,10 @@ /* * wrrle.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in RLE format. @@ -207,8 +209,7 @@ finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) rle_put_setup(&header); /* Now output the RLE data from our virtual array. - * We assume here that (a) rle_pixel is represented the same as JSAMPLE, - * and (b) we are not on a machine where FAR pointers differ from regular. + * We assume here that rle_pixel is represented the same as JSAMPLE. */ #ifdef PROGRESS_REPORT diff --git a/wrtarga.c b/wrtarga.c index ffdce631..0ee26b5c 100644 --- a/wrtarga.c +++ b/wrtarga.c @@ -1,8 +1,10 @@ /* * wrtarga.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only information + * relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in Targa format. @@ -28,15 +30,6 @@ Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */ #endif -/* - * The output buffer needs to be writable by fwrite(). On PCs, we must - * allocate the buffer in near data space, because we are assuming small-data - * memory model, wherein fwrite() can't reach far memory. If you need to - * process very wide images on a PC, you might have to compile in large-memory - * model, or else replace fwrite() with a putc() loop --- which will be much - * slower. - */ - /* Private version of data destination object */ @@ -236,7 +229,7 @@ jinit_write_targa (j_decompress_ptr cinfo) /* Calculate output image dimensions so we can allocate space */ jpeg_calc_output_dimensions(cinfo); - /* Create I/O buffer. Note we make this near on a PC. */ + /* Create I/O buffer. */ dest->buffer_width = cinfo->output_width * cinfo->output_components; dest->iobuffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, From 46611eb0ee9670871c2e2850db5481bb2e26f667 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 19:04:03 +0000 Subject: [PATCH 931/985] libjpeg-turbo has never supported non-ANSI compilers, so get rid of the crufty SIZEOF() macro. It was not being used consistently anyhow, so it would not have been possible to build prior releases of libjpeg-turbo using the broken compilers for which that macro was designed. --- coderules.txt | 5 ---- jcapimin.c | 6 ++--- jcarith.c | 6 +++-- jccoefct.c | 12 ++++----- jccolor.c | 4 +-- jcdctmgr.c | 12 ++++----- jchuff.c | 24 ++++++++--------- jcmainct.c | 2 +- jcmarker.c | 2 +- jcmaster.c | 2 +- jcomapi.c | 10 ++++--- jcparam.c | 4 +-- jcphuff.c | 10 +++---- jcprepct.c | 10 ++++--- jcsample.c | 2 +- jctrans.c | 8 +++--- jdapimin.c | 10 ++++--- jdarith.c | 8 +++--- jdatadst-tj.c | 2 +- jdatadst.c | 6 ++--- jdatasrc-tj.c | 2 +- jdatasrc.c | 6 ++--- jdcoefct.c | 10 +++---- jdcolor.c | 12 ++++----- jddctmgr.c | 6 ++--- jdhuff.c | 4 +-- jdinput.c | 6 ++--- jdmainct.c | 6 ++--- jdmarker.c | 14 +++++----- jdmaster.c | 10 +++---- jdmerge.c | 12 ++++----- jdphuff.c | 4 +-- jdpostct.c | 2 +- jdsample.c | 2 +- jinclude.h | 14 +++------- jmemmgr.c | 74 +++++++++++++++++++++++++-------------------------- jquant1.c | 12 ++++----- jquant2.c | 16 +++++------ jstdhuff.c | 4 +-- jutils.c | 4 +-- rdbmp.c | 2 +- rdppm.c | 10 +++---- rdrle.c | 6 ++--- rdswitch.c | 4 +-- rdtarga.c | 2 +- transupp.c | 2 +- turbojpeg.c | 2 +- wrbmp.c | 10 +++---- wrgif.c | 6 +++-- wrppm.c | 10 +++---- wrrle.c | 4 +-- wrtarga.c | 10 +++---- 52 files changed, 216 insertions(+), 217 deletions(-) diff --git a/coderules.txt b/coderules.txt index c87e6d2b..8683e9a6 100644 --- a/coderules.txt +++ b/coderules.txt @@ -45,11 +45,6 @@ keywords can be inserted for use in Windows DLLs.) A similar solution is used for external function declarations (see the EXTERN macro.) -It seems there are some non-ANSI compilers in which the sizeof() operator -is defined to return int, yet size_t is defined as long. Needless to say, -this is brain-damaged. Always use the SIZEOF() macro in place of sizeof(), -so that the result is guaranteed to be of type size_t. - The JPEG library is intended to be used within larger programs. Furthermore, we want it to be reentrant so that it can be used by applications that process diff --git a/jcapimin.c b/jcapimin.c index 60f57372..3b005d3f 100644 --- a/jcapimin.c +++ b/jcapimin.c @@ -38,9 +38,9 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) 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)) + if (structsize != sizeof(struct jpeg_compress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, - (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); + (int) sizeof(struct jpeg_compress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set @@ -51,7 +51,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) { struct jpeg_error_mgr * err = cinfo->err; void * client_data = cinfo->client_data; /* ignore Purify complaint here */ - MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); + MEMZERO(cinfo, sizeof(struct jpeg_compress_struct)); cinfo->err = err; cinfo->client_data = client_data; } diff --git a/jcarith.c b/jcarith.c index e8bb281c..71a84ddb 100644 --- a/jcarith.c +++ b/jcarith.c @@ -1,8 +1,10 @@ /* * jcarith.c * + * This file was part of the Independent JPEG Group's software: * Developed 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains portable arithmetic entropy encoding routines for JPEG @@ -909,7 +911,7 @@ jinit_arith_encoder (j_compress_ptr cinfo) entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(arith_entropy_encoder)); + sizeof(arith_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass; entropy->pub.finish_pass = finish_pass; diff --git a/jccoefct.c b/jccoefct.c index d17b75c1..a4acce5c 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -180,7 +180,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) if (blockcnt < compptr->MCU_width) { /* Create some dummy blocks at the right edge of the image. */ jzero_far((void *) coef->MCU_buffer[blkn + blockcnt], - (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); + (compptr->MCU_width - blockcnt) * sizeof(JBLOCK)); for (bi = blockcnt; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; } @@ -188,7 +188,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) } else { /* Create a row of dummy blocks at the bottom of the image. */ jzero_far((void *) coef->MCU_buffer[blkn], - compptr->MCU_width * SIZEOF(JBLOCK)); + compptr->MCU_width * sizeof(JBLOCK)); for (bi = 0; bi < compptr->MCU_width; bi++) { coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; } @@ -285,7 +285,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) if (ndummy > 0) { /* Create dummy blocks at the right edge of the image. */ thisblockrow += blocks_across; /* => first dummy block */ - jzero_far((void *) thisblockrow, ndummy * SIZEOF(JBLOCK)); + jzero_far((void *) thisblockrow, ndummy * sizeof(JBLOCK)); lastDC = thisblockrow[-1][0]; for (bi = 0; bi < ndummy; bi++) { thisblockrow[bi][0] = lastDC; @@ -305,7 +305,7 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) thisblockrow = buffer[block_row]; lastblockrow = buffer[block_row-1]; jzero_far((void *) thisblockrow, - (size_t) (blocks_across * SIZEOF(JBLOCK))); + (size_t) (blocks_across * sizeof(JBLOCK))); for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { lastDC = lastblockrow[h_samp_factor-1][0]; for (bi = 0; bi < h_samp_factor; bi++) { @@ -407,7 +407,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + sizeof(my_coef_controller)); cinfo->coef = (struct jpeg_c_coef_controller *) coef; coef->pub.start_pass = start_pass_coef; @@ -439,7 +439,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } diff --git a/jccolor.c b/jccolor.c index f32dcfa1..0af12248 100644 --- a/jccolor.c +++ b/jccolor.c @@ -202,7 +202,7 @@ rgb_ycc_start (j_compress_ptr cinfo) /* Allocate and fill in the conversion tables. */ cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(INT32))); + (TABLE_SIZE * sizeof(INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; @@ -507,7 +507,7 @@ jinit_color_converter (j_compress_ptr cinfo) cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_converter)); + sizeof(my_color_converter)); cinfo->cconvert = (struct jpeg_color_converter *) cconvert; /* set start_pass to null method until we find out differently */ cconvert->pub.start_pass = null_method; diff --git a/jcdctmgr.c b/jcdctmgr.c index 3066d52e..2d256590 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -234,7 +234,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); + (DCTSIZE2 * 4) * sizeof(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { @@ -270,7 +270,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (DCTSIZE2 * 4) * SIZEOF(DCTELEM)); + (DCTSIZE2 * 4) * sizeof(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { @@ -305,7 +305,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->float_divisors[qtblno] == NULL) { fdct->float_divisors[qtblno] = (FAST_FLOAT *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - DCTSIZE2 * SIZEOF(FAST_FLOAT)); + DCTSIZE2 * sizeof(FAST_FLOAT)); } fdtbl = fdct->float_divisors[qtblno]; i = 0; @@ -546,7 +546,7 @@ jinit_forward_dct (j_compress_ptr cinfo) fdct = (my_fdct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_fdct_controller)); + sizeof(my_fdct_controller)); cinfo->fdct = (struct jpeg_forward_dct *) fdct; fdct->pub.start_pass = start_pass_fdctmgr; @@ -625,12 +625,12 @@ jinit_forward_dct (j_compress_ptr cinfo) if (cinfo->dct_method == JDCT_FLOAT) fdct->float_workspace = (FAST_FLOAT *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(FAST_FLOAT) * DCTSIZE2); + sizeof(FAST_FLOAT) * DCTSIZE2); else #endif fdct->workspace = (DCTELEM *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(DCTELEM) * DCTSIZE2); + sizeof(DCTELEM) * DCTSIZE2); /* Mark divisor tables unallocated */ for (i = 0; i < NUM_QUANT_TBLS; i++) { diff --git a/jchuff.c b/jchuff.c index e316f730..5f6288aa 100644 --- a/jchuff.c +++ b/jchuff.c @@ -174,13 +174,13 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) if (entropy->dc_count_ptrs[dctbl] == NULL) entropy->dc_count_ptrs[dctbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long)); + 257 * sizeof(long)); + MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * sizeof(long)); if (entropy->ac_count_ptrs[actbl] == NULL) entropy->ac_count_ptrs[actbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long)); + 257 * sizeof(long)); + MEMZERO(entropy->ac_count_ptrs[actbl], 257 * sizeof(long)); #endif } else { /* Compute derived values for Huffman tables */ @@ -238,7 +238,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, if (*pdtbl == NULL) *pdtbl = (c_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(c_derived_tbl)); + sizeof(c_derived_tbl)); dtbl = *pdtbl; /* Figure C.1: make table of Huffman code length for each symbol */ @@ -281,7 +281,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, * this lets us detect duplicate VAL entries here, and later * allows emit_bits to detect any attempt to emit such symbols. */ - MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi)); + MEMZERO(dtbl->ehufsi, sizeof(dtbl->ehufsi)); /* This is also a convenient place to check for out-of-range * and duplicated VAL entries. We allow 0..255 for AC symbols @@ -847,8 +847,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) /* This algorithm is explained in section K.2 of the JPEG standard */ - MEMZERO(bits, SIZEOF(bits)); - MEMZERO(codesize, SIZEOF(codesize)); + MEMZERO(bits, sizeof(bits)); + MEMZERO(codesize, sizeof(codesize)); for (i = 0; i < 257; i++) others[i] = -1; /* init links to empty */ @@ -950,7 +950,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) bits[i]--; /* Return final symbol counts (only for lengths 0..16) */ - MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); + MEMCOPY(htbl->bits, bits, sizeof(htbl->bits)); /* Return a list of the symbols sorted by code length */ /* It's not real clear to me why we don't need to consider the codelength @@ -988,8 +988,8 @@ finish_pass_gather (j_compress_ptr cinfo) /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ - MEMZERO(did_dc, SIZEOF(did_dc)); - MEMZERO(did_ac, SIZEOF(did_ac)); + MEMZERO(did_dc, sizeof(did_dc)); + MEMZERO(did_ac, sizeof(did_ac)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; @@ -1028,7 +1028,7 @@ jinit_huff_encoder (j_compress_ptr cinfo) entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_encoder)); + sizeof(huff_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass_huff; diff --git a/jcmainct.c b/jcmainct.c index 20ef398b..fc4014b1 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -252,7 +252,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); + sizeof(my_main_controller)); cinfo->main = (struct jpeg_c_main_controller *) main_ptr; main_ptr->pub.start_pass = start_pass_main; diff --git a/jcmarker.c b/jcmarker.c index 62aeb59e..aac7dbd8 100644 --- a/jcmarker.c +++ b/jcmarker.c @@ -649,7 +649,7 @@ jinit_marker_writer (j_compress_ptr cinfo) /* Create the subobject */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_marker_writer)); + sizeof(my_marker_writer)); cinfo->marker = (struct jpeg_marker_writer *) marker; /* Initialize method pointers */ marker->pub.write_file_header = write_file_header; diff --git a/jcmaster.c b/jcmaster.c index cf51c1ea..ea13d0d5 100644 --- a/jcmaster.c +++ b/jcmaster.c @@ -581,7 +581,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_comp_master)); + sizeof(my_comp_master)); cinfo->master = (struct jpeg_comp_master *) master; master->pub.prepare_for_pass = prepare_for_pass; master->pub.pass_startup = pass_startup; diff --git a/jcomapi.c b/jcomapi.c index 4ca20428..d8f396d1 100644 --- a/jcomapi.c +++ b/jcomapi.c @@ -1,8 +1,10 @@ /* * jcomapi.c * - * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1997, Thomas G. Lane.0 + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface routines that are used for both @@ -88,7 +90,7 @@ jpeg_alloc_quant_table (j_common_ptr cinfo) JQUANT_TBL *tbl; tbl = (JQUANT_TBL *) - (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); + (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL)); tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } @@ -100,7 +102,7 @@ jpeg_alloc_huff_table (j_common_ptr cinfo) JHUFF_TBL *tbl; tbl = (JHUFF_TBL *) - (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); + (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL)); tbl->sent_table = FALSE; /* make sure this is false in any new table */ return tbl; } diff --git a/jcparam.c b/jcparam.c index ba81108c..3194c9df 100644 --- a/jcparam.c +++ b/jcparam.c @@ -192,7 +192,7 @@ jpeg_set_defaults (j_compress_ptr cinfo) if (cinfo->comp_info == NULL) cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - MAX_COMPONENTS * SIZEOF(jpeg_component_info)); + MAX_COMPONENTS * sizeof(jpeg_component_info)); /* Initialize everything not dependent on the color space */ @@ -498,7 +498,7 @@ jpeg_simple_progression (j_compress_ptr cinfo) cinfo->script_space_size = MAX(nscans, 10); cinfo->script_space = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - cinfo->script_space_size * SIZEOF(jpeg_scan_info)); + cinfo->script_space_size * sizeof(jpeg_scan_info)); } scanptr = cinfo->script_space; cinfo->scan_info = scanptr; diff --git a/jcphuff.c b/jcphuff.c index 85d89047..5ce12b57 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -134,7 +134,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) if (entropy->bit_buffer == NULL) entropy->bit_buffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - MAX_CORR_BITS * SIZEOF(char)); + MAX_CORR_BITS * sizeof(char)); } } if (gather_statistics) @@ -167,8 +167,8 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) if (entropy->count_ptrs[tbl] == NULL) entropy->count_ptrs[tbl] = (long *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 257 * SIZEOF(long)); - MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long)); + 257 * sizeof(long)); + MEMZERO(entropy->count_ptrs[tbl], 257 * sizeof(long)); } else { /* Compute derived values for Huffman table */ /* We may do this more than once for a table, but it's not expensive */ @@ -781,7 +781,7 @@ finish_pass_gather_phuff (j_compress_ptr cinfo) /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ - MEMZERO(did, SIZEOF(did)); + MEMZERO(did, sizeof(did)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; @@ -818,7 +818,7 @@ jinit_phuff_encoder (j_compress_ptr cinfo) entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_encoder)); + sizeof(phuff_entropy_encoder)); cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; entropy->pub.start_pass = start_pass_phuff; diff --git a/jcprepct.c b/jcprepct.c index 785ff887..3470de08 100644 --- a/jcprepct.c +++ b/jcprepct.c @@ -1,8 +1,10 @@ /* * jcprepct.c * + * This file is part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains the compression preprocessing controller. @@ -278,7 +280,7 @@ create_context_buffer (j_compress_ptr cinfo) fake_buffer = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (cinfo->num_components * 5 * rgroup_height) * - SIZEOF(JSAMPROW)); + sizeof(JSAMPROW)); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { @@ -293,7 +295,7 @@ create_context_buffer (j_compress_ptr cinfo) (JDIMENSION) (3 * rgroup_height)); /* Copy true buffer row pointers into the middle of the fake row array */ MEMCOPY(fake_buffer + rgroup_height, true_buffer, - 3 * rgroup_height * SIZEOF(JSAMPROW)); + 3 * rgroup_height * sizeof(JSAMPROW)); /* Fill in the above and below wraparound pointers */ for (i = 0; i < rgroup_height; i++) { fake_buffer[i] = true_buffer[2 * rgroup_height + i]; @@ -323,7 +325,7 @@ jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) prep = (my_prep_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_prep_controller)); + sizeof(my_prep_controller)); cinfo->prep = (struct jpeg_c_prep_controller *) prep; prep->pub.start_pass = start_pass_prep; diff --git a/jcsample.c b/jcsample.c index de7f3477..d8c376b6 100644 --- a/jcsample.c +++ b/jcsample.c @@ -474,7 +474,7 @@ jinit_downsampler (j_compress_ptr cinfo) downsample = (my_downsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_downsampler)); + sizeof(my_downsampler)); cinfo->downsample = (struct jpeg_downsampler *) downsample; downsample->pub.start_pass = start_pass_downsample; downsample->pub.downsample = sep_downsample; diff --git a/jctrans.c b/jctrans.c index 85725a92..ccd7b34b 100644 --- a/jctrans.c +++ b/jctrans.c @@ -101,7 +101,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval, - SIZEOF((*qtblptr)->quantval)); + sizeof((*qtblptr)->quantval)); (*qtblptr)->sent_table = FALSE; } } @@ -382,7 +382,7 @@ transencode_coef_controller (j_compress_ptr cinfo, coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + sizeof(my_coef_controller)); cinfo->coef = (struct jpeg_c_coef_controller *) coef; coef->pub.start_pass = start_pass_coef; coef->pub.compress_data = compress_output; @@ -393,8 +393,8 @@ transencode_coef_controller (j_compress_ptr cinfo, /* Allocate and pre-zero space for dummy DCT blocks. */ buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); - jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); + jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->dummy_buffer[i] = buffer + i; } diff --git a/jdapimin.c b/jdapimin.c index db53fdce..fc8898f8 100644 --- a/jdapimin.c +++ b/jdapimin.c @@ -1,8 +1,10 @@ /* * jdapimin.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1998, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains application interface code for the decompression half @@ -35,9 +37,9 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) 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)) + if (structsize != sizeof(struct jpeg_decompress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, - (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); + (int) sizeof(struct jpeg_decompress_struct), (int) structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set @@ -48,7 +50,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) { struct jpeg_error_mgr * err = cinfo->err; void * client_data = cinfo->client_data; /* ignore Purify complaint here */ - MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct)); + MEMZERO(cinfo, sizeof(struct jpeg_decompress_struct)); cinfo->err = err; cinfo->client_data = client_data; } diff --git a/jdarith.c b/jdarith.c index b945d64d..c6a1a99a 100644 --- a/jdarith.c +++ b/jdarith.c @@ -1,8 +1,10 @@ /* * jdarith.c * + * This file was part of the Independent JPEG Group's software: * Developed 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains portable arithmetic entropy decoding routines for JPEG @@ -734,7 +736,7 @@ jinit_arith_decoder (j_decompress_ptr cinfo) entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(arith_entropy_decoder)); + sizeof(arith_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass; @@ -752,7 +754,7 @@ jinit_arith_decoder (j_decompress_ptr cinfo) int *coef_bit_ptr, ci; cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components*DCTSIZE2*SIZEOF(int)); + cinfo->num_components*DCTSIZE2*sizeof(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) diff --git a/jdatadst-tj.c b/jdatadst-tj.c index 786a7522..bc4a35dd 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -161,7 +161,7 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_mem_destination_mgr)); + sizeof(my_mem_destination_mgr)); dest = (my_mem_dest_ptr) cinfo->dest; dest->newbuffer = NULL; } diff --git a/jdatadst.c b/jdatadst.c index 436e6638..7a40e4f3 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -72,7 +72,7 @@ init_destination (j_compress_ptr cinfo) /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); + OUTPUT_BUF_SIZE * sizeof(JOCTET)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; @@ -216,7 +216,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_destination_mgr)); + sizeof(my_destination_mgr)); } dest = (my_dest_ptr) cinfo->dest; @@ -254,7 +254,7 @@ jpeg_mem_dest (j_compress_ptr cinfo, if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_mem_destination_mgr)); + sizeof(my_mem_destination_mgr)); } dest = (my_mem_dest_ptr) cinfo->dest; diff --git a/jdatasrc-tj.c b/jdatasrc-tj.c index f023a8bf..09f95960 100644 --- a/jdatasrc-tj.c +++ b/jdatasrc-tj.c @@ -171,7 +171,7 @@ jpeg_mem_src_tj (j_decompress_ptr cinfo, if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(struct jpeg_source_mgr)); + sizeof(struct jpeg_source_mgr)); } src = cinfo->src; diff --git a/jdatasrc.c b/jdatasrc.c index 5b4c17df..bf70422b 100644 --- a/jdatasrc.c +++ b/jdatasrc.c @@ -227,11 +227,11 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_source_mgr)); + sizeof(my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - INPUT_BUF_SIZE * SIZEOF(JOCTET)); + INPUT_BUF_SIZE * sizeof(JOCTET)); } src = (my_src_ptr) cinfo->src; @@ -268,7 +268,7 @@ jpeg_mem_src (j_decompress_ptr cinfo, if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(struct jpeg_source_mgr)); + sizeof(struct jpeg_source_mgr)); } src = cinfo->src; diff --git a/jdcoefct.c b/jdcoefct.c index c1a168a2..199a628b 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -166,7 +166,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) MCU_col_num++) { /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ jzero_far((void *) coef->MCU_buffer[0], - (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); + (size_t) (cinfo->blocks_in_MCU * sizeof(JBLOCK))); if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; @@ -423,7 +423,7 @@ smoothing_ok (j_decompress_ptr cinfo) coef->coef_bits_latch = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * - (SAVED_COEFS * SIZEOF(int))); + (SAVED_COEFS * sizeof(int))); coef_bits_latch = coef->coef_bits_latch; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; @@ -685,7 +685,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_coef_controller)); + sizeof(my_coef_controller)); cinfo->coef = (struct jpeg_d_coef_controller *) coef; coef->pub.start_input_pass = start_input_pass; coef->pub.start_output_pass = start_output_pass; @@ -731,7 +731,7 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) buffer = (JBLOCKROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { coef->MCU_buffer[i] = buffer + i; } @@ -743,5 +743,5 @@ jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) /* Allocate the workspace buffer */ coef->workspace = (JCOEF *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(JCOEF) * DCTSIZE2); + sizeof(JCOEF) * DCTSIZE2); } diff --git a/jdcolor.c b/jdcolor.c index 932c2534..6927e5ed 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -216,16 +216,16 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * sizeof(int)); cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * sizeof(int)); cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * sizeof(INT32)); cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * sizeof(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ @@ -308,7 +308,7 @@ build_rgb_y_table (j_decompress_ptr cinfo) /* Allocate and fill in the conversion tables. */ cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(INT32))); + (TABLE_SIZE * sizeof(INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_y_tab[i+R_Y_OFF] = FIX(0.29900) * i; @@ -570,7 +570,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_color_deconverter)); + sizeof(my_color_deconverter)); cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; cconvert->pub.start_pass = start_pass_dcolor; diff --git a/jddctmgr.c b/jddctmgr.c index bcc4f556..93d50090 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -331,7 +331,7 @@ jinit_inverse_dct (j_decompress_ptr cinfo) idct = (my_idct_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_idct_controller)); + sizeof(my_idct_controller)); cinfo->idct = (struct jpeg_inverse_dct *) idct; idct->pub.start_pass = start_pass; @@ -340,8 +340,8 @@ jinit_inverse_dct (j_decompress_ptr cinfo) /* Allocate and pre-zero a multiplier table for each component */ compptr->dct_table = (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(multiplier_table)); - MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); + sizeof(multiplier_table)); + MEMZERO(compptr->dct_table, sizeof(multiplier_table)); /* Mark multiplier table not yet set up for any method */ idct->cur_method[ci] = -1; } diff --git a/jdhuff.c b/jdhuff.c index db2b5eac..7dc13289 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -177,7 +177,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, if (*pdtbl == NULL) *pdtbl = (d_derived_tbl *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(d_derived_tbl)); + sizeof(d_derived_tbl)); dtbl = *pdtbl; dtbl->pub = htbl; /* fill in back link */ @@ -804,7 +804,7 @@ jinit_huff_decoder (j_decompress_ptr cinfo) entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(huff_entropy_decoder)); + sizeof(huff_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass_huff_decoder; entropy->pub.decode_mcu = decode_mcu; diff --git a/jdinput.c b/jdinput.c index e3df0c10..6f4ea7ba 100644 --- a/jdinput.c +++ b/jdinput.c @@ -253,8 +253,8 @@ latch_quant_tables (j_decompress_ptr cinfo) /* OK, save away the quantization table */ qtbl = (JQUANT_TBL *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(JQUANT_TBL)); - MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); + sizeof(JQUANT_TBL)); + MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL)); compptr->quant_table = qtbl; } } @@ -382,7 +382,7 @@ jinit_input_controller (j_decompress_ptr cinfo) /* Create subobject in permanent pool */ inputctl = (my_inputctl_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_input_controller)); + sizeof(my_input_controller)); cinfo->inputctl = (struct jpeg_input_controller *) inputctl; /* Initialize method pointers */ inputctl->pub.consume_input = consume_markers; diff --git a/jdmainct.c b/jdmainct.c index b4d4a22c..7f7bd33e 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -173,7 +173,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) */ main_ptr->xbuffer[0] = (JSAMPIMAGE) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); + cinfo->num_components * 2 * sizeof(JSAMPARRAY)); main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; @@ -185,7 +185,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) */ xbuf = (JSAMPARRAY) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); + 2 * (rgroup * (M + 4)) * sizeof(JSAMPROW)); xbuf += rgroup; /* want one row group at negative offsets */ main_ptr->xbuffer[0][ci] = xbuf; xbuf += rgroup * (M + 4); @@ -484,7 +484,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_main_controller)); + sizeof(my_main_controller)); cinfo->main = (struct jpeg_d_main_controller *) main_ptr; main_ptr->pub.start_pass = start_pass_main; diff --git a/jdmarker.c b/jdmarker.c index fbcf554c..d1357af4 100644 --- a/jdmarker.c +++ b/jdmarker.c @@ -276,7 +276,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) if (cinfo->comp_info == NULL) /* do only once, even if suspend */ cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components * SIZEOF(jpeg_component_info)); + cinfo->num_components * sizeof(jpeg_component_info)); for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { @@ -472,7 +472,7 @@ get_dht (j_decompress_ptr cinfo) for (i = 0; i < count; i++) INPUT_BYTE(cinfo, huffval[i], return FALSE); - MEMZERO(&huffval[count], (256 - count) * SIZEOF(UINT8)); + MEMZERO(&huffval[count], (256 - count) * sizeof(UINT8)); length -= count; @@ -490,8 +490,8 @@ get_dht (j_decompress_ptr cinfo) if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); - MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); - MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); + MEMCOPY((*htblptr)->bits, bits, sizeof((*htblptr)->bits)); + MEMCOPY((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval)); } if (length != 0) @@ -778,7 +778,7 @@ save_marker (j_decompress_ptr cinfo) /* allocate and initialize the marker item */ cur_marker = (jpeg_saved_marker_ptr) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(struct jpeg_marker_struct) + limit); + sizeof(struct jpeg_marker_struct) + limit); cur_marker->next = NULL; cur_marker->marker = (UINT8) cinfo->unread_marker; cur_marker->original_length = (unsigned int) length; @@ -1283,7 +1283,7 @@ jinit_marker_reader (j_decompress_ptr cinfo) /* Create subobject in permanent pool */ marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - SIZEOF(my_marker_reader)); + sizeof(my_marker_reader)); cinfo->marker = (struct jpeg_marker_reader *) marker; /* Initialize public method pointers */ marker->pub.reset_marker_reader = reset_marker_reader; @@ -1323,7 +1323,7 @@ jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, /* Length limit mustn't be larger than what we can allocate * (should only be a concern in a 16-bit environment). */ - maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct); + maxlength = cinfo->mem->max_alloc_chunk - sizeof(struct jpeg_marker_struct); if (((long) length_limit) > maxlength) length_limit = (unsigned int) maxlength; diff --git a/jdmaster.c b/jdmaster.c index e1f02907..604e2916 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -429,11 +429,11 @@ prepare_range_limit_table (j_decompress_ptr cinfo) table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * sizeof(JSAMPLE)); table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ cinfo->sample_range_limit = table; /* First segment of "simple" table: limit[x] = 0 for x < 0 */ - MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); + MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * sizeof(JSAMPLE)); /* Main part of "simple" table: limit[x] = x */ for (i = 0; i <= MAXJSAMPLE; i++) table[i] = (JSAMPLE) i; @@ -443,9 +443,9 @@ prepare_range_limit_table (j_decompress_ptr cinfo) table[i] = MAXJSAMPLE; /* Second half of post-IDCT table */ MEMZERO(table + (2 * (MAXJSAMPLE+1)), - (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE)); MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), - cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); + cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE)); } @@ -726,7 +726,7 @@ jinit_master_decompress (j_decompress_ptr cinfo) master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_decomp_master)); + sizeof(my_decomp_master)); cinfo->master = (struct jpeg_decomp_master *) master; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; diff --git a/jdmerge.c b/jdmerge.c index 60d0f5c1..f89d69f5 100644 --- a/jdmerge.c +++ b/jdmerge.c @@ -227,16 +227,16 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) upsample->Cr_r_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * sizeof(int)); upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(int)); + (MAXJSAMPLE+1) * sizeof(int)); upsample->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * sizeof(INT32)); upsample->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * sizeof(INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ @@ -801,7 +801,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); + sizeof(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_merged_upsample; upsample->pub.need_context_rows = FALSE; @@ -824,7 +824,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) /* Allocate a spare row buffer */ upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); + (size_t) (upsample->out_row_width * sizeof(JSAMPLE))); } else { upsample->pub.upsample = merged_1v_upsample; if (jsimd_can_h2v1_merged_upsample()) diff --git a/jdphuff.c b/jdphuff.c index e52aa7b9..eae15383 100644 --- a/jdphuff.c +++ b/jdphuff.c @@ -649,7 +649,7 @@ jinit_phuff_decoder (j_decompress_ptr cinfo) entropy = (phuff_entropy_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(phuff_entropy_decoder)); + sizeof(phuff_entropy_decoder)); cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; entropy->pub.start_pass = start_pass_phuff_decoder; @@ -661,7 +661,7 @@ jinit_phuff_decoder (j_decompress_ptr cinfo) /* Create progression status table */ cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - cinfo->num_components*DCTSIZE2*SIZEOF(int)); + cinfo->num_components*DCTSIZE2*sizeof(int)); coef_bit_ptr = & cinfo->coef_bits[0][0]; for (ci = 0; ci < cinfo->num_components; ci++) for (i = 0; i < DCTSIZE2; i++) diff --git a/jdpostct.c b/jdpostct.c index 38438316..9eef9ee0 100644 --- a/jdpostct.c +++ b/jdpostct.c @@ -252,7 +252,7 @@ jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) post = (my_post_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_post_controller)); + sizeof(my_post_controller)); cinfo->post = (struct jpeg_d_post_controller *) post; post->pub.start_pass = start_pass_dpost; post->whole_image = NULL; /* flag for no virtual arrays */ diff --git a/jdsample.c b/jdsample.c index a1d19e7b..66f2c04a 100644 --- a/jdsample.c +++ b/jdsample.c @@ -412,7 +412,7 @@ jinit_upsampler (j_decompress_ptr cinfo) upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_upsampler)); + sizeof(my_upsampler)); cinfo->upsample = (struct jpeg_upsampler *) upsample; upsample->pub.start_pass = start_pass_upsample; upsample->pub.upsample = sep_upsample; diff --git a/jinclude.h b/jinclude.h index b14a3fc0..4dced6e2 100644 --- a/jinclude.h +++ b/jinclude.h @@ -1,8 +1,10 @@ /* * jinclude.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1994, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file exists to provide a single place to fix any problems with @@ -69,16 +71,6 @@ #endif -/* - * In ANSI C, and indeed any rational implementation, size_t is also the - * type returned by sizeof(). However, it seems there are some irrational - * implementations out there, in which sizeof() returns an int even though - * size_t is defined as long or unsigned long. To ensure consistent results - * we always use this SIZEOF() macro in place of using sizeof() directly. - */ - -#define SIZEOF(object) ((size_t) sizeof(object)) - /* * The modules that use fread() and fwrite() always invoke them through * these macros. On some systems you may need to twiddle the argument casts. diff --git a/jmemmgr.c b/jmemmgr.c index c721c46f..f7219d26 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -82,7 +82,7 @@ round_up_pow2 (size_t a, size_t b) #ifndef ALIGN_SIZE /* so can override from jconfig.h */ #ifndef WITH_SIMD -#define ALIGN_SIZE SIZEOF(double) +#define ALIGN_SIZE sizeof(double) #else #define ALIGN_SIZE 16 /* Most SIMD implementations require this */ #endif @@ -278,7 +278,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE); /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) + if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ /* See if space is available in any existing pool */ @@ -296,7 +296,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* Time to make a new pool? */ if (hdr_ptr == NULL) { /* min_request is what we need now, slop is what will be leftover */ - min_request = SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1; + min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1; if (prev_hdr_ptr == NULL) /* first pool in class? */ slop = first_pool_slop[pool_id]; else @@ -326,7 +326,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) /* OK, allocate the object from the current pool */ data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */ - data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */ + data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */ if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */ data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE; data_ptr += hdr_ptr->bytes_used; /* point to place for object */ @@ -366,7 +366,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE); /* Check for unsatisfiable request (do now to ensure no overflow below) */ - if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) + if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK) out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ /* Always make a new pool */ @@ -374,11 +374,11 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + - SIZEOF(large_pool_hdr) + + sizeof(large_pool_hdr) + ALIGN_SIZE - 1); if (hdr_ptr == NULL) out_of_memory(cinfo, 4); /* jpeg_get_large failed */ - mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr) + ALIGN_SIZE - 1; + mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) + ALIGN_SIZE - 1; /* Success, initialize the new pool header and add to list */ hdr_ptr->next = mem->large_list[pool_id]; @@ -390,7 +390,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) mem->large_list[pool_id] = hdr_ptr; data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */ - data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */ + data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */ if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */ data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE; @@ -426,13 +426,13 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, long ltemp; /* Make sure each row is properly aligned */ - if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0) + if ((ALIGN_SIZE % sizeof(JSAMPLE)) != 0) out_of_memory(cinfo, 5); /* safety check */ - samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE)); + samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / sizeof(JSAMPLE)); /* Calculate max # of rows allowed in one allocation chunk */ - ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) samplesperrow * SIZEOF(JSAMPLE)); + ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) / + ((long) samplesperrow * sizeof(JSAMPLE)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) @@ -443,7 +443,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, /* Get space for row pointers (small object) */ result = (JSAMPARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JSAMPROW))); + (size_t) (numrows * sizeof(JSAMPROW))); /* Get the rows themselves (large objects) */ currow = 0; @@ -451,7 +451,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id, rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JSAMPROW) alloc_large(cinfo, pool_id, (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow - * SIZEOF(JSAMPLE))); + * sizeof(JSAMPLE))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += samplesperrow; @@ -479,12 +479,12 @@ alloc_barray (j_common_ptr cinfo, int pool_id, long ltemp; /* Make sure each row is properly aligned */ - if ((SIZEOF(JBLOCK) % ALIGN_SIZE) != 0) + if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0) out_of_memory(cinfo, 6); /* safety check */ /* Calculate max # of rows allowed in one allocation chunk */ - ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / - ((long) blocksperrow * SIZEOF(JBLOCK)); + ltemp = (MAX_ALLOC_CHUNK-sizeof(large_pool_hdr)) / + ((long) blocksperrow * sizeof(JBLOCK)); if (ltemp <= 0) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); if (ltemp < (long) numrows) @@ -495,7 +495,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id, /* Get space for row pointers (small object) */ result = (JBLOCKARRAY) alloc_small(cinfo, pool_id, - (size_t) (numrows * SIZEOF(JBLOCKROW))); + (size_t) (numrows * sizeof(JBLOCKROW))); /* Get the rows themselves (large objects) */ currow = 0; @@ -503,7 +503,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id, rowsperchunk = MIN(rowsperchunk, numrows - currow); workspace = (JBLOCKROW) alloc_large(cinfo, pool_id, (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow - * SIZEOF(JBLOCK))); + * sizeof(JBLOCK))); for (i = rowsperchunk; i > 0; i--) { result[currow++] = workspace; workspace += blocksperrow; @@ -566,7 +566,7 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, /* get control block */ result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_sarray_control)); + sizeof(struct jvirt_sarray_control)); result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; @@ -596,7 +596,7 @@ request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, /* get control block */ result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id, - SIZEOF(struct jvirt_barray_control)); + sizeof(struct jvirt_barray_control)); result->mem_buffer = NULL; /* marks array not yet realized */ result->rows_in_array = numrows; @@ -630,17 +630,17 @@ realize_virt_arrays (j_common_ptr cinfo) for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { if (sptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) sptr->maxaccess * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + (long) sptr->samplesperrow * sizeof(JSAMPLE); maximum_space += (long) sptr->rows_in_array * - (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + (long) sptr->samplesperrow * sizeof(JSAMPLE); } } for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { if (bptr->mem_buffer == NULL) { /* if not realized yet */ space_per_minheight += (long) bptr->maxaccess * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); + (long) bptr->blocksperrow * sizeof(JBLOCK); maximum_space += (long) bptr->rows_in_array * - (long) bptr->blocksperrow * SIZEOF(JBLOCK); + (long) bptr->blocksperrow * sizeof(JBLOCK); } } @@ -680,7 +680,7 @@ realize_virt_arrays (j_common_ptr cinfo) jpeg_open_backing_store(cinfo, & sptr->b_s_info, (long) sptr->rows_in_array * (long) sptr->samplesperrow * - (long) SIZEOF(JSAMPLE)); + (long) sizeof(JSAMPLE)); sptr->b_s_open = TRUE; } sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE, @@ -704,7 +704,7 @@ realize_virt_arrays (j_common_ptr cinfo) jpeg_open_backing_store(cinfo, & bptr->b_s_info, (long) bptr->rows_in_array * (long) bptr->blocksperrow * - (long) SIZEOF(JBLOCK)); + (long) sizeof(JBLOCK)); bptr->b_s_open = TRUE; } bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE, @@ -724,7 +724,7 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) { long bytesperrow, file_offset, byte_count, rows, thisrow, i; - bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE); + bytesperrow = (long) ptr->samplesperrow * sizeof(JSAMPLE); file_offset = ptr->cur_start_row * bytesperrow; /* Loop to read or write each allocation chunk in mem_buffer */ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { @@ -757,7 +757,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) { long bytesperrow, file_offset, byte_count, rows, thisrow, i; - bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK); + bytesperrow = (long) ptr->blocksperrow * sizeof(JBLOCK); file_offset = ptr->cur_start_row * bytesperrow; /* Loop to read or write each allocation chunk in mem_buffer */ for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { @@ -849,7 +849,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, if (writable) ptr->first_undef_row = end_row; if (ptr->pre_zero) { - size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE); + size_t bytesperrow = (size_t) ptr->samplesperrow * sizeof(JSAMPLE); undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { @@ -934,7 +934,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, if (writable) ptr->first_undef_row = end_row; if (ptr->pre_zero) { - size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK); + size_t bytesperrow = (size_t) ptr->blocksperrow * sizeof(JBLOCK); undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ end_row -= ptr->cur_start_row; while (undef_row < end_row) { @@ -1003,7 +1003,7 @@ free_pool (j_common_ptr cinfo, int pool_id) large_pool_ptr next_lhdr_ptr = lhdr_ptr->next; space_freed = lhdr_ptr->bytes_used + lhdr_ptr->bytes_left + - SIZEOF(large_pool_hdr); + sizeof(large_pool_hdr); jpeg_free_large(cinfo, (void *) lhdr_ptr, space_freed); mem->total_space_allocated -= space_freed; lhdr_ptr = next_lhdr_ptr; @@ -1017,7 +1017,7 @@ free_pool (j_common_ptr cinfo, int pool_id) small_pool_ptr next_shdr_ptr = shdr_ptr->next; space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left + - SIZEOF(small_pool_hdr); + sizeof(small_pool_hdr); jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); mem->total_space_allocated -= space_freed; shdr_ptr = next_shdr_ptr; @@ -1044,7 +1044,7 @@ self_destruct (j_common_ptr cinfo) } /* Release the memory manager control block too. */ - jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr)); + jpeg_free_small(cinfo, (void *) cinfo->mem, sizeof(my_memory_mgr)); cinfo->mem = NULL; /* ensures I will be called only once */ jpeg_mem_term(cinfo); /* system-dependent cleanup */ @@ -1067,7 +1067,7 @@ jinit_memory_mgr (j_common_ptr cinfo) cinfo->mem = NULL; /* for safety if init fails */ /* Check for configuration errors. - * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably + * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably * doesn't reflect any real hardware alignment requirement. * The test is a little tricky: for X>0, X and X-1 have no one-bits * in common if and only if X is a power of 2, ie has only one one-bit. @@ -1088,7 +1088,7 @@ jinit_memory_mgr (j_common_ptr cinfo) max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */ /* Attempt to allocate memory manager's control block */ - mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr)); + mem = (my_mem_ptr) jpeg_get_small(cinfo, sizeof(my_memory_mgr)); if (mem == NULL) { jpeg_mem_term(cinfo); /* system-dependent cleanup */ @@ -1121,7 +1121,7 @@ jinit_memory_mgr (j_common_ptr cinfo) mem->virt_sarray_list = NULL; mem->virt_barray_list = NULL; - mem->total_space_allocated = SIZEOF(my_memory_mgr); + mem->total_space_allocated = sizeof(my_memory_mgr); /* Declare ourselves open for business */ cinfo->mem = & mem->pub; diff --git a/jquant1.c b/jquant1.c index 2fd3037b..0e253547 100644 --- a/jquant1.c +++ b/jquant1.c @@ -403,7 +403,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) odither = (ODITHER_MATRIX_PTR) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ODITHER_MATRIX)); + sizeof(ODITHER_MATRIX)); /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). * Hence the dither value for the matrix cell with fill order f * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). @@ -532,7 +532,7 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ - jzero_far((void *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); + jzero_far((void *) output_buf[row], (size_t) (width * sizeof(JSAMPLE))); row_index = cquantize->row_index; for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; @@ -636,7 +636,7 @@ quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, for (row = 0; row < num_rows; row++) { /* Initialize output values to 0 so can process components separately */ - jzero_far((void *) output_buf[row], (size_t) (width * SIZEOF(JSAMPLE))); + jzero_far((void *) output_buf[row], (size_t) (width * sizeof(JSAMPLE))); for (ci = 0; ci < nc; ci++) { input_ptr = input_buf[row] + ci; output_ptr = output_buf[row]; @@ -725,7 +725,7 @@ alloc_fs_workspace (j_decompress_ptr cinfo) size_t arraysize; int i; - arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); + arraysize = (size_t) ((cinfo->output_width + 2) * sizeof(FSERROR)); for (i = 0; i < cinfo->out_color_components; i++) { cquantize->fserrors[i] = (FSERRPTR) (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); @@ -779,7 +779,7 @@ start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) if (cquantize->fserrors[0] == NULL) alloc_fs_workspace(cinfo); /* Initialize the propagated errors to zero. */ - arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); + arraysize = (size_t) ((cinfo->output_width + 2) * sizeof(FSERROR)); for (i = 0; i < cinfo->out_color_components; i++) jzero_far((void *) cquantize->fserrors[i], arraysize); break; @@ -824,7 +824,7 @@ jinit_1pass_quantizer (j_decompress_ptr cinfo) cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); + sizeof(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_1_quant; cquantize->pub.finish_pass = finish_pass_1_quant; diff --git a/jquant2.c b/jquant2.c index a9c78454..291b4f1b 100644 --- a/jquant2.c +++ b/jquant2.c @@ -524,7 +524,7 @@ select_colors (j_decompress_ptr cinfo, int desired_colors) /* Allocate workspace for box list */ boxlist = (boxptr) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * sizeof(box)); /* Initialize one box containing whole space */ numboxes = 1; boxlist[0].c0min = 0; @@ -1083,7 +1083,7 @@ init_error_limit (j_decompress_ptr cinfo) int in, out; table = (int *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * sizeof(int)); table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ cquantize->error_limiter = table; @@ -1167,7 +1167,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) if (cinfo->dither_mode == JDITHER_FS) { size_t arraysize = (size_t) ((cinfo->output_width + 2) * - (3 * SIZEOF(FSERROR))); + (3 * sizeof(FSERROR))); /* Allocate Floyd-Steinberg workspace if we didn't already. */ if (cquantize->fserrors == NULL) cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) @@ -1185,7 +1185,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) if (cquantize->needs_zeroed) { for (i = 0; i < HIST_C0_ELEMS; i++) { jzero_far((void *) histogram[i], - HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); + HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); } cquantize->needs_zeroed = FALSE; } @@ -1218,7 +1218,7 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) cquantize = (my_cquantize_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(my_cquantizer)); + sizeof(my_cquantizer)); cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_2_quant; cquantize->pub.new_color_map = new_color_map_2_quant; @@ -1231,11 +1231,11 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) /* Allocate the histogram/inverse colormap storage */ cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d)); + ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * sizeof(hist2d)); for (i = 0; i < HIST_C0_ELEMS; i++) { cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); + HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); } cquantize->needs_zeroed = TRUE; /* histogram is garbage now */ @@ -1272,7 +1272,7 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) if (cinfo->dither_mode == JDITHER_FS) { cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR)))); + (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR)))); /* Might as well create the error-limiting table too. */ init_error_limit(cinfo); } diff --git a/jstdhuff.c b/jstdhuff.c index 0e9aff42..b29e5ea4 100644 --- a/jstdhuff.c +++ b/jstdhuff.c @@ -28,7 +28,7 @@ add_huff_table (j_common_ptr cinfo, return; /* Copy the number-of-symbols-of-each-code-length counts */ - MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); + MEMCOPY((*htblptr)->bits, bits, sizeof((*htblptr)->bits)); /* Validate the counts. We do this here mainly so we can copy the right * number of symbols from the val[] array, without risking marching off @@ -40,7 +40,7 @@ add_huff_table (j_common_ptr cinfo, if (nsymbols < 1 || nsymbols > 256) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); - MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8)); + MEMCOPY((*htblptr)->huffval, val, nsymbols * sizeof(UINT8)); /* Initialize sent_table FALSE so table will be written to JPEG file. */ (*htblptr)->sent_table = FALSE; diff --git a/jutils.c b/jutils.c index 7955d23c..0e2611c8 100644 --- a/jutils.c +++ b/jutils.c @@ -100,7 +100,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row, */ { register JSAMPROW inptr, outptr; - register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); + register size_t count = (size_t) (num_cols * sizeof(JSAMPLE)); register int row; input_array += source_row; @@ -119,7 +119,7 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks) /* Copy a row of coefficient blocks from one place to another. */ { - MEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); + MEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF))); } diff --git a/rdbmp.c b/rdbmp.c index 0b2351db..ffedeed4 100644 --- a/rdbmp.c +++ b/rdbmp.c @@ -469,7 +469,7 @@ jinit_read_bmp (j_compress_ptr cinfo) /* Create module interface object */ source = (bmp_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_source_struct)); + sizeof(bmp_source_struct)); source->cinfo = cinfo; /* make back link for subroutines */ /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_bmp; diff --git a/rdppm.c b/rdppm.c index 0bc6d35a..f56d5cf3 100644 --- a/rdppm.c +++ b/rdppm.c @@ -350,7 +350,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) TRACEMS2(cinfo, 1, JTRC_PGM, w, h); if (maxval > 255) { source->pub.get_pixel_rows = get_word_gray_row; - } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) { + } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR)) { source->pub.get_pixel_rows = get_raw_row; use_raw_buffer = TRUE; need_rescale = FALSE; @@ -365,7 +365,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) TRACEMS2(cinfo, 1, JTRC_PPM, w, h); if (maxval > 255) { source->pub.get_pixel_rows = get_word_rgb_row; - } else if (maxval == MAXJSAMPLE && SIZEOF(JSAMPLE) == SIZEOF(U_CHAR)) { + } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR)) { source->pub.get_pixel_rows = get_raw_row; use_raw_buffer = TRUE; need_rescale = FALSE; @@ -378,7 +378,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */ if (need_iobuffer) { source->buffer_width = (size_t) w * cinfo->input_components * - ((maxval<=255) ? SIZEOF(U_CHAR) : (2*SIZEOF(U_CHAR))); + ((maxval<=255) ? sizeof(U_CHAR) : (2*sizeof(U_CHAR))); source->iobuffer = (U_CHAR *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, source->buffer_width); @@ -406,7 +406,7 @@ start_input_ppm (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* On 16-bit-int machines we have to be careful of maxval = 65535 */ source->rescale = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (((long) maxval + 1L) * SIZEOF(JSAMPLE))); + (size_t) (((long) maxval + 1L) * sizeof(JSAMPLE))); half_maxval = maxval / 2; for (val = 0; val <= (INT32) maxval; val++) { /* The multiplication here must be done in 32 bits to avoid overflow */ @@ -439,7 +439,7 @@ jinit_read_ppm (j_compress_ptr cinfo) /* Create module interface object */ source = (ppm_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_source_struct)); + sizeof(ppm_source_struct)); /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_ppm; source->pub.finish_input = finish_input_ppm; diff --git a/rdrle.c b/rdrle.c index a82cc3a3..8df3ddb5 100644 --- a/rdrle.c +++ b/rdrle.c @@ -3,8 +3,8 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * It was modified by The libjpeg-turbo Project to include only information - * relevant to libjpeg-turbo. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to read input images in Utah RLE format. @@ -376,7 +376,7 @@ jinit_read_rle (j_compress_ptr cinfo) /* Create module interface object */ source = (rle_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(rle_source_struct)); + sizeof(rle_source_struct)); /* Fill in method ptrs */ source->pub.start_input = start_input_rle; source->pub.finish_input = finish_input_rle; diff --git a/rdswitch.c b/rdswitch.c index 65499740..a0aa37c7 100644 --- a/rdswitch.c +++ b/rdswitch.c @@ -261,8 +261,8 @@ bogus: */ scanptr = (jpeg_scan_info *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - scanno * SIZEOF(jpeg_scan_info)); - MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info)); + scanno * sizeof(jpeg_scan_info)); + MEMCOPY(scanptr, scans, scanno * sizeof(jpeg_scan_info)); cinfo->scan_info = scanptr; cinfo->num_scans = scanno; } diff --git a/rdtarga.c b/rdtarga.c index 3f35d3d4..afd17c43 100644 --- a/rdtarga.c +++ b/rdtarga.c @@ -489,7 +489,7 @@ jinit_read_targa (j_compress_ptr cinfo) /* Create module interface object */ source = (tga_source_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_source_struct)); + sizeof(tga_source_struct)); source->cinfo = cinfo; /* make back link for subroutines */ /* Fill in method ptrs, except get_pixel_rows which start_input sets */ source->pub.start_input = start_input_tga; diff --git a/transupp.c b/transupp.c index 20c8d594..93444e31 100644 --- a/transupp.c +++ b/transupp.c @@ -1093,7 +1093,7 @@ jtransform_request_workspace (j_decompress_ptr srcinfo, if (need_workspace) { coef_arrays = (jvirt_barray_ptr *) (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE, - SIZEOF(jvirt_barray_ptr) * info->num_components); + sizeof(jvirt_barray_ptr) * info->num_components); width_in_iMCUs = (JDIMENSION) jdiv_round_up((long) info->output_width, (long) info->iMCU_sample_width); diff --git a/turbojpeg.c b/turbojpeg.c index 6e86e26e..2490836b 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1263,7 +1263,7 @@ static int setDecodeDefaults(struct jpeg_decompress_struct *dinfo, dinfo->comp_info=(jpeg_component_info *) (*dinfo->mem->alloc_small)((j_common_ptr)dinfo, JPOOL_IMAGE, - dinfo->num_components*SIZEOF(jpeg_component_info)); + dinfo->num_components*sizeof(jpeg_component_info)); for(i=0; inum_components; i++) { diff --git a/wrbmp.c b/wrbmp.c index 0949dd77..3a85441c 100644 --- a/wrbmp.c +++ b/wrbmp.c @@ -215,8 +215,8 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; /* Set unused fields of header to 0 */ - MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); - MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader)); + MEMZERO(bmpfileheader, sizeof(bmpfileheader)); + MEMZERO(bmpinfoheader, sizeof(bmpinfoheader)); /* Fill the file header */ bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ @@ -283,8 +283,8 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest) bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height; /* Set unused fields of header to 0 */ - MEMZERO(bmpfileheader, SIZEOF(bmpfileheader)); - MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader)); + MEMZERO(bmpfileheader, sizeof(bmpfileheader)); + MEMZERO(bmpcoreheader, sizeof(bmpcoreheader)); /* Fill the file header */ bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */ @@ -422,7 +422,7 @@ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2) /* Create module interface object, fill in method pointers */ dest = (bmp_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(bmp_dest_struct)); + sizeof(bmp_dest_struct)); dest->pub.start_output = start_output_bmp; dest->pub.finish_output = finish_output_bmp; dest->is_os2 = is_os2; diff --git a/wrgif.c b/wrgif.c index 193f7b58..d260ee0f 100644 --- a/wrgif.c +++ b/wrgif.c @@ -1,8 +1,10 @@ /* * wrgif.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in GIF format. @@ -364,7 +366,7 @@ jinit_write_gif (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (gif_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(gif_dest_struct)); + sizeof(gif_dest_struct)); dest->cinfo = cinfo; /* make back link for subroutines */ dest->pub.start_output = start_output_gif; dest->pub.put_pixel_rows = put_pixel_rows; diff --git a/wrppm.c b/wrppm.c index 6acf2043..d3a613c8 100644 --- a/wrppm.c +++ b/wrppm.c @@ -4,8 +4,8 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. * Modified 2009 by Guido Vollbeding. - * It was modified by The libjpeg-turbo Project to include only information - * relevant to libjpeg-turbo. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in PPM/PGM format. @@ -221,7 +221,7 @@ jinit_write_ppm (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (ppm_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(ppm_dest_struct)); + sizeof(ppm_dest_struct)); dest->pub.start_output = start_output_ppm; dest->pub.finish_output = finish_output_ppm; @@ -230,12 +230,12 @@ jinit_write_ppm (j_decompress_ptr cinfo) /* Create physical I/O buffer */ dest->samples_per_row = cinfo->output_width * cinfo->out_color_components; - dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char)); + dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * sizeof(char)); dest->iobuffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width); if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 || - SIZEOF(JSAMPLE) != SIZEOF(char)) { + sizeof(JSAMPLE) != sizeof(char)) { /* When quantizing, we need an output buffer for colormap indexes * that's separate from the physical I/O buffer. We also need a * separate buffer if pixel format translation must take place. diff --git a/wrrle.c b/wrrle.c index 7560d161..6f35ad91 100644 --- a/wrrle.c +++ b/wrrle.c @@ -115,7 +115,7 @@ start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) if (cinfo->quantize_colors) { /* Allocate storage for RLE-style cmap, zero any extra entries */ - cmapsize = cinfo->out_color_components * CMAPLENGTH * SIZEOF(rle_map); + cmapsize = cinfo->out_color_components * CMAPLENGTH * sizeof(rle_map); dest->colormap = (rle_map *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize); MEMZERO(dest->colormap, cmapsize); @@ -282,7 +282,7 @@ jinit_write_rle (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (rle_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(rle_dest_struct)); + sizeof(rle_dest_struct)); dest->pub.start_output = start_output_rle; dest->pub.finish_output = finish_output_rle; diff --git a/wrtarga.c b/wrtarga.c index 0ee26b5c..5fbfc538 100644 --- a/wrtarga.c +++ b/wrtarga.c @@ -3,8 +3,8 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1996, Thomas G. Lane. - * It was modified by The libjpeg-turbo Project to include only information - * relevant to libjpeg-turbo. + * It was modified by The libjpeg-turbo Project to include only code and + * information relevant to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains routines to write output images in Targa format. @@ -50,7 +50,7 @@ write_header (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, int num_colors) char targaheader[18]; /* Set unused fields of header to 0 */ - MEMZERO(targaheader, SIZEOF(targaheader)); + MEMZERO(targaheader, sizeof(targaheader)); if (num_colors > 0) { targaheader[1] = 1; /* color map type 1 */ @@ -222,7 +222,7 @@ jinit_write_targa (j_decompress_ptr cinfo) /* Create module interface object, fill in method pointers */ dest = (tga_dest_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - SIZEOF(tga_dest_struct)); + sizeof(tga_dest_struct)); dest->pub.start_output = start_output_tga; dest->pub.finish_output = finish_output_tga; @@ -233,7 +233,7 @@ jinit_write_targa (j_decompress_ptr cinfo) dest->buffer_width = cinfo->output_width * cinfo->output_components; dest->iobuffer = (char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (size_t) (dest->buffer_width * SIZEOF(char))); + (size_t) (dest->buffer_width * sizeof(char))); /* Create decompressor output buffer. */ dest->pub.buffer = (*cinfo->mem->alloc_sarray) From ecfbabdbf3a2fd91a5732bb1fe053197603f852e Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 19:36:05 +0000 Subject: [PATCH 932/985] Fix MIPS build --- simd/jsimd.h | 12 +++++++----- simd/jsimd_mips.c | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/simd/jsimd.h b/simd/jsimd.h index 8cd4473e..776edbba 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -311,9 +311,11 @@ EXTERN(void) jsimd_h2v2_downsample_mips_dspr2 /* h2v2 Smooth Downsampling */ EXTERN(void) jsimd_h2v2_smooth_downsample_mips_dspr2 - (JDIMENSION image_width, int max_v_samp_factor, - JDIMENSION v_samp_factor, JDIMENSION width_blocks, - JSAMPARRAY input_data, JSAMPARRAY output_data); + (JSAMPARRAY input_data, JSAMPARRAY output_data, + JDIMENSION v_samp_factor, int max_v_samp_factor, + int smoothing_factor, JDIMENSION width_blocks, + JDIMENSION image_width); + /* Upsampling */ EXTERN(void) jsimd_h2v1_upsample_mmx @@ -626,8 +628,8 @@ EXTERN(void) jsimd_idct_islow_neon JDIMENSION output_col); EXTERN(void) jsimd_idct_islow_mips_dspr2 - (void * dct_table, JCOEFPTR coef_block, JSAMPARRAY output_buf, - JDIMENSION output_col); + (void * dct_table, JCOEFPTR coef_block, int * output_buf, + JSAMPLE * output_col); /* Fast Integer Inverse DCT */ EXTERN(void) jsimd_idct_ifast_mmx diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index 336b2dba..ae9d41ee 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -286,9 +286,9 @@ jsimd_c_null_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { if (simd_support & JSIMD_MIPS_DSPR2) - jsimd_null_convert_compr_mips_dspr2(cinfo->image_width, input_buf, - output_buf, output_row, num_rows, - cinfo->num_components); + jsimd_c_null_convert_mips_dspr2(cinfo->image_width, input_buf, + output_buf, output_row, num_rows, + cinfo->num_components); } GLOBAL(int) From 6263c1fc1b9fbf6821f112a6eb1ac56caa359525 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 18 May 2014 20:04:47 +0000 Subject: [PATCH 933/985] SIMD-accelerated int upsample routine for MIPS DSPr2 --- jccolor.c | 1 + jcsample.c | 1 + jddctmgr.c | 1 + jdsample.c | 8 +++- jsimd.h | 4 ++ jsimd_none.c | 12 ++++++ simd/jsimd.h | 6 +++ simd/jsimd_mips.c | 49 +++++++++++++++++++++++ simd/jsimd_mips_dspr2.S | 88 +++++++++++++++++++++++++++++++++++++++++ 9 files changed, 169 insertions(+), 1 deletion(-) diff --git a/jccolor.c b/jccolor.c index 0af12248..4be75f71 100644 --- a/jccolor.c +++ b/jccolor.c @@ -6,6 +6,7 @@ * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB * Copyright (C) 2009-2012, D. R. Commander. + * Copyright (C) 2014, MIPS Technologies, Inc., California * For conditions of distribution and use, see the accompanying README file. * * This file contains input colorspace conversion routines. diff --git a/jcsample.c b/jcsample.c index d8c376b6..286f7585 100644 --- a/jcsample.c +++ b/jcsample.c @@ -5,6 +5,7 @@ * Copyright (C) 1991-1996, Thomas G. Lane. * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB + * Copyright (C) 2014, MIPS Technologies, Inc., California * For conditions of distribution and use, see the accompanying README file. * * This file contains downsampling routines. diff --git a/jddctmgr.c b/jddctmgr.c index 93d50090..40e68f1f 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -7,6 +7,7 @@ * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB * Copyright (C) 2010, D. R. Commander. + * Copyright (C) 2013, MIPS Technologies, Inc., California * For conditions of distribution and use, see the accompanying README file. * * This file contains the inverse-DCT management logic. diff --git a/jdsample.c b/jdsample.c index 66f2c04a..27529667 100644 --- a/jdsample.c +++ b/jdsample.c @@ -6,6 +6,7 @@ * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB * Copyright (C) 2010, D. R. Commander. + * Copyright (C) 2014, MIPS Technologies, Inc., California * For conditions of distribution and use, see the accompanying README file. * * This file contains upsampling routines. @@ -482,7 +483,12 @@ jinit_upsampler (j_decompress_ptr cinfo) } else if ((h_out_group % h_in_group) == 0 && (v_out_group % v_in_group) == 0) { /* Generic integral-factors upsampling method */ - upsample->methods[ci] = int_upsample; +#if defined(__mips__) + if (jsimd_can_int_upsample()) + upsample->methods[ci] = jsimd_int_upsample; + else +#endif + upsample->methods[ci] = int_upsample; upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); } else diff --git a/jsimd.h b/jsimd.h index 663c9693..d45fd700 100644 --- a/jsimd.h +++ b/jsimd.h @@ -47,6 +47,7 @@ EXTERN(void) jsimd_h2v1_downsample EXTERN(int) jsimd_can_h2v2_upsample (void); EXTERN(int) jsimd_can_h2v1_upsample (void); +EXTERN(int) jsimd_can_int_upsample (void); EXTERN(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, @@ -54,6 +55,9 @@ EXTERN(void) jsimd_h2v2_upsample EXTERN(void) jsimd_h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_int_upsample + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); EXTERN(int) jsimd_can_h2v2_fancy_upsample (void); EXTERN(int) jsimd_can_h2v1_fancy_upsample (void); diff --git a/jsimd_none.c b/jsimd_none.c index bdba6930..96a9842a 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -118,6 +118,18 @@ jsimd_can_h2v1_upsample (void) return 0; } +GLOBAL(int) +jsimd_can_int_upsample (void) +{ + return 0; +} + +GLOBAL(void) +jsimd_int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ +} + GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, diff --git a/simd/jsimd.h b/simd/jsimd.h index 776edbba..609b91f5 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -339,6 +339,12 @@ EXTERN(void) jsimd_h2v2_upsample_mips_dspr2 (int max_v_samp_factor, JDIMENSION output_width, JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr); +EXTERN(void) jsimd_int_upsample_mips_dspr2 + (UINT8 h_expand, UINT8 v_expand, JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr, JDIMENSION output_width, + int max_v_samp_factor); + + /* Fancy Upsampling */ EXTERN(void) jsimd_h2v1_fancy_upsample_mmx (int max_v_samp_factor, JDIMENSION downsampled_width, diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index ae9d41ee..2a1059e0 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -85,6 +85,25 @@ static const int mips_idct_ifast_coefs[4] = { 0xAC60AC60 // FIX(-2.613125930 / 4) = -21407 = 0xAC61 }; +/* The following struct is borrowed from jdsample.c */ +typedef void (*upsample1_ptr) (j_decompress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY input_data, + JSAMPARRAY * output_data_ptr); + +typedef struct { + struct jpeg_upsampler pub; + JSAMPARRAY color_buf[MAX_COMPONENTS]; + upsample1_ptr methods[MAX_COMPONENTS]; + int next_row_out; + JDIMENSION rows_to_go; + int rowgroup_height[MAX_COMPONENTS]; + UINT8 h_expand[MAX_COMPONENTS]; + UINT8 v_expand[MAX_COMPONENTS]; +} my_upsampler; + +typedef my_upsampler * my_upsample_ptr; + GLOBAL(int) jsimd_can_rgb_ycc (void) { @@ -415,6 +434,23 @@ jsimd_can_h2v1_upsample (void) return 0; } +GLOBAL(int) +jsimd_can_int_upsample (void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_MIPS_DSPR2) + return 1; + + return 0; +} + GLOBAL(void) jsimd_h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, @@ -439,6 +475,19 @@ jsimd_h2v1_upsample (j_decompress_ptr cinfo, output_data_ptr); } +GLOBAL(void) +jsimd_int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + + jsimd_int_upsample_mips_dspr2(upsample->h_expand[compptr->component_index], + upsample->v_expand[compptr->component_index], + input_data, output_data_ptr, + cinfo->output_width, + cinfo->max_v_samp_factor); +} + GLOBAL(int) jsimd_can_h2v2_fancy_upsample (void) { diff --git a/simd/jsimd_mips_dspr2.S b/simd/jsimd_mips_dspr2.S index 532966a5..4572a51f 100644 --- a/simd/jsimd_mips_dspr2.S +++ b/simd/jsimd_mips_dspr2.S @@ -1613,6 +1613,94 @@ LEAF_MIPS_DSPR2(jsimd_h2v2_smooth_downsample_mips_dspr2) nop END(jsimd_h2v2_smooth_downsample_mips_dspr2) + +/*****************************************************************************/ +LEAF_MIPS_DSPR2(jsimd_int_upsample_mips_dspr2) +/* + * a0 - upsample->h_expand[compptr->component_index] + * a1 - upsample->v_expand[compptr->component_index] + * a2 - input_data + * a3 - output_data_ptr + * 16(sp) - cinfo->output_width + * 20(sp) - cinfo->max_v_samp_factor + */ + .set at + + SAVE_REGS_ON_STACK 16, s0, s1, s2, s3 + + lw s0, 0(a3) // s0 = output_data + lw s1, 32(sp) // s1 = cinfo->output_width + lw s2, 36(sp) // s2 = cinfo->max_v_samp_factor + li t6, 0 // t6 = inrow + beqz s2, 10f + li s3, 0 // s3 = outrow +0: + addu t0, a2, t6 + addu t7, s0, s3 + lw t3, 0(t0) // t3 = inptr + lw t8, 0(t7) // t8 = outptr + beqz s1, 4f + addu t5, t8, s1 // t5 = outend +1: + lb t2, 0(t3) // t2 = invalue = *inptr++ + addiu t3, 1 + beqz a0, 3f + move t0, a0 // t0 = h_expand +2: + sb t2, 0(t8) + addiu t0, -1 + bgtz t0, 2b + addiu t8, 1 +3: + bgt t5, t8, 1b + nop +4: + addiu t9, a1, -1 // t9 = v_expand - 1 + blez t9, 9f + nop +5: + lw t3, 0(s0) + lw t4, 4(s0) + subu t0, s1, 0xF + blez t0, 7f + addu t5, t3, s1 // t5 = end address + andi t7, s1, 0xF // t7 = residual + subu t8, t5, t7 +6: + ulw t0, 0(t3) + ulw t1, 4(t3) + ulw t2, 8(t3) + usw t0, 0(t4) + ulw t0, 12(t3) + usw t1, 4(t4) + usw t2, 8(t4) + usw t0, 12(t4) + addiu t3, 16 + bne t3, t8, 6b + addiu t4, 16 + beqz t7, 8f + nop +7: + lbu t0, 0(t3) + sb t0, 0(t4) + addiu t3, 1 + bne t3, t5, 7b + addiu t4, 1 +8: + addiu t9, -1 + bgtz t9, 5b + addiu s0, 8 +9: + addu s3, s3, a1 + bne s3, s2, 0b + addiu t6, 1 +10: + RESTORE_REGS_FROM_STACK 16, s0, s1, s2, s3 + + j ra + nop +END(jsimd_int_upsample_mips_dspr2) + /*****************************************************************************/ LEAF_MIPS_DSPR2(jsimd_h2v1_upsample_mips_dspr2) /* From 76ef3c5ddad4a4b9b9516045072e1104f3db9875 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 19 May 2014 19:13:22 +0000 Subject: [PATCH 934/985] Allow for building the MIPS DSPr2 extensions if the host is mips-* as well as mipsel-*. The DSPr2 extensions are little endian, so we still have to check that the compiler defines __MIPSEL__ before enabling them. This paves the way for supporting big-endian MIPS, and in the near term, it allows the SIMD extensions to be built with Sourcery CodeBench. --- acinclude.m4 | 2 +- configure.ac | 10 +++++----- simd/Makefile.am | 2 +- simd/jsimd_mips.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 40a9e52f..8d667849 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -184,7 +184,7 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[ # AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE # -------------------------- # Test whether the assembler is suitable and supports MIPS instructions -AC_DEFUN([AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE],[ +AC_DEFUN([AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE],[ have_mips_dspr2=no ac_save_CFLAGS="$CFLAGS" CFLAGS="$CCASFLAGS -mdspr2" diff --git a/configure.ac b/configure.ac index 53f7e302..d2de1852 100644 --- a/configure.ac +++ b/configure.ac @@ -441,12 +441,12 @@ if test "x${with_simd}" != "xno"; then fi fi ;; - mipsel*) - AC_MSG_RESULT([yes (mipsel)]) + mips*) + AC_MSG_RESULT([yes (mips)]) AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used]) - AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE( + AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE( [AC_MSG_RESULT([yes]) - simd_arch=mipsel], + simd_arch=mips], [AC_MSG_RESULT([no]) with_simd=no]) if test "x${with_simd}" = "xno"; then @@ -481,7 +481,7 @@ AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"]) AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"]) AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"]) AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"]) -AM_CONDITIONAL([SIMD_MIPSEL], [test "x$simd_arch" = "xmipsel"]) +AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"]) AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"]) AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"]) diff --git a/simd/Makefile.am b/simd/Makefile.am index f4d44c3b..72d6366a 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -64,7 +64,7 @@ libsimd_la_SOURCES = jsimd_arm64.c jsimd_arm_neon_64.S endif -if SIMD_MIPSEL +if SIMD_MIPS libsimd_la_SOURCES = jsimd_mips.c jsimd_mips_dspr2_asm.h jsimd_mips_dspr2.S diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index 2a1059e0..e95023a2 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -67,7 +67,7 @@ init_simd (void) simd_support = 0; -#if defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#if defined(__MIPSEL__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) simd_support |= JSIMD_MIPS_DSPR2; #elif defined(__linux__) /* We still have a chance to use MIPS DSPR2 regardless of globally used From 360ffd4441038a5afc88619ab545fda0562228af Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 21 May 2014 04:13:09 +0000 Subject: [PATCH 935/985] We don't support non-ANSI C compilers --- libjpeg.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libjpeg.txt b/libjpeg.txt index edc61b71..7dbb3542 100644 --- a/libjpeg.txt +++ b/libjpeg.txt @@ -2975,9 +2975,8 @@ the design goals in this area. (If you encounter any bugs that cause the library to be less portable than is claimed here, we'd appreciate hearing about them.) -The code works fine on ANSI C, C++, and pre-ANSI C compilers, using any of -the popular system include file setups, and some not-so-popular ones too. -See install.txt for configuration procedures. +The code works fine on ANSI C and C++ compilers, using any of the popular +system include file setups, and some not-so-popular ones too. The code is not dependent on the exact sizes of the C data types. As distributed, we make the assumptions that From 7e6f1ee2d4f939aeaa6f794bb0b9935296358521 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 28 May 2014 20:19:54 +0000 Subject: [PATCH 936/985] Our copyright string is longer than JMSG_LENGTH_MAX, and this was causing a buffer overrun if output_message() was called with msg_code set to JMSG_COPYRIGHT, or if format_message() was called with msg_code set to JMSG_COPYRIGHT and with a buffer of length JMSG_LENGTH_MAX. We can't simply increase JMSG_LENGTH_MAX, because it is part of the libjpeg API, and it is generally assumed that a buffer of this length will be passed to format_message(). Thus, the easiest solution is simply to use a shorter copyright string for JMSG_COPYRIGHT. --- ChangeLog.txt | 3 +++ jerror.h | 6 ++++-- jversion.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c8476df6..8a70f671 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -70,6 +70,9 @@ handle prototypes and support for the MS-DOS memory model, were removed from the libjpeg code, greatly improving its readability and making it easier to maintain and extend. +[10] Fixed a segfault that occurred when calling output_message() with msg_code +set to JMSG_COPYRIGHT. + 1.3.1 ===== diff --git a/jerror.h b/jerror.h index fab59b38..402613e0 100644 --- a/jerror.h +++ b/jerror.h @@ -1,9 +1,11 @@ /* * jerror.h * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. * Modified 1997-2009 by Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * libjpeg-turbo Modifications: + * Copyright (C) 2014, D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file defines the error and message codes for the JPEG library. @@ -132,7 +134,7 @@ JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") JMESSAGE(JERR_XMS_READ, "Read from XMS failed") JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") -JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) +JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT_SHORT) JMESSAGE(JMSG_VERSION, JVERSION) JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") diff --git a/jversion.h b/jversion.h index 7ab28870..25c3cf0b 100644 --- a/jversion.h +++ b/jversion.h @@ -32,3 +32,5 @@ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ "Copyright (C) 2013 Linaro Limited" + +#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2014 The libjpeg-turbo Project and many others" From b8f2b72acb7b02ce34a40fe9d25eb2cd1e127e89 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 29 May 2014 19:31:45 +0000 Subject: [PATCH 937/985] Remove VMS-specific code --- cdjpeg.h | 13 ------------- rdjpgcom.c | 12 +++--------- wrjpgcom.c | 13 +++---------- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/cdjpeg.h b/cdjpeg.h index c633f3f8..8461ee33 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -129,29 +129,16 @@ EXTERN(FILE *) write_stdout (void); #define READ_BINARY "r" #define WRITE_BINARY "w" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ #define READ_BINARY "rb" #define WRITE_BINARY "wb" #endif -#endif #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else #define EXIT_SUCCESS 0 #endif -#endif #ifndef EXIT_WARNING -#ifdef VMS -#define EXIT_WARNING 1 /* VMS is very nonstandard */ -#else #define EXIT_WARNING 2 #endif -#endif diff --git a/rdjpgcom.c b/rdjpgcom.c index 02ce90f2..2f0115df 100644 --- a/rdjpgcom.c +++ b/rdjpgcom.c @@ -1,9 +1,11 @@ /* * rdjpgcom.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. * Modified 2009 by Bill Allombert, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains a very simple stand-alone application that displays @@ -38,23 +40,15 @@ #ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ #define READ_BINARY "r" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ #define READ_BINARY "rb" #endif -#endif #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else #define EXIT_SUCCESS 0 #endif -#endif /* diff --git a/wrjpgcom.c b/wrjpgcom.c index 1055d862..ecebd8cc 100644 --- a/wrjpgcom.c +++ b/wrjpgcom.c @@ -1,8 +1,10 @@ /* * wrjpgcom.c * + * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. + * It was modified by The libjpeg-turbo Project to include only code relevant + * to libjpeg-turbo. * For conditions of distribution and use, see the accompanying README file. * * This file contains a very simple stand-alone application that inserts @@ -38,25 +40,16 @@ extern void * malloc (); #define READ_BINARY "r" #define WRITE_BINARY "w" #else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ #define READ_BINARY "rb" #define WRITE_BINARY "wb" #endif -#endif #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 #endif #ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else #define EXIT_SUCCESS 0 #endif -#endif /* Reduce this value if your malloc() can't allocate blocks up to 64K. * On DOS, compiling in large model is usually a better solution. From e3d3cc073d70492e8a130b3ae3d41f1caee369cb Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 22 Jun 2014 20:36:50 +0000 Subject: [PATCH 938/985] Prevent a buffer overrun if the comment begins with a literal quote character and the string exceeds 65k characters. Also prevent comments longer than 65k characters from being written, since this will produce an incorrect JPEG file. --- ChangeLog.txt | 5 +++++ wrjpgcom.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8a70f671..e8b18afa 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -73,6 +73,11 @@ maintain and extend. [10] Fixed a segfault that occurred when calling output_message() with msg_code set to JMSG_COPYRIGHT. +[11] Fixed an issue whereby wrjpgcom was allowing comments longer than 65k +characters to be passed on the command line, which was causing it to generate +incorrect JPEG files. + + 1.3.1 ===== diff --git a/wrjpgcom.c b/wrjpgcom.c index ecebd8cc..0a22f629 100644 --- a/wrjpgcom.c +++ b/wrjpgcom.c @@ -3,8 +3,8 @@ * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1997, Thomas G. Lane. - * It was modified by The libjpeg-turbo Project to include only code relevant - * to libjpeg-turbo. + * libjpeg-turbo Modifications: + * Copyright (C) 2014, D. R. Commander * For conditions of distribution and use, see the accompanying README file. * * This file contains a very simple stand-alone application that inserts @@ -446,6 +446,11 @@ main (int argc, char **argv) comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); if (comment_arg == NULL) ERREXIT("Insufficient memory"); + if (strlen(argv[argn]) + 2 >= (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); + } strcpy(comment_arg, argv[argn]+1); for (;;) { comment_length = (unsigned int) strlen(comment_arg); @@ -455,9 +460,19 @@ main (int argc, char **argv) } if (++argn >= argc) ERREXIT("Missing ending quote mark"); + if (strlen(comment_arg) + strlen(argv[argn]) + 2 >= + (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); + } strcat(comment_arg, " "); strcat(comment_arg, argv[argn]); } + } else if (strlen(argv[argn]) >= (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); } comment_length = (unsigned int) strlen(comment_arg); } else From 8d4544b7bcf152501ee0bd4ac39a25642070bfec Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 22 Jun 2014 20:46:48 +0000 Subject: [PATCH 939/985] Big oops. wrjpgcom on Windows was being built using the rdjpgcom source. --- CMakeLists.txt | 2 +- ChangeLog.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 307c495e..42cb70af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,7 @@ set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") add_executable(rdjpgcom rdjpgcom.c) -add_executable(wrjpgcom rdjpgcom.c) +add_executable(wrjpgcom wrjpgcom.c) # diff --git a/ChangeLog.txt b/ChangeLog.txt index e8b18afa..b6901336 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -77,6 +77,8 @@ set to JMSG_COPYRIGHT. characters to be passed on the command line, which was causing it to generate incorrect JPEG files. +[12] Fixed a bug in the build system that was causing the Windows version of +wrjpgcom to be built using the rdjpgcom code. 1.3.1 From e2f5c7cab3f582d0972a6563de2cbb59438f2209 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 22 Jun 2014 21:14:39 +0000 Subject: [PATCH 940/985] Add proper support for Borland compilers (Borland needs section names to be prefixed with an underscore, and it needs OMF object files.) --- simd/CMakeLists.txt | 11 +++++++---- simd/jsimdext.inc | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt index 4ec5ade0..25bd290f 100755 --- a/simd/CMakeLists.txt +++ b/simd/CMakeLists.txt @@ -3,12 +3,15 @@ if(NOT DEFINED NASM) endif() if(SIMD_X86_64) - set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__ -I${CMAKE_SOURCE_DIR}/win/ - -I${CMAKE_CURRENT_SOURCE_DIR}/) + set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__) else() - set(NAFLAGS -fwin32 -DWIN32 -I${CMAKE_SOURCE_DIR}/win/ - -I${CMAKE_CURRENT_SOURCE_DIR}/) + if(BORLAND) + set(NAFLAGS -fobj -DOBJ32) + else() + set(NAFLAGS -fwin32 -DWIN32) + endif() endif() +set(NAFLAGS ${NAFLAGS} -I${CMAKE_SOURCE_DIR}/win/ -I${CMAKE_CURRENT_SOURCE_DIR}/) # This only works if building from the command line. There is currently no way # to set a variable's value based on the build type when using the MSVC IDE. diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 0f1a8dac..e1442de1 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -65,8 +65,8 @@ ; -- segment definition -- ; -%define SEG_TEXT .text align=16 public use32 class=CODE -%define SEG_CONST .data align=16 public use32 class=DATA +%define SEG_TEXT _text align=16 public use32 class=CODE +%define SEG_CONST _data align=16 public use32 class=DATA %elifdef ELF ; ----(nasm -felf[64] -DELF ...)------------ ; * Linux From 24aeccff3e5c5aae5a67c79ba9569781f96c3f1d Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 17 Jul 2014 08:24:58 +0000 Subject: [PATCH 941/985] Include "Installed-Size" field in the deb-control file to prevent Ubuntu from complaining --- release/deb-control.tmpl | 1 + release/makedpkg.in | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/release/deb-control.tmpl b/release/deb-control.tmpl index 5ae4ce9f..510b1d66 100644 --- a/release/deb-control.tmpl +++ b/release/deb-control.tmpl @@ -6,6 +6,7 @@ Architecture: {__ARCH} Essential: no Maintainer: The libjpeg-turbo Project Homepage: http://www.libjpeg-turbo.org +Installed-Size: {__SIZE} Description: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, diff --git a/release/makedpkg.in b/release/makedpkg.in index fa6bc190..448e4cdd 100644 --- a/release/makedpkg.in +++ b/release/makedpkg.in @@ -29,9 +29,6 @@ makedeb() rm -f $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX` mkdir $TMPDIR/DEBIAN - (cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \ - | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \ - | sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control) if [ $SUPPLEMENT = 1 ]; then make install DESTDIR=$TMPDIR bindir=/dummy/bin datadir=/dummy/data \ @@ -47,6 +44,13 @@ makedeb() fi fi + SIZE=`du -s $TMPDIR | cut -f1` + (cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \ + | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \ + | sed s/{__ARCH}/$DEBARCH/g | sed s/{__SIZE}/$SIZE/g \ + > $TMPDIR/DEBIAN/control) + + /sbin/ldconfig -n $TMPDIR$LIBDIR sudo chown -Rh root:root $TMPDIR/* From 82b87514821490347ddd5835f01b1e6e4ec56936 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 23 Jul 2014 14:14:14 +0000 Subject: [PATCH 942/985] Fix performance and other issues uncovered in testing with actual ARM64 hardware; formatting tweaks; remove NEON platform check (NEON is always available with ARMv8) --- simd/jsimd_arm64.c | 83 +-------- simd/jsimd_arm_neon_64.S | 380 +++++++++++++++++++-------------------- 2 files changed, 193 insertions(+), 270 deletions(-) diff --git a/simd/jsimd_arm64.c b/simd/jsimd_arm64.c index 988023a6..44225aa6 100644 --- a/simd/jsimd_arm64.c +++ b/simd/jsimd_arm64.c @@ -27,98 +27,29 @@ static unsigned int simd_support = ~0; -#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) - -#define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024) - -LOCAL(int) -check_feature (char *buffer, char *feature) -{ - char *p; - if (*feature == 0) - return 0; - if (strncmp(buffer, "Features", 8) != 0) - return 0; - buffer += 8; - while (isspace(*buffer)) - buffer++; - - /* Check if 'feature' is present in the buffer as a separate word */ - while ((p = strstr(buffer, feature))) { - if (p > buffer && !isspace(*(p - 1))) { - buffer++; - continue; - } - p += strlen(feature); - if (*p != 0 && !isspace(*p)) { - buffer++; - continue; - } - return 1; - } - return 0; -} - -LOCAL(int) -parse_proc_cpuinfo (int bufsize) -{ - char *buffer = (char *)malloc(bufsize); - FILE *fd; - simd_support = 0; - - if (!buffer) - return 0; - - fd = fopen("/proc/cpuinfo", "r"); - if (fd) { - while (fgets(buffer, bufsize, fd)) { - if (!strchr(buffer, '\n') && !feof(fd)) { - /* "impossible" happened - insufficient size of the buffer! */ - fclose(fd); - free(buffer); - return 0; - } - if (check_feature(buffer, "neon")) - simd_support |= JSIMD_ARM_NEON; - } - fclose(fd); - } - free(buffer); - return 1; -} - -#endif - /* * Check what SIMD accelerations are supported. * * FIXME: This code is racy under a multi-threaded environment. */ + +/* + * ARMv8 architectures support NEON extensions by default. + * It is no longer optional as it was with ARMv7. + */ + + LOCAL(void) init_simd (void) { char *env = NULL; -#if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) - int bufsize = 1024; /* an initial guess for the line buffer size limit */ -#endif if (simd_support != ~0U) return; simd_support = 0; -#if defined(__ARM_NEON__) simd_support |= JSIMD_ARM_NEON; -#elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__) - /* We still have a chance to use NEON regardless of globally used - * -mcpu/-mfpu options passed to gcc by performing runtime detection via - * /proc/cpuinfo parsing on linux/android */ - while (!parse_proc_cpuinfo(bufsize)) { - bufsize *= 2; - if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT) - break; - } -#endif /* Force different settings through environment variables */ env = getenv("JSIMD_FORCENEON"); diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index 8806abc6..2c3989c6 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -34,7 +34,6 @@ #define RESPECT_STRICT_ALIGNMENT 1 -#define RTSM_SQSHRN_SIM_ISSUE /*****************************************************************************/ @@ -257,8 +256,18 @@ asm_function jsimd_idct_islow_neon ROW6R .req v29 ROW7L .req v30 ROW7R .req v31 - + /* Save all NEON registers and x15 (32 NEON registers * 8 bytes + 16) */ + sub sp, sp, 272 + str x15, [sp], 16 adr x15, jsimd_idct_islow_neon_consts + st1 {v0.8b - v3.8b}, [sp], 32 + st1 {v4.8b - v7.8b}, [sp], 32 + st1 {v8.8b - v11.8b}, [sp], 32 + st1 {v12.8b - v15.8b}, [sp], 32 + st1 {v16.8b - v19.8b}, [sp], 32 + st1 {v20.8b - v23.8b}, [sp], 32 + st1 {v24.8b - v27.8b}, [sp], 32 + st1 {v28.8b - v31.8b}, [sp], 32 ld1 {v16.4h, v17.4h, v18.4h, v19.4h}, [COEF_BLOCK], 32 ld1 {v0.4h, v1.4h, v2.4h, v3.4h}, [DCT_TABLE], 32 ld1 {v20.4h, v21.4h, v22.4h, v23.4h}, [COEF_BLOCK], 32 @@ -277,7 +286,7 @@ asm_function jsimd_idct_islow_neon mul v22.4h, v22.4h, v6.4h mul v23.4h, v23.4h, v7.4h ins v22.2d[1], v23.2d[0] /* 128 bit q11 */ - ld1 {v28.4h, v29.4h, v30.4h, v31.4h}, [COEF_BLOCK], 32 + ld1 {v28.4h, v29.4h, v30.4h, v31.4h}, [COEF_BLOCK] mul v24.4h, v24.4h, v0.4h mul v25.4h, v25.4h, v1.4h ins v24.2d[1], v25.2d[0] /* 128 bit q12 */ @@ -293,80 +302,79 @@ asm_function jsimd_idct_islow_neon mul v30.4h, v30.4h, v6.4h mul v31.4h, v31.4h, v7.4h ins v30.2d[1], v31.2d[0] /* 128 bit q15 */ - sub sp, sp, #32 - st1 {v8.4h-v11.4h}, [sp] /* save NEON registers */ - sub sp, sp, #32 - st1 {v12.4h-v15.4h}, [sp] + /* Go to the bottom of the stack */ + sub sp, sp, 352 + stp x4, x5, [sp], 16 + st1 {v8.4h - v11.4h}, [sp], 32 /* save NEON registers */ + st1 {v12.4h - v15.4h}, [sp], 32 /* 1-D IDCT, pass 1, left 4x8 half */ add v4.4h, ROW7L.4h, ROW3L.4h add v5.4h, ROW5L.4h, ROW1L.4h smull v12.4s, v4.4h, XFIX_1_175875602_MINUS_1_961570560 smlal v12.4s, v5.4h, XFIX_1_175875602 smull v14.4s, v4.4h, XFIX_1_175875602 - /* Check for the zero coefficients in the right 4x8 half */ - /* push {x4, x5} */ - stp x4, x5, [sp, -16]! - mov x5, #0 + /* Check for the zero coefficients in the right 4x8 half */ smlal v14.4s, v5.4h, XFIX_1_175875602_MINUS_0_390180644 ssubl v6.4s, ROW0L.4h, ROW4L.4h - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 1 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 1 * 8))] smull v4.4s, ROW2L.4h, XFIX_0_541196100 smlal v4.4s, ROW6L.4h, XFIX_0_541196100_MINUS_1_847759065 - orr x0, x4, x5 + orr x0, x4, x5 mov v8.16b, v12.16b smlsl v12.4s, ROW5L.4h, XFIX_2_562915447 - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 2 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 2 * 8))] smlal v12.4s, ROW3L.4h, XFIX_3_072711026_MINUS_2_562915447 shl v6.4s, v6.4s, #13 - orr x0, x0, x4 + orr x0, x0, x4 smlsl v8.4s, ROW1L.4h, XFIX_0_899976223 - orr x0, x0 , x5 + orr x0, x0 , x5 add v2.4s, v6.4s, v4.4s - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 3 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 3 * 8))] mov v10.16b, v14.16b add v2.4s, v2.4s, v12.4s - orr x0, x0, x4 + orr x0, x0, x4 smlsl v14.4s, ROW7L.4h, XFIX_0_899976223 - orr x0, x0, x5 + orr x0, x0, x5 smlal v14.4s, ROW1L.4h, XFIX_1_501321110_MINUS_0_899976223 rshrn ROW1L.4h, v2.4s, #11 - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 4 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 4 * 8))] sub v2.4s, v2.4s, v12.4s smlal v10.4s, ROW5L.4h, XFIX_2_053119869_MINUS_2_562915447 - orr x0, x0, x4 + orr x0, x0, x4 smlsl v10.4s, ROW3L.4h, XFIX_2_562915447 - orr x0, x0, x5 + orr x0, x0, x5 sub v2.4s, v2.4s, v12.4s smull v12.4s, ROW2L.4h, XFIX_0_541196100_PLUS_0_765366865 - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 5 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 5 * 8))] smlal v12.4s, ROW6L.4h, XFIX_0_541196100 sub v6.4s, v6.4s, v4.4s - orr x0, x0, x4 + orr x0, x0, x4 rshrn ROW6L.4h, v2.4s, #11 - orr x0, x0, x5 + orr x0, x0, x5 add v2.4s, v6.4s, v10.4s - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 6 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 6 * 8))] sub v6.4s, v6.4s, v10.4s saddl v10.4s, ROW0L.4h, ROW4L.4h - orr x0, x0, x4 + orr x0, x0, x4 rshrn ROW2L.4h, v2.4s, #11 - orr x0, x0, x5 + orr x0, x0, x5 rshrn ROW5L.4h, v6.4s, #11 - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 7 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 7 * 8))] shl v10.4s, v10.4s, #13 smlal v8.4s, ROW7L.4h, XFIX_0_298631336_MINUS_0_899976223 - orr x0, x0, x4 + orr x0, x0, x4 add v4.4s, v10.4s, v12.4s - orr x0, x0, x5 + orr x0, x0, x5 sub v2.4s, v10.4s, v12.4s add v12.4s, v4.4s, v14.4s - ldr x4, [COEF_BLOCK, #(-96 + 2 * (4 + 0 * 8))] + ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 0 * 8))] sub v4.4s, v4.4s, v14.4s add v10.4s, v2.4s, v8.4s - orr x0, x4, x5 + orr x0, x4, x5 sub v6.4s, v2.4s, v8.4s /* pop {x4, x5} */ - ldp x4, x5, [sp], 16 + sub sp, sp, 80 + ldp x4, x5, [sp], 16 rshrn ROW7L.4h, v4.4s, #11 rshrn ROW3L.4h, v10.4s, #11 rshrn ROW0L.4h, v12.4s, #11 @@ -552,48 +560,27 @@ asm_function jsimd_idct_islow_neon ins v18.2d[1], v19.2d[0] ins v20.2d[1], v21.2d[0] ins v22.2d[1], v23.2d[0] -#ifdef RTSM_SQSHRN_SIM_ISSUE sqrshrn v16.8b, v16.8h, #2 sqrshrn2 v16.16b, v18.8h, #2 sqrshrn v18.8b, v20.8h, #2 sqrshrn2 v18.16b, v22.8h, #2 -#else - sqrshrn v16.4h, v16.4s, #2 - sqrshrn2 v16.8h, v18.4s, #2 - sqrshrn v18.4h, v20.4s, #2 - sqrshrn2 v18.8h, v22.4s, #2 -#endif - /* vpop {v8.4h-d15.4h} */ /* restore NEON registers */ - ld1 {v12.4h-v15.4h}, [sp], 32 - ld1 {v8.4h-v11.4h}, [sp], 32 + /* vpop {v8.4h - d15.4h} */ /* restore NEON registers */ + ld1 {v8.4h - v11.4h}, [sp], 32 + ld1 {v12.4h - v15.4h}, [sp], 32 ins v24.2d[1], v25.2d[0] -#ifdef RTSM_SQSHRN_SIM_ISSUE sqrshrn v20.8b, v24.8h, #2 -#else - - sqrshrn v20.4h, v24.4s, #2 -#endif /* Transpose the final 8-bit samples and do signed->unsigned conversion */ /* trn1 v16.8h, v16.8h, v18.8h */ transpose v16, v18, v3, .16b, .8h ins v26.2d[1], v27.2d[0] ins v28.2d[1], v29.2d[0] ins v30.2d[1], v31.2d[0] -#ifdef RTSM_SQSHRN_SIM_ISSUE sqrshrn2 v20.16b, v26.8h, #2 sqrshrn v22.8b, v28.8h, #2 -#else - sqrshrn2 v20.8h, v26.4s, #2 - sqrshrn v22.4h, v28.4s, #2 -#endif movi v0.16b, #(CENTERJSAMPLE) -#ifdef RTSM_SQSHRN_SIM_ISSUE sqrshrn2 v22.16b, v30.8h, #2 -#else - sqrshrn2 v22.8h, v30.4s, #2 -#endif transpose_single v16, v17, v3, .2d, .8b transpose_single v18, v19, v3, .2d, .8b add v16.8b, v16.8b, v0.8b @@ -628,6 +615,15 @@ asm_function jsimd_idct_islow_neon st1 {v21.8b}, [TMP2] st1 {v22.8b}, [TMP3] st1 {v23.8b}, [TMP4] + ldr x15, [sp], 16 + ld1 {v0.8b - v3.8b}, [sp], 32 + ld1 {v4.8b - v7.8b}, [sp], 32 + ld1 {v8.8b - v11.8b}, [sp], 32 + ld1 {v12.8b - v15.8b}, [sp], 32 + ld1 {v16.8b - v19.8b}, [sp], 32 + ld1 {v20.8b - v23.8b}, [sp], 32 + ld1 {v24.8b - v27.8b}, [sp], 32 + ld1 {v28.8b - v31.8b}, [sp], 32 blr x30 3: /* Left 4x8 half is done, right 4x8 half contains mostly zeros */ @@ -799,7 +795,8 @@ asm_function jsimd_idct_ifast_neon TMP1 .req x0 TMP2 .req x1 TMP3 .req x2 - TMP4 .req x15 + TMP4 .req x22 + TMP5 .req x23 /* Load and dequantize coefficients into NEON registers * with the following allocation: @@ -814,7 +811,15 @@ asm_function jsimd_idct_ifast_neon * 6 | d28 | d29 ( v14.8h ) * 7 | d30 | d31 ( v15.8h ) */ - adr x15, jsimd_idct_ifast_neon_consts + /* Save NEON registers used in fast IDCT */ + sub sp, sp, #176 + stp x22, x23, [sp], 16 + adr x23, jsimd_idct_ifast_neon_consts + st1 {v0.8b - v3.8b}, [sp], 32 + st1 {v4.8b - v7.8b}, [sp], 32 + st1 {v8.8b - v11.8b}, [sp], 32 + st1 {v12.8b - v15.8b}, [sp], 32 + st1 {v16.8b - v19.8b}, [sp], 32 ld1 {v8.8h, v9.8h}, [COEF_BLOCK], 32 ld1 {v0.8h, v1.8h}, [DCT_TABLE], 32 ld1 {v10.8h, v11.8h}, [COEF_BLOCK], 32 @@ -830,14 +835,9 @@ asm_function jsimd_idct_ifast_neon ld1 {v2.8h, v3.8h}, [DCT_TABLE], 32 mul v14.8h, v14.8h, v2.8h mul v13.8h, v13.8h, v1.8h - ld1 {v0.4h}, [x15] /* load constants */ + ld1 {v0.4h}, [x23] /* load constants */ mul v15.8h, v15.8h, v3.8h - /* vpush {v4.8h-v6.8h} */ /* save NEON registers */ - sub sp, sp, #32 - st1 {v4.8h-v5.8h}, [sp] /* save NEON registers */ - sub sp, sp, #16 - st1 {v6.8h}, [sp] /* 1-D IDCT, pass 1 */ sub v2.8h, v10.8h, v14.8h add v14.8h, v10.8h, v14.8h @@ -912,25 +912,25 @@ asm_function jsimd_idct_ifast_neon trn1 v13.4s, v13.4s, v15.4s trn2 v15.4s, v18.4s, v15.4s /* vswp v14.4h, v10-MSB.4h */ - umov x10, v14.d[0] + umov x22, v14.d[0] ins v14.2d[0], v10.2d[1] - ins v10.2d[1], x10 + ins v10.2d[1], x22 /* vswp v13.4h, v9MSB.4h */ - umov x10, v13.d[0] + umov x22, v13.d[0] ins v13.2d[0], v9.2d[1] - ins v9.2d[1], x10 + ins v9.2d[1], x22 /* 1-D IDCT, pass 2 */ sub v2.8h, v10.8h, v14.8h /* vswp v15.4h, v11MSB.4h */ - umov x10, v15.d[0] + umov x22, v15.d[0] ins v15.2d[0], v11.2d[1] - ins v11.2d[1], x10 + ins v11.2d[1], x22 add v14.8h, v10.8h, v14.8h /* vswp v12.4h, v8-MSB.4h */ - umov x10, v12.d[0] + umov x22, v12.d[0] ins v12.2d[0], v8.2d[1] - ins v8.2d[1], x10 + ins v8.2d[1], x22 sub v1.8h, v11.8h, v13.8h add v13.8h, v11.8h, v13.8h sub v5.8h, v9.8h, v15.8h @@ -966,15 +966,11 @@ asm_function jsimd_idct_ifast_neon add v14.8h, v5.8h, v3.8h sub v9.8h, v5.8h, v3.8h sub v13.8h, v10.8h, v2.8h - /* vpop {v4.8h-v7.4h} */ /* restore NEON registers...not available */ - ld1 {v6.8h}, [sp], 16 - ld1 {v4.8h-v5.8h}, [sp], 32 add v10.8h, v10.8h, v2.8h sub v11.8h, v12.8h, v1.8h add v12.8h, v12.8h, v1.8h /* Descale to 8-bit and range limit */ movi v0.16b, #0x80 -#ifdef RTSM_SQSHRN_SIM_ISSUE sqshrn v8.8b, v8.8h, #5 sqshrn2 v8.16b, v9.8h, #5 sqshrn v9.8b, v10.8h, #5 @@ -983,16 +979,6 @@ asm_function jsimd_idct_ifast_neon sqshrn2 v10.16b, v13.8h, #5 sqshrn v11.8b, v14.8h, #5 sqshrn2 v11.16b, v15.8h, #5 -#else - sqshrn v8.4h, v8.4s, #5 - sqshrn2 v8.8h, v9.4s, #5 - sqshrn v9.4h, v10.4s, #5 - sqshrn2 v9.8h, v11.4s, #5 - sqshrn v10.4h, v12.4s, #5 - sqshrn2 v10.8h, v13.4s, #5 - sqshrn v11.4h, v14.4s, #5 - sqshrn2 v11.8h, v15.4s, #5 -#endif add v8.16b, v8.16b, v0.16b add v9.16b, v9.16b, v0.16b add v10.16b, v10.16b, v0.16b @@ -1036,26 +1022,33 @@ asm_function jsimd_idct_ifast_neon add TMP2, TMP2, OUTPUT_COL st1 {v9.8b}, [TMP1] /* make copy */ - ins v21.2d[0], v10.2d[1] + ins v7.2d[0], v10.2d[1] mov v18.16b, v10.16b - trn1 v10.8b, v10.8b, v21.8b - trn2 v21.8b, v18.8b, v21.8b + trn1 v10.8b, v10.8b, v7.8b + trn2 v7.8b, v18.8b, v7.8b st1 {v19.8b}, [TMP2] ldp TMP1, TMP2, [OUTPUT_BUF], 16 - ldp TMP3, TMP4, [OUTPUT_BUF] + ldp TMP4, TMP5, [OUTPUT_BUF], 16 add TMP1, TMP1, OUTPUT_COL add TMP2, TMP2, OUTPUT_COL - add TMP3, TMP3, OUTPUT_COL add TMP4, TMP4, OUTPUT_COL + add TMP5, TMP5, OUTPUT_COL st1 {v10.8b}, [TMP1] /* make copy */ - ins v23.2d[0], v11.2d[1] + ins v16.2d[0], v11.2d[1] mov v18.16b, v11.16b - trn1 v11.8b, v11.8b, v23.8b - trn2 v23.8b, v18.8b, v23.8b - st1 {v21.8b}, [TMP2] - st1 {v11.8b}, [TMP3] - st1 {v23.8b}, [TMP4] + trn1 v11.8b, v11.8b, v16.8b + trn2 v16.8b, v18.8b, v16.8b + st1 {v7.8b}, [TMP2] + st1 {v11.8b}, [TMP4] + st1 {v16.8b}, [TMP5] + sub sp, sp, #176 + ldp x22, x23, [sp], 16 + ld1 {v0.8b - v3.8b}, [sp], 32 + ld1 {v4.8b - v7.8b}, [sp], 32 + ld1 {v8.8b - v11.8b}, [sp], 32 + ld1 {v12.8b - v15.8b}, [sp], 32 + ld1 {v16.8b - v19.8b}, [sp], 32 blr x30 .unreq DCT_TABLE @@ -1179,14 +1172,19 @@ asm_function jsimd_idct_4x4_neon TMP3 .req x2 TMP4 .req x15 - /* vpush {v8.4h-v15.4h} */ - sub sp, sp, #32 - st1 {v8.4h-v11.4h}, [sp] /* save NEON registers */ - sub sp, sp, #32 - st1 {v12.4h-v15.4h}, [sp] - + /* Save all used NEON registers */ + sub sp, sp, 272 + str x15, [sp], 16 /* Load constants (v3.4h is just used for padding) */ adr TMP4, jsimd_idct_4x4_neon_consts + st1 {v0.8b - v3.8b}, [sp], 32 + st1 {v4.8b - v7.8b}, [sp], 32 + st1 {v8.8b - v11.8b}, [sp], 32 + st1 {v12.8b - v15.8b}, [sp], 32 + st1 {v16.8b - v19.8b}, [sp], 32 + st1 {v20.8b - v23.8b}, [sp], 32 + st1 {v24.8b - v27.8b}, [sp], 32 + st1 {v28.8b - v31.8b}, [sp], 32 ld1 {v0.4h, v1.4h, v2.4h, v3.4h}, [TMP4] /* Load all COEF_BLOCK into NEON registers with the following allocation: @@ -1290,10 +1288,17 @@ asm_function jsimd_idct_4x4_neon st1 {v27.b}[7], [TMP4], 1 #endif - /* vpop {v8.4h-v15.4h} ;not available */ - ld1 {v12.4h-v15.4h}, [sp], 32 - ld1 {v8.4h-v11.4h}, [sp], 32 - + /* vpop {v8.4h - v15.4h} ;not available */ + sub sp, sp, #272 + ldr x15, [sp], 16 + ld1 {v0.8b - v3.8b}, [sp], 32 + ld1 {v4.8b - v7.8b}, [sp], 32 + ld1 {v8.8b - v11.8b}, [sp], 32 + ld1 {v12.8b - v15.8b}, [sp], 32 + ld1 {v16.8b - v19.8b}, [sp], 32 + ld1 {v20.8b - v23.8b}, [sp], 32 + ld1 {v24.8b - v27.8b}, [sp], 32 + ld1 {v28.8b - v31.8b}, [sp], 32 blr x30 .unreq DCT_TABLE @@ -1333,23 +1338,23 @@ jsimd_idct_2x2_neon_consts: .short FIX_3_624509785 /* d0[3] */ .macro idct_helper x4, x6, x10, x12, x16, shift, y26, y27 - sshll v28.4s, \x4, #15 + sshll v15.4s, \x4, #15 smull v26.4s, \x6, v0.4h[3] smlal v26.4s, \x10, v0.4h[2] smlal v26.4s, \x12, v0.4h[1] smlal v26.4s, \x16, v0.4h[0] - add v20.4s, v28.4s, v26.4s - sub v28.4s, v28.4s, v26.4s + add v20.4s, v15.4s, v26.4s + sub v15.4s, v15.4s, v26.4s .if \shift > 16 srshr v20.4s, v20.4s, #\shift - srshr v28.4s, v28.4s, #\shift + srshr v15.4s, v15.4s, #\shift xtn \y26, v20.4s - xtn \y27, v28.4s + xtn \y27, v15.4s .else rshrn \y26, v20.4s, #\shift - rshrn \y27, v28.4s, #\shift + rshrn \y27, v15.4s, #\shift .endif .endm @@ -1363,15 +1368,20 @@ asm_function jsimd_idct_2x2_neon TMP1 .req x0 TMP2 .req x15 - /* vpush {v8.4h-v15.4h} ; not available */ - sub sp, sp, #32 - st1 {v8.4h-v11.4h}, [sp] /* save NEON registers */ - sub sp, sp, #32 - st1 {v12.4h-v15.4h}, [sp] + /* vpush {v8.4h - v15.4h} ; not available */ + sub sp, sp, 208 + str x15, [sp], 16 /* Load constants */ adr TMP2, jsimd_idct_2x2_neon_consts - ld1 {v0.4h}, [TMP2] + st1 {v4.8b - v7.8b}, [sp], 32 + st1 {v8.8b - v11.8b}, [sp], 32 + st1 {v12.8b - v15.8b}, [sp], 32 + st1 {v16.8b - v19.8b}, [sp], 32 + st1 {v21.8b - v22.8b}, [sp], 16 + st1 {v24.8b - v27.8b}, [sp], 32 + st1 {v30.8b - v31.8b}, [sp], 16 + ld1 {v14.4h}, [TMP2] /* Load all COEF_BLOCK into NEON registers with the following allocation: * 0 1 2 3 | 4 5 6 7 @@ -1423,24 +1433,24 @@ asm_function jsimd_idct_2x2_neon idct_helper v5.4h, v7.4h, v11.4h, v13.4h, v17.4h, 13, v5.4h, v7.4h transpose_4x4 v5.4h, v7.4h, v9.4h, v11.4h #else - smull v26.4s, v6.4h, v0.4h[3] - smlal v26.4s, v10.4h, v0.4h[2] - smlal v26.4s, v12.4h, v0.4h[1] - smlal v26.4s, v16.4h, v0.4h[0] - smull v24.4s, v7.4h, v0.4h[3] - smlal v24.4s, v11.4h, v0.4h[2] - smlal v24.4s, v13.4h, v0.4h[1] - smlal v24.4s, v17.4h, v0.4h[0] - sshll v28.4s, v4.4h, #15 + smull v26.4s, v6.4h, v14.4h[3] + smlal v26.4s, v10.4h, v14.4h[2] + smlal v26.4s, v12.4h, v14.4h[1] + smlal v26.4s, v16.4h, v14.4h[0] + smull v24.4s, v7.4h, v14.4h[3] + smlal v24.4s, v11.4h, v14.4h[2] + smlal v24.4s, v13.4h, v14.4h[1] + smlal v24.4s, v17.4h, v14.4h[0] + sshll v15.4s, v4.4h, #15 sshll v30.4s, v5.4h, #15 - add v20.4s, v28.4s, v26.4s - sub v28.4s, v28.4s, v26.4s + add v20.4s, v15.4s, v26.4s + sub v15.4s, v15.4s, v26.4s rshrn v4.4h, v20.4s, #13 - rshrn v6.4h, v28.4s, #13 + rshrn v6.4h, v15.4s, #13 add v20.4s, v30.4s, v24.4s - sub v28.4s, v30.4s, v24.4s + sub v15.4s, v30.4s, v24.4s rshrn v5.4h, v20.4s, #13 - rshrn v7.4h, v28.4s, #13 + rshrn v7.4h, v15.4s, #13 transpose v4, v6, v3, .16b, .8h transpose v6, v10, v3, .16b, .4s #endif @@ -1466,11 +1476,15 @@ asm_function jsimd_idct_2x2_neon st1 {v26.b}[1], [TMP2], 1 st1 {v27.b}[5], [TMP2], 1 - /* vpop {v8.4h-v15.4h} ;not available */ - - ld1 {v12.4h-v15.4h}, [sp], 32 - ld1 {v8.4h-v11.4h}, [sp], 32 - + sub sp, sp, #208 + ldr x15, [sp], 16 + ld1 {v4.8b - v7.8b}, [sp], 32 + ld1 {v8.8b - v11.8b}, [sp], 32 + ld1 {v12.8b - v15.8b}, [sp], 32 + ld1 {v16.8b - v19.8b}, [sp], 32 + ld1 {v21.8b - v22.8b}, [sp], 16 + ld1 {v24.8b - v27.8b}, [sp], 32 + ld1 {v30.8b - v31.8b}, [sp], 16 blr x30 .unreq DCT_TABLE @@ -1572,13 +1586,11 @@ asm_function jsimd_idct_2x2_neon .error unsupported bpp .endif .endm -#ifdef RTSM_SQSHRN_SIM_ISSUE + .macro generate_jsimd_ycc_rgb_convert_neon colorid, bpp, r_offs, rsize, g_offs, gsize, b_offs, bsize, defsize -#else -.macro generate_jsimd_ycc_rgb_convert_neon colorid, bpp, r_offs, rsize, g_offs, gsize, b_offs, bsize -#endif + /* - * 2 stage pipelined YCbCr->RGB conversion + * 2-stage pipelined YCbCr->RGB conversion */ .macro do_yuv_to_rgb_stage1 @@ -1604,16 +1616,10 @@ asm_function jsimd_idct_2x2_neon uaddw v20.8h, v20.8h, v0.8b uaddw v24.8h, v24.8h, v0.8b uaddw v28.8h, v28.8h, v0.8b -#ifdef RTSM_SQSHRN_SIM_ISSUE sqxtun v1\g_offs\defsize, v20.8h sqxtun v1\r_offs\defsize, v24.8h sqxtun v1\b_offs\defsize, v28.8h -#else - sqxtun v1\g_offs\gsize, v20.4s - sqxtun v1\r_offs\rsize, v24.4s - sqxtun v1\b_offs\bsize, v28.4s -#endif .endm .macro do_yuv_to_rgb_stage2_store_load_stage1 @@ -1628,25 +1634,13 @@ asm_function jsimd_idct_2x2_neon uaddw v20.8h, v20.8h, v0.8b uaddw v24.8h, v24.8h, v0.8b uaddw v28.8h, v28.8h, v0.8b -#ifdef RTSM_SQSHRN_SIM_ISSUE sqxtun v1\g_offs\defsize, v20.8h -#else - sqxtun v1\g_offs\gsize, v20.4s -#endif ld1 {v0.8b}, [Y], 8 -#ifdef RTSM_SQSHRN_SIM_ISSUE sqxtun v1\r_offs\defsize, v24.8h -#else - sqxtun v1\r_offs\rsize, v24.4s -#endif prfm PLDL1KEEP, [U, #64] prfm PLDL1KEEP, [V, #64] prfm PLDL1KEEP, [Y, #64] -#ifdef RTSM_SQSHRN_SIM_ISSUE sqxtun v1\b_offs\defsize, v28.8h -#else - sqxtun v1\b_offs\gsize, v28.4s -#endif uaddw v6.8h, v2.8h, v4.8b /* v6.16b = u - 128 */ uaddw v8.8h, v2.8h, v5.8b /* q2 = v - 128 */ do_store \bpp, 8 @@ -1693,29 +1687,33 @@ asm_function jsimd_ycc_\colorid\()_convert_neon V .req x10 N .req x15 + sub sp, sp, 336 + str x15, [sp], 16 /* Load constants to d1, d2, d3 (v0.4h is just used for padding) */ adr x15, jsimd_ycc_\colorid\()_neon_consts + /* Save NEON registers */ + st1 {v0.8b - v3.8b}, [sp], 32 + st1 {v4.8b - v7.8b}, [sp], 32 + st1 {v8.8b - v11.8b}, [sp], 32 + st1 {v12.8b - v15.8b}, [sp], 32 + st1 {v16.8b - v19.8b}, [sp], 32 + st1 {v20.8b - v23.8b}, [sp], 32 + st1 {v24.8b - v27.8b}, [sp], 32 + st1 {v28.8b - v31.8b}, [sp], 32 ld1 {v0.4h, v1.4h}, [x15], 16 ld1 {v2.8h}, [x15] /* Save ARM registers and handle input arguments */ /* push {x4, x5, x6, x7, x8, x9, x10, x30} */ - stp x4, x5, [sp,-16]! - stp x6, x7, [sp,-16]! - stp x8, x9, [sp,-16]! - stp x10, x30, [sp,-16]! + stp x4, x5, [sp], 16 + stp x6, x7, [sp], 16 + stp x8, x9, [sp], 16 + stp x10, x30, [sp], 16 ldr INPUT_BUF0, [INPUT_BUF] ldr INPUT_BUF1, [INPUT_BUF, 8] ldr INPUT_BUF2, [INPUT_BUF, 16] .unreq INPUT_BUF - /* Save NEON registers */ - /* vpush {v8.4h-v15.4h} */ - sub sp, sp, #32 - st1 {v8.4h-v11.4h}, [sp] - sub sp, sp, #32 - st1 {v12.4h-v15.4h}, [sp] - /* Initially set v10, v11.4h, v12.8b, d13 to 0xFF */ movi v10.16b, #255 movi v12.16b, #255 @@ -1778,14 +1776,21 @@ asm_function jsimd_ycc_\colorid\()_convert_neon bgt 0b 9: /* Restore all registers and return */ - /* vpop {v8.4h-v15.4h} */ - ld1 {v12.4h-v15.4h}, [sp], #32 - ld1 {v8.4h-v11.4h}, [sp], #32 + sub sp, sp, #336 + ldr x15, [sp], 16 + ld1 {v0.8b - v3.8b}, [sp], 32 + ld1 {v4.8b - v7.8b}, [sp], 32 + ld1 {v8.8b - v11.8b}, [sp], 32 + ld1 {v12.8b - v15.8b}, [sp], 32 + ld1 {v16.8b - v19.8b}, [sp], 32 + ld1 {v20.8b - v23.8b}, [sp], 32 + ld1 {v24.8b - v27.8b}, [sp], 32 + ld1 {v28.8b - v31.8b}, [sp], 32 /* pop {r4, r5, r6, r7, r8, r9, r10, pc} */ - ldp x10, x30, [sp], #16 - ldp x8, x9, [sp], #16 - ldp x6, x5, [sp], #16 - ldp x4, x5, [sp], #16 + ldp x4, x5, [sp], 16 + ldp x6, x7, [sp], 16 + ldp x8, x9, [sp], 16 + ldp x10, x30, [sp], 16 br x30 .unreq OUTPUT_WIDTH .unreq INPUT_ROW @@ -1807,10 +1812,6 @@ asm_function jsimd_ycc_\colorid\()_convert_neon .purgem do_yuv_to_rgb_stage2_store_load_stage1 .endm -/* RTSM simulator fix integer saturation works on 8b boundry add a new parameter - * as a workaround for the simulator fix - */ -#ifdef RTSM_SQSHRN_SIM_ISSUE /*--------------------------------- id ----- bpp R rsize G gsize B bsize defsize */ generate_jsimd_ycc_rgb_convert_neon extrgb, 24, 0, .4h, 1, .4h, 2, .4h, .8b generate_jsimd_ycc_rgb_convert_neon extbgr, 24, 2, .4h, 1, .4h, 0, .4h, .8b @@ -1818,15 +1819,6 @@ generate_jsimd_ycc_rgb_convert_neon extrgbx, 32, 0, .4h, 1, .4h, 2, .4h, . generate_jsimd_ycc_rgb_convert_neon extbgrx, 32, 2, .4h, 1, .4h, 0, .4h, .8b generate_jsimd_ycc_rgb_convert_neon extxbgr, 32, 3, .4h, 2, .4h, 1, .4h, .8b generate_jsimd_ycc_rgb_convert_neon extxrgb, 32, 1, .4h, 2, .4h, 3, .4h, .8b -#else -/*--------------------------------- id ----- bpp R rsize G gsize B bsize */ -generate_jsimd_ycc_rgb_convert_neon extrgb, 24, 0, .4h, 1, .4h, 2, .4h -generate_jsimd_ycc_rgb_convert_neon extbgr, 24, 2, .4h, 1, .4h, 0, .4h -generate_jsimd_ycc_rgb_convert_neon extrgbx, 32, 0, .4h, 1, .4h, 2, .4h -generate_jsimd_ycc_rgb_convert_neon extbgrx, 32, 2, .4h, 1, .4h, 0, .4h -generate_jsimd_ycc_rgb_convert_neon extxbgr, 32, 3, .4h, 2, .4h, 1, .4h -generate_jsimd_ycc_rgb_convert_neon extxrgb, 32, 1, .4h, 2, .4h, 3, .4h -#endif .purgem do_load .purgem do_store From b7efc273a014e9cdcf5ea07efef64f992868ba12 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 9 Aug 2014 14:30:28 +0000 Subject: [PATCH 943/985] Attempt to improve performance by refactoring the compression-side color conversion and DCT algorithms so that they take full advantage of the additional registers available with 64-bit SSE2. This produces a somewhat yawn-worthy speedup of 2-3%, but at least the code is a lot more readable now. --- simd/jccolext-sse2-64.asm | 123 +++---- simd/jcgryext-sse2-64.asm | 75 ++--- simd/jfdctfst-sse2-64.asm | 452 ++++++++++++-------------- simd/jfdctint-sse2-64.asm | 651 +++++++++++++++++--------------------- 4 files changed, 576 insertions(+), 725 deletions(-) diff --git a/simd/jccolext-sse2-64.asm b/simd/jccolext-sse2-64.asm index 7bd6d016..5dbdc273 100644 --- a/simd/jccolext-sse2-64.asm +++ b/simd/jccolext-sse2-64.asm @@ -3,7 +3,7 @@ ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. -; Copyright (C) 2009, D. R. Commander. +; Copyright (C) 2009, 2014, D. R. Commander. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), @@ -32,21 +32,11 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 8 - align 16 global EXTN(jsimd_rgb_ycc_convert_sse2) EXTN(jsimd_rgb_ycc_convert_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] collect_args push rbx @@ -290,34 +280,31 @@ EXTN(jsimd_rgb_ycc_convert_sse2): ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE - movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO + movdqa xmm8,xmm0 ; xmm8=RE + movdqa xmm9,xmm1 ; xmm9=RO + movdqa xmm10,xmm4 ; xmm10=BE + movdqa xmm11,xmm5 ; xmm11=BO - movdqa xmm6,xmm1 + movdqa xmm13,xmm1 punpcklwd xmm1,xmm3 - punpckhwd xmm6,xmm3 + punpckhwd xmm13,xmm3 movdqa xmm7,xmm1 - movdqa xmm4,xmm6 + movdqa xmm4,xmm13 pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm13,[rel PW_F0299_F0337] ; xmm13=ROH*FIX(0.299)+GOH*FIX(0.337) pmaddwd xmm7,[rel PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) - movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) - - pxor xmm1,xmm1 + pxor xmm12,xmm12 pxor xmm6,xmm6 - punpcklwd xmm1,xmm5 ; xmm1=BOL + punpcklwd xmm12,xmm5 ; xmm12=BOL punpckhwd xmm6,xmm5 ; xmm6=BOH - psrld xmm1,1 ; xmm1=BOL*FIX(0.500) + psrld xmm12,1 ; xmm12=BOL*FIX(0.500) psrld xmm6,1 ; xmm6=BOH*FIX(0.500) movdqa xmm5,[rel PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm1 + paddd xmm7,xmm12 paddd xmm4,xmm6 paddd xmm7,xmm5 paddd xmm4,xmm5 @@ -325,34 +312,29 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm4,SCALEBITS ; xmm4=CbOH packssdw xmm7,xmm4 ; xmm7=CbO - movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE - - movdqa xmm6,xmm0 + movdqa xmm15,xmm0 punpcklwd xmm0,xmm2 - punpckhwd xmm6,xmm2 + punpckhwd xmm15,xmm2 movdqa xmm5,xmm0 - movdqa xmm4,xmm6 + movdqa xmm4,xmm15 pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm15,[rel PW_F0299_F0337] ; xmm15=REH*FIX(0.299)+GEH*FIX(0.337) pmaddwd xmm5,[rel PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) - - pxor xmm0,xmm0 + pxor xmm14,xmm14 pxor xmm6,xmm6 - punpcklwd xmm0,xmm1 ; xmm0=BEL - punpckhwd xmm6,xmm1 ; xmm6=BEH - psrld xmm0,1 ; xmm0=BEL*FIX(0.500) + punpcklwd xmm14,xmm10 ; xmm14=BEL + punpckhwd xmm6,xmm10 ; xmm6=BEH + psrld xmm14,1 ; xmm14=BEL*FIX(0.500) psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] + movdqa xmm12,[rel PD_ONEHALFM1_CJ] ; xmm12=[PD_ONEHALFM1_CJ] - paddd xmm5,xmm0 + paddd xmm5,xmm14 paddd xmm4,xmm6 - paddd xmm5,xmm1 - paddd xmm4,xmm1 + paddd xmm5,xmm12 + paddd xmm4,xmm12 psrld xmm5,SCALEBITS ; xmm5=CbEL psrld xmm4,SCALEBITS ; xmm4=CbEH packssdw xmm5,xmm4 ; xmm5=CbE @@ -361,34 +343,30 @@ EXTN(jsimd_rgb_ycc_convert_sse2): por xmm5,xmm7 ; xmm5=Cb movdqa XMMWORD [rbx], xmm5 ; Save Cb - movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO - - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 + movdqa xmm4,xmm11 + punpcklwd xmm11,xmm3 punpckhwd xmm4,xmm3 - movdqa xmm7,xmm0 + movdqa xmm7,xmm11 movdqa xmm5,xmm4 - pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm11,[rel PW_F0114_F0250] ; xmm11=BOL*FIX(0.114)+GOL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) pmaddwd xmm7,[rel PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm0, XMMWORD [wk(4)] - paddd xmm4, XMMWORD [wk(5)] - paddd xmm0,xmm3 + paddd xmm11, xmm1 + paddd xmm4, xmm13 + paddd xmm11,xmm3 paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm11,SCALEBITS ; xmm11=YOL psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + packssdw xmm11,xmm4 ; xmm11=YO pxor xmm3,xmm3 pxor xmm4,xmm4 - punpcklwd xmm3,xmm1 ; xmm3=ROL - punpckhwd xmm4,xmm1 ; xmm4=ROH + punpcklwd xmm3,xmm9 ; xmm3=ROL + punpckhwd xmm4,xmm9 ; xmm4=ROH psrld xmm3,1 ; xmm3=ROL*FIX(0.500) psrld xmm4,1 ; xmm4=ROH*FIX(0.500) @@ -402,31 +380,31 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm5,SCALEBITS ; xmm5=CrOH packssdw xmm7,xmm5 ; xmm7=CrO - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE + movdqa xmm3, xmm8 ; xmm3=RE - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 + movdqa xmm4,xmm10 + punpcklwd xmm10,xmm2 punpckhwd xmm4,xmm2 - movdqa xmm1,xmm6 + movdqa xmm1,xmm10 movdqa xmm5,xmm4 - pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm10,[rel PW_F0114_F0250] ; xmm10=BEL*FIX(0.114)+GEL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) pmaddwd xmm1,[rel PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(6)] - paddd xmm4, XMMWORD [wk(7)] - paddd xmm6,xmm2 + paddd xmm10, xmm0 + paddd xmm4, xmm15 + paddd xmm10,xmm2 paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm10,SCALEBITS ; xmm10=YEL psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + packssdw xmm10,xmm4 ; xmm10=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [rdi], xmm6 ; Save Y + psllw xmm11,BYTE_BIT + por xmm10,xmm11 ; xmm10=Y + movdqa XMMWORD [rdi], xmm10 ; Save Y pxor xmm2,xmm2 pxor xmm4,xmm4 @@ -475,9 +453,6 @@ EXTN(jsimd_rgb_ycc_convert_sse2): .return: pop rbx uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jcgryext-sse2-64.asm b/simd/jcgryext-sse2-64.asm index 5af02e04..e399be9c 100644 --- a/simd/jcgryext-sse2-64.asm +++ b/simd/jcgryext-sse2-64.asm @@ -3,7 +3,7 @@ ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. -; Copyright (C) 2011, D. R. Commander. +; Copyright (C) 2011, 2014, D. R. Commander. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), @@ -32,21 +32,11 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 - align 16 global EXTN(jsimd_rgb_gray_convert_sse2) EXTN(jsimd_rgb_gray_convert_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] collect_args push rbx @@ -284,7 +274,7 @@ EXTN(jsimd_rgb_gray_convert_sse2): pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) movdqa xmm6,xmm0 punpcklwd xmm0,xmm2 @@ -292,47 +282,41 @@ EXTN(jsimd_rgb_gray_convert_sse2): pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) - - movdqa xmm0, xmm5 ; xmm0=BO - movdqa xmm6, xmm4 ; xmm6=BE - - movdqa xmm4,xmm0 - punpcklwd xmm0,xmm3 - punpckhwd xmm4,xmm3 - pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) + movdqa xmm12,xmm5 + punpcklwd xmm5,xmm3 + punpckhwd xmm12,xmm3 + pmaddwd xmm5,[rel PW_F0114_F0250] ; xmm5=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm12,[rel PW_F0114_F0250] ; xmm12=BOH*FIX(0.114)+GOH*FIX(0.250) movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm0, xmm1 - paddd xmm4, xmm7 - paddd xmm0,xmm3 - paddd xmm4,xmm3 - psrld xmm0,SCALEBITS ; xmm0=YOL - psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm0,xmm4 ; xmm0=YO + paddd xmm5, xmm1 + paddd xmm12, xmm7 + paddd xmm5,xmm3 + paddd xmm12,xmm3 + psrld xmm5,SCALEBITS ; xmm5=YOL + psrld xmm12,SCALEBITS ; xmm12=YOH + packssdw xmm5,xmm12 ; xmm5=YO - movdqa xmm4,xmm6 - punpcklwd xmm6,xmm2 - punpckhwd xmm4,xmm2 - pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) + movdqa xmm12,xmm4 + punpcklwd xmm4,xmm2 + punpckhwd xmm12,xmm2 + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm12,[rel PW_F0114_F0250] ; xmm12=BEH*FIX(0.114)+GEH*FIX(0.250) movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm6, XMMWORD [wk(0)] - paddd xmm4, XMMWORD [wk(1)] - paddd xmm6,xmm2 + paddd xmm4,xmm0 ; xmm4=REL*FIX(0.299)+GEL*FIX(0.337) + paddd xmm12,xmm6 ; xmm12=REH*FIX(0.299)+GEH*FIX(0.337) paddd xmm4,xmm2 - psrld xmm6,SCALEBITS ; xmm6=YEL - psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm6,xmm4 ; xmm6=YE + paddd xmm12,xmm2 + psrld xmm4,SCALEBITS ; xmm4=YEL + psrld xmm12,SCALEBITS ; xmm12=YEH + packssdw xmm4,xmm12 ; xmm4=YE - psllw xmm0,BYTE_BIT - por xmm6,xmm0 ; xmm6=Y - movdqa XMMWORD [rdi], xmm6 ; Save Y + psllw xmm5,BYTE_BIT + por xmm4,xmm5 ; xmm4=Y + movdqa XMMWORD [rdi], xmm4 ; Save Y sub rcx, byte SIZEOF_XMMWORD add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr @@ -354,9 +338,6 @@ EXTN(jsimd_rgb_gray_convert_sse2): .return: pop rbx uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jfdctfst-sse2-64.asm b/simd/jfdctfst-sse2-64.asm index 13c4efc0..0e2bd90d 100644 --- a/simd/jfdctfst-sse2-64.asm +++ b/simd/jfdctfst-sse2-64.asm @@ -2,7 +2,7 @@ ; jfdctfst.asm - fast integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB -; Copyright 2009 D. R. Commander +; Copyright 2009, 2014, D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -76,315 +76,273 @@ PW_F1306 times 8 dw F_1_306 << CONST_SHIFT ; r10 = DCTELEM * data -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 2 - align 16 global EXTN(jsimd_fdct_ifast_sse2) EXTN(jsimd_fdct_ifast_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] collect_args ; ---- Pass 1: process rows. mov rdx, r10 ; (DCTELEM *) - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm8, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm9, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm11, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm4, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm13, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm15, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + ; xmm8=(00 01 02 03 04 05 06 07), xmm9=(10 11 12 13 14 15 16 17) + ; xmm2=(20 21 22 23 24 25 26 27), xmm11=(30 31 32 33 34 35 36 37) + ; xmm4=(40 41 42 43 44 45 46 47), xmm13=(50 51 52 53 54 55 56 57) + ; xmm5=(60 61 62 63 64 65 66 67), xmm15=(70 71 72 73 74 75 76 77) - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + movdqa xmm12,xmm8 ; transpose coefficients(phase 1) + punpcklwd xmm8,xmm9 ; xmm8=(00 10 01 11 02 12 03 13) + punpckhwd xmm12,xmm9 ; xmm12=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm11 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm1,xmm11 ; xmm1=(24 34 25 35 26 36 27 37) - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm13 ; xmm4=(40 50 41 51 42 52 43 53) + punpckhwd xmm0,xmm13 ; xmm0=(44 54 45 55 46 56 47 57) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm15 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm3,xmm15 ; xmm3=(64 74 65 75 66 76 67 77) - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) + movdqa xmm10,xmm8 ; transpose coefficients(phase 2) + punpckldq xmm8,xmm2 ; xmm8=(00 10 20 30 01 11 21 31) + punpckhdq xmm10,xmm2 ; xmm10=(02 12 22 32 03 13 23 33) + movdqa xmm14,xmm12 ; transpose coefficients(phase 2) + punpckldq xmm12,xmm1 ; xmm12=(04 14 24 34 05 15 25 35) + punpckhdq xmm14,xmm1 ; xmm14=(06 16 26 36 07 17 27 37) + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(40 50 60 70 41 51 61 71) + punpckhdq xmm6,xmm5 ; xmm6=(42 52 62 72 43 53 63 73) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + punpckldq xmm0,xmm3 ; xmm0=(44 54 64 74 45 55 65 75) + punpckhdq xmm7,xmm3 ; xmm7=(46 56 66 76 47 57 67 77) - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm9,xmm8 ; transpose coefficients(phase 3) + punpcklqdq xmm8,xmm4 ; xmm8=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm9,xmm4 ; xmm9=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm11,xmm10 ; transpose coefficients(phase 3) + punpcklqdq xmm10,xmm6 ; xmm10=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm11,xmm6 ; xmm11=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + movdqa xmm13,xmm12 ; transpose coefficients(phase 3) + punpcklqdq xmm12,xmm0 ; xmm12=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm13,xmm0 ; xmm13=(05 15 25 35 45 55 65 75)=data5 + movdqa xmm15,xmm14 ; transpose coefficients(phase 3) + punpcklqdq xmm14,xmm7 ; xmm14=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm15,xmm7 ; xmm15=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + movdqa xmm0,xmm8 + paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 + movdqa xmm1,xmm9 + paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 + movdqa xmm2,xmm10 + paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 + movdqa xmm3,xmm11 + paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 + psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 + psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 + psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - psubw xmm3,xmm1 ; xmm3=tmp13 - psubw xmm6,xmm7 ; xmm6=tmp12 - paddw xmm4,xmm1 ; xmm4=tmp10 - paddw xmm0,xmm7 ; xmm0=tmp11 + movdqa xmm4,xmm0 + paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 + movdqa xmm5,xmm1 + paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 + psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 + psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 - paddw xmm6,xmm3 - psllw xmm6,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm6,[rel PW_F0707] ; xmm6=z1 + paddw xmm1,xmm0 ; xmm1=tmp12+tmp13 + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[rel PW_F0707] ; xmm1=z1 - movdqa xmm1,xmm4 - movdqa xmm7,xmm3 - psubw xmm4,xmm0 ; xmm4=data4 - psubw xmm3,xmm6 ; xmm3=data6 - paddw xmm1,xmm0 ; xmm1=data0 - paddw xmm7,xmm6 ; xmm7=data2 - - movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 + movdqa xmm12,xmm4 + paddw xmm12,xmm5 ; xmm12=tmp10+tmp11=out0 + movdqa xmm14,xmm0 + paddw xmm14,xmm1 ; xmm14=tmp13+z1=out2 + psubw xmm4,xmm5 ; xmm4=tmp10-tmp11=out4 + psubw xmm0,xmm1 ; xmm0=tmp13-z1=out6 ; -- Odd part - paddw xmm2,xmm5 ; xmm2=tmp10 - paddw xmm5,xmm0 ; xmm5=tmp11 - paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 + paddw xmm11,xmm10 ; xmm11=tmp4+tmp5=tmp10 + paddw xmm10,xmm9 ; xmm10=tmp5+tmp6=tmp11 + paddw xmm9,xmm8 ; xmm9=tmp6+tmp7=tmp12 - psllw xmm2,PRE_MULTIPLY_SCALE_BITS - psllw xmm0,PRE_MULTIPLY_SCALE_BITS + psllw xmm11,PRE_MULTIPLY_SCALE_BITS + psllw xmm10,PRE_MULTIPLY_SCALE_BITS + psllw xmm9,PRE_MULTIPLY_SCALE_BITS - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[rel PW_F0707] ; xmm5=z3 + movdqa xmm5,xmm11 + psubw xmm5,xmm9 ; xmm5=tmp10-tmp12 + pmulhw xmm5,[rel PW_F0382] ; xmm5=z5 - movdqa xmm4,xmm2 ; xmm4=tmp10 - psubw xmm2,xmm0 - pmulhw xmm2,[rel PW_F0382] ; xmm2=z5 - pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm0,[rel PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm2 ; xmm4=z2 - paddw xmm0,xmm2 ; xmm0=z4 + pmulhw xmm11,[rel PW_F0541] ; xmm11=MULTIPLY(tmp10,FIX_0_541196) + paddw xmm11,xmm5 ; +z5=z2 - movdqa xmm3,xmm6 - psubw xmm6,xmm5 ; xmm6=z13 - paddw xmm3,xmm5 ; xmm3=z11 + pmulhw xmm9,[rel PW_F1306] ; xmm9=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm9,xmm5 ; +z5=z4 - movdqa xmm2,xmm6 - movdqa xmm5,xmm3 - psubw xmm6,xmm4 ; xmm6=data3 - psubw xmm3,xmm0 ; xmm3=data7 - paddw xmm2,xmm4 ; xmm2=data5 - paddw xmm5,xmm0 ; xmm5=data1 + pmulhw xmm10,[rel PW_F0707] ; xmm10=MULTIPLY(tmp11,FIX_1_306562)=z3 + + movdqa xmm1,xmm8 + paddw xmm1,xmm10 ; xmm1=tmp7+z3=z11 + psubw xmm8,xmm10 ; xmm8=tmp7-z3=z13 + + movdqa xmm13,xmm8 + paddw xmm13,xmm11 ; xmm13=z13+z2=out5 + movdqa xmm15,xmm1 + psubw xmm15,xmm9 ; xmm15=z11-z4=out7 + paddw xmm9,xmm1 ; xmm9=z11+z4=out1 + psubw xmm8,xmm11 ; xmm8=z13-z2=out3 ; ---- Pass 2: process columns. - ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) - ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) + ; Re-order registers so we can reuse the same transpose code + movdqa xmm11,xmm8 + movdqa xmm8,xmm12 + movdqa xmm2,xmm14 + movdqa xmm5,xmm0 - movdqa xmm4,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) - punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) - movdqa xmm0,xmm7 ; transpose coefficients(phase 1) - punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) - punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) + ; xmm8=(00 10 20 30 40 50 60 70), xmm9=(01 11 21 31 41 51 61 71) + ; xmm2=(02 12 22 32 42 52 62 72), xmm11=(03 13 23 33 43 53 63 73) + ; xmm4=(04 14 24 34 44 54 64 74), xmm13=(05 15 25 35 45 55 65 75) + ; xmm5=(06 16 26 36 46 56 66 76), xmm15=(07 17 27 37 47 57 67 77) - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 - movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 + movdqa xmm12,xmm8 ; transpose coefficients(phase 1) + punpcklwd xmm8,xmm9 ; xmm8=(00 01 10 11 20 21 30 31) + punpckhwd xmm12,xmm9 ; xmm12=(40 41 50 51 60 61 70 71) + movdqa xmm1,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm11 ; xmm2=(02 03 12 13 22 23 32 33) + punpckhwd xmm1,xmm11 ; xmm1=(42 43 52 53 62 63 72 73) - ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) - ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm13 ; xmm4=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm13 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm15 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm15 ; xmm3=(46 47 56 57 66 67 76 77) - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) + movdqa xmm10,xmm8 ; transpose coefficients(phase 2) + punpckldq xmm8,xmm2 ; xmm8=(00 01 02 03 10 11 12 13) + punpckhdq xmm10,xmm2 ; xmm10=(20 21 22 23 30 31 32 33) + movdqa xmm14,xmm12 ; transpose coefficients(phase 2) + punpckldq xmm12,xmm1 ; xmm12=(40 41 42 43 50 51 52 53) + punpckhdq xmm14,xmm1 ; xmm14=(60 61 62 63 70 71 72 73) - movdqa xmm7,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) - punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) - movdqa xmm0,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) - punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 05 06 07 14 15 16 17) + punpckhdq xmm6,xmm5 ; xmm6=(24 25 26 27 34 35 36 37) + movdqa xmm7,xmm0 ; transpose coefficients(phase 2) + punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) + punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) - movdqa xmm2,xmm5 ; transpose coefficients(phase 2) - punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) - punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) - movdqa xmm3,xmm7 ; transpose coefficients(phase 2) - punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) - punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) + movdqa xmm9,xmm8 ; transpose coefficients(phase 3) + punpcklqdq xmm8,xmm4 ; xmm8=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm9,xmm4 ; xmm9=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm11,xmm10 ; transpose coefficients(phase 3) + punpcklqdq xmm10,xmm6 ; xmm10=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm11,xmm6 ; xmm11=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) + movdqa xmm13,xmm12 ; transpose coefficients(phase 3) + punpcklqdq xmm12,xmm0 ; xmm12=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm13,xmm0 ; xmm13=(50 51 52 53 54 55 56 57)=data5 + movdqa xmm15,xmm14 ; transpose coefficients(phase 3) + punpcklqdq xmm14,xmm7 ; xmm14=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm15,xmm7 ; xmm15=(70 71 72 73 74 75 76 77)=data7 - movdqa xmm2,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) - punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) - movdqa xmm7,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) - punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) + movdqa xmm0,xmm8 + paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 + movdqa xmm1,xmm9 + paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 + movdqa xmm2,xmm10 + paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 + movdqa xmm3,xmm11 + paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm0,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 - - movdqa xmm5,xmm6 - movdqa xmm3,xmm1 - psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 - psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 - paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 - paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 - - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) - movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 - - movdqa xmm6,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm1,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 - - movdqa xmm7,xmm6 - movdqa xmm0,xmm2 - paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 - paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 - psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 - psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 + psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 + psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 + psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 + psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm1,xmm5 - psubw xmm3,xmm6 ; xmm3=tmp13 - psubw xmm5,xmm2 ; xmm5=tmp12 - paddw xmm4,xmm6 ; xmm4=tmp10 - paddw xmm1,xmm2 ; xmm1=tmp11 + movdqa xmm4,xmm0 + paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 + movdqa xmm5,xmm1 + paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 + psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 + psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 - paddw xmm5,xmm3 - psllw xmm5,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm5,[rel PW_F0707] ; xmm5=z1 + paddw xmm1,xmm0 ; xmm1=tmp12+tmp13 + psllw xmm1,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm1,[rel PW_F0707] ; xmm1=z1 - movdqa xmm6,xmm4 - movdqa xmm2,xmm3 - psubw xmm4,xmm1 ; xmm4=data4 - psubw xmm3,xmm5 ; xmm3=data6 - paddw xmm6,xmm1 ; xmm6=data0 - paddw xmm2,xmm5 ; xmm2=data2 - - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 + movdqa xmm12,xmm4 + paddw xmm12,xmm5 ; xmm12=tmp10+tmp11=out0 + movdqa xmm14,xmm0 + paddw xmm14,xmm1 ; xmm14=tmp13+z1=out2 + psubw xmm4,xmm5 ; xmm4=tmp10-tmp11=out4 + psubw xmm0,xmm1 ; xmm0=tmp13-z1=out6 ; -- Odd part - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + paddw xmm11,xmm10 ; xmm11=tmp4+tmp5=tmp10 + paddw xmm10,xmm9 ; xmm10=tmp5+tmp6=tmp11 + paddw xmm9,xmm8 ; xmm9=tmp6+tmp7=tmp12 - paddw xmm7,xmm0 ; xmm7=tmp10 - paddw xmm0,xmm1 ; xmm0=tmp11 - paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 + psllw xmm11,PRE_MULTIPLY_SCALE_BITS + psllw xmm10,PRE_MULTIPLY_SCALE_BITS + psllw xmm9,PRE_MULTIPLY_SCALE_BITS - psllw xmm7,PRE_MULTIPLY_SCALE_BITS - psllw xmm1,PRE_MULTIPLY_SCALE_BITS + movdqa xmm5,xmm11 + psubw xmm5,xmm9 ; xmm5=tmp10-tmp12 + pmulhw xmm5,[rel PW_F0382] ; xmm5=z5 - psllw xmm0,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm0,[rel PW_F0707] ; xmm0=z3 + pmulhw xmm11,[rel PW_F0541] ; xmm11=MULTIPLY(tmp10,FIX_0_541196) + paddw xmm11,xmm5 ; +z5=z2 - movdqa xmm4,xmm7 ; xmm4=tmp10 - psubw xmm7,xmm1 - pmulhw xmm7,[rel PW_F0382] ; xmm7=z5 - pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) - pmulhw xmm1,[rel PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm4,xmm7 ; xmm4=z2 - paddw xmm1,xmm7 ; xmm1=z4 + pmulhw xmm9,[rel PW_F1306] ; xmm9=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm9,xmm5 ; +z5=z4 - movdqa xmm3,xmm5 - psubw xmm5,xmm0 ; xmm5=z13 - paddw xmm3,xmm0 ; xmm3=z11 + pmulhw xmm10,[rel PW_F0707] ; xmm10=MULTIPLY(tmp11,FIX_1_306562)=z3 - movdqa xmm6,xmm5 - movdqa xmm2,xmm3 - psubw xmm5,xmm4 ; xmm5=data3 - psubw xmm3,xmm1 ; xmm3=data7 - paddw xmm6,xmm4 ; xmm6=data5 - paddw xmm2,xmm1 ; xmm2=data1 + movdqa xmm1,xmm8 + paddw xmm1,xmm10 ; xmm1=tmp7+z3=z11 + psubw xmm8,xmm10 ; xmm8=tmp7-z3=z13 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm5 - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm3 - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2 + movdqa xmm13,xmm8 + paddw xmm13,xmm11 ; xmm13=z13+z2=out5 + movdqa xmm15,xmm1 + psubw xmm15,xmm9 ; xmm15=z11-z4=out7 + paddw xmm9,xmm1 ; xmm9=z11+z4=out1 + psubw xmm8,xmm11 ; xmm8=z13-z2=out3 + + ; -- Write result + + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm12 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm9 + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm14 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm8 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm13 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm0 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jfdctint-sse2-64.asm b/simd/jfdctint-sse2-64.asm index 53ec5276..6a7c0028 100644 --- a/simd/jfdctint-sse2-64.asm +++ b/simd/jfdctint-sse2-64.asm @@ -2,7 +2,7 @@ ; jfdctint.asm - accurate integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB -; Copyright 2009 D. R. Commander +; Copyright 2009, 2014, D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -97,174 +97,140 @@ PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) ; r10 = DCTELEM * data -%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] -%define WK_NUM 6 - align 16 global EXTN(jsimd_fdct_islow_sse2) EXTN(jsimd_fdct_islow_sse2): - push rbp - mov rax,rsp ; rax = original rbp - sub rsp, byte 4 - and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits - mov [rsp],rax - mov rbp,rsp ; rbp = aligned rbp - lea rsp, [wk(0)] collect_args ; ---- Pass 1: process rows. mov rdx, r10 ; (DCTELEM *) - movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm8, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm9, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm11, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm4, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm13, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm5, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm15, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) - ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) + ; xmm8=(00 01 02 03 04 05 06 07), xmm9=(10 11 12 13 14 15 16 17) + ; xmm2=(20 21 22 23 24 25 26 27), xmm11=(30 31 32 33 34 35 36 37) + ; xmm4=(40 41 42 43 44 45 46 47), xmm13=(50 51 52 53 54 55 56 57) + ; xmm5=(60 61 62 63 64 65 66 67), xmm15=(70 71 72 73 74 75 76 77) - movdqa xmm4,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) - punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) - movdqa xmm5,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) + movdqa xmm12,xmm8 ; transpose coefficients(phase 1) + punpcklwd xmm8,xmm9 ; xmm8=(00 10 01 11 02 12 03 13) + punpckhwd xmm12,xmm9 ; xmm12=(04 14 05 15 06 16 07 17) + movdqa xmm1,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm11 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm1,xmm11 ; xmm1=(24 34 25 35 26 36 27 37) - movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm13 ; xmm4=(40 50 41 51 42 52 43 53) + punpckhwd xmm0,xmm13 ; xmm0=(44 54 45 55 46 56 47 57) + movdqa xmm3,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm15 ; xmm5=(60 70 61 71 62 72 63 73) + punpckhwd xmm3,xmm15 ; xmm3=(64 74 65 75 66 76 67 77) - ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) - ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) - - movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) - movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) - - movdqa xmm2,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) - punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) - movdqa xmm5,xmm1 ; transpose coefficients(phase 1) - punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) - punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) - - movdqa xmm7,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) - punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) - movdqa xmm3,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) - punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) - - movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) - movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) - movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) + movdqa xmm10,xmm8 ; transpose coefficients(phase 2) + punpckldq xmm8,xmm2 ; xmm8=(00 10 20 30 01 11 21 31) + punpckhdq xmm10,xmm2 ; xmm10=(02 12 22 32 03 13 23 33) + movdqa xmm14,xmm12 ; transpose coefficients(phase 2) + punpckldq xmm12,xmm1 ; xmm12=(04 14 24 34 05 15 25 35) + punpckhdq xmm14,xmm1 ; xmm14=(06 16 26 36 07 17 27 37) + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(40 50 60 70 41 51 61 71) + punpckhdq xmm6,xmm5 ; xmm6=(42 52 62 72 43 53 63 73) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) - punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) - movdqa xmm2,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) - punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) + punpckldq xmm0,xmm3 ; xmm0=(44 54 64 74 45 55 65 75) + punpckhdq xmm7,xmm3 ; xmm7=(46 56 66 76 47 57 67 77) - movdqa xmm1,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm5,xmm2 ; transpose coefficients(phase 3) - punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm9,xmm8 ; transpose coefficients(phase 3) + punpcklqdq xmm8,xmm4 ; xmm8=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm9,xmm4 ; xmm9=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm11,xmm10 ; transpose coefficients(phase 3) + punpcklqdq xmm10,xmm6 ; xmm10=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm11,xmm6 ; xmm11=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm6,xmm1 - movdqa xmm3,xmm0 - psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 - psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 - paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 - paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 + movdqa xmm13,xmm12 ; transpose coefficients(phase 3) + punpcklqdq xmm12,xmm0 ; xmm12=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm13,xmm0 ; xmm13=(05 15 25 35 45 55 65 75)=data5 + movdqa xmm15,xmm14 ; transpose coefficients(phase 3) + punpcklqdq xmm14,xmm7 ; xmm14=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm15,xmm7 ; xmm15=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) - movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) - movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 + movdqa xmm0,xmm8 + paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 + movdqa xmm1,xmm9 + paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 + movdqa xmm2,xmm10 + paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 + movdqa xmm3,xmm11 + paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 - movdqa xmm1,xmm7 ; transpose coefficients(phase 3) - punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 - movdqa xmm0,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 - - movdqa xmm2,xmm1 - movdqa xmm5,xmm7 - paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 - paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 - psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 - psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 + psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 + psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 + psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 + psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 ; -- Even part - movdqa xmm4,xmm3 - movdqa xmm0,xmm6 - paddw xmm3,xmm1 ; xmm3=tmp10 - paddw xmm6,xmm7 ; xmm6=tmp11 - psubw xmm4,xmm1 ; xmm4=tmp13 - psubw xmm0,xmm7 ; xmm0=tmp12 + movdqa xmm4,xmm0 + paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 + movdqa xmm5,xmm1 + paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 + psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 + psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 - movdqa xmm1,xmm3 - paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 - psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 + movdqa xmm12,xmm4 + paddw xmm12,xmm5 ; xmm12=tmp10+tmp11 + psubw xmm4,xmm5 ; xmm4=tmp10-tmp11 - psllw xmm3,PASS1_BITS ; xmm3=data0 - psllw xmm1,PASS1_BITS ; xmm1=data4 - - movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 - movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 + psllw xmm12,PASS1_BITS ; xmm12=out0 + psllw xmm4,PASS1_BITS ; xmm4=out4 ; (Original) ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; + ; out2 = z1 + tmp13 * 0.765366865; + ; out6 = z1 + tmp12 * -1.847759065; ; ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; out2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; out6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movdqa xmm7,xmm4 ; xmm4=tmp13 - movdqa xmm6,xmm4 - punpcklwd xmm7,xmm0 ; xmm0=tmp12 - punpckhwd xmm6,xmm0 - movdqa xmm4,xmm7 + movdqa xmm2,xmm0 ; xmm0=tmp13 + movdqa xmm6,xmm0 + punpcklwd xmm2,xmm1 ; xmm1=tmp12 + punpckhwd xmm6,xmm1 + movdqa xmm5,xmm2 movdqa xmm0,xmm6 - pmaddwd xmm7,[rel PW_F130_F054] ; xmm7=data2L - pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=data2H - pmaddwd xmm4,[rel PW_F054_MF130] ; xmm4=data6L - pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=data6H + pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=out2L + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=out2H + pmaddwd xmm5,[rel PW_F054_MF130] ; xmm5=out6L + pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=out6H - paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm2,[rel PD_DESCALE_P1] paddd xmm6,[rel PD_DESCALE_P1] - psrad xmm7,DESCALE_P1 + psrad xmm2,DESCALE_P1 psrad xmm6,DESCALE_P1 - paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm5,[rel PD_DESCALE_P1] paddd xmm0,[rel PD_DESCALE_P1] - psrad xmm4,DESCALE_P1 + psrad xmm5,DESCALE_P1 psrad xmm0,DESCALE_P1 - packssdw xmm7,xmm6 ; xmm7=data2 - packssdw xmm4,xmm0 ; xmm4=data6 - - movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 - movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 + packssdw xmm2,xmm6 ; xmm2=out2 + packssdw xmm5,xmm0 ; xmm5=out6 ; -- Odd part - movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 - movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 - - movdqa xmm6,xmm2 ; xmm2=tmp4 - movdqa xmm0,xmm5 ; xmm5=tmp5 - paddw xmm6,xmm3 ; xmm6=z3 - paddw xmm0,xmm1 ; xmm0=z4 + movdqa xmm6,xmm11 ; xmm11=tmp4 + movdqa xmm0,xmm10 ; xmm10=tmp5 + paddw xmm6,xmm9 ; xmm6=tmp4+tmp6=z3 + paddw xmm0,xmm8 ; xmm0=tmp5+tmp7=z4 ; (Original) ; z5 = (z3 + z4) * 1.175875602; @@ -276,239 +242,211 @@ EXTN(jsimd_fdct_islow_sse2): ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); movdqa xmm7,xmm6 - movdqa xmm4,xmm6 + movdqa xmm14,xmm6 punpcklwd xmm7,xmm0 - punpckhwd xmm4,xmm0 + punpckhwd xmm14,xmm0 movdqa xmm6,xmm7 - movdqa xmm0,xmm4 + movdqa xmm0,xmm14 pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L - pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3H + pmaddwd xmm14,[rel PW_MF078_F117] ; xmm14=z3H pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H - movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H - ; (Original) ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; out7 = tmp4 + z1 + z3; out5 = tmp5 + z2 + z4; + ; out3 = tmp6 + z2 + z3; out1 = tmp7 + z1 + z4; ; ; (This implementation) ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; + ; out7 = tmp4 + z3; out5 = tmp5 + z4; + ; out3 = tmp6 + z3; out1 = tmp7 + z4; - movdqa xmm7,xmm2 - movdqa xmm4,xmm2 - punpcklwd xmm7,xmm1 - punpckhwd xmm4,xmm1 - movdqa xmm2,xmm7 - movdqa xmm1,xmm4 - pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp4L - pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4H - pmaddwd xmm2,[rel PW_MF089_F060] ; xmm2=tmp7L + movdqa xmm15,xmm11 ; xmm11=tmp4 + movdqa xmm13,xmm11 + punpcklwd xmm15,xmm8 ; xmm8=tmp7 + punpckhwd xmm13,xmm8 + movdqa xmm8,xmm15 + movdqa xmm1,xmm13 + pmaddwd xmm15,[rel PW_MF060_MF089] ; xmm15=tmp4L + pmaddwd xmm13,[rel PW_MF060_MF089] ; xmm13=tmp4H + pmaddwd xmm8,[rel PW_MF089_F060] ; xmm8=tmp7L pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H - paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L - paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H - paddd xmm2,xmm6 ; xmm2=data1L - paddd xmm1,xmm0 ; xmm1=data1H + paddd xmm15,xmm7 ; xmm15=out7L + paddd xmm13,xmm14 ; xmm13=out7H + paddd xmm8,xmm6 ; xmm8=out1L + paddd xmm1,xmm0 ; xmm1=out1H - paddd xmm7,[rel PD_DESCALE_P1] - paddd xmm4,[rel PD_DESCALE_P1] - psrad xmm7,DESCALE_P1 - psrad xmm4,DESCALE_P1 - paddd xmm2,[rel PD_DESCALE_P1] + paddd xmm15,[rel PD_DESCALE_P1] + paddd xmm13,[rel PD_DESCALE_P1] + psrad xmm15,DESCALE_P1 + psrad xmm13,DESCALE_P1 + paddd xmm8,[rel PD_DESCALE_P1] paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm2,DESCALE_P1 + psrad xmm8,DESCALE_P1 psrad xmm1,DESCALE_P1 - packssdw xmm7,xmm4 ; xmm7=data7 - packssdw xmm2,xmm1 ; xmm2=data1 + packssdw xmm15,xmm13 ; xmm15=out7 + packssdw xmm8,xmm1 ; xmm8=out1 - movdqa xmm4,xmm5 - movdqa xmm1,xmm5 - punpcklwd xmm4,xmm3 - punpckhwd xmm1,xmm3 - movdqa xmm5,xmm4 + movdqa xmm13,xmm10 ; xmm10=tmp5 + movdqa xmm1,xmm10 + punpcklwd xmm13,xmm9 ; xmm9=tmp6 + punpckhwd xmm1,xmm9 + movdqa xmm11,xmm13 movdqa xmm3,xmm1 - pmaddwd xmm4,[rel PW_MF050_MF256] ; xmm4=tmp5L + pmaddwd xmm13,[rel PW_MF050_MF256] ; xmm13=tmp5L pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H - pmaddwd xmm5,[rel PW_MF256_F050] ; xmm5=tmp6L + pmaddwd xmm11,[rel PW_MF256_F050] ; xmm11=tmp6L pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H - paddd xmm4,xmm6 ; xmm4=data5L - paddd xmm1,xmm0 ; xmm1=data5H - paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L - paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H + paddd xmm13,xmm6 ; xmm13=out5L + paddd xmm1,xmm0 ; xmm1=out5H + paddd xmm11,xmm7 ; xmm11=out3L + paddd xmm3,xmm14 ; xmm3=out3H - paddd xmm4,[rel PD_DESCALE_P1] + paddd xmm13,[rel PD_DESCALE_P1] paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm4,DESCALE_P1 + psrad xmm13,DESCALE_P1 psrad xmm1,DESCALE_P1 - paddd xmm5,[rel PD_DESCALE_P1] + paddd xmm11,[rel PD_DESCALE_P1] paddd xmm3,[rel PD_DESCALE_P1] - psrad xmm5,DESCALE_P1 + psrad xmm11,DESCALE_P1 psrad xmm3,DESCALE_P1 - packssdw xmm4,xmm1 ; xmm4=data5 - packssdw xmm5,xmm3 ; xmm5=data3 + packssdw xmm13,xmm1 ; xmm13=out5 + packssdw xmm11,xmm3 ; xmm11=out3 ; ---- Pass 2: process columns. - movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 - movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 + ; Re-order registers so we can reuse the same transpose code + movdqa xmm9,xmm8 + movdqa xmm8,xmm12 - ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) - ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) + ; xmm8=(00 10 20 30 40 50 60 70), xmm9=(01 11 21 31 41 51 61 71) + ; xmm2=(02 12 22 32 42 52 62 72), xmm11=(03 13 23 33 43 53 63 73) + ; xmm4=(04 14 24 34 44 54 64 74), xmm13=(05 15 25 35 45 55 65 75) + ; xmm5=(06 16 26 36 46 56 66 76), xmm15=(07 17 27 37 47 57 67 77) - movdqa xmm1,xmm6 ; transpose coefficients(phase 1) - punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) - punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) - movdqa xmm3,xmm0 ; transpose coefficients(phase 1) - punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) - punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) + movdqa xmm12,xmm8 ; transpose coefficients(phase 1) + punpcklwd xmm8,xmm9 ; xmm8=(00 01 10 11 20 21 30 31) + punpckhwd xmm12,xmm9 ; xmm12=(40 41 50 51 60 61 70 71) + movdqa xmm1,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm11 ; xmm2=(02 03 12 13 22 23 32 33) + punpckhwd xmm1,xmm11 ; xmm1=(42 43 52 53 62 63 72 73) - movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 - movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 - - ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) - ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) - - movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) - movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) - - movdqa xmm0,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) - punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm4 ; transpose coefficients(phase 1) + punpcklwd xmm4,xmm13 ; xmm4=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm13 ; xmm0=(44 45 54 55 64 65 74 75) movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) - punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) + punpcklwd xmm5,xmm15 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm15 ; xmm3=(46 47 56 57 66 67 76 77) - movdqa xmm4,xmm2 ; transpose coefficients(phase 2) - punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) - punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) + movdqa xmm10,xmm8 ; transpose coefficients(phase 2) + punpckldq xmm8,xmm2 ; xmm8=(00 01 02 03 10 11 12 13) + punpckhdq xmm10,xmm2 ; xmm10=(20 21 22 23 30 31 32 33) + movdqa xmm14,xmm12 ; transpose coefficients(phase 2) + punpckldq xmm12,xmm1 ; xmm12=(40 41 42 43 50 51 52 53) + punpckhdq xmm14,xmm1 ; xmm14=(60 61 62 63 70 71 72 73) + + movdqa xmm6,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 05 06 07 14 15 16 17) + punpckhdq xmm6,xmm5 ; xmm6=(24 25 26 27 34 35 36 37) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) - movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) - movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) - movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) - movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) + movdqa xmm9,xmm8 ; transpose coefficients(phase 3) + punpcklqdq xmm8,xmm4 ; xmm8=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm9,xmm4 ; xmm9=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm11,xmm10 ; transpose coefficients(phase 3) + punpcklqdq xmm10,xmm6 ; xmm10=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm11,xmm6 ; xmm11=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm4,xmm6 ; transpose coefficients(phase 2) - punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) - punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) - movdqa xmm0,xmm1 ; transpose coefficients(phase 2) - punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) - punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) + movdqa xmm13,xmm12 ; transpose coefficients(phase 3) + punpcklqdq xmm12,xmm0 ; xmm12=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm13,xmm0 ; xmm13=(50 51 52 53 54 55 56 57)=data5 + movdqa xmm15,xmm14 ; transpose coefficients(phase 3) + punpcklqdq xmm14,xmm7 ; xmm14=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm15,xmm7 ; xmm15=(70 71 72 73 74 75 76 77)=data7 - movdqa xmm5,xmm6 ; transpose coefficients(phase 3) - punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm3,xmm0 ; transpose coefficients(phase 3) - punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 + movdqa xmm0,xmm8 + paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 + movdqa xmm1,xmm9 + paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 + movdqa xmm2,xmm10 + paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 + movdqa xmm3,xmm11 + paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 - movdqa xmm2,xmm5 - movdqa xmm7,xmm6 - psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 - psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 - paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 - paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 - - movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) - movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) - movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 - movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 - - movdqa xmm5,xmm4 ; transpose coefficients(phase 3) - punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 - movdqa xmm6,xmm1 ; transpose coefficients(phase 3) - punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 - - movdqa xmm0,xmm5 - movdqa xmm3,xmm4 - paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 - paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 - psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 - psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 + psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 + psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 + psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 + psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 ; -- Even part - movdqa xmm1,xmm7 - movdqa xmm6,xmm2 - paddw xmm7,xmm5 ; xmm7=tmp10 - paddw xmm2,xmm4 ; xmm2=tmp11 - psubw xmm1,xmm5 ; xmm1=tmp13 - psubw xmm6,xmm4 ; xmm6=tmp12 + movdqa xmm4,xmm0 + paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 + movdqa xmm5,xmm1 + paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 + psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 + psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 - movdqa xmm5,xmm7 - paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 - psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 + movdqa xmm12,xmm4 + paddw xmm12,xmm5 ; xmm12=tmp10+tmp11 + psubw xmm4,xmm5 ; xmm4=tmp10-tmp11 - paddw xmm7,[rel PW_DESCALE_P2X] - paddw xmm5,[rel PW_DESCALE_P2X] - psraw xmm7,PASS1_BITS ; xmm7=data0 - psraw xmm5,PASS1_BITS ; xmm5=data4 - - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm7 - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm5 + paddw xmm12,[rel PW_DESCALE_P2X] + paddw xmm4,[rel PW_DESCALE_P2X] + psraw xmm12,PASS1_BITS ; xmm12=out0 + psraw xmm4,PASS1_BITS ; xmm4=out4 ; (Original) ; z1 = (tmp12 + tmp13) * 0.541196100; - ; data2 = z1 + tmp13 * 0.765366865; - ; data6 = z1 + tmp12 * -1.847759065; + ; out2 = z1 + tmp13 * 0.765366865; + ; out6 = z1 + tmp12 * -1.847759065; ; ; (This implementation) - ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; out2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; out6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movdqa xmm4,xmm1 ; xmm1=tmp13 - movdqa xmm2,xmm1 - punpcklwd xmm4,xmm6 ; xmm6=tmp12 - punpckhwd xmm2,xmm6 - movdqa xmm1,xmm4 - movdqa xmm6,xmm2 - pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=data2L - pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=data2H - pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=data6L - pmaddwd xmm6,[rel PW_F054_MF130] ; xmm6=data6H + movdqa xmm2,xmm0 ; xmm0=tmp13 + movdqa xmm6,xmm0 + punpcklwd xmm2,xmm1 ; xmm1=tmp12 + punpckhwd xmm6,xmm1 + movdqa xmm5,xmm2 + movdqa xmm0,xmm6 + pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=out2L + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=out2H + pmaddwd xmm5,[rel PW_F054_MF130] ; xmm5=out6L + pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=out6H - paddd xmm4,[rel PD_DESCALE_P2] paddd xmm2,[rel PD_DESCALE_P2] - psrad xmm4,DESCALE_P2 - psrad xmm2,DESCALE_P2 - paddd xmm1,[rel PD_DESCALE_P2] paddd xmm6,[rel PD_DESCALE_P2] - psrad xmm1,DESCALE_P2 + psrad xmm2,DESCALE_P2 psrad xmm6,DESCALE_P2 + paddd xmm5,[rel PD_DESCALE_P2] + paddd xmm0,[rel PD_DESCALE_P2] + psrad xmm5,DESCALE_P2 + psrad xmm0,DESCALE_P2 - packssdw xmm4,xmm2 ; xmm4=data2 - packssdw xmm1,xmm6 ; xmm1=data6 - - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm1 + packssdw xmm2,xmm6 ; xmm2=out2 + packssdw xmm5,xmm0 ; xmm5=out6 ; -- Odd part - movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 - movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - - movdqa xmm2,xmm0 ; xmm0=tmp4 - movdqa xmm6,xmm3 ; xmm3=tmp5 - paddw xmm2,xmm7 ; xmm2=z3 - paddw xmm6,xmm5 ; xmm6=z4 + movdqa xmm6,xmm11 ; xmm11=tmp4 + movdqa xmm0,xmm10 ; xmm10=tmp5 + paddw xmm6,xmm9 ; xmm6=tmp4+tmp6=z3 + paddw xmm0,xmm8 ; xmm0=tmp5+tmp7=z4 ; (Original) ; z5 = (z3 + z4) * 1.175875602; @@ -519,102 +457,101 @@ EXTN(jsimd_fdct_islow_sse2): ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm4,xmm2 - movdqa xmm1,xmm2 - punpcklwd xmm4,xmm6 - punpckhwd xmm1,xmm6 - movdqa xmm2,xmm4 - movdqa xmm6,xmm1 - pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3L - pmaddwd xmm1,[rel PW_MF078_F117] ; xmm1=z3H - pmaddwd xmm2,[rel PW_F117_F078] ; xmm2=z4L - pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4H - - movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L - movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H + movdqa xmm7,xmm6 + movdqa xmm14,xmm6 + punpcklwd xmm7,xmm0 + punpckhwd xmm14,xmm0 + movdqa xmm6,xmm7 + movdqa xmm0,xmm14 + pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L + pmaddwd xmm14,[rel PW_MF078_F117] ; xmm14=z3H + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L + pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H ; (Original) ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; - ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; + ; out7 = tmp4 + z1 + z3; out5 = tmp5 + z2 + z4; + ; out3 = tmp6 + z2 + z3; out1 = tmp7 + z1 + z4; ; ; (This implementation) ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; data7 = tmp4 + z3; data5 = tmp5 + z4; - ; data3 = tmp6 + z3; data1 = tmp7 + z4; + ; out7 = tmp4 + z3; out5 = tmp5 + z4; + ; out3 = tmp6 + z3; out1 = tmp7 + z4; - movdqa xmm4,xmm0 - movdqa xmm1,xmm0 - punpcklwd xmm4,xmm5 - punpckhwd xmm1,xmm5 - movdqa xmm0,xmm4 - movdqa xmm5,xmm1 - pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4L - pmaddwd xmm1,[rel PW_MF060_MF089] ; xmm1=tmp4H - pmaddwd xmm0,[rel PW_MF089_F060] ; xmm0=tmp7L - pmaddwd xmm5,[rel PW_MF089_F060] ; xmm5=tmp7H + movdqa xmm15,xmm11 ; xmm11=tmp4 + movdqa xmm13,xmm11 + punpcklwd xmm15,xmm8 ; xmm8=tmp7 + punpckhwd xmm13,xmm8 + movdqa xmm8,xmm15 + movdqa xmm1,xmm13 + pmaddwd xmm15,[rel PW_MF060_MF089] ; xmm15=tmp4L + pmaddwd xmm13,[rel PW_MF060_MF089] ; xmm13=tmp4H + pmaddwd xmm8,[rel PW_MF089_F060] ; xmm8=tmp7L + pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H - paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L - paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H - paddd xmm0,xmm2 ; xmm0=data1L - paddd xmm5,xmm6 ; xmm5=data1H + paddd xmm15,xmm7 ; xmm15=out7L + paddd xmm13,xmm14 ; xmm13=out7H + paddd xmm8,xmm6 ; xmm8=out1L + paddd xmm1,xmm0 ; xmm1=out1H - paddd xmm4,[rel PD_DESCALE_P2] + paddd xmm15,[rel PD_DESCALE_P2] + paddd xmm13,[rel PD_DESCALE_P2] + psrad xmm15,DESCALE_P2 + psrad xmm13,DESCALE_P2 + paddd xmm8,[rel PD_DESCALE_P2] paddd xmm1,[rel PD_DESCALE_P2] - psrad xmm4,DESCALE_P2 + psrad xmm8,DESCALE_P2 psrad xmm1,DESCALE_P2 - paddd xmm0,[rel PD_DESCALE_P2] - paddd xmm5,[rel PD_DESCALE_P2] - psrad xmm0,DESCALE_P2 - psrad xmm5,DESCALE_P2 - packssdw xmm4,xmm1 ; xmm4=data7 - packssdw xmm0,xmm5 ; xmm0=data1 + packssdw xmm15,xmm13 ; xmm15=out7 + packssdw xmm8,xmm1 ; xmm8=out1 - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm0 - - movdqa xmm1,xmm3 - movdqa xmm5,xmm3 - punpcklwd xmm1,xmm7 - punpckhwd xmm5,xmm7 + movdqa xmm13,xmm10 ; xmm10=tmp5 + movdqa xmm1,xmm10 + punpcklwd xmm13,xmm9 ; xmm9=tmp6 + punpckhwd xmm1,xmm9 + movdqa xmm11,xmm13 movdqa xmm3,xmm1 - movdqa xmm7,xmm5 - pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5L - pmaddwd xmm5,[rel PW_MF050_MF256] ; xmm5=tmp5H - pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6L - pmaddwd xmm7,[rel PW_MF256_F050] ; xmm7=tmp6H + pmaddwd xmm13,[rel PW_MF050_MF256] ; xmm13=tmp5L + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H + pmaddwd xmm11,[rel PW_MF256_F050] ; xmm11=tmp6L + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H - paddd xmm1,xmm2 ; xmm1=data5L - paddd xmm5,xmm6 ; xmm5=data5H - paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L - paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H + paddd xmm13,xmm6 ; xmm13=out5L + paddd xmm1,xmm0 ; xmm1=out5H + paddd xmm11,xmm7 ; xmm11=out3L + paddd xmm3,xmm14 ; xmm3=out3H + paddd xmm13,[rel PD_DESCALE_P2] paddd xmm1,[rel PD_DESCALE_P2] - paddd xmm5,[rel PD_DESCALE_P2] + psrad xmm13,DESCALE_P2 psrad xmm1,DESCALE_P2 - psrad xmm5,DESCALE_P2 + paddd xmm11,[rel PD_DESCALE_P2] paddd xmm3,[rel PD_DESCALE_P2] - paddd xmm7,[rel PD_DESCALE_P2] + psrad xmm11,DESCALE_P2 psrad xmm3,DESCALE_P2 - psrad xmm7,DESCALE_P2 - packssdw xmm1,xmm5 ; xmm1=data5 - packssdw xmm3,xmm7 ; xmm3=data3 + packssdw xmm13,xmm1 ; xmm13=out5 + packssdw xmm11,xmm3 ; xmm11=out3 - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3 + ; -- Write result + + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm12 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm8 + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm11 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm13 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 uncollect_args - mov rsp,rbp ; rsp <- aligned rbp - pop rsp ; rsp <- original rbp - pop rbp ret ; For some reason, the OS X linker does not honor the request to align the From 3c50582e77a96a4d7d3c48d39ea62aeeb81c67e4 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 9 Aug 2014 22:58:18 +0000 Subject: [PATCH 944/985] Oops. The Windows version of collect_args/uncollect_args uses rsp, so we still need the rsp prologue/epilogue, despite the fact that we aren't using the stack as a work area. This fixes a segfault on Windows caused by r1335. --- simd/jccolext-sse2-64.asm | 4 ++++ simd/jcgryext-sse2-64.asm | 4 ++++ simd/jfdctfst-sse2-64.asm | 4 ++++ simd/jfdctint-sse2-64.asm | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/simd/jccolext-sse2-64.asm b/simd/jccolext-sse2-64.asm index 5dbdc273..079953ac 100644 --- a/simd/jccolext-sse2-64.asm +++ b/simd/jccolext-sse2-64.asm @@ -37,6 +37,9 @@ global EXTN(jsimd_rgb_ycc_convert_sse2) EXTN(jsimd_rgb_ycc_convert_sse2): + push rbp + mov rax,rsp + mov rbp,rsp collect_args push rbx @@ -453,6 +456,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2): .return: pop rbx uncollect_args + pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jcgryext-sse2-64.asm b/simd/jcgryext-sse2-64.asm index e399be9c..abdd9a06 100644 --- a/simd/jcgryext-sse2-64.asm +++ b/simd/jcgryext-sse2-64.asm @@ -37,6 +37,9 @@ global EXTN(jsimd_rgb_gray_convert_sse2) EXTN(jsimd_rgb_gray_convert_sse2): + push rbp + mov rax,rsp + mov rbp,rsp collect_args push rbx @@ -338,6 +341,7 @@ EXTN(jsimd_rgb_gray_convert_sse2): .return: pop rbx uncollect_args + pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jfdctfst-sse2-64.asm b/simd/jfdctfst-sse2-64.asm index 0e2bd90d..fe87fccd 100644 --- a/simd/jfdctfst-sse2-64.asm +++ b/simd/jfdctfst-sse2-64.asm @@ -80,6 +80,9 @@ PW_F1306 times 8 dw F_1_306 << CONST_SHIFT global EXTN(jsimd_fdct_ifast_sse2) EXTN(jsimd_fdct_ifast_sse2): + push rbp + mov rax,rsp + mov rbp,rsp collect_args ; ---- Pass 1: process rows. @@ -343,6 +346,7 @@ EXTN(jsimd_fdct_ifast_sse2): movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 uncollect_args + pop rbp ret ; For some reason, the OS X linker does not honor the request to align the diff --git a/simd/jfdctint-sse2-64.asm b/simd/jfdctint-sse2-64.asm index 6a7c0028..996a53b3 100644 --- a/simd/jfdctint-sse2-64.asm +++ b/simd/jfdctint-sse2-64.asm @@ -101,6 +101,9 @@ PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) global EXTN(jsimd_fdct_islow_sse2) EXTN(jsimd_fdct_islow_sse2): + push rbp + mov rax,rsp + mov rbp,rsp collect_args ; ---- Pass 1: process rows. @@ -552,6 +555,7 @@ EXTN(jsimd_fdct_islow_sse2): movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 uncollect_args + pop rbp ret ; For some reason, the OS X linker does not honor the request to align the From ceb4712807fefe2658a0c1b6938081105c13760a Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 9 Aug 2014 23:06:07 +0000 Subject: [PATCH 945/985] 12-bit JPEG support --- CMakeLists.txt | 455 ++++++++++++++++++++++---------------- ChangeLog.txt | 7 + Makefile.am | 114 +++++++--- configure.ac | 26 ++- jcdctmgr.c | 66 +++++- jconfig.h.in | 11 + jdct.h | 1 - jmorecfg.h | 12 - sharedlib/CMakeLists.txt | 20 +- testimages/testorig12.jpg | Bin 0 -> 12394 bytes win/jconfig.h.in | 11 + 11 files changed, 482 insertions(+), 241 deletions(-) create mode 100644 testimages/testorig12.jpg diff --git a/CMakeLists.txt b/CMakeLists.txt index 42cb70af..c34f45eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,20 @@ option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) +option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test programs" TRUE) option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE) +option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_SIMD=0 WITH_TURBOJPEG=0 WITH_ARITH_ENC=0 WITH_ARITH_DEC=0)" FALSE) + +if(WITH_12BIT) + set(WITH_SIMD FALSE) + set(WITH_TURBOJPEG FALSE) + set(WITH_ARITH_ENC FALSE) + set(WITH_ARITH_DEC FALSE) + set(BITS_IN_JSAMPLE 12) + message(STATUS "12-bit JPEG support enabled") +else() + set(BITS_IN_JSAMPLE 8) +endif() if(WITH_ARITH_ENC) set(C_ARITH_CODING_SUPPORTED 1) @@ -66,6 +79,12 @@ else() message(STATUS "Arithmetic decoding support disabled") endif() +if(WITH_TURBOJPEG) + message(STATUS "TurboJPEG C wrapper enabled") +else() + message(STATUS "TurboJPEG C wrapper disabled") +endif() + if(WITH_JAVA) message(STATUS "TurboJPEG Java wrapper enabled") else() @@ -209,57 +228,65 @@ if(WITH_SIMD) add_dependencies(jpeg-static simd) endif() -set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) -if(WITH_JAVA) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) - include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) +if(WITH_TURBOJPEG) + set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) + if(WITH_JAVA) + set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) + include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) + endif() + + add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) + set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) + if(MINGW) + set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) + endif() + target_link_libraries(turbojpeg jpeg-static) + set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") + + add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} + turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) + if(NOT MSVC) + set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) + endif() + if(WITH_SIMD) + add_dependencies(turbojpeg-static simd) + endif() + + add_executable(tjunittest tjunittest.c tjutil.c) + target_link_libraries(tjunittest turbojpeg) + + add_executable(tjunittest-static tjunittest.c tjutil.c) + target_link_libraries(tjunittest-static turbojpeg-static) + + add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c + wrppm.c) + target_link_libraries(tjbench turbojpeg jpeg-static) + set_property(TARGET tjbench PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") + + add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c + wrppm.c) + target_link_libraries(tjbench-static turbojpeg-static jpeg-static) + set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS + "-DBMP_SUPPORTED -DPPM_SUPPORTED") endif() -add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) -set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) -if(MINGW) - set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) -endif() -target_link_libraries(turbojpeg jpeg-static) -set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") - -add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} - turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) -if(NOT MSVC) - set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) -endif() -if(WITH_SIMD) - add_dependencies(turbojpeg-static simd) +if(WITH_12BIT) + set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE") +else() + set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") + set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) + set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) endif() -add_executable(tjunittest tjunittest.c tjutil.c) -target_link_libraries(tjunittest turbojpeg) - -add_executable(tjunittest-static tjunittest.c tjutil.c) -target_link_libraries(tjunittest-static turbojpeg-static) - -add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c - wrppm.c) -target_link_libraries(tjbench turbojpeg jpeg-static) -set_property(TARGET tjbench PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - -add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c - wrppm.c) -target_link_libraries(tjbench-static turbojpeg-static jpeg-static) -set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DPPM_SUPPORTED") - -add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c - rdtarga.c) -set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") +add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c + ${CJPEG_BMP_SOURCES}) +set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(cjpeg-static jpeg-static) -add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c - wrppm.c wrtarga.c) -set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") +add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrgif.c + wrppm.c ${DJPEG_BMP_SOURCES}) +set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(djpeg-static jpeg-static) add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) @@ -283,53 +310,85 @@ endif() enable_testing() -set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) -set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) -set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) -set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) -set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) -set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) -set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) -set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) -set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) -set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) -set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) -set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) -set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) -set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) -set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) -set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) -set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) -set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) -if(WITH_SIMD) -set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) -set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) +if(WITH_12BIT) + set(TESTORIG testorig12.jpg) + set(MD5_JPEG_RGB_ISLOW 9620f424569594bb9242b48498ad801f) + set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0) + set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4) + set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950) + set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0) + set(MD5_JPEG_420_IFAST_Q100_PROG a1da220b5604081863a504297ed59e55) + set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e) + set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566) + set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9) + set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca) + set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d) + set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e) + set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8) + set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956) + set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0) + set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb) + set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96) + set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82) + set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c) + set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43) + set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93) + set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd) + set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866) + set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) + set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) + set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) + set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) else() -set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) -set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) + set(TESTORIG testorig.jpg) + set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) + set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) + set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) + set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) + set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) + set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) + set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) + set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) + set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) + set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) + set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) + set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) + set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) + set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) + set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) + set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) + set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) + set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) + if(WITH_SIMD) + set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) + set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) + else() + set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) + set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) + endif() + set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) + set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) + set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) + set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) + set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) + set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) + set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) + set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) + set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) + set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) + set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) + set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) + set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) + set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) + set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) + set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) + set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) + set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) + set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) + set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) + set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) + set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) endif() -set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) -set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) -set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) -set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) -set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) -set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) -set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) -set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) -set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) -set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) -set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) -set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) -set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) -set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) -set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) -set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) -set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) -set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) -set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) -set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) -set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e) -set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) if(WITH_JAVA) add_test(TJUnitTest @@ -365,11 +424,13 @@ foreach(libtype shared static) set(dir "") set(suffix -static) endif() - add_test(tjunittest${suffix} tjunittest${suffix}) - add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) - add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) - add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) - add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) + if(WITH_TURBOJPEG) + add_test(tjunittest${suffix} tjunittest${suffix}) + add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) + add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) + add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) + add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) + endif() # These tests are carefully chosen to provide full coverage of as many of the # underlying algorithms as possible (including all of the SIMD-accelerated @@ -389,22 +450,24 @@ foreach(libtype shared static) add_test(djpeg${suffix}-rgb-islow-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-rgb-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) - add_test(djpeg${suffix}-rgb-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} - -DFILE=testout_rgb_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-rgb-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) - add_test(djpeg${suffix}-rgb-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} - -DFILE=testout_rgb_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + if(NOT WITH_12BIT) + # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} + -DFILE=testout_rgb_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-rgb-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) + add_test(djpeg${suffix}-rgb-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} + -DFILE=testout_rgb_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff add_test(cjpeg${suffix}-422-ifast-opt @@ -429,22 +492,24 @@ foreach(libtype shared static) add_test(djpeg${suffix}-422m-ifast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff - add_test(djpeg${suffix}-422m-ifast-565 - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp - -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) - add_test(djpeg${suffix}-422m-ifast-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} - -DFILE=testout_422m_ifast_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff - add_test(djpeg${suffix}-422m-ifast-565D - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp - -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) - add_test(djpeg${suffix}-422m-ifast-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} - -DFILE=testout_422m_ifast_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + if(NOT WITH_12BIT) + # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast-565 + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp + -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} + -DFILE=testout_422m_ifast_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff + add_test(djpeg${suffix}-422m-ifast-565D + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp + -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) + add_test(djpeg${suffix}-422m-ifast-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} + -DFILE=testout_422m_ifast_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff add_test(cjpeg${suffix}-420-q100-ifast-prog @@ -496,22 +561,24 @@ foreach(libtype shared static) ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW_RGB} -DFILE=testout_gray_islow_rgb.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-gray-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) - add_test(djpeg${suffix}-gray-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} - -DFILE=testout_gray_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff - add_test(djpeg${suffix}-gray-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) - add_test(djpeg${suffix}-gray-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} - -DFILE=testout_gray_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + if(NOT WITH_12BIT) + # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} + -DFILE=testout_gray_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff + add_test(djpeg${suffix}-gray-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) + add_test(djpeg${suffix}-gray-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} + -DFILE=testout_gray_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff @@ -610,62 +677,63 @@ foreach(libtype shared static) add_test(djpeg${suffix}-420m-islow-${scale} ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm -outfile testout_420m_islow_${scale}.ppm - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) add_test(djpeg${suffix}-420m-islow-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} -DFILE=testout_420m_islow_${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) endforeach() - # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-256 - ${dir}djpeg${suffix} -dct int -colors 256 -bmp - -outfile testout_420_islow_256.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-256-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} - -DFILE=testout_420_islow_256.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-565 - ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp - -outfile testout_420_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} - -DFILE=testout_420_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - add_test(djpeg${suffix}-420-islow-565D - ${dir}djpeg${suffix} -dct int -rgb565 -bmp - -outfile testout_420_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} - -DFILE=testout_420_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff - add_test(djpeg${suffix}-420m-islow-565 - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp - -outfile testout_420m_islow_565.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420m-islow-565-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} - -DFILE=testout_420m_islow_565.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff - add_test(djpeg${suffix}-420m-islow-565D - ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp - -outfile testout_420m_islow_565D.bmp - ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) - add_test(djpeg${suffix}-420m-islow-565D-cmp - ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} - -DFILE=testout_420m_islow_565D.bmp - -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) - + if(NOT WITH_12BIT) + # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-256 + ${dir}djpeg${suffix} -dct int -colors 256 -bmp + -outfile testout_420_islow_256.bmp + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420-islow-256-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} + -DFILE=testout_420_islow_256.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-565 + ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp + -outfile testout_420_islow_565.bmp + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} + -DFILE=testout_420_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff + add_test(djpeg${suffix}-420-islow-565D + ${dir}djpeg${suffix} -dct int -rgb565 -bmp + -outfile testout_420_islow_565D.bmp + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} + -DFILE=testout_420_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff + add_test(djpeg${suffix}-420m-islow-565 + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp + -outfile testout_420m_islow_565.bmp + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420m-islow-565-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} + -DFILE=testout_420m_islow_565.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff + add_test(djpeg${suffix}-420m-islow-565D + ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp + -outfile testout_420m_islow_565D.bmp + ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) + add_test(djpeg${suffix}-420m-islow-565D-cmp + ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} + -DFILE=testout_420m_islow_565D.bmp + -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) + endif() add_test(jpegtran${suffix}-crop ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect - -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) + -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) add_test(jpegtran${suffix}-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) @@ -721,7 +789,10 @@ add_custom_target(installer cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} SOURCES libjpeg-turbo.nsi) -install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench +if(WITH_TURBOJPEG) + set(TURBOJPEG_TARGETS turbojpeg turbojpeg-static tjbench) +endif() +install(TARGETS jpeg-static rdjpgcom wrjpgcom ${TURBOJPEG_TARGETS} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin diff --git a/ChangeLog.txt b/ChangeLog.txt index b6901336..a4632547 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -80,6 +80,13 @@ incorrect JPEG files. [12] Fixed a bug in the build system that was causing the Windows version of wrjpgcom to be built using the rdjpgcom code. +[13] Restored 12-bit-per-component JPEG support. A 12-bit version of +libjpeg-turbo can now be built by passing an argument of --with-12bit to +configure (Unix) or -DWITH_12BIT=1 to cmake (Windows.) 12-bit JPEG support is +included only for convenience. Enabling this feature disables all of the +performance features in libjpeg-turbo, as well as arithmetic coding and the +TurboJPEG API. The resulting library behaves no differently than libjpeg v6b. + 1.3.1 ===== diff --git a/Makefile.am b/Makefile.am index cee54eb3..dad69dfb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -108,21 +108,34 @@ tjunittest_LDADD = libturbojpeg.la endif -cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \ - rdppm.c rdswitch.c rdtarga.c +cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdgif.c rdppm.c rdswitch.c +if WITH_12BIT +else +cjpeg_SOURCES += rdbmp.c rdtarga.c +endif cjpeg_LDADD = libjpeg.la -cjpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ - -DTARGA_SUPPORTED +cjpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED +if WITH_12BIT +else +cjpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED +endif djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \ - wrbmp.c wrgif.c wrppm.c wrtarga.c + wrgif.c wrppm.c +if WITH_12BIT +else +djpeg_SOURCES += wrbmp.c wrtarga.c +endif djpeg_LDADD = libjpeg.la -djpeg_CFLAGS = -DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED \ - -DTARGA_SUPPORTED +djpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED +if WITH_12BIT +else +djpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED +endif jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c transupp.h @@ -163,6 +176,40 @@ dist-hook: SUBDIRS += md5 +if WITH_12BIT + +TESTORIG = testorig12.jpg +MD5_JPEG_RGB_ISLOW = 9620f424569594bb9242b48498ad801f +MD5_PPM_RGB_ISLOW = f3301d2219783b8b3d942b7239fa50c0 +MD5_JPEG_422_IFAST_OPT = 7322e3bd2f127f7de4b40d4480ce60e4 +MD5_PPM_422_IFAST = 79807fa552899e66a04708f533e16950 +MD5_PPM_422M_IFAST = 07737bfe8a7c1c87aaa393a0098d16b0 +MD5_JPEG_420_IFAST_Q100_PROG = a1da220b5604081863a504297ed59e55 +MD5_PPM_420_Q100_IFAST = 1b3730122709f53d007255e8dfd3305e +MD5_PPM_420M_Q100_IFAST = 980a1a3c5bf9510022869d30b7d26566 +MD5_JPEG_GRAY_ISLOW = 235c90707b16e2e069f37c888b2636d9 +MD5_PPM_GRAY_ISLOW = 7213c10af507ad467da5578ca5ee1fca +MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d +MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e +MD5_JPEG_3x2_FLOAT_PROG = a8c17daf77b457725ec929e215b603f8 +MD5_PPM_3x2_FLOAT = 42876ab9e5c2f76a87d08db5fbd57956 +MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0 +MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb +MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96 +MD5_PPM_420M_ISLOW_11_8 = 800a16f9f4dc9b293197bfe11be10a82 +MD5_PPM_420M_ISLOW_9_8 = 06b7a92a9bc69f4dc36ec40f1937d55c +MD5_PPM_420M_ISLOW_7_8 = 3ec444a14a4ab4eab88ffc49c48eca43 +MD5_PPM_420M_ISLOW_3_4 = 3e726b7ea872445b19437d1c1d4f0d93 +MD5_PPM_420M_ISLOW_5_8 = a8a771abdc94301d20ffac119b2caccd +MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866 +MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8 +MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb +MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7 +MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c + +else + +TESTORIG = testorig.jpg MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291 MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be @@ -212,6 +259,8 @@ MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d +endif + test: testclean all if WITH_TURBOJPEG @@ -241,6 +290,9 @@ endif ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm rm testout_rgb_islow.ppm +if WITH_12BIT + rm testout_rgb_islow.jpg +else # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp @@ -249,6 +301,7 @@ endif ./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp rm testout_rgb_islow_565D.bmp testout_rgb_islow.jpg +endif # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm @@ -261,6 +314,9 @@ endif ./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm rm testout_422m_ifast.ppm +if WITH_12BIT + rm testout_422_ifast_opt.jpg +else # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp @@ -269,6 +325,7 @@ endif ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp rm testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg +endif # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff ./cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm @@ -293,6 +350,9 @@ endif ./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm rm testout_gray_islow_rgb.ppm +if WITH_12BIT + rm testout_gray_islow.jpg +else # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp @@ -301,6 +361,7 @@ endif ./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp rm testout_gray_islow_565D.bmp testout_gray_islow.jpg +endif # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # ENT: 2-pass huff @@ -340,75 +401,78 @@ if WITH_ARITH_DEC endif # CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff - ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm rm testout_420m_islow_2_1.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff - ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm rm testout_420m_islow_15_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff - ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm rm testout_420m_islow_13_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff - ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm rm testout_420m_islow_11_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff - ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm rm testout_420m_islow_9_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff - ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm rm testout_420m_islow_7_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff - ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm rm testout_420m_islow_3_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff - ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm rm testout_420m_islow_5_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff - ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm rm testout_420m_islow_1_2.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff - ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm rm testout_420m_islow_3_8.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff - ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm rm testout_420m_islow_1_4.ppm # CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff - ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm rm testout_420m_islow_1_8.ppm +if WITH_12BIT +else # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp rm testout_420_islow_256.bmp # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp rm testout_420_islow_565.bmp # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff - ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp rm testout_420_islow_565D.bmp # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff - ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp rm testout_420m_islow_565.bmp # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff - ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/testorig.jpg + ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp rm testout_420m_islow_565D.bmp +endif - ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/testorig.jpg + ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG) md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg rm testout_crop.jpg diff --git a/configure.ac b/configure.ac index d2de1852..64f32655 100644 --- a/configure.ac +++ b/configure.ac @@ -269,6 +269,9 @@ AC_MSG_CHECKING([whether to include arithmetic encoding support]) AC_ARG_WITH([arith-enc], AC_HELP_STRING([--without-arith-enc], [Do not include arithmetic encoding support])) +if test "x$with_12bit" = "xyes"; then + with_arith_enc=no +fi if test "x$with_arith_enc" = "xno"; then AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc" @@ -282,6 +285,9 @@ AC_MSG_CHECKING([whether to include arithmetic decoding support]) AC_ARG_WITH([arith-dec], AC_HELP_STRING([--without-arith-dec], [Do not include arithmetic decoding support])) +if test "x$with_12bit" = "xyes"; then + with_arith_dec=no +fi if test "x$with_arith_dec" = "xno"; then AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec" @@ -294,11 +300,26 @@ AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"]) AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"]) +# 12-bit component support +AC_MSG_CHECKING([whether to use 12-bit samples]) +AC_ARG_WITH([12bit], + AC_HELP_STRING([--with-12bit], [Encode/decode JPEG images with 12-bit samples (implies --without-simd --without-turbojpeg --without-arith-dec --without-arith-enc)])) +if test "x$with_12bit" = "xyes"; then + AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12]) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"]) + # TurboJPEG support AC_MSG_CHECKING([whether to build TurboJPEG C wrapper]) AC_ARG_WITH([turbojpeg], AC_HELP_STRING([--without-turbojpeg], [Do not include the TurboJPEG wrapper library and associated test programs])) +if test "x$with_12bit" = "xyes"; then + with_turbojpeg=no +fi if test "x$with_turbojpeg" = "xno"; then AC_MSG_RESULT(no) RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg" @@ -330,7 +351,7 @@ AC_ARG_VAR(JNI_CFLAGS, AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper]) AC_ARG_WITH([java], AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library])) -if test "x$with_turbojpeg" = "xno"; then +if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then with_java=no fi @@ -391,6 +412,9 @@ fi # SIMD is optional AC_ARG_WITH([simd], AC_HELP_STRING([--without-simd], [Do not include SIMD extensions])) +if test "x$with_12bit" = "xyes"; then + with_simd=no +fi if test "x${with_simd}" != "xno"; then require_simd=no if test "x${with_simd}" = "xyes"; then diff --git a/jcdctmgr.c b/jcdctmgr.c index 2d256590..78935729 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -6,7 +6,7 @@ * libjpeg-turbo Modifications: * Copyright (C) 1999-2006, MIYASAKA Masaru. * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2011 D. R. Commander + * Copyright (C) 2011, 2014 D. R. Commander * For conditions of distribution and use, see the accompanying README file. * * This file contains the forward-DCT management logic. @@ -72,9 +72,12 @@ typedef struct { typedef my_fdct_controller * my_fdct_ptr; +#if BITS_IN_JSAMPLE == 8 + /* * Find the highest bit in an integer through binary search. */ + LOCAL(int) flss (UINT16 val) { @@ -105,6 +108,7 @@ flss (UINT16 val) return bit; } + /* * Compute values to do a division using reciprocal. * @@ -163,6 +167,7 @@ flss (UINT16 val) * of in a consecutive manner, yet again in order to allow SIMD * routines. */ + LOCAL(int) compute_reciprocal (UINT16 divisor, DCTELEM * dtbl) { @@ -197,6 +202,9 @@ compute_reciprocal (UINT16 divisor, DCTELEM * dtbl) else return 1; } +#endif + + /* * Initialize for a processing pass. * Verify that all referenced Q-tables are present, and set up @@ -238,9 +246,13 @@ start_pass_fdctmgr (j_compress_ptr cinfo) } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { +#if BITS_IN_JSAMPLE == 8 if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]) && fdct->quantize == jsimd_quantize) fdct->quantize = quantize; +#else + dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; +#endif } break; #endif @@ -274,12 +286,19 @@ start_pass_fdctmgr (j_compress_ptr cinfo) } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { +#if BITS_IN_JSAMPLE == 8 if(!compute_reciprocal( DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], (INT32) aanscales[i]), CONST_BITS-3), &dtbl[i]) && fdct->quantize == jsimd_quantize) fdct->quantize = quantize; +#else + dtbl[i] = (DCTELEM) + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-3); +#endif } } break; @@ -372,9 +391,12 @@ quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) { int i; DCTELEM temp; + JCOEFPTR output_ptr = coef_block; + +#if BITS_IN_JSAMPLE == 8 + UDCTELEM recip, corr, shift; UDCTELEM2 product; - JCOEFPTR output_ptr = coef_block; for (i = 0; i < DCTSIZE2; i++) { temp = workspace[i]; @@ -393,9 +415,47 @@ quantize (JCOEFPTR coef_block, DCTELEM * divisors, DCTELEM * workspace) product >>= shift + sizeof(DCTELEM)*8; temp = product; } - output_ptr[i] = (JCOEF) temp; } + +#else + + register DCTELEM qval; + + for (i = 0; i < DCTSIZE2; i++) { + qval = divisors[i]; + temp = workspace[i]; + /* Divide the coefficient value by qval, ensuring proper rounding. + * Since C does not specify the direction of rounding for negative + * quotients, we have to force the dividend positive for portability. + * + * In most files, at least half of the output values will be zero + * (at default quantization settings, more like three-quarters...) + * so we should ensure that this case is fast. On many machines, + * a comparison is enough cheaper than a divide to make a special test + * a win. Since both inputs will be nonnegative, we need only test + * for a < b to discover whether a/b is 0. + * If your machine's division is fast enough, define FAST_DIVIDE. + */ +#ifdef FAST_DIVIDE +#define DIVIDE_BY(a,b) a /= b +#else +#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 +#endif + if (temp < 0) { + temp = -temp; + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + temp = -temp; + } else { + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + } + output_ptr[i] = (JCOEF) temp; + } + +#endif + } diff --git a/jconfig.h.in b/jconfig.h.in index cdca01f3..42d86f24 100644 --- a/jconfig.h.in +++ b/jconfig.h.in @@ -12,6 +12,17 @@ /* Support arithmetic decoding */ #undef D_ARITH_CODING_SUPPORTED +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H diff --git a/jdct.h b/jdct.h index c06bf9dc..6f8b1591 100644 --- a/jdct.h +++ b/jdct.h @@ -41,7 +41,6 @@ typedef unsigned int UDCTELEM2; #endif #else typedef INT32 DCTELEM; /* must have 32 bits */ -typedef UINT32 UDCTELEM; typedef unsigned long long UDCTELEM2; #endif diff --git a/jmorecfg.h b/jmorecfg.h index 91fbd15f..36fe9714 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -13,18 +13,6 @@ */ -/* - * Define BITS_IN_JSAMPLE as either - * 8 for 8-bit sample values (the usual setting) - * 12 for 12-bit sample values - * Only 8 and 12 are legal data precisions for lossy JPEG according to the - * JPEG standard, and the IJG code does not support anything else! - * We do not support run-time selection of data precision, sorry. - */ - -#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ - - /* * Maximum number of components (color channels) allowed in JPEG image. * To meet the letter of the JPEG spec, set this to 255. However, darn diff --git a/sharedlib/CMakeLists.txt b/sharedlib/CMakeLists.txt index cd3f2687..d423ccef 100755 --- a/sharedlib/CMakeLists.txt +++ b/sharedlib/CMakeLists.txt @@ -42,16 +42,22 @@ if(WITH_SIMD) add_dependencies(jpeg simd) endif() -add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdbmp.c ../rdgif.c ../rdppm.c - ../rdswitch.c ../rdtarga.c) -set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") +if(WITH_12BIT) + set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE") +else() + set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") + set(CJPEG_BMP_SOURCES ../rdbmp.c ../rdtarga.c) + set(DJPEG_BMP_SOURCES ../wrbmp.c ../wrtarga.c) +endif() + +add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c + ../rdswitch.c ${CJPEG_BMP_SOURCES}) +set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(cjpeg jpeg) add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c - ../wrbmp.c ../wrgif.c ../wrppm.c ../wrtarga.c) -set_property(TARGET djpeg PROPERTY COMPILE_FLAGS - "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") + ../wrgif.c ../wrppm.c ${DJPEG_BMP_SOURCES}) +set_property(TARGET djpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(djpeg jpeg) add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c) diff --git a/testimages/testorig12.jpg b/testimages/testorig12.jpg new file mode 100644 index 0000000000000000000000000000000000000000..861aff98e2a78131bf546b82fd38b00a4f741dd2 GIT binary patch literal 12394 zcmb7~S6GwF7w!`hNT>m%NeKy{2+~DqA)yl+p>9x+qA2QCnsfr8hax1vRzQKMR6zwn z1r-TR2}S85y-P2lCWOG@e{n9(<(cp1d!CtR&D_kI-+JG5^yg?2Ab82*q6Gj51OR}? zAK+*NUWx0YZF$Cx96cP!7N$ z1Oy2Ik6Hi-006+n0s7y0|L@>}K)HE1d4U{YKG5-sYl48|Ul523$_?S-3FHER zAwnEbQEsFrNJQ+Eu?>%~+<9{kzi4pcpSPiSf14(yRQZDMBoO3}jpW?aU9 zMc)VL@@Fpm;~xP2m&2%4u)`Xf&OtUnc2T@zO+5Nk19}@PUrw3xR|H z7{I_RurY#G-?eW{0*zE}5lGLtpLsC{_t-roIdsIsB;BAwOKfYDZ=w9eq&(@0#uj6> zmrfb}&V5nzG`i!P&Yo-c`73Ti`)I}_39@qpxOBO*jB$uvFnS6KJV%XyQdirSw76-OJaM-5FbnH;qzFv#SCiz&f8&kBmkLAz@^vt z)O_MYD9-oC+z>SkpVp|98SE+xQQ0pjp`8}pQ=PivW6uFD$rR_r-q+IoFJ#++UeRcC z3q2Ns7-HRQ{;aFOjWr5M&y5^nDw(|8v7BUv)g@1SQb;+=d_}=vN@`tDA&R^zj=Lr$ zJN`aZd#2qToNh9Pi=5^)RQg^M$nF7O8eTPL!?=ZaIjBNGJ?yM;HHD2Ne+i6HV~@PV zyj@q~Vq*}-e!(T5-xj{fSo-Bi z9|5l9x6V)aW-#|)na;8nkhx! zq>&ufkr<+AMGEnDLC%Ri`9SB2D&fUF;bKu-&}_U#woVC-yqOucD>p2`r+OIfU%t$0 zPB#$Q&|*xOnJ7eh)?Hw~vu96Y)SI{e`tfTgu<2(EFbmN<+shS zeyVNVvYX(vcyNNg9IJ}?plSFQmZ6jOPUY;I;U~A-6lN*5 zV#uoh^HjC)nk?q>C|FY=f#qzCO&Anm0_T0xkj(>PyLt@#h3i(uW;BxDHL%QZ_P0S+ z0b&B#14-Ni3^>%h<7Oj|0D6S}#|d8psi|z5{6=Qgeyal#ZhooPSv)AZ7B{dP3#6u4 zQ{)HsK3sV^dSS<1K67d&QJ}9C>lDr3<2=FXn-Y@NFSdu(#d=GZy{{s3S-#%wR*su+ zci^TkjQ77H^vQyqwvgj@w;Q8^l=hu6jMzlZzxlEgFpOF8} z9W%!{BOFWNuTtkP7Wr5|;b%J!V6$j~vSJx!aPIN0gLn43JI2z$Izjm0h{yu5C=3D+HCDa1==|1dG~zf{!TE5pu>To6p}xKmVf zN;T%XZ)&lg_9yL~hWM!8pNB2u?0PVzDpwJuVr2JFoqfbyOcoO8AGG-$6C9Q7$2vAtRpqM7D z9~O##+cvVAmQ9<^%}>6%dW!Nvq_00O1OJ#qK|vjn>-Z5}s$n~|#uGVdA}mptujziJ z!jr1RjA(xp_TtXPmm9H8GBf)o<6h|qBYYJ7kd*epkZL;AHw*3OqgGdx?1X}SDn_`M zn;lqGhr#>{QF z6%DBu^fyG!r!+P^F-!gOt=^bgLXu@Q&p{h?9=^tQ>9Os?@;L&3vUZKC_aJ$$LEOdZ zLoBxurdtv7g|D{uzOg+PNAjsX56hggdHIuVDfpLhIM#zug@iY2sB?%IHd&UJaRZn1 zutI&UBn0N?5nz*HtrhX~FCD@yd>#zsVg=@!G8>H1)=X3YuF+MfEBjGH8L5Q|lZ?N0 z-&soFyQk|`EnLMDG_i)Wyt6c2Ff+0++1E;Q#xwbQv;!?=FE6mS=W6hdr_1_3@%}v2 zt6fu+8eN? zi=Ks1X;y_fia{zDA099Qe`|KVGyd$bp{D$_(W}nV?=RT77fPP2UW2rR?FjIB?EXf6$r{(e5x|M&Gx?3qT!5_pJpvTn@{D)=^O`(5G3gtf)xH(@ zbP}x}p#ZI>-`kpb@{rDi<;i^-qW+P3CQWkWN5z7sI4Dc9KlfPp$QLN$IxLf6YMfTo z&t>RfJzc)g+W!s?%*aJ;2@U?Y&D>@6hEML^*8glXI;B$$p7dE`Ne=0U{NWz!u_MpL(;Op3;35Z)W5_-`zHH26s|2?LiIokM%T@a7?h*}#oCo79 z-<+La<$br-vC(n6lpj~)sUYjG0$HAZo^whW9F^2JrOh^J1A2lZg~Z)FYg_|*|5 zzCFh@s!>W-MJXXm3eZOaw4#YPuMCKQV_9r`l)kaOA3rNYq2P^p_Z8FWCx;!l62!kS zifX_|uF!*zfay2sBCdfcG3;(Re@w=M-x%eG*(n;-;!pJqLE|f5`S^O@WL1+BHeeZV zJ=4T_jnZ;Wc}8jo68_rXW<0N4*lQ}X*E*;>0Y3t)Ok;f-uC++2ft_C|2N`?iJR0H5 znXy za{04{s@emMC_dEJp>Q~3{L(0)dX#^Aep481NavHX{^VwRFrO+{r9wYA92LHBs#IF& zdWND#dd$%&x*bjup{I^@Qi}$ur z_e5puLIr4Pqs1%E*TbzLkh@_Xr=}=)kowQ-R{_0mjeZYh z@)mdU4o0vcou!6{xPiuTjE$GwUTj>LVlD*hDlLH9tc#48!dNTE8b$50jEGBM$YH&S zYMb2_&~h=-?Tf7C!Xv!@8MeV2T@|fSn(b%%yD_nS<^F8I9+PORXWZt~#(u52#~abGVTh*t=|aiAg2+-qB!-6{?M3pfX-$~QOblN68V=o_wfUhen`Htyw!4x6)O)k%)a}i1mqMMUI7KRqrz@p zc4d#ul()n&=r!aUW6L}VN?d`s^rncIY$Dm=y%>{!mp!p<;=bWkcd=G`ahJ(;1kf0d zgVFAFOU?lN{v6clNSD~tg7D4qGLG2GCs3s_ovzp`crI4geO=6hc< z6sq|lsnB1!U|iEqgT&mz-eJvV2ik-Pm9L-Vtj{m~Rt_Vou5n0)hu-IzrV|g0;@Ev} zkXZ(cOiBD^J`i1oikgeJWE#oYa&74*?%2xD?*JDnjT-3?SjK6zl}T^jxx#$k9mZ>; zk{Kv!r~{Myr(_m-Ex4)git|jT!ceCc_uG;0^sgQ%HU~7AuidYA2>pE`uUSpH`y(FD ziQwpFM4=+>5eIMNpUN-~ztG55-?wIBwdW{>nu?;qj3YpkQinj!gLsM#&7(1mAd;pc zPm{w(D25mMtbRECWHY@Tw=(#S%X}cI<<|v>b4Wb;Chj6`n~ar@Kldg3Z_Yc3cnpoor>S~H;#IeZESxvzXbmYWYQf`gLOt!hhT#@bK!|^{KFYpztBl)&SYjtKz zec4~sBqxSH!i|R%f&mI?Z#DmzgH%T1Jc*iC17ml~PWQ_~K4q=ibox(wMag0im|g!N zxiR(Y4>S+k^@k|=4vmJ^7u)cc^<~kiT=IeeN&s?{nFo zJ*(C}rlV;>dFFx%WMA9BB;{AC-r6}Bwi z_q=%f9-EvGd%q-_zB%_*R<`7$>Z zT=?0|nLYHHuN^5gCn?RmMy)OU!>u13^|B0;FXulU0gAgncGU}WSS}w9DaYsROHcZI z&`6W%Od?P*Z;m-Y{rP|nK|-$|5*Hhm-_=Dz z{+6j(C0!Vvf2VWj?by!M8<3^hnYo2;9UIS^`Qw|$v-`X%Z=S@SI~nS@Z~d_poPrs@yu27; z6@u$!?(s!U!#Mj|DO(}*7DL%x6Sy&3`*5Ktud<|gKIbRZ{leAgM(adfqgo>zsihz> zz27pj>oHp$Fd>^5DtrO?wO+SWB!0^5zTduwH9#RY3VfW_#v0w{aIFD&4k4Q*<4I$6 zBnvYHz~$E)0J0_J@7f;*=jt)lz0A_mGm!eG!fHx~O6V_&t!9Ywji#MPfWRrl4Ttx$*SQ~&eEmgft{nx9K48D;3F?HUjYOVFwN9wn5gLQZlweOE0dy_D)pv!+l5Hi^@(nT8{o;=? z#7LvpAJ27|v6|jl{eqPy#afdy$PV;EPqFq~RyAe+2oR@nzsSXTWuBWWEM3yP$snG% z6EU+W??p{RO&il3?lsg$oVzlAx;-RUXGgjMVI#h)EKxAszAUM(ly^8bE@^KMY3>kr!xPnFSu}g)gCmt1a?{T|yK6HC=zQOy%xZz!)VJ3~38YIFYn?MS!#;I3<3qCP_KYFY~7y|+q@!Prg$@!U8-v6YN6 z!H0s83&&6DcQ+Rieabz?7nGrM3n3)PJPswr6KBZ2>|!4i5s99dUo5Hc!k-*k|3f7= z80!Q*yYcMi-jmz~%8c-{d?C98K?1p-MvI=Wp4Da>Dh~d}j6n;us8qLs<_q@B=a_hD zn54TI08G8VxJ1P=LiOTwQjfV*{cN$x8evf={lY zHQkdJ;;{*xR-3r3*R=Mk4K2}P`Uak#^DC0jb3J7PEQ!}R4qi%)cDD?iOqim=HDd4l$or+a>3r^tPaNrz zt0>2#Y=tz$xy%ltfVzx#(kk)SVHaa2^)K7VOV_eI5I-{}IdU)1&4NL1CZ>-KEhlLX zg*%nU+l18Jio@a>3tk6>AJy7v~r0 z;D6+L8AR5fi5mC8r6W)wQ_H0lGJACwpQsHPTI1{%A>j=qjebn2I$o8jPTSydK}Fb< zA2b)j{r<`-wnTL^C8KjCe;DTfs*42>YTn4-KG5;Kqb3IT2;9EN+ibT)A|yZ?tG;?M z_N7Ci_qJxS>CV@CF5r0NbHu^{Y-69fh$(9&#uVFKk2()KMB%TdwTx13>qlurYL#PP zawe?L`)1@-j^SJXEy)_W$N(1h$#6`>SH$JVZJ(hG_3isVK8F5w`?Y(;RVvVyV6{e% zti*?QKZ<{|RNBuYl%)hDM5E($Dgvi(ob&i#k=1`N zh12DFL0>|@2xy3!nrYpMhUxqWdq2zd^v=guk+rvhEhv_5M&Z8BKv)C*p7&uNbD6L@ z6)ri&o7Q2MoPwbhb{*#@359+363jo(l=d4=sg4q~*lGx&&svfxTcJ{6Xg!%yEEzHG zD}XR;MwsFd=twbfwm_MEXp2Pz1^s587az(2J`d9gBsdv|RXT7T9%JJEt8rlWUNko+ zdbsS=)qe7#{(;xc0F=WXeH= zHCb@*d7^8tz$$w7o-;$QHz$>qC?;I2pyFLJFN(#Liw&up< zQD0)l3<^)M4I`0U_^SE0L&mTBE|3-VnzPH0Q75>I zMpz&G#2wHXeyIpOvbL0Yz4azQpFrtSU~+F$D9+xiQ%y22WQw{Lm%vkCGp=V5>IiWB z!SlV=2Za)3*ZQ&G$c6vRCrrg`W^yGaZjoxYM`m+a1oeJXrMHq{=n51LrOZMvBf8)y zf(G(8oQwoZ7T}I6edbb3!6<|VW1AQeANX!`LtSFyp@JdgWq#9oh^E{-PK0qN`ztz; z{}{2-0M>5;@XiBO9;-@=i|nj=vMmoGp%N=gz6+CK<6~nfZ~O5gL|rU}kd8LlkLKUQ zc72`id)c?#wRZ%#ydLAbauJC#;CaOur@`|hxq!G*+5&Xww=0&Wwe}cXF+0B8yqcuG z;hrzwy6XH!bLbOSfpkCvGj@syMs+BuFK#HVk7X zMbk|#rO&WgQ;noD83ckNYhQym@^0_k@F+X!4xi{(F$x=|D`@YQ((8@@uL*IEypOY) z0$6p3j!LKpGN!PRYOM+TVQ3vQEF$?mM?4-~tl*+uU#fcS5HMS<6Z2j(GZEvJe>WMW zNh2ddhPfQqVt$^8Etpm2O)!GoPeTgrM&Q`Fdzc~1k(ER;4SUC9u6lB(Q);Z^{71fI z|JkIO>>s(Tk2VMsb#*e=O@9gD2l(v?bszPtD(1fvO+Y*D_#~RrH-Gs{T}3lc)>T930Z>fEqKxv>;zzCPUa#*R zjz~NxLS+J1d=?@s$@aRw!TC6dcV@ZD<65_R9{IiuM!O#_z#+gBXWVq&cAqFwnby9P zt4Bcq8#p2WWI5e1r%>MS;ZZtCII{C;R*(XU@6%sn|8d>e&_DQP9-PjM0~7 zKb|G^iLkfxY!REPN7u=lf?9iuW3bKSe|PB^|5?JBcfh`xRzRn7{PCTX1_dcG`7MLX ze#?qhd6OtI=r{%8rLTKICS%sh!2PHVN(jnp2g1#{%po3k;Jq#zOc)aJ4-2Odk}W#= zPN-^$?Vavnt;|F&%b=%g*=Bh5Z?>z&xKAu^TYZGo>YflxM^{Gxp%-F;p76bYZjCEq zy=1pJx-$hIk15)27Cfxoh>_hsBGi2{Hr-(RI{K#ZXCTHi}wFKs9QSz7CLh&FtH z^4%25SCEaK`q3WQ`9b2>WNJ+7xuF()8H8~&B9?W++G$TjsLcOTa!7*efr5fq_vcEb z8QeztZ!#pOj~P_A%p`J8mKwI#x@M^VH8{Yx)F|!<@YwQ= z1ELX8h9acSomLY|>`7wSuiSzjdpo|tnpYyHU2?RD>&dvzi%(eaAcrdp5CJE;vKp4dv_hiq372{mVZKhdVOrF~5Y) zeq1W@e{}wQQ&2DrgQAqejsOU^2f81Ex;FPlw`L(ee#m=?;#mWm41bkJ{}@a@05I40 zIQjDhErPjw>)v{F#0rNWAO{po)K4+>s6Qqa_YzHqo@cH!tO7by(d|33WQ1|UBxTG; zCoSISi9jb;uQUTMYx8%jsq`Q5P=QJ-k5cEoxEpeWgMx-l!C$V-QjSR(D_1l{diZLCytvz=vQc^F&^cGZYk?I)bdr@n)DR@b zUQQGw7c}?%us?|CaSjB=#R|5UurKwGjl-XPo^R$w(8^=0 z$1{{q_)pu#kkMz?9-=7^pt4&$UkUc7y=v^qhgVaNMHt^Bz+0{hY(cW@ziKS+_$DnL z9e<`9ZcGaCBk1gH2DENM()c+#4kBpNA{t`+eac?>#Aj;Hw2$0bWMf2n4_Da{05?JS zqSxneVtc@@pBiwfN9mLd4$(*l`u6hNJm1)Ct+W--eIJa)-gGP0?>m^(c}gSrU-P+5 zylsCkWG@93wI<=yIw;6?xpz%DEQBa(w&s*tKI|a(NdBM5yJ4mj5+vQO`HAGq%Vk6? z1QsIT(|?kUHvU$so+}Thy9*Y>w7}4}HGwf^J}Y&1bs@ijLot+osLpG;jM1@?bkH!h z9m1&21itA0m4K@kgewlMF1-MikAwb8I0B3dIi62I(F~j6DShHS@(B9clT7{AjB>EQ`mTjRS zY&A}l3Yx*c4#r7X3`;ZGxd+zt?^Wi1tC^gNJZWW=(!hkoprC^Nihaw(c+0X7NF13y z(}zRUldQ(*LIq`@s7O&d*4wK8`^nv1cWey}$yv2FRjeAJ==e}!#xS)4)77?~ z&w5?Z_plYdw#@E!!(b4dvcJKW0{c@$KvxPe=L{Pg7JOfj=%743SqipKi6UZ}#{@Nh z2SgFp$3(wS8S5VozUIXklo)4A55Xw1J-c!Hdt?N;bxG9NbzrPHcz}C3=0%y%$EO{m zm6UY35*kSc@w8vvyCnf1kw-EwQ+1z42W^nmUGvMFcHJBx5$Z+jdmubfgHo!Xk0~w5 zRcvkU_7a{-e8M(U=lhaY^F_ZPDpY=CmA+5-IwSyn;$E^HLD`74_nP0wAdJFri-*1m z0erq9lV$H;OA_5ad|H0FweELU;F!ARq|bq-xM!)i*6c<_!aalBh|`_1Ed++q8#UgY zP*{`s{Vim^^dB!^y~&F~o)?q8LWpnfrq-Wc3KzL(9Racq{s{W?1Gf$R*`_0GkKf?) z5Z-3`7de*h$!M7ESF#k&k6L{eM?7Ig?XU5N`t_Q)_x$irLU%Xx}wdTht zj8**wV>R?G)B7PlSgM#?PBZN`^97}+?=W$YmDR+9uB@gBo7+oIN@v~Zsl+M$5?Yt! z_(hTZY>!uCkZF9s3=pX}Sw|&nDO{i;lnGp@v0snps&o(yVdnzso z^2p*!mO#<^%{?=fyJnH;p|Yilqp-cl``d9bgdMt5!L5{~&x38C-R-WW)NAE-9}T~s z(`Qkx<=Z|IQ?rQ(e_?XNKL5-U;}*(uYO7`h8M%JNr@G=qRR$N?nPb-k%xa zP}TYqf;V_~3;7u#Fj|{AvTGc7cOb9j`4hWk(tvhI8A!%HD+Q!PXuD%to`x@vS~51x zX^}p+wL4Z4N*xf(Bp>AdcKs#We}pU*=8+PH3lY$VEQxpZP>)wE_8k3Pu-h-Rjk?qRlZ?2F%P8<^PESmcWU^x-z^xUT=>QNT|%hZ^iEaVCIs(~CZ`Fs0aJmvH^ zkwBbt(8)s_&&_M<*J;-xE_3MYCd`U=yTy!7Kq;3+@E#sM%LoOT&pq`9p8RzBk1;E* zWqV7^--`svJu9)86()Fo>08ajIQj3VXDjTVR_&dAG9ADC&*Ti>vz_g0OV4+GCugXm z1e`TQB2qrv1iyM!sC63|3ho!4aB*0~Qtz!K6~9j=27bHjd~LOSTr0=G+sM(}2@wND zY>x(W=g%ioUcnqgwrx7RE1gKaXMaaB{<|_MNWK(OkXX@53o5h#vS)=H{X;rNmSS0^ zd9z}bA$4~epX_vL>b0w6AOkMHa(k}|mquUmb7~c8o@RVoK30=%9w#L?C7-V~cnt}S zkwDz6C&Ynt`ZC|EAh#jLm;`eVx;*5|ssPW-(}e0*_r9!8ak4MkRkNsg!O-AF70Nhd z&(eGyJ@q}@jlS|Y;<%m}5c5|%zZG@(b6J`!gPu&k2yCvYcs?Ni%+N>~)LubCL@5r` zk0a0#O{TMSdcJ&c13U7rx7BQM^z@s_u-8-GrSvKuvjlZYfc8qmL*at$P$&!m0JT~< z!=z2$=r_qzFBn{L5d}i4U*AvnsjeH36H+lsJN!eMhMhvzMe`dGWi}epK5!W_l#vy~ zV>bq~B{1*9N~Y<&vUP}X-pnZt0f_^Ol>bQKHI{yafsgGnE!_P>D z&lw){+%f!@-<<;2O%~eXmdKS!(`} zOsZZw0vyWrqbA0La?cTzl3AI@)A8?XW>{D5;$yHX`()qiZQu(Gu0XPlV;l+5pgQk- z#$PE*nlk${wyjqg-z#c><^``TYF3@0gpJcPe(ZNAVOeNyBj)zhWDwjS}jO9|kTls-9pvIsPV4Rn>iUpSGL6 zzZrSvEzG<3f@k(dR&y-J=^ZN#h?n!Bhhx5>`9RfO`HijD3qsbOv&>d$E0@gHbJxxw+lrNR7U+zRyZ&!` ztPdV1heGJsDbWL_HPzbhg;8 z#oqc61@O<4eMydu=y zq+0wr_w>b_Of}tZ)cccE1ik#`60sUKG8emU9e%K{8g52>G>TqOtbLw&cpug|chy7M*ploE^W6#M+H2QXx$xOtZlh#-pJcmMS=7%C6qc%+ zG~Gz2r(!-hc-Eaa30t{&48F(mRKE^uvi|Zudi|3$n1zYi;y-ZsM|0^H8By;uwQV|_ z0mb%_gRfTD9+$QYtQk0QzfH$yA0tjgm}HS=!j+2`aHAqdL~ihC`Pd0(wZWixYlL9{ zbK3;;8_r9(pgyh5&Id$FRU4^4@0G7j32hoj{?<*zk5v+i2C%6Zza+pb>J)>XhnFP-H0nn5Ca4Zdj(6M@ti4k6 zgc_;)Fq<17m{ zIGg;ICrRo*S44T*Es?jYZ6zB?ksARniGPMIegxmkcob(su6wna?Qnt*Dj0G17&L}d zco*hK<6;~5+<~Uv5zNUn6)k-7uQ#a`GwK_OHp6}&(3P9guXiW6$(iX^=C|L*@>FC} z@lc`t{z-5&&}(SIt$Et@8#x>^9C+c)Wrx;Vi>>IHoH?<7;VPHoH5e19>l*6F1g8g& z-^nlx7)H^Y|0Hz(2ONFHs(2@MU-MC)?q`9EcQi_#k`b0;>t?#$pnrJSxBqHh@$buE z)cR7tNd3O07ksIHu}hA7+)RY1Vs0C0d-cTk+^ZcAF4ZB79_v+^8dDwW<>Qctif z*|kF7aJM-(3uiVPW5nE=U~Su3 zis#!Es0|!UF{`EvsUhbG;sTlXsFHgP(V`bu<+A=j`&uqvnG^SQp`1##d*bYFHl4p< zdu9yiZ7=y!rKmX6C-v8(D?tq@v-k~!ML>FsFROPGx7yypZ1{81bn|mHh+O_y`SILr znYhY12gD<3%IVy~b@{`~NvMaTly}Q3$=~_Q6tQ_mbK>CHV%Fr3PY1ry92##gr6eA( z>@w<~7Em5c&I}Lym-J5nTv( z+Qo-k3hDh5ViXP1dEx*SFBBD3Ab1@r{apP=gCh;$7F%rn&%D0#t-mhMrbyCtQIJnv z{#@KOp8xpZoTtsAIRI}r@#*PC>BP~PD7%u`xzwMVy5^h7*?uECofn5zqB+2ZmS%k= Iua1WP4;iQWivR!s literal 0 HcmV?d00001 diff --git a/win/jconfig.h.in b/win/jconfig.h.in index 6865fafe..8783900e 100644 --- a/win/jconfig.h.in +++ b/win/jconfig.h.in @@ -7,6 +7,17 @@ #cmakedefine D_ARITH_CODING_SUPPORTED #cmakedefine MEM_SRCDST_SUPPORTED +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */ + #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT /* #define void char */ From 0b8d990cef92c0158a1b6a1808eda7c65a1f1d21 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 10 Aug 2014 16:43:31 +0000 Subject: [PATCH 946/985] Make the documentation more readable by displaying fixed-width text (which is used to refer to variables and functions) in a different color. --- doc/html/annotated.html | 1 + doc/html/classes.html | 1 + doc/html/doxygen-extra.css | 3 +++ doc/html/functions.html | 1 + doc/html/functions_vars.html | 1 + doc/html/group___turbo_j_p_e_g.html | 1 + doc/html/index.html | 1 + doc/html/modules.html | 1 + doc/html/structtjregion.html | 1 + doc/html/structtjscalingfactor.html | 1 + doc/html/structtjtransform.html | 1 + doxygen-extra.css | 3 +++ doxygen.config | 1 + 13 files changed, 17 insertions(+) create mode 100644 doc/html/doxygen-extra.css create mode 100644 doxygen-extra.css diff --git a/doc/html/annotated.html b/doc/html/annotated.html index f9287209..dad0fb16 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/classes.html b/doc/html/classes.html index ad625f12..7720c671 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/doxygen-extra.css b/doc/html/doxygen-extra.css new file mode 100644 index 00000000..5abbcc21 --- /dev/null +++ b/doc/html/doxygen-extra.css @@ -0,0 +1,3 @@ +code { + color: #4665A2; +} diff --git a/doc/html/functions.html b/doc/html/functions.html index 55ccba08..b13faed8 100644 --- a/doc/html/functions.html +++ b/doc/html/functions.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html index cdc55604..cca5603f 100644 --- a/doc/html/functions_vars.html +++ b/doc/html/functions_vars.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 6936e5df..8779c8b4 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/index.html b/doc/html/index.html index 139b84c4..ccaa12e4 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/modules.html b/doc/html/modules.html index 6b769e40..9b41adbd 100644 --- a/doc/html/modules.html +++ b/doc/html/modules.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/structtjregion.html b/doc/html/structtjregion.html index 515686c6..d22c09ed 100644 --- a/doc/html/structtjregion.html +++ b/doc/html/structtjregion.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/structtjscalingfactor.html b/doc/html/structtjscalingfactor.html index f34e1503..f7b7c84f 100644 --- a/doc/html/structtjscalingfactor.html +++ b/doc/html/structtjscalingfactor.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html index ef2c8d59..54e82e5d 100644 --- a/doc/html/structtjtransform.html +++ b/doc/html/structtjtransform.html @@ -14,6 +14,7 @@ $(document).ready(function() { searchBox.OnSelectItem(0); }); +
    diff --git a/doxygen-extra.css b/doxygen-extra.css new file mode 100644 index 00000000..5abbcc21 --- /dev/null +++ b/doxygen-extra.css @@ -0,0 +1,3 @@ +code { + color: #4665A2; +} diff --git a/doxygen.config b/doxygen.config index 96801753..4ffba681 100644 --- a/doxygen.config +++ b/doxygen.config @@ -13,3 +13,4 @@ JAVADOC_AUTOBRIEF = YES MAX_INITIALIZER_LINES = 0 ALWAYS_DETAILED_SEC = YES HTML_TIMESTAMP = NO +HTML_EXTRA_STYLESHEET = doxygen-extra.css From 11fe81d0df297640f9fd7e6e93e68ba7a71462c7 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 10 Aug 2014 18:30:52 +0000 Subject: [PATCH 947/985] Clean up notes using the doxygen @note command --- doc/html/group___turbo_j_p_e_g.html | 22 +++++++-------- turbojpeg.h | 43 ++++++++++++----------------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 8779c8b4..e379326c 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -301,7 +301,8 @@ Variables

    Detailed Description

    TurboJPEG API.

    -

    This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.

    +

    This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.

    +
    Note
    Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    Macro Definition Documentation

    @@ -694,7 +695,6 @@ Variables

    Chrominance subsampling options.

    When pixels are converted from RGB to YCbCr (see TJCS_YCbCr) or from CMYK to YCCK (see TJCS_YCCK) as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than to small changes in color.) This is called "chrominance subsampling".

    -

    NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    Enumerator
    TJSAMP_444 

    4:4:4 chrominance subsampling (no chrominance subsampling).

    @@ -714,11 +714,13 @@ Variables
    TJSAMP_440 

    4:4:0 chrominance subsampling.

    -

    The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. Note that 4:4:0 subsampling is not fully accelerated in libjpeg-turbo.

    +

    The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image.

    +
    Note
    4:4:0 subsampling is not fully accelerated in libjpeg-turbo.
    TJSAMP_411 

    4:1:1 chrominance subsampling.

    -

    The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features. Note that 4:1:1 subsampling is not fully accelerated in libjpeg-turbo.

    +

    The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features.

    +
    Note
    4:1:1 subsampling is not fully accelerated in libjpeg-turbo.
    @@ -1068,7 +1070,7 @@ If you choose option 1, *jpegSize should be set to the size of your

    Compress a YUV planar image into a JPEG image.

    -

    Note that, if the width or height of the YUV image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.

    +
    Note
    If the width or height of the YUV image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    Parameters
    @@ -1166,8 +1168,7 @@ If you choose option 1, *jpegSize should be set to the size of your

    Decode a YUV planar image into an RGB or grayscale image.

    -

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 in the input image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    -

    NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    +

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 in the input image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    Parameters
    handlea handle to a TurboJPEG compressor or transformer instance
    @@ -1404,8 +1405,8 @@ If you choose option 1, *jpegSize should be set to the size of your

    Decompress a JPEG image to a YUV planar image.

    -

    This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The structure of the planes in this image is the same as in the images generated by tjEncodeYUV3(). Note that, if the width or height of the JPEG image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.

    -

    NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    +

    This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The structure of the planes in this image is the same as in the images generated by tjEncodeYUV3().

    +
    Note
    If the width or height of the JPEG image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    Parameters
    handlea handle to a TurboJPEG decompressor or transformer instance
    @@ -1521,8 +1522,7 @@ If you choose option 1, *jpegSize should be set to the size of your

    Encode an RGB or grayscale image into a YUV planar image.

    -

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process. The Y, U (Cb), and V (Cr) image planes are stored sequentially into the destination buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    -

    NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    +

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process. The Y, U (Cb), and V (Cr) image planes are stored sequentially into the destination buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    Parameters
    handlea handle to a TurboJPEG decompressor or transformer instance
    diff --git a/turbojpeg.h b/turbojpeg.h index 818ca6e0..0c663417 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -42,6 +42,11 @@ * TurboJPEG API. This API provides an interface for generating, decoding, and * transforming planar YUV and JPEG images in memory. * + * @note Technically, the JPEG format uses the YCbCr colorspace (which is + * technically not a colorspace but a color transform), but per the convention + * of the digital video community, the TurboJPEG API uses "YUV" to refer to an + * image format consisting of Y, Cb, and Cr image planes. + * * @{ */ @@ -59,10 +64,6 @@ * to produce a smaller image with little perceptible loss of image clarity * (the human eye is more sensitive to small changes in brightness than to * small changes in color.) This is called "chrominance subsampling". - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. */ enum TJSAMP { @@ -89,7 +90,8 @@ enum TJSAMP /** * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one * chrominance component for every 1x2 block of pixels in the source image. - * Note that 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. + * + * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. */ TJSAMP_440, /** @@ -99,8 +101,9 @@ enum TJSAMP * same size as those compressed with 4:2:0 subsampling, and in the * aggregate, both subsampling methods produce approximately the same * perceptual quality. However, 4:1:1 is better able to reproduce sharp - * horizontal features. Note that 4:1:1 subsampling is not fully accelerated - * in libjpeg-turbo. + * horizontal features. + * + * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. */ TJSAMP_411 }; @@ -636,10 +639,11 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, /** - * Compress a YUV planar image into a JPEG image. Note that, if the width or - * height of the YUV image is not an even multiple of the MCU block size - * (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer copy will be - * performed within TurboJPEG. + * Compress a YUV planar image into a JPEG image. + * + * @note If the width or height of the YUV image is not an even multiple of the + * MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate + * buffer copy will be performed within TurboJPEG. * * @param handle a handle to a TurboJPEG compressor or transformer instance * @param srcBuf pointer to an image buffer containing a YUV planar image @@ -746,10 +750,6 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * plane is padded to the nearest multiple of 2 in the output image (same goes * for the height of the luminance plane, if the chrominance components are * subsampled along the vertical dimension.) - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. * * @param handle a handle to a TurboJPEG compressor or transformer instance * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels @@ -886,14 +886,11 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * Decompress a JPEG image to a YUV planar image. This function performs JPEG * decompression but leaves out the color conversion step, so a planar YUV * image is generated instead of an RGB image. The structure of the planes in - * this image is the same as in the images generated by #tjEncodeYUV3(). Note - * that, if the width or height of the JPEG image is not an even multiple of + * this image is the same as in the images generated by #tjEncodeYUV3(). + * + * @note If the width or height of the JPEG image is not an even multiple of * the MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate * buffer copy will be performed within TurboJPEG. - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. * * @param handle a handle to a TurboJPEG decompressor or transformer instance * @param jpegBuf pointer to a buffer containing the JPEG image to decompress @@ -940,10 +937,6 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * luminance plane should be padded to the nearest multiple of 2 in the input * image (same goes for the height of the luminance plane, if the chrominance * components are subsampled along the vertical dimension.) - *

    - * NOTE: Technically, the JPEG format uses the YCbCr colorspace, but per the - * convention of the digital video community, the TurboJPEG API uses "YUV" to - * refer to an image format consisting of Y, Cb, and Cr image planes. * * @param handle a handle to a TurboJPEG decompressor or transformer instance * @param srcBuf pointer to an image buffer containing a YUV planar image to be From 22505838cbad3ece7c1ee3585fc2a0ab89944c36 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 10 Aug 2014 20:12:17 +0000 Subject: [PATCH 948/985] Clean up and consolidate notes regarding the YUV image format. This also corrects a factual error regarding the padding of the luminance plane-- because we now support 4:1:1, the component width is not necessarily padded to the nearest multiple of 2 if horizontal subsampling is used. --- doc/html/group___turbo_j_p_e_g.html | 30 ++--- java/doc/index-all.html | 2 +- .../org/libjpegturbo/turbojpeg/YUVImage.html | 50 +++++--- .../turbojpeg/package-summary.html | 2 +- java/org/libjpegturbo/turbojpeg/YUVImage.java | 50 +++++--- turbojpeg.h | 108 ++++++++++-------- 6 files changed, 140 insertions(+), 102 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index e379326c..eff285e5 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -302,7 +302,11 @@ Variables

    Detailed Description

    TurboJPEG API.

    This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.

    -
    Note
    Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.
    +

    +

    YUV Image Format Notes

    +

    Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

    +

    Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The "component width" and "component height" of each plane are determined by the image width, height, and level of chrominance subsampling. For the luminance plane, the component width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the component height of the luminance plane is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The component width of the chrominance planes is equal to the component width of the luminance plane divided by the horizontal subsampling factor, and the component height of the chrominance planes is equal to the component height of the luminance plane divided by the vertical subsampling factor.

    +

    For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes.

    Macro Definition Documentation

    @@ -1070,14 +1074,13 @@ If you choose option 1, *jpegSize should be set to the size of your

    Compress a YUV planar image into a JPEG image.

    -
    Note
    If the width or height of the YUV image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    Parameters
    handlea handle to a TurboJPEG compressor or transformer instance
    - - + + - + - - - + + + @@ -849,8 +849,8 @@ Variables

    The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.

    Parameters
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing a YUV planar image to be compressed. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the buffer, and the size of each plane is determined by the specified width, height, padding, and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) This is irrespective of any additional padding specified in the pad parameter.
    widthwidth (in pixels) of the source image
    srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    heightheight (in pixels) of the source image
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. @@ -1168,11 +1171,11 @@ If you choose option 1, *jpegSize should be set to the size of your

      Decode a YUV planar image into an RGB or grayscale image.

      -

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 in the input image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

      +

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

      Parameters
      - + @@ -1405,17 +1408,16 @@ If you choose option 1, *jpegSize should be set to the size of your

      Decompress a JPEG image to a YUV planar image.

      -

      This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The structure of the planes in this image is the same as in the images generated by tjEncodeYUV3().

      -
      Note
      If the width or height of the JPEG image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
      +

      This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

      Parameters
      handlea handle to a TurboJPEG decompressor or transformer instance
      srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling.
      srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
      padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
      subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
      dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
      - - + + - +
      handlea handle to a TurboJPEG decompressor or transformer instance
      jpegBufpointer to a buffer containing the JPEG image to decompress
      jpegSizesize of the JPEG image (in bytes)
      dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling.
      widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
      dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
      widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
      padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
      heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size.
      heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
      flagsthe bitwise OR of one or more of the flags.
      @@ -1522,7 +1524,7 @@ If you choose option 1, *jpegSize should be set to the size of your

      Encode an RGB or grayscale image into a YUV planar image.

      -

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process. The Y, U (Cb), and V (Cr) image planes are stored sequentially into the destination buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

      +

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

      Parameters
      @@ -1531,7 +1533,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index fa92e3c9..a976556d 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -857,7 +857,7 @@
       
      YUVImage - Class in org.libjpegturbo.turbojpeg
      -
      This class encapsulates a YUV planar image buffer and the metadata +
      This class encapsulates a YUV planar image and the metadata associated with it.
      YUVImage(int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
      diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html index 13e6160c..3e7a6e8b 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -94,7 +94,7 @@
      public class YUVImage
       extends java.lang.Object
      -
      This class encapsulates a YUV planar image buffer and the metadata +
      This class encapsulates a YUV planar image and the metadata associated with it. The TurboJPEG API allows both the JPEG compression and decompression pipelines to be split into stages: YUV encode, compress from YUV, decompress to YUV, and YUV decode. A YUVImage instance @@ -105,18 +105,28 @@ extends java.lang.Object Technically, the JPEG format uses the YCbCr colorspace (which technically is not a "colorspace" but rather a "color transform"), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an - image format consisting of Y, Cb, and Cr image planes. In this image - format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same - image buffer, and the size of each plane is determined by the image width, - height, line padding, and level of chrominance subsampling. If the - chrominance components are subsampled along the horizontal dimension, then - the width of the luminance plane would be padded to the nearest multiple of - 2 (same goes for the height of the luminance plane, if the chrominance - components are subsampled along the vertical dimension.) For instance, if - the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the - luminance plane would be 36 x 35 bytes, and each of the chrominance planes - would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 - bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + image format consisting of Y, Cb, and Cr image planes. +

      + Each plane is simply a 2D array of bytes, each byte representing the value + of one of the components at a particular location in the image. The + "component width" and "component height" of each plane are determined by the + image width, height, and level of chrominance subsampling. For the + luminance plane, the component width is the image width padded to the + nearest multiple of the horizontal subsampling factor (2 in the case of + 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + grayscale.) Similarly, the component height of the luminance plane is the + image height padded to the nearest multiple of the vertical subsampling + factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + grayscale.) The component width of the chrominance planes is equal to the + component width of the luminance plane divided by the horizontal subsampling + factor, and the component height of the chrominance planes is equal to the + component height of the luminance plane divided by the vertical subsampling + factor. +

      + For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + used, then the luminance plane would be 36 x 35 bytes, and each of the + chrominance planes would be 18 x 35 bytes. If you specify a line padding of + 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes.

      @@ -372,9 +382,10 @@ extends java.lang.Object
      Create a YUVImage instance from an existing YUV planar image buffer.
      Parameters:
      yuvImage - image buffer that contains or will contain YUV planar - image data. See above for a description of the image - format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this - buffer.
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + this buffer. The Y, U (Cb), and V (Cr) image planes are stored + sequentially in the buffer (see above for a description + of the image format.)
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
      @@ -405,9 +416,10 @@ extends java.lang.Object
      Assign an existing YUV planar image buffer to this YUVImage instance.
      Parameters:
      yuvImage - image buffer that contains or will contain YUV planar - image data. See above for a description of the image - format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this - buffer.
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + this buffer. The Y, U (Cb), and V (Cr) image planes are stored + sequentially in the buffer (see above for a description + of the image format.)
      width - width (in pixels) of the YUV image
      pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
      diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html index c5e2f7d8..ea360576 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html +++ b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html @@ -127,7 +127,7 @@
      diff --git a/java/org/libjpegturbo/turbojpeg/YUVImage.java b/java/org/libjpegturbo/turbojpeg/YUVImage.java index 619b0c31..27b1b70c 100644 --- a/java/org/libjpegturbo/turbojpeg/YUVImage.java +++ b/java/org/libjpegturbo/turbojpeg/YUVImage.java @@ -29,7 +29,7 @@ package org.libjpegturbo.turbojpeg; /** - * This class encapsulates a YUV planar image buffer and the metadata + * This class encapsulates a YUV planar image and the metadata * associated with it. The TurboJPEG API allows both the JPEG compression and * decompression pipelines to be split into stages: YUV encode, compress from * YUV, decompress to YUV, and YUV decode. A YUVImage instance @@ -40,18 +40,28 @@ package org.libjpegturbo.turbojpeg; * Technically, the JPEG format uses the YCbCr colorspace (which technically is * not a "colorspace" but rather a "color transform"), but per the convention * of the digital video community, the TurboJPEG API uses "YUV" to refer to an - * image format consisting of Y, Cb, and Cr image planes. In this image - * format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same - * image buffer, and the size of each plane is determined by the image width, - * height, line padding, and level of chrominance subsampling. If the - * chrominance components are subsampled along the horizontal dimension, then - * the width of the luminance plane would be padded to the nearest multiple of - * 2 (same goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) For instance, if - * the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the - * luminance plane would be 36 x 35 bytes, and each of the chrominance planes - * would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 - * bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * image format consisting of Y, Cb, and Cr image planes. + *

      + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components at a particular location in the image. The + * "component width" and "component height" of each plane are determined by the + * image width, height, and level of chrominance subsampling. For the + * luminance plane, the component width is the image width padded to the + * nearest multiple of the horizontal subsampling factor (2 in the case of + * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + * grayscale.) Similarly, the component height of the luminance plane is the + * image height padded to the nearest multiple of the vertical subsampling + * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + * grayscale.) The component width of the chrominance planes is equal to the + * component width of the luminance plane divided by the horizontal subsampling + * factor, and the component height of the chrominance planes is equal to the + * component height of the luminance plane divided by the vertical subsampling + * factor. + *

      + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a line padding of + * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and * each of the chrominance planes would be 20 x 35 bytes. */ public class YUVImage { @@ -83,9 +93,10 @@ public class YUVImage { * buffer. * * @param yuvImage image buffer that contains or will contain YUV planar - * image data. See {@link YUVImage above} for a description of the image - * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this - * buffer. + * image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for + * this buffer. The Y, U (Cb), and V (Cr) image planes are stored + * sequentially in the buffer (see {@link YUVImage above} for a description + * of the image format.) * * @param width width (in pixels) of the YUV image * @@ -108,9 +119,10 @@ public class YUVImage { * instance. * * @param yuvImage image buffer that contains or will contain YUV planar - * image data. See {@link YUVImage above} for a description of the image - * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this - * buffer. + * image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for + * this buffer. The Y, U (Cb), and V (Cr) image planes are stored + * sequentially in the buffer (see {@link YUVImage above} for a description + * of the image format.) * * @param width width (in pixels) of the YUV image * diff --git a/turbojpeg.h b/turbojpeg.h index 0c663417..36ede71f 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -42,10 +42,36 @@ * TurboJPEG API. This API provides an interface for generating, decoding, and * transforming planar YUV and JPEG images in memory. * - * @note Technically, the JPEG format uses the YCbCr colorspace (which is - * technically not a colorspace but a color transform), but per the convention - * of the digital video community, the TurboJPEG API uses "YUV" to refer to an - * image format consisting of Y, Cb, and Cr image planes. + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The "component width" and "component height" of each plane are + * determined by the image width, height, and level of chrominance subsampling. + * For the luminance plane, the component width is the image width padded to + * the nearest multiple of the horizontal subsampling factor (2 in the case of + * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + * grayscale.) Similarly, the component height of the luminance plane is the + * image height padded to the nearest multiple of the vertical subsampling + * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + * grayscale.) This is irrespective of any additional padding that may be + * specified as an argument to the various YUV functions. The component width + * of the chrominance planes is equal to the component width of the luminance + * plane divided by the horizontal subsampling factor, and the component height + * of the chrominance planes is equal to the component height of the luminance + * plane divided by the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a line padding of + * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * each of the chrominance planes would be 20 x 35 bytes. * * @{ */ @@ -641,27 +667,22 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, /** * Compress a YUV planar image into a JPEG image. * - * @note If the width or height of the YUV image is not an even multiple of the - * MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate - * buffer copy will be performed within TurboJPEG. - * * @param handle a handle to a TurboJPEG compressor or transformer instance - * @param srcBuf pointer to an image buffer containing a YUV planar image - * to be compressed. The Y, U (Cb), and V (Cr) image planes should be - * stored sequentially in the buffer, and the size of each plane - * is determined by the specified width, height, padding, and level of - * chrominance subsampling. If the chrominance components are - * subsampled along the horizontal dimension, then the width of the - * luminance plane should be padded to the nearest multiple of 2 (same - * goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) This is - * irrespective of any additional padding specified in the pad - * parameter. - * @param width width (in pixels) of the source image + * @param srcBuf pointer to an image buffer containing a YUV planar image to be + * compressed. The size of this buffer should match the value returned + * by #tjBufSizeYUV2() for the given image width, height, padding, and + * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image + * planes should be stored sequentially in the source buffer (refer to + * @ref YUVnotes "YUV Image Format Notes".) + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the MCU block width (see #tjMCUWidth), then an + * intermediate buffer copy will be performed within TurboJPEG. * @param pad the line padding used in the source image. For instance, if each * line in each plane of the YUV image is padded to the nearest multiple * of 4 bytes, then pad should be set to 4. - * @param height height (in pixels) of the source image + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. * @param subsamp the level of chrominance subsampling used in the source * image (see @ref TJSAMP "Chrominance subsampling options".) * @param jpegBuf address of a pointer to an image buffer that will receive the @@ -742,14 +763,7 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * Encode an RGB or grayscale image into a YUV planar image. This function * uses the accelerated color conversion routines in the underlying * codec but does not execute any of the other steps in the JPEG compression - * process. The Y, U (Cb), and V (Cr) image planes are stored sequentially - * into the destination buffer, and the size of each plane is determined by the - * width and height of the source image, as well as the specified padding and - * level of chrominance subsampling. If the chrominance components are - * subsampled along the horizontal dimension, then the width of the luminance - * plane is padded to the nearest multiple of 2 in the output image (same goes - * for the height of the luminance plane, if the chrominance components are - * subsampled along the vertical dimension.) + * process. * * @param handle a handle to a TurboJPEG compressor or transformer instance * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels @@ -768,7 +782,9 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * @param dstBuf pointer to an image buffer that will receive the YUV image. * Use #tjBufSizeYUV2() to determine the appropriate size for this * buffer based on the image width, height, padding, and level of - * chrominance subsampling. + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will + * be stored sequentially in the buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) * @param pad the width of each line in each plane of the YUV image will be * padded to the nearest multiple of this number of bytes (must be a * power of 2.) To generate images suitable for X Video, pad @@ -885,12 +901,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, /** * Decompress a JPEG image to a YUV planar image. This function performs JPEG * decompression but leaves out the color conversion step, so a planar YUV - * image is generated instead of an RGB image. The structure of the planes in - * this image is the same as in the images generated by #tjEncodeYUV3(). - * - * @note If the width or height of the JPEG image is not an even multiple of - * the MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate - * buffer copy will be performed within TurboJPEG. + * image is generated instead of an RGB image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance * @param jpegBuf pointer to a buffer containing the JPEG image to decompress @@ -898,13 +909,17 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * @param dstBuf pointer to an image buffer that will receive the YUV image. * Use #tjBufSizeYUV2() to determine the appropriate size for this * buffer based on the image width, height, padding, and level of - * subsampling. + * subsampling. The Y, U (Cb), and V (Cr) image planes will be stored + * sequentially in the buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) * @param width desired width (in pixels) of the YUV image. If this is * different than the width of the JPEG image being decompressed, then * TurboJPEG will use scaling in the JPEG decompressor to generate the * largest possible image that will fit within the desired width. If * width is set to 0, then only the height will be considered - * when determining the scaled image size. + * when determining the scaled image size. If the scaled width is not + * an even multiple of the MCU block width (see #tjMCUWidth), then an + * intermediate buffer copy will be performed within TurboJPEG. * @param pad the width of each line in each plane of the YUV image will be * padded to the nearest multiple of this number of bytes (must be a * power of 2.) To generate images suitable for X Video, pad @@ -914,7 +929,9 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * TurboJPEG will use scaling in the JPEG decompressor to generate the * largest possible image that will fit within the desired height. If * height is set to 0, then only the width will be considered - * when determining the scaled image size. + * when determining the scaled image size. If the scaled height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP * "flags". * @@ -929,20 +946,15 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * Decode a YUV planar image into an RGB or grayscale image. This function * uses the accelerated color conversion routines in the underlying * codec but does not execute any of the other steps in the JPEG decompression - * process. The Y, U (Cb), and V (Cr) image planes should be stored - * sequentially in the source buffer, and the size of each plane is determined - * by the width and height of the source image, as well as the specified - * padding and level of chrominance subsampling. If the chrominance components - * are subsampled along the horizontal dimension, then the width of the - * luminance plane should be padded to the nearest multiple of 2 in the input - * image (same goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) + * process. * * @param handle a handle to a TurboJPEG decompressor or transformer instance * @param srcBuf pointer to an image buffer containing a YUV planar image to be * decoded. The size of this buffer should match the value returned * by #tjBufSizeYUV2() for the given image width, height, padding, and - * level of chrominance subsampling. + * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image + * planes should be stored sequentially in the source buffer (refer to + * @ref YUVnotes "YUV Image Format Notes".) * @param pad Use this parameter to specify that the width of each line in each * plane of the YUV source image is padded to the nearest multiple of * this number of bytes (must be a power of 2.) From ab62cf7ba5a064758ebbb9cdf4936f7a7b7ae5dc Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 11 Aug 2014 18:05:41 +0000 Subject: [PATCH 949/985] Extend the TurboJPEG C API to support handling YUV images stored in separate image planes instead of a unified buffer --- ChangeLog.txt | 5 + doc/html/group___turbo_j_p_e_g.html | 374 ++++++++++++++++++++++++++++ doc/html/search/all_74.js | 6 +- doc/html/search/functions_74.js | 4 + turbojpeg-mapfile | 4 + turbojpeg-mapfile.jni | 4 + turbojpeg.c | 284 +++++++++++++++------ turbojpeg.h | 210 ++++++++++++++++ 8 files changed, 820 insertions(+), 71 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a4632547..70a1730a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -20,6 +20,11 @@ scope for a codec library. and should now be much more intuitive. -- The Java API now supports encoding a YUV image from an arbitrary position in a large image buffer. +-- All of the YUV functions now have a corresponding function that operates on +separate image planes instead of a unified image buffer. This allows for +compressing/decoding a YUV image from or decompressing/encoding a YUV image to +an arbitrary position in a larger YUV image. It also allows for handling YUV +formats that swap the order of the U and V planes. [2] Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up the compression of full-color JPEGs by 70-80% on such platforms and diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index eff285e5..8ca4eda2 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -232,6 +232,9 @@ Functions

      + + + @@ -241,6 +244,9 @@ Functions + + + @@ -256,9 +262,15 @@ Functions + + + + + + @@ -1096,6 +1108,103 @@ If you choose option 1, *jpegSize should be set to the size of your
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      + + + +
      +
      +
      handlea handle to a TurboJPEG compressor or transformer instance
      pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
      heightheight (in pixels) of the source image
      pixelFormatpixel format of the source image (see Pixel formats.)
      dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling.
      dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
      padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
      subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
      flagsthe bitwise OR of one or more of the flags.
      YUVImage -
      This class encapsulates a YUV planar image buffer and the metadata +
      This class encapsulates a YUV planar image and the metadata associated with it.
      DLLEXPORT int DLLCALL tjCompressFromYUV (tjhandle handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
       Compress a YUV planar image into a JPEG image. More...
       
      DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcBufs, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
       Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
       
      DLLEXPORT unsigned long DLLCALL tjBufSize (int width, int height, int jpegSubsamp)
       The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. More...
       
      DLLEXPORT int DLLCALL tjEncodeYUV3 (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)
       Encode an RGB or grayscale image into a YUV planar image. More...
       
      DLLEXPORT int DLLCALL tjEncodeYUVPlanes (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)
       Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. More...
       
      DLLEXPORT tjhandle DLLCALL tjInitDecompress (void)
       Create a TurboJPEG decompressor instance. More...
       
      DLLEXPORT int DLLCALL tjDecompressToYUV2 (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)
       Decompress a JPEG image to a YUV planar image. More...
       
      DLLEXPORT int DLLCALL tjDecompressToYUVPlanes (tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)
       Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. More...
       
      DLLEXPORT int DLLCALL tjDecodeYUV (tjhandle handle, unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
       Decode a YUV planar image into an RGB or grayscale image. More...
       
      DLLEXPORT int DLLCALL tjDecodeYUVPlanes (tjhandle handle, unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)
       Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. More...
       
      DLLEXPORT tjhandle DLLCALL tjInitTransform (void)
       Create a new TurboJPEG transformer instance. More...
       
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle,
      unsigned char ** srcBufs,
      int width,
      int * strides,
      int height,
      int subsamp,
      unsigned char ** jpegBuf,
      unsigned long * jpegSize,
      int jpegQual,
      int flags 
      )
      +
      + +

      Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image.

      +
      Parameters
      + + + + + + + + + + + +
      handlea handle to a TurboJPEG compressor or transformer instance
      srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
      heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
      subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
      jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
        +
      1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
      2. +
      3. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
      4. +
      5. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
      6. +
      +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
      jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
      jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
      flagsthe bitwise OR of one or more of the flags.
      +
      +
      +
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      +
      @@ -1189,6 +1298,99 @@ If you choose option 1, *jpegSize should be set to the size of your
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      DLLEXPORT int DLLCALL tjDecodeYUVPlanes (tjhandle handle,
      unsigned char ** srcPlanes,
      int * strides,
      int subsamp,
      unsigned char * dstBuf,
      int width,
      int pitch,
      int height,
      int pixelFormat,
      int flags 
      )
      +
      + +

      Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image.

      +

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

      +
      Parameters
      + + + + + + + + + + + +
      handlea handle to a TurboJPEG decompressor or transformer instance
      srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
      subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
      dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
      widthwidth (in pixels) of the source and destination images
      pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
      heightheight (in pixels) of the source and destination images
      pixelFormatpixel format of the destination image (see Pixel formats.)
      flagsthe bitwise OR of one or more of the flags.
      +
      +
      +
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      +
      @@ -1424,6 +1626,85 @@ If you choose option 1, *jpegSize should be set to the size of your
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      DLLEXPORT int DLLCALL tjDecompressToYUVPlanes (tjhandle handle,
      unsigned char * jpegBuf,
      unsigned long jpegSize,
      unsigned char ** dstPlanes,
      int width,
      int * strides,
      int height,
      int flags 
      )
      +
      + +

      Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes.

      +

      This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

      +
      Parameters
      + + + + + + + + + +
      handlea handle to a TurboJPEG decompressor or transformer instance
      jpegBufpointer to a buffer containing the JPEG image to decompress
      jpegSizesize of the JPEG image (in bytes)
      dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
      heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
      flagsthe bitwise OR of one or more of the flags.
      +
      +
      +
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      +
      @@ -1542,6 +1823,99 @@ If you choose option 1, *jpegSize should be set to the size of your
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      DLLEXPORT int DLLCALL tjEncodeYUVPlanes (tjhandle handle,
      unsigned char * srcBuf,
      int width,
      int pitch,
      int height,
      int pixelFormat,
      unsigned char ** dstPlanes,
      int * strides,
      int subsamp,
      int flags 
      )
      +
      + +

      Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes.

      +

      This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

      +
      Parameters
      + + + + + + + + + + + +
      handlea handle to a TurboJPEG compressor or transformer instance
      srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
      widthwidth (in pixels) of the source image
      pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
      heightheight (in pixels) of the source image
      pixelFormatpixel format of the source image (see Pixel formats.)
      dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.
      subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
      flagsthe bitwise OR of one or more of the flags.
      +
      +
      +
      Returns
      0 if successful, or -1 if an error occurred (see tjGetErrorStr().)
      +
      diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js index 435cec4d..e371aaed 100644 --- a/doc/html/search/all_74.js +++ b/doc/html/search/all_74.js @@ -10,6 +10,7 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], ['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]], ['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]], ['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]], @@ -17,11 +18,14 @@ var searchData= ['tjcs_5fycbcr',['TJCS_YCbCr',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75',1,'turbojpeg.h']]], ['tjcs_5fycck',['TJCS_YCCK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e',1,'turbojpeg.h']]], ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], + ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#gacd0fac3af74b3511d39b4781b7103086',1,'turbojpeg.h']]], ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga7c08b340ad7f8e85d407bd9e81d44d07',1,'turbojpeg.h']]], + ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga0828a38ae29631ac28b6857cefb0eebf',1,'turbojpeg.h']]], ['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]], ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360',1,'turbojpeg.h']]], + ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaa791db8598853ddcad24e42897ef1269',1,'turbojpeg.h']]], ['tjflag_5faccuratedct',['TJFLAG_ACCURATEDCT',['../group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0',1,'turbojpeg.h']]], ['tjflag_5fbottomup',['TJFLAG_BOTTOMUP',['../group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec',1,'turbojpeg.h']]], ['tjflag_5ffastdct',['TJFLAG_FASTDCT',['../group___turbo_j_p_e_g.html#gaabce235db80d3f698b27f36cbd453da2',1,'turbojpeg.h']]], @@ -63,7 +67,7 @@ var searchData= ['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]], ['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]], ['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]], - ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]], + ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]], ['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]], ['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]], ['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]], diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js index 0a0e6cdc..8e7e1f57 100644 --- a/doc/html/search/functions_74.js +++ b/doc/html/search/functions_74.js @@ -5,12 +5,16 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], + ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], ['tjdecompressheader3',['tjDecompressHeader3',['../group___turbo_j_p_e_g.html#gacd0fac3af74b3511d39b4781b7103086',1,'turbojpeg.h']]], ['tjdecompresstoyuv2',['tjDecompressToYUV2',['../group___turbo_j_p_e_g.html#ga7c08b340ad7f8e85d407bd9e81d44d07',1,'turbojpeg.h']]], + ['tjdecompresstoyuvplanes',['tjDecompressToYUVPlanes',['../group___turbo_j_p_e_g.html#ga0828a38ae29631ac28b6857cefb0eebf',1,'turbojpeg.h']]], ['tjdestroy',['tjDestroy',['../group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540',1,'turbojpeg.h']]], ['tjencodeyuv3',['tjEncodeYUV3',['../group___turbo_j_p_e_g.html#ga0a5ffbf7cb58a5b6a8201114fe889360',1,'turbojpeg.h']]], + ['tjencodeyuvplanes',['tjEncodeYUVPlanes',['../group___turbo_j_p_e_g.html#gaa791db8598853ddcad24e42897ef1269',1,'turbojpeg.h']]], ['tjfree',['tjFree',['../group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137',1,'turbojpeg.h']]], ['tjgeterrorstr',['tjGetErrorStr',['../group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf',1,'turbojpeg.h']]], ['tjgetscalingfactors',['tjGetScalingFactors',['../group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8',1,'turbojpeg.h']]], diff --git a/turbojpeg-mapfile b/turbojpeg-mapfile index 7d174ca8..bd675519 100755 --- a/turbojpeg-mapfile +++ b/turbojpeg-mapfile @@ -42,8 +42,12 @@ TURBOJPEG_1.4 global: tjBufSizeYUV2; tjCompressFromYUV; + tjCompressFromYUVPlanes; tjDecodeYUV; + tjDecodeYUVPlanes; tjDecompressHeader3; tjDecompressToYUV2; + tjDecompressToYUVPlanes; tjEncodeYUV3; + tjEncodeYUVPlanes; } TURBOJPEG_1.2; diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni index f9fc7e53..31c8ae08 100755 --- a/turbojpeg-mapfile.jni +++ b/turbojpeg-mapfile.jni @@ -68,10 +68,14 @@ TURBOJPEG_1.4 global: tjBufSizeYUV2; tjCompressFromYUV; + tjCompressFromYUVPlanes; tjDecodeYUV; + tjDecodeYUVPlanes; tjDecompressHeader3; tjDecompressToYUV2; + tjDecompressToYUVPlanes; tjEncodeYUV3; + tjEncodeYUVPlanes; Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII; Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII; Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII; diff --git a/turbojpeg.c b/turbojpeg.c index 2490836b..926f633a 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -84,7 +84,7 @@ typedef struct _tjinstance struct jpeg_compress_struct cinfo; struct jpeg_decompress_struct dinfo; struct my_error_mgr jerr; - int init; + int init, headerRead; } tjinstance; static const int pixelsize[TJ_NUMSAMP]={3, 3, 3, 1, 3, 3}; @@ -704,17 +704,16 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf, } -DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, - int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, - int pad, int subsamp, int flags) +DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, + int *strides, int subsamp, int flags) { int i, retval=0; JSAMPROW *row_pointer=NULL; JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS]; JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS]; JSAMPROW *outbuf[MAX_COMPONENTS]; int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS]; - JSAMPLE *ptr=dstBuf; - unsigned long yuvsize=0; + JSAMPLE *ptr; jpeg_component_info *compptr; #ifndef JCS_EXTENSIONS unsigned char *rgbBuf=NULL; @@ -729,12 +728,14 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, } if((this->init&COMPRESS)==0) - _throw("tjEncodeYUV3(): Instance has not been initialized for compression"); + _throw("tjEncodeYUVPlanes(): Instance has not been initialized for compression"); if(srcBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0 - || pixelFormat>=TJ_NUMPF || dstBuf==NULL || pad<0 || !isPow2(pad) - || subsamp<0 || subsamp>=NUMSUBOPT) - _throw("tjEncodeYUV3(): Invalid argument"); + || pixelFormat>=TJ_NUMPF || !dstPlanes || !dstPlanes[0] || subsamp<0 + || subsamp>=NUMSUBOPT) + _throw("tjEncodeYUVPlanes(): Invalid argument"); + if(subsamp!=TJSAMP_GRAY && (!dstPlanes[1] || !dstPlanes[2])) + _throw("tjEncodeYUVPlanes(): Invalid argument"); if(setjmp(this->jerr.setjmp_buffer)) { @@ -744,7 +745,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, } if(pixelFormat==TJPF_CMYK) - _throw("tjEncodeYUV3(): Cannot generate YUV images from CMYK pixels"); + _throw("tjEncodeYUVPlanes(): Cannot generate YUV images from CMYK pixels"); if(pitch==0) pitch=width*tjPixelSize[pixelFormat]; @@ -752,7 +753,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, if(pixelFormat!=TJPF_GRAY && pixelFormat!=TJPF_CMYK) { rgbBuf=(unsigned char *)malloc(width*height*RGB_PIXELSIZE); - if(!rgbBuf) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!rgbBuf) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); srcBuf=toRGB(srcBuf, width, pitch, height, pixelFormat, rgbBuf); pitch=width*RGB_PIXELSIZE; } @@ -765,7 +766,6 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); - yuvsize=tjBufSizeYUV2(width, pad, height, subsamp); if(setCompDefaults(cinfo, pixelFormat, subsamp, -1, flags)==-1) return -1; /* Execute only the parts of jpeg_start_compress() that we need. If we @@ -773,7 +773,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, to write the file headers, which could overflow the output buffer if the YUV image were very small. */ if(cinfo->global_state!=CSTATE_START) - _throw("tjEncodeYUV3(): libjpeg API is in the wrong state"); + _throw("tjEncodeYUVPlanes(): libjpeg API is in the wrong state"); (*cinfo->err->reset_error_mgr)((j_common_ptr)cinfo); jinit_c_master_control(cinfo, FALSE); jinit_color_converter(cinfo); @@ -784,7 +784,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, ph=PAD(height, cinfo->max_v_samp_factor); if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL) - _throw("tjEncodeYUV3(): Memory allocation failure"); + _throw("tjEncodeYUVPlanes(): Memory allocation failure"); for(i=0; iwidth_in_blocks*cinfo->max_h_samp_factor*DCTSIZE) /compptr->h_samp_factor, 16) * cinfo->max_v_samp_factor + 16); - if(!_tmpbuf[i]) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!_tmpbuf[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*cinfo->max_v_samp_factor); - if(!tmpbuf[i]) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!tmpbuf[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); for(row=0; rowmax_v_samp_factor; row++) { unsigned char *_tmpbuf_aligned= @@ -812,9 +812,9 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, } _tmpbuf2[i]=(JSAMPLE *)malloc(PAD(compptr->width_in_blocks*DCTSIZE, 16) * compptr->v_samp_factor + 16); - if(!_tmpbuf2[i]) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!_tmpbuf2[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); tmpbuf2[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*compptr->v_samp_factor); - if(!tmpbuf2[i]) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!tmpbuf2[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); for(row=0; rowv_samp_factor; row++) { unsigned char *_tmpbuf2_aligned= @@ -825,15 +825,14 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, cw[i]=pw*compptr->h_samp_factor/cinfo->max_h_samp_factor; ch[i]=ph*compptr->v_samp_factor/cinfo->max_v_samp_factor; outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]); - if(!outbuf[i]) _throw("tjEncodeYUV3(): Memory allocation failure"); + if(!outbuf[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); + ptr=dstPlanes[i]; for(row=0; row0)? strides[i]:cw[i]; } } - if(yuvsize!=(unsigned long)(ptr-dstBuf)) - _throw("tjEncodeYUV3(): Generated image is not the correct size"); for(row=0; rowmax_v_samp_factor) { @@ -865,6 +864,34 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, return retval; } +DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, + int pad, int subsamp, int flags) +{ + unsigned char *dstPlanes[3]; + int pw, ph, cw, ch, strides[3], retval=-1; + + if(width<=0 || height<=0 || dstBuf==NULL || pad<0 || !isPow2(pad) + || subsamp<0 || subsamp>=NUMSUBOPT) + _throw("tjEncodeYUV3(): Invalid argument"); + + pw=PAD(width, tjMCUWidth[subsamp]/8); + ph=PAD(height, tjMCUHeight[subsamp]/8); + cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; + + strides[0]=PAD(pw, pad); + strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + dstPlanes[0]=dstBuf; + dstPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph); + dstPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch); + + return tjEncodeYUVPlanes(handle, srcBuf, width, pitch, height, pixelFormat, + dstPlanes, strides, subsamp, flags); + + bailout: + return retval; +} + DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int subsamp, int flags) @@ -882,14 +909,14 @@ DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, } -DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, - int width, int pad, int height, int subsamp, unsigned char **jpegBuf, - unsigned long *jpegSize, int jpegQual, int flags) +DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, + unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, + unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags) { int i, row, retval=0, alloc=1; JSAMPROW *inbuf[MAX_COMPONENTS]; int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS], tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; - JSAMPLE *_tmpbuf=NULL, *ptr=srcBuf; JSAMPROW *tmpbuf[MAX_COMPONENTS]; + JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS]; getcinstance(handle) @@ -899,12 +926,14 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, } if((this->init&COMPRESS)==0) - _throw("tjCompressFromYUV(): Instance has not been initialized for compression"); + _throw("tjCompressFromYUVPlanes(): Instance has not been initialized for compression"); - if(srcBuf==NULL || width<=0 || pad<1 || height<=0 || subsamp<0 + if(!srcPlanes || !srcPlanes[0] || width<=0 || height<=0 || subsamp<0 || subsamp>=NUMSUBOPT || jpegBuf==NULL || jpegSize==NULL || jpegQual<0 || jpegQual>100) - _throw("tjCompressFromYUV(): Invalid argument"); + _throw("tjCompressFromYUVPlanes(): Invalid argument"); + if(subsamp!=TJSAMP_GRAY && (!srcPlanes[1] || !srcPlanes[2])) + _throw("tjCompressFromYUVPlanes(): Invalid argument"); if(setjmp(this->jerr.setjmp_buffer)) { @@ -944,22 +973,23 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, th[i]=compptr->v_samp_factor*DCTSIZE; tmpbufsize+=iw[i]*th[i]; if((inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL) - _throw("tjCompressFromYUV(): Memory allocation failure"); + _throw("tjCompressFromYUVPlanes(): Memory allocation failure"); + ptr=srcPlanes[i]; for(row=0; row0)? strides[i]:cw[i]; } } if(usetmpbuf) { if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL) - _throw("tjCompressFromYUV(): Memory allocation failure"); + _throw("tjCompressFromYUVPlanes(): Memory allocation failure"); ptr=_tmpbuf; for(i=0; inum_components; i++) { if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL) - _throw("tjCompressFromYUV(): Memory allocation failure"); + _throw("tjCompressFromYUVPlanes(): Memory allocation failure"); for(row=0; row=NUMSUBOPT) + _throw("tjCompressFromYUV(): Invalid argument"); + + pw=PAD(width, tjMCUWidth[subsamp]/8); + ph=PAD(height, tjMCUHeight[subsamp]/8); + cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; + + strides[0]=PAD(pw, pad); + strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + srcPlanes[0]=srcBuf; + srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph); + srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch); + + return tjCompressFromYUVPlanes(handle, srcPlanes, width, strides, height, + subsamp, jpegBuf, jpegSize, jpegQual, flags); + + bailout: + return retval; +} + /* Decompressor */ @@ -1296,16 +1354,15 @@ void my_reset_marker_reader(j_decompress_ptr dinfo) { } -DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, - int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, - int height, int pixelFormat, int flags) +DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, + unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, int flags) { int i, retval=0; JSAMPROW *row_pointer=NULL; JSAMPLE *_tmpbuf[MAX_COMPONENTS]; JSAMPROW *tmpbuf[MAX_COMPONENTS], *inbuf[MAX_COMPONENTS]; int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS]; - JSAMPLE *ptr=srcBuf; - unsigned long yuvsize=0; + JSAMPLE *ptr; jpeg_component_info *compptr; #ifndef JCS_EXTENSIONS unsigned char *rgbBuf=NULL; @@ -1322,12 +1379,14 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, } if((this->init&DECOMPRESS)==0) - _throw("tjDecodeYUV(): Instance has not been initialized for decompression"); + _throw("tjDecodeYUVPlanes(): Instance has not been initialized for decompression"); - if(srcBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT + if(!srcPlanes || !srcPlanes[0] || subsamp<0 || subsamp>=NUMSUBOPT || dstBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0 || pixelFormat>=TJ_NUMPF) - _throw("tjDecodeYUV(): Invalid argument"); + _throw("tjDecodeYUVPlanes(): Invalid argument"); + if(subsamp!=TJSAMP_GRAY && (!srcPlanes[1] || !srcPlanes[2])) + _throw("tjDecodeYUVPlanes(): Invalid argument"); if(setjmp(this->jerr.setjmp_buffer)) { @@ -1337,7 +1396,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, } if(pixelFormat==TJPF_CMYK) - _throw("tjDecodeYUV(): Cannot decode YUV images into CMYK pixels."); + _throw("tjDecodeYUVPlanes(): Cannot decode YUV images into CMYK pixels."); if(pitch==0) pitch=width*tjPixelSize[pixelFormat]; dinfo->image_width=width; @@ -1347,7 +1406,6 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1"); - yuvsize=tjBufSizeYUV2(width, pad, height, subsamp); if(setDecodeDefaults(dinfo, pixelFormat, subsamp, flags)==-1) { retval=-1; goto bailout; @@ -1381,14 +1439,14 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, RGB_PIXELSIZE!=tjPixelSize[pixelFormat])) { rgbBuf=(unsigned char *)malloc(width*height*3); - if(!rgbBuf) _throw("tjDecodeYUV(): Memory allocation failure"); + if(!rgbBuf) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); _pitch=pitch; pitch=width*3; _dstBuf=dstBuf; dstBuf=rgbBuf; } #endif if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL) - _throw("tjDecodeYUV(): Memory allocation failure"); + _throw("tjDecodeYUVPlanes(): Memory allocation failure"); for(i=0; icomp_info[i]; _tmpbuf[i]=(JSAMPLE *)malloc(PAD(compptr->width_in_blocks*DCTSIZE, 16) * compptr->v_samp_factor + 16); - if(!_tmpbuf[i]) _throw("tjDecodeYUV(): Memory allocation failure"); + if(!_tmpbuf[i]) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*compptr->v_samp_factor); - if(!tmpbuf[i]) _throw("tjDecodeYUV(): Memory allocation failure"); + if(!tmpbuf[i]) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); for(row=0; rowv_samp_factor; row++) { unsigned char *_tmpbuf_aligned= @@ -1415,17 +1473,15 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, cw[i]=pw*compptr->h_samp_factor/dinfo->max_h_samp_factor; ch[i]=ph*compptr->v_samp_factor/dinfo->max_v_samp_factor; inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]); - if(!inbuf[i]) _throw("tjDecodeYUV(): Memory allocation failure"); + if(!inbuf[i]) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); + ptr=srcPlanes[i]; for(row=0; row0)? strides[i]:cw[i]; } } - if(yuvsize!=(unsigned long)(ptr-srcBuf)) - _throw("tjDecodeYUV(): YUV image is not the correct size"); - for(row=0; rowmax_v_samp_factor) { JDIMENSION inrow=0, outrow=0; @@ -1458,16 +1514,43 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, return retval; } +DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, + int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, + int height, int pixelFormat, int flags) +{ + unsigned char *srcPlanes[3]; + int pw, ph, cw, ch, strides[3], retval=-1; -DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, - unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, - int width, int pad, int height, int flags) + if(srcBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT + || width<=0 || height<=0) + _throw("tjDecodeYUV(): Invalid argument"); + + pw=PAD(width, tjMCUWidth[subsamp]/8); + ph=PAD(height, tjMCUHeight[subsamp]/8); + cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; + + strides[0]=PAD(pw, pad); + strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + srcPlanes[0]=srcBuf; + srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph); + srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch); + + return tjDecodeYUVPlanes(handle, srcPlanes, strides, subsamp, dstBuf, width, + pitch, height, pixelFormat, flags); + + bailout: + return retval; +} + +DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, + unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, + int width, int *strides, int height, int flags) { int i, sfi, row, retval=0; JSAMPROW *outbuf[MAX_COMPONENTS]; int jpegwidth, jpegheight, jpegSubsamp, scaledw, scaledh; int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS], tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; - JSAMPLE *_tmpbuf=NULL, *ptr=dstBuf; JSAMPROW *tmpbuf[MAX_COMPONENTS]; + JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS]; int dctsize; getdinstance(handle); @@ -1478,11 +1561,11 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, } if((this->init&DECOMPRESS)==0) - _throw("tjDecompressToYUV2(): Instance has not been initialized for decompression"); + _throw("tjDecompressToYUVPlanes(): Instance has not been initialized for decompression"); - if(jpegBuf==NULL || jpegSize<=0 || dstBuf==NULL || width<0 || pad<1 - || !isPow2(pad) || height<0) - _throw("tjDecompressToYUV2(): Invalid argument"); + if(jpegBuf==NULL || jpegSize<=0 || !dstPlanes || !dstPlanes[0] || width<0 + || height<0) + _throw("tjDecompressToYUVPlanes(): Invalid argument"); if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1"); else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1"); @@ -1495,11 +1578,18 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, goto bailout; } - jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize); - jpeg_read_header(dinfo, TRUE); + if(!this->headerRead) + { + jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize); + jpeg_read_header(dinfo, TRUE); + } + this->headerRead=0; jpegSubsamp=getSubsamp(dinfo); if(jpegSubsamp<0) - _throw("tjDecompressToYUV2(): Could not determine subsampling type for JPEG image"); + _throw("tjDecompressToYUVPlanes(): Could not determine subsampling type for JPEG image"); + + if(jpegSubsamp!=TJSAMP_GRAY && (!dstPlanes[1] || !dstPlanes[2])) + _throw("tjDecompressToYUVPlanes(): Invalid argument"); jpegwidth=dinfo->image_width; jpegheight=dinfo->image_height; if(width==0) width=jpegwidth; @@ -1512,9 +1602,9 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, break; } if(scaledw>width || scaledh>height) - _throw("tjDecompressToYUV2(): Could not scale down to desired image dimensions"); + _throw("tjDecompressToYUVPlanes(): Could not scale down to desired image dimensions"); if(dinfo->num_components>3) - _throw("tjDecompressToYUV2(): JPEG image must have 3 or fewer components"); + _throw("tjDecompressToYUVPlanes(): JPEG image must have 3 or fewer components"); width=scaledw; height=scaledh; dinfo->scale_num=sf[i].num; @@ -1538,22 +1628,23 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, th[i]=compptr->v_samp_factor*dctsize; tmpbufsize+=iw[i]*th[i]; if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL) - _throw("tjDecompressToYUV2(): Memory allocation failure"); + _throw("tjDecompressToYUVPlanes(): Memory allocation failure"); + ptr=dstPlanes[i]; for(row=0; row0)? strides[i]:cw[i]; } } if(usetmpbuf) { if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL) - _throw("tjDecompressToYUV2(): Memory allocation failure"); + _throw("tjDecompressToYUVPlanes(): Memory allocation failure"); ptr=_tmpbuf; for(i=0; inum_components; i++) { if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL) - _throw("tjDecompressToYUV2(): Memory allocation failure"); + _throw("tjDecompressToYUVPlanes(): Memory allocation failure"); for(row=0; rowimage_width; jpegheight=dinfo->image_height; + if(width==0) width=jpegwidth; + if(height==0) height=jpegheight; + + for(i=0; iwidth || scaledh>height) + _throw("tjDecompressToYUV2(): Could not scale down to desired image dimensions"); + + pw=PAD(scaledw, tjMCUWidth[jpegSubsamp]/8); + ph=PAD(scaledh, tjMCUHeight[jpegSubsamp]/8); + cw=pw*8/tjMCUWidth[jpegSubsamp]; ch=ph*8/tjMCUHeight[jpegSubsamp]; + + strides[0]=PAD(pw, pad); + strides[1]=strides[2]=(jpegSubsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + dstPlanes[0]=dstBuf; + dstPlanes[1]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph); + dstPlanes[2]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch); + + this->headerRead=1; + return tjDecompressToYUVPlanes(handle, jpegBuf, jpegSize, dstPlanes, width, + strides, height, flags); + + bailout: + return retval; + +} + DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int flags) diff --git a/turbojpeg.h b/turbojpeg.h index 36ede71f..66b33d67 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -717,6 +717,65 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, unsigned long *jpegSize, int jpegQual, int flags); +/** + * Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if compressing a grayscale image) that contain a + * YUV image to be compressed. These planes can be contiguous or + * non-contiguous in memory. Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the MCU block width (see #tjMCUWidth), then an + * intermediate buffer copy will be performed within TurboJPEG. + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the YUV source image. Setting the + * stride for any plane to 0 is the same as setting it to the component + * width for the plane. If stride is NULL, then the strides + * for all planes will be set to their respective component widths. You + * can adjust the strides in order to specify an arbitrary amount of + * line padding in each plane or to create a JPEG image from a subregion + * of a larger YUV planar image. + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * @param subsamp the level of chrominance subsampling used in the source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * @param jpegBuf address of a pointer to an image buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer + * to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using + * #tjAlloc() and let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the + * buffer for you, or + * -# pre-allocate the buffer to a "worst case" size determined by + * calling #tjBufSize(). This should ensure that the buffer never has + * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the + * size of your pre-allocated buffer. In any case, unless you have + * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon + * return from this function, as it may have changed. + * @param jpegSize pointer to an unsigned long variable that holds the size of + * the JPEG image buffer. If *jpegBuf points to a + * pre-allocated buffer, then *jpegSize should be set to the + * size of the buffer. Upon return, *jpegSize will contain the + * size of the JPEG image (in bytes.) + * @param jpegQual the image quality of the generated JPEG image (1 = worst, + 100 = best) + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) +*/ +DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, + unsigned char **srcBufs, int width, int *strides, int height, int subsamp, + unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags); + + /** * The maximum size of the buffer (in bytes) required to hold a JPEG image with * the given parameters. The number of bytes returned by this function is @@ -804,6 +863,56 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *dstBuf, int pad, int subsamp, int flags); +/** + * Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image + * planes. This function uses the accelerated color conversion routines in the + * underlying codec but does not execute any of the other steps in the JPEG + * compression process. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels + * to be encoded + * @param width width (in pixels) of the source image + * @param pitch bytes per line of the source image. Normally, this should be + * width * #tjPixelSize[pixelFormat] if the image is unpadded, + * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of + * the image is padded to the nearest 32-bit boundary, as is the case + * for Windows bitmaps. You can also be clever and use this parameter + * to skip lines, etc. Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat]. + * @param height height (in pixels) of the source image + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if generating a grayscale image) that will + * receive the encoded image. These planes can be contiguous or + * non-contiguous in memory. Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the output image. Setting the + * stride for any plane to 0 is the same as setting it to the component + * width for the plane. If stride is NULL, then the strides + * for all planes will be set to their respective component widths. You + * can adjust the strides in order to add an arbitrary amount of line + * padding to each plane or to encode an RGB or grayscale image into a + * subregion of a larger YUV planar image. + * @param subsamp the level of chrominance subsampling to be used when + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for + * X Video, subsamp should be set to @ref TJSAMP_420. This + * produces an image compatible with the I420 (AKA "YUV420P") format. + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) +*/ +DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, + unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, + unsigned char **dstPlanes, int *strides, int subsamp, int flags); + + /** * Create a TurboJPEG decompressor instance. * @@ -942,6 +1051,56 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, int width, int pad, int height, int flags); +/** + * Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image + * planes. This function performs JPEG decompression but leaves out the color + * conversion step, so a planar YUV image is generated instead of an RGB image. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * @param jpegSize size of the JPEG image (in bytes) + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decompressing a grayscale image) that will + * receive the YUV image. These planes can be contiguous or + * non-contiguous in memory. Each plane should be at least + * {component stride} * {scaled component height} bytes in + * size. (See below for a description of stride, and refer to @ref + * YUVnotes "YUV Image Format Notes" for a description of component + * height.) + * @param width desired width (in pixels) of the YUV image. If this is + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the + * largest possible image that will fit within the desired width. If + * width is set to 0, then only the height will be considered + * when determining the scaled image size. If the scaled width is not + * an even multiple of the MCU block width (see #tjMCUWidth), then an + * intermediate buffer copy will be performed within TurboJPEG. + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the output image. Setting the + * stride for any plane to 0 is the same as setting it to the scaled + * component width for the plane. If stride is NULL, then the + * strides for all planes will be set to their respective scaled + * component widths. You can adjust the strides in order to add an + * arbitrary amount of line padding to each plane or to decompress the + * JPEG image into a subregion of a larger YUV planar image. + * @param height desired height (in pixels) of the YUV image. If this is + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the + * largest possible image that will fit within the desired height. If + * height is set to 0, then only the width will be considered + * when determining the scaled image size. If the scaled height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) + */ +DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, + unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, + int width, int *strides, int height, int flags); + + /** * Decode a YUV planar image into an RGB or grayscale image. This function * uses the accelerated color conversion routines in the underlying @@ -987,6 +1146,57 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, int height, int pixelFormat, int flags); +/** + * Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale + * image. This function uses the accelerated color conversion routines in the + * underlying codec but does not execute any of the other steps in the JPEG + * decompression process. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decoding a grayscale image) that contain a + * YUV image to be decoded. These planes can be contiguous or + * non-contiguous in memory. Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the YUV source image. Setting the + * stride for any plane to 0 is the same as setting it to the component + * width for the plane. If stride is NULL, then the strides + * for all planes will be set to their respective component widths. You + * can adjust the strides in order to specify an arbitrary amount of + * line padding in each plane or to decode a subregion of a larger YUV + * planar image. + * @param subsamp the level of chrominance subsampling used in the YUV source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * @param dstBuf pointer to an image buffer that will receive the decoded + * image. This buffer should normally be pitch * height + * bytes in size, but the dstBuf pointer can also be used to + * decode into a specific region of a larger buffer. + * @param width width (in pixels) of the source and destination images + * @param pitch bytes per line of the destination image. Normally, this should + * be width * #tjPixelSize[pixelFormat] if the destination + * image is unpadded, or #TJPAD(width * + * #tjPixelSize[pixelFormat]) if each line of the destination + * image should be padded to the nearest 32-bit boundary, as is the case + * for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the + * equivalent of setting it to width * + * #tjPixelSize[pixelFormat]. + * @param height height (in pixels) of the source and destination images + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) + */ +DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, + unsigned char **srcPlanes, int *strides, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, int flags); + + /** * Create a new TurboJPEG transformer instance. * From 8c2c4158477fc970a9406d00eae35dc4711b5899 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 12 Aug 2014 15:06:30 +0000 Subject: [PATCH 950/985] Reformat TurboJPEG C API documentation to improve ease of maintenance and to make it more consistent with the javadoc formatting; fix minor error in tjCompressFromYUV() prototype. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1344 632fc199-4ca6-4c93-a231-07263d6284db --- doc/html/group___turbo_j_p_e_g.html | 218 ++++---- doc/html/search/all_74.js | 2 +- doc/html/search/functions_74.js | 2 +- doc/html/structtjtransform.html | 10 +- turbojpeg.h | 750 ++++++++++++++++------------ 5 files changed, 537 insertions(+), 445 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 8ca4eda2..72a36568 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -232,9 +232,9 @@ Functions
    DLLEXPORT int DLLCALL tjCompressFromYUV (tjhandle handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
     Compress a YUV planar image into a JPEG image. More...
     
    DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcBufs, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
     Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
     
    DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)
     Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
     
    DLLEXPORT unsigned long DLLCALL tjBufSize (int width, int height, int jpegSubsamp)
     The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. More...
     
    - - + +
    widthwidth of the image (in pixels)
    heightheight of the image (in pixels)
    widthwidth of the image (in pixels)
    heightheight of the image (in pixels)
    jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
    @@ -898,9 +898,9 @@ Variables

    The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.

    Parameters
    - - - + + +
    widthwidth of the image (in pixels)
    padthe width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    heightheight of the image (in pixels)
    widthwidth of the image (in pixels)
    padthe width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    heightheight of the image (in pixels)
    subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
    @@ -990,21 +990,21 @@ Variables

    Compress an RGB, grayscale, or CMYK image into a JPEG image.

    Parameters
    - - - - - - + + + + + + - - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + + +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
    3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
    -If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1088,20 +1088,20 @@ If you choose option 1, *jpegSize should be set to the size of your

    Compress a YUV planar image into a JPEG image.

    Parameters
    - - - - - - + + + + + + - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
    3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
    -If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1110,7 +1110,7 @@ If you choose option 1, *jpegSize should be set to the size of your
    - +
    @@ -1124,7 +1124,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1185,20 +1185,20 @@ If you choose option 1, *jpegSize should be set to the size of your

    Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image.

    Parameters
    unsigned char ** srcBufs, srcPlanes,
    - - - - - - + + + + + + - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    handlea handle to a TurboJPEG compressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
    3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
    -If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1283,15 +1283,15 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

    Parameters
    - - - - - - - - - + + + + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
    padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
    dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
    widthwidth (in pixels) of the source and destination images
    pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source and destination images
    pixelFormatpixel format of the destination image (see Pixel formats.)
    handlea handle to a TurboJPEG decompressor or transformer instance
    srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
    padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
    dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
    widthwidth (in pixels) of the source and destination images
    pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source and destination images
    pixelFormatpixel format of the destination image (see Pixel formats.)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1376,15 +1376,15 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

    Parameters
    - - - - - - - - - + + + + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
    subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
    dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
    widthwidth (in pixels) of the source and destination images
    pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source and destination images
    pixelFormatpixel format of the destination image (see Pixel formats.)
    handlea handle to a TurboJPEG decompressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
    subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
    dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
    widthwidth (in pixels) of the source and destination images
    pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source and destination images
    pixelFormatpixel format of the destination image (see Pixel formats.)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1462,14 +1462,14 @@ If you choose option 1, *jpegSize should be set to the size of your

    Decompress a JPEG image to an RGB, grayscale, or CMYK image.

    Parameters
    - - - - - - - - + + + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer.
    widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
    pitchbytes per line of the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat].
    heightdesired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size.
    pixelFormatpixel format of the destination image (see Pixel formats.)
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer.
    widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
    pitchbytes per line of the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat].
    heightdesired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size.
    pixelFormatpixel format of the destination image (see Pixel formats.)
    flagsthe bitwise OR of one or more of the flags.
    @@ -1535,12 +1535,12 @@ If you choose option 1, *jpegSize should be set to the size of your

    Retrieve information about a JPEG image without decompressing it.

    Parameters
    - - - - - - + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing a JPEG image
    jpegSizesize of the JPEG image (in bytes)
    widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image
    heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image
    jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see Chrominance subsampling options.)
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing a JPEG image
    jpegSizesize of the JPEG image (in bytes)
    widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image
    heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image
    jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see Chrominance subsampling options.)
    jpegColorspacepointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see JPEG colorspaces.)
    @@ -1613,13 +1613,13 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

    Parameters
    - - - - - - - + + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
    widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
    heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
    widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
    heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    flagsthe bitwise OR of one or more of the flags.
    @@ -1692,13 +1692,13 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

    Parameters
    - - - - - - - + + + + + + +
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
    heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    handlea handle to a TurboJPEG decompressor or transformer instance
    jpegBufpointer to a buffer containing the JPEG image to decompress
    jpegSizesize of the JPEG image (in bytes)
    dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
    heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    flagsthe bitwise OR of one or more of the flags.
    @@ -1808,15 +1808,15 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

    Parameters
    - - - - - - - - - + + + + + + + + +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
    padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
    subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
    padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
    subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
    flagsthe bitwise OR of one or more of the flags.
    @@ -1901,15 +1901,15 @@ If you choose option 1, *jpegSize should be set to the size of your

    This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

    Parameters
    - - - - - - - - - + + + + + + + + +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.
    subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
    handlea handle to a TurboJPEG compressor or transformer instance
    srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
    widthwidth (in pixels) of the source image
    pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source image
    pixelFormatpixel format of the source image (see Pixel formats.)
    dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.
    subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
    flagsthe bitwise OR of one or more of the flags.
    @@ -2109,18 +2109,18 @@ If you choose option 1, *jpegSize should be set to the size of your

    Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.

    Parameters
    - - - - + + + + - - +If you choose option 1, dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed. + +
    handlea handle to a TurboJPEG transformer instance
    jpegBufpointer to a buffer containing the JPEG image to transform
    jpegSizesize of the JPEG image (in bytes)
    nthe number of transformed JPEG images to generate
    handlea handle to a TurboJPEG transformer instance
    jpegBufpointer to a buffer containing the JPEG image to transform
    jpegSizesize of the JPEG image (in bytes)
    nthe number of transformed JPEG images to generate
    dstBufspointer to an array of n image buffers. dstBufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer for you, or
    3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize() with the transformed or cropped width and height. This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
    -If you choose option 1, dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed.
    dstSizespointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the JPEG image (in bytes.)
    transformspointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.
    dstSizespointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the JPEG image (in bytes.)
    transformspointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.
    flagsthe bitwise OR of one or more of the flags.
    diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js index e371aaed..7b508306 100644 --- a/doc/html/search/all_74.js +++ b/doc/html/search/all_74.js @@ -10,7 +10,7 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], ['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]], ['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]], ['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]], diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js index 8e7e1f57..35a3f8e1 100644 --- a/doc/html/search/functions_74.js +++ b/doc/html/search/functions_74.js @@ -5,7 +5,7 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html index 54e82e5d..7a07c2aa 100644 --- a/doc/html/structtjtransform.html +++ b/doc/html/structtjtransform.html @@ -129,11 +129,11 @@ Data Fields

    This allows for custom filters or other transformations to be applied in the frequency domain.

    Parameters
    - - - - - + + + + +
    coeffspointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)
    arrayRegiontjregion structure containing the width and height of the array pointed to by coeffs as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.
    planeRegiontjregion structure containing the width and height of the component plane to which coeffs belongs
    componentIDID number of the component plane to which coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
    transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
    coeffspointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)
    arrayRegiontjregion structure containing the width and height of the array pointed to by coeffs as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.
    planeRegiontjregion structure containing the width and height of the component plane to which coeffs belongs
    componentIDID number of the component plane to which coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
    transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
    transforma pointer to a tjtransform structure that specifies the parameters and/or cropping region for this transform
    diff --git a/turbojpeg.h b/turbojpeg.h index 66b33d67..90985b3a 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -550,26 +550,29 @@ typedef struct tjtransform * to be applied in the frequency domain. * * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: - * this pointer is not guaranteed to be valid once the callback - * returns, so applications wishing to hand off the DCT coefficients - * to another function or library should make a copy of them within - * the body of the callback.) + * this pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * * @param arrayRegion #tjregion structure containing the width and height of - * the array pointed to by coeffs as well as its offset - * relative to the component plane. TurboJPEG implementations may - * choose to split each component plane into multiple DCT coefficient - * arrays and call the callback function once for each array. + * the array pointed to by coeffs as well as its offset relative to + * the component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * * @param planeRegion #tjregion structure containing the width and height of - * the component plane to which coeffs belongs + * the component plane to which coeffs belongs + * * @param componentID ID number of the component plane to which - * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of - * 0, 1, and 2 in typical JPEG images.) + * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, + * and 2 in typical JPEG images.) + * * @param transformID ID number of the transformed image to which - * coeffs belongs. This is the same as the index of the - * transform in the transforms array that was passed to - * #tjTransform(). + * coeffs belongs. This is the same as the index of the transform + * in the transforms array that was passed to #tjTransform(). + * * @param transform a pointer to a #tjtransform structure that specifies the - * parameters and/or cropping region for this transform + * parameters and/or cropping region for this transform * * @return 0 if the callback was successful, or -1 if an error occurred. */ @@ -616,46 +619,56 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); * Compress an RGB, grayscale, or CMYK image into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB, grayscale, or - * CMYK pixels to be compressed + * CMYK pixels to be compressed + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer + * to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -668,47 +681,56 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, * Compress a YUV planar image into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * compressed. The size of this buffer should match the value returned - * by #tjBufSizeYUV2() for the given image width, height, padding, and - * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image - * planes should be stored sequentially in the source buffer (refer to - * @ref YUVnotes "YUV Image Format Notes".) + * compressed. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * * @param pad the line padding used in the source image. For instance, if each - * line in each plane of the YUV image is padded to the nearest multiple - * of 4 bytes, then pad should be set to 4. + * line in each plane of the YUV image is padded to the nearest multiple of 4 + * bytes, then pad should be set to 4. + * * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -721,58 +743,66 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if compressing a grayscale image) that contain a - * YUV image to be compressed. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * image to be compressed. These planes can be contiguous or non-contiguous in + * memory. Each plane should be at least + * {component stride} * {component height} bytes in size. (See + * below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to specify an arbitrary amount of - * line padding in each plane or to create a JPEG image from a subregion - * of a larger YUV planar image. + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to specify an arbitrary amount of line padding in each plane or to + * create a JPEG image from a subregion of a larger YUV planar image. + * * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, - unsigned char **srcBufs, int width, int *strides, int height, int subsamp, + unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags); @@ -788,10 +818,12 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, * handled. * * @param width width of the image (in pixels) + * * @param height height of the image (in pixels) + * * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) * * @return the maximum size of the buffer (in bytes) required to hold the * image, or -1 if the arguments are out of bounds. @@ -805,11 +837,14 @@ DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height, * the given parameters. * * @param width width of the image (in pixels) + * * @param pad the width of each line in each plane of the image is padded to - * the nearest multiple of this number of bytes (must be a power of 2.) + * the nearest multiple of this number of bytes (must be a power of 2.) + * * @param height height of the image (in pixels) + * * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) + * @ref TJSAMP "Chrominance subsampling options".) * * @return the size of the buffer (in bytes) required to hold the image, or * -1 if the arguments are out of bounds. @@ -825,36 +860,44 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * process. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded + * to be encoded + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this - * buffer based on the image width, height, padding, and level of - * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will - * be stored sequentially in the buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of chrominance subsampling. + * The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer (refer to @ref YUVnotes "YUV Image Format Notes".) + * * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a - * power of 2.) To generate images suitable for X Video, pad - * should be set to 4. + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for - * X Video, subsamp should be set to @ref TJSAMP_420. This - * produces an image compatible with the I420 (AKA "YUV420P") format. + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -870,41 +913,49 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * compression process. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded + * to be encoded + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if generating a grayscale image) that will - * receive the encoded image. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to add an arbitrary amount of line - * padding to each plane or to encode an RGB or grayscale image into a - * subregion of a larger YUV planar image. + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to add an arbitrary amount of line padding to each plane or to encode + * an RGB or grayscale image into a subregion of a larger YUV planar image. + * * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for - * X Video, subsamp should be set to @ref TJSAMP_420. This - * produces an image compatible with the I420 (AKA "YUV420P") format. + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -926,18 +977,24 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); * Retrieve information about a JPEG image without decompressing it. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing a JPEG image + * * @param jpegSize size of the JPEG image (in bytes) + * * @param width pointer to an integer variable that will receive the width (in - * pixels) of the JPEG image + * pixels) of the JPEG image + * * @param height pointer to an integer variable that will receive the height - * (in pixels) of the JPEG image + * (in pixels) of the JPEG image + * * @param jpegSubsamp pointer to an integer variable that will receive the - * level of chrominance subsampling used when compressing the JPEG image - * (see @ref TJSAMP "Chrominance subsampling options".) + * level of chrominance subsampling used when compressing the JPEG image (see + * @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegColorspace pointer to an integer variable that will receive one - * of the JPEG colorspace constants, indicating the colorspace of the - * JPEG image (see @ref TJCS "JPEG colorspaces".) + * of the JPEG colorspace constants, indicating the colorspace of the JPEG + * image (see @ref TJCS "JPEG colorspaces".) * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -951,7 +1008,7 @@ DLLEXPORT int DLLCALL tjDecompressHeader3(tjhandle handle, * this implementation of TurboJPEG supports. * * @param numscalingfactors pointer to an integer variable that will receive - * the number of elements in the list + * the number of elements in the list * * @return a pointer to a list of fractional scaling factors, or NULL if an * error is encountered (see #tjGetErrorStr().) @@ -963,42 +1020,48 @@ DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); * Decompress a JPEG image to an RGB, grayscale, or CMYK image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstBuf pointer to an image buffer that will receive the decompressed - * image. This buffer should normally be pitch * scaledHeight - * bytes in size, where scaledHeight can be determined by - * calling #TJSCALED() with the JPEG image height and one of the scaling - * factors returned by #tjGetScalingFactors(). The dstBuf - * pointer may also be used to decompress into a specific region of a - * larger buffer. + * image. This buffer should normally be pitch * scaledHeight bytes + * in size, where scaledHeight can be determined by calling + * #TJSCALED() with the JPEG image height and one of the scaling factors + * returned by #tjGetScalingFactors(). The dstBuf pointer may also be + * used to decompress into a specific region of a larger buffer. + * * @param width desired width (in pixels) of the destination image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. + * * @param pitch bytes per line of the destination image. Normally, this is - * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed - * image is unpadded, else #TJPAD(scaledWidth * - * #tjPixelSize[pixelFormat]) if each line of the decompressed - * image is padded to the nearest 32-bit boundary, as is the case for - * Windows bitmaps. (NOTE: scaledWidth can be determined by - * calling #TJSCALED() with the JPEG image width and one of the scaling - * factors returned by #tjGetScalingFactors().) You can also be clever - * and use the pitch parameter to skip lines, etc. Setting this - * parameter to 0 is the equivalent of setting it to - * scaledWidth * #tjPixelSize[pixelFormat]. + * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed image + * is unpadded, else #TJPAD(scaledWidth * #tjPixelSize[pixelFormat]) + * if each line of the decompressed image is padded to the nearest 32-bit + * boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth + * can be determined by calling #TJSCALED() with the JPEG image width and one + * of the scaling factors returned by #tjGetScalingFactors().) You can also be + * clever and use the pitch parameter to skip lines, etc. Setting this + * parameter to 0 is the equivalent of setting it to + * scaledWidth * #tjPixelSize[pixelFormat]. + * * @param height desired height (in pixels) of the destination image. If this - * is different than the height of the JPEG image being decompressed, - * then TurboJPEG will use scaling in the JPEG decompressor to generate - * the largest possible image that will fit within the desired height. - * If height is set to 0, then only the width will be - * considered when determining the scaled image size. + * is different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. + * * @param pixelFormat pixel format of the destination image (see @ref - * TJPF "Pixel formats".) + * TJPF "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1013,36 +1076,42 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * image is generated instead of an RGB image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this - * buffer based on the image width, height, padding, and level of - * subsampling. The Y, U (Cb), and V (Cr) image planes will be stored - * sequentially in the buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of subsampling. The Y, + * U (Cb), and V (Cr) image planes will be stored sequentially in the buffer + * (refer to @ref YUVnotes "YUV Image Format Notes".) + * * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. If the scaled width is not - * an even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a - * power of 2.) To generate images suitable for X Video, pad - * should be set to 4. + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired height. If - * height is set to 0, then only the width will be considered - * when determining the scaled image size. If the scaled height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1057,42 +1126,47 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * conversion step, so a planar YUV image is generated instead of an RGB image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decompressing a grayscale image) that will - * receive the YUV image. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {scaled component height} bytes in - * size. (See below for a description of stride, and refer to @ref - * YUVnotes "YUV Image Format Notes" for a description of component - * height.) + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the YUV image. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {scaled component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. If the scaled width is not - * an even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the - * stride for any plane to 0 is the same as setting it to the scaled - * component width for the plane. If stride is NULL, then the - * strides for all planes will be set to their respective scaled - * component widths. You can adjust the strides in order to add an - * arbitrary amount of line padding to each plane or to decompress the - * JPEG image into a subregion of a larger YUV planar image. + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the scaled component width for + * the plane. If stride is NULL, then the strides for all planes will + * be set to their respective scaled component widths. You can adjust the + * strides in order to add an arbitrary amount of line padding to each plane or + * to decompress the JPEG image into a subregion of a larger YUV planar image. + * * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired height. If - * height is set to 0, then only the width will be considered - * when determining the scaled image size. If the scaled height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1108,36 +1182,43 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, * process. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * decoded. The size of this buffer should match the value returned - * by #tjBufSizeYUV2() for the given image width, height, padding, and - * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image - * planes should be stored sequentially in the source buffer (refer to - * @ref YUVnotes "YUV Image Format Notes".) + * decoded. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * * @param pad Use this parameter to specify that the width of each line in each - * plane of the YUV source image is padded to the nearest multiple of - * this number of bytes (must be a power of 2.) + * plane of the YUV source image is padded to the nearest multiple of this + * number of bytes (must be a power of 2.) + * * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height - * bytes in size, but the dstBuf pointer can also be used to - * decode into a specific region of a larger buffer. + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * * @param width width (in pixels) of the source and destination images + * * @param pitch bytes per line of the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination - * image is unpadded, or #TJPAD(width * - * #tjPixelSize[pixelFormat]) if each line of the destination - * image should be padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the - * equivalent of setting it to width * - * #tjPixelSize[pixelFormat]. + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source and destination images + * * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1153,42 +1234,48 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * decompression process. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decoding a grayscale image) that contain a - * YUV image to be decoded. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to specify an arbitrary amount of - * line padding in each plane or to decode a subregion of a larger YUV - * planar image. + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to specify an arbitrary amount of line padding in each plane or to + * decode a subregion of a larger YUV planar image. + * * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height - * bytes in size, but the dstBuf pointer can also be used to - * decode into a specific region of a larger buffer. + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * * @param width width (in pixels) of the source and destination images + * * @param pitch bytes per line of the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination - * image is unpadded, or #TJPAD(width * - * #tjPixelSize[pixelFormat]) if each line of the destination - * image should be padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the - * equivalent of setting it to width * - * #tjPixelSize[pixelFormat]. + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source and destination images + * * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1220,38 +1307,43 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void); * source coefficients multiple times. * * @param handle a handle to a TurboJPEG transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to transform + * * @param jpegSize size of the JPEG image (in bytes) + * * @param n the number of transformed JPEG images to generate + * * @param dstBufs pointer to an array of n image buffers. dstBufs[i] - * will receive a JPEG image that has been transformed using the - * parameters in transforms[i]. TurboJPEG has the ability to - * reallocate the JPEG buffer to accommodate the size of the JPEG image. - * Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize() with the transformed or cropped width and - * height. This should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, dstSizes[i] should be set to - * the size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check dstBufs[i] - * upon return from this function, as it may have changed. + * will receive a JPEG image that has been transformed using the parameters in + * transforms[i]. TurboJPEG has the ability to reallocate the JPEG + * buffer to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize() with the transformed or cropped width and height. This should + * ensure that the buffer never has to be re-allocated (setting + * #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, dstSizes[i] should be set to the size of + * your pre-allocated buffer. In any case, unless you have set + * #TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return + * from this function, as it may have changed. + * * @param dstSizes pointer to an array of n unsigned long variables that will - * receive the actual sizes (in bytes) of each transformed JPEG image. - * If dstBufs[i] points to a pre-allocated buffer, then - * dstSizes[i] should be set to the size of the buffer. Upon - * return, dstSizes[i] will contain the size of the JPEG image - * (in bytes.) + * receive the actual sizes (in bytes) of each transformed JPEG image. If + * dstBufs[i] points to a pre-allocated buffer, then + * dstSizes[i] should be set to the size of the buffer. Upon return, + * dstSizes[i] will contain the size of the JPEG image (in bytes.) + * * @param transforms pointer to an array of n #tjtransform structures, each of - * which specifies the transform parameters and/or cropping region for - * the corresponding transformed output image. + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed output image. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1264,7 +1356,7 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf, * Destroy a TurboJPEG compressor, decompressor, or transformer instance. * * @param handle a handle to a TurboJPEG compressor, decompressor or - * transformer instance + * transformer instance * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1280,7 +1372,7 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle handle); * @param bytes the number of bytes to allocate * * @return a pointer to a newly-allocated buffer with the specified number of - * bytes + * bytes * * @sa tjFree() */ From 4db50792eb0155e74e48ebb002c82635019c49be Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 12 Aug 2014 15:52:51 +0000 Subject: [PATCH 951/985] Oops. Parameter name is "strides", not "stride" git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1345 632fc199-4ca6-4c93-a231-07263d6284db --- doc/html/group___turbo_j_p_e_g.html | 8 ++++---- turbojpeg.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 72a36568..e40189ef 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -1188,7 +1188,7 @@ If you choose option 1, *jpegSize should be set to the size of your handlea handle to a TurboJPEG compressor or transformer instance srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.) widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG. - stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image. + stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image. heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG. subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.) jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
      @@ -1378,7 +1378,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1697,7 +1697,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
      handlea handle to a TurboJPEG decompressor or transformer instance
      srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
      subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
      dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
      widthwidth (in pixels) of the source and destination images
      jpegSizesize of the JPEG image (in bytes)
      dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
      widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
      stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
      heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
      flagsthe bitwise OR of one or more of the flags.
      @@ -1908,7 +1908,7 @@ If you choose option 1, *jpegSize should be set to the size of your heightheight (in pixels) of the source image pixelFormatpixel format of the source image (see Pixel formats.) dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.) - stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image. + stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image. subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format. flagsthe bitwise OR of one or more of the flags. diff --git a/turbojpeg.h b/turbojpeg.h index 90985b3a..0ba7070c 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -759,7 +759,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the YUV source image. Setting the stride * for any plane to 0 is the same as setting it to the component width for the - * plane. If stride is NULL, then the strides for all planes will be + * plane. If strides is NULL, then the strides for all planes will be * set to their respective component widths. You can adjust the strides in * order to specify an arbitrary amount of line padding in each plane or to * create a JPEG image from a subregion of a larger YUV planar image. @@ -943,7 +943,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the output image. Setting the stride for * any plane to 0 is the same as setting it to the component width for the - * plane. If stride is NULL, then the strides for all planes will be + * plane. If strides is NULL, then the strides for all planes will be * set to their respective component widths. You can adjust the strides in * order to add an arbitrary amount of line padding to each plane or to encode * an RGB or grayscale image into a subregion of a larger YUV planar image. @@ -1151,8 +1151,8 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the output image. Setting the stride for * any plane to 0 is the same as setting it to the scaled component width for - * the plane. If stride is NULL, then the strides for all planes will - * be set to their respective scaled component widths. You can adjust the + * the plane. If strides is NULL, then the strides for all planes + * will be set to their respective scaled component widths. You can adjust the * strides in order to add an arbitrary amount of line padding to each plane or * to decompress the JPEG image into a subregion of a larger YUV planar image. * @@ -1246,7 +1246,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the YUV source image. Setting the stride * for any plane to 0 is the same as setting it to the component width for the - * plane. If stride is NULL, then the strides for all planes will be + * plane. If strides is NULL, then the strides for all planes will be * set to their respective component widths. You can adjust the strides in * order to specify an arbitrary amount of line padding in each plane or to * decode a subregion of a larger YUV planar image. From e9ccb2ff221be24485360c4b0e296cc7abb8b3fa Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 14 Aug 2014 16:54:04 +0000 Subject: [PATCH 952/985] Clean up exception handling in the JNI code. The exception is actually not thrown until the function exits, so we can let the code fall through to bailout: if the TurboJPEG C function fails. Also, per the JNI spec, no other JNI functions can be called between GetPrimitiveArrayCritical() and ReleasePrimitiveArrayCritical(). This hasn't caused any problems thus far, but better safe than sorry. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1346 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 79 +++++++++---------------------------------------- 1 file changed, 14 insertions(+), 65 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 4b5578ff..53bdceba 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -134,12 +134,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 if(tjCompress2(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, &jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - jpegBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); @@ -191,12 +186,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 if(tjCompress2(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), height, pf, &jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - jpegBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); @@ -237,12 +227,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom if(tjCompressFromYUV(handle, srcBuf, width, pad, height, subsamp, &jpegBuf, &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - jpegBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); @@ -282,12 +267,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjEncodeYUV3(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, dstBuf, pad, subsamp, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - dstBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -337,12 +317,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjEncodeYUV3(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), height, pf, dstBuf, pad, subsamp, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - dstBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -433,10 +408,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if(tjDecompressHeader3(handle, jpegBuf, (unsigned long)jpegSize, &width, &height, &jpegSubsamp, &jpegColorspace)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); _throw(tjGetErrorStr()); - } + (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); jpegBuf=NULL; bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); @@ -449,6 +422,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress (*env)->SetIntField(env, obj, _fid, height); bailout: + if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); return; } @@ -480,12 +454,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, &dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); - dstBuf=jpegBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -531,12 +500,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, &dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), height, pf, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); - dstBuf=jpegBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -584,12 +548,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if(tjDecompressToYUV2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, desiredWidth, pad, desiredHeight, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); - dstBuf=jpegBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -635,12 +594,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ if(tjDecodeYUV(handle, srcBuf, pad, subsamp, &dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - dstBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -680,12 +634,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ if(tjDecodeYUV(handle, srcBuf, pad, subsamp, &dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), height, pf, flags)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - dstBuf=srcBuf=NULL; _throw(tjGetErrorStr()); - } bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); @@ -851,7 +800,6 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf } } - bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0)); for(i=0; iGetArrayLength(env, jdstBufs[i]) GetPrimitiveArrayCritical(env, jdstBufs[i], 0)); } + bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0)); + for(i=0; iGetPrimitiveArrayCritical(env, jdstBufs[i], 0)); if(tjTransform(handle, jpegBuf, jpegSize, n, dstBufs, dstSizes, t, flags|TJFLAG_NOREALLOC)==-1) - { - (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); - jpegBuf=NULL; - for(i=0; iReleasePrimitiveArrayCritical(env, jdstBufs[i], dstBufs[i], 0); - dstBufs[i]=NULL; - } _throw(tjGetErrorStr()); + + for(i=0; iReleasePrimitiveArrayCritical(env, jdstBufs[i], dstBufs[i], 0); + dstBufs[i]=NULL; } + (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); + jpegBuf=NULL; jdstSizes=(*env)->NewIntArray(env, n); bailif0(dstSizesi=(*env)->GetIntArrayElements(env, jdstSizes, 0)); for(i=0; iReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); + if(dstSizesi) (*env)->ReleaseIntArrayElements(env, jdstSizes, dstSizesi, 0); if(dstBufs) { for(i=0; iReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); if(jdstBufs) free(jdstBufs); if(dstSizes) free(dstSizes); - if(dstSizesi) (*env)->ReleaseIntArrayElements(env, jdstSizes, dstSizesi, 0); if(t) free(t); return jdstSizes; } From 91c739f5413d4720bf279b8e58e6105a717a1f5f Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 13:18:58 +0000 Subject: [PATCH 953/985] Allow the int pixel versions of the various TurboJPEG JNI functions to share the same code as the byte pixel versions. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1348 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 247 ++++++++++++++++++++---------------------------- 1 file changed, 105 insertions(+), 142 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 53bdceba..5c1f6e31 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -102,10 +102,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init return; } -JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIIIII_3BIII - (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, - jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, - jint jpegQual, jint flags) +JNIEXPORT jint JNICALL TJCompressor_compress + (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, + jint width, jint pitch, jint height, jint pf, jbyteArray dst, + jint jpegSubsamp, jint jpegQual, jint flags) { tjhandle handle=0; unsigned long jpegSize=0; @@ -121,8 +121,8 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 _throw("Mismatch between Java and C API"); actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; - arraySize=(y+height-1)*actualPitch + x+width; - if((*env)->GetArrayLength(env, src)GetArrayLength(env, src)*srcElementSizeGetArrayLength(env, dst)<(jsize)jpegSize) @@ -142,14 +142,22 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 return (jint)jpegSize; } +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIIIII_3BIII + (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, + jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, + jint jpegQual, jint flags) +{ + return TJCompressor_compress(env, obj, src, 1, x, y, width, pitch, height, + pf, dst, jpegSubsamp, jpegQual, flags); +} + JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, jint flags) { - return Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIIIII_3BIII( - env, obj, src, 0, 0, width, pitch, height, pf, dst, jpegSubsamp, jpegQual, - flags); + return TJCompressor_compress(env, obj, src, 1, 0, 0, width, pitch, height, + pf, dst, jpegSubsamp, jpegQual, flags); } JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIIIII_3BIII @@ -157,51 +165,33 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 jint stride, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, jint flags) { - tjhandle handle=0; - unsigned long jpegSize=0; - jsize arraySize=0, actualStride; - unsigned char *srcBuf=NULL, *jpegBuf=NULL; - - gethandle(); - - if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1 - || stride<0) + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) _throw("Invalid argument in compress()"); - if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) - _throw("Mismatch between Java and C API"); if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when compressing from an integer buffer."); - actualStride=(stride==0)? width:stride; - arraySize=(y+height-1)*actualStride + x+width; - if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)<(jsize)jpegSize) - _throw("Destination buffer is not large enough"); - - bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); - bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - - if(tjCompress2(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width, - stride*sizeof(jint), height, pf, &jpegBuf, &jpegSize, jpegSubsamp, - jpegQual, flags|TJFLAG_NOREALLOC)==-1) - _throw(tjGetErrorStr()); + return TJCompressor_compress(env, obj, src, sizeof(jint), x, y, width, + stride*sizeof(jint), height, pf, dst, jpegSubsamp, jpegQual, flags); bailout: - if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); - if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); - return (jint)jpegSize; + return 0; } JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII - (JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch, + (JNIEnv *env, jobject obj, jintArray src, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, jint flags) { - return Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIIIII_3BIII( - env, obj, src, 0, 0, width, pitch, height, pf, dst, jpegSubsamp, jpegQual, - flags); + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in compress()"); + if(tjPixelSize[pf]!=sizeof(jint)) + _throw("Pixel format must be 32-bit when compressing from an integer buffer."); + + return TJCompressor_compress(env, obj, src, sizeof(jint), 0, 0, width, + stride*sizeof(jint), height, pf, dst, jpegSubsamp, jpegQual, flags); + + bailout: + return 0; } JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII @@ -235,10 +225,10 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom return (jint)jpegSize; } -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII - (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, - jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, - jint flags) +JNIEXPORT void JNICALL TJCompressor_encodeYUV + (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, + jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint pad, + jint subsamp, jint flags) { tjhandle handle=0; jsize arraySize=0, actualPitch, yuvSize; @@ -253,8 +243,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ _throw("Mismatch between Java and C API"); actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; - arraySize=(y+height-1)*actualPitch + x+width; - if((*env)->GetArrayLength(env, src)GetArrayLength(env, src)*srcElementSize=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1 - || stride<0) + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) _throw("Invalid argument in encodeYUV()"); - if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) - _throw("Mismatch between Java and C API"); if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - actualStride=(stride==0)? width:stride; - arraySize=(y+height-1)*actualStride + x+width; - if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); - bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - - if(tjEncodeYUV3(handle, &srcBuf[(y*actualStride + x)*sizeof(int)], width, - stride*sizeof(jint), height, pf, dstBuf, pad, subsamp, flags)==-1) - _throw(tjGetErrorStr()); + return TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width, + stride*sizeof(jint), height, pf, dst, pad, subsamp, flags); bailout: - if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); return; } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII - (JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch, + (JNIEnv *env, jobject obj, jintArray src, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII( - env, obj, src, 0, 0, width, pitch, height, pf, dst, 4, subsamp, flags); + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in encodeYUV()"); + if(tjPixelSize[pf]!=sizeof(jint)) + _throw("Pixel format must be 32-bit when encoding from an integer buffer."); + + return TJCompressor_encodeYUV(env, obj, src, sizeof(jint), 0, 0, width, + stride*sizeof(jint), height, pf, dst, 4, subsamp, flags); + + bailout: + return; } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy @@ -426,9 +408,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII - (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, - jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) +JNIEXPORT void JNICALL TJDecompressor_decompress + (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jarray dst, + jint dstElementSize, jint x, jint y, jint width, jint pitch, jint height, + jint pf, jint flags) { tjhandle handle=0; jsize arraySize=0, actualPitch; @@ -445,7 +428,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress _throw("Source buffer is not large enough"); actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf]; - if((*env)->GetArrayLength(env, dst)GetArrayLength(env, dst)*dstElementSizeGetPrimitiveArrayCritical(env, src, 0)); @@ -462,49 +445,35 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII + (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, + jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) +{ + TJDecompressor_decompress(env, obj, src, jpegSize, dst, 1, x, y, width, + pitch, height, pf, flags); +} + JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint width, jint pitch, jint height, jint pf, jint flags) { - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII - (env, obj, src, jpegSize, dst, 0, 0, width, pitch, height, pf, flags); + TJDecompressor_decompress(env, obj, src, jpegSize, dst, 1, 0, 0, width, + pitch, height, pf, flags); } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst, jint x, jint y, jint width, jint stride, jint height, jint pf, jint flags) { - tjhandle handle=0; - jsize arraySize=0, actualStride; - unsigned char *jpegBuf=NULL, *dstBuf=NULL; - - gethandle(); - if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) _throw("Invalid argument in decompress()"); - if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) - _throw("Mismatch between Java and C API"); if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when decompressing to an integer buffer."); - if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); - bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - - if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, - &dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), - height, pf, flags)==-1) - _throw(tjGetErrorStr()); + TJDecompressor_decompress(env, obj, src, jpegSize, dst, sizeof(jint), x, y, + width, stride*sizeof(jint), height, pf, flags); bailout: - if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); return; } @@ -512,8 +481,16 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst, jint width, jint stride, jint height, jint pf, jint flags) { - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII - (env, obj, src, jpegSize, dst, 0, 0, width, stride, height, pf, flags); + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in decompress()"); + if(tjPixelSize[pf]!=sizeof(jint)) + _throw("Pixel format must be 32-bit when decompressing to an integer buffer."); + + TJDecompressor_decompress(env, obj, src, jpegSize, dst, sizeof(jint), 0, 0, + width, stride*sizeof(jint), height, pf, flags); + + bailout: + return; } @@ -564,10 +541,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress env, obj, src, jpegSize, dst, 0, 4, 0, flags); } -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII +JNIEXPORT void JNICALL TJDecompressor_decodeYUV (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, - jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, - jint pf, jint flags) + jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch, + jint height, jint pf, jint flags) { tjhandle handle=0; jsize arraySize=0, actualPitch; @@ -585,7 +562,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ _throw("Source buffer is not large enough"); actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf]; - if((*env)->GetArrayLength(env, dst)GetArrayLength(env, dst)*dstElementSizeGetPrimitiveArrayCritical(env, src, 0)); @@ -602,43 +579,29 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ return; } +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII + (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, + jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, + jint pf, jint flags) +{ + TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, 1, x, y, width, + pitch, height, pf, flags); +} + JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, jintArray dst, jint x, jint y, jint width, jint stride, jint height, jint pf, jint flags) { - tjhandle handle=0; - jsize arraySize=0, actualStride; - unsigned char *srcBuf=NULL, *dstBuf=NULL; - - gethandle(); - if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) _throw("Invalid argument in decodeYUV()"); - if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) - _throw("Mismatch between Java and C API"); if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when decoding to an integer buffer."); - arraySize=tjBufSizeYUV2(width, pad, height, subsamp); - if((*env)->GetArrayLength(env, src)GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); - bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - - if(tjDecodeYUV(handle, srcBuf, pad, subsamp, - &dstBuf[(y*actualStride + x)*sizeof(int)], width, stride*sizeof(jint), - height, pf, flags)==-1) - _throw(tjGetErrorStr()); + TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, sizeof(jint), x, + y, width, stride*sizeof(jint), height, pf, flags); bailout: - if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); return; } From 7def1fcf5b3a745f11bd157185f7656c5b4328ba Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 14:01:21 +0000 Subject: [PATCH 954/985] Restore backward compatibility between libjpeg-turbo 1.3.x JAR and the new JNI library git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1349 632fc199-4ca6-4c93-a231-07263d6284db --- .../turbojpeg/TJDecompressor.java | 68 +++++++++---------- turbojpeg-jni.c | 24 ++++--- 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java index 83057212..c71ce777 100644 --- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java @@ -37,7 +37,7 @@ import java.nio.*; public class TJDecompressor { private static final String NO_ASSOC_ERROR = - "No source image is associated with this instance"; + "No JPEG image is associated with this instance"; /** * Create a TurboJPEG decompresssor instance. @@ -139,9 +139,9 @@ public class TJDecompressor { public int getWidth() throws Exception { if (yuvImage != null) return yuvImage.getWidth(); - if (srcWidth < 1) + if (jpegWidth < 1) throw new Exception(NO_ASSOC_ERROR); - return srcWidth; + return jpegWidth; } /** @@ -154,9 +154,9 @@ public class TJDecompressor { public int getHeight() throws Exception { if (yuvImage != null) return yuvImage.getHeight(); - if (srcHeight < 1) + if (jpegHeight < 1) throw new Exception(NO_ASSOC_ERROR); - return srcHeight; + return jpegHeight; } /** @@ -170,11 +170,11 @@ public class TJDecompressor { public int getSubsamp() throws Exception { if (yuvImage != null) return yuvImage.getSubsamp(); - if (srcSubsamp < 0) + if (jpegSubsamp < 0) throw new Exception(NO_ASSOC_ERROR); - if (srcSubsamp >= TJ.NUMSAMP) + if (jpegSubsamp >= TJ.NUMSAMP) throw new Exception("JPEG header information is invalid"); - return srcSubsamp; + return jpegSubsamp; } /** @@ -188,11 +188,11 @@ public class TJDecompressor { public int getColorspace() throws Exception { if (yuvImage != null) return TJ.CS_YCbCr; - if (srcColorspace < 0) + if (jpegColorspace < 0) throw new Exception(NO_ASSOC_ERROR); - if (srcColorspace >= TJ.NUMCS) + if (jpegColorspace >= TJ.NUMCS) throw new Exception("JPEG header information is invalid"); - return srcColorspace; + return jpegColorspace; } /** @@ -265,19 +265,19 @@ public class TJDecompressor { */ public int getScaledWidth(int desiredWidth, int desiredHeight) throws Exception { - if (srcWidth < 1 || srcHeight < 1) + if (jpegWidth < 1 || jpegHeight < 1) throw new Exception(NO_ASSOC_ERROR); if (desiredWidth < 0 || desiredHeight < 0) throw new Exception("Invalid argument in getScaledWidth()"); TJScalingFactor[] sf = TJ.getScalingFactors(); if (desiredWidth == 0) - desiredWidth = srcWidth; + desiredWidth = jpegWidth; if (desiredHeight == 0) - desiredHeight = srcHeight; - int scaledWidth = srcWidth, scaledHeight = srcHeight; + desiredHeight = jpegHeight; + int scaledWidth = jpegWidth, scaledHeight = jpegHeight; for (int i = 0; i < sf.length; i++) { - scaledWidth = sf[i].getScaled(srcWidth); - scaledHeight = sf[i].getScaled(srcHeight); + scaledWidth = sf[i].getScaled(jpegWidth); + scaledHeight = sf[i].getScaled(jpegHeight); if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight) break; } @@ -307,19 +307,19 @@ public class TJDecompressor { */ public int getScaledHeight(int desiredWidth, int desiredHeight) throws Exception { - if (srcWidth < 1 || srcHeight < 1) + if (jpegWidth < 1 || jpegHeight < 1) throw new Exception(NO_ASSOC_ERROR); if (desiredWidth < 0 || desiredHeight < 0) throw new Exception("Invalid argument in getScaledHeight()"); TJScalingFactor[] sf = TJ.getScalingFactors(); if (desiredWidth == 0) - desiredWidth = srcWidth; + desiredWidth = jpegWidth; if (desiredHeight == 0) - desiredHeight = srcHeight; - int scaledWidth = srcWidth, scaledHeight = srcHeight; + desiredHeight = jpegHeight; + int scaledWidth = jpegWidth, scaledHeight = jpegHeight; for (int i = 0; i < sf.length; i++) { - scaledWidth = sf[i].getScaled(srcWidth); - scaledHeight = sf[i].getScaled(srcHeight); + scaledWidth = sf[i].getScaled(jpegWidth); + scaledHeight = sf[i].getScaled(jpegHeight); if (scaledWidth <= desiredWidth && scaledHeight <= desiredHeight) break; } @@ -497,7 +497,7 @@ public class TJDecompressor { if (scaledWidth != dstImage.getWidth() || scaledHeight != dstImage.getHeight()) throw new Exception("YUVImage dimensions do not match one of the scaled image sizes that TurboJPEG is capable of generating."); - if (srcSubsamp != dstImage.getSubsamp()) + if (jpegSubsamp != dstImage.getSubsamp()) throw new Exception("YUVImage subsampling level does not match that of the JPEG image"); decompressToYUV(jpegBuf, jpegBufSize, dstImage.getBuf(), @@ -510,8 +510,8 @@ public class TJDecompressor { */ @Deprecated public void decompressToYUV(byte[] dstBuf, int flags) throws Exception { - YUVImage dstImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, - srcSubsamp); + YUVImage dstImage = new YUVImage(dstBuf, jpegWidth, 4, jpegHeight, + jpegSubsamp); decompressToYUV(dstImage, flags); } @@ -553,9 +553,9 @@ public class TJDecompressor { int flags) throws Exception { if (flags < 0) throw new Exception("Invalid argument in decompressToYUV()"); - if (srcWidth < 1 || srcHeight < 1 || srcSubsamp < 0) + if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0) throw new Exception(NO_ASSOC_ERROR); - if (srcSubsamp >= TJ.NUMSAMP) + if (jpegSubsamp >= TJ.NUMSAMP) throw new Exception("JPEG header information is invalid"); if (yuvImage != null) throw new Exception("Source image is the wrong type"); @@ -563,7 +563,7 @@ public class TJDecompressor { int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); int scaledHeight = getScaledHeight(desiredWidth, desiredHeight); YUVImage yuvImage = new YUVImage(scaledWidth, pad, scaledHeight, - srcSubsamp); + jpegSubsamp); decompressToYUV(yuvImage, flags); return yuvImage; } @@ -573,7 +573,7 @@ public class TJDecompressor { */ @Deprecated public byte[] decompressToYUV(int flags) throws Exception { - YUVImage dstImage = new YUVImage(srcWidth, 4, srcHeight, srcSubsamp); + YUVImage dstImage = new YUVImage(jpegWidth, 4, jpegHeight, jpegSubsamp); decompressToYUV(dstImage, flags); return dstImage.getBuf(); } @@ -855,9 +855,9 @@ public class TJDecompressor { protected byte[] jpegBuf = null; protected int jpegBufSize = 0; protected YUVImage yuvImage = null; - protected int srcWidth = 0; - protected int srcHeight = 0; - protected int srcSubsamp = -1; - protected int srcColorspace = -1; + protected int jpegWidth = 0; + protected int jpegHeight = 0; + protected int jpegSubsamp = -1; + protected int jpegColorspace = -1; private ByteOrder byteOrder = null; }; diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 5c1f6e31..55dc4ad0 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -394,13 +394,15 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); jpegBuf=NULL; - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I")); (*env)->SetIntField(env, obj, _fid, jpegSubsamp); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcColorspace", "I")); - (*env)->SetIntField(env, obj, _fid, jpegColorspace); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I")); + if((_fid=(*env)->GetFieldID(env, _cls, "jpegColorspace", "I"))==0) + (*env)->ExceptionClear(env); + else + (*env)->SetIntField(env, obj, _fid, jpegColorspace); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); (*env)->SetIntField(env, obj, _fid, width); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); (*env)->SetIntField(env, obj, _fid, height); bailout: @@ -507,11 +509,11 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress if((*env)->GetArrayLength(env, src)GetFieldID(env, _cls, "srcSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I")); jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcWidth", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); jpegWidth=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth, @@ -702,11 +704,11 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf if((*env)->GetArrayLength(env, jsrcBuf)GetFieldID(env, _cls, "srcWidth", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); jpegWidth=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcHeight", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); - bailif0(_fid=(*env)->GetFieldID(env, _cls, "srcSubsamp", "I")); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I")); jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid); n=(*env)->GetArrayLength(env, dstobjs); From b83bfa68a97d882b5cd55f04752c20adeedbcbcb Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 14:40:05 +0000 Subject: [PATCH 955/985] Compiler warnings git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1350 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 55dc4ad0..f57567c3 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -55,7 +55,7 @@ jfieldID _fid; \ if(!_cls) goto bailout; \ bailif0(_fid=(*env)->GetFieldID(env, _cls, "handle", "J")); \ - handle=(tjhandle)(jlong)(*env)->GetLongField(env, obj, _fid); \ + handle=(tjhandle)(size_t)(*env)->GetLongField(env, obj, _fid); \ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize (JNIEnv *env, jclass cls, jint width, jint height, jint jpegSubsamp) @@ -96,7 +96,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init bailif0(cls=(*env)->GetObjectClass(env, obj)); bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J")); - (*env)->SetLongField(env, obj, fid, (jlong)handle); + (*env)->SetLongField(env, obj, fid, (size_t)handle); bailout: return; @@ -270,16 +270,16 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags) { - return TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, - pf, dst, pad, subsamp, flags); + TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf, dst, + pad, subsamp, flags); } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { - return TJCompressor_encodeYUV(env, obj, src, 1, 0, 0, width, pitch, height, - pf, dst, 4, subsamp, flags); + TJCompressor_encodeYUV(env, obj, src, 1, 0, 0, width, pitch, height, pf, dst, + 4, subsamp, flags); } JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII @@ -292,7 +292,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - return TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width, + TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width, stride*sizeof(jint), height, pf, dst, pad, subsamp, flags); bailout: @@ -308,7 +308,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - return TJCompressor_encodeYUV(env, obj, src, sizeof(jint), 0, 0, width, + TJCompressor_encodeYUV(env, obj, src, sizeof(jint), 0, 0, width, stride*sizeof(jint), height, pf, dst, 4, subsamp, flags); bailout: @@ -340,7 +340,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init bailif0(cls=(*env)->GetObjectClass(env, obj)); bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J")); - (*env)->SetLongField(env, obj, fid, (jlong)handle); + (*env)->SetLongField(env, obj, fid, (size_t)handle); bailout: return; @@ -618,7 +618,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init bailif0(cls=(*env)->GetObjectClass(env, obj)); bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J")); - (*env)->SetLongField(env, obj, fid, (jlong)handle); + (*env)->SetLongField(env, obj, fid, (size_t)handle); bailout: return; From ba67ec6270f76dc3890b618a0e0021cc49875f2d Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 14:40:36 +0000 Subject: [PATCH 956/985] Fix build broken by r1349 git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1351 632fc199-4ca6-4c93-a231-07263d6284db --- java/org/libjpegturbo/turbojpeg/TJTransformer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/org/libjpegturbo/turbojpeg/TJTransformer.java b/java/org/libjpegturbo/turbojpeg/TJTransformer.java index ee1f6071..a62f410b 100644 --- a/java/org/libjpegturbo/turbojpeg/TJTransformer.java +++ b/java/org/libjpegturbo/turbojpeg/TJTransformer.java @@ -119,15 +119,15 @@ public class TJTransformer extends TJDecompressor { public TJDecompressor[] transform(TJTransform[] transforms, int flags) throws Exception { byte[][] dstBufs = new byte[transforms.length][]; - if (srcWidth < 1 || srcHeight < 1) + if (jpegWidth < 1 || jpegHeight < 1) throw new Exception("JPEG buffer not initialized"); for (int i = 0; i < transforms.length; i++) { - int w = srcWidth, h = srcHeight; + int w = jpegWidth, h = jpegHeight; if ((transforms[i].options & TJTransform.OPT_CROP) != 0) { if (transforms[i].width != 0) w = transforms[i].width; if (transforms[i].height != 0) h = transforms[i].height; } - dstBufs[i] = new byte[TJ.bufSize(w, h, srcSubsamp)]; + dstBufs[i] = new byte[TJ.bufSize(w, h, jpegSubsamp)]; } TJDecompressor[] tjd = new TJDecompressor[transforms.length]; transform(dstBufs, transforms, flags); From 370aaa61fd460df41c8959eae5715dc3a7129ecb Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 16:07:15 +0000 Subject: [PATCH 957/985] Add descriptions to help sort out which function goes with which version of the API. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1354 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index f57567c3..f16c1b5e 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -57,6 +57,7 @@ bailif0(_fid=(*env)->GetFieldID(env, _cls, "handle", "J")); \ handle=(tjhandle)(size_t)(*env)->GetLongField(env, obj, _fid); \ +/* TurboJPEG 1.2.x: TJ::bufSize() */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize (JNIEnv *env, jclass cls, jint width, jint height, jint jpegSubsamp) { @@ -67,6 +68,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize return retval; } +/* TurboJPEG 1.4.x: TJ::bufSizeYUV() */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII (JNIEnv *env, jclass cls, jint width, jint pad, jint height, jint subsamp) { @@ -77,6 +79,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII return retval; } +/* TurboJPEG 1.2.x: TJ::bufSizeYUV() */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III (JNIEnv *env, jclass cls, jint width, jint height, jint subsamp) { @@ -84,6 +87,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III 4, height, subsamp); } +/* TurboJPEG 1.2.x: TJCompressor::init() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init (JNIEnv *env, jobject obj) { @@ -142,6 +146,7 @@ JNIEXPORT jint JNICALL TJCompressor_compress return (jint)jpegSize; } +/* TurboJPEG 1.3.x: TJCompressor::compress() byte source */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIIIII_3BIII (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, @@ -151,6 +156,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 pf, dst, jpegSubsamp, jpegQual, flags); } +/* TurboJPEG 1.2.x: TJCompressor::compress() byte source */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, @@ -160,6 +166,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 pf, dst, jpegSubsamp, jpegQual, flags); } +/* TurboJPEG 1.3.x: TJCompressor::compress() int source */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIIIII_3BIII (JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, @@ -177,6 +184,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 return 0; } +/* TurboJPEG 1.2.x: TJCompressor::compress() int source */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII (JNIEnv *env, jobject obj, jintArray src, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, @@ -194,6 +202,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 return 0; } +/* TurboJPEG 1.4.x: TJCompressor::compressFromYUV() */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pad, jint height, jint subsamp, jbyteArray dst, jint jpegQual, jint flags) @@ -265,6 +274,7 @@ JNIEXPORT void JNICALL TJCompressor_encodeYUV return; } +/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() byte source */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, @@ -274,6 +284,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ pad, subsamp, flags); } +/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() byte source */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) @@ -282,6 +293,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ 4, subsamp, flags); } +/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() int source */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII (JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, @@ -299,6 +311,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ return; } +/* TurboJPEG 1.2.x: TJCompressor::encodeYUV() int source */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII (JNIEnv *env, jobject obj, jintArray src, jint width, jint stride, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) @@ -315,6 +328,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ return; } +/* TurboJPEG 1.2.x: TJCompressor::destroy() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy (JNIEnv *env, jobject obj) { @@ -329,6 +343,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy return; } +/* TurboJPEG 1.2.x: TJDecompressor::init() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init (JNIEnv *env, jobject obj) { @@ -346,6 +361,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init return; } +/* TurboJPEG 1.2.x: TJDecompressor::getScalingFactors() */ JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors (JNIEnv *env, jclass cls) { @@ -374,6 +390,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFact return sfjava; } +/* TurboJPEG 1.2.x: TJDecompressor::decompressHeader() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize) { @@ -447,6 +464,7 @@ JNIEXPORT void JNICALL TJDecompressor_decompress return; } +/* TurboJPEG 1.3.x: TJDecompressor::decompress() byte destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) @@ -455,6 +473,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress pitch, height, pf, flags); } +/* TurboJPEG 1.2.x: TJDecompressor::decompress() byte destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint width, jint pitch, jint height, jint pf, jint flags) @@ -463,6 +482,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress pitch, height, pf, flags); } +/* TurboJPEG 1.3.x: TJDecompressor::decompress() int destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst, jint x, jint y, jint width, jint stride, jint height, jint pf, jint flags) @@ -479,6 +499,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } +/* TurboJPEG 1.2.x: TJDecompressor::decompress() int destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst, jint width, jint stride, jint height, jint pf, jint flags) @@ -496,6 +517,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress } +/* TurboJPEG 1.4.x: TJDecompressor::decompressToYUV() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint desiredWidth, jint pad, jint desiredHeight, jint flags) @@ -535,6 +557,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } +/* TurboJPEG 1.2.x: TJDecompressor::decompressToYUV() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint flags) @@ -581,6 +604,7 @@ JNIEXPORT void JNICALL TJDecompressor_decodeYUV return; } +/* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() byte destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, @@ -590,6 +614,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ pitch, height, pf, flags); } +/* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() int destination */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, jintArray dst, jint x, jint y, jint width, jint stride, jint height, @@ -607,6 +632,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV_ return; } +/* TurboJPEG 1.2.x: TJTransformer::init() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init (JNIEnv *env, jobject obj) { @@ -688,6 +714,7 @@ static int JNICustomFilter(short *coeffs, tjregion arrayRegion, return -1; } +/* TurboJPEG 1.2.x: TJTransformer::transform() */ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transform (JNIEnv *env, jobject obj, jbyteArray jsrcBuf, jint jpegSize, jobjectArray dstobjs, jobjectArray tobjs, jint flags) @@ -813,6 +840,7 @@ JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transf return jdstSizes; } +/* TurboJPEG 1.2.x: TJDecompressor::destroy() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy (JNIEnv *env, jobject obj) { From 608dfddd22223ba52c92a8a819255e0f05d616cd Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 16:08:12 +0000 Subject: [PATCH 958/985] Whitespace formatting tweaks git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1355 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index f16c1b5e..59b8a1e2 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -365,7 +365,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors (JNIEnv *env, jclass cls) { - jclass sfcls=NULL; jfieldID fid=0; + jclass sfcls=NULL; jfieldID fid=0; tjscalingfactor *sf=NULL; int n=0, i; jobject sfobj=NULL; jobjectArray sfjava=NULL; @@ -664,20 +664,20 @@ static int JNICustomFilter(short *coeffs, tjregion arrayRegion, JNICustomFilterParams *params=(JNICustomFilterParams *)transform->data; JNIEnv *env=params->env; jobject tobj=params->tobj, cfobj=params->cfobj; - jobject arrayRegionObj, planeRegionObj, bufobj, borobj; + jobject arrayRegionObj, planeRegionObj, bufobj, borobj; jclass cls; jmethodID mid; jfieldID fid; bailif0(bufobj=(*env)->NewDirectByteBuffer(env, coeffs, sizeof(short)*arrayRegion.w*arrayRegion.h)); bailif0(cls=(*env)->FindClass(env, "java/nio/ByteOrder")); - bailif0(mid=(*env)->GetStaticMethodID(env, cls, "nativeOrder", + bailif0(mid=(*env)->GetStaticMethodID(env, cls, "nativeOrder", "()Ljava/nio/ByteOrder;")); bailif0(borobj=(*env)->CallStaticObjectMethod(env, cls, mid)); bailif0(cls=(*env)->GetObjectClass(env, bufobj)); bailif0(mid=(*env)->GetMethodID(env, cls, "order", "(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;")); (*env)->CallObjectMethod(env, bufobj, mid, borobj); - bailif0(mid=(*env)->GetMethodID(env, cls, "asShortBuffer", + bailif0(mid=(*env)->GetMethodID(env, cls, "asShortBuffer", "()Ljava/nio/ShortBuffer;")); bailif0(bufobj=(*env)->CallObjectMethod(env, bufobj, mid)); From 804440b2e1ab2da5c7c8dd2d2990980110d73666 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 16:40:56 +0000 Subject: [PATCH 959/985] Make the wrapped functions static git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1359 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 59b8a1e2..f872cf00 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -106,7 +106,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init return; } -JNIEXPORT jint JNICALL TJCompressor_compress +static jint TJCompressor_compress (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, jint flags) @@ -234,7 +234,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom return (jint)jpegSize; } -JNIEXPORT void JNICALL TJCompressor_encodeYUV +static void TJCompressor_encodeYUV (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, jint flags) @@ -427,7 +427,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } -JNIEXPORT void JNICALL TJDecompressor_decompress +static void TJDecompressor_decompress (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) @@ -566,7 +566,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress env, obj, src, jpegSize, dst, 0, 4, 0, flags); } -JNIEXPORT void JNICALL TJDecompressor_decodeYUV +static void TJDecompressor_decodeYUV (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) From ce6f3d8cd28bb01cca5e5a0cc3166ac5b3be89d8 Mon Sep 17 00:00:00 2001 From: DRC Date: Sun, 17 Aug 2014 12:23:49 +0000 Subject: [PATCH 960/985] Refactored YUVImage Java class so that it supports both unified YUV image buffers as well as separate YUV image planes; modified the JNI functions accordingly and added new helper functions to the TurboJPEG C API (tjPlaneWidth(), tjPlaneHeight(), tjPlaneSizeYUV()) to facilitate those modifications; changed potentially confusing "component width" and "component height" terms to "plane width" and "plane height" and modified variable names in turbojpeg.c to reflect this; numerous other documentation tweaks git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1360 632fc199-4ca6-4c93-a231-07263d6284db --- doc/html/group___turbo_j_p_e_g.html | 224 +++++++-- doc/html/search/all_74.js | 5 +- doc/html/search/functions_74.js | 3 + java/TJExample.java | 2 +- java/doc/deprecated-list.html | 64 +-- java/doc/index-all.html | 242 +++++---- java/doc/index.html | 9 +- java/doc/org/libjpegturbo/turbojpeg/TJ.html | 124 ++++- .../libjpegturbo/turbojpeg/TJCompressor.html | 161 +++--- .../turbojpeg/TJCustomFilter.html | 4 +- .../turbojpeg/TJDecompressor.html | 290 +++++------ .../turbojpeg/TJScalingFactor.html | 8 +- .../libjpegturbo/turbojpeg/TJTransform.html | 14 +- .../libjpegturbo/turbojpeg/TJTransformer.html | 16 +- .../org/libjpegturbo/turbojpeg/YUVImage.html | 319 ++++++++++-- java/org/libjpegturbo/turbojpeg/TJ.java | 82 ++- .../libjpegturbo/turbojpeg/TJCompressor.java | 79 ++- .../turbojpeg/TJDecompressor.java | 175 ++++--- .../turbojpeg/TJScalingFactor.java | 11 +- .../libjpegturbo/turbojpeg/TJTransformer.java | 4 +- java/org/libjpegturbo/turbojpeg/YUVImage.java | 298 +++++++++-- java/org_libjpegturbo_turbojpeg_TJ.h | 24 + .../org_libjpegturbo_turbojpeg_TJCompressor.h | 18 +- ...rg_libjpegturbo_turbojpeg_TJDecompressor.h | 18 +- turbojpeg-jni.c | 473 ++++++++++++++---- turbojpeg-mapfile.jni | 15 +- turbojpeg.c | 282 +++++++---- turbojpeg.h | 218 +++++--- 28 files changed, 2278 insertions(+), 904 deletions(-) diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index e40189ef..c7b19bf4 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -241,6 +241,15 @@ Functions DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2 (int width, int pad, int height, int subsamp)  The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. More...
        +DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV (int componentID, int width, int stride, int height, int subsamp) + The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. More...
      +  +DLLEXPORT int tjPlaneWidth (int componentID, int width, int subsamp) + The plane width of a YUV image plane with the given parameters. More...
      +  +DLLEXPORT int tjPlaneHeight (int componentID, int height, int subsamp) + The plane height of a YUV image plane with the given parameters. More...
      +  DLLEXPORT int DLLCALL tjEncodeYUV3 (tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)  Encode an RGB or grayscale image into a YUV planar image. More...
        @@ -317,7 +326,7 @@ Variables

      YUV Image Format Notes

      Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

      -

      Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The "component width" and "component height" of each plane are determined by the image width, height, and level of chrominance subsampling. For the luminance plane, the component width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the component height of the luminance plane is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The component width of the chrominance planes is equal to the component width of the luminance plane divided by the horizontal subsampling factor, and the component height of the chrominance planes is equal to the component height of the luminance plane divided by the vertical subsampling factor.

      +

      Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane height is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.

      For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes.

      Macro Definition Documentation

      @@ -810,7 +819,7 @@ Variables
    -
    Returns
    a pointer to a newly-allocated buffer with the specified number of bytes
    +
    Returns
    a pointer to a newly-allocated buffer with the specified number of bytes.
    See Also
    tjFree()
    @@ -849,8 +858,8 @@ Variables

    The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.

    Parameters
    - - + +
    widthwidth of the image (in pixels)
    heightheight of the image (in pixels)
    widthwidth (in pixels) of the image
    heightheight (in pixels) of the image
    jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
    @@ -898,9 +907,9 @@ Variables

    The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.

    Parameters
    - + - +
    widthwidth of the image (in pixels)
    widthwidth (in pixels) of the image
    padthe width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
    heightheight of the image (in pixels)
    heightheight (in pixels) of the image
    subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
    @@ -993,7 +1002,7 @@ Variables handlea handle to a TurboJPEG compressor or transformer instance srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed widthwidth (in pixels) of the source image - pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. + pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. heightheight (in pixels) of the source image pixelFormatpixel format of the source image (see Pixel formats.) jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
      @@ -1005,7 +1014,7 @@ If you choose option 1, *jpegSize should be set to the size of your jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.) jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best) - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1102,7 +1111,7 @@ If you choose option 1, *jpegSize should be set to the size of your If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best) - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1186,9 +1195,9 @@ If you choose option 1, *jpegSize should be set to the size of your
    Parameters
    - + - + - +
    handlea handle to a TurboJPEG compressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details.
    widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
    heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
    jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
      @@ -1199,7 +1208,7 @@ If you choose option 1, *jpegSize should be set to the size of your If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
    jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
    jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
    flagsthe bitwise OR of one or more of the flags.
    flagsthe bitwise OR of one or more of the flags
    @@ -1289,10 +1298,10 @@ If you choose option 1, *jpegSize should be set to the size of your subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.) dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer. widthwidth (in pixels) of the source and destination images - pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. + pitchbytes per line in the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. heightheight (in pixels) of the source and destination images pixelFormatpixel format of the destination image (see Pixel formats.) - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1377,15 +1386,15 @@ If you choose option 1, *jpegSize should be set to the size of your
    Parameters
    - - + + - + - +
    handlea handle to a TurboJPEG decompressor or transformer instance
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
    srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. The size of each plane should match the value returned by tjPlaneSizeYUV() for the given image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details.
    stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
    subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
    dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
    widthwidth (in pixels) of the source and destination images
    pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    pitchbytes per line in the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
    heightheight (in pixels) of the source and destination images
    pixelFormatpixel format of the destination image (see Pixel formats.)
    flagsthe bitwise OR of one or more of the flags.
    flagsthe bitwise OR of one or more of the flags
    @@ -1467,10 +1476,10 @@ If you choose option 1, *jpegSize should be set to the size of your jpegSizesize of the JPEG image (in bytes) dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer. widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. - pitchbytes per line of the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat]. + pitchbytes per line in the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat]. heightdesired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. pixelFormatpixel format of the destination image (see Pixel formats.) - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1540,7 +1549,7 @@ If you choose option 1, *jpegSize should be set to the size of your jpegSizesize of the JPEG image (in bytes) widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image - jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see Chrominance subsampling options.) + jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see Chrominance subsampling options.) jpegColorspacepointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see JPEG colorspaces.) @@ -1620,7 +1629,7 @@ If you choose option 1, *jpegSize should be set to the size of your widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG. padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4. heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG. - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1695,11 +1704,11 @@ If you choose option 1, *jpegSize should be set to the size of your handlea handle to a TurboJPEG decompressor or transformer instance jpegBufpointer to a buffer containing the JPEG image to decompress jpegSizesize of the JPEG image (in bytes) - dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.) + dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Use tjPlaneSizeYUV() to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details. widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG. - stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image. + stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective scaled plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image. heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG. - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1811,13 +1820,13 @@ If you choose option 1, *jpegSize should be set to the size of your handlea handle to a TurboJPEG compressor or transformer instance srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded widthwidth (in pixels) of the source image - pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. + pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. heightheight (in pixels) of the source image pixelFormatpixel format of the source image (see Pixel formats.) dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.) padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4. subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format. - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -1904,13 +1913,13 @@ If you choose option 1, *jpegSize should be set to the size of your handlea handle to a TurboJPEG compressor or transformer instance srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded widthwidth (in pixels) of the source image - pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. + pitchbytes per line in the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat]. heightheight (in pixels) of the source image pixelFormatpixel format of the source image (see Pixel formats.) - dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.) - stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If strides is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image. + dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Use tjPlaneSizeYUV() to determine the appropriate size for each plane based on the image width, height, strides, and level of chrominance subsampling. Refer to YUV Image Format Notes for more details. + stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the plane width (see YUV Image Format Notes.) If strides is NULL, then the strides for all planes will be set to their respective plane widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image. subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format. - flagsthe bitwise OR of one or more of the flags. + flagsthe bitwise OR of one or more of the flags
    @@ -2043,6 +2052,151 @@ If you choose option 1, *jpegSize should be set to the size of your

    Create a new TurboJPEG transformer instance.

    Returns
    a handle to the newly-created instance, or NULL if an error occurred (see tjGetErrorStr().)
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    DLLEXPORT int tjPlaneHeight (int componentID,
    int height,
    int subsamp 
    )
    +
    + +

    The plane height of a YUV image plane with the given parameters.

    +

    Refer to YUV Image Format Notes for a description of plane height.

    +
    Parameters
    + + + + +
    componentIDID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
    heightheight (in pixels) of the YUV image
    subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
    +
    +
    +
    Returns
    the plane height of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds.
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV (int componentID,
    int width,
    int stride,
    int height,
    int subsamp 
    )
    +
    + +

    The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters.

    +
    Parameters
    + + + + + + +
    componentIDID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
    widthwidth (in pixels) of the YUV image. NOTE: this is the width of the whole image, not the plane width.
    stridebytes per line in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.
    heightheight (in pixels) of the YUV image. NOTE: this is the height of the whole image, not the plane height.
    subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
    +
    +
    +
    Returns
    the size of the buffer (in bytes) required to hold the YUV image plane, or -1 if the arguments are out of bounds.
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    DLLEXPORT int tjPlaneWidth (int componentID,
    int width,
    int subsamp 
    )
    +
    + +

    The plane width of a YUV image plane with the given parameters.

    +

    Refer to YUV Image Format Notes for a description of plane width.

    +
    Parameters
    + + + + +
    componentIDID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)
    widthwidth (in pixels) of the YUV image
    subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
    +
    +
    +
    Returns
    the plane width of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds.
    +
    @@ -2106,12 +2260,12 @@ If you choose option 1, *jpegSize should be set to the size of your

    Losslessly transform a JPEG image into another JPEG image.

    -

    Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.

    +

    Lossless transforms work by moving the raw DCT coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.

    Parameters
    - - + + - +
    handlea handle to a TurboJPEG transformer instance
    jpegBufpointer to a buffer containing the JPEG image to transform
    jpegSizesize of the JPEG image (in bytes)
    jpegBufpointer to a buffer containing the JPEG source image to transform
    jpegSizesize of the JPEG source image (in bytes)
    nthe number of transformed JPEG images to generate
    dstBufspointer to an array of n image buffers. dstBufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
    1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
    2. @@ -2121,7 +2275,7 @@ If you choose option 1, *jpegSize should be set to the size of your If you choose option 1, dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed.
    dstSizespointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the JPEG image (in bytes.)
    transformspointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.
    flagsthe bitwise OR of one or more of the flags.
    flagsthe bitwise OR of one or more of the flags
    diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js index 7b508306..5b46106f 100644 --- a/doc/html/search/all_74.js +++ b/doc/html/search/all_74.js @@ -56,6 +56,9 @@ var searchData= ['tjpf_5fxbgr',['TJPF_XBGR',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af',1,'turbojpeg.h']]], ['tjpf_5fxrgb',['TJPF_XRGB',['../group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84',1,'turbojpeg.h']]], ['tjpixelsize',['tjPixelSize',['../group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c',1,'turbojpeg.h']]], + ['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]], + ['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]], + ['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]], ['tjredoffset',['tjRedOffset',['../group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8',1,'turbojpeg.h']]], ['tjregion',['tjregion',['../structtjregion.html',1,'']]], ['tjsamp',['TJSAMP',['../group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074',1,'turbojpeg.h']]], @@ -67,7 +70,7 @@ var searchData= ['tjsamp_5fgray',['TJSAMP_GRAY',['../group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248',1,'turbojpeg.h']]], ['tjscaled',['TJSCALED',['../group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df',1,'turbojpeg.h']]], ['tjscalingfactor',['tjscalingfactor',['../structtjscalingfactor.html',1,'']]], - ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h']]], + ['tjtransform',['tjtransform',['../structtjtransform.html',1,'tjtransform'],['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'tjTransform(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags): turbojpeg.h'],['../group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31',1,'tjtransform(): turbojpeg.h']]], ['tjxop',['TJXOP',['../group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866',1,'turbojpeg.h']]], ['tjxop_5fhflip',['TJXOP_HFLIP',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce',1,'turbojpeg.h']]], ['tjxop_5fnone',['TJXOP_NONE',['../group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27',1,'turbojpeg.h']]], diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js index 35a3f8e1..73b7ee98 100644 --- a/doc/html/search/functions_74.js +++ b/doc/html/search/functions_74.js @@ -21,5 +21,8 @@ var searchData= ['tjinitcompress',['tjInitCompress',['../group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a',1,'turbojpeg.h']]], ['tjinitdecompress',['tjInitDecompress',['../group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e',1,'turbojpeg.h']]], ['tjinittransform',['tjInitTransform',['../group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902',1,'turbojpeg.h']]], + ['tjplaneheight',['tjPlaneHeight',['../group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f',1,'turbojpeg.h']]], + ['tjplanesizeyuv',['tjPlaneSizeYUV',['../group___turbo_j_p_e_g.html#ga6f98d977bfa9d167c97172e876ba61e2',1,'turbojpeg.h']]], + ['tjplanewidth',['tjPlaneWidth',['../group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1',1,'turbojpeg.h']]], ['tjtransform',['tjTransform',['../group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616',1,'turbojpeg.h']]] ]; diff --git a/java/TJExample.java b/java/TJExample.java index 2c6324dc..75621143 100644 --- a/java/TJExample.java +++ b/java/TJExample.java @@ -277,7 +277,7 @@ public class TJExample implements TJCustomFilter { scaleFactor.isOne()) { file = new File(argv[1]); FileOutputStream fos = new FileOutputStream(file); - fos.write(tjd.getSourceBuf(), 0, tjd.getSourceSize()); + fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize()); fos.close(); System.exit(0); } diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index 79fd7ed9..e47ffb13 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -106,83 +106,73 @@ -org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int) - +org.libjpegturbo.turbojpeg.TJ.bufSizeYUV(int, int, int) + -org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int) +org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, byte[], int) + TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and + TJCompressor.compress(byte[], int) instead.
    -org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int) +org.libjpegturbo.turbojpeg.TJCompressor.compress(BufferedImage, int) -org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int) +org.libjpegturbo.turbojpeg.TJDecompressor.decompress(byte[], int, int, int, int, int) + TJDecompressor.decompress(byte[], int, int, int, int, int, int, int) instead.
    -org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int) - +org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(byte[], int) + org.libjpegturbo.turbojpeg.TJDecompressor.decompressToYUV(int) - + -org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int) +org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, byte[], int) + TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and + TJCompressor.encodeYUV(byte[], int) instead.
    -org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int) +org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(BufferedImage, int) + TJCompressor.setSourceImage(BufferedImage, int, int, int, int) and + TJCompressor.encodeYUV(int, int) instead.
    -org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int) - +org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(byte[], int) + org.libjpegturbo.turbojpeg.TJCompressor.encodeYUV(int) - + -org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGBuf() - +org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int) + -org.libjpegturbo.turbojpeg.TJDecompressor.getJPEGSize() - - - - -org.libjpegturbo.turbojpeg.TJDecompressor.setJPEGImage(byte[], int) - - - - -org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int) +org.libjpegturbo.turbojpeg.TJCompressor.setSourceImage(byte[], int, int, int, int) + TJCompressor.setSourceImage(byte[], int, int, int, int, int, int) instead.
    @@ -201,9 +191,9 @@ -org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int) +org.libjpegturbo.turbojpeg.TJCompressor(byte[], int, int, int, int) + TJCompressor.TJCompressor(byte[], int, int, int, int, int, int) instead.
    diff --git a/java/doc/index-all.html b/java/doc/index-all.html index a976556d..1af78bed 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -63,20 +63,20 @@

    B

    -
    bufSize(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    bufSize(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG image with the given width, height, and level of chrominance subsampling.
    -
    bufSizeYUV(int, int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    bufSizeYUV(int, int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    Returns the size of the buffer (in bytes) required to hold a YUV planar image with the given width, height, and level of chrominance subsampling.
    -
    bufSizeYUV(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    bufSizeYUV(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    @@ -97,7 +97,7 @@
    Free the native structures associated with this decompressor instance.
    -
    compress(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    compress(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Compress the uncompressed source image associated with this compressor instance and output a JPEG image to the given destination buffer.
    @@ -107,19 +107,19 @@
    Compress the uncompressed source image associated with this compressor instance and return a buffer containing a JPEG image.
    -
    compress(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    compress(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    -
    compress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    compress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    @@ -143,7 +143,7 @@
    YCCK colorspace.
    -
    customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform) - Method in interface org.libjpegturbo.turbojpeg.TJCustomFilter
    +
    customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform) - Method in interface org.libjpegturbo.turbojpeg.TJCustomFilter
    A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new @@ -155,64 +155,70 @@

    D

    -
    decompress(byte[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(byte[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.
    -
    decompress(byte[], int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(byte[], int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
    decompress(int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image associated with this decompressor instance and return a buffer containing the decompressed image.
    -
    decompress(int[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(int[], int, int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a grayscale, RGB, or CMYK image to the given destination buffer.
    -
    decompress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to the given BufferedImage instance.
    -
    decompress(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompress(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and return a BufferedImage instance containing the decompressed/decoded image.
    -
    decompressToYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompressToYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given YUVImage instance.
    -
    decompressToYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompressToYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
    decompressToYUV(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    decompressToYUV(int, int[], int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Decompress the JPEG source image associated with this decompressor - instance into a YUV planar image and return a YUVImage - instance containing the decompressed image.
    + instance into a set of Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the decompressed image planes. +
    +
    decompressToYUV(int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    +
    Decompress the JPEG source image associated with this decompressor + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the decompressed image.
    decompressToYUV(int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    @@ -221,44 +227,50 @@

    E

    -
    encodeYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    encodeYUV(YUVImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given YUVImage instance.
    -
    encodeYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    encodeYUV(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    -
    encodeYUV(int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    encodeYUV(int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Encode the uncompressed source image associated with this compressor - instance into a YUV planar image and return a YUVImage - instance containing the encoded image.
    + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the encoded image. +
    +
    encodeYUV(int[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    +
    Encode the uncompressed source image associated with this compressor + instance into separate Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the encoded image planes.
    encodeYUV(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    -
    encodeYUV(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    encodeYUV(BufferedImage, byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    -
    encodeYUV(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    encodeYUV(BufferedImage, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    equals(TJScalingFactor) - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    @@ -325,7 +337,8 @@
    getBuf() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the YUV image buffer
    +
    Returns the YUV image buffer (if this image is stored in a unified + buffer rather than separate image planes.)
    getColorspace() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    @@ -335,7 +348,7 @@
    getCompressedSize() - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Returns the size of the image (in bytes) generated by the most recent - compress/encode operation.
    + compress operation.
    getDenom() - Method in class org.libjpegturbo.turbojpeg.TJScalingFactor
    @@ -353,19 +366,16 @@
    getHeight() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the height of the YUV image.
    +
    Returns the height of the YUV image (or subregion.)
    getJPEGBuf() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
    Deprecated. - -
    +
    Returns the JPEG image buffer associated with this decompressor instance.
    getJPEGSize() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
    Deprecated. - -
    +
    Returns the size of the JPEG image (in bytes) associated with this + decompressor instance.
    getMCUHeight(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    @@ -381,14 +391,24 @@
    Returns numerator
    +
    getOffsets() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the offsets (in bytes) of each plane within the planes of a larger + YUV image.
    +
    getPad() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the line padding used in the YUV image buffer.
    +
    Returns the line padding used in the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    getPixelSize(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    Returns the pixel size (in bytes) for the given pixel format.
    +
    getPlanes() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Returns the YUV image planes.
    +
    getRedOffset(int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    For the given pixel format, returns the number of bytes that the red @@ -398,13 +418,13 @@
    Returns the scaled value of dimension.
    -
    getScaledHeight(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    getScaledHeight(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
    -
    getScaledWidth(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    getScaledWidth(int, int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and @@ -417,17 +437,12 @@
    getSize() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the size (in bytes) of the YUV image buffer
    +
    Returns the size (in bytes) of the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    -
    getSourceBuf() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    getStrides() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the source image buffer associated with this decompressor - instance.
    -
    -
    getSourceSize() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
    -
    Returns the size of the source image (in bytes) associated with this - decompressor instance.
    +
    Returns the number of bytes per line of each plane in the YUV image.
    getSubsamp() - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    @@ -450,7 +465,7 @@
    getWidth() - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Returns the width of the YUV image.
    +
    Returns the width of the YUV image (or subregion.)
    @@ -483,6 +498,14 @@
     
    jpegBufSize - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
     
    +
    jpegColorspace - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    jpegHeight - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    jpegSubsamp - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    +
    jpegWidth - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
     
    @@ -559,12 +582,12 @@
    OPT_NOOUTPUT - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    -
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this +
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this particular transform.
    OPT_PERFECT - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    -
    This option will cause TJTransformer.transform() to throw an exception if the transform is not +
    This option will cause TJTransformer.transform() to throw an exception if the transform is not perfect.
    OPT_TRIM - Static variable in class org.libjpegturbo.turbojpeg.TJTransform
    @@ -632,6 +655,19 @@
    XRGB pixel format.
    +
    planeHeight(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the plane height of a YUV image plane with the given parameters.
    +
    +
    planeSizeYUV(int, int, int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the size of the buffer (in bytes) required to hold a YUV image + plane with the given parameters.
    +
    +
    planeWidth(int, int, int) - Static method in class org.libjpegturbo.turbojpeg.TJ
    +
    +
    Returns the plane width of a YUV image plane with the given parameters.
    +
    @@ -662,34 +698,37 @@
    Grayscale.
    -
    setBuf(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    setBuf(byte[][], int[], int, int[], int, int) - Method in class org.libjpegturbo.turbojpeg.YUVImage
    -
    Assign an existing YUV planar image buffer to this YUVImage - instance.
    +
    Assign a set of image planes to this YUVImage instance.
    -
    setJPEGImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    setBuf(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Assign a unified image buffer to this YUVImage instance.
    +
    +
    setJPEGImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    setJPEGQuality(int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Set the JPEG image quality level for subsequent compress operations.
    -
    setSourceImage(byte[], int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    setSourceImage(byte[], int, int, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Associate an uncompressed RGB, grayscale, or CMYK source image with this compressor instance.
    -
    setSourceImage(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    setSourceImage(byte[], int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    -
    setSourceImage(BufferedImage, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    +
    setSourceImage(BufferedImage, int, int, int, int) - Method in class org.libjpegturbo.turbojpeg.TJCompressor
    Associate an uncompressed RGB or grayscale source image with this compressor instance.
    @@ -699,10 +738,10 @@
    Associate an uncompressed YUV planar source image with this compressor instance.
    -
    setSourceImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    setSourceImage(byte[], int) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    Associate the JPEG image of length imageSize bytes stored in - srcImage with this decompressor instance.
    + jpegImage with this decompressor instance.
    setSourceImage(YUVImage) - Method in class org.libjpegturbo.turbojpeg.TJDecompressor
    @@ -714,14 +753,6 @@
    Set the level of chrominance subsampling for subsequent compress/encode operations.
    -
    srcColorspace - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
     
    -
    srcHeight - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
     
    -
    srcSubsamp - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
     
    -
    srcWidth - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    -
     
    @@ -742,20 +773,20 @@
    Create a TurboJPEG compressor instance.
    -
    TJCompressor(byte[], int, int, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    TJCompressor(byte[], int, int, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created instance.
    -
    TJCompressor(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    TJCompressor(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    -
    TJCompressor(BufferedImage, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    +
    TJCompressor(BufferedImage, int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJCompressor
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created @@ -778,7 +809,7 @@
    Create a TurboJPEG decompressor instance and associate the JPEG source image stored in jpegImage with the newly created instance.
    -
    TJDecompressor(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    +
    TJDecompressor(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJDecompressor
    Create a TurboJPEG decompressor instance and associate the JPEG source image of length imageSize bytes stored in @@ -794,7 +825,7 @@
    Fractional scaling factor
    -
    TJScalingFactor(int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJScalingFactor
    +
    TJScalingFactor(int, int) - Constructor for class org.libjpegturbo.turbojpeg.TJScalingFactor
     
    TJTransform - Class in org.libjpegturbo.turbojpeg
    @@ -804,11 +835,11 @@
    Create a new lossless transform instance.
    -
    TJTransform(int, int, int, int, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    +
    TJTransform(int, int, int, int, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    Create a new lossless transform instance with the given parameters.
    -
    TJTransform(Rectangle, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    +
    TJTransform(Rectangle, int, int, TJCustomFilter) - Constructor for class org.libjpegturbo.turbojpeg.TJTransform
    Create a new lossless transform instance with the given parameters.
    @@ -825,19 +856,19 @@
    Create a TurboJPEG lossless transformer instance and associate the JPEG image stored in jpegImage with the newly created instance.
    -
    TJTransformer(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJTransformer
    +
    TJTransformer(byte[], int) - Constructor for class org.libjpegturbo.turbojpeg.TJTransformer
    Create a TurboJPEG lossless transformer instance and associate the JPEG image of length imageSize bytes stored in jpegImage with the newly created instance.
    -
    transform(byte[][], TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    +
    transform(byte[][], TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    Losslessly transform the JPEG image associated with this transformer instance into one or more JPEG images stored in the given destination buffers.
    -
    transform(TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    +
    transform(TJTransform[], int) - Method in class org.libjpegturbo.turbojpeg.TJTransformer
    Losslessly transform the JPEG image associated with this transformer instance and return an array of TJDecompressor instances, each of @@ -849,8 +880,6 @@

    Y

    -
    yuvBuf - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    -
     
    yuvHeight - Variable in class org.libjpegturbo.turbojpeg.YUVImage
     
    yuvImage - Variable in class org.libjpegturbo.turbojpeg.TJDecompressor
    @@ -860,17 +889,34 @@
    This class encapsulates a YUV planar image and the metadata associated with it.
    -
    YUVImage(int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    YUVImage(int, int[], int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    -
    Create a YUVImage instance with a new image buffer.
    +
    Create a new YUVImage instance backed by separate image + planes, and allocate memory for the image planes.
    -
    YUVImage(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    YUVImage(int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    -
    Create a YUVImage instance from an existing YUV planar image +
    Create a new YUVImage instance backed by a unified image + buffer, and allocate memory for the image buffer.
    +
    +
    YUVImage(byte[][], int[], int, int[], int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Create a new YUVImage instance from a set of existing image + planes.
    +
    +
    YUVImage(byte[], int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    +
    +
    Create a new YUVImage instance from an existing unified image buffer.
    +
    yuvOffsets - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    yuvPad - Variable in class org.libjpegturbo.turbojpeg.YUVImage
     
    +
    yuvPlanes - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    +
    yuvStrides - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    +
     
    yuvSubsamp - Variable in class org.libjpegturbo.turbojpeg.YUVImage
     
    yuvWidth - Variable in class org.libjpegturbo.turbojpeg.YUVImage
    diff --git a/java/doc/index.html b/java/doc/index.html index 25a639d4..b9839573 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -10,6 +10,12 @@ if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage))) targetPage = "undefined"; function validURL(url) { + try { + url = decodeURIComponent(url); + } + catch (error) { + return false; + } var pos = url.indexOf(".html"); if (pos == -1 || pos != url.length - 5) return false; @@ -21,7 +27,8 @@ if ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '$' || - ch == '_') { + ch == '_' || + ch.charCodeAt(0) > 127) { allowNumber = true; allowSep = true; } else if ('0' <= ch && ch <= '9' diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJ.html b/java/doc/org/libjpegturbo/turbojpeg/TJ.html index ee22e763..f8342f24 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJ.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJ.html @@ -355,7 +355,7 @@ extends java.lang.Object static int -bufSize(int width, +bufSize(int width, int height, int jpegSubsamp)
    Returns the maximum size of the buffer (in bytes) required to hold a JPEG @@ -364,17 +364,17 @@ extends java.lang.Object static int -bufSizeYUV(int width, +bufSizeYUV(int width, int height, int subsamp)
    Deprecated.  - +
    static int -bufSizeYUV(int width, +bufSizeYUV(int width, int pad, int height, int subsamp) @@ -430,6 +430,33 @@ extends java.lang.Object this implementation of TurboJPEG supports.
    + +static int +planeHeight(int componentID, + int height, + int subsamp) +
    Returns the plane height of a YUV image plane with the given parameters.
    + + + +static int +planeSizeYUV(int componentID, + int width, + int stride, + int height, + int subsamp) +
    Returns the size of the buffer (in bytes) required to hold a YUV image + plane with the given parameters.
    + + + +static int +planeWidth(int componentID, + int width, + int subsamp) +
    Returns the plane width of a YUV image plane with the given parameters.
    + + + + + +
      +
    • +

      planeSizeYUV

      +
      public static int planeSizeYUV(int componentID,
      +               int width,
      +               int stride,
      +               int height,
      +               int subsamp)
      +                        throws java.lang.Exception
      +
      Returns the size of the buffer (in bytes) required to hold a YUV image + plane with the given parameters.
      +
      Parameters:
      componentID - ID number of the image plane (0 = Y, 1 = U/Cb, + 2 = V/Cr)
      width - width (in pixels) of the YUV image. NOTE: this is the width + of the whole image, not the plane width.
      stride - bytes per line in the image plane.
      height - height (in pixels) of the YUV image. NOTE: this is the + height of the whole image, not the plane height.
      subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
      +
      Returns:
      the size of the buffer (in bytes) required to hold a YUV planar + image with the given parameters.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      planeWidth

      +
      public static int planeWidth(int componentID,
      +             int width,
      +             int subsamp)
      +                      throws java.lang.Exception
      +
      Returns the plane width of a YUV image plane with the given parameters. + Refer to YUVImage for a description of plane width.
      +
      Parameters:
      componentID - ID number of the image plane (0 = Y, 1 = U/Cb, + 2 = V/Cr)
      width - width (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV image + (one of TJ.SAMP_*)
      +
      Returns:
      the plane width of a YUV image plane with the given parameters.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      planeHeight

      +
      public static int planeHeight(int componentID,
      +              int height,
      +              int subsamp)
      +                       throws java.lang.Exception
      +
      Returns the plane height of a YUV image plane with the given parameters. + Refer to YUVImage for a description of plane height.
      +
      Parameters:
      componentID - ID number of the image plane (0 = Y, 1 = U/Cb, + 2 = V/Cr)
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling used in the YUV image + (one of TJ.SAMP_*)
      +
      Returns:
      the plane height of a YUV image plane with the given parameters.
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -1127,7 +1219,7 @@ public static int bufSizeYUV(int width,
    Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports.
    Returns:
    a list of fractional scaling factors that the JPEG decompressor in - this implementation of TurboJPEG supports
    + this implementation of TurboJPEG supports.
    Throws:
    java.lang.Exception
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html index 6c367a70..93872531 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html @@ -118,7 +118,7 @@ extends java.lang.Object -TJCompressor(java.awt.image.BufferedImage srcImage, +TJCompressor(java.awt.image.BufferedImage srcImage, int x, int y, int width, @@ -129,19 +129,19 @@ extends java.lang.Object -TJCompressor(byte[] srcImage, +TJCompressor(byte[] srcImage, int width, int pitch, int height, int pixelFormat)
    -TJCompressor(byte[] srcImage, +TJCompressor(byte[] srcImage, int x, int y, int width, @@ -176,30 +176,30 @@ extends java.lang.Object void -compress(java.awt.image.BufferedImage srcImage, +compress(java.awt.image.BufferedImage srcImage, byte[] dstBuf, int flags) byte[] -compress(java.awt.image.BufferedImage srcImage, +compress(java.awt.image.BufferedImage srcImage, int flags) void -compress(byte[] dstBuf, +compress(byte[] dstBuf, int flags)
    Compress the uncompressed source image associated with this compressor instance and output a JPEG image to the given destination buffer.
    @@ -214,33 +214,33 @@ extends java.lang.Object void -encodeYUV(java.awt.image.BufferedImage srcImage, +encodeYUV(java.awt.image.BufferedImage srcImage, byte[] dstBuf, int flags) byte[] -encodeYUV(java.awt.image.BufferedImage srcImage, +encodeYUV(java.awt.image.BufferedImage srcImage, int flags) void -encodeYUV(byte[] dstBuf, +encodeYUV(byte[] dstBuf, int flags)
    Deprecated.  - +
    @@ -248,48 +248,57 @@ extends java.lang.Object byte[] encodeYUV(int flags)
    Deprecated.  -
    Use encodeYUV(int, int) instead.
    +
    Use encodeYUV(int, int) instead.
    YUVImage -encodeYUV(int pad, +encodeYUV(int[] strides, int flags)
    Encode the uncompressed source image associated with this compressor - instance into a YUV planar image and return a YUVImage - instance containing the encoded image.
    + instance into separate Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the encoded image planes. +YUVImage +encodeYUV(int pad, + int flags) +
    Encode the uncompressed source image associated with this compressor + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the encoded image.
    + + + void -encodeYUV(YUVImage dstImage, +encodeYUV(YUVImage dstImage, int flags)
    Encode the uncompressed source image associated with this compressor instance into a YUV planar image and store it in the given YUVImage instance.
    - + protected void finalize()  - + int getCompressedSize()
    Returns the size of the image (in bytes) generated by the most recent - compress/encode operation.
    + compress operation. - + void setJPEGQuality(int quality)
    Set the JPEG image quality level for subsequent compress operations.
    - + void -setSourceImage(java.awt.image.BufferedImage srcImage, +setSourceImage(java.awt.image.BufferedImage srcImage, int x, int y, int width, @@ -298,22 +307,22 @@ extends java.lang.Object compressor instance. - + void -setSourceImage(byte[] srcImage, +setSourceImage(byte[] srcImage, int width, int pitch, int height, int pixelFormat) - + void -setSourceImage(byte[] srcImage, +setSourceImage(byte[] srcImage, int x, int y, int width, @@ -324,14 +333,14 @@ extends java.lang.Object compressor instance. - + void setSourceImage(YUVImage srcImage)
    Associate an uncompressed YUV planar source image with this compressor instance.
    - + void setSubsamp(int newSubsamp)
    Set the level of chrominance subsampling for subsequent compress/encode @@ -390,7 +399,7 @@ extends java.lang.Object
    Create a TurboJPEG compressor instance and associate the uncompressed source image stored in srcImage with the newly created instance.
    -
    Parameters:
    srcImage - see setSourceImage(byte[], int, int, int, int, int, int) for description
    x - see setSourceImage(byte[], int, int, int, int, int, int) for description
    y - see setSourceImage(byte[], int, int, int, int, int, int) for description
    width - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pitch - see setSourceImage(byte[], int, int, int, int, int, int) for description
    height - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pixelFormat - pixel format of the source image (one of +
    Parameters:
    srcImage - see setSourceImage(byte[], int, int, int, int, int, int) for description
    x - see setSourceImage(byte[], int, int, int, int, int, int) for description
    y - see setSourceImage(byte[], int, int, int, int, int, int) for description
    width - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pitch - see setSourceImage(byte[], int, int, int, int, int, int) for description
    height - see setSourceImage(byte[], int, int, int, int, int, int) for description
    pixelFormat - pixel format of the source image (one of TJ.PF_*)
    Throws:
    java.lang.Exception
    @@ -410,7 +419,7 @@ public TJCompressor(byte[] srcImage, int pixelFormat) throws java.lang.Exception + TJCompressor(byte[], int, int, int, int, int, int) instead.
    Throws:
    java.lang.Exception
    @@ -431,11 +440,11 @@ public TJCompressor(byte[] srcImage, source image stored in srcImage with the newly created instance.
    Parameters:
    srcImage - see - setSourceImage(BufferedImage, int, int, int, int) for description
    x - see - setSourceImage(BufferedImage, int, int, int, int) for description
    y - see - setSourceImage(BufferedImage, int, int, int, int) for description
    width - see - setSourceImage(BufferedImage, int, int, int, int) for description
    height - see - setSourceImage(BufferedImage, int, int, int, int) for description
    + setSourceImage(BufferedImage, int, int, int, int) for description
    x - see + setSourceImage(BufferedImage, int, int, int, int) for description
    y - see + setSourceImage(BufferedImage, int, int, int, int) for description
    width - see + setSourceImage(BufferedImage, int, int, int, int) for description
    height - see + setSourceImage(BufferedImage, int, int, int, int) for description
    Throws:
    java.lang.Exception
    @@ -496,7 +505,7 @@ public void setSourceImage(byte[] srcImage, int pixelFormat) throws java.lang.Exception + setSourceImage(byte[], int, int, int, int, int, int) instead.
    Throws:
    java.lang.Exception
    @@ -599,7 +608,7 @@ public void setSourceImage(byte[] srcImage,
    Compress the uncompressed source image associated with this compressor instance and output a JPEG image to the given destination buffer.
    Parameters:
    dstBuf - buffer that will receive the JPEG image. Use - TJ.bufSize(int, int, int) to determine the maximum size for this buffer based on + TJ.bufSize(int, int, int) to determine the maximum size for this buffer based on the source image's width and height and the desired level of chrominance subsampling.
    flags - the bitwise OR of one or more of TJ.FLAG_*
    @@ -637,8 +646,8 @@ public void compress(java.awt.image.BufferedImage srcImage, int flags) throws java.lang.Exception + setSourceImage(BufferedImage, int, int, int, int) and + compress(byte[], int) instead.
    Throws:
    java.lang.Exception
    @@ -654,7 +663,7 @@ public byte[] compress(java.awt.image.BufferedImage srcImage, int flags) throws java.lang.Exception
    Throws:
    java.lang.Exception
    @@ -692,7 +701,7 @@ public byte[] compress(java.awt.image.BufferedImage srcImage, public void encodeYUV(byte[] dstBuf, int flags) throws java.lang.Exception -
    Deprecated. Use encodeYUV(YUVImage, int) instead.
    +
    Deprecated. Use encodeYUV(YUVImage, int) instead.
    Throws:
    java.lang.Exception
    @@ -707,16 +716,44 @@ public void encodeYUV(byte[] dstBuf, int flags) throws java.lang.Exception
    Encode the uncompressed source image associated with this compressor - instance into a YUV planar image and return a YUVImage - instance containing the encoded image. This method uses the accelerated - color conversion routines in TurboJPEG's underlying codec but does not - execute any of the other steps in the JPEG compression process. Encoding - CMYK source images to YUV is not supported.
    + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the encoded image. This method + uses the accelerated color conversion routines in TurboJPEG's underlying + codec but does not execute any of the other steps in the JPEG compression + process. Encoding CMYK source images to YUV is not supported.
    Parameters:
    pad - the width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.)
    flags - the bitwise OR of one or more of TJ.FLAG_*
    -
    Returns:
    a YUV planar image
    +
    Returns:
    a YUV planar image.
    +
    Throws:
    +
    java.lang.Exception
    + + + + + +
      +
    • +

      encodeYUV

      +
      public YUVImage encodeYUV(int[] strides,
      +                 int flags)
      +                   throws java.lang.Exception
      +
      Encode the uncompressed source image associated with this compressor + instance into separate Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the encoded image planes. This + method uses the accelerated color conversion routines in TurboJPEG's + underlying codec but does not execute any of the other steps in the JPEG + compression process. Encoding CMYK source images to YUV is not supported.
      +
      Parameters:
      strides - an array of integers, each specifying the number of bytes + per line in the corresponding plane of the output image. Setting the + stride for any plane to 0 is the same as setting it to the component width + of the plane. If strides is null, then the strides for all + planes will be set to their respective component widths. You can adjust + the strides in order to add an arbitrary amount of line padding to each + plane.
      flags - the bitwise OR of one or more of + TJ.FLAG_*
      +
      Returns:
      a YUV planar image.
      Throws:
      java.lang.Exception
    • @@ -730,7 +767,7 @@ public void encodeYUV(byte[] dstBuf,
      @Deprecated
       public byte[] encodeYUV(int flags)
                        throws java.lang.Exception
      -
      Deprecated. Use encodeYUV(int, int) instead.
      +
      Deprecated. Use encodeYUV(int, int) instead.
      Throws:
      java.lang.Exception
      @@ -747,8 +784,8 @@ public void encodeYUV(java.awt.image.BufferedImage srcImage, int flags) throws java.lang.Exception + setSourceImage(BufferedImage, int, int, int, int) and + encodeYUV(byte[], int) instead.
      Throws:
      java.lang.Exception
      @@ -764,8 +801,8 @@ public byte[] encodeYUV(java.awt.image.BufferedImage srcImage, int flags) throws java.lang.Exception + setSourceImage(BufferedImage, int, int, int, int) and + encodeYUV(int, int) instead.
      Throws:
      java.lang.Exception
      @@ -778,9 +815,9 @@ public byte[] encodeYUV(java.awt.image.BufferedImage srcImage,

      getCompressedSize

      public int getCompressedSize()
      Returns the size of the image (in bytes) generated by the most recent - compress/encode operation.
      + compress operation.
      Returns:
      the size of the image (in bytes) generated by the most recent - compress/encode operation
      + compress operation.
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html index bac519b9..c2b6e613 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html @@ -106,7 +106,7 @@ void -customFilter(java.nio.ShortBuffer coeffBuffer, +customFilter(java.nio.ShortBuffer coeffBuffer, java.awt.Rectangle bufferRegion, java.awt.Rectangle planeRegion, int componentID, @@ -162,7 +162,7 @@ coeffBuffer belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
    transformID - ID number of the transformed image to which coeffBuffer belongs. This is the same as the index of the - transform in the transforms array that was passed to TJTransformer.transform().
    transform - a TJTransform instance that specifies the + transform in the transforms array that was passed to TJTransformer.transform().
    transform - a TJTransform instance that specifies the parameters and/or cropping region for this transform
    Throws:
    java.lang.Exception
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html index af6a9020..faf9b6e9 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html @@ -131,19 +131,19 @@ extends java.lang.Object protected int -srcColorspace  +jpegColorspace  protected int -srcHeight  +jpegHeight  protected int -srcSubsamp  +jpegSubsamp  protected int -srcWidth  +jpegWidth  protected YUVImage @@ -175,7 +175,7 @@ extends java.lang.Object -TJDecompressor(byte[] jpegImage, +TJDecompressor(byte[] jpegImage, int imageSize)
    Create a TurboJPEG decompressor instance and associate the JPEG source image of length imageSize bytes stored in @@ -212,7 +212,7 @@ extends java.lang.Object void -decompress(java.awt.image.BufferedImage dstImage, +decompress(java.awt.image.BufferedImage dstImage, int flags)
    Decompress the JPEG source image or decode the YUV source image associated with this decompressor instance and output a decompressed/decoded image to @@ -221,7 +221,7 @@ extends java.lang.Object void -decompress(byte[] dstBuf, +decompress(byte[] dstBuf, int desiredWidth, int pitch, int desiredHeight, @@ -229,13 +229,13 @@ extends java.lang.Object int flags)
    void -decompress(byte[] dstBuf, +decompress(byte[] dstBuf, int x, int y, int desiredWidth, @@ -250,7 +250,7 @@ extends java.lang.Object void -decompress(int[] dstBuf, +decompress(int[] dstBuf, int x, int y, int desiredWidth, @@ -265,7 +265,7 @@ extends java.lang.Object java.awt.image.BufferedImage -decompress(int desiredWidth, +decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags) @@ -276,7 +276,7 @@ extends java.lang.Object byte[] -decompress(int desiredWidth, +decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, @@ -287,10 +287,10 @@ extends java.lang.Object void -decompressToYUV(byte[] dstBuf, +decompressToYUV(byte[] dstBuf, int flags)
    Deprecated.  - +
    @@ -298,128 +298,122 @@ extends java.lang.Object byte[] decompressToYUV(int flags) YUVImage -decompressToYUV(int desiredWidth, +decompressToYUV(int desiredWidth, + int[] strides, + int desiredHeight, + int flags) +
    Decompress the JPEG source image associated with this decompressor + instance into a set of Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the decompressed image planes.
    + + + +YUVImage +decompressToYUV(int desiredWidth, int pad, int desiredHeight, int flags)
    Decompress the JPEG source image associated with this decompressor - instance into a YUV planar image and return a YUVImage - instance containing the decompressed image.
    + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the decompressed image.
    - + void -decompressToYUV(YUVImage dstImage, +decompressToYUV(YUVImage dstImage, int flags)
    Decompress the JPEG source image associated with this decompressor instance into a YUV planar image and store it in the given YUVImage instance.
    - + protected void finalize()  - + int getColorspace()
    Returns the colorspace used in the source image (JPEG or YUV) associated with this decompressor instance.
    - + int getHeight()
    Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
    - + byte[] getJPEGBuf() -
    Deprecated.  -
    Use getSourceBuf() instead.
    -
    +
    Returns the JPEG image buffer associated with this decompressor instance.
    + + + +int +getJPEGSize() +
    Returns the size of the JPEG image (in bytes) associated with this + decompressor instance.
    int -getJPEGSize() -
    Deprecated.  -
    Use getSourceSize() instead.
    -
    - - - -int -getScaledHeight(int desiredWidth, +getScaledHeight(int desiredWidth, int desiredHeight)
    Returns the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
    - + int -getScaledWidth(int desiredWidth, +getScaledWidth(int desiredWidth, int desiredHeight)
    Returns the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and height.
    - -byte[] -getSourceBuf() -
    Returns the source image buffer associated with this decompressor - instance.
    - - int -getSourceSize() -
    Returns the size of the source image (in bytes) associated with this - decompressor instance.
    - - - -int getSubsamp()
    Returns the level of chrominance subsampling used in the source image (JPEG or YUV) associated with this decompressor instance.
    - + int getWidth()
    Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
    - + void -setJPEGImage(byte[] jpegImage, +setJPEGImage(byte[] jpegImage, int imageSize)
    Deprecated.  - +
    - + void -setSourceImage(byte[] srcImage, +setSourceImage(byte[] jpegImage, int imageSize)
    Associate the JPEG image of length imageSize bytes stored in - srcImage with this decompressor instance.
    + jpegImage with this decompressor instance. - + void setSourceImage(YUVImage srcImage)
    Associate the specified YUV planar source image with this decompressor @@ -484,40 +478,40 @@ extends java.lang.Object
    protected YUVImage yuvImage
    - +
    • -

      srcWidth

      -
      protected int srcWidth
      +

      jpegWidth

      +
      protected int jpegWidth
    - +
    • -

      srcHeight

      -
      protected int srcHeight
      +

      jpegHeight

      +
      protected int jpegHeight
    - +
    • -

      srcSubsamp

      -
      protected int srcSubsamp
      +

      jpegSubsamp

      +
      protected int jpegSubsamp
    - +
    • -

      srcColorspace

      -
      protected int srcColorspace
      +

      jpegColorspace

      +
      protected int jpegColorspace
    @@ -605,13 +599,13 @@ extends java.lang.Object
    • setSourceImage

      -
      public void setSourceImage(byte[] srcImage,
      +
      public void setSourceImage(byte[] jpegImage,
                         int imageSize)
                           throws java.lang.Exception
      Associate the JPEG image of length imageSize bytes stored in - srcImage with this decompressor instance. This image will + jpegImage with this decompressor instance. This image will be used as the source image for subsequent decompress operations.
      -
      Parameters:
      srcImage - JPEG image buffer
      imageSize - size of the JPEG image (in bytes)
      +
      Parameters:
      jpegImage - JPEG image buffer
      imageSize - size of the JPEG image (in bytes)
      Throws:
      java.lang.Exception
    • @@ -626,7 +620,7 @@ extends java.lang.Object public void setJPEGImage(byte[] jpegImage, int imageSize) throws java.lang.Exception -
      Deprecated. Use setSourceImage(byte[], int) instead.
      +
      Deprecated. Use setSourceImage(byte[], int) instead.
      Throws:
      java.lang.Exception
      @@ -659,7 +653,7 @@ public void setJPEGImage(byte[] jpegImage,
      Returns the width of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
      the width of the source image (JPEG or YUV) associated with this - decompressor instance
      + decompressor instance.
      Throws:
      java.lang.Exception
      @@ -675,7 +669,7 @@ public void setJPEGImage(byte[] jpegImage,
      Returns the height of the source image (JPEG or YUV) associated with this decompressor instance.
      Returns:
      the height of the source image (JPEG or YUV) associated with this - decompressor instance
      + decompressor instance.
      Throws:
      java.lang.Exception
      @@ -692,7 +686,7 @@ public void setJPEGImage(byte[] jpegImage, (JPEG or YUV) associated with this decompressor instance. See TJ.SAMP_*.
    Returns:
    the level of chrominance subsampling used in the source image - (JPEG or YUV) associated with this decompressor instance
    + (JPEG or YUV) associated with this decompressor instance.
    Throws:
    java.lang.Exception
    @@ -709,22 +703,7 @@ public void setJPEGImage(byte[] jpegImage, with this decompressor instance. See TJ.CS_*. If the source image is YUV, then this always returns TJ.CS_YCbCr.
    Returns:
    the colorspace used in the source image (JPEG or YUV) associated - with this decompressor instance
    -
    Throws:
    -
    java.lang.Exception
    - - - - - -
      -
    • -

      getSourceBuf

      -
      public byte[] getSourceBuf()
      -                    throws java.lang.Exception
      -
      Returns the source image buffer associated with this decompressor - instance.
      -
      Returns:
      the source image buffer associated with this decompressor instance
      + with this decompressor instance.
      Throws:
      java.lang.Exception
    • @@ -735,26 +714,10 @@ public void setJPEGImage(byte[] jpegImage,
      • getJPEGBuf

        -
        @Deprecated
        -public byte[] getJPEGBuf()
        +
        public byte[] getJPEGBuf()
                           throws java.lang.Exception
        -
        Deprecated. Use getSourceBuf() instead.
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      - - - -
        -
      • -

        getSourceSize

        -
        public int getSourceSize()
        -                  throws java.lang.Exception
        -
        Returns the size of the source image (in bytes) associated with this - decompressor instance.
        -
        Returns:
        the size of the source image (in bytes) associated with this - decompressor instance
        +
        Returns the JPEG image buffer associated with this decompressor instance.
        +
        Returns:
        the JPEG image buffer associated with this decompressor instance.
        Throws:
        java.lang.Exception
      • @@ -765,11 +728,13 @@ public byte[] getJPEGBuf()
        • getJPEGSize

          -
          @Deprecated
          -public int getJPEGSize()
          +
          public int getJPEGSize()
                           throws java.lang.Exception
          -
          Deprecated. Use getSourceSize() instead.
          -
          Throws:
          +
          Returns the size of the JPEG image (in bytes) associated with this + decompressor instance.
          +
          Returns:
          the size of the JPEG image (in bytes) associated with this + decompressor instance.
          +
          Throws:
          java.lang.Exception
        @@ -794,7 +759,7 @@ public int getJPEGSize() the scaled image size.)
        Returns:
        the width of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height
        + height.
        Throws:
        java.lang.Exception
        @@ -820,7 +785,7 @@ public int getJPEGSize() the scaled image size.)
        Returns:
        the height of the largest scaled-down image that the TurboJPEG decompressor can generate without exceeding the desired image width and - height
        + height.
        Throws:
        java.lang.Exception
        @@ -848,7 +813,7 @@ public int getJPEGSize() pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling scalingFactor.getScaled(jpegHeight) - with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the +
        with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the source image is a YUV image, then this buffer should normally be pitch * height bytes in size, where height is the height of the YUV image. However, the buffer may also be larger than @@ -872,7 +837,7 @@ public int getJPEGSize() if the source image is a JPEG image, then scaledWidth can be determined by calling scalingFactor.getScaled(jpegWidth) - or by calling getScaledWidth(int, int). If the source image is a + or by calling getScaledWidth(int, int). If the source image is a YUV image, then scaledWidth is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * TJ.pixelSize(pixelFormat).
        desiredHeight - If the source image is a JPEG image, then this @@ -905,7 +870,7 @@ public void decompress(byte[] dstBuf, int flags) throws java.lang.Exception + decompress(byte[], int, int, int, int, int, int, int) instead.
        Throws:
        java.lang.Exception
        @@ -925,15 +890,15 @@ public void decompress(byte[] dstBuf,
        Decompress the JPEG source image associated with this decompressor instance and return a buffer containing the decompressed image.
        Parameters:
        desiredWidth - see - decompress(byte[], int, int, int, int, int, int, int) + decompress(byte[], int, int, int, int, int, int, int) for description
        pitch - see - decompress(byte[], int, int, int, int, int, int, int) + decompress(byte[], int, int, int, int, int, int, int) for description
        desiredHeight - see - decompress(byte[], int, int, int, int, int, int, int) + decompress(byte[], int, int, int, int, int, int, int) for description
        pixelFormat - pixel format of the decompressed image (one of TJ.PF_*)
        flags - the bitwise OR of one or more of TJ.FLAG_*
        -
        Returns:
        a buffer containing the decompressed image
        +
        Returns:
        a buffer containing the decompressed image.
        Throws:
        java.lang.Exception
        @@ -974,11 +939,54 @@ public void decompress(byte[] dstBuf, public void decompressToYUV(byte[] dstBuf, int flags) throws java.lang.Exception -
        Deprecated. Use decompressToYUV(YUVImage, int) instead.
        +
        Deprecated. Use decompressToYUV(YUVImage, int) instead.
        Throws:
        java.lang.Exception
      + + + +
        +
      • +

        decompressToYUV

        +
        public YUVImage decompressToYUV(int desiredWidth,
        +                       int[] strides,
        +                       int desiredHeight,
        +                       int flags)
        +                         throws java.lang.Exception
        +
        Decompress the JPEG source image associated with this decompressor + instance into a set of Y, U (Cb), and V (Cr) image planes and return a + YUVImage instance containing the decompressed image planes. + This method performs JPEG decompression but leaves out the color + conversion step, so a planar YUV image is generated instead of an RGB or + grayscale image. This method cannot be used to decompress JPEG source + images with the CMYK or YCCK colorspace.
        +
        Parameters:
        desiredWidth - desired width (in pixels) of the YUV image. If the + desired image dimensions are different than the dimensions of the JPEG + image being decompressed, then TurboJPEG will use scaling in the JPEG + decompressor to generate the largest possible image that will fit within + the desired dimensions. Setting this to 0 is the same as setting it to + the width of the JPEG image (in other words, the width will not be + considered when determining the scaled image size.)
        strides - an array of integers, each specifying the number of bytes + per line in the corresponding plane of the output image. Setting the + stride for any plane to 0 is the same as setting it to the scaled + component width of the plane. If strides is NULL, then the + strides for all planes will be set to their respective scaled component + widths. You can adjust the strides in order to add an arbitrary amount of + line padding to each plane.
        desiredHeight - desired height (in pixels) of the YUV image. If the + desired image dimensions are different than the dimensions of the JPEG + image being decompressed, then TurboJPEG will use scaling in the JPEG + decompressor to generate the largest possible image that will fit within + the desired dimensions. Setting this to 0 is the same as setting it to + the height of the JPEG image (in other words, the height will not be + considered when determining the scaled image size.)
        flags - the bitwise OR of one or more of + TJ.FLAG_*
        +
        Returns:
        a YUV planar image.
        +
        Throws:
        +
        java.lang.Exception
        +
      • +
      @@ -991,12 +999,12 @@ public void decompressToYUV(byte[] dstBuf, int flags) throws java.lang.Exception
      Decompress the JPEG source image associated with this decompressor - instance into a YUV planar image and return a YUVImage - instance containing the decompressed image. This method performs JPEG - decompression but leaves out the color conversion step, so a planar YUV - image is generated instead of an RGB or grayscale image. This method - cannot be used to decompress JPEG source images with the CMYK or YCCK - colorspace.
      + instance into a unified YUV planar image buffer and return a + YUVImage instance containing the decompressed image. This + method performs JPEG decompression but leaves out the color conversion + step, so a planar YUV image is generated instead of an RGB or grayscale + image. This method cannot be used to decompress JPEG source images with + the CMYK or YCCK colorspace.
      Parameters:
      desiredWidth - desired width (in pixels) of the YUV image. If the desired image dimensions are different than the dimensions of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG @@ -1013,7 +1021,7 @@ public void decompressToYUV(byte[] dstBuf, the height of the JPEG image (in other words, the height will not be considered when determining the scaled image size.)
      flags - the bitwise OR of one or more of TJ.FLAG_*
      -
      Returns:
      a YUV planar image
      +
      Returns:
      a YUV planar image.
      Throws:
      java.lang.Exception
      @@ -1027,7 +1035,7 @@ public void decompressToYUV(byte[] dstBuf,
      @Deprecated
       public byte[] decompressToYUV(int flags)
                              throws java.lang.Exception
      -
      Deprecated. Use decompressToYUV(int, int, int, int) instead.
      +
      Deprecated. Use decompressToYUV(int, int, int, int) instead.
      Throws:
      java.lang.Exception
      @@ -1055,7 +1063,7 @@ public byte[] decompressToYUV(int flags) stride * scaledHeight pixels in size, where scaledHeight can be determined by calling scalingFactor.getScaled(jpegHeight) - with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the + with one of the scaling factors returned from TJ.getScalingFactors() or by calling getScaledHeight(int, int). If the source image is a YUV image, then this buffer should normally be stride * height pixels in size, where height is the height of the YUV image. However, the buffer may also be larger than @@ -1077,7 +1085,7 @@ public byte[] decompressToYUV(int flags) NOTE: if the source image is a JPEG image, then scaledWidth can be determined by calling scalingFactor.getScaled(jpegWidth) - or by calling getScaledWidth(int, int). If the source image is a + or by calling getScaledWidth(int, int). If the source image is a YUV image, then scaledWidth is the width of the YUV image. Setting this parameter to 0 is the equivalent of setting it to scaledWidth.
      desiredHeight - If the source image is a JPEG image, then this @@ -1134,15 +1142,15 @@ public byte[] decompressToYUV(int flags) with this decompressor instance and return a BufferedImage instance containing the decompressed/decoded image.
      Parameters:
      desiredWidth - see - decompress(byte[], int, int, int, int, int, int, int) for + decompress(byte[], int, int, int, int, int, int, int) for description
      desiredHeight - see - decompress(byte[], int, int, int, int, int, int, int) for + decompress(byte[], int, int, int, int, int, int, int) for description
      bufferedImageType - the image type of the BufferedImage instance that will be created (for instance, BufferedImage.TYPE_INT_RGB)
      flags - the bitwise OR of one or more of TJ.FLAG_*
      Returns:
      a BufferedImage instance containing the - decompressed/decoded image
      + decompressed/decoded image.
      Throws:
      java.lang.Exception
      diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html index 1b901477..c28c00c0 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html @@ -113,7 +113,7 @@ extends java.lang.Object Constructor and Description -TJScalingFactor(int num, +TJScalingFactor(int num, int denom)  @@ -238,7 +238,7 @@ extends java.lang.Object
      Returns the scaled value of dimension. This function performs the integer equivalent of ceil(dimension * scalingFactor).
      -
      Returns:
      the scaled value of dimension
      +
      Returns:
      the scaled value of dimension.
    @@ -251,7 +251,7 @@ extends java.lang.Object
    Returns true or false, depending on whether this instance and other have the same numerator and denominator.
    Returns:
    true or false, depending on whether this instance and - other have the same numerator and denominator
    + other have the same numerator and denominator.
    @@ -264,7 +264,7 @@ extends java.lang.Object
    Returns true or false, depending on whether this instance is equal to 1/1.
    Returns:
    true or false, depending on whether this instance is equal to - 1/1
    + 1/1. diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html index b4bd5cc7..daabfb3f 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html @@ -231,14 +231,14 @@ extends java.awt.Rectangle static int
    OPT_NOOUTPUT -
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this +
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this particular transform.
    static int OPT_PERFECT -
    This option will cause TJTransformer.transform() to throw an exception if the transform is not +
    This option will cause TJTransformer.transform() to throw an exception if the transform is not perfect.
    @@ -289,7 +289,7 @@ extends java.awt.Rectangle -TJTransform(int x, +TJTransform(int x, int y, int w, int h, @@ -300,7 +300,7 @@ extends java.awt.Rectangle -TJTransform(java.awt.Rectangle r, +TJTransform(java.awt.Rectangle r, int op, int options, TJCustomFilter cf) @@ -486,7 +486,7 @@ extends java.awt.Rectangle
  • OPT_PERFECT

    public static final int OPT_PERFECT
    -
    This option will cause TJTransformer.transform() to throw an exception if the transform is not +
    This option will cause TJTransformer.transform() to throw an exception if the transform is not perfect. Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used. If the image's width or height is not evenly divisible by the MCU block size (see TJ.getMCUWidth(int) @@ -541,7 +541,7 @@ extends java.awt.Rectangle
  • OPT_NOOUTPUT

    public static final int OPT_NOOUTPUT
    -
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this +
    This option will prevent TJTransformer.transform() from outputting a JPEG image for this particular transform. This can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.
    @@ -636,7 +636,7 @@ extends java.awt.Rectangle throws java.lang.Exception
    Create a new lossless transform instance with the given parameters.
    Parameters:
    r - a Rectangle instance that specifies the cropping - region. See TJTransform(int, int, int, int, int, int, TJCustomFilter) for more + region. See TJTransform(int, int, int, int, int, int, TJCustomFilter) for more detail.
    op - one of the transform operations (OP_*)
    options - the bitwise OR of one or more of the transform options (OPT_*)
    cf - an instance of an object that implements the TJCustomFilter interface, or null if no custom filter is needed
    Throws:
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html index 3be18ec6..333f3eb3 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html +++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html @@ -117,7 +117,7 @@ extends

    Fields inherited from class org.libjpegturbo.turbojpeg.TJDecompressor

    -handle, jpegBuf, jpegBufSize, srcColorspace, srcHeight, srcSubsamp, srcWidth, yuvImage
  • +handle, jpegBuf, jpegBufSize, jpegColorspace, jpegHeight, jpegSubsamp, jpegWidth, yuvImage @@ -144,7 +144,7 @@ extends -TJTransformer(byte[] jpegImage, +TJTransformer(byte[] jpegImage, int imageSize)
    Create a TurboJPEG lossless transformer instance and associate the JPEG image of length imageSize bytes stored in @@ -175,7 +175,7 @@ extends void -transform(byte[][] dstBufs, +transform(byte[][] dstBufs, TJTransform[] transforms, int flags)
    Losslessly transform the JPEG image associated with this transformer @@ -185,7 +185,7 @@ extends TJDecompressor[] -transform(TJTransform[] transforms, +transform(TJTransform[] transforms, int flags)
    Losslessly transform the JPEG image associated with this transformer instance and return an array of TJDecompressor instances, each of @@ -198,7 +198,7 @@ extends

    Methods inherited from class org.libjpegturbo.turbojpeg.TJDecompressor

    -close, decompress, decompress, decompress, decompress, decompress, decompress, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, finalize, getColorspace, getHeight, getJPEGBuf, getJPEGSize, getScaledHeight, getScaledWidth, getSourceBuf, getSourceSize, getSubsamp, getWidth, setJPEGImage, setSourceImage, setSourceImage +close, decompress, decompress, decompress, decompress, decompress, decompress, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, decompressToYUV, finalize, getColorspace, getHeight, getJPEGBuf, getJPEGSize, getScaledHeight, getScaledWidth, getSubsamp, getWidth, setJPEGImage, setSourceImage, setSourceImage
    Returns:
    an array containing the sizes of the transformed JPEG images - generated by the most recent transform operation
    + generated by the most recent transform operation.
    Throws:
    java.lang.Exception
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html index 3e7a6e8b..0a3e0a51 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -108,20 +108,18 @@ extends java.lang.Object image format consisting of Y, Cb, and Cr image planes.

    Each plane is simply a 2D array of bytes, each byte representing the value - of one of the components at a particular location in the image. The - "component width" and "component height" of each plane are determined by the - image width, height, and level of chrominance subsampling. For the - luminance plane, the component width is the image width padded to the - nearest multiple of the horizontal subsampling factor (2 in the case of - 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or - grayscale.) Similarly, the component height of the luminance plane is the - image height padded to the nearest multiple of the vertical subsampling - factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or - grayscale.) The component width of the chrominance planes is equal to the - component width of the luminance plane divided by the horizontal subsampling - factor, and the component height of the chrominance planes is equal to the - component height of the luminance plane divided by the vertical subsampling - factor. + of one of the components (Y, Cb, or Cr) at a particular location in the + image. The width and height of each plane are determined by the image + width, height, and level of chrominance subsampling. The luminance plane + width is the image width padded to the nearest multiple of the horizontal + subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of + 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane + height is the image height padded to the nearest multiple of the vertical + subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 + or grayscale.) The chrominance plane width is equal to the luminance plane + width divided by the horizontal subsampling factor, and the chrominance + plane height is equal to the luminance plane height divided by the vertical + subsampling factor.

    For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the @@ -151,18 +149,26 @@ extends java.lang.Object handle  -protected byte[] -yuvBuf  - - protected int yuvHeight  + +protected int[] +yuvOffsets  + protected int yuvPad  +protected byte[][] +yuvPlanes  + + +protected int[] +yuvStrides  + + protected int yuvSubsamp  @@ -185,21 +191,42 @@ extends java.lang.Object Constructor and Description -YUVImage(byte[] yuvImage, +YUVImage(byte[][] planes, + int[] offsets, + int width, + int[] strides, + int height, + int subsamp) +

    Create a new YUVImage instance from a set of existing image + planes.
    + + + +YUVImage(byte[] yuvImage, int width, int pad, int height, int subsamp) -
    Create a YUVImage instance from an existing YUV planar image +
    Create a new YUVImage instance from an existing unified image buffer.
    + +YUVImage(int width, + int[] strides, + int height, + int subsamp) +
    Create a new YUVImage instance backed by separate image + planes, and allocate memory for the image planes.
    + + -YUVImage(int width, +YUVImage(int width, int pad, int height, int subsamp) -
    Create a YUVImage instance with a new image buffer.
    +
    Create a new YUVImage instance backed by a unified image + buffer, and allocate memory for the image buffer.
    @@ -220,48 +247,80 @@ extends java.lang.Object byte[] getBuf() -
    Returns the YUV image buffer
    +
    Returns the YUV image buffer (if this image is stored in a unified + buffer rather than separate image planes.)
    int getHeight() -
    Returns the height of the YUV image.
    +
    Returns the height of the YUV image (or subregion.)
    +int[] +getOffsets() +
    Returns the offsets (in bytes) of each plane within the planes of a larger + YUV image.
    + + + int getPad() -
    Returns the line padding used in the YUV image buffer.
    +
    Returns the line padding used in the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    + + + +byte[][] +getPlanes() +
    Returns the YUV image planes.
    int getSize() -
    Returns the size (in bytes) of the YUV image buffer
    +
    Returns the size (in bytes) of the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    +int[] +getStrides() +
    Returns the number of bytes per line of each plane in the YUV image.
    + + + int getSubsamp()
    Returns the level of chrominance subsampling used in the YUV image.
    - + int getWidth() -
    Returns the width of the YUV image.
    +
    Returns the width of the YUV image (or subregion.)
    + + + +void +setBuf(byte[][] planes, + int[] offsets, + int width, + int[] strides, + int height, + int subsamp) +
    Assign a set of image planes to this YUVImage instance.
    void -setBuf(byte[] yuvImage, +setBuf(byte[] yuvImage, int width, int pad, int height, int subsamp) -
    Assign an existing YUV planar image buffer to this YUVImage - instance.
    +
    Assign a unified image buffer to this YUVImage instance.
    @@ -295,13 +354,31 @@ extends java.lang.Object
    protected long handle
    - +
    • -

      yuvBuf

      -
      protected byte[] yuvBuf
      +

      yuvPlanes

      +
      protected byte[][] yuvPlanes
      +
    • +
    + + + +
      +
    • +

      yuvOffsets

      +
      protected int[] yuvOffsets
      +
    • +
    + + + +
      +
    • +

      yuvStrides

      +
      protected int[] yuvStrides
    @@ -348,6 +425,31 @@ extends java.lang.Object

    Constructor Detail

    + + + +
      +
    • +

      YUVImage

      +
      public YUVImage(int width,
      +        int[] strides,
      +        int height,
      +        int subsamp)
      +         throws java.lang.Exception
      +
      Create a new YUVImage instance backed by separate image + planes, and allocate memory for the image planes.
      +
      Parameters:
      width - width (in pixels) of the YUV image
      strides - an array of integers, each specifying the number of bytes + per line in the corresponding plane of the YUV image. Setting the stride + for any plane to 0 is the same as setting it to the plane width (see + above.) If strides is null, then the + strides for all planes will be set to their respective plane widths. When + using this constructor, the stride for each plane must be equal to or + greater than the plane width.
      height - height (in pixels) of the YUV image
      subsamp - the level of chrominance subsampling to be used in the YUV + image (one of TJ.SAMP_*)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -359,7 +461,8 @@ extends java.lang.Object int height, int subsamp) throws java.lang.Exception -
    Create a YUVImage instance with a new image buffer.
    +
    Create a new YUVImage instance backed by a unified image + buffer, and allocate memory for the image buffer.
    Parameters:
    width - width (in pixels) of the YUV image
    pad - Each line of each plane in the YUV image buffer will be padded to this number of bytes (must be a power of 2.)
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling to be used in the YUV image (one of TJ.SAMP_*)
    @@ -367,6 +470,44 @@ extends java.lang.Object
    java.lang.Exception
    + + + +
      +
    • +

      YUVImage

      +
      public YUVImage(byte[][] planes,
      +        int[] offsets,
      +        int width,
      +        int[] strides,
      +        int height,
      +        int subsamp)
      +         throws java.lang.Exception
      +
      Create a new YUVImage instance from a set of existing image + planes.
      +
      Parameters:
      planes - an array of buffers representing the Y, U (Cb), and V (Cr) + image planes (or just the Y plane, if the image is grayscale.) These + planes can be contiguous or non-contiguous in memory. Plane + i should be at least offsets[i] + + TJ.planeSizeYUV(i, width, strides[i], height, subsamp) + bytes in size.
      offsets - If this YUVImage instance represents a + subregion of a larger image, then offsets[i] specifies the + offset (in bytes) of the subregion within plane i of the + larger image. Setting this to null is the same as setting the offsets for + all planes to 0.
      width - width (in pixels) of the new YUV image (or subregion)
      strides - an array of integers, each specifying the number of bytes + per line in the corresponding plane of the YUV image. Setting the stride + for any plane to 0 is the same as setting it to the plane width (see + above.) If strides is null, then the + strides for all planes will be set to their respective plane widths. You + can adjust the strides in order to add an arbitrary amount of line padding + to each plane or to specify that this YUVImage instance is a + subregion of a larger image (in which case, strides[i] should + be set to the plane width of plane i in the larger image.)
      height - height (in pixels) of the new YUV image (or subregion)
      subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -379,10 +520,10 @@ extends java.lang.Object int height, int subsamp) throws java.lang.Exception -
    Create a YUVImage instance from an existing YUV planar image +
    Create a new YUVImage instance from an existing unified image buffer.
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar - image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in the buffer (see above for a description of the image format.)
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For @@ -401,6 +542,43 @@ extends java.lang.Object

    Method Detail

    + + + +
      +
    • +

      setBuf

      +
      public void setBuf(byte[][] planes,
      +          int[] offsets,
      +          int width,
      +          int[] strides,
      +          int height,
      +          int subsamp)
      +            throws java.lang.Exception
      +
      Assign a set of image planes to this YUVImage instance.
      +
      Parameters:
      planes - an array of buffers representing the Y, U (Cb), and V (Cr) + image planes (or just the Y plane, if the image is grayscale.) These + planes can be contiguous or non-contiguous in memory. Plane + i should be at least offsets[i] + + TJ.planeSizeYUV(i, width, strides[i], height, subsamp) + bytes in size.
      offsets - If this YUVImage instance represents a + subregion of a larger image, then offsets[i] specifies the + offset (in bytes) of the subregion within plane i of the + larger image. Setting this to null is the same as setting the offsets for + all planes to 0.
      width - width (in pixels) of the YUV image (or subregion)
      strides - an array of integers, each specifying the number of bytes + per line in the corresponding plane of the YUV image. Setting the stride + for any plane to 0 is the same as setting it to the plane width (see + above.) If strides is null, then the + strides for all planes will be set to their respective plane widths. You + can adjust the strides in order to add an arbitrary amount of line padding + to each plane or to specify that this YUVImage image is a + subregion of a larger image (in which case, strides[i] should + be set to the plane width of plane i in the larger image.)
      height - height (in pixels) of the YUV image (or subregion)
      subsamp - the level of chrominance subsampling used in the YUV + image (one of TJ.SAMP_*)
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -413,10 +591,9 @@ extends java.lang.Object int height, int subsamp) throws java.lang.Exception -
    Assign an existing YUV planar image buffer to this YUVImage - instance.
    +
    Assign a unified image buffer to this YUVImage instance.
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar - image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this buffer. The Y, U (Cb), and V (Cr) image planes are stored sequentially in the buffer (see above for a description of the image format.)
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For @@ -435,8 +612,8 @@ extends java.lang.Object

    getWidth

    public int getWidth()
                  throws java.lang.Exception
    -
    Returns the width of the YUV image.
    -
    Returns:
    the width of the YUV image
    +
    Returns the width of the YUV image (or subregion.)
    +
    Returns:
    the width of the YUV image (or subregion)
    Throws:
    java.lang.Exception
    @@ -449,8 +626,8 @@ extends java.lang.Object

    getHeight

    public int getHeight()
                   throws java.lang.Exception
    -
    Returns the height of the YUV image.
    -
    Returns:
    the height of the YUV image
    +
    Returns the height of the YUV image (or subregion.)
    +
    Returns:
    the height of the YUV image (or subregion)
    Throws:
    java.lang.Exception
    @@ -463,12 +640,43 @@ extends java.lang.Object

    getPad

    public int getPad()
                throws java.lang.Exception
    -
    Returns the line padding used in the YUV image buffer.
    +
    Returns the line padding used in the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    Returns:
    the line padding used in the YUV image buffer
    Throws:
    java.lang.Exception
    + + + +
      +
    • +

      getStrides

      +
      public int[] getStrides()
      +                 throws java.lang.Exception
      +
      Returns the number of bytes per line of each plane in the YUV image.
      +
      Returns:
      the number of bytes per line of each plane in the YUV image
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    + + + +
      +
    • +

      getOffsets

      +
      public int[] getOffsets()
      +                 throws java.lang.Exception
      +
      Returns the offsets (in bytes) of each plane within the planes of a larger + YUV image.
      +
      Returns:
      the offsets (in bytes) of each plane within the planes of a larger + YUV image
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -484,6 +692,21 @@ extends java.lang.Object
    java.lang.Exception
    + + + +
      +
    • +

      getPlanes

      +
      public byte[][] getPlanes()
      +                   throws java.lang.Exception
      +
      Returns the YUV image planes. If the image is stored in a unified buffer, + then all image planes will point to that buffer.
      +
      Returns:
      the YUV image planes
      +
      Throws:
      +
      java.lang.Exception
      +
    • +
    @@ -492,7 +715,8 @@ extends java.lang.Object

    getBuf

    public byte[] getBuf()
                   throws java.lang.Exception
    -
    Returns the YUV image buffer
    +
    Returns the YUV image buffer (if this image is stored in a unified + buffer rather than separate image planes.)
    Returns:
    the YUV image buffer
    Throws:
    java.lang.Exception
    @@ -506,7 +730,8 @@ extends java.lang.Object

    getSize

    public int getSize()
                 throws java.lang.Exception
    -
    Returns the size (in bytes) of the YUV image buffer
    +
    Returns the size (in bytes) of the YUV image buffer (if this image is + stored in a unified buffer rather than separate image planes.)
    Returns:
    the size (in bytes) of the YUV image buffer
    Throws:
    java.lang.Exception
    diff --git a/java/org/libjpegturbo/turbojpeg/TJ.java b/java/org/libjpegturbo/turbojpeg/TJ.java index ac4a4dd1..644a1978 100644 --- a/java/org/libjpegturbo/turbojpeg/TJ.java +++ b/java/org/libjpegturbo/turbojpeg/TJ.java @@ -84,7 +84,8 @@ public final class TJ { * @param subsamp the level of chrominance subsampling (one of * SAMP_*) * - * @return the MCU block width for the given level of chrominance subsampling + * @return the MCU block width for the given level of chrominance + * subsampling. */ public static int getMCUWidth(int subsamp) throws Exception { if (subsamp < 0 || subsamp >= NUMSAMP) @@ -105,7 +106,7 @@ public final class TJ { * SAMP_*) * * @return the MCU block height for the given level of chrominance - * subsampling + * subsampling. */ public static int getMCUHeight(int subsamp) throws Exception { if (subsamp < 0 || subsamp >= NUMSAMP) @@ -214,7 +215,7 @@ public final class TJ { * * @param pixelFormat the pixel format (one of PF_*) * - * @return the pixel size (in bytes) for the given pixel format + * @return the pixel size (in bytes) for the given pixel format. */ public static int getPixelSize(int pixelFormat) throws Exception { if (pixelFormat < 0 || pixelFormat >= NUMPF) @@ -236,7 +237,7 @@ public final class TJ { * * @param pixelFormat the pixel format (one of PF_*) * - * @return the red offset for the given pixel format + * @return the red offset for the given pixel format. */ public static int getRedOffset(int pixelFormat) throws Exception { if (pixelFormat < 0 || pixelFormat >= NUMPF) @@ -258,7 +259,7 @@ public final class TJ { * * @param pixelFormat the pixel format (one of PF_*) * - * @return the green offset for the given pixel format + * @return the green offset for the given pixel format. */ public static int getGreenOffset(int pixelFormat) throws Exception { if (pixelFormat < 0 || pixelFormat >= NUMPF) @@ -280,7 +281,7 @@ public final class TJ { * * @param pixelFormat the pixel format (one of PF_*) * - * @return the blue offset for the given pixel format + * @return the blue offset for the given pixel format. */ public static int getBlueOffset(int pixelFormat) throws Exception { if (pixelFormat < 0 || pixelFormat >= NUMPF) @@ -404,7 +405,7 @@ public final class TJ { * generating the JPEG image (one of {@link TJ TJ.SAMP_*}) * * @return the maximum size of the buffer (in bytes) required to hold a JPEG - * image with the given width, height, and level of chrominance subsampling + * image with the given width, height, and level of chrominance subsampling. */ public static native int bufSize(int width, int height, int jpegSubsamp) throws Exception; @@ -416,8 +417,7 @@ public final class TJ { * @param width the width (in pixels) of the YUV image * * @param pad the width of each line in each plane of the image is padded to - * the nearest multiple of this number of bytes (must be a power of - * 2.) + * the nearest multiple of this number of bytes (must be a power of 2.) * * @param height the height (in pixels) of the YUV image * @@ -425,7 +425,7 @@ public final class TJ { * image (one of {@link TJ TJ.SAMP_*}) * * @return the size of the buffer (in bytes) required to hold a YUV planar - * image with the given width, height, and level of chrominance subsampling + * image with the given width, height, and level of chrominance subsampling. */ public static native int bufSizeYUV(int width, int pad, int height, int subsamp) @@ -438,12 +438,72 @@ public final class TJ { public static native int bufSizeYUV(int width, int height, int subsamp) throws Exception; + /** + * Returns the size of the buffer (in bytes) required to hold a YUV image + * plane with the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, + * 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: this is the width + * of the whole image, not the plane width. + * + * @param stride bytes per line in the image plane. + * + * @param height height (in pixels) of the YUV image. NOTE: this is the + * height of the whole image, not the plane height. + * + * @param subsamp the level of chrominance subsampling used in the YUV + * image (one of {@link TJ TJ.SAMP_*}) + * + * @return the size of the buffer (in bytes) required to hold a YUV planar + * image with the given parameters. + */ + public static native int planeSizeYUV(int componentID, int width, int stride, + int height, int subsamp) + throws Exception; + + /** + * Returns the plane width of a YUV image plane with the given parameters. + * Refer to {@link YUVImage YUVImage} for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, + * 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling used in the YUV image + * (one of {@link TJ TJ.SAMP_*}) + * + * @return the plane width of a YUV image plane with the given parameters. + */ + public static native int planeWidth(int componentID, int width, int subsamp) + throws Exception; + + /** + * Returns the plane height of a YUV image plane with the given parameters. + * Refer to {@link YUVImage YUVImage} for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, + * 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling used in the YUV image + * (one of {@link TJ TJ.SAMP_*}) + * + * @return the plane height of a YUV image plane with the given parameters. + */ + public static native int planeHeight(int componentID, int height, + int subsamp) + throws Exception; + /** * Returns a list of fractional scaling factors that the JPEG decompressor in * this implementation of TurboJPEG supports. * * @return a list of fractional scaling factors that the JPEG decompressor in - * this implementation of TurboJPEG supports + * this implementation of TurboJPEG supports. */ public static native TJScalingFactor[] getScalingFactors() throws Exception; diff --git a/java/org/libjpegturbo/turbojpeg/TJCompressor.java b/java/org/libjpegturbo/turbojpeg/TJCompressor.java index 0debf53e..c4a8cc58 100644 --- a/java/org/libjpegturbo/turbojpeg/TJCompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJCompressor.java @@ -332,9 +332,10 @@ public class TJCompressor { throw new Exception("Subsampling level not set"); if (srcYUVImage != null) - compressedSize = compressFromYUV(srcYUVImage.getBuf(), + compressedSize = compressFromYUV(srcYUVImage.getPlanes(), + srcYUVImage.getOffsets(), srcYUVImage.getWidth(), - srcYUVImage.getPad(), + srcYUVImage.getStrides(), srcYUVImage.getHeight(), srcYUVImage.getSubsamp(), dstBuf, jpegQuality, flags); @@ -429,14 +430,14 @@ public class TJCompressor { if (srcBufInt != null) { encodeYUV(srcBufInt, srcX, srcY, srcWidth, srcStride, srcHeight, - srcPixelFormat, dstImage.getBuf(), dstImage.getPad(), - dstImage.getSubsamp(), flags); + srcPixelFormat, dstImage.getPlanes(), dstImage.getOffsets(), + dstImage.getStrides(), dstImage.getSubsamp(), flags); } else { encodeYUV(srcBuf, srcX, srcY, srcWidth, srcPitch, srcHeight, - srcPixelFormat, dstImage.getBuf(), dstImage.getPad(), - dstImage.getSubsamp(), flags); + srcPixelFormat, dstImage.getPlanes(), dstImage.getOffsets(), + dstImage.getStrides(), dstImage.getSubsamp(), flags); } - compressedSize = dstImage.getSize(); + compressedSize = 0; } /** @@ -456,11 +457,11 @@ public class TJCompressor { /** * Encode the uncompressed source image associated with this compressor - * instance into a YUV planar image and return a YUVImage - * instance containing the encoded image. This method uses the accelerated - * color conversion routines in TurboJPEG's underlying codec but does not - * execute any of the other steps in the JPEG compression process. Encoding - * CMYK source images to YUV is not supported. + * instance into a unified YUV planar image buffer and return a + * YUVImage instance containing the encoded image. This method + * uses the accelerated color conversion routines in TurboJPEG's underlying + * codec but does not execute any of the other steps in the JPEG compression + * process. Encoding CMYK source images to YUV is not supported. * * @param pad the width of each line in each plane of the YUV image will be * padded to the nearest multiple of this number of bytes (must be a power of @@ -469,7 +470,7 @@ public class TJCompressor { * @param flags the bitwise OR of one or more of * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * - * @return a YUV planar image + * @return a YUV planar image. */ public YUVImage encodeYUV(int pad, int flags) throws Exception { if (srcWidth < 1 || srcHeight < 1) @@ -483,6 +484,37 @@ public class TJCompressor { return yuvImage; } + /** + * Encode the uncompressed source image associated with this compressor + * instance into separate Y, U (Cb), and V (Cr) image planes and return a + * YUVImage instance containing the encoded image planes. This + * method uses the accelerated color conversion routines in TurboJPEG's + * underlying codec but does not execute any of the other steps in the JPEG + * compression process. Encoding CMYK source images to YUV is not supported. + * + * @param strides an array of integers, each specifying the number of bytes + * per line in the corresponding plane of the output image. Setting the + * stride for any plane to 0 is the same as setting it to the component width + * of the plane. If strides is null, then the strides for all + * planes will be set to their respective component widths. You can adjust + * the strides in order to add an arbitrary amount of line padding to each + * plane. + * + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} + * + * @return a YUV planar image. + */ + public YUVImage encodeYUV(int[] strides, int flags) throws Exception { + if (srcWidth < 1 || srcHeight < 1) + throw new Exception(NO_ASSOC_ERROR); + if (subsamp < 0) + throw new Exception("Subsampling level not set"); + YUVImage yuvImage = new YUVImage(srcWidth, strides, srcHeight, subsamp); + encodeYUV(yuvImage, flags); + return yuvImage; + } + /** * @deprecated Use {@link #encodeYUV(int, int)} instead. */ @@ -512,7 +544,7 @@ public class TJCompressor { /** * @deprecated Use * {@link #setSourceImage(BufferedImage, int, int, int, int)} and - * {@link #encodeYUV(int)} instead. + * {@link #encodeYUV(int, int)} instead. */ @Deprecated public byte[] encodeYUV(BufferedImage srcImage, int flags) throws Exception { @@ -522,10 +554,10 @@ public class TJCompressor { /** * Returns the size of the image (in bytes) generated by the most recent - * compress/encode operation. + * compress operation. * * @return the size of the image (in bytes) generated by the most recent - * compress/encode operation + * compress operation. */ public int getCompressedSize() { return compressedSize; @@ -568,8 +600,9 @@ public class TJCompressor { int stride, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp, int jpegQual, int flags) throws Exception; - private native int compressFromYUV(byte[] srcBuf, int width, int pad, - int height, int subsamp, byte[] dstBuf, int jpegQual, int flags) + private native int compressFromYUV(byte[][] srcPlanes, int[] srcOffsets, + int width, int[] srcStrides, int height, int subsamp, byte[] dstBuf, + int jpegQual, int flags) throws Exception; private native void encodeYUV(byte[] srcBuf, int width, int pitch, @@ -577,16 +610,18 @@ public class TJCompressor { throws Exception; // deprecated private native void encodeYUV(byte[] srcBuf, int x, int y, int width, - int pitch, int height, int pixelFormat, byte[] dstBuf, int pad, - int subsamp, int flags) throws Exception; + int pitch, int height, int pixelFormat, byte[][] dstPlanes, + int[] dstOffsets, int[] dstStrides, int subsamp, int flags) + throws Exception; private native void encodeYUV(int[] srcBuf, int width, int stride, int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags) throws Exception; // deprecated private native void encodeYUV(int[] srcBuf, int x, int y, int width, - int pitch, int height, int pixelFormat, byte[] dstBuf, int pad, - int subsamp, int flags) throws Exception; + int srcStride, int height, int pixelFormat, byte[][] dstPlanes, + int[] dstOffsets, int[] dstStrides, int subsamp, int flags) + throws Exception; static { TJLoader.load(); diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java index c71ce777..1a2774c0 100644 --- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java +++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java @@ -87,18 +87,18 @@ public class TJDecompressor { /** * Associate the JPEG image of length imageSize bytes stored in - * srcImage with this decompressor instance. This image will + * jpegImage with this decompressor instance. This image will * be used as the source image for subsequent decompress operations. * - * @param srcImage JPEG image buffer + * @param jpegImage JPEG image buffer * * @param imageSize size of the JPEG image (in bytes) */ - public void setSourceImage(byte[] srcImage, int imageSize) + public void setSourceImage(byte[] jpegImage, int imageSize) throws Exception { - if (srcImage == null || imageSize < 1) + if (jpegImage == null || imageSize < 1) throw new Exception("Invalid argument in setSourceImage()"); - jpegBuf = srcImage; + jpegBuf = jpegImage; jpegBufSize = imageSize; decompressHeader(jpegBuf, jpegBufSize); yuvImage = null; @@ -134,7 +134,7 @@ public class TJDecompressor { * decompressor instance. * * @return the width of the source image (JPEG or YUV) associated with this - * decompressor instance + * decompressor instance. */ public int getWidth() throws Exception { if (yuvImage != null) @@ -149,7 +149,7 @@ public class TJDecompressor { * decompressor instance. * * @return the height of the source image (JPEG or YUV) associated with this - * decompressor instance + * decompressor instance. */ public int getHeight() throws Exception { if (yuvImage != null) @@ -165,7 +165,7 @@ public class TJDecompressor { * {@link TJ#SAMP_444 TJ.SAMP_*}. * * @return the level of chrominance subsampling used in the source image - * (JPEG or YUV) associated with this decompressor instance + * (JPEG or YUV) associated with this decompressor instance. */ public int getSubsamp() throws Exception { if (yuvImage != null) @@ -183,7 +183,7 @@ public class TJDecompressor { * source image is YUV, then this always returns {@link TJ#CS_YCbCr}. * * @return the colorspace used in the source image (JPEG or YUV) associated - * with this decompressor instance + * with this decompressor instance. */ public int getColorspace() throws Exception { if (yuvImage != null) @@ -196,23 +196,10 @@ public class TJDecompressor { } /** - * Returns the source image buffer associated with this decompressor - * instance. + * Returns the JPEG image buffer associated with this decompressor instance. * - * @return the source image buffer associated with this decompressor instance + * @return the JPEG image buffer associated with this decompressor instance. */ - public byte[] getSourceBuf() throws Exception { - if (yuvImage != null) - return yuvImage.getBuf(); - if (jpegBuf == null) - throw new Exception(NO_ASSOC_ERROR); - return jpegBuf; - } - - /** - * @deprecated Use {@link #getSourceBuf} instead. - */ - @Deprecated public byte[] getJPEGBuf() throws Exception { if (jpegBuf == null) throw new Exception(NO_ASSOC_ERROR); @@ -220,24 +207,12 @@ public class TJDecompressor { } /** - * Returns the size of the source image (in bytes) associated with this + * Returns the size of the JPEG image (in bytes) associated with this * decompressor instance. * - * @return the size of the source image (in bytes) associated with this - * decompressor instance + * @return the size of the JPEG image (in bytes) associated with this + * decompressor instance. */ - public int getSourceSize() throws Exception { - if (yuvImage != null) - return yuvImage.getSize(); - if (jpegBufSize < 1) - throw new Exception(NO_ASSOC_ERROR); - return jpegBufSize; - } - - /** - * @deprecated Use {@link #getSourceSize} instead. - */ - @Deprecated public int getJPEGSize() throws Exception { if (jpegBufSize < 1) throw new Exception(NO_ASSOC_ERROR); @@ -261,7 +236,7 @@ public class TJDecompressor { * * @return the width of the largest scaled-down image that the TurboJPEG * decompressor can generate without exceeding the desired image width and - * height + * height. */ public int getScaledWidth(int desiredWidth, int desiredHeight) throws Exception { @@ -303,7 +278,7 @@ public class TJDecompressor { * * @return the height of the largest scaled-down image that the TurboJPEG * decompressor can generate without exceeding the desired image width and - * height + * height. */ public int getScaledHeight(int desiredWidth, int desiredHeight) throws Exception { @@ -402,9 +377,10 @@ public class TJDecompressor { pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); if (yuvImage != null) - decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), - dstBuf, x, y, yuvImage.getWidth(), pitch, yuvImage.getHeight(), - pixelFormat, flags); + decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(), + yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y, + yuvImage.getWidth(), pitch, yuvImage.getHeight(), pixelFormat, + flags); else { if (x > 0 || y > 0) decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, pitch, @@ -449,7 +425,7 @@ public class TJDecompressor { * @param flags the bitwise OR of one or more of * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * - * @return a buffer containing the decompressed image + * @return a buffer containing the decompressed image. */ public byte[] decompress(int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags) throws Exception { @@ -500,9 +476,9 @@ public class TJDecompressor { if (jpegSubsamp != dstImage.getSubsamp()) throw new Exception("YUVImage subsampling level does not match that of the JPEG image"); - decompressToYUV(jpegBuf, jpegBufSize, dstImage.getBuf(), - dstImage.getWidth(), dstImage.getPad(), - dstImage.getHeight(), flags); + decompressToYUV(jpegBuf, jpegBufSize, dstImage.getPlanes(), + dstImage.getOffsets(), dstImage.getWidth(), + dstImage.getStrides(), dstImage.getHeight(), flags); } /** @@ -517,12 +493,70 @@ public class TJDecompressor { /** * Decompress the JPEG source image associated with this decompressor - * instance into a YUV planar image and return a YUVImage - * instance containing the decompressed image. This method performs JPEG - * decompression but leaves out the color conversion step, so a planar YUV - * image is generated instead of an RGB or grayscale image. This method - * cannot be used to decompress JPEG source images with the CMYK or YCCK - * colorspace. + * instance into a set of Y, U (Cb), and V (Cr) image planes and return a + * YUVImage instance containing the decompressed image planes. + * This method performs JPEG decompression but leaves out the color + * conversion step, so a planar YUV image is generated instead of an RGB or + * grayscale image. This method cannot be used to decompress JPEG source + * images with the CMYK or YCCK colorspace. + * + * @param desiredWidth desired width (in pixels) of the YUV image. If the + * desired image dimensions are different than the dimensions of the JPEG + * image being decompressed, then TurboJPEG will use scaling in the JPEG + * decompressor to generate the largest possible image that will fit within + * the desired dimensions. Setting this to 0 is the same as setting it to + * the width of the JPEG image (in other words, the width will not be + * considered when determining the scaled image size.) + * + * @param strides an array of integers, each specifying the number of bytes + * per line in the corresponding plane of the output image. Setting the + * stride for any plane to 0 is the same as setting it to the scaled + * component width of the plane. If strides is NULL, then the + * strides for all planes will be set to their respective scaled component + * widths. You can adjust the strides in order to add an arbitrary amount of + * line padding to each plane. + * + * @param desiredHeight desired height (in pixels) of the YUV image. If the + * desired image dimensions are different than the dimensions of the JPEG + * image being decompressed, then TurboJPEG will use scaling in the JPEG + * decompressor to generate the largest possible image that will fit within + * the desired dimensions. Setting this to 0 is the same as setting it to + * the height of the JPEG image (in other words, the height will not be + * considered when determining the scaled image size.) + * + * @param flags the bitwise OR of one or more of + * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} + * + * @return a YUV planar image. + */ + public YUVImage decompressToYUV(int desiredWidth, int[] strides, + int desiredHeight, + int flags) throws Exception { + if (flags < 0) + throw new Exception("Invalid argument in decompressToYUV()"); + if (jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0) + throw new Exception(NO_ASSOC_ERROR); + if (jpegSubsamp >= TJ.NUMSAMP) + throw new Exception("JPEG header information is invalid"); + if (yuvImage != null) + throw new Exception("Source image is the wrong type"); + + int scaledWidth = getScaledWidth(desiredWidth, desiredHeight); + int scaledHeight = getScaledHeight(desiredWidth, desiredHeight); + YUVImage yuvImage = new YUVImage(scaledWidth, null, scaledHeight, + jpegSubsamp); + decompressToYUV(yuvImage, flags); + return yuvImage; + } + + /** + * Decompress the JPEG source image associated with this decompressor + * instance into a unified YUV planar image buffer and return a + * YUVImage instance containing the decompressed image. This + * method performs JPEG decompression but leaves out the color conversion + * step, so a planar YUV image is generated instead of an RGB or grayscale + * image. This method cannot be used to decompress JPEG source images with + * the CMYK or YCCK colorspace. * * @param desiredWidth desired width (in pixels) of the YUV image. If the * desired image dimensions are different than the dimensions of the JPEG @@ -547,7 +581,7 @@ public class TJDecompressor { * @param flags the bitwise OR of one or more of * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * - * @return a YUV planar image + * @return a YUV planar image. */ public YUVImage decompressToYUV(int desiredWidth, int pad, int desiredHeight, int flags) throws Exception { @@ -650,9 +684,10 @@ public class TJDecompressor { pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0) throw new Exception("Invalid argument in decompress()"); if (yuvImage != null) - decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), - dstBuf, x, y, yuvImage.getWidth(), stride, - yuvImage.getHeight(), pixelFormat, flags); + decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(), + yuvImage.getStrides(), yuvImage.getSubsamp(), dstBuf, x, y, + yuvImage.getWidth(), stride, yuvImage.getHeight(), pixelFormat, + flags); else decompress(jpegBuf, jpegBufSize, dstBuf, x, y, desiredWidth, stride, desiredHeight, pixelFormat, flags); @@ -734,8 +769,9 @@ public class TJDecompressor { DataBufferInt db = (DataBufferInt)wr.getDataBuffer(); int[] buf = db.getData(); if (yuvImage != null) - decodeYUV(yuvImage.getBuf(), yuvImage.getPad(), yuvImage.getSubsamp(), - buf, 0, 0, yuvImage.getWidth(), stride, yuvImage.getHeight(), + decodeYUV(yuvImage.getPlanes(), yuvImage.getOffsets(), + yuvImage.getStrides(), yuvImage.getSubsamp(), buf, 0, 0, + yuvImage.getWidth(), stride, yuvImage.getHeight(), pixelFormat, flags); else { if (jpegBuf == null) @@ -778,7 +814,7 @@ public class TJDecompressor { * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} * * @return a BufferedImage instance containing the - * decompressed/decoded image + * decompressed/decoded image. */ public BufferedImage decompress(int desiredWidth, int desiredHeight, int bufferedImageType, int flags) @@ -836,16 +872,17 @@ public class TJDecompressor { private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf, int flags) throws Exception; // deprecated - private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf, - int desiredWidth, int pad, int desiredheight, int flags) throws Exception; + private native void decompressToYUV(byte[] srcBuf, int size, + byte[][] dstPlanes, int[] dstOffsets, int desiredWidth, int[] dstStrides, + int desiredheight, int flags) throws Exception; - private native void decodeYUV(byte[] srcBuf, int pad, int subsamp, - byte[] dstBuf, int x, int y, int width, int pitch, int height, - int pixelFormat, int flags) throws Exception; + private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets, + int[] srcStrides, int subsamp, byte[] dstBuf, int x, int y, int width, + int pitch, int height, int pixelFormat, int flags) throws Exception; - private native void decodeYUV(byte[] srcBuf, int pad, int subsamp, - int[] dstBuf, int x, int y, int width, int stride, int height, - int pixelFormat, int flags) throws Exception; + private native void decodeYUV(byte[][] srcPlanes, int[] srcOffsets, + int[] srcStrides, int subsamp, int[] dstBuf, int x, int y, int width, + int stride, int height, int pixelFormat, int flags) throws Exception; static { TJLoader.load(); diff --git a/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java b/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java index 4e7363ff..e00fdf7d 100644 --- a/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java +++ b/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java @@ -42,6 +42,7 @@ public class TJScalingFactor { /** * Returns numerator + * * @return numerator */ public int getNum() { @@ -50,6 +51,7 @@ public class TJScalingFactor { /** * Returns denominator + * * @return denominator */ public int getDenom() { @@ -60,7 +62,8 @@ public class TJScalingFactor { * Returns the scaled value of dimension. This function * performs the integer equivalent of * ceil(dimension * scalingFactor). - * @return the scaled value of dimension + * + * @return the scaled value of dimension. */ public int getScaled(int dimension) { return (dimension * num + denom - 1) / denom; @@ -69,8 +72,9 @@ public class TJScalingFactor { /** * Returns true or false, depending on whether this instance and * other have the same numerator and denominator. + * * @return true or false, depending on whether this instance and - * other have the same numerator and denominator + * other have the same numerator and denominator. */ public boolean equals(TJScalingFactor other) { return (this.num == other.num && this.denom == other.denom); @@ -79,8 +83,9 @@ public class TJScalingFactor { /** * Returns true or false, depending on whether this instance is equal to * 1/1. + * * @return true or false, depending on whether this instance is equal to - * 1/1 + * 1/1. */ public boolean isOne() { return (num == 1 && denom == 1); diff --git a/java/org/libjpegturbo/turbojpeg/TJTransformer.java b/java/org/libjpegturbo/turbojpeg/TJTransformer.java index a62f410b..cf773fae 100644 --- a/java/org/libjpegturbo/turbojpeg/TJTransformer.java +++ b/java/org/libjpegturbo/turbojpeg/TJTransformer.java @@ -111,7 +111,7 @@ public class TJTransformer extends TJDecompressor { * corresponding transformed output image * * @return an array of {@link TJDecompressor} instances, each of - * which has a transformed JPEG image associated with it + * which has a transformed JPEG image associated with it. * * @param flags the bitwise OR of one or more of * {@link TJ#FLAG_BOTTOMUP TJ.FLAG_*} @@ -141,7 +141,7 @@ public class TJTransformer extends TJDecompressor { * generated by the most recent transform operation. * * @return an array containing the sizes of the transformed JPEG images - * generated by the most recent transform operation + * generated by the most recent transform operation. */ public int[] getTransformedSizes() throws Exception { if (transformedSizes == null) diff --git a/java/org/libjpegturbo/turbojpeg/YUVImage.java b/java/org/libjpegturbo/turbojpeg/YUVImage.java index 27b1b70c..2d790e93 100644 --- a/java/org/libjpegturbo/turbojpeg/YUVImage.java +++ b/java/org/libjpegturbo/turbojpeg/YUVImage.java @@ -43,20 +43,18 @@ package org.libjpegturbo.turbojpeg; * image format consisting of Y, Cb, and Cr image planes. *

    * Each plane is simply a 2D array of bytes, each byte representing the value - * of one of the components at a particular location in the image. The - * "component width" and "component height" of each plane are determined by the - * image width, height, and level of chrominance subsampling. For the - * luminance plane, the component width is the image width padded to the - * nearest multiple of the horizontal subsampling factor (2 in the case of - * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or - * grayscale.) Similarly, the component height of the luminance plane is the - * image height padded to the nearest multiple of the vertical subsampling - * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or - * grayscale.) The component width of the chrominance planes is equal to the - * component width of the luminance plane divided by the horizontal subsampling - * factor, and the component height of the chrominance planes is equal to the - * component height of the luminance plane divided by the vertical subsampling - * factor. + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of + * 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane + * height is the image height padded to the nearest multiple of the vertical + * subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 + * or grayscale.) The chrominance plane width is equal to the luminance plane + * width divided by the horizontal subsampling factor, and the chrominance + * plane height is equal to the luminance plane height divided by the vertical + * subsampling factor. *

    * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is * used, then the luminance plane would be 36 x 35 bytes, and each of the @@ -67,10 +65,35 @@ package org.libjpegturbo.turbojpeg; public class YUVImage { private static final String NO_ASSOC_ERROR = - "No YUV buffer is associated with this instance"; + "No image data is associated with this instance"; /** - * Create a YUVImage instance with a new image buffer. + * Create a new YUVImage instance backed by separate image + * planes, and allocate memory for the image planes. + * + * @param width width (in pixels) of the YUV image + * + * @param strides an array of integers, each specifying the number of bytes + * per line in the corresponding plane of the YUV image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * {@link YUVImage above}.) If strides is null, then the + * strides for all planes will be set to their respective plane widths. When + * using this constructor, the stride for each plane must be equal to or + * greater than the plane width. + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp the level of chrominance subsampling to be used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public YUVImage(int width, int[] strides, int height, int subsamp) + throws Exception { + setBuf(null, null, width, strides, height, subsamp, true); + } + + /** + * Create a new YUVImage instance backed by a unified image + * buffer, and allocate memory for the image buffer. * * @param width width (in pixels) of the YUV image * @@ -83,13 +106,52 @@ public class YUVImage { * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) */ public YUVImage(int width, int pad, int height, int subsamp) - throws Exception { + throws Exception { setBuf(new byte[TJ.bufSizeYUV(width, pad, height, subsamp)], width, pad, height, subsamp); } /** - * Create a YUVImage instance from an existing YUV planar image + * Create a new YUVImage instance from a set of existing image + * planes. + * + * @param planes an array of buffers representing the Y, U (Cb), and V (Cr) + * image planes (or just the Y plane, if the image is grayscale.) These + * planes can be contiguous or non-contiguous in memory. Plane + * i should be at least offsets[i] + + * {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp) + * bytes in size. + * + * @param offsets If this YUVImage instance represents a + * subregion of a larger image, then offsets[i] specifies the + * offset (in bytes) of the subregion within plane i of the + * larger image. Setting this to null is the same as setting the offsets for + * all planes to 0. + * + * @param width width (in pixels) of the new YUV image (or subregion) + * + * @param strides an array of integers, each specifying the number of bytes + * per line in the corresponding plane of the YUV image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * {@link YUVImage above}.) If strides is null, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to add an arbitrary amount of line padding + * to each plane or to specify that this YUVImage instance is a + * subregion of a larger image (in which case, strides[i] should + * be set to the plane width of plane i in the larger image.) + * + * @param height height (in pixels) of the new YUV image (or subregion) + * + * @param subsamp the level of chrominance subsampling used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public YUVImage(byte[][] planes, int[] offsets, int width, int[] strides, + int height, int subsamp) throws Exception { + setBuf(planes, offsets, width, strides, height, subsamp, false); + } + + /** + * Create a new YUVImage instance from an existing unified image * buffer. * * @param yuvImage image buffer that contains or will contain YUV planar @@ -115,8 +177,89 @@ public class YUVImage { } /** - * Assign an existing YUV planar image buffer to this YUVImage - * instance. + * Assign a set of image planes to this YUVImage instance. + * + * @param planes an array of buffers representing the Y, U (Cb), and V (Cr) + * image planes (or just the Y plane, if the image is grayscale.) These + * planes can be contiguous or non-contiguous in memory. Plane + * i should be at least offsets[i] + + * {@link TJ#planeSizeYUV TJ.planeSizeYUV}(i, width, strides[i], height, subsamp) + * bytes in size. + * + * @param offsets If this YUVImage instance represents a + * subregion of a larger image, then offsets[i] specifies the + * offset (in bytes) of the subregion within plane i of the + * larger image. Setting this to null is the same as setting the offsets for + * all planes to 0. + * + * @param width width (in pixels) of the YUV image (or subregion) + * + * @param strides an array of integers, each specifying the number of bytes + * per line in the corresponding plane of the YUV image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * {@link YUVImage above}.) If strides is null, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to add an arbitrary amount of line padding + * to each plane or to specify that this YUVImage image is a + * subregion of a larger image (in which case, strides[i] should + * be set to the plane width of plane i in the larger image.) + * + * @param height height (in pixels) of the YUV image (or subregion) + * + * @param subsamp the level of chrominance subsampling used in the YUV + * image (one of {@link TJ#SAMP_444 TJ.SAMP_*}) + */ + public void setBuf(byte[][] planes, int[] offsets, int width, int strides[], + int height, int subsamp) throws Exception { + setBuf(planes, offsets, width, strides, height, subsamp, false); + } + + private void setBuf(byte[][] planes, int[] offsets, int width, int strides[], + int height, int subsamp, boolean alloc) throws Exception { + if ((planes == null && !alloc) || width < 1 || height < 1 || subsamp < 0 || + subsamp >= TJ.NUMSAMP) + throw new Exception("Invalid argument in YUVImage::setBuf()"); + + int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3); + if (planes.length != nc || (offsets != null && offsets.length != nc) || + (strides != null && strides.length != nc)) + throw new Exception("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size"); + + if (offsets == null) + offsets = new int[nc]; + if (strides == null) + strides = new int[nc]; + + for (int i = 0; i < nc; i++) { + int pw = TJ.planeWidth(i, width, subsamp); + int ph = TJ.planeHeight(i, height, subsamp); + int planeSize = TJ.planeSizeYUV(i, width, strides[i], height, subsamp); + + if (strides[i] == 0) + strides[i] = pw; + if (alloc) { + if (strides[i] < pw) + throw new Exception("Stride must be >= plane width when allocating a new YUV image"); + planes[i] = new byte[strides[i] * ph]; + } + if (planes[i] == null || offsets[i] < 0) + throw new Exception("Invalid argument in YUVImage::setBuf()"); + if (strides[i] < 0 && offsets[i] - planeSize + pw < 0) + throw new Exception("Stride for plane " + i + " would cause memory to be accessed below plane boundary"); + if (planes[i].length < offsets[i] + planeSize) + throw new Exception("Image plane " + i + " is not large enough"); + } + + yuvPlanes = planes; + yuvOffsets = offsets; + yuvWidth = width; + yuvStrides = strides; + yuvHeight = height; + yuvSubsamp = subsamp; + } + + /** + * Assign a unified image buffer to this YUVImage instance. * * @param yuvImage image buffer that contains or will contain YUV planar * image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for @@ -139,20 +282,34 @@ public class YUVImage { int subsamp) throws Exception { if (yuvImage == null || width < 1 || pad < 1 || ((pad & (pad - 1)) != 0) || height < 1 || subsamp < 0 || subsamp >= TJ.NUMSAMP) - throw new Exception("Invalid argument in YUVImage()"); + throw new Exception("Invalid argument in YUVImage::setBuf()"); if (yuvImage.length < TJ.bufSizeYUV(width, pad, height, subsamp)) throw new Exception("YUV image buffer is not large enough"); - yuvBuf = yuvImage; - yuvWidth = width; + + int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3); + byte[][] planes = new byte[nc][]; + int[] strides = new int[nc]; + int[] offsets = new int[nc]; + + planes[0] = yuvImage; + strides[0] = PAD(TJ.planeWidth(0, width, subsamp), pad); + if (subsamp != TJ.SAMP_GRAY) { + strides[1] = strides[2] = PAD(TJ.planeWidth(1, width, subsamp), pad); + planes[1] = planes[2] = yuvImage; + offsets[1] = offsets[0] + + strides[0] * TJ.planeHeight(0, height, subsamp); + offsets[2] = offsets[1] + + strides[1] * TJ.planeHeight(1, height, subsamp); + } + yuvPad = pad; - yuvHeight = height; - yuvSubsamp = subsamp; + setBuf(planes, offsets, width, strides, height, subsamp); } /** - * Returns the width of the YUV image. + * Returns the width of the YUV image (or subregion.) * - * @return the width of the YUV image + * @return the width of the YUV image (or subregion) */ public int getWidth() throws Exception { if (yuvWidth < 1) @@ -161,9 +318,9 @@ public class YUVImage { } /** - * Returns the height of the YUV image. + * Returns the height of the YUV image (or subregion.) * - * @return the height of the YUV image + * @return the height of the YUV image (or subregion) */ public int getHeight() throws Exception { if (yuvHeight < 1) @@ -172,16 +329,43 @@ public class YUVImage { } /** - * Returns the line padding used in the YUV image buffer. + * Returns the line padding used in the YUV image buffer (if this image is + * stored in a unified buffer rather than separate image planes.) * * @return the line padding used in the YUV image buffer */ public int getPad() throws Exception { - if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0)) + if (yuvPlanes == null) throw new Exception(NO_ASSOC_ERROR); + if (yuvPad < 1 || ((yuvPad & (yuvPad - 1)) != 0)) + throw new Exception("Image is not stored in a unified buffer"); return yuvPad; } + /** + * Returns the number of bytes per line of each plane in the YUV image. + * + * @return the number of bytes per line of each plane in the YUV image + */ + public int[] getStrides() throws Exception { + if (yuvStrides == null) + throw new Exception(NO_ASSOC_ERROR); + return yuvStrides; + } + + /** + * Returns the offsets (in bytes) of each plane within the planes of a larger + * YUV image. + * + * @return the offsets (in bytes) of each plane within the planes of a larger + * YUV image + */ + public int[] getOffsets() throws Exception { + if (yuvOffsets == null) + throw new Exception(NO_ASSOC_ERROR); + return yuvOffsets; + } + /** * Returns the level of chrominance subsampling used in the YUV image. See * {@link TJ#SAMP_444 TJ.SAMP_*}. @@ -195,29 +379,61 @@ public class YUVImage { } /** - * Returns the YUV image buffer + * Returns the YUV image planes. If the image is stored in a unified buffer, + * then all image planes will point to that buffer. + * + * @return the YUV image planes + */ + public byte[][] getPlanes() throws Exception { + if (yuvPlanes == null) + throw new Exception(NO_ASSOC_ERROR); + return yuvPlanes; + } + + /** + * Returns the YUV image buffer (if this image is stored in a unified + * buffer rather than separate image planes.) * * @return the YUV image buffer */ public byte[] getBuf() throws Exception { - if (yuvBuf == null) + if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP) throw new Exception(NO_ASSOC_ERROR); - return yuvBuf; + int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3); + for (int i = 1; i < nc; i++) { + if (yuvPlanes[i] != yuvPlanes[0]) + throw new Exception("Image is not stored in a unified buffer"); + } + return yuvPlanes[0]; } /** - * Returns the size (in bytes) of the YUV image buffer + * Returns the size (in bytes) of the YUV image buffer (if this image is + * stored in a unified buffer rather than separate image planes.) * * @return the size (in bytes) of the YUV image buffer */ - public int getSize() throws Exception { - if (yuvBuf == null) - throw new Exception(NO_ASSOC_ERROR); - return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp); - } + public int getSize() throws Exception { + if (yuvPlanes == null || yuvSubsamp < 0 || yuvSubsamp >= TJ.NUMSAMP) + throw new Exception(NO_ASSOC_ERROR); + int nc = (yuvSubsamp == TJ.SAMP_GRAY ? 1 : 3); + if (yuvPad < 1) + throw new Exception("Image is not stored in a unified buffer"); + for (int i = 1; i < nc; i++) { + if (yuvPlanes[i] != yuvPlanes[0]) + throw new Exception("Image is not stored in a unified buffer"); + } + return TJ.bufSizeYUV(yuvWidth, yuvPad, yuvHeight, yuvSubsamp); + } + + private static final int PAD(int v, int p) { + return (v + p - 1) & (~(p - 1)); + } protected long handle = 0; - protected byte[] yuvBuf = null; + protected byte[][] yuvPlanes = null; + protected int[] yuvOffsets = null; + protected int[] yuvStrides = null; protected int yuvPad = 0; protected int yuvWidth = 0; protected int yuvHeight = 0; diff --git a/java/org_libjpegturbo_turbojpeg_TJ.h b/java/org_libjpegturbo_turbojpeg_TJ.h index b00a128a..84ee8711 100644 --- a/java/org_libjpegturbo_turbojpeg_TJ.h +++ b/java/org_libjpegturbo_turbojpeg_TJ.h @@ -91,6 +91,30 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III (JNIEnv *, jclass, jint, jint, jint); +/* + * Class: org_libjpegturbo_turbojpeg_TJ + * Method: planeSizeYUV + * Signature: (IIIII)I + */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII + (JNIEnv *, jclass, jint, jint, jint, jint, jint); + +/* + * Class: org_libjpegturbo_turbojpeg_TJ + * Method: planeWidth + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: org_libjpegturbo_turbojpeg_TJ + * Method: planeHeight + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III + (JNIEnv *, jclass, jint, jint, jint); + /* * Class: org_libjpegturbo_turbojpeg_TJ * Method: getScalingFactors diff --git a/java/org_libjpegturbo_turbojpeg_TJCompressor.h b/java/org_libjpegturbo_turbojpeg_TJCompressor.h index edb23b4d..e76bd0ef 100644 --- a/java/org_libjpegturbo_turbojpeg_TJCompressor.h +++ b/java/org_libjpegturbo_turbojpeg_TJCompressor.h @@ -58,10 +58,10 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 /* * Class: org_libjpegturbo_turbojpeg_TJCompressor * Method: compressFromYUV - * Signature: ([BIIII[BII)I + * Signature: ([[B[II[III[BII)I */ -JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII - (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint); +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII + (JNIEnv *, jobject, jobjectArray, jintArray, jint, jintArray, jint, jint, jbyteArray, jint, jint); /* * Class: org_libjpegturbo_turbojpeg_TJCompressor @@ -74,10 +74,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ /* * Class: org_libjpegturbo_turbojpeg_TJCompressor * Method: encodeYUV - * Signature: ([BIIIIII[BIII)V + * Signature: ([BIIIIII[[B[I[III)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII - (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III + (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint); /* * Class: org_libjpegturbo_turbojpeg_TJCompressor @@ -90,10 +90,10 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ /* * Class: org_libjpegturbo_turbojpeg_TJCompressor * Method: encodeYUV - * Signature: ([IIIIIII[BIII)V + * Signature: ([IIIIIII[[B[I[III)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII - (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III + (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint); #ifdef __cplusplus } diff --git a/java/org_libjpegturbo_turbojpeg_TJDecompressor.h b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h index 1d8205c5..2d58e735 100644 --- a/java/org_libjpegturbo_turbojpeg_TJDecompressor.h +++ b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h @@ -74,26 +74,26 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress /* * Class: org_libjpegturbo_turbojpeg_TJDecompressor * Method: decompressToYUV - * Signature: ([BI[BIIII)V + * Signature: ([BI[[B[II[III)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII - (JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III + (JNIEnv *, jobject, jbyteArray, jint, jobjectArray, jintArray, jint, jintArray, jint, jint); /* * Class: org_libjpegturbo_turbojpeg_TJDecompressor * Method: decodeYUV - * Signature: ([BII[BIIIIIII)V + * Signature: ([[B[I[II[BIIIIIII)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII - (JNIEnv *, jobject, jbyteArray, jint, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII + (JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint); /* * Class: org_libjpegturbo_turbojpeg_TJDecompressor * Method: decodeYUV - * Signature: ([BII[IIIIIIII)V + * Signature: ([[B[I[II[IIIIIIII)V */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII - (JNIEnv *, jobject, jbyteArray, jint, jint, jintArray, jint, jint, jint, jint, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII + (JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jintArray, jint, jint, jint, jint, jint, jint, jint); #ifdef __cplusplus } diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index f872cf00..cab57bdf 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -37,6 +37,8 @@ #include "java/org_libjpegturbo_turbojpeg_TJDecompressor.h" #include "java/org_libjpegturbo_turbojpeg_TJ.h" +#define PAD(v, p) ((v+(p)-1)&(~((p)-1))) + #define _throw(msg) { \ jclass _exccls=(*env)->FindClass(env, "java/lang/Exception"); \ if(!_exccls) goto bailout; \ @@ -87,6 +89,41 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III 4, height, subsamp); } +/* TurboJPEG 1.4.x: TJ::planeSizeYUV() */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII + (JNIEnv *env, jclass cls, jint componentID, jint width, jint stride, + jint height, jint subsamp) +{ + jint retval=(jint)tjPlaneSizeYUV(componentID, width, stride, height, + subsamp); + if(retval==-1) _throw(tjGetErrorStr()); + + bailout: + return retval; +} + +/* TurboJPEG 1.4.x: TJ::planeWidth() */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III + (JNIEnv *env, jclass cls, jint componentID, jint width, jint subsamp) +{ + jint retval=(jint)tjPlaneWidth(componentID, width, subsamp); + if(retval==-1) _throw(tjGetErrorStr()); + + bailout: + return retval; +} + +/* TurboJPEG 1.4.x: TJ::planeHeight() */ +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III + (JNIEnv *env, jclass cls, jint componentID, jint height, jint subsamp) +{ + jint retval=(jint)tjPlaneHeight(componentID, height, subsamp); + if(retval==-1) _throw(tjGetErrorStr()); + + bailout: + return retval; +} + /* TurboJPEG 1.2.x: TJCompressor::init() */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init (JNIEnv *env, jobject obj) @@ -203,44 +240,192 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 } /* TurboJPEG 1.4.x: TJCompressor::compressFromYUV() */ -JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII - (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pad, jint height, - jint subsamp, jbyteArray dst, jint jpegQual, jint flags) +JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII + (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets, + jint width, jintArray jSrcStrides, jint height, jint subsamp, + jbyteArray dst, jint jpegQual, jint flags) { tjhandle handle=0; unsigned long jpegSize=0; - jsize arraySize=0; - unsigned char *srcBuf=NULL, *jpegBuf=NULL; + jbyteArray jSrcPlanes[3]={NULL, NULL, NULL}; + unsigned char *srcPlanes[3], *jpegBuf=NULL; + int *srcOffsets=NULL, *srcStrides=NULL; + int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i; gethandle(); - arraySize=tjBufSizeYUV2(width, pad, height, subsamp); - if((*env)->GetArrayLength(env, src)=org_libjpegturbo_turbojpeg_TJ_NUMSAMP) + _throw("Invalid argument in compressFromYUV()"); + if(org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP) + _throw("Mismatch between Java and C API"); + + if((*env)->GetArrayLength(env, srcobjs)GetArrayLength(env, jSrcOffsets)GetArrayLength(env, jSrcStrides)GetArrayLength(env, dst)<(jsize)jpegSize) _throw("Destination buffer is not large enough"); - bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); + bailif0(srcOffsets=(*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0)); + bailif0(srcStrides=(*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0)); + for(i=0; iGetObjectArrayElement(env, srcobjs, i)); + if((*env)->GetArrayLength(env, jSrcPlanes[i])GetPrimitiveArrayCritical(env, jSrcPlanes[i], + 0)); + srcPlanes[i]=&srcPlanes[i][srcOffsets[i]]; + } bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - if(tjCompressFromYUV(handle, srcBuf, width, pad, height, subsamp, &jpegBuf, - &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1) + if(tjCompressFromYUVPlanes(handle, srcPlanes, width, srcStrides, height, + subsamp, &jpegBuf, &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1) _throw(tjGetErrorStr()); bailout: if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0); - if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + for(i=0; iReleasePrimitiveArrayCritical(env, jSrcPlanes[i], srcPlanes[i], + 0); + } + if(srcStrides) + (*env)->ReleasePrimitiveArrayCritical(env, jSrcStrides, srcStrides, 0); + if(srcOffsets) + (*env)->ReleasePrimitiveArrayCritical(env, jSrcOffsets, srcOffsets, 0); return (jint)jpegSize; } static void TJCompressor_encodeYUV (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, - jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint pad, - jint subsamp, jint flags) + jint width, jint pitch, jint height, jint pf, jobjectArray dstobjs, + jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags) { tjhandle handle=0; - jsize arraySize=0, actualPitch, yuvSize; + jsize arraySize=0, actualPitch; + jbyteArray jDstPlanes[3]={NULL, NULL, NULL}; + unsigned char *srcBuf=NULL, *dstPlanes[3]; + int *dstOffsets=NULL, *dstStrides=NULL; + int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i; + + gethandle(); + + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1 + || pitch<0 || subsamp<0 || subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP) + _throw("Invalid argument in encodeYUV()"); + if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF + || org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP) + _throw("Mismatch between Java and C API"); + + if((*env)->GetArrayLength(env, dstobjs)GetArrayLength(env, jDstOffsets)GetArrayLength(env, jDstStrides)GetArrayLength(env, src)*srcElementSizeGetPrimitiveArrayCritical(env, jDstOffsets, 0)); + bailif0(dstStrides=(*env)->GetPrimitiveArrayCritical(env, jDstStrides, 0)); + for(i=0; iGetObjectArrayElement(env, dstobjs, i)); + if((*env)->GetArrayLength(env, jDstPlanes[i])GetPrimitiveArrayCritical(env, jDstPlanes[i], + 0)); + dstPlanes[i]=&dstPlanes[i][dstOffsets[i]]; + } + bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); + + if(tjEncodeYUVPlanes(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], + width, pitch, height, pf, dstPlanes, dstStrides, subsamp, flags)==-1) + _throw(tjGetErrorStr()); + + bailout: + if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + for(i=0; iReleasePrimitiveArrayCritical(env, jDstPlanes[i], dstPlanes[i], + 0); + } + if(dstStrides) + (*env)->ReleasePrimitiveArrayCritical(env, jDstStrides, dstStrides, 0); + if(dstOffsets) + (*env)->ReleasePrimitiveArrayCritical(env, jDstOffsets, dstOffsets, 0); + return; +} + +/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() byte source */ +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III + (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, + jint pitch, jint height, jint pf, jobjectArray dstobjs, + jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags) +{ + TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf, + dstobjs, jDstOffsets, jDstStrides, subsamp, flags); +} + +/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() int source */ +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III + (JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width, + jint stride, jint height, jint pf, jobjectArray dstobjs, + jintArray jDstOffsets, jintArray jDstStrides, jint subsamp, jint flags) +{ + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + _throw("Invalid argument in encodeYUV()"); + if(tjPixelSize[pf]!=sizeof(jint)) + _throw("Pixel format must be 32-bit when encoding from an integer buffer."); + + TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width, + stride*sizeof(jint), height, pf, dstobjs, jDstOffsets, jDstStrides, + subsamp, flags); + + bailout: + return; +} + +JNIEXPORT void JNICALL TJCompressor_encodeYUV_12 + (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint width, + jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) +{ + tjhandle handle=0; + jsize arraySize=0; unsigned char *srcBuf=NULL, *dstBuf=NULL; gethandle(); @@ -251,21 +436,18 @@ static void TJCompressor_encodeYUV if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) _throw("Mismatch between Java and C API"); - actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch; - arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf]; + arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height; if((*env)->GetArrayLength(env, src)*srcElementSizeGetArrayLength(env, dst)GetArrayLength(env, dst) + <(jsize)tjBufSizeYUV(width, height, subsamp)) _throw("Destination buffer is not large enough"); bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - if(tjEncodeYUV3(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width, - pitch, height, pf, dstBuf, pad, subsamp, flags)==-1) + if(tjEncodeYUV2(handle, srcBuf, width, pitch, height, pf, dstBuf, subsamp, + flags)==-1) _throw(tjGetErrorStr()); bailout: @@ -274,41 +456,13 @@ static void TJCompressor_encodeYUV return; } -/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() byte source */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII - (JNIEnv *env, jobject obj, jbyteArray src, jint x, jint y, jint width, - jint pitch, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, - jint flags) -{ - TJCompressor_encodeYUV(env, obj, src, 1, x, y, width, pitch, height, pf, dst, - pad, subsamp, flags); -} - /* TurboJPEG 1.2.x: TJCompressor::encodeYUV() byte source */ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { - TJCompressor_encodeYUV(env, obj, src, 1, 0, 0, width, pitch, height, pf, dst, - 4, subsamp, flags); -} - -/* TurboJPEG 1.4.x: TJCompressor::encodeYUV() int source */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII - (JNIEnv *env, jobject obj, jintArray src, jint x, jint y, jint width, - jint stride, jint height, jint pf, jbyteArray dst, jint pad, jint subsamp, - jint flags) -{ - if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) - _throw("Invalid argument in encodeYUV()"); - if(tjPixelSize[pf]!=sizeof(jint)) - _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - - TJCompressor_encodeYUV(env, obj, src, sizeof(jint), x, y, width, - stride*sizeof(jint), height, pf, dst, pad, subsamp, flags); - - bailout: - return; + TJCompressor_encodeYUV_12(env, obj, src, 1, width, pitch, height, pf, dst, + subsamp, flags); } /* TurboJPEG 1.2.x: TJCompressor::encodeYUV() int source */ @@ -321,8 +475,8 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___ if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when encoding from an integer buffer."); - TJCompressor_encodeYUV(env, obj, src, sizeof(jint), 0, 0, width, - stride*sizeof(jint), height, pf, dst, 4, subsamp, flags); + TJCompressor_encodeYUV_12(env, obj, src, sizeof(jint), width, + stride*sizeof(jint), height, pf, dst, subsamp, flags); bailout: return; @@ -518,14 +672,19 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress } /* TurboJPEG 1.4.x: TJDecompressor::decompressToYUV() */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII - (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, - jint desiredWidth, jint pad, jint desiredHeight, jint flags) +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III + (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, + jobjectArray dstobjs, jintArray jDstOffsets, jint desiredWidth, + jintArray jDstStrides, jint desiredHeight, jint flags) { tjhandle handle=0; - unsigned char *jpegBuf=NULL, *dstBuf=NULL; + jbyteArray jDstPlanes[3]={NULL, NULL, NULL}; + unsigned char *jpegBuf=NULL, *dstPlanes[3]; + int *dstOffsets=NULL, *dstStrides=NULL; int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0; - jsize yuvSize; + int nc=0, i, width, height, scaledWidth, scaledHeight, nsf=0; + tjscalingfactor *sf; + gethandle(); @@ -538,22 +697,64 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); - yuvSize=(jsize)tjBufSizeYUV2(desiredWidth==0? jpegWidth:desiredWidth, - pad, desiredHeight==0? jpegHeight:desiredHeight, jpegSubsamp); - if(yuvSize==(unsigned long)-1) - _throw(tjGetErrorStr()); - if((*env)->GetArrayLength(env, dst)GetPrimitiveArrayCritical(env, src, 0)); - bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + nc=(jpegSubsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3); - if(tjDecompressToYUV2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, - desiredWidth, pad, desiredHeight, flags)==-1) + width=desiredWidth; height=desiredHeight; + if(width==0) width=jpegWidth; + if(height==0) height=jpegHeight; + sf=tjGetScalingFactors(&nsf); + if(!sf || nsf<1) + _throw(tjGetErrorStr()); + for(i=0; iGetPrimitiveArrayCritical(env, jDstOffsets, 0)); + bailif0(dstStrides=(*env)->GetPrimitiveArrayCritical(env, jDstStrides, 0)); + for(i=0; iGetObjectArrayElement(env, dstobjs, i)); + if((*env)->GetArrayLength(env, jDstPlanes[i])GetPrimitiveArrayCritical(env, jDstPlanes[i], + 0)); + dstPlanes[i]=&dstPlanes[i][dstOffsets[i]]; + } + bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); + + if(tjDecompressToYUVPlanes(handle, jpegBuf, (unsigned long)jpegSize, + dstPlanes, desiredWidth, dstStrides, desiredHeight, flags)==-1) _throw(tjGetErrorStr()); bailout: - if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); + for(i=0; iReleasePrimitiveArrayCritical(env, jDstPlanes[i], dstPlanes[i], + 0); + } + if(dstStrides) + (*env)->ReleasePrimitiveArrayCritical(env, jDstStrides, dstStrides, 0); + if(dstOffsets) + (*env)->ReleasePrimitiveArrayCritical(env, jDstOffsets, dstOffsets, 0); return; } @@ -561,72 +762,140 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst, jint flags) -{ - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII( - env, obj, src, jpegSize, dst, 0, 4, 0, flags); -} - -static void TJDecompressor_decodeYUV - (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, - jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch, - jint height, jint pf, jint flags) { tjhandle handle=0; - jsize arraySize=0, actualPitch; - unsigned char *srcBuf=NULL, *dstBuf=NULL; + unsigned char *jpegBuf=NULL, *dstBuf=NULL; + int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0; gethandle(); - if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) + if((*env)->GetArrayLength(env, src)GetFieldID(env, _cls, "jpegSubsamp", "I")); + jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I")); + jpegWidth=(int)(*env)->GetIntField(env, obj, _fid); + bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I")); + jpegHeight=(int)(*env)->GetIntField(env, obj, _fid); + if((*env)->GetArrayLength(env, dst) + <(jsize)tjBufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)) + _throw("Destination buffer is not large enough"); + + bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); + bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + + if(tjDecompressToYUV(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, + flags)==-1) + _throw(tjGetErrorStr()); + + bailout: + if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); + if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); + return; +} + +static void TJDecompressor_decodeYUV + (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets, + jintArray jSrcStrides, jint subsamp, jarray dst, jint dstElementSize, + jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) +{ + tjhandle handle=0; + jsize arraySize=0, actualPitch; + jbyteArray jSrcPlanes[3]={NULL, NULL, NULL}; + unsigned char *srcPlanes[3], *dstBuf=NULL; + int *srcOffsets=NULL, *srcStrides=NULL; + int nc=(subsamp==org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY? 1:3), i; + + gethandle(); + + if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || subsamp<0 + || subsamp>=org_libjpegturbo_turbojpeg_TJ_NUMSAMP) _throw("Invalid argument in decodeYUV()"); - if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF) + if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF + || org_libjpegturbo_turbojpeg_TJ_NUMSAMP!=TJ_NUMSAMP) _throw("Mismatch between Java and C API"); - arraySize=tjBufSizeYUV2(width, pad, height, subsamp); - if((*env)->GetArrayLength(env, src)GetArrayLength(env, srcobjs)GetArrayLength(env, jSrcOffsets)GetArrayLength(env, jSrcStrides)GetArrayLength(env, dst)*dstElementSizeGetPrimitiveArrayCritical(env, src, 0)); + bailif0(srcOffsets=(*env)->GetPrimitiveArrayCritical(env, jSrcOffsets, 0)); + bailif0(srcStrides=(*env)->GetPrimitiveArrayCritical(env, jSrcStrides, 0)); + for(i=0; iGetObjectArrayElement(env, srcobjs, i)); + if((*env)->GetArrayLength(env, jSrcPlanes[i])GetPrimitiveArrayCritical(env, jSrcPlanes[i], + 0)); + srcPlanes[i]=&srcPlanes[i][srcOffsets[i]]; + } bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); - if(tjDecodeYUV(handle, srcBuf, pad, subsamp, + if(tjDecodeYUVPlanes(handle, srcPlanes, srcStrides, subsamp, &dstBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, flags)==-1) _throw(tjGetErrorStr()); bailout: if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0); - if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0); + for(i=0; iReleasePrimitiveArrayCritical(env, jSrcPlanes[i], srcPlanes[i], + 0); + } + if(srcStrides) + (*env)->ReleasePrimitiveArrayCritical(env, jSrcStrides, srcStrides, 0); + if(srcOffsets) + (*env)->ReleasePrimitiveArrayCritical(env, jSrcOffsets, srcOffsets, 0); return; } /* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() byte destination */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII - (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, - jbyteArray dst, jint x, jint y, jint width, jint pitch, jint height, - jint pf, jint flags) +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII + (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets, + jintArray jSrcStrides, jint subsamp, jbyteArray dst, jint x, jint y, + jint width, jint pitch, jint height, jint pf, jint flags) { - TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, 1, x, y, width, - pitch, height, pf, flags); + TJDecompressor_decodeYUV(env, obj, srcobjs, jSrcOffsets, jSrcStrides, + subsamp, dst, 1, x, y, width, pitch, height, pf, flags); } /* TurboJPEG 1.4.x: TJDecompressor::decodeYUV() int destination */ -JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII - (JNIEnv *env, jobject obj, jbyteArray src, jint pad, jint subsamp, - jintArray dst, jint x, jint y, jint width, jint stride, jint height, - jint pf, jint flags) +JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII + (JNIEnv *env, jobject obj, jobjectArray srcobjs, jintArray jSrcOffsets, + jintArray jSrcStrides, jint subsamp, jintArray dst, jint x, jint y, + jint width, jint stride, jint height, jint pf, jint flags) { if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF) _throw("Invalid argument in decodeYUV()"); if(tjPixelSize[pf]!=sizeof(jint)) _throw("Pixel format must be 32-bit when decoding to an integer buffer."); - TJDecompressor_decodeYUV(env, obj, src, pad, subsamp, dst, sizeof(jint), x, - y, width, stride*sizeof(jint), height, pf, flags); + TJDecompressor_decodeYUV(env, obj, srcobjs, jSrcOffsets, jSrcStrides, + subsamp, dst, sizeof(jint), x, y, width, stride*sizeof(jint), height, pf, + flags); bailout: return; diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni index 31c8ae08..3370d1f2 100755 --- a/turbojpeg-mapfile.jni +++ b/turbojpeg-mapfile.jni @@ -77,10 +77,13 @@ TURBOJPEG_1.4 tjEncodeYUV3; tjEncodeYUVPlanes; Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII; - Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3BIIII_3BII; - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3BIII; - Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3BIII; - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BIIII; - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3BIIIIIII; - Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3BII_3IIIIIIII; + Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII; + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III; + Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII; + Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII; + Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III; + Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII; + Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III; } TURBOJPEG_1.3; diff --git a/turbojpeg.c b/turbojpeg.c index 926f633a..0daa86ab 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -579,15 +579,19 @@ DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height) DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, int subsamp) { - unsigned long retval=0; - int pw, ph, cw, ch; - if(width<1 || height<1 || pad<1 || !isPow2(pad) || subsamp<0 - || subsamp>=NUMSUBOPT) + int retval=0, nc, i; + + if(subsamp<0 || subsamp>=NUMSUBOPT) _throw("tjBufSizeYUV2(): Invalid argument"); - pw=PAD(width, tjMCUWidth[subsamp]/8); - ph=PAD(height, tjMCUHeight[subsamp]/8); - cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; - retval=PAD(pw, pad)*ph + (subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)*ch*2); + + nc=(subsamp==TJSAMP_GRAY? 1:3); + for(i=0; i=TJ_NUMSAMP) + _throw("tjPlaneWidth(): Invalid argument"); + nc=(subsamp==TJSAMP_GRAY? 1:3); + if(componentID<0 || componentID>=nc) + _throw("tjPlaneWidth(): Invalid argument"); + + pw=PAD(width, tjMCUWidth[subsamp]/8); + if(componentID==0) + retval=pw; + else + retval=pw*8/tjMCUWidth[subsamp]; + + bailout: + return retval; +} + + +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp) +{ + int ph, nc, retval=0; + + if(height<1 || subsamp<0 || subsamp>=TJ_NUMSAMP) + _throw("tjPlaneHeight(): Invalid argument"); + nc=(subsamp==TJSAMP_GRAY? 1:3); + if(componentID<0 || componentID>=nc) + _throw("tjPlaneHeight(): Invalid argument"); + + ph=PAD(height, tjMCUHeight[subsamp]/8); + if(componentID==0) + retval=ph; + else + retval=ph*8/tjMCUHeight[subsamp]; + + bailout: + return retval; +} + + +DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV(int componentID, int width, + int stride, int height, int subsamp) +{ + unsigned long retval=0; + int pw, ph; + + if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT) + _throw("tjPlaneSizeYUV(): Invalid argument"); + + pw=tjPlaneWidth(componentID, width, subsamp); + ph=tjPlaneHeight(componentID, height, subsamp); + + if(stride==0) stride=pw; + else stride=abs(stride); + + retval=stride*(ph-1)+pw; + + bailout: + return retval; +} + + DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags) @@ -712,7 +780,7 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS]; JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS]; JSAMPROW *outbuf[MAX_COMPONENTS]; - int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS]; + int row, pw0, ph0, pw[MAX_COMPONENTS], ph[MAX_COMPONENTS]; JSAMPLE *ptr; jpeg_component_info *compptr; #ifndef JCS_EXTENSIONS @@ -780,18 +848,18 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, jinit_downsampler(cinfo); (*cinfo->cconvert->start_pass)(cinfo); - pw=PAD(width, cinfo->max_h_samp_factor); - ph=PAD(height, cinfo->max_v_samp_factor); + pw0=PAD(width, cinfo->max_h_samp_factor); + ph0=PAD(height, cinfo->max_v_samp_factor); - if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL) + if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph0))==NULL) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); for(i=0; inum_components; i++) { @@ -822,19 +890,19 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, tmpbuf2[i][row]=&_tmpbuf2_aligned[ PAD(compptr->width_in_blocks*DCTSIZE, 16) * row]; } - cw[i]=pw*compptr->h_samp_factor/cinfo->max_h_samp_factor; - ch[i]=ph*compptr->v_samp_factor/cinfo->max_v_samp_factor; - outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]); + pw[i]=pw0*compptr->h_samp_factor/cinfo->max_h_samp_factor; + ph[i]=ph0*compptr->v_samp_factor/cinfo->max_v_samp_factor; + outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]); if(!outbuf[i]) _throw("tjEncodeYUVPlanes(): Memory allocation failure"); ptr=dstPlanes[i]; - for(row=0; row0)? strides[i]:cw[i]; + ptr+=(strides && strides[i]!=0)? strides[i]:pw[i]; } } - for(row=0; rowmax_v_samp_factor) + for(row=0; rowmax_v_samp_factor) { (*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf, 0, cinfo->max_v_samp_factor); @@ -842,7 +910,7 @@ DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle, unsigned char *srcBuf, for(i=0, compptr=cinfo->comp_info; inum_components; i++, compptr++) jcopy_sample_rows(tmpbuf2[i], 0, outbuf[i], row*compptr->v_samp_factor/cinfo->max_v_samp_factor, - compptr->v_samp_factor, cw[i]); + compptr->v_samp_factor, pw[i]); } cinfo->next_scanline+=height; jpeg_abort_compress(cinfo); @@ -869,21 +937,29 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, unsigned char *srcBuf, int pad, int subsamp, int flags) { unsigned char *dstPlanes[3]; - int pw, ph, cw, ch, strides[3], retval=-1; + int pw0, ph0, strides[3], retval=-1; if(width<=0 || height<=0 || dstBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT) _throw("tjEncodeYUV3(): Invalid argument"); - pw=PAD(width, tjMCUWidth[subsamp]/8); - ph=PAD(height, tjMCUHeight[subsamp]/8); - cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; - - strides[0]=PAD(pw, pad); - strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + pw0=tjPlaneWidth(0, width, subsamp); + ph0=tjPlaneHeight(0, height, subsamp); dstPlanes[0]=dstBuf; - dstPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph); - dstPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch); + strides[0]=PAD(pw0, pad); + if(subsamp==TJSAMP_GRAY) + { + strides[1]=strides[2]=0; + dstPlanes[1]=dstPlanes[2]=NULL; + } + else + { + int pw1=tjPlaneWidth(1, width, subsamp); + int ph1=tjPlaneHeight(1, height, subsamp); + strides[1]=strides[2]=PAD(pw1, pad); + dstPlanes[1]=dstPlanes[0]+strides[0]*ph0; + dstPlanes[2]=dstPlanes[1]+strides[1]*ph1; + } return tjEncodeYUVPlanes(handle, srcBuf, width, pitch, height, pixelFormat, dstPlanes, strides, subsamp, flags); @@ -914,7 +990,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags) { int i, row, retval=0, alloc=1; JSAMPROW *inbuf[MAX_COMPONENTS]; - int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS], + int pw[MAX_COMPONENTS], ph[MAX_COMPONENTS], iw[MAX_COMPONENTS], tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS]; @@ -965,20 +1041,20 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, int ih; iw[i]=compptr->width_in_blocks*DCTSIZE; ih=compptr->height_in_blocks*DCTSIZE; - cw[i]=PAD(cinfo->image_width, cinfo->max_h_samp_factor) + pw[i]=PAD(cinfo->image_width, cinfo->max_h_samp_factor) *compptr->h_samp_factor/cinfo->max_h_samp_factor; - ch[i]=PAD(cinfo->image_height, cinfo->max_v_samp_factor) + ph[i]=PAD(cinfo->image_height, cinfo->max_v_samp_factor) *compptr->v_samp_factor/cinfo->max_v_samp_factor; - if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1; + if(iw[i]!=pw[i] || ih!=ph[i]) usetmpbuf=1; th[i]=compptr->v_samp_factor*DCTSIZE; tmpbufsize+=iw[i]*th[i]; - if((inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL) + if((inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]))==NULL) _throw("tjCompressFromYUVPlanes(): Memory allocation failure"); ptr=srcPlanes[i]; - for(row=0; row0)? strides[i]:cw[i]; + ptr+=(strides && strides[i]!=0)? strides[i]:pw[i]; } } if(usetmpbuf) @@ -1010,15 +1086,15 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, if(usetmpbuf) { int j, k; - for(j=0; j=NUMSUBOPT) _throw("tjCompressFromYUV(): Invalid argument"); - pw=PAD(width, tjMCUWidth[subsamp]/8); - ph=PAD(height, tjMCUHeight[subsamp]/8); - cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; - - strides[0]=PAD(pw, pad); - strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + pw0=tjPlaneWidth(0, width, subsamp); + ph0=tjPlaneHeight(0, height, subsamp); srcPlanes[0]=srcBuf; - srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph); - srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch); + strides[0]=PAD(pw0, pad); + if(subsamp==TJSAMP_GRAY) + { + strides[1]=strides[2]=0; + srcPlanes[1]=srcPlanes[2]=NULL; + } + else + { + int pw1=tjPlaneWidth(1, width, subsamp); + int ph1=tjPlaneHeight(1, height, subsamp); + strides[1]=strides[2]=PAD(pw1, pad); + srcPlanes[1]=srcPlanes[0]+strides[0]*ph0; + srcPlanes[2]=srcPlanes[1]+strides[1]*ph1; + } return tjCompressFromYUVPlanes(handle, srcPlanes, width, strides, height, subsamp, jpegBuf, jpegSize, jpegQual, flags); @@ -1361,7 +1445,7 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, int i, retval=0; JSAMPROW *row_pointer=NULL; JSAMPLE *_tmpbuf[MAX_COMPONENTS]; JSAMPROW *tmpbuf[MAX_COMPONENTS], *inbuf[MAX_COMPONENTS]; - int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS]; + int row, pw0, ph0, pw[MAX_COMPONENTS], ph[MAX_COMPONENTS]; JSAMPLE *ptr; jpeg_component_info *compptr; #ifndef JCS_EXTENSIONS @@ -1426,8 +1510,8 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, jinit_master_decompress(dinfo); (*dinfo->upsample->start_pass)(dinfo); - pw=PAD(width, dinfo->max_h_samp_factor); - ph=PAD(height, dinfo->max_v_samp_factor); + pw0=PAD(width, dinfo->max_h_samp_factor); + ph0=PAD(height, dinfo->max_v_samp_factor); if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat]; @@ -1445,15 +1529,15 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, } #endif - if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL) + if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph0))==NULL) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); for(i=0; inum_components; i++) { @@ -1470,25 +1554,25 @@ DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle, tmpbuf[i][row]=&_tmpbuf_aligned[ PAD(compptr->width_in_blocks*DCTSIZE, 16) * row]; } - cw[i]=pw*compptr->h_samp_factor/dinfo->max_h_samp_factor; - ch[i]=ph*compptr->v_samp_factor/dinfo->max_v_samp_factor; - inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]); + pw[i]=pw0*compptr->h_samp_factor/dinfo->max_h_samp_factor; + ph[i]=ph0*compptr->v_samp_factor/dinfo->max_v_samp_factor; + inbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]); if(!inbuf[i]) _throw("tjDecodeYUVPlanes(): Memory allocation failure"); ptr=srcPlanes[i]; - for(row=0; row0)? strides[i]:cw[i]; + ptr+=(strides && strides[i]!=0)? strides[i]:pw[i]; } } - for(row=0; rowmax_v_samp_factor) + for(row=0; rowmax_v_samp_factor) { JDIMENSION inrow=0, outrow=0; for(i=0, compptr=dinfo->comp_info; inum_components; i++, compptr++) jcopy_sample_rows(inbuf[i], row*compptr->v_samp_factor/dinfo->max_v_samp_factor, tmpbuf[i], 0, - compptr->v_samp_factor, cw[i]); + compptr->v_samp_factor, pw[i]); (dinfo->upsample->upsample)(dinfo, tmpbuf, &inrow, dinfo->max_v_samp_factor, &row_pointer[row], &outrow, dinfo->max_v_samp_factor); @@ -1519,21 +1603,29 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, int height, int pixelFormat, int flags) { unsigned char *srcPlanes[3]; - int pw, ph, cw, ch, strides[3], retval=-1; + int pw0, ph0, strides[3], retval=-1; if(srcBuf==NULL || pad<0 || !isPow2(pad) || subsamp<0 || subsamp>=NUMSUBOPT || width<=0 || height<=0) _throw("tjDecodeYUV(): Invalid argument"); - pw=PAD(width, tjMCUWidth[subsamp]/8); - ph=PAD(height, tjMCUHeight[subsamp]/8); - cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp]; - - strides[0]=PAD(pw, pad); - strides[1]=strides[2]=(subsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + pw0=tjPlaneWidth(0, width, subsamp); + ph0=tjPlaneHeight(0, height, subsamp); srcPlanes[0]=srcBuf; - srcPlanes[1]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[0]+strides[0]*ph); - srcPlanes[2]=(subsamp==TJSAMP_GRAY? NULL:srcPlanes[1]+strides[1]*ch); + strides[0]=PAD(pw0, pad); + if(subsamp==TJSAMP_GRAY) + { + strides[1]=strides[2]=0; + srcPlanes[1]=srcPlanes[2]=NULL; + } + else + { + int pw1=tjPlaneWidth(1, width, subsamp); + int ph1=tjPlaneHeight(1, height, subsamp); + strides[1]=strides[2]=PAD(pw1, pad); + srcPlanes[1]=srcPlanes[0]+strides[0]*ph0; + srcPlanes[2]=srcPlanes[1]+strides[1]*ph1; + } return tjDecodeYUVPlanes(handle, srcPlanes, strides, subsamp, dstBuf, width, pitch, height, pixelFormat, flags); @@ -1548,7 +1640,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, { int i, sfi, row, retval=0; JSAMPROW *outbuf[MAX_COMPONENTS]; int jpegwidth, jpegheight, jpegSubsamp, scaledw, scaledh; - int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS], + int pw[MAX_COMPONENTS], ph[MAX_COMPONENTS], iw[MAX_COMPONENTS], tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; JSAMPLE *_tmpbuf=NULL, *ptr; JSAMPROW *tmpbuf[MAX_COMPONENTS]; int dctsize; @@ -1620,20 +1712,20 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, int ih; iw[i]=compptr->width_in_blocks*dctsize; ih=compptr->height_in_blocks*dctsize; - cw[i]=PAD(dinfo->output_width, dinfo->max_h_samp_factor) + pw[i]=PAD(dinfo->output_width, dinfo->max_h_samp_factor) *compptr->h_samp_factor/dinfo->max_h_samp_factor; - ch[i]=PAD(dinfo->output_height, dinfo->max_v_samp_factor) + ph[i]=PAD(dinfo->output_height, dinfo->max_v_samp_factor) *compptr->v_samp_factor/dinfo->max_v_samp_factor; - if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1; + if(iw[i]!=pw[i] || ih!=ph[i]) usetmpbuf=1; th[i]=compptr->v_samp_factor*dctsize; tmpbufsize+=iw[i]*th[i]; - if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL) + if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph[i]))==NULL) _throw("tjDecompressToYUVPlanes(): Memory allocation failure"); ptr=dstPlanes[i]; - for(row=0; row0)? strides[i]:cw[i]; + ptr+=(strides && strides[i]!=0)? strides[i]:pw[i]; } } if(usetmpbuf) @@ -1695,9 +1787,9 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, int j; for(i=0; inum_components; i++) { - for(j=0; jwidth || scaledh>height) _throw("tjDecompressToYUV2(): Could not scale down to desired image dimensions"); - pw=PAD(scaledw, tjMCUWidth[jpegSubsamp]/8); - ph=PAD(scaledh, tjMCUHeight[jpegSubsamp]/8); - cw=pw*8/tjMCUWidth[jpegSubsamp]; ch=ph*8/tjMCUHeight[jpegSubsamp]; - - strides[0]=PAD(pw, pad); - strides[1]=strides[2]=(jpegSubsamp==TJSAMP_GRAY? 0:PAD(cw, pad)); + pw0=tjPlaneWidth(0, width, jpegSubsamp); + ph0=tjPlaneHeight(0, height, jpegSubsamp); dstPlanes[0]=dstBuf; - dstPlanes[1]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[0]+strides[0]*ph); - dstPlanes[2]=(jpegSubsamp==TJSAMP_GRAY? NULL:dstPlanes[1]+strides[1]*ch); + strides[0]=PAD(pw0, pad); + if(jpegSubsamp==TJSAMP_GRAY) + { + strides[1]=strides[2]=0; + dstPlanes[1]=dstPlanes[2]=NULL; + } + else + { + int pw1=tjPlaneWidth(1, width, jpegSubsamp); + int ph1=tjPlaneHeight(1, height, jpegSubsamp); + strides[1]=strides[2]=PAD(pw1, pad); + dstPlanes[1]=dstPlanes[0]+strides[0]*ph0; + dstPlanes[2]=dstPlanes[1]+strides[1]*ph1; + } this->headerRead=1; return tjDecompressToYUVPlanes(handle, jpegBuf, jpegSize, dstPlanes, width, diff --git a/turbojpeg.h b/turbojpeg.h index 0ba7070c..2505100c 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -52,20 +52,18 @@ * * Each plane is simply a 2D array of bytes, each byte representing the value * of one of the components (Y, Cb, or Cr) at a particular location in the - * image. The "component width" and "component height" of each plane are - * determined by the image width, height, and level of chrominance subsampling. - * For the luminance plane, the component width is the image width padded to - * the nearest multiple of the horizontal subsampling factor (2 in the case of - * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or - * grayscale.) Similarly, the component height of the luminance plane is the - * image height padded to the nearest multiple of the vertical subsampling - * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or - * grayscale.) This is irrespective of any additional padding that may be - * specified as an argument to the various YUV functions. The component width - * of the chrominance planes is equal to the component width of the luminance - * plane divided by the horizontal subsampling factor, and the component height - * of the chrominance planes is equal to the component height of the luminance - * plane divided by the vertical subsampling factor. + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of + * 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane + * height is the image height padded to the nearest multiple of the vertical + * subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 + * or grayscale.) This is irrespective of any additional padding that may be + * specified as an argument to the various YUV functions. The chrominance + * plane width is equal to the luminance plane width divided by the horizontal + * subsampling factor, and the chrominance plane height is equal to the + * luminance plane height divided by the vertical subsampling factor. * * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is * used, then the luminance plane would be 36 x 35 bytes, and each of the @@ -625,7 +623,7 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); * * @param width width (in pixels) of the source image * - * @param pitch bytes per line of the source image. Normally, this should be + * @param pitch bytes per line in the source image. Normally, this should be * width * #tjPixelSize[pixelFormat] if the image is unpadded, or * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image * is padded to the nearest 32-bit boundary, as is the case for Windows @@ -668,7 +666,7 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); * 100 = best) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -730,7 +728,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, * 100 = best) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -747,10 +745,10 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes * (or just a Y plane, if compressing a grayscale image) that contain a YUV * image to be compressed. These planes can be contiguous or non-contiguous in - * memory. Each plane should be at least - * {component stride} * {component height} bytes in size. (See - * below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * memory. The size of each plane should match the value returned by + * #tjPlaneSizeYUV() for the given image width, height, strides, and level of + * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" + * for more details. * * @param width width (in pixels) of the source image. If the width is not an * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate @@ -758,11 +756,12 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the YUV source image. Setting the stride - * for any plane to 0 is the same as setting it to the component width for the - * plane. If strides is NULL, then the strides for all planes will be - * set to their respective component widths. You can adjust the strides in - * order to specify an arbitrary amount of line padding in each plane or to - * create a JPEG image from a subregion of a larger YUV planar image. + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to specify an arbitrary amount of line + * padding in each plane or to create a JPEG image from a subregion of a larger + * YUV planar image. * * @param height height (in pixels) of the source image. If the height is not * an even multiple of the MCU block height (see #tjMCUHeight), then an @@ -797,7 +796,7 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * 100 = best) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -817,9 +816,9 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, * size of a JPEG image prior to compression, the corner case has to be * handled. * - * @param width width of the image (in pixels) + * @param width width (in pixels) of the image * - * @param height height of the image (in pixels) + * @param height height (in pixels) of the image * * @param jpegSubsamp the level of chrominance subsampling to be used when * generating the JPEG image (see @ref TJSAMP @@ -836,12 +835,12 @@ DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height, * The size of the buffer (in bytes) required to hold a YUV planar image with * the given parameters. * - * @param width width of the image (in pixels) + * @param width width (in pixels) of the image * * @param pad the width of each line in each plane of the image is padded to * the nearest multiple of this number of bytes (must be a power of 2.) * - * @param height height of the image (in pixels) + * @param height height (in pixels) of the image * * @param subsamp level of chrominance subsampling in the image (see * @ref TJSAMP "Chrominance subsampling options".) @@ -853,6 +852,65 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, int subsamp); +/** + * The size of the buffer (in bytes) required to hold a YUV image plane with + * the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: this is the width of + * the whole image, not the plane width. + * + * @param stride bytes per line in the image plane. Setting this to 0 is the + * equivalent of setting it to the plane width. + * + * @param height height (in pixels) of the YUV image. NOTE: this is the height + * of the whole image, not the plane height. + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the YUV image + * plane, or -1 if the arguments are out of bounds. + */ +DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV(int componentID, int width, + int stride, int height, int subsamp); + + +/** + * The plane width of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane width of a YUV image plane with the given parameters, or + * -1 if the arguments are out of bounds. + */ +DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); + + +/** + * The plane height of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane height of a YUV image plane with the given parameters, or + * -1 if the arguments are out of bounds. + */ +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); + + /** * Encode an RGB or grayscale image into a YUV planar image. This function * uses the accelerated color conversion routines in the underlying @@ -866,7 +924,7 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * * @param width width (in pixels) of the source image * - * @param pitch bytes per line of the source image. Normally, this should be + * @param pitch bytes per line in the source image. Normally, this should be * width * #tjPixelSize[pixelFormat] if the image is unpadded, or * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image * is padded to the nearest 32-bit boundary, as is the case for Windows @@ -897,7 +955,7 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * image compatible with the I420 (AKA "YUV420P") format. * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -919,7 +977,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * * @param width width (in pixels) of the source image * - * @param pitch bytes per line of the source image. Normally, this should be + * @param pitch bytes per line in the source image. Normally, this should be * width * #tjPixelSize[pixelFormat] if the image is unpadded, or * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image * is padded to the nearest 32-bit boundary, as is the case for Windows @@ -935,18 +993,18 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes * (or just a Y plane, if generating a grayscale image) that will receive the * encoded image. These planes can be contiguous or non-contiguous in memory. - * Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based + * on the image width, height, strides, and level of chrominance subsampling. + * Refer to @ref YUVnotes "YUV Image Format Notes" for more details. * * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the output image. Setting the stride for - * any plane to 0 is the same as setting it to the component width for the - * plane. If strides is NULL, then the strides for all planes will be - * set to their respective component widths. You can adjust the strides in - * order to add an arbitrary amount of line padding to each plane or to encode - * an RGB or grayscale image into a subregion of a larger YUV planar image. + * any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to add an arbitrary amount of line + * padding to each plane or to encode an RGB or grayscale image into a + * subregion of a larger YUV planar image. * * @param subsamp the level of chrominance subsampling to be used when * generating the YUV image (see @ref TJSAMP @@ -955,7 +1013,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * image compatible with the I420 (AKA "YUV420P") format. * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -989,8 +1047,8 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); * (in pixels) of the JPEG image * * @param jpegSubsamp pointer to an integer variable that will receive the - * level of chrominance subsampling used when compressing the JPEG image (see - * @ref TJSAMP "Chrominance subsampling options".) + * level of chrominance subsampling used when the JPEG image was compressed + * (see @ref TJSAMP "Chrominance subsampling options".) * * @param jpegColorspace pointer to an integer variable that will receive one * of the JPEG colorspace constants, indicating the colorspace of the JPEG @@ -1039,7 +1097,7 @@ DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); * set to 0, then only the height will be considered when determining the * scaled image size. * - * @param pitch bytes per line of the destination image. Normally, this is + * @param pitch bytes per line in the destination image. Normally, this is * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed image * is unpadded, else #TJPAD(scaledWidth * #tjPixelSize[pixelFormat]) * if each line of the decompressed image is padded to the nearest 32-bit @@ -1061,7 +1119,7 @@ DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); * TJPF "Pixel formats".) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1111,7 +1169,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * performed within TurboJPEG. * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1134,10 +1192,10 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes * (or just a Y plane, if decompressing a grayscale image) that will receive * the YUV image. These planes can be contiguous or non-contiguous in memory. - * Each plane should be at least - * {component stride} * {scaled component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based + * on the scaled image width, scaled image height, strides, and level of + * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" + * for more details. * * @param width desired width (in pixels) of the YUV image. If this is * different than the width of the JPEG image being decompressed, then @@ -1150,11 +1208,12 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the output image. Setting the stride for - * any plane to 0 is the same as setting it to the scaled component width for - * the plane. If strides is NULL, then the strides for all planes - * will be set to their respective scaled component widths. You can adjust the - * strides in order to add an arbitrary amount of line padding to each plane or - * to decompress the JPEG image into a subregion of a larger YUV planar image. + * any plane to 0 is the same as setting it to the scaled plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective scaled plane + * widths. You can adjust the strides in order to add an arbitrary amount of + * line padding to each plane or to decompress the JPEG image into a subregion + * of a larger YUV planar image. * * @param height desired height (in pixels) of the YUV image. If this is * different than the height of the JPEG image being decompressed, then @@ -1166,7 +1225,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * performed within TurboJPEG. * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1204,7 +1263,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, * * @param width width (in pixels) of the source and destination images * - * @param pitch bytes per line of the destination image. Normally, this should + * @param pitch bytes per line in the destination image. Normally, this should * be width * #tjPixelSize[pixelFormat] if the destination image is * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line * of the destination image should be padded to the nearest 32-bit boundary, as @@ -1218,7 +1277,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, * "Pixel formats".) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1238,18 +1297,18 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes * (or just a Y plane, if decoding a grayscale image) that contain a YUV image * to be decoded. These planes can be contiguous or non-contiguous in memory. - * Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * The size of each plane should match the value returned by #tjPlaneSizeYUV() + * for the given image width, height, strides, and level of chrominance + * subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" for more + * details. * * @param strides an array of integers, each specifying the number of bytes per * line in the corresponding plane of the YUV source image. Setting the stride - * for any plane to 0 is the same as setting it to the component width for the - * plane. If strides is NULL, then the strides for all planes will be - * set to their respective component widths. You can adjust the strides in - * order to specify an arbitrary amount of line padding in each plane or to - * decode a subregion of a larger YUV planar image. + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to specify an arbitrary amount of line + * padding in each plane or to decode a subregion of a larger YUV planar image. * * @param subsamp the level of chrominance subsampling used in the YUV source * image (see @ref TJSAMP "Chrominance subsampling options".) @@ -1261,7 +1320,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * * @param width width (in pixels) of the source and destination images * - * @param pitch bytes per line of the destination image. Normally, this should + * @param pitch bytes per line in the destination image. Normally, this should * be width * #tjPixelSize[pixelFormat] if the destination image is * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line * of the destination image should be padded to the nearest 32-bit boundary, as @@ -1275,7 +1334,7 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * "Pixel formats".) * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1295,9 +1354,9 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void); /** * Losslessly transform a JPEG image into another JPEG image. Lossless - * transforms work by moving the raw coefficients from one JPEG image structure - * to another without altering the values of the coefficients. While this is - * typically faster than decompressing the image, transforming it, and + * transforms work by moving the raw DCT coefficients from one JPEG image + * structure to another without altering the values of the coefficients. While + * this is typically faster than decompressing the image, transforming it, and * re-compressing it, lossless transforms are not free. Each lossless * transform requires reading and performing Huffman decoding on all of the * coefficients in the source image, regardless of the size of the destination @@ -1308,9 +1367,10 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void); * * @param handle a handle to a TurboJPEG transformer instance * - * @param jpegBuf pointer to a buffer containing the JPEG image to transform + * @param jpegBuf pointer to a buffer containing the JPEG source image to + * transform * - * @param jpegSize size of the JPEG image (in bytes) + * @param jpegSize size of the JPEG source image (in bytes) * * @param n the number of transformed JPEG images to generate * @@ -1343,7 +1403,7 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void); * corresponding transformed output image. * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags" * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1372,7 +1432,7 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle handle); * @param bytes the number of bytes to allocate * * @return a pointer to a newly-allocated buffer with the specified number of - * bytes + * bytes. * * @sa tjFree() */ From f4543c7379847b84916cd5ab6309d1810dbb7ae0 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 20 Aug 2014 13:14:46 +0000 Subject: [PATCH 961/985] Properly detect the need for gas-preprocessor.pl when building for ARM64 git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1361 632fc199-4ca6-4c93-a231-07263d6284db --- acinclude.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 8d667849..4a130825 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -219,6 +219,7 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[ CC="$CCAS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ .text + .arch armv8-a+fp+simd movi v0.16b, #100]])], ac_good_gnu_arm_assembler=yes) ac_use_gas_preprocessor=no @@ -226,6 +227,7 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[ CC="gas-preprocessor.pl $CCAS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ .text + .arch armv8-a+fp+simd movi v0.16b, #100]])], ac_use_gas_preprocessor=yes) fi CFLAGS="$ac_save_CFLAGS" From 7c0efc8589b7f2504ff13b9b43681c3899fa16e8 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 20 Aug 2014 15:40:43 +0000 Subject: [PATCH 962/985] Document the existence of the new ARM64 SIMD code git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1362 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 70a1730a..30c3b5c6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -92,6 +92,11 @@ included only for convenience. Enabling this feature disables all of the performance features in libjpeg-turbo, as well as arithmetic coding and the TurboJPEG API. The resulting library behaves no differently than libjpeg v6b. +[14] Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion +and IDCT algorithms (both are used during JPEG decompression.) For unknown +reasons (probably related to clang), this code cannot currently be compiled for +iOS. + 1.3.1 ===== From bbe6136281df0a8000aedcbd04480348c4d90d77 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 20 Aug 2014 16:02:49 +0000 Subject: [PATCH 963/985] Wordsmithing & clarifications git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1363 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 30c3b5c6..f5374ef7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -13,18 +13,18 @@ compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no significant advantages relative to 4:2:0. -- CMYK images are now supported. This feature allows CMYK source images to be compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to CMYK -destination images. Conversion between CMYK and RGB or YUV images is not -supported. Such conversion requires a color management system and is out of -scope for a codec library. +destination images. Conversion between CMYK/YCCK and RGB or YUV images is not +supported. Such conversion requires a color management system and is thus out +of scope for a codec library. -- The handling of YUV images in the Java API has been significantly refactored and should now be much more intuitive. -- The Java API now supports encoding a YUV image from an arbitrary position in a large image buffer. -- All of the YUV functions now have a corresponding function that operates on separate image planes instead of a unified image buffer. This allows for -compressing/decoding a YUV image from or decompressing/encoding a YUV image to -an arbitrary position in a larger YUV image. It also allows for handling YUV -formats that swap the order of the U and V planes. +compressing/decoding from or decompressing/encoding to a subregion of a larger +YUV image. It also allows for handling YUV formats that swap the order of the +U and V planes. [2] Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up the compression of full-color JPEGs by 70-80% on such platforms and @@ -51,7 +51,7 @@ Android devices that were tested, two demonstrated a small overall performance loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with ARMv7 code when enabling this new feature, but the other two devices demonstrated a significant overall performance gain with both ARMv6 and ARMv7 -code (~10-20%.) Actual mileage may vary. +code (~10-20%) when enabling the feature. Actual mileage may vary. [6] Worked around an issue with Visual C++ 2010 and later that caused incorrect pixels to be generated when decompressing a JPEG image to a 256-color bitmap, @@ -70,10 +70,9 @@ slower. [8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows for decompressing JPEG images into RGB565 (16-bit) pixels. -[9] Numerous obsolete features, such as support for compilers that can't -handle prototypes and support for the MS-DOS memory model, were removed from -the libjpeg code, greatly improving its readability and making it easier to -maintain and extend. +[9] Numerous obsolete features, such as support for non-ANSI compilers and +support for the MS-DOS memory model, were removed from the libjpeg code, +greatly improving its readability and making it easier to maintain and extend. [10] Fixed a segfault that occurred when calling output_message() with msg_code set to JMSG_COPYRIGHT. @@ -83,14 +82,16 @@ characters to be passed on the command line, which was causing it to generate incorrect JPEG files. [12] Fixed a bug in the build system that was causing the Windows version of -wrjpgcom to be built using the rdjpgcom code. +wrjpgcom to be built using the rdjpgcom source code. [13] Restored 12-bit-per-component JPEG support. A 12-bit version of libjpeg-turbo can now be built by passing an argument of --with-12bit to configure (Unix) or -DWITH_12BIT=1 to cmake (Windows.) 12-bit JPEG support is included only for convenience. Enabling this feature disables all of the performance features in libjpeg-turbo, as well as arithmetic coding and the -TurboJPEG API. The resulting library behaves no differently than libjpeg v6b. +TurboJPEG API. The resulting library still contains the other libjpeg-turbo +features (such as the colorspace extensions), but in general, it performs no +faster than libjpeg v6b. [14] Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion and IDCT algorithms (both are used during JPEG decompression.) For unknown From 6bce2c22c7c1a0b824be9903e7c987ade1fdc679 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 01:53:47 +0000 Subject: [PATCH 964/985] Fix an extremely rare crash that can occur when compressing a very high-frequency MCU using quality 100 and no subsampling, and when dynamically allocating the JPEG buffer in the destination manager. Even with a test program designed specifically to reproduce the crash, it only occurred once in about 25 million iterations. More details here: https://sourceforge.net/p/libjpeg-turbo/bugs/64 git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1364 632fc199-4ca6-4c93-a231-07263d6284db --- jchuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jchuff.c b/jchuff.c index 5f6288aa..026b1f29 100644 --- a/jchuff.c +++ b/jchuff.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009-2011, D. R. Commander. + * Copyright (C) 2009-2011, 2014 D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines. @@ -443,7 +443,7 @@ dump_buffer (working_state * state) LOCAL(boolean) flush_bits (working_state * state) { - JOCTET _buffer[BUFSIZE], *buffer; + JOCTET _buffer[BUFSIZE + 8], *buffer; size_t put_buffer; int put_bits; size_t bytes, bytestocopy; int localbuf = 0; @@ -472,7 +472,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, int temp, temp2, temp3; int nbits; int r, code, size; - JOCTET _buffer[BUFSIZE], *buffer; + JOCTET _buffer[BUFSIZE + 8], *buffer; size_t put_buffer; int put_bits; int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; size_t bytes, bytestocopy; int localbuf = 0; From d4a32f71d4b0c0e1324d6b36e79f766579e3e70b Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 03:40:37 +0000 Subject: [PATCH 965/985] Actually, we need to increase the size of BUFSIZE, not just the size of _buffer. The previous patch might have cause problems if, for instance, state->free_in_buffer was 127 but 129 bytes were compressed. In that case, only 127 of the 129 bytes would have been written to the file. Also document the fix. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1367 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 8 ++++++++ jchuff.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f5374ef7..6f39b0a2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -98,6 +98,14 @@ and IDCT algorithms (both are used during JPEG decompression.) For unknown reasons (probably related to clang), this code cannot currently be compiled for iOS. +[15] Fixed an extremely rare bug that could cause the Huffman encoder's local +buffer to overrun when a very high-frequency MCU is compressed using quality +100 and no subsampling, and when the JPEG output buffer is being dynamically +resized by the destination manager. This issue was so rare that, even with a +test program specifically designed to make the bug occur (by injecting random +high-frequency YUV data into the compressor), it was reproducible only once in +about every 25 million iterations. + 1.3.1 ===== diff --git a/jchuff.c b/jchuff.c index 026b1f29..d8eb1d35 100644 --- a/jchuff.c +++ b/jchuff.c @@ -408,7 +408,7 @@ dump_buffer (working_state * state) #endif -#define BUFSIZE (DCTSIZE2 * 2) +#define BUFSIZE (DCTSIZE2 * 2) + 8 #define LOAD_BUFFER() { \ if (state->free_in_buffer < BUFSIZE) { \ @@ -443,7 +443,7 @@ dump_buffer (working_state * state) LOCAL(boolean) flush_bits (working_state * state) { - JOCTET _buffer[BUFSIZE + 8], *buffer; + JOCTET _buffer[BUFSIZE], *buffer; size_t put_buffer; int put_bits; size_t bytes, bytestocopy; int localbuf = 0; @@ -472,7 +472,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, int temp, temp2, temp3; int nbits; int r, code, size; - JOCTET _buffer[BUFSIZE + 8], *buffer; + JOCTET _buffer[BUFSIZE], *buffer; size_t put_buffer; int put_bits; int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; size_t bytes, bytestocopy; int localbuf = 0; From bc4d369b49876db56b416b98d7e9a33b0811c232 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 15:51:47 +0000 Subject: [PATCH 966/985] If the output buffer in the TurboJPEG destination manager was allocated by the destination manager and is being reused from a previous compression operation, then we need to get the buffer size from the previous operation, since the calling program doesn't know the actual buffer size. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1368 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 9 +++++++++ doc/html/group___turbo_j_p_e_g.html | 6 +++--- jdatadst-tj.c | 11 +++++++++-- tjunittest.c | 10 ++++++++-- turbojpeg.h | 12 +++++++++--- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6f39b0a2..c31a0075 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -106,6 +106,15 @@ test program specifically designed to make the bug occur (by injecting random high-frequency YUV data into the compressor), it was reproducible only once in about every 25 million iterations. +[16] Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG +compression functions was called repeatedly with the same +automatically-allocated destination buffer, then TurboJPEG would erroneously +assume that the jpegSize parameter was equal to the size of the buffer, when in +fact that parameter was probably equal to the size of the most recently +compressed JPEG image. If the size of the previous JPEG image was not as large +as the current JPEG image, then TurboJPEG would unnecessarily reallocate the +destination buffer. + 1.3.1 ===== diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index c7b19bf4..7188c7d6 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -1011,7 +1011,7 @@ Variables

  • pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
  • If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. - jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) + jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) If *jpegBuf points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then *jpegSize is ignored. jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.) jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best) flagsthe bitwise OR of one or more of the flags @@ -1109,7 +1109,7 @@ If you choose option 1, *jpegSize should be set to the size of your
  • pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
  • If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. - jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) + jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) If *jpegBuf points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then *jpegSize is ignored. jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best) flagsthe bitwise OR of one or more of the flags @@ -1206,7 +1206,7 @@ If you choose option 1, *jpegSize should be set to the size of your
  • pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
  • If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. - jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) + jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.) If *jpegBuf points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then *jpegSize is ignored. jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best) flagsthe bitwise OR of one or more of the flags diff --git a/jdatadst-tj.c b/jdatadst-tj.c index bc4a35dd..8289d3a4 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -5,7 +5,7 @@ * Copyright (C) 1994-1996, Thomas G. Lane. * Modified 2009-2012 by Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2011, D. R. Commander. + * Copyright (C) 2011, 2014 D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains compression data destination routines for the case of @@ -150,6 +150,7 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, unsigned char ** outbuffer, unsigned long * outsize, boolean alloc) { + boolean reused = FALSE; my_mem_dest_ptr dest; if (outbuffer == NULL || outsize == NULL) /* sanity check */ @@ -164,12 +165,16 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, sizeof(my_mem_destination_mgr)); dest = (my_mem_dest_ptr) cinfo->dest; dest->newbuffer = NULL; + dest->outbuffer = NULL; } dest = (my_mem_dest_ptr) cinfo->dest; dest->pub.init_destination = init_mem_destination; dest->pub.empty_output_buffer = empty_mem_output_buffer; dest->pub.term_destination = term_mem_destination; + if (dest->outbuffer && *(dest->outbuffer) == *outbuffer && + *outbuffer != NULL && alloc) + reused = TRUE; dest->outbuffer = outbuffer; dest->outsize = outsize; dest->alloc = alloc; @@ -186,5 +191,7 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, } dest->pub.next_output_byte = dest->buffer = *outbuffer; - dest->pub.free_in_buffer = dest->bufsize = *outsize; + if (!reused) + dest->bufsize = *outsize; + dest->pub.free_in_buffer = dest->bufsize; } diff --git a/tjunittest.c b/tjunittest.c index dc84bbaa..9ac6626c 100644 --- a/tjunittest.c +++ b/tjunittest.c @@ -638,7 +638,10 @@ void bufSizeTest(void) &dstSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC)); } free(srcBuf); srcBuf=NULL; - tjFree(dstBuf); dstBuf=NULL; + if(!alloc) + { + tjFree(dstBuf); dstBuf=NULL; + } if((srcBuf=(unsigned char *)malloc(h*w*4))==NULL) _throw("Memory allocation failure"); @@ -667,7 +670,10 @@ void bufSizeTest(void) &dstSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC)); } free(srcBuf); srcBuf=NULL; - tjFree(dstBuf); dstBuf=NULL; + if(!alloc) + { + tjFree(dstBuf); dstBuf=NULL; + } } } } diff --git a/turbojpeg.h b/turbojpeg.h index 2505100c..1ada65a2 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -656,7 +656,9 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); * the JPEG image buffer. If *jpegBuf points to a pre-allocated * buffer, then *jpegSize should be set to the size of the buffer. * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. * * @param jpegSubsamp the level of chrominance subsampling to be used when * generating the JPEG image (see @ref TJSAMP @@ -722,7 +724,9 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, * the JPEG image buffer. If *jpegBuf points to a pre-allocated * buffer, then *jpegSize should be set to the size of the buffer. * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. * * @param jpegQual the image quality of the generated JPEG image (1 = worst, * 100 = best) @@ -790,7 +794,9 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * the JPEG image buffer. If *jpegBuf points to a pre-allocated * buffer, then *jpegSize should be set to the size of the buffer. * Upon return, *jpegSize will contain the size of the JPEG image (in - * bytes.) + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. * * @param jpegQual the image quality of the generated JPEG image (1 = worst, * 100 = best) From 4dec5210ef61d133c6c5d7ee3b4bc0c9816af13d Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 22:15:19 +0000 Subject: [PATCH 967/985] Subtle point, but dest->outbuffer is a pointer to the address of the JPEG buffer, which is stored in the calling program. Thus, *(dest->outbuffer) will always equal *outbuffer. We need to compare *outbuffer with dest->buffer instead to determine if the pointer is being reused. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1369 632fc199-4ca6-4c93-a231-07263d6284db --- jdatadst-tj.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jdatadst-tj.c b/jdatadst-tj.c index 8289d3a4..a0e0f2e0 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -165,15 +165,14 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, sizeof(my_mem_destination_mgr)); dest = (my_mem_dest_ptr) cinfo->dest; dest->newbuffer = NULL; - dest->outbuffer = NULL; + dest->buffer = NULL; } dest = (my_mem_dest_ptr) cinfo->dest; dest->pub.init_destination = init_mem_destination; dest->pub.empty_output_buffer = empty_mem_output_buffer; dest->pub.term_destination = term_mem_destination; - if (dest->outbuffer && *(dest->outbuffer) == *outbuffer && - *outbuffer != NULL && alloc) + if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc) { reused = TRUE; dest->outbuffer = outbuffer; dest->outsize = outsize; From ebfee8203a4af2de425147fc02c721daa83cbe00 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 22:16:25 +0000 Subject: [PATCH 968/985] Oops git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1370 632fc199-4ca6-4c93-a231-07263d6284db --- jdatadst-tj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdatadst-tj.c b/jdatadst-tj.c index a0e0f2e0..1f6f3a5e 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -172,7 +172,7 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, dest->pub.init_destination = init_mem_destination; dest->pub.empty_output_buffer = empty_mem_output_buffer; dest->pub.term_destination = term_mem_destination; - if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc) { + if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc) reused = TRUE; dest->outbuffer = outbuffer; dest->outsize = outsize; From c62f3f40be34c9b392bccc3ac20811278f4a9870 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 03:00:37 +0000 Subject: [PATCH 969/985] Run the TurboJPEG conformance tests out of a directory in /tmp (for improved performance, if the source directory is on a remote file share.) Fix an issue in TJBench.java that prevented it from working properly if the source image resided in a directory with a dot in the name. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1373 632fc199-4ca6-4c93-a231-07263d6284db --- java/TJBench.java | 6 +++--- tjbenchtest.in | 2 +- tjbenchtest.java.in | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/TJBench.java b/java/TJBench.java index 617d312d..c9d110c3 100644 --- a/java/TJBench.java +++ b/java/TJBench.java @@ -236,7 +236,7 @@ class TJBench { "_" + sizeStr + ".bmp"); saveImage(tempStr, dstBuf, scaledw, scaledh, pf); - int ndx = tempStr.indexOf('.'); + int ndx = tempStr.lastIndexOf('.'); tempStr = new String(tempStr.substring(0, ndx) + "-err.bmp"); if (srcBuf != null && sf.getNum() == 1 && sf.getDenom() == 1) { if (quiet == 0) @@ -432,7 +432,7 @@ class TJBench { fis.read(srcBuf, 0, srcSize); fis.close(); - int index = fileName.indexOf('.'); + int index = fileName.lastIndexOf('.'); if (index >= 0) fileName = new String(fileName.substring(0, index)); @@ -846,7 +846,7 @@ class TJBench { srcBuf = loadImage(argv[0], width, height, pf); w = width[0]; h = height[0]; int index = -1; - if ((index = argv[0].indexOf('.')) >= 0) + if ((index = argv[0].lastIndexOf('.')) >= 0) argv[0] = argv[0].substring(0, index); } diff --git a/tjbenchtest.in b/tjbenchtest.in index 5e08c9b3..4c4e0406 100755 --- a/tjbenchtest.in +++ b/tjbenchtest.in @@ -22,7 +22,7 @@ runme() EXT=bmp IMAGES="vgl_5674_0098.${EXT} vgl_6434_0018a.${EXT} vgl_6548_0026a.${EXT} nightshot_iso_100.${EXT}" IMGDIR=@srcdir@/testimages -OUTDIR=__tjbenchtest_output +OUTDIR=`mktemp -d /tmp/__tjbenchtest_output.XXXXXX` EXEDIR=. BMPARG= NSARG= diff --git a/tjbenchtest.java.in b/tjbenchtest.java.in index 20546035..acdabd08 100755 --- a/tjbenchtest.java.in +++ b/tjbenchtest.java.in @@ -21,7 +21,7 @@ runme() IMAGES="vgl_5674_0098.bmp vgl_6434_0018a.bmp vgl_6548_0026a.bmp nightshot_iso_100.bmp" IMGDIR=@srcdir@/testimages -OUTDIR=__tjbenchtest_java_output +OUTDIR=`mktemp -d /tmp/__tjbenchtest_java_output.XXXXXX` EXEDIR=. JAVA="@JAVA@ -cp java/turbojpeg.jar -Djava.library.path=.libs" BMPARG= From 2bbe593b31df56a4dd25640c91678aca8b3ced0a Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 03:04:06 +0000 Subject: [PATCH 970/985] Extend tjbenchtest so that it tests the dynamic JPEG buffer allocation feature in TurboJPEG. Disable the tiling feature in TJBench whenever dynamic buffer allocation is enabled (because the tiling feature requires a separate buffer for each tile, using it successfully with dynamic buffer allocation would require a separate TurboJPEG compressor instance for each tile, and it's not worth going to that trouble right now.) git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1374 632fc199-4ca6-4c93-a231-07263d6284db --- Makefile.am | 2 + tjbench.c | 7 +++ tjbenchtest.in | 131 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 95 insertions(+), 45 deletions(-) diff --git a/Makefile.am b/Makefile.am index dad69dfb..e34f13e9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -513,7 +513,9 @@ testclean: tjtest: sh ./tjbenchtest + sh ./tjbenchtest -alloc sh ./tjbenchtest -yuv + sh ./tjbenchtest -yuv -alloc if WITH_JAVA sh ./tjbenchtest.java sh ./tjbenchtest.java -yuv diff --git a/tjbench.c b/tjbench.c index 14ccd00e..47254160 100644 --- a/tjbench.c +++ b/tjbench.c @@ -908,6 +908,13 @@ int main(int argc, char *argv[]) dotile=0; } + if((flags&TJFLAG_NOREALLOC)==0 && dotile) + { + printf("Disabling tiled compression/decompression tests, because those tests do not\n"); + printf("work when dynamic JPEG buffer allocation is enabled.\n\n"); + dotile=0; + } + if(!decomponly) { if(loadbmp(argv[1], &srcbuf, &w, &h, pf, (flags&TJFLAG_BOTTOMUP)!=0)==-1) diff --git a/tjbenchtest.in b/tjbenchtest.in index 4c4e0406..ef11b246 100755 --- a/tjbenchtest.in +++ b/tjbenchtest.in @@ -27,6 +27,8 @@ EXEDIR=. BMPARG= NSARG= YUVARG= +ALLOC=0 +ALLOCARG= if [ "$EXT" = "bmp" ]; then BMPARG=-bmp; fi if [ -d $OUTDIR ]; then @@ -59,6 +61,10 @@ if [ $# -gt 0 ]; then # of round-off error.) IMAGES="vgl_6548_0026a.${EXT}" fi + if [ "$1" = "-alloc" ]; then + ALLOCARG=-alloc + ALLOC=1 + fi fi # Standard tests @@ -87,7 +93,7 @@ for image in $IMAGES; do # Compression for dct in accurate fast; do - runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -warmup 0 -${dct}dct $YUVARG + runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -warmup 0 -${dct}dct $YUVARG $ALLOCARG for samp in GRAY 420 422 444; do runme cmp $OUTDIR/${basename}_${samp}_Q95.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg done @@ -100,39 +106,59 @@ for image in $IMAGES; do fi # Tiled compression & decompression - runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG + runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG $ALLOCARG for samp in GRAY 444; do - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} - rm $i - done + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $i + done + fi done - runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG + runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG $ALLOCARG for samp in 420 422; do - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} - rm $i - done + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $i + done + fi done # Tiled decompression for samp in GRAY 444; do - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} - rm $i - done + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG $ALLOCARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT} + rm $i + done + fi done for samp in 420 422; do - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} - rm $i - done + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG $ALLOCARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT} + rm $i + done + fi done done @@ -141,7 +167,7 @@ for image in $IMAGES; do scalearg=`echo $scale | sed s@_@/@g` for samp in GRAY 420 422 444; do runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} done @@ -160,33 +186,48 @@ for image in $IMAGES; do for xform in hflip vflip transpose transverse rot90 rot180 rot270; do for samp in GRAY 444; do runme $EXEDIR/djpeg -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 $YUVARG - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} - rm $i - done + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} + rm $i + done + fi done for samp in 420 422; do runme $EXEDIR/djpeg -nosmooth -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample $YUVARG - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} - rm $i - done + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample $YUVARG $ALLOCARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} + rm $i + done + fi done done # Grayscale transform for xform in hflip vflip transpose transverse rot90 rot180 rot270; do for samp in GRAY 444 422 420; do - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -grayscale $YUVARG - for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ - $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do - runme cmp $i $OUTDIR/${basename}_GRAY_${xform}_jpegtran.${EXT} - rm $i - done + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -grayscale $YUVARG $ALLOCARG + if [ $ALLOC = 1 ]; then + runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_GRAY_${xform}_jpegtran.${EXT} + rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT} + else + for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \ + $OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do + runme cmp $i $OUTDIR/${basename}_GRAY_${xform}_jpegtran.${EXT} + rm $i + done + fi done done @@ -196,7 +237,7 @@ for image in $IMAGES; do for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do scalearg=`echo $scale | sed s@_@/@g` runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg - runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG + runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT} rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} done From 83052612d0e5388c487005570611b846f1bfbabf Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 11:31:46 +0000 Subject: [PATCH 971/985] .func/.endfunc are only necessary when generating STABS debug info, which basically went out of style with parachute pants and Rick Astley. At any rate, none of the platforms for which we're building the ARM code use it (DWARF is the common format these days), and the .func/.endfunc directives cause the clang integrated assembler to fail (http://llvm.org/bugs/show_bug.cgi?id=20424). git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1375 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jsimd_arm_neon.S | 12 ------------ simd/jsimd_arm_neon_64.S | 7 ------- 2 files changed, 19 deletions(-) diff --git a/simd/jsimd_arm_neon.S b/simd/jsimd_arm_neon.S index ac6c8607..44c61fdd 100644 --- a/simd/jsimd_arm_neon.S +++ b/simd/jsimd_arm_neon.S @@ -41,11 +41,9 @@ /* Supplementary macro for setting function attributes */ .macro asm_function fname #ifdef __APPLE__ - .func _\fname .globl _\fname _\fname: #else - .func \fname .global \fname #ifdef __ELF__ .hidden \fname @@ -670,7 +668,6 @@ asm_function jsimd_idct_islow_neon .unreq ROW6R .unreq ROW7L .unreq ROW7R -.endfunc /*****************************************************************************/ @@ -895,7 +892,6 @@ asm_function jsimd_idct_ifast_neon .unreq TMP2 .unreq TMP3 .unreq TMP4 -.endfunc /*****************************************************************************/ @@ -1108,7 +1104,6 @@ asm_function jsimd_idct_4x4_neon .unreq TMP2 .unreq TMP3 .unreq TMP4 -.endfunc .purgem idct_helper @@ -1263,7 +1258,6 @@ asm_function jsimd_idct_2x2_neon .unreq OUTPUT_COL .unreq TMP1 .unreq TMP2 -.endfunc .purgem idct_helper @@ -1547,7 +1541,6 @@ asm_function jsimd_ycc_\colorid\()_convert_neon .unreq U .unreq V .unreq N -.endfunc .purgem do_yuv_to_rgb .purgem do_yuv_to_rgb_stage1 @@ -1858,7 +1851,6 @@ asm_function jsimd_\colorid\()_ycc_convert_neon .unreq U .unreq V .unreq N -.endfunc .purgem do_rgb_to_yuv .purgem do_rgb_to_yuv_stage1 @@ -1940,7 +1932,6 @@ asm_function jsimd_convsamp_neon .unreq TMP2 .unreq TMP3 .unreq TMP4 -.endfunc /*****************************************************************************/ @@ -2064,7 +2055,6 @@ asm_function jsimd_fdct_ifast_neon .unreq DATA .unreq TMP -.endfunc /*****************************************************************************/ @@ -2166,7 +2156,6 @@ asm_function jsimd_quantize_neon .unreq CORRECTION .unreq SHIFT .unreq LOOP_COUNT -.endfunc /*****************************************************************************/ @@ -2401,7 +2390,6 @@ asm_function jsimd_h2v1_fancy_upsample_neon .unreq WIDTH .unreq TMP -.endfunc .purgem upsample16 .purgem upsample32 diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index 2c3989c6..b0ba4801 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -41,11 +41,9 @@ /* Supplementary macro for setting function attributes */ .macro asm_function fname #ifdef __APPLE__ - .func _\fname .globl _\fname _\fname: #else - .func \fname .global \fname #ifdef __ELF__ .hidden \fname @@ -753,7 +751,6 @@ asm_function jsimd_idct_islow_neon .unreq ROW6R .unreq ROW7L .unreq ROW7R -.endfunc /*****************************************************************************/ @@ -1059,7 +1056,6 @@ asm_function jsimd_idct_ifast_neon .unreq TMP2 .unreq TMP3 .unreq TMP4 -.endfunc /*****************************************************************************/ @@ -1309,7 +1305,6 @@ asm_function jsimd_idct_4x4_neon .unreq TMP2 .unreq TMP3 .unreq TMP4 -.endfunc .purgem idct_helper @@ -1493,7 +1488,6 @@ asm_function jsimd_idct_2x2_neon .unreq OUTPUT_COL .unreq TMP1 .unreq TMP2 -.endfunc .purgem idct_helper @@ -1804,7 +1798,6 @@ asm_function jsimd_ycc_\colorid\()_convert_neon .unreq U .unreq V .unreq N -.endfunc .purgem do_yuv_to_rgb .purgem do_yuv_to_rgb_stage1 From 04962caf3a49498c30ea10894e4fc6cd7d77c599 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 13:43:33 +0000 Subject: [PATCH 972/985] Add a set of undocumented environment variables and Java system properties that allow compression features of libjpeg that are not normally exposed in the TurboJPEG API to be enabled. These features are not normally exposed because, for the most part, they aren't "turbo" features, but it is still useful to be able to benchmark them without modifying the code. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1376 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 37 +++++++++++++++++++++++++++++++++++++ turbojpeg.c | 26 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index cab57bdf..76af1f2b 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -59,6 +59,39 @@ bailif0(_fid=(*env)->GetFieldID(env, _cls, "handle", "J")); \ handle=(tjhandle)(size_t)(*env)->GetLongField(env, obj, _fid); \ +#define prop2env(property, envvar) \ +{ \ + if((jName=(*env)->NewStringUTF(env, property))!=NULL \ + && (jValue=(*env)->CallStaticObjectMethod(env, cls, mid, jName))!=NULL) \ + { \ + if((value=(*env)->GetStringUTFChars(env, jValue, 0))!=NULL) \ + { \ + setenv(envvar, value, 1); \ + (*env)->ReleaseStringUTFChars(env, jValue, value); \ + } \ + } \ +} + +int ProcessSystemProperties(JNIEnv *env) +{ + jclass cls; jmethodID mid; + jstring jName, jValue; + const char *value; + + bailif0(cls=(*env)->FindClass(env, "java/lang/System")); + bailif0(mid=(*env)->GetStaticMethodID(env, cls, "getProperty", + "(Ljava/lang/String;)Ljava/lang/String;")); + + prop2env("turbojpeg.optimize", "TJ_OPTIMIZE"); + prop2env("turbojpeg.arithmetic", "TJ_ARITHMETIC"); + prop2env("turbojpeg.restart", "TJ_RESTART"); + prop2env("turbojpeg.progressive", "TJ_PROGRESSIVE"); + return 0; + + bailout: + return -1; +} + /* TurboJPEG 1.2.x: TJ::bufSize() */ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize (JNIEnv *env, jclass cls, jint width, jint height, jint jpegSubsamp) @@ -172,6 +205,8 @@ static jint TJCompressor_compress bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0)); bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + if(ProcessSystemProperties(env)<0) goto bailout; + if(tjCompress2(handle, &srcBuf[y*actualPitch + x*tjPixelSize[pf]], width, pitch, height, pf, &jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1) @@ -295,6 +330,8 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFrom } bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0)); + if(ProcessSystemProperties(env)<0) goto bailout; + if(tjCompressFromYUVPlanes(handle, srcPlanes, width, srcStrides, height, subsamp, &jpegBuf, &jpegSize, jpegQual, flags|TJFLAG_NOREALLOC)==-1) _throw(tjGetErrorStr()); diff --git a/turbojpeg.c b/turbojpeg.c index 0daa86ab..1acf7c44 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -31,6 +31,7 @@ #include #include +#include #include #define JPEG_INTERNALS #include @@ -161,6 +162,7 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, int pixelFormat, int subsamp, int jpegQual, int flags) { int retval=0; + char *env=NULL; switch(pixelFormat) { @@ -203,6 +205,26 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, cinfo->input_components=tjPixelSize[pixelFormat]; jpeg_set_defaults(cinfo); + + if((env=getenv("TJ_OPTIMIZE"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) + cinfo->optimize_coding=TRUE; + if((env=getenv("TJ_ARITHMETIC"))!=NULL && strlen(env)>0 && !strcmp(env, "1")) + cinfo->arith_code=TRUE; + if((env=getenv("TJ_RESTART"))!=NULL && strlen(env)>0) + { + int temp=-1; char tempc=0; + if(sscanf(env, "%d%c", &temp, &tempc)>=1 && temp>=0 && temp<=65535) + { + if(toupper(tempc)=='B') + { + cinfo->restart_interval=temp; + cinfo->restart_in_rows=0; + } + else + cinfo->restart_in_rows=temp; + } + } + if(jpegQual>=0) { jpeg_set_quality(cinfo, jpegQual, TRUE); @@ -215,6 +237,10 @@ static int setCompDefaults(struct jpeg_compress_struct *cinfo, jpeg_set_colorspace(cinfo, JCS_YCCK); else jpeg_set_colorspace(cinfo, JCS_YCbCr); + if((env=getenv("TJ_PROGRESSIVE"))!=NULL && strlen(env)>0 + && !strcmp(env, "1")) + jpeg_simple_progression(cinfo); + cinfo->comp_info[0].h_samp_factor=tjMCUWidth[subsamp]/8; cinfo->comp_info[1].h_samp_factor=1; cinfo->comp_info[2].h_samp_factor=1; From ea0f2c2811cd70c1444ead30ee211b39e60fa368 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 14:15:08 +0000 Subject: [PATCH 973/985] Don't use sudo when building a Debian package unless the user is non-root git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1377 632fc199-4ca6-4c93-a231-07263d6284db --- release/makedpkg.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/makedpkg.in b/release/makedpkg.in index 448e4cdd..80cc89bd 100644 --- a/release/makedpkg.in +++ b/release/makedpkg.in @@ -7,14 +7,20 @@ trap onexit TERM trap onexit EXIT TMPDIR= +SUDO= onexit() { if [ ! "$TMPDIR" = "" ]; then - sudo rm -rf $TMPDIR + $SUDO rm -rf $TMPDIR fi } +uid() +{ + id | cut -f2 -d = | cut -f1 -d \(; +} + makedeb() { SUPPLEMENT=$1 @@ -53,7 +59,7 @@ makedeb() /sbin/ldconfig -n $TMPDIR$LIBDIR - sudo chown -Rh root:root $TMPDIR/* + $SUDO chown -Rh root:root $TMPDIR/* dpkg -b $TMPDIR $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb } @@ -66,6 +72,10 @@ PREFIX=%{__prefix} DOCDIR=%{__docdir} LIBDIR=%{__libdir} +if [ ! `uid` -eq 0 ]; then + SUDO=sudo +fi + makedeb 0 if [ "$DEBARCH" = "i386" ]; then makedeb 1; fi From 50a3df621e09905a08e42e072ed846bf21f01801 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 14:19:12 +0000 Subject: [PATCH 974/985] Fix 'make dist' git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1378 632fc199-4ca6-4c93-a231-07263d6284db --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index e34f13e9..1aeb5ddb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,7 +168,7 @@ dist_example_DATA = example.c EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \ - jccolext.c jdcolext.c jdcol565.c jdmrgext.c jstdhuff.c + doxygen-extra.css jccolext.c jdcolext.c jdcol565.c jdmrgext.c jstdhuff.c dist-hook: rm -rf `find $(distdir) -name .svn` From 2d055dc7c755663aac1ee0f64d5c8a00d51943f1 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 14:22:00 +0000 Subject: [PATCH 975/985] 1.4 beta1 git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1379 632fc199-4ca6-4c93-a231-07263d6284db --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c34f45eb..202b5e76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ if(POLICY CMP0022) endif() project(libjpeg-turbo C) -set(VERSION 1.3.80) +set(VERSION 1.3.90) if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) diff --git a/configure.ac b/configure.ac index 64f32655..832e4cfb 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.56]) -AC_INIT([libjpeg-turbo], [1.3.80]) +AC_INIT([libjpeg-turbo], [1.3.90]) BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) From 00696236dfee16597a1dd25ed308e974b6df2e56 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 15:39:32 +0000 Subject: [PATCH 976/985] Windows doesn't have setenv(). Go, go Gadget Macros. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1380 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 76af1f2b..1bf478f1 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -59,6 +59,10 @@ bailif0(_fid=(*env)->GetFieldID(env, _cls, "handle", "J")); \ handle=(tjhandle)(size_t)(*env)->GetLongField(env, obj, _fid); \ +#ifdef _WIN32 +#define setenv(envvar, value, dummy) _putenv_s(envvar, value) +#endif + #define prop2env(property, envvar) \ { \ if((jName=(*env)->NewStringUTF(env, property))!=NULL \ From d0d81e9c3a6f2af2574394bbc1f459c75090665b Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 18:30:44 +0000 Subject: [PATCH 977/985] Revert r1335 and r1336. It was a valiant effort, but on Windows, xmm8-xmm15 are non-volatile, and the overhead of pushing them onto the stack at the beginning of each function and popping them at the end was causing worse performance (in the neighborhood of 3-5%) than just using the work areas and limiting the register usage to xmm0-xmm7. Best to leave the SSE2 code alone. We can optimize the register usage for AVX2, once that port takes place. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1382 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jccolext-sse2-64.asm | 123 ++++--- simd/jcgryext-sse2-64.asm | 75 +++-- simd/jfdctfst-sse2-64.asm | 452 ++++++++++++++------------ simd/jfdctint-sse2-64.asm | 651 +++++++++++++++++++++----------------- 4 files changed, 717 insertions(+), 584 deletions(-) diff --git a/simd/jccolext-sse2-64.asm b/simd/jccolext-sse2-64.asm index 079953ac..7bd6d016 100644 --- a/simd/jccolext-sse2-64.asm +++ b/simd/jccolext-sse2-64.asm @@ -3,7 +3,7 @@ ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. -; Copyright (C) 2009, 2014, D. R. Commander. +; Copyright (C) 2009, D. R. Commander. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), @@ -32,14 +32,21 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 8 + align 16 global EXTN(jsimd_rgb_ycc_convert_sse2) EXTN(jsimd_rgb_ycc_convert_sse2): push rbp - mov rax,rsp - mov rbp,rsp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] collect_args push rbx @@ -283,31 +290,34 @@ EXTN(jsimd_rgb_ycc_convert_sse2): ; Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE ; Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE - movdqa xmm8,xmm0 ; xmm8=RE - movdqa xmm9,xmm1 ; xmm9=RO - movdqa xmm10,xmm4 ; xmm10=BE - movdqa xmm11,xmm5 ; xmm11=BO + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=RE + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=RO + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=BE + movdqa XMMWORD [wk(3)], xmm5 ; wk(3)=BO - movdqa xmm13,xmm1 + movdqa xmm6,xmm1 punpcklwd xmm1,xmm3 - punpckhwd xmm13,xmm3 + punpckhwd xmm6,xmm3 movdqa xmm7,xmm1 - movdqa xmm4,xmm13 + movdqa xmm4,xmm6 pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) - pmaddwd xmm13,[rel PW_F0299_F0337] ; xmm13=ROH*FIX(0.299)+GOH*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) pmaddwd xmm7,[rel PW_MF016_MF033] ; xmm7=ROL*-FIX(0.168)+GOL*-FIX(0.331) pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=ROH*-FIX(0.168)+GOH*-FIX(0.331) - pxor xmm12,xmm12 + movdqa XMMWORD [wk(4)], xmm1 ; wk(4)=ROL*FIX(0.299)+GOL*FIX(0.337) + movdqa XMMWORD [wk(5)], xmm6 ; wk(5)=ROH*FIX(0.299)+GOH*FIX(0.337) + + pxor xmm1,xmm1 pxor xmm6,xmm6 - punpcklwd xmm12,xmm5 ; xmm12=BOL + punpcklwd xmm1,xmm5 ; xmm1=BOL punpckhwd xmm6,xmm5 ; xmm6=BOH - psrld xmm12,1 ; xmm12=BOL*FIX(0.500) + psrld xmm1,1 ; xmm1=BOL*FIX(0.500) psrld xmm6,1 ; xmm6=BOH*FIX(0.500) movdqa xmm5,[rel PD_ONEHALFM1_CJ] ; xmm5=[PD_ONEHALFM1_CJ] - paddd xmm7,xmm12 + paddd xmm7,xmm1 paddd xmm4,xmm6 paddd xmm7,xmm5 paddd xmm4,xmm5 @@ -315,29 +325,34 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm4,SCALEBITS ; xmm4=CbOH packssdw xmm7,xmm4 ; xmm7=CbO - movdqa xmm15,xmm0 + movdqa xmm1, XMMWORD [wk(2)] ; xmm1=BE + + movdqa xmm6,xmm0 punpcklwd xmm0,xmm2 - punpckhwd xmm15,xmm2 + punpckhwd xmm6,xmm2 movdqa xmm5,xmm0 - movdqa xmm4,xmm15 + movdqa xmm4,xmm6 pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) - pmaddwd xmm15,[rel PW_F0299_F0337] ; xmm15=REH*FIX(0.299)+GEH*FIX(0.337) + pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) pmaddwd xmm5,[rel PW_MF016_MF033] ; xmm5=REL*-FIX(0.168)+GEL*-FIX(0.331) pmaddwd xmm4,[rel PW_MF016_MF033] ; xmm4=REH*-FIX(0.168)+GEH*-FIX(0.331) - pxor xmm14,xmm14 + movdqa XMMWORD [wk(6)], xmm0 ; wk(6)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(7)], xmm6 ; wk(7)=REH*FIX(0.299)+GEH*FIX(0.337) + + pxor xmm0,xmm0 pxor xmm6,xmm6 - punpcklwd xmm14,xmm10 ; xmm14=BEL - punpckhwd xmm6,xmm10 ; xmm6=BEH - psrld xmm14,1 ; xmm14=BEL*FIX(0.500) + punpcklwd xmm0,xmm1 ; xmm0=BEL + punpckhwd xmm6,xmm1 ; xmm6=BEH + psrld xmm0,1 ; xmm0=BEL*FIX(0.500) psrld xmm6,1 ; xmm6=BEH*FIX(0.500) - movdqa xmm12,[rel PD_ONEHALFM1_CJ] ; xmm12=[PD_ONEHALFM1_CJ] + movdqa xmm1,[rel PD_ONEHALFM1_CJ] ; xmm1=[PD_ONEHALFM1_CJ] - paddd xmm5,xmm14 + paddd xmm5,xmm0 paddd xmm4,xmm6 - paddd xmm5,xmm12 - paddd xmm4,xmm12 + paddd xmm5,xmm1 + paddd xmm4,xmm1 psrld xmm5,SCALEBITS ; xmm5=CbEL psrld xmm4,SCALEBITS ; xmm4=CbEH packssdw xmm5,xmm4 ; xmm5=CbE @@ -346,30 +361,34 @@ EXTN(jsimd_rgb_ycc_convert_sse2): por xmm5,xmm7 ; xmm5=Cb movdqa XMMWORD [rbx], xmm5 ; Save Cb - movdqa xmm4,xmm11 - punpcklwd xmm11,xmm3 + movdqa xmm0, XMMWORD [wk(3)] ; xmm0=BO + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=BE + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=RO + + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 punpckhwd xmm4,xmm3 - movdqa xmm7,xmm11 + movdqa xmm7,xmm0 movdqa xmm5,xmm4 - pmaddwd xmm11,[rel PW_F0114_F0250] ; xmm11=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) pmaddwd xmm7,[rel PW_MF008_MF041] ; xmm7=BOL*-FIX(0.081)+GOL*-FIX(0.418) pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BOH*-FIX(0.081)+GOH*-FIX(0.418) movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm11, xmm1 - paddd xmm4, xmm13 - paddd xmm11,xmm3 + paddd xmm0, XMMWORD [wk(4)] + paddd xmm4, XMMWORD [wk(5)] + paddd xmm0,xmm3 paddd xmm4,xmm3 - psrld xmm11,SCALEBITS ; xmm11=YOL + psrld xmm0,SCALEBITS ; xmm0=YOL psrld xmm4,SCALEBITS ; xmm4=YOH - packssdw xmm11,xmm4 ; xmm11=YO + packssdw xmm0,xmm4 ; xmm0=YO pxor xmm3,xmm3 pxor xmm4,xmm4 - punpcklwd xmm3,xmm9 ; xmm3=ROL - punpckhwd xmm4,xmm9 ; xmm4=ROH + punpcklwd xmm3,xmm1 ; xmm3=ROL + punpckhwd xmm4,xmm1 ; xmm4=ROH psrld xmm3,1 ; xmm3=ROL*FIX(0.500) psrld xmm4,1 ; xmm4=ROH*FIX(0.500) @@ -383,31 +402,31 @@ EXTN(jsimd_rgb_ycc_convert_sse2): psrld xmm5,SCALEBITS ; xmm5=CrOH packssdw xmm7,xmm5 ; xmm7=CrO - movdqa xmm3, xmm8 ; xmm3=RE + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=RE - movdqa xmm4,xmm10 - punpcklwd xmm10,xmm2 + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 punpckhwd xmm4,xmm2 - movdqa xmm1,xmm10 + movdqa xmm1,xmm6 movdqa xmm5,xmm4 - pmaddwd xmm10,[rel PW_F0114_F0250] ; xmm10=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) pmaddwd xmm1,[rel PW_MF008_MF041] ; xmm1=BEL*-FIX(0.081)+GEL*-FIX(0.418) pmaddwd xmm5,[rel PW_MF008_MF041] ; xmm5=BEH*-FIX(0.081)+GEH*-FIX(0.418) movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm10, xmm0 - paddd xmm4, xmm15 - paddd xmm10,xmm2 + paddd xmm6, XMMWORD [wk(6)] + paddd xmm4, XMMWORD [wk(7)] + paddd xmm6,xmm2 paddd xmm4,xmm2 - psrld xmm10,SCALEBITS ; xmm10=YEL + psrld xmm6,SCALEBITS ; xmm6=YEL psrld xmm4,SCALEBITS ; xmm4=YEH - packssdw xmm10,xmm4 ; xmm10=YE + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm11,BYTE_BIT - por xmm10,xmm11 ; xmm10=Y - movdqa XMMWORD [rdi], xmm10 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [rdi], xmm6 ; Save Y pxor xmm2,xmm2 pxor xmm4,xmm4 @@ -456,6 +475,8 @@ EXTN(jsimd_rgb_ycc_convert_sse2): .return: pop rbx uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp pop rbp ret diff --git a/simd/jcgryext-sse2-64.asm b/simd/jcgryext-sse2-64.asm index abdd9a06..5af02e04 100644 --- a/simd/jcgryext-sse2-64.asm +++ b/simd/jcgryext-sse2-64.asm @@ -3,7 +3,7 @@ ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. -; Copyright (C) 2011, 2014, D. R. Commander. +; Copyright (C) 2011, D. R. Commander. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), @@ -32,14 +32,21 @@ ; r13 = JDIMENSION output_row ; r14 = int num_rows +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + align 16 global EXTN(jsimd_rgb_gray_convert_sse2) EXTN(jsimd_rgb_gray_convert_sse2): push rbp - mov rax,rsp - mov rbp,rsp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] collect_args push rbx @@ -277,7 +284,7 @@ EXTN(jsimd_rgb_gray_convert_sse2): pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337) - movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) + movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337) movdqa xmm6,xmm0 punpcklwd xmm0,xmm2 @@ -285,41 +292,47 @@ EXTN(jsimd_rgb_gray_convert_sse2): pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337) pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337) - movdqa xmm12,xmm5 - punpcklwd xmm5,xmm3 - punpckhwd xmm12,xmm3 - pmaddwd xmm5,[rel PW_F0114_F0250] ; xmm5=BOL*FIX(0.114)+GOL*FIX(0.250) - pmaddwd xmm12,[rel PW_F0114_F0250] ; xmm12=BOH*FIX(0.114)+GOH*FIX(0.250) + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) + + movdqa xmm0, xmm5 ; xmm0=BO + movdqa xmm6, xmm4 ; xmm6=BE + + movdqa xmm4,xmm0 + punpcklwd xmm0,xmm3 + punpckhwd xmm4,xmm3 + pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250) movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF] - paddd xmm5, xmm1 - paddd xmm12, xmm7 - paddd xmm5,xmm3 - paddd xmm12,xmm3 - psrld xmm5,SCALEBITS ; xmm5=YOL - psrld xmm12,SCALEBITS ; xmm12=YOH - packssdw xmm5,xmm12 ; xmm5=YO + paddd xmm0, xmm1 + paddd xmm4, xmm7 + paddd xmm0,xmm3 + paddd xmm4,xmm3 + psrld xmm0,SCALEBITS ; xmm0=YOL + psrld xmm4,SCALEBITS ; xmm4=YOH + packssdw xmm0,xmm4 ; xmm0=YO - movdqa xmm12,xmm4 - punpcklwd xmm4,xmm2 - punpckhwd xmm12,xmm2 - pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEL*FIX(0.114)+GEL*FIX(0.250) - pmaddwd xmm12,[rel PW_F0114_F0250] ; xmm12=BEH*FIX(0.114)+GEH*FIX(0.250) + movdqa xmm4,xmm6 + punpcklwd xmm6,xmm2 + punpckhwd xmm4,xmm2 + pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250) + pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250) movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF] - paddd xmm4,xmm0 ; xmm4=REL*FIX(0.299)+GEL*FIX(0.337) - paddd xmm12,xmm6 ; xmm12=REH*FIX(0.299)+GEH*FIX(0.337) + paddd xmm6, XMMWORD [wk(0)] + paddd xmm4, XMMWORD [wk(1)] + paddd xmm6,xmm2 paddd xmm4,xmm2 - paddd xmm12,xmm2 - psrld xmm4,SCALEBITS ; xmm4=YEL - psrld xmm12,SCALEBITS ; xmm12=YEH - packssdw xmm4,xmm12 ; xmm4=YE + psrld xmm6,SCALEBITS ; xmm6=YEL + psrld xmm4,SCALEBITS ; xmm4=YEH + packssdw xmm6,xmm4 ; xmm6=YE - psllw xmm5,BYTE_BIT - por xmm4,xmm5 ; xmm4=Y - movdqa XMMWORD [rdi], xmm4 ; Save Y + psllw xmm0,BYTE_BIT + por xmm6,xmm0 ; xmm6=Y + movdqa XMMWORD [rdi], xmm6 ; Save Y sub rcx, byte SIZEOF_XMMWORD add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr @@ -341,6 +354,8 @@ EXTN(jsimd_rgb_gray_convert_sse2): .return: pop rbx uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp pop rbp ret diff --git a/simd/jfdctfst-sse2-64.asm b/simd/jfdctfst-sse2-64.asm index fe87fccd..13c4efc0 100644 --- a/simd/jfdctfst-sse2-64.asm +++ b/simd/jfdctfst-sse2-64.asm @@ -2,7 +2,7 @@ ; jfdctfst.asm - fast integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB -; Copyright 2009, 2014, D. R. Commander +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -76,276 +76,314 @@ PW_F1306 times 8 dw F_1_306 << CONST_SHIFT ; r10 = DCTELEM * data +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 2 + align 16 global EXTN(jsimd_fdct_ifast_sse2) EXTN(jsimd_fdct_ifast_sse2): push rbp - mov rax,rsp - mov rbp,rsp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] collect_args ; ---- Pass 1: process rows. mov rdx, r10 ; (DCTELEM *) - movdqa xmm8, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm9, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm11, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm4, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm13, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm5, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm15, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - ; xmm8=(00 01 02 03 04 05 06 07), xmm9=(10 11 12 13 14 15 16 17) - ; xmm2=(20 21 22 23 24 25 26 27), xmm11=(30 31 32 33 34 35 36 37) - ; xmm4=(40 41 42 43 44 45 46 47), xmm13=(50 51 52 53 54 55 56 57) - ; xmm5=(60 61 62 63 64 65 66 67), xmm15=(70 71 72 73 74 75 76 77) + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - movdqa xmm12,xmm8 ; transpose coefficients(phase 1) - punpcklwd xmm8,xmm9 ; xmm8=(00 10 01 11 02 12 03 13) - punpckhwd xmm12,xmm9 ; xmm12=(04 14 05 15 06 16 07 17) - movdqa xmm1,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm11 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm1,xmm11 ; xmm1=(24 34 25 35 26 36 27 37) + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm13 ; xmm4=(40 50 41 51 42 52 43 53) - punpckhwd xmm0,xmm13 ; xmm0=(44 54 45 55 46 56 47 57) - movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm15 ; xmm5=(60 70 61 71 62 72 63 73) - punpckhwd xmm3,xmm15 ; xmm3=(64 74 65 75 66 76 67 77) + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm10,xmm8 ; transpose coefficients(phase 2) - punpckldq xmm8,xmm2 ; xmm8=(00 10 20 30 01 11 21 31) - punpckhdq xmm10,xmm2 ; xmm10=(02 12 22 32 03 13 23 33) - movdqa xmm14,xmm12 ; transpose coefficients(phase 2) - punpckldq xmm12,xmm1 ; xmm12=(04 14 24 34 05 15 25 35) - punpckhdq xmm14,xmm1 ; xmm14=(06 16 26 36 07 17 27 37) + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(1)], xmm2 ; wk(1)=(44 54 64 74 45 55 65 75) - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(40 50 60 70 41 51 61 71) - punpckhdq xmm6,xmm5 ; xmm6=(42 52 62 72 43 53 63 73) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(44 54 64 74 45 55 65 75) - punpckhdq xmm7,xmm3 ; xmm7=(46 56 66 76 47 57 67 77) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - movdqa xmm9,xmm8 ; transpose coefficients(phase 3) - punpcklqdq xmm8,xmm4 ; xmm8=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm9,xmm4 ; xmm9=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm11,xmm10 ; transpose coefficients(phase 3) - punpcklqdq xmm10,xmm6 ; xmm10=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm11,xmm6 ; xmm11=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm13,xmm12 ; transpose coefficients(phase 3) - punpcklqdq xmm12,xmm0 ; xmm12=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm13,xmm0 ; xmm13=(05 15 25 35 45 55 65 75)=data5 - movdqa xmm15,xmm14 ; transpose coefficients(phase 3) - punpcklqdq xmm14,xmm7 ; xmm14=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm15,xmm7 ; xmm15=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - movdqa xmm0,xmm8 - paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 - movdqa xmm1,xmm9 - paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 - movdqa xmm2,xmm10 - paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 - movdqa xmm3,xmm11 - paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 + movdqa xmm2, XMMWORD [wk(0)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 - psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 - psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 - psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 ; -- Even part - movdqa xmm4,xmm0 - paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 - movdqa xmm5,xmm1 - paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 - psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 - psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + psubw xmm3,xmm1 ; xmm3=tmp13 + psubw xmm6,xmm7 ; xmm6=tmp12 + paddw xmm4,xmm1 ; xmm4=tmp10 + paddw xmm0,xmm7 ; xmm0=tmp11 - paddw xmm1,xmm0 ; xmm1=tmp12+tmp13 - psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm1,[rel PW_F0707] ; xmm1=z1 + paddw xmm6,xmm3 + psllw xmm6,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm6,[rel PW_F0707] ; xmm6=z1 - movdqa xmm12,xmm4 - paddw xmm12,xmm5 ; xmm12=tmp10+tmp11=out0 - movdqa xmm14,xmm0 - paddw xmm14,xmm1 ; xmm14=tmp13+z1=out2 - psubw xmm4,xmm5 ; xmm4=tmp10-tmp11=out4 - psubw xmm0,xmm1 ; xmm0=tmp13-z1=out6 + movdqa xmm1,xmm4 + movdqa xmm7,xmm3 + psubw xmm4,xmm0 ; xmm4=data4 + psubw xmm3,xmm6 ; xmm3=data6 + paddw xmm1,xmm0 ; xmm1=data0 + paddw xmm7,xmm6 ; xmm7=data2 + + movdqa xmm0, XMMWORD [wk(0)] ; xmm0=tmp6 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=tmp7 + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=data4 + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=data6 ; -- Odd part - paddw xmm11,xmm10 ; xmm11=tmp4+tmp5=tmp10 - paddw xmm10,xmm9 ; xmm10=tmp5+tmp6=tmp11 - paddw xmm9,xmm8 ; xmm9=tmp6+tmp7=tmp12 + paddw xmm2,xmm5 ; xmm2=tmp10 + paddw xmm5,xmm0 ; xmm5=tmp11 + paddw xmm0,xmm6 ; xmm0=tmp12, xmm6=tmp7 - psllw xmm11,PRE_MULTIPLY_SCALE_BITS - psllw xmm10,PRE_MULTIPLY_SCALE_BITS - psllw xmm9,PRE_MULTIPLY_SCALE_BITS + psllw xmm2,PRE_MULTIPLY_SCALE_BITS + psllw xmm0,PRE_MULTIPLY_SCALE_BITS - movdqa xmm5,xmm11 - psubw xmm5,xmm9 ; xmm5=tmp10-tmp12 - pmulhw xmm5,[rel PW_F0382] ; xmm5=z5 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[rel PW_F0707] ; xmm5=z3 - pmulhw xmm11,[rel PW_F0541] ; xmm11=MULTIPLY(tmp10,FIX_0_541196) - paddw xmm11,xmm5 ; +z5=z2 + movdqa xmm4,xmm2 ; xmm4=tmp10 + psubw xmm2,xmm0 + pmulhw xmm2,[rel PW_F0382] ; xmm2=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm0,[rel PW_F1306] ; xmm0=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm2 ; xmm4=z2 + paddw xmm0,xmm2 ; xmm0=z4 - pmulhw xmm9,[rel PW_F1306] ; xmm9=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm9,xmm5 ; +z5=z4 + movdqa xmm3,xmm6 + psubw xmm6,xmm5 ; xmm6=z13 + paddw xmm3,xmm5 ; xmm3=z11 - pmulhw xmm10,[rel PW_F0707] ; xmm10=MULTIPLY(tmp11,FIX_1_306562)=z3 - - movdqa xmm1,xmm8 - paddw xmm1,xmm10 ; xmm1=tmp7+z3=z11 - psubw xmm8,xmm10 ; xmm8=tmp7-z3=z13 - - movdqa xmm13,xmm8 - paddw xmm13,xmm11 ; xmm13=z13+z2=out5 - movdqa xmm15,xmm1 - psubw xmm15,xmm9 ; xmm15=z11-z4=out7 - paddw xmm9,xmm1 ; xmm9=z11+z4=out1 - psubw xmm8,xmm11 ; xmm8=z13-z2=out3 + movdqa xmm2,xmm6 + movdqa xmm5,xmm3 + psubw xmm6,xmm4 ; xmm6=data3 + psubw xmm3,xmm0 ; xmm3=data7 + paddw xmm2,xmm4 ; xmm2=data5 + paddw xmm5,xmm0 ; xmm5=data1 ; ---- Pass 2: process columns. - ; Re-order registers so we can reuse the same transpose code - movdqa xmm11,xmm8 - movdqa xmm8,xmm12 - movdqa xmm2,xmm14 - movdqa xmm5,xmm0 + ; xmm1=(00 10 20 30 40 50 60 70), xmm7=(02 12 22 32 42 52 62 72) + ; xmm5=(01 11 21 31 41 51 61 71), xmm6=(03 13 23 33 43 53 63 73) - ; xmm8=(00 10 20 30 40 50 60 70), xmm9=(01 11 21 31 41 51 61 71) - ; xmm2=(02 12 22 32 42 52 62 72), xmm11=(03 13 23 33 43 53 63 73) - ; xmm4=(04 14 24 34 44 54 64 74), xmm13=(05 15 25 35 45 55 65 75) - ; xmm5=(06 16 26 36 46 56 66 76), xmm15=(07 17 27 37 47 57 67 77) + movdqa xmm4,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm5 ; xmm1=(00 01 10 11 20 21 30 31) + punpckhwd xmm4,xmm5 ; xmm4=(40 41 50 51 60 61 70 71) + movdqa xmm0,xmm7 ; transpose coefficients(phase 1) + punpcklwd xmm7,xmm6 ; xmm7=(02 03 12 13 22 23 32 33) + punpckhwd xmm0,xmm6 ; xmm0=(42 43 52 53 62 63 72 73) - movdqa xmm12,xmm8 ; transpose coefficients(phase 1) - punpcklwd xmm8,xmm9 ; xmm8=(00 01 10 11 20 21 30 31) - punpckhwd xmm12,xmm9 ; xmm12=(40 41 50 51 60 61 70 71) - movdqa xmm1,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm11 ; xmm2=(02 03 12 13 22 23 32 33) - punpckhwd xmm1,xmm11 ; xmm1=(42 43 52 53 62 63 72 73) + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=col4 + movdqa xmm6, XMMWORD [wk(1)] ; xmm6=col6 - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm13 ; xmm4=(04 05 14 15 24 25 34 35) - punpckhwd xmm0,xmm13 ; xmm0=(44 45 54 55 64 65 74 75) - movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm15 ; xmm5=(06 07 16 17 26 27 36 37) - punpckhwd xmm3,xmm15 ; xmm3=(46 47 56 57 66 67 76 77) + ; xmm5=(04 14 24 34 44 54 64 74), xmm6=(06 16 26 36 46 56 66 76) + ; xmm2=(05 15 25 35 45 55 65 75), xmm3=(07 17 27 37 47 57 67 77) - movdqa xmm10,xmm8 ; transpose coefficients(phase 2) - punpckldq xmm8,xmm2 ; xmm8=(00 01 02 03 10 11 12 13) - punpckhdq xmm10,xmm2 ; xmm10=(20 21 22 23 30 31 32 33) - movdqa xmm14,xmm12 ; transpose coefficients(phase 2) - punpckldq xmm12,xmm1 ; xmm12=(40 41 42 43 50 51 52 53) - punpckhdq xmm14,xmm1 ; xmm14=(60 61 62 63 70 71 72 73) + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(42 43 52 53 62 63 72 73) - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 05 06 07 14 15 16 17) - punpckhdq xmm6,xmm5 ; xmm6=(24 25 26 27 34 35 36 37) - movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) - punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) + movdqa xmm7,xmm5 ; transpose coefficients(phase 1) + punpcklwd xmm5,xmm2 ; xmm5=(04 05 14 15 24 25 34 35) + punpckhwd xmm7,xmm2 ; xmm7=(44 45 54 55 64 65 74 75) + movdqa xmm0,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm3 ; xmm6=(06 07 16 17 26 27 36 37) + punpckhwd xmm0,xmm3 ; xmm0=(46 47 56 57 66 67 76 77) - movdqa xmm9,xmm8 ; transpose coefficients(phase 3) - punpcklqdq xmm8,xmm4 ; xmm8=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm9,xmm4 ; xmm9=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm11,xmm10 ; transpose coefficients(phase 3) - punpcklqdq xmm10,xmm6 ; xmm10=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm11,xmm6 ; xmm11=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm2,xmm5 ; transpose coefficients(phase 2) + punpckldq xmm5,xmm6 ; xmm5=(04 05 06 07 14 15 16 17) + punpckhdq xmm2,xmm6 ; xmm2=(24 25 26 27 34 35 36 37) + movdqa xmm3,xmm7 ; transpose coefficients(phase 2) + punpckldq xmm7,xmm0 ; xmm7=(44 45 46 47 54 55 56 57) + punpckhdq xmm3,xmm0 ; xmm3=(64 65 66 67 74 75 76 77) - movdqa xmm13,xmm12 ; transpose coefficients(phase 3) - punpcklqdq xmm12,xmm0 ; xmm12=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm13,xmm0 ; xmm13=(50 51 52 53 54 55 56 57)=data5 - movdqa xmm15,xmm14 ; transpose coefficients(phase 3) - punpcklqdq xmm14,xmm7 ; xmm14=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm15,xmm7 ; xmm15=(70 71 72 73 74 75 76 77)=data7 + movdqa xmm6, XMMWORD [wk(0)] ; xmm6=(02 03 12 13 22 23 32 33) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=(44 45 46 47 54 55 56 57) - movdqa xmm0,xmm8 - paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 - movdqa xmm1,xmm9 - paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 - movdqa xmm2,xmm10 - paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 - movdqa xmm3,xmm11 - paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 + movdqa xmm2,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm6 ; xmm1=(00 01 02 03 10 11 12 13) + punpckhdq xmm2,xmm6 ; xmm2=(20 21 22 23 30 31 32 33) + movdqa xmm7,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm0 ; xmm4=(40 41 42 43 50 51 52 53) + punpckhdq xmm7,xmm0 ; xmm7=(60 61 62 63 70 71 72 73) - psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 - psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 - psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 - psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm5 ; xmm1=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm6,xmm5 ; xmm6=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm0,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm3 ; xmm7=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm0,xmm3 ; xmm0=(70 71 72 73 74 75 76 77)=data7 + + movdqa xmm5,xmm6 + movdqa xmm3,xmm1 + psubw xmm6,xmm7 ; xmm6=data1-data6=tmp6 + psubw xmm1,xmm0 ; xmm1=data0-data7=tmp7 + paddw xmm5,xmm7 ; xmm5=data1+data6=tmp1 + paddw xmm3,xmm0 ; xmm3=data0+data7=tmp0 + + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=(24 25 26 27 34 35 36 37) + movdqa xmm0, XMMWORD [wk(1)] ; xmm0=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm6 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=tmp7 + + movdqa xmm6,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm7 ; xmm2=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm6,xmm7 ; xmm6=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm1,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm1,xmm0 ; xmm1=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm7,xmm6 + movdqa xmm0,xmm2 + paddw xmm6,xmm4 ; xmm6=data3+data4=tmp3 + paddw xmm2,xmm1 ; xmm2=data2+data5=tmp2 + psubw xmm7,xmm4 ; xmm7=data3-data4=tmp4 + psubw xmm0,xmm1 ; xmm0=data2-data5=tmp5 ; -- Even part - movdqa xmm4,xmm0 - paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 - movdqa xmm5,xmm1 - paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 - psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 - psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 + movdqa xmm4,xmm3 + movdqa xmm1,xmm5 + psubw xmm3,xmm6 ; xmm3=tmp13 + psubw xmm5,xmm2 ; xmm5=tmp12 + paddw xmm4,xmm6 ; xmm4=tmp10 + paddw xmm1,xmm2 ; xmm1=tmp11 - paddw xmm1,xmm0 ; xmm1=tmp12+tmp13 - psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm1,[rel PW_F0707] ; xmm1=z1 + paddw xmm5,xmm3 + psllw xmm5,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm5,[rel PW_F0707] ; xmm5=z1 - movdqa xmm12,xmm4 - paddw xmm12,xmm5 ; xmm12=tmp10+tmp11=out0 - movdqa xmm14,xmm0 - paddw xmm14,xmm1 ; xmm14=tmp13+z1=out2 - psubw xmm4,xmm5 ; xmm4=tmp10-tmp11=out4 - psubw xmm0,xmm1 ; xmm0=tmp13-z1=out6 + movdqa xmm6,xmm4 + movdqa xmm2,xmm3 + psubw xmm4,xmm1 ; xmm4=data4 + psubw xmm3,xmm5 ; xmm3=data6 + paddw xmm6,xmm1 ; xmm6=data0 + paddw xmm2,xmm5 ; xmm2=data2 + + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 ; -- Odd part - paddw xmm11,xmm10 ; xmm11=tmp4+tmp5=tmp10 - paddw xmm10,xmm9 ; xmm10=tmp5+tmp6=tmp11 - paddw xmm9,xmm8 ; xmm9=tmp6+tmp7=tmp12 + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 - psllw xmm11,PRE_MULTIPLY_SCALE_BITS - psllw xmm10,PRE_MULTIPLY_SCALE_BITS - psllw xmm9,PRE_MULTIPLY_SCALE_BITS + paddw xmm7,xmm0 ; xmm7=tmp10 + paddw xmm0,xmm1 ; xmm0=tmp11 + paddw xmm1,xmm5 ; xmm1=tmp12, xmm5=tmp7 - movdqa xmm5,xmm11 - psubw xmm5,xmm9 ; xmm5=tmp10-tmp12 - pmulhw xmm5,[rel PW_F0382] ; xmm5=z5 + psllw xmm7,PRE_MULTIPLY_SCALE_BITS + psllw xmm1,PRE_MULTIPLY_SCALE_BITS - pmulhw xmm11,[rel PW_F0541] ; xmm11=MULTIPLY(tmp10,FIX_0_541196) - paddw xmm11,xmm5 ; +z5=z2 + psllw xmm0,PRE_MULTIPLY_SCALE_BITS + pmulhw xmm0,[rel PW_F0707] ; xmm0=z3 - pmulhw xmm9,[rel PW_F1306] ; xmm9=MULTIPLY(tmp12,FIX_1_306562) - paddw xmm9,xmm5 ; +z5=z4 + movdqa xmm4,xmm7 ; xmm4=tmp10 + psubw xmm7,xmm1 + pmulhw xmm7,[rel PW_F0382] ; xmm7=z5 + pmulhw xmm4,[rel PW_F0541] ; xmm4=MULTIPLY(tmp10,FIX_0_541196) + pmulhw xmm1,[rel PW_F1306] ; xmm1=MULTIPLY(tmp12,FIX_1_306562) + paddw xmm4,xmm7 ; xmm4=z2 + paddw xmm1,xmm7 ; xmm1=z4 - pmulhw xmm10,[rel PW_F0707] ; xmm10=MULTIPLY(tmp11,FIX_1_306562)=z3 + movdqa xmm3,xmm5 + psubw xmm5,xmm0 ; xmm5=z13 + paddw xmm3,xmm0 ; xmm3=z11 - movdqa xmm1,xmm8 - paddw xmm1,xmm10 ; xmm1=tmp7+z3=z11 - psubw xmm8,xmm10 ; xmm8=tmp7-z3=z13 + movdqa xmm6,xmm5 + movdqa xmm2,xmm3 + psubw xmm5,xmm4 ; xmm5=data3 + psubw xmm3,xmm1 ; xmm3=data7 + paddw xmm6,xmm4 ; xmm6=data5 + paddw xmm2,xmm1 ; xmm2=data1 - movdqa xmm13,xmm8 - paddw xmm13,xmm11 ; xmm13=z13+z2=out5 - movdqa xmm15,xmm1 - psubw xmm15,xmm9 ; xmm15=z11-z4=out7 - paddw xmm9,xmm1 ; xmm9=z11+z4=out1 - psubw xmm8,xmm11 ; xmm8=z13-z2=out3 - - ; -- Write result - - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm12 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm9 - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm14 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm8 - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm13 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm0 - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm5 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm3 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2 uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp pop rbp ret diff --git a/simd/jfdctint-sse2-64.asm b/simd/jfdctint-sse2-64.asm index 996a53b3..53ec5276 100644 --- a/simd/jfdctint-sse2-64.asm +++ b/simd/jfdctint-sse2-64.asm @@ -2,7 +2,7 @@ ; jfdctint.asm - accurate integer FDCT (64-bit SSE2) ; ; Copyright 2009 Pierre Ossman for Cendio AB -; Copyright 2009, 2014, D. R. Commander +; Copyright 2009 D. R. Commander ; ; Based on ; x86 SIMD extension for IJG JPEG library @@ -97,143 +97,174 @@ PW_DESCALE_P2X times 8 dw 1 << (PASS1_BITS-1) ; r10 = DCTELEM * data +%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] +%define WK_NUM 6 + align 16 global EXTN(jsimd_fdct_islow_sse2) EXTN(jsimd_fdct_islow_sse2): push rbp - mov rax,rsp - mov rbp,rsp + mov rax,rsp ; rax = original rbp + sub rsp, byte 4 + and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits + mov [rsp],rax + mov rbp,rsp ; rbp = aligned rbp + lea rsp, [wk(0)] collect_args ; ---- Pass 1: process rows. mov rdx, r10 ; (DCTELEM *) - movdqa xmm8, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm9, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)] movdqa xmm2, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm11, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm4, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm13, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm5, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm15, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)] - ; xmm8=(00 01 02 03 04 05 06 07), xmm9=(10 11 12 13 14 15 16 17) - ; xmm2=(20 21 22 23 24 25 26 27), xmm11=(30 31 32 33 34 35 36 37) - ; xmm4=(40 41 42 43 44 45 46 47), xmm13=(50 51 52 53 54 55 56 57) - ; xmm5=(60 61 62 63 64 65 66 67), xmm15=(70 71 72 73 74 75 76 77) + ; xmm0=(00 01 02 03 04 05 06 07), xmm2=(20 21 22 23 24 25 26 27) + ; xmm1=(10 11 12 13 14 15 16 17), xmm3=(30 31 32 33 34 35 36 37) - movdqa xmm12,xmm8 ; transpose coefficients(phase 1) - punpcklwd xmm8,xmm9 ; xmm8=(00 10 01 11 02 12 03 13) - punpckhwd xmm12,xmm9 ; xmm12=(04 14 05 15 06 16 07 17) - movdqa xmm1,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm11 ; xmm2=(20 30 21 31 22 32 23 33) - punpckhwd xmm1,xmm11 ; xmm1=(24 34 25 35 26 36 27 37) + movdqa xmm4,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm1 ; xmm0=(00 10 01 11 02 12 03 13) + punpckhwd xmm4,xmm1 ; xmm4=(04 14 05 15 06 16 07 17) + movdqa xmm5,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm3 ; xmm2=(20 30 21 31 22 32 23 33) + punpckhwd xmm5,xmm3 ; xmm5=(24 34 25 35 26 36 27 37) - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm13 ; xmm4=(40 50 41 51 42 52 43 53) - punpckhwd xmm0,xmm13 ; xmm0=(44 54 45 55 46 56 47 57) - movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm15 ; xmm5=(60 70 61 71 62 72 63 73) - punpckhwd xmm3,xmm15 ; xmm3=(64 74 65 75 66 76 67 77) + movdqa xmm6, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm7, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm1, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)] + movdqa xmm3, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)] - movdqa xmm10,xmm8 ; transpose coefficients(phase 2) - punpckldq xmm8,xmm2 ; xmm8=(00 10 20 30 01 11 21 31) - punpckhdq xmm10,xmm2 ; xmm10=(02 12 22 32 03 13 23 33) - movdqa xmm14,xmm12 ; transpose coefficients(phase 2) - punpckldq xmm12,xmm1 ; xmm12=(04 14 24 34 05 15 25 35) - punpckhdq xmm14,xmm1 ; xmm14=(06 16 26 36 07 17 27 37) + ; xmm6=( 4 12 20 28 36 44 52 60), xmm1=( 6 14 22 30 38 46 54 62) + ; xmm7=( 5 13 21 29 37 45 53 61), xmm3=( 7 15 23 31 39 47 55 63) + + movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=(20 30 21 31 22 32 23 33) + movdqa XMMWORD [wk(1)], xmm5 ; wk(1)=(24 34 25 35 26 36 27 37) + + movdqa xmm2,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm7 ; xmm6=(40 50 41 51 42 52 43 53) + punpckhwd xmm2,xmm7 ; xmm2=(44 54 45 55 46 56 47 57) + movdqa xmm5,xmm1 ; transpose coefficients(phase 1) + punpcklwd xmm1,xmm3 ; xmm1=(60 70 61 71 62 72 63 73) + punpckhwd xmm5,xmm3 ; xmm5=(64 74 65 75 66 76 67 77) + + movdqa xmm7,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm1 ; xmm6=(40 50 60 70 41 51 61 71) + punpckhdq xmm7,xmm1 ; xmm7=(42 52 62 72 43 53 63 73) + movdqa xmm3,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(44 54 64 74 45 55 65 75) + punpckhdq xmm3,xmm5 ; xmm3=(46 56 66 76 47 57 67 77) + + movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(20 30 21 31 22 32 23 33) + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=(24 34 25 35 26 36 27 37) + movdqa XMMWORD [wk(2)], xmm7 ; wk(2)=(42 52 62 72 43 53 63 73) + movdqa XMMWORD [wk(3)], xmm2 ; wk(3)=(44 54 64 74 45 55 65 75) - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(40 50 60 70 41 51 61 71) - punpckhdq xmm6,xmm5 ; xmm6=(42 52 62 72 43 53 63 73) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) - punpckldq xmm0,xmm3 ; xmm0=(44 54 64 74 45 55 65 75) - punpckhdq xmm7,xmm3 ; xmm7=(46 56 66 76 47 57 67 77) + punpckldq xmm0,xmm1 ; xmm0=(00 10 20 30 01 11 21 31) + punpckhdq xmm7,xmm1 ; xmm7=(02 12 22 32 03 13 23 33) + movdqa xmm2,xmm4 ; transpose coefficients(phase 2) + punpckldq xmm4,xmm5 ; xmm4=(04 14 24 34 05 15 25 35) + punpckhdq xmm2,xmm5 ; xmm2=(06 16 26 36 07 17 27 37) - movdqa xmm9,xmm8 ; transpose coefficients(phase 3) - punpcklqdq xmm8,xmm4 ; xmm8=(00 10 20 30 40 50 60 70)=data0 - punpckhqdq xmm9,xmm4 ; xmm9=(01 11 21 31 41 51 61 71)=data1 - movdqa xmm11,xmm10 ; transpose coefficients(phase 3) - punpcklqdq xmm10,xmm6 ; xmm10=(02 12 22 32 42 52 62 72)=data2 - punpckhqdq xmm11,xmm6 ; xmm11=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm1,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm6 ; xmm0=(00 10 20 30 40 50 60 70)=data0 + punpckhqdq xmm1,xmm6 ; xmm1=(01 11 21 31 41 51 61 71)=data1 + movdqa xmm5,xmm2 ; transpose coefficients(phase 3) + punpcklqdq xmm2,xmm3 ; xmm2=(06 16 26 36 46 56 66 76)=data6 + punpckhqdq xmm5,xmm3 ; xmm5=(07 17 27 37 47 57 67 77)=data7 - movdqa xmm13,xmm12 ; transpose coefficients(phase 3) - punpcklqdq xmm12,xmm0 ; xmm12=(04 14 24 34 44 54 64 74)=data4 - punpckhqdq xmm13,xmm0 ; xmm13=(05 15 25 35 45 55 65 75)=data5 - movdqa xmm15,xmm14 ; transpose coefficients(phase 3) - punpcklqdq xmm14,xmm7 ; xmm14=(06 16 26 36 46 56 66 76)=data6 - punpckhqdq xmm15,xmm7 ; xmm15=(07 17 27 37 47 57 67 77)=data7 + movdqa xmm6,xmm1 + movdqa xmm3,xmm0 + psubw xmm1,xmm2 ; xmm1=data1-data6=tmp6 + psubw xmm0,xmm5 ; xmm0=data0-data7=tmp7 + paddw xmm6,xmm2 ; xmm6=data1+data6=tmp1 + paddw xmm3,xmm5 ; xmm3=data0+data7=tmp0 - movdqa xmm0,xmm8 - paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 - movdqa xmm1,xmm9 - paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 - movdqa xmm2,xmm10 - paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 - movdqa xmm3,xmm11 - paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 + movdqa xmm2, XMMWORD [wk(2)] ; xmm2=(42 52 62 72 43 53 63 73) + movdqa xmm5, XMMWORD [wk(3)] ; xmm5=(44 54 64 74 45 55 65 75) + movdqa XMMWORD [wk(0)], xmm1 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=tmp7 - psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 - psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 - psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 - psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 + movdqa xmm1,xmm7 ; transpose coefficients(phase 3) + punpcklqdq xmm7,xmm2 ; xmm7=(02 12 22 32 42 52 62 72)=data2 + punpckhqdq xmm1,xmm2 ; xmm1=(03 13 23 33 43 53 63 73)=data3 + movdqa xmm0,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm5 ; xmm4=(04 14 24 34 44 54 64 74)=data4 + punpckhqdq xmm0,xmm5 ; xmm0=(05 15 25 35 45 55 65 75)=data5 + + movdqa xmm2,xmm1 + movdqa xmm5,xmm7 + paddw xmm1,xmm4 ; xmm1=data3+data4=tmp3 + paddw xmm7,xmm0 ; xmm7=data2+data5=tmp2 + psubw xmm2,xmm4 ; xmm2=data3-data4=tmp4 + psubw xmm5,xmm0 ; xmm5=data2-data5=tmp5 ; -- Even part - movdqa xmm4,xmm0 - paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 - movdqa xmm5,xmm1 - paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 - psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 - psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 + movdqa xmm4,xmm3 + movdqa xmm0,xmm6 + paddw xmm3,xmm1 ; xmm3=tmp10 + paddw xmm6,xmm7 ; xmm6=tmp11 + psubw xmm4,xmm1 ; xmm4=tmp13 + psubw xmm0,xmm7 ; xmm0=tmp12 - movdqa xmm12,xmm4 - paddw xmm12,xmm5 ; xmm12=tmp10+tmp11 - psubw xmm4,xmm5 ; xmm4=tmp10-tmp11 + movdqa xmm1,xmm3 + paddw xmm3,xmm6 ; xmm3=tmp10+tmp11 + psubw xmm1,xmm6 ; xmm1=tmp10-tmp11 - psllw xmm12,PASS1_BITS ; xmm12=out0 - psllw xmm4,PASS1_BITS ; xmm4=out4 + psllw xmm3,PASS1_BITS ; xmm3=data0 + psllw xmm1,PASS1_BITS ; xmm1=data4 + + movdqa XMMWORD [wk(2)], xmm3 ; wk(2)=data0 + movdqa XMMWORD [wk(3)], xmm1 ; wk(3)=data4 ; (Original) ; z1 = (tmp12 + tmp13) * 0.541196100; - ; out2 = z1 + tmp13 * 0.765366865; - ; out6 = z1 + tmp12 * -1.847759065; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; ; ; (This implementation) - ; out2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; out6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movdqa xmm2,xmm0 ; xmm0=tmp13 - movdqa xmm6,xmm0 - punpcklwd xmm2,xmm1 ; xmm1=tmp12 - punpckhwd xmm6,xmm1 - movdqa xmm5,xmm2 + movdqa xmm7,xmm4 ; xmm4=tmp13 + movdqa xmm6,xmm4 + punpcklwd xmm7,xmm0 ; xmm0=tmp12 + punpckhwd xmm6,xmm0 + movdqa xmm4,xmm7 movdqa xmm0,xmm6 - pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=out2L - pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=out2H - pmaddwd xmm5,[rel PW_F054_MF130] ; xmm5=out6L - pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=out6H + pmaddwd xmm7,[rel PW_F130_F054] ; xmm7=data2L + pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=data2H + pmaddwd xmm4,[rel PW_F054_MF130] ; xmm4=data6L + pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=data6H - paddd xmm2,[rel PD_DESCALE_P1] + paddd xmm7,[rel PD_DESCALE_P1] paddd xmm6,[rel PD_DESCALE_P1] - psrad xmm2,DESCALE_P1 + psrad xmm7,DESCALE_P1 psrad xmm6,DESCALE_P1 - paddd xmm5,[rel PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] paddd xmm0,[rel PD_DESCALE_P1] - psrad xmm5,DESCALE_P1 + psrad xmm4,DESCALE_P1 psrad xmm0,DESCALE_P1 - packssdw xmm2,xmm6 ; xmm2=out2 - packssdw xmm5,xmm0 ; xmm5=out6 + packssdw xmm7,xmm6 ; xmm7=data2 + packssdw xmm4,xmm0 ; xmm4=data6 + + movdqa XMMWORD [wk(4)], xmm7 ; wk(4)=data2 + movdqa XMMWORD [wk(5)], xmm4 ; wk(5)=data6 ; -- Odd part - movdqa xmm6,xmm11 ; xmm11=tmp4 - movdqa xmm0,xmm10 ; xmm10=tmp5 - paddw xmm6,xmm9 ; xmm6=tmp4+tmp6=z3 - paddw xmm0,xmm8 ; xmm0=tmp5+tmp7=z4 + movdqa xmm3, XMMWORD [wk(0)] ; xmm3=tmp6 + movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp7 + + movdqa xmm6,xmm2 ; xmm2=tmp4 + movdqa xmm0,xmm5 ; xmm5=tmp5 + paddw xmm6,xmm3 ; xmm6=z3 + paddw xmm0,xmm1 ; xmm0=z4 ; (Original) ; z5 = (z3 + z4) * 1.175875602; @@ -245,211 +276,239 @@ EXTN(jsimd_fdct_islow_sse2): ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); movdqa xmm7,xmm6 - movdqa xmm14,xmm6 + movdqa xmm4,xmm6 punpcklwd xmm7,xmm0 - punpckhwd xmm14,xmm0 + punpckhwd xmm4,xmm0 movdqa xmm6,xmm7 - movdqa xmm0,xmm14 + movdqa xmm0,xmm4 pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L - pmaddwd xmm14,[rel PW_MF078_F117] ; xmm14=z3H + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3H pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H + movdqa XMMWORD [wk(0)], xmm7 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=z3H + ; (Original) ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; out7 = tmp4 + z1 + z3; out5 = tmp5 + z2 + z4; - ; out3 = tmp6 + z2 + z3; out1 = tmp7 + z1 + z4; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; ; ; (This implementation) ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; out7 = tmp4 + z3; out5 = tmp5 + z4; - ; out3 = tmp6 + z3; out1 = tmp7 + z4; + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; - movdqa xmm15,xmm11 ; xmm11=tmp4 - movdqa xmm13,xmm11 - punpcklwd xmm15,xmm8 ; xmm8=tmp7 - punpckhwd xmm13,xmm8 - movdqa xmm8,xmm15 - movdqa xmm1,xmm13 - pmaddwd xmm15,[rel PW_MF060_MF089] ; xmm15=tmp4L - pmaddwd xmm13,[rel PW_MF060_MF089] ; xmm13=tmp4H - pmaddwd xmm8,[rel PW_MF089_F060] ; xmm8=tmp7L + movdqa xmm7,xmm2 + movdqa xmm4,xmm2 + punpcklwd xmm7,xmm1 + punpckhwd xmm4,xmm1 + movdqa xmm2,xmm7 + movdqa xmm1,xmm4 + pmaddwd xmm7,[rel PW_MF060_MF089] ; xmm7=tmp4L + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4H + pmaddwd xmm2,[rel PW_MF089_F060] ; xmm2=tmp7L pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H - paddd xmm15,xmm7 ; xmm15=out7L - paddd xmm13,xmm14 ; xmm13=out7H - paddd xmm8,xmm6 ; xmm8=out1L - paddd xmm1,xmm0 ; xmm1=out1H + paddd xmm7, XMMWORD [wk(0)] ; xmm7=data7L + paddd xmm4, XMMWORD [wk(1)] ; xmm4=data7H + paddd xmm2,xmm6 ; xmm2=data1L + paddd xmm1,xmm0 ; xmm1=data1H - paddd xmm15,[rel PD_DESCALE_P1] - paddd xmm13,[rel PD_DESCALE_P1] - psrad xmm15,DESCALE_P1 - psrad xmm13,DESCALE_P1 - paddd xmm8,[rel PD_DESCALE_P1] + paddd xmm7,[rel PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] + psrad xmm7,DESCALE_P1 + psrad xmm4,DESCALE_P1 + paddd xmm2,[rel PD_DESCALE_P1] paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm8,DESCALE_P1 + psrad xmm2,DESCALE_P1 psrad xmm1,DESCALE_P1 - packssdw xmm15,xmm13 ; xmm15=out7 - packssdw xmm8,xmm1 ; xmm8=out1 + packssdw xmm7,xmm4 ; xmm7=data7 + packssdw xmm2,xmm1 ; xmm2=data1 - movdqa xmm13,xmm10 ; xmm10=tmp5 - movdqa xmm1,xmm10 - punpcklwd xmm13,xmm9 ; xmm9=tmp6 - punpckhwd xmm1,xmm9 - movdqa xmm11,xmm13 + movdqa xmm4,xmm5 + movdqa xmm1,xmm5 + punpcklwd xmm4,xmm3 + punpckhwd xmm1,xmm3 + movdqa xmm5,xmm4 movdqa xmm3,xmm1 - pmaddwd xmm13,[rel PW_MF050_MF256] ; xmm13=tmp5L + pmaddwd xmm4,[rel PW_MF050_MF256] ; xmm4=tmp5L pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H - pmaddwd xmm11,[rel PW_MF256_F050] ; xmm11=tmp6L + pmaddwd xmm5,[rel PW_MF256_F050] ; xmm5=tmp6L pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H - paddd xmm13,xmm6 ; xmm13=out5L - paddd xmm1,xmm0 ; xmm1=out5H - paddd xmm11,xmm7 ; xmm11=out3L - paddd xmm3,xmm14 ; xmm3=out3H + paddd xmm4,xmm6 ; xmm4=data5L + paddd xmm1,xmm0 ; xmm1=data5H + paddd xmm5, XMMWORD [wk(0)] ; xmm5=data3L + paddd xmm3, XMMWORD [wk(1)] ; xmm3=data3H - paddd xmm13,[rel PD_DESCALE_P1] + paddd xmm4,[rel PD_DESCALE_P1] paddd xmm1,[rel PD_DESCALE_P1] - psrad xmm13,DESCALE_P1 + psrad xmm4,DESCALE_P1 psrad xmm1,DESCALE_P1 - paddd xmm11,[rel PD_DESCALE_P1] + paddd xmm5,[rel PD_DESCALE_P1] paddd xmm3,[rel PD_DESCALE_P1] - psrad xmm11,DESCALE_P1 + psrad xmm5,DESCALE_P1 psrad xmm3,DESCALE_P1 - packssdw xmm13,xmm1 ; xmm13=out5 - packssdw xmm11,xmm3 ; xmm11=out3 + packssdw xmm4,xmm1 ; xmm4=data5 + packssdw xmm5,xmm3 ; xmm5=data3 ; ---- Pass 2: process columns. - ; Re-order registers so we can reuse the same transpose code - movdqa xmm9,xmm8 - movdqa xmm8,xmm12 + movdqa xmm6, XMMWORD [wk(2)] ; xmm6=col0 + movdqa xmm0, XMMWORD [wk(4)] ; xmm0=col2 - ; xmm8=(00 10 20 30 40 50 60 70), xmm9=(01 11 21 31 41 51 61 71) - ; xmm2=(02 12 22 32 42 52 62 72), xmm11=(03 13 23 33 43 53 63 73) - ; xmm4=(04 14 24 34 44 54 64 74), xmm13=(05 15 25 35 45 55 65 75) - ; xmm5=(06 16 26 36 46 56 66 76), xmm15=(07 17 27 37 47 57 67 77) + ; xmm6=(00 10 20 30 40 50 60 70), xmm0=(02 12 22 32 42 52 62 72) + ; xmm2=(01 11 21 31 41 51 61 71), xmm5=(03 13 23 33 43 53 63 73) - movdqa xmm12,xmm8 ; transpose coefficients(phase 1) - punpcklwd xmm8,xmm9 ; xmm8=(00 01 10 11 20 21 30 31) - punpckhwd xmm12,xmm9 ; xmm12=(40 41 50 51 60 61 70 71) - movdqa xmm1,xmm2 ; transpose coefficients(phase 1) - punpcklwd xmm2,xmm11 ; xmm2=(02 03 12 13 22 23 32 33) - punpckhwd xmm1,xmm11 ; xmm1=(42 43 52 53 62 63 72 73) + movdqa xmm1,xmm6 ; transpose coefficients(phase 1) + punpcklwd xmm6,xmm2 ; xmm6=(00 01 10 11 20 21 30 31) + punpckhwd xmm1,xmm2 ; xmm1=(40 41 50 51 60 61 70 71) + movdqa xmm3,xmm0 ; transpose coefficients(phase 1) + punpcklwd xmm0,xmm5 ; xmm0=(02 03 12 13 22 23 32 33) + punpckhwd xmm3,xmm5 ; xmm3=(42 43 52 53 62 63 72 73) - movdqa xmm0,xmm4 ; transpose coefficients(phase 1) - punpcklwd xmm4,xmm13 ; xmm4=(04 05 14 15 24 25 34 35) - punpckhwd xmm0,xmm13 ; xmm0=(44 45 54 55 64 65 74 75) + movdqa xmm2, XMMWORD [wk(3)] ; xmm2=col4 + movdqa xmm5, XMMWORD [wk(5)] ; xmm5=col6 + + ; xmm2=(04 14 24 34 44 54 64 74), xmm5=(06 16 26 36 46 56 66 76) + ; xmm4=(05 15 25 35 45 55 65 75), xmm7=(07 17 27 37 47 57 67 77) + + movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=(02 03 12 13 22 23 32 33) + movdqa XMMWORD [wk(1)], xmm3 ; wk(1)=(42 43 52 53 62 63 72 73) + + movdqa xmm0,xmm2 ; transpose coefficients(phase 1) + punpcklwd xmm2,xmm4 ; xmm2=(04 05 14 15 24 25 34 35) + punpckhwd xmm0,xmm4 ; xmm0=(44 45 54 55 64 65 74 75) movdqa xmm3,xmm5 ; transpose coefficients(phase 1) - punpcklwd xmm5,xmm15 ; xmm5=(06 07 16 17 26 27 36 37) - punpckhwd xmm3,xmm15 ; xmm3=(46 47 56 57 66 67 76 77) + punpcklwd xmm5,xmm7 ; xmm5=(06 07 16 17 26 27 36 37) + punpckhwd xmm3,xmm7 ; xmm3=(46 47 56 57 66 67 76 77) - movdqa xmm10,xmm8 ; transpose coefficients(phase 2) - punpckldq xmm8,xmm2 ; xmm8=(00 01 02 03 10 11 12 13) - punpckhdq xmm10,xmm2 ; xmm10=(20 21 22 23 30 31 32 33) - movdqa xmm14,xmm12 ; transpose coefficients(phase 2) - punpckldq xmm12,xmm1 ; xmm12=(40 41 42 43 50 51 52 53) - punpckhdq xmm14,xmm1 ; xmm14=(60 61 62 63 70 71 72 73) - - movdqa xmm6,xmm4 ; transpose coefficients(phase 2) - punpckldq xmm4,xmm5 ; xmm4=(04 05 06 07 14 15 16 17) - punpckhdq xmm6,xmm5 ; xmm6=(24 25 26 27 34 35 36 37) + movdqa xmm4,xmm2 ; transpose coefficients(phase 2) + punpckldq xmm2,xmm5 ; xmm2=(04 05 06 07 14 15 16 17) + punpckhdq xmm4,xmm5 ; xmm4=(24 25 26 27 34 35 36 37) movdqa xmm7,xmm0 ; transpose coefficients(phase 2) punpckldq xmm0,xmm3 ; xmm0=(44 45 46 47 54 55 56 57) punpckhdq xmm7,xmm3 ; xmm7=(64 65 66 67 74 75 76 77) - movdqa xmm9,xmm8 ; transpose coefficients(phase 3) - punpcklqdq xmm8,xmm4 ; xmm8=(00 01 02 03 04 05 06 07)=data0 - punpckhqdq xmm9,xmm4 ; xmm9=(10 11 12 13 14 15 16 17)=data1 - movdqa xmm11,xmm10 ; transpose coefficients(phase 3) - punpcklqdq xmm10,xmm6 ; xmm10=(20 21 22 23 24 25 26 27)=data2 - punpckhqdq xmm11,xmm6 ; xmm11=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm5, XMMWORD [wk(0)] ; xmm5=(02 03 12 13 22 23 32 33) + movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(42 43 52 53 62 63 72 73) + movdqa XMMWORD [wk(2)], xmm4 ; wk(2)=(24 25 26 27 34 35 36 37) + movdqa XMMWORD [wk(3)], xmm0 ; wk(3)=(44 45 46 47 54 55 56 57) - movdqa xmm13,xmm12 ; transpose coefficients(phase 3) - punpcklqdq xmm12,xmm0 ; xmm12=(40 41 42 43 44 45 46 47)=data4 - punpckhqdq xmm13,xmm0 ; xmm13=(50 51 52 53 54 55 56 57)=data5 - movdqa xmm15,xmm14 ; transpose coefficients(phase 3) - punpcklqdq xmm14,xmm7 ; xmm14=(60 61 62 63 64 65 66 67)=data6 - punpckhqdq xmm15,xmm7 ; xmm15=(70 71 72 73 74 75 76 77)=data7 + movdqa xmm4,xmm6 ; transpose coefficients(phase 2) + punpckldq xmm6,xmm5 ; xmm6=(00 01 02 03 10 11 12 13) + punpckhdq xmm4,xmm5 ; xmm4=(20 21 22 23 30 31 32 33) + movdqa xmm0,xmm1 ; transpose coefficients(phase 2) + punpckldq xmm1,xmm3 ; xmm1=(40 41 42 43 50 51 52 53) + punpckhdq xmm0,xmm3 ; xmm0=(60 61 62 63 70 71 72 73) - movdqa xmm0,xmm8 - paddw xmm0,xmm15 ; xmm0=data0+data7=tmp0 - movdqa xmm1,xmm9 - paddw xmm1,xmm14 ; xmm1=data1+data6=tmp1 - movdqa xmm2,xmm10 - paddw xmm2,xmm13 ; xmm2=data2+data5=tmp2 - movdqa xmm3,xmm11 - paddw xmm3,xmm12 ; xmm3=data3+data4=tmp3 + movdqa xmm5,xmm6 ; transpose coefficients(phase 3) + punpcklqdq xmm6,xmm2 ; xmm6=(00 01 02 03 04 05 06 07)=data0 + punpckhqdq xmm5,xmm2 ; xmm5=(10 11 12 13 14 15 16 17)=data1 + movdqa xmm3,xmm0 ; transpose coefficients(phase 3) + punpcklqdq xmm0,xmm7 ; xmm0=(60 61 62 63 64 65 66 67)=data6 + punpckhqdq xmm3,xmm7 ; xmm3=(70 71 72 73 74 75 76 77)=data7 - psubw xmm11,xmm12 ; xmm11=data3-data4=tmp4 - psubw xmm10,xmm13 ; xmm10=data2-data5=tmp5 - psubw xmm9,xmm14 ; xmm9=data1-data6=tmp6 - psubw xmm8,xmm15 ; xmm8=data0-data7=tmp7 + movdqa xmm2,xmm5 + movdqa xmm7,xmm6 + psubw xmm5,xmm0 ; xmm5=data1-data6=tmp6 + psubw xmm6,xmm3 ; xmm6=data0-data7=tmp7 + paddw xmm2,xmm0 ; xmm2=data1+data6=tmp1 + paddw xmm7,xmm3 ; xmm7=data0+data7=tmp0 + + movdqa xmm0, XMMWORD [wk(2)] ; xmm0=(24 25 26 27 34 35 36 37) + movdqa xmm3, XMMWORD [wk(3)] ; xmm3=(44 45 46 47 54 55 56 57) + movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=tmp6 + movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp7 + + movdqa xmm5,xmm4 ; transpose coefficients(phase 3) + punpcklqdq xmm4,xmm0 ; xmm4=(20 21 22 23 24 25 26 27)=data2 + punpckhqdq xmm5,xmm0 ; xmm5=(30 31 32 33 34 35 36 37)=data3 + movdqa xmm6,xmm1 ; transpose coefficients(phase 3) + punpcklqdq xmm1,xmm3 ; xmm1=(40 41 42 43 44 45 46 47)=data4 + punpckhqdq xmm6,xmm3 ; xmm6=(50 51 52 53 54 55 56 57)=data5 + + movdqa xmm0,xmm5 + movdqa xmm3,xmm4 + paddw xmm5,xmm1 ; xmm5=data3+data4=tmp3 + paddw xmm4,xmm6 ; xmm4=data2+data5=tmp2 + psubw xmm0,xmm1 ; xmm0=data3-data4=tmp4 + psubw xmm3,xmm6 ; xmm3=data2-data5=tmp5 ; -- Even part - movdqa xmm4,xmm0 - paddw xmm4,xmm3 ; xmm4=tmp0+tmp3=tmp10 - movdqa xmm5,xmm1 - paddw xmm5,xmm2 ; xmm5=tmp1+tmp2=tmp11 - psubw xmm1,xmm2 ; xmm1=tmp1-tmp2=tmp12 - psubw xmm0,xmm3 ; xmm0=tmp0-tmp3=tmp13 + movdqa xmm1,xmm7 + movdqa xmm6,xmm2 + paddw xmm7,xmm5 ; xmm7=tmp10 + paddw xmm2,xmm4 ; xmm2=tmp11 + psubw xmm1,xmm5 ; xmm1=tmp13 + psubw xmm6,xmm4 ; xmm6=tmp12 - movdqa xmm12,xmm4 - paddw xmm12,xmm5 ; xmm12=tmp10+tmp11 - psubw xmm4,xmm5 ; xmm4=tmp10-tmp11 + movdqa xmm5,xmm7 + paddw xmm7,xmm2 ; xmm7=tmp10+tmp11 + psubw xmm5,xmm2 ; xmm5=tmp10-tmp11 - paddw xmm12,[rel PW_DESCALE_P2X] - paddw xmm4,[rel PW_DESCALE_P2X] - psraw xmm12,PASS1_BITS ; xmm12=out0 - psraw xmm4,PASS1_BITS ; xmm4=out4 + paddw xmm7,[rel PW_DESCALE_P2X] + paddw xmm5,[rel PW_DESCALE_P2X] + psraw xmm7,PASS1_BITS ; xmm7=data0 + psraw xmm5,PASS1_BITS ; xmm5=data4 + + movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm7 + movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm5 ; (Original) ; z1 = (tmp12 + tmp13) * 0.541196100; - ; out2 = z1 + tmp13 * 0.765366865; - ; out6 = z1 + tmp12 * -1.847759065; + ; data2 = z1 + tmp13 * 0.765366865; + ; data6 = z1 + tmp12 * -1.847759065; ; ; (This implementation) - ; out2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; - ; out6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); + ; data2 = tmp13 * (0.541196100 + 0.765366865) + tmp12 * 0.541196100; + ; data6 = tmp13 * 0.541196100 + tmp12 * (0.541196100 - 1.847759065); - movdqa xmm2,xmm0 ; xmm0=tmp13 - movdqa xmm6,xmm0 - punpcklwd xmm2,xmm1 ; xmm1=tmp12 - punpckhwd xmm6,xmm1 - movdqa xmm5,xmm2 - movdqa xmm0,xmm6 - pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=out2L - pmaddwd xmm6,[rel PW_F130_F054] ; xmm6=out2H - pmaddwd xmm5,[rel PW_F054_MF130] ; xmm5=out6L - pmaddwd xmm0,[rel PW_F054_MF130] ; xmm0=out6H + movdqa xmm4,xmm1 ; xmm1=tmp13 + movdqa xmm2,xmm1 + punpcklwd xmm4,xmm6 ; xmm6=tmp12 + punpckhwd xmm2,xmm6 + movdqa xmm1,xmm4 + movdqa xmm6,xmm2 + pmaddwd xmm4,[rel PW_F130_F054] ; xmm4=data2L + pmaddwd xmm2,[rel PW_F130_F054] ; xmm2=data2H + pmaddwd xmm1,[rel PW_F054_MF130] ; xmm1=data6L + pmaddwd xmm6,[rel PW_F054_MF130] ; xmm6=data6H + paddd xmm4,[rel PD_DESCALE_P2] paddd xmm2,[rel PD_DESCALE_P2] - paddd xmm6,[rel PD_DESCALE_P2] + psrad xmm4,DESCALE_P2 psrad xmm2,DESCALE_P2 + paddd xmm1,[rel PD_DESCALE_P2] + paddd xmm6,[rel PD_DESCALE_P2] + psrad xmm1,DESCALE_P2 psrad xmm6,DESCALE_P2 - paddd xmm5,[rel PD_DESCALE_P2] - paddd xmm0,[rel PD_DESCALE_P2] - psrad xmm5,DESCALE_P2 - psrad xmm0,DESCALE_P2 - packssdw xmm2,xmm6 ; xmm2=out2 - packssdw xmm5,xmm0 ; xmm5=out6 + packssdw xmm4,xmm2 ; xmm4=data2 + packssdw xmm1,xmm6 ; xmm1=data6 + + movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm1 ; -- Odd part - movdqa xmm6,xmm11 ; xmm11=tmp4 - movdqa xmm0,xmm10 ; xmm10=tmp5 - paddw xmm6,xmm9 ; xmm6=tmp4+tmp6=z3 - paddw xmm0,xmm8 ; xmm0=tmp5+tmp7=z4 + movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp6 + movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp7 + + movdqa xmm2,xmm0 ; xmm0=tmp4 + movdqa xmm6,xmm3 ; xmm3=tmp5 + paddw xmm2,xmm7 ; xmm2=z3 + paddw xmm6,xmm5 ; xmm6=z4 ; (Original) ; z5 = (z3 + z4) * 1.175875602; @@ -460,101 +519,101 @@ EXTN(jsimd_fdct_islow_sse2): ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); - movdqa xmm7,xmm6 - movdqa xmm14,xmm6 - punpcklwd xmm7,xmm0 - punpckhwd xmm14,xmm0 - movdqa xmm6,xmm7 - movdqa xmm0,xmm14 - pmaddwd xmm7,[rel PW_MF078_F117] ; xmm7=z3L - pmaddwd xmm14,[rel PW_MF078_F117] ; xmm14=z3H - pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4L - pmaddwd xmm0,[rel PW_F117_F078] ; xmm0=z4H + movdqa xmm4,xmm2 + movdqa xmm1,xmm2 + punpcklwd xmm4,xmm6 + punpckhwd xmm1,xmm6 + movdqa xmm2,xmm4 + movdqa xmm6,xmm1 + pmaddwd xmm4,[rel PW_MF078_F117] ; xmm4=z3L + pmaddwd xmm1,[rel PW_MF078_F117] ; xmm1=z3H + pmaddwd xmm2,[rel PW_F117_F078] ; xmm2=z4L + pmaddwd xmm6,[rel PW_F117_F078] ; xmm6=z4H + + movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=z3L + movdqa XMMWORD [wk(1)], xmm1 ; wk(1)=z3H ; (Original) ; z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; ; tmp4 = tmp4 * 0.298631336; tmp5 = tmp5 * 2.053119869; ; tmp6 = tmp6 * 3.072711026; tmp7 = tmp7 * 1.501321110; ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; - ; out7 = tmp4 + z1 + z3; out5 = tmp5 + z2 + z4; - ; out3 = tmp6 + z2 + z3; out1 = tmp7 + z1 + z4; + ; data7 = tmp4 + z1 + z3; data5 = tmp5 + z2 + z4; + ; data3 = tmp6 + z2 + z3; data1 = tmp7 + z1 + z4; ; ; (This implementation) ; tmp4 = tmp4 * (0.298631336 - 0.899976223) + tmp7 * -0.899976223; ; tmp5 = tmp5 * (2.053119869 - 2.562915447) + tmp6 * -2.562915447; ; tmp6 = tmp5 * -2.562915447 + tmp6 * (3.072711026 - 2.562915447); ; tmp7 = tmp4 * -0.899976223 + tmp7 * (1.501321110 - 0.899976223); - ; out7 = tmp4 + z3; out5 = tmp5 + z4; - ; out3 = tmp6 + z3; out1 = tmp7 + z4; + ; data7 = tmp4 + z3; data5 = tmp5 + z4; + ; data3 = tmp6 + z3; data1 = tmp7 + z4; - movdqa xmm15,xmm11 ; xmm11=tmp4 - movdqa xmm13,xmm11 - punpcklwd xmm15,xmm8 ; xmm8=tmp7 - punpckhwd xmm13,xmm8 - movdqa xmm8,xmm15 - movdqa xmm1,xmm13 - pmaddwd xmm15,[rel PW_MF060_MF089] ; xmm15=tmp4L - pmaddwd xmm13,[rel PW_MF060_MF089] ; xmm13=tmp4H - pmaddwd xmm8,[rel PW_MF089_F060] ; xmm8=tmp7L - pmaddwd xmm1,[rel PW_MF089_F060] ; xmm1=tmp7H + movdqa xmm4,xmm0 + movdqa xmm1,xmm0 + punpcklwd xmm4,xmm5 + punpckhwd xmm1,xmm5 + movdqa xmm0,xmm4 + movdqa xmm5,xmm1 + pmaddwd xmm4,[rel PW_MF060_MF089] ; xmm4=tmp4L + pmaddwd xmm1,[rel PW_MF060_MF089] ; xmm1=tmp4H + pmaddwd xmm0,[rel PW_MF089_F060] ; xmm0=tmp7L + pmaddwd xmm5,[rel PW_MF089_F060] ; xmm5=tmp7H - paddd xmm15,xmm7 ; xmm15=out7L - paddd xmm13,xmm14 ; xmm13=out7H - paddd xmm8,xmm6 ; xmm8=out1L - paddd xmm1,xmm0 ; xmm1=out1H + paddd xmm4, XMMWORD [wk(0)] ; xmm4=data7L + paddd xmm1, XMMWORD [wk(1)] ; xmm1=data7H + paddd xmm0,xmm2 ; xmm0=data1L + paddd xmm5,xmm6 ; xmm5=data1H - paddd xmm15,[rel PD_DESCALE_P2] - paddd xmm13,[rel PD_DESCALE_P2] - psrad xmm15,DESCALE_P2 - psrad xmm13,DESCALE_P2 - paddd xmm8,[rel PD_DESCALE_P2] + paddd xmm4,[rel PD_DESCALE_P2] paddd xmm1,[rel PD_DESCALE_P2] - psrad xmm8,DESCALE_P2 + psrad xmm4,DESCALE_P2 psrad xmm1,DESCALE_P2 + paddd xmm0,[rel PD_DESCALE_P2] + paddd xmm5,[rel PD_DESCALE_P2] + psrad xmm0,DESCALE_P2 + psrad xmm5,DESCALE_P2 - packssdw xmm15,xmm13 ; xmm15=out7 - packssdw xmm8,xmm1 ; xmm8=out1 + packssdw xmm4,xmm1 ; xmm4=data7 + packssdw xmm0,xmm5 ; xmm0=data1 - movdqa xmm13,xmm10 ; xmm10=tmp5 - movdqa xmm1,xmm10 - punpcklwd xmm13,xmm9 ; xmm9=tmp6 - punpckhwd xmm1,xmm9 - movdqa xmm11,xmm13 + movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm4 + movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm0 + + movdqa xmm1,xmm3 + movdqa xmm5,xmm3 + punpcklwd xmm1,xmm7 + punpckhwd xmm5,xmm7 movdqa xmm3,xmm1 - pmaddwd xmm13,[rel PW_MF050_MF256] ; xmm13=tmp5L - pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5H - pmaddwd xmm11,[rel PW_MF256_F050] ; xmm11=tmp6L - pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6H + movdqa xmm7,xmm5 + pmaddwd xmm1,[rel PW_MF050_MF256] ; xmm1=tmp5L + pmaddwd xmm5,[rel PW_MF050_MF256] ; xmm5=tmp5H + pmaddwd xmm3,[rel PW_MF256_F050] ; xmm3=tmp6L + pmaddwd xmm7,[rel PW_MF256_F050] ; xmm7=tmp6H - paddd xmm13,xmm6 ; xmm13=out5L - paddd xmm1,xmm0 ; xmm1=out5H - paddd xmm11,xmm7 ; xmm11=out3L - paddd xmm3,xmm14 ; xmm3=out3H + paddd xmm1,xmm2 ; xmm1=data5L + paddd xmm5,xmm6 ; xmm5=data5H + paddd xmm3, XMMWORD [wk(0)] ; xmm3=data3L + paddd xmm7, XMMWORD [wk(1)] ; xmm7=data3H - paddd xmm13,[rel PD_DESCALE_P2] paddd xmm1,[rel PD_DESCALE_P2] - psrad xmm13,DESCALE_P2 + paddd xmm5,[rel PD_DESCALE_P2] psrad xmm1,DESCALE_P2 - paddd xmm11,[rel PD_DESCALE_P2] + psrad xmm5,DESCALE_P2 paddd xmm3,[rel PD_DESCALE_P2] - psrad xmm11,DESCALE_P2 + paddd xmm7,[rel PD_DESCALE_P2] psrad xmm3,DESCALE_P2 + psrad xmm7,DESCALE_P2 - packssdw xmm13,xmm1 ; xmm13=out5 - packssdw xmm11,xmm3 ; xmm11=out3 + packssdw xmm1,xmm5 ; xmm1=data5 + packssdw xmm3,xmm7 ; xmm3=data3 - ; -- Write result - - movdqa XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_DCTELEM)], xmm12 - movdqa XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm8 - movdqa XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_DCTELEM)], xmm2 - movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm11 - movdqa XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_DCTELEM)], xmm4 - movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm13 - movdqa XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_DCTELEM)], xmm5 - movdqa XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_DCTELEM)], xmm15 + movdqa XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1 + movdqa XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3 uncollect_args + mov rsp,rbp ; rsp <- aligned rbp + pop rsp ; rsp <- original rbp pop rbp ret From 7ff92d811b981f99cbd0ddd98ccd2cd3a3185558 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 22 Aug 2014 19:27:28 +0000 Subject: [PATCH 978/985] Ensure that tjFree() is used for any JPEG buffers that might have been dynamically allocated by the compress/transform functions. To keep things simple, we use tjAlloc() for the statically-allocated buffer as well, so that tjFree() can always be used to free the buffer, regardless of whether it was allocated by tjbench or by the TurboJPEG library. This fixes crashes that occurred on Windows when running tjunittest or tjbench with the -alloc flag. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1383 632fc199-4ca6-4c93-a231-07263d6284db --- tjbench.c | 14 +++++++------- tjunittest.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tjbench.c b/tjbench.c index 47254160..741dc7e7 100644 --- a/tjbench.c +++ b/tjbench.c @@ -312,7 +312,7 @@ int fullTest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual, if((flags&TJFLAG_NOREALLOC)!=0) for(i=0; i Date: Sat, 23 Aug 2014 15:47:51 +0000 Subject: [PATCH 979/985] ARM NEON SIMD support for YCC-to-RGB565 conversion, and optimizations to the existing YCC-to-RGB conversion code: ----- https://github.com/ssvb/libjpeg-turbo/commit/aee36252be20054afce371a92406fc66ba6627b5.patch From aee36252be20054afce371a92406fc66ba6627b5 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Wed, 13 Aug 2014 03:50:22 +0300 Subject: [PATCH] ARM: Faster NEON yuv->rgb conversion for Krait and Cortex-A15 The older code was developed and tested only on ARM Cortex-A8 and ARM Cortex-A9. Tuning it for newer ARM processors can introduce some speed-up (up to 20%). The performance of the inner loop (conversion of 8 pixels) improves from ~27 cycles down to ~22 cycles on Qualcomm Krait 300, and from ~20 cycles down to ~18 cycles on ARM Cortex-A15. The performance remains exactly the same on ARM Cortex-A7 (~58 cycles), ARM Cortex-A8 (~25 cycles) and ARM Cortex-A9 (~30 cycles) processors. Also use larger indentation in the source code for separating two independent instruction streams. ----- https://github.com/ssvb/libjpeg-turbo/commit/a5efdbf22ce9c1acd4b14a353cec863c2c57557e.patch From a5efdbf22ce9c1acd4b14a353cec863c2c57557e Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Wed, 13 Aug 2014 07:23:09 +0300 Subject: [PATCH] ARM: NEON optimized yuv->rgb565 conversion The performance of the inner loop (conversion of 8 pixels): * ARM Cortex-A7: ~55 cycles * ARM Cortex-A8: ~28 cycles * ARM Cortex-A9: ~32 cycles * ARM Cortex-A15: ~20 cycles * Qualcomm Krait: ~24 cycles Based on the Linaro rgb565 patch from https://sourceforge.net/p/libjpeg-turbo/patches/24/ but implements better instructions scheduling. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1385 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 3 +- jdcolor.c | 10 +++++-- jsimd.h | 6 +++- jsimd_none.c | 15 +++++++++- simd/jsimd.h | 4 +++ simd/jsimd_arm.c | 31 +++++++++++++++++-- simd/jsimd_arm64.c | 13 ++++++++ simd/jsimd_arm_neon.S | 70 ++++++++++++++++++++++++++++++++++--------- simd/jsimd_i386.c | 15 +++++++++- simd/jsimd_mips.c | 15 +++++++++- simd/jsimd_x86_64.c | 15 +++++++++- 11 files changed, 172 insertions(+), 25 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c31a0075..166788b2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -68,7 +68,8 @@ accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit slower. [8] Added a new output colorspace (JCS_RGB565) to the libjpeg API that allows -for decompressing JPEG images into RGB565 (16-bit) pixels. +for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not +used, then this code path is SIMD-accelerated on ARM platforms. [9] Numerous obsolete features, such as support for non-ANSI compilers and support for the MS-DOS memory model, were removed from the libjpeg code, diff --git a/jdcolor.c b/jdcolor.c index 6927e5ed..ffedabd5 100644 --- a/jdcolor.c +++ b/jdcolor.c @@ -6,7 +6,7 @@ * Modified 2011 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2009, 2011-2012, D. R. Commander. + * Copyright (C) 2009, 2011-2012, 2014, D. R. Commander. * Copyright (C) 2013, Linaro Limited. * For conditions of distribution and use, see the accompanying README file. * @@ -657,8 +657,12 @@ jinit_color_deconverter (j_decompress_ptr cinfo) cinfo->out_color_components = 3; if (cinfo->dither_mode == JDITHER_NONE) { if (cinfo->jpeg_color_space == JCS_YCbCr) { - cconvert->pub.color_convert = ycc_rgb565_convert; - build_ycc_rgb_table(cinfo); + if (jsimd_can_ycc_rgb565()) + cconvert->pub.color_convert = jsimd_ycc_rgb565_convert; + else { + cconvert->pub.color_convert = ycc_rgb565_convert; + build_ycc_rgb_table(cinfo); + } } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { cconvert->pub.color_convert = gray_rgb565_convert; } else if (cinfo->jpeg_color_space == JCS_RGB) { diff --git a/jsimd.h b/jsimd.h index d45fd700..f1f584b8 100644 --- a/jsimd.h +++ b/jsimd.h @@ -2,7 +2,7 @@ * jsimd.h * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2011 D. R. Commander + * Copyright 2011, 2014 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -13,6 +13,7 @@ EXTERN(int) jsimd_can_rgb_ycc (void); EXTERN(int) jsimd_can_rgb_gray (void); EXTERN(int) jsimd_can_ycc_rgb (void); +EXTERN(int) jsimd_can_ycc_rgb565 (void); EXTERN(int) jsimd_c_can_null_convert (void); EXTERN(void) jsimd_rgb_ycc_convert @@ -24,6 +25,9 @@ EXTERN(void) jsimd_rgb_gray_convert EXTERN(void) jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_rgb565_convert + (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_c_null_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows); diff --git a/jsimd_none.c b/jsimd_none.c index 96a9842a..34aefc9f 100644 --- a/jsimd_none.c +++ b/jsimd_none.c @@ -2,7 +2,7 @@ * jsimd_none.c * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011 D. R. Commander + * Copyright 2009-2011, 2014 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -36,6 +36,12 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + return 0; +} + GLOBAL(int) jsimd_c_can_null_convert (void) { @@ -63,6 +69,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, { } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + GLOBAL(void) jsimd_c_null_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, diff --git a/simd/jsimd.h b/simd/jsimd.h index 609b91f5..c5abd458 100644 --- a/simd/jsimd.h +++ b/simd/jsimd.h @@ -4,6 +4,7 @@ * Copyright 2009 Pierre Ossman for Cendio AB * Copyright 2011 D. R. Commander * Copyright (C) 2013-2014, MIPS Technologies, Inc., California + * Copyright (C) 2014 Linaro Limited * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -249,6 +250,9 @@ EXTERN(void) jsimd_ycc_extxbgr_convert_neon EXTERN(void) jsimd_ycc_extxrgb_convert_neon (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows); +EXTERN(void) jsimd_ycc_rgb565_convert_neon + (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); EXTERN(void) jsimd_ycc_rgb_convert_mips_dspr2 (JDIMENSION out_width, JSAMPIMAGE input_buf, JDIMENSION input_row, diff --git a/simd/jsimd_arm.c b/simd/jsimd_arm.c index aefb1e67..4cbcf2d5 100644 --- a/simd/jsimd_arm.c +++ b/simd/jsimd_arm.c @@ -2,7 +2,7 @@ * jsimd_arm.c * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011, 2013 D. R. Commander + * Copyright 2009-2011, 2013-2014 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -175,6 +175,23 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_ARM_NEON) + return 1; + + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -251,7 +268,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, case JCS_EXT_ARGB: neonfct=jsimd_ycc_extxrgb_convert_neon; break; - default: + default: neonfct=jsimd_ycc_extrgb_convert_neon; break; } @@ -260,6 +277,16 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + if (simd_support & JSIMD_ARM_NEON) + jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row, + output_buf, num_rows); +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { diff --git a/simd/jsimd_arm64.c b/simd/jsimd_arm64.c index 44225aa6..a346d165 100644 --- a/simd/jsimd_arm64.c +++ b/simd/jsimd_arm64.c @@ -95,6 +95,12 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -148,6 +154,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, neonfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { diff --git a/simd/jsimd_arm_neon.S b/simd/jsimd_arm_neon.S index 44c61fdd..7e8e134c 100644 --- a/simd/jsimd_arm_neon.S +++ b/simd/jsimd_arm_neon.S @@ -4,6 +4,7 @@ * Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Author: Siarhei Siamashka + * Copyright (C) 2014 Linaro Limited. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -1346,6 +1347,19 @@ asm_function jsimd_idct_2x2_neon .else .error unsupported macroblock size .endif + .elseif \bpp == 16 + .if \size == 8 + vst1.16 {q15}, [RGB]! + .elseif \size == 4 + vst1.16 {d30}, [RGB]! + .elseif \size == 2 + vst1.16 {d31[0]}, [RGB]! + vst1.16 {d31[1]}, [RGB]! + .elseif \size == 1 + vst1.16 {d31[2]}, [RGB]! + .else + .error unsupported macroblock size + .endif .else .error unsupported bpp .endif @@ -1377,44 +1391,71 @@ asm_function jsimd_idct_2x2_neon vrshrn.s32 d25, q13, #14 vrshrn.s32 d28, q14, #14 vrshrn.s32 d29, q15, #14 - vaddw.u8 q10, q10, d0 + vaddw.u8 q11, q10, d0 vaddw.u8 q12, q12, d0 vaddw.u8 q14, q14, d0 - vqmovun.s16 d1\g_offs, q10 +.if \bpp != 16 + vqmovun.s16 d1\g_offs, q11 vqmovun.s16 d1\r_offs, q12 vqmovun.s16 d1\b_offs, q14 +.else /* rgb565 */ + vqshlu.s16 q13, q11, #8 + vqshlu.s16 q15, q12, #8 + vqshlu.s16 q14, q14, #8 + vsri.u16 q15, q13, #5 + vsri.u16 q15, q14, #11 +.endif .endm .macro do_yuv_to_rgb_stage2_store_load_stage1 - vld1.8 {d4}, [U, :64]! + /* "do_yuv_to_rgb_stage2" and "store" */ vrshrn.s32 d20, q10, #15 + /* "load" and "do_yuv_to_rgb_stage1" */ + pld [U, #64] vrshrn.s32 d21, q11, #15 + pld [V, #64] vrshrn.s32 d24, q12, #14 vrshrn.s32 d25, q13, #14 + vld1.8 {d4}, [U, :64]! vrshrn.s32 d28, q14, #14 vld1.8 {d5}, [V, :64]! vrshrn.s32 d29, q15, #14 - vaddw.u8 q10, q10, d0 - vaddw.u8 q12, q12, d0 - vaddw.u8 q14, q14, d0 - vqmovun.s16 d1\g_offs, q10 - vld1.8 {d0}, [Y, :64]! - vqmovun.s16 d1\r_offs, q12 - pld [U, #64] - pld [V, #64] - pld [Y, #64] - vqmovun.s16 d1\b_offs, q14 vaddw.u8 q3, q1, d4 /* q3 = u - 128 */ vaddw.u8 q4, q1, d5 /* q2 = v - 128 */ - do_store \bpp, 8 + vaddw.u8 q11, q10, d0 vmull.s16 q10, d6, d1[1] /* multiply by -11277 */ vmlal.s16 q10, d8, d1[2] /* multiply by -23401 */ + vaddw.u8 q12, q12, d0 + vaddw.u8 q14, q14, d0 +.if \bpp != 16 /**************** rgb24/rgb32 *********************************/ + vqmovun.s16 d1\g_offs, q11 + pld [Y, #64] + vqmovun.s16 d1\r_offs, q12 + vld1.8 {d0}, [Y, :64]! + vqmovun.s16 d1\b_offs, q14 vmull.s16 q11, d7, d1[1] /* multiply by -11277 */ vmlal.s16 q11, d9, d1[2] /* multiply by -23401 */ + do_store \bpp, 8 vmull.s16 q12, d8, d1[0] /* multiply by 22971 */ vmull.s16 q13, d9, d1[0] /* multiply by 22971 */ vmull.s16 q14, d6, d1[3] /* multiply by 29033 */ vmull.s16 q15, d7, d1[3] /* multiply by 29033 */ +.else /**************************** rgb565 ***********************************/ + vqshlu.s16 q13, q11, #8 + pld [Y, #64] + vqshlu.s16 q15, q12, #8 + vqshlu.s16 q14, q14, #8 + vld1.8 {d0}, [Y, :64]! + vmull.s16 q11, d7, d1[1] + vmlal.s16 q11, d9, d1[2] + vsri.u16 q15, q13, #5 + vmull.s16 q12, d8, d1[0] + vsri.u16 q15, q14, #11 + vmull.s16 q13, d9, d1[0] + vmull.s16 q14, d6, d1[3] + do_store \bpp, 8 + vmull.s16 q15, d7, d1[3] +.endif .endm .macro do_yuv_to_rgb @@ -1556,6 +1597,7 @@ generate_jsimd_ycc_rgb_convert_neon extrgbx, 32, 0, 1, 2 generate_jsimd_ycc_rgb_convert_neon extbgrx, 32, 2, 1, 0 generate_jsimd_ycc_rgb_convert_neon extxbgr, 32, 3, 2, 1 generate_jsimd_ycc_rgb_convert_neon extxrgb, 32, 1, 2, 3 +generate_jsimd_ycc_rgb_convert_neon rgb565, 16, 0, 0, 0 .purgem do_load .purgem do_store diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c index c173e740..25d06974 100644 --- a/simd/jsimd_i386.c +++ b/simd/jsimd_i386.c @@ -2,7 +2,7 @@ * jsimd_i386.c * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011, 2013 D. R. Commander + * Copyright 2009-2011, 2013-2014 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -130,6 +130,12 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -280,6 +286,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, mmxfct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { diff --git a/simd/jsimd_mips.c b/simd/jsimd_mips.c index e95023a2..abcd19f5 100644 --- a/simd/jsimd_mips.c +++ b/simd/jsimd_mips.c @@ -2,7 +2,7 @@ * jsimd_mips.c * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011 D. R. Commander + * Copyright 2009-2011, 2014 D. R. Commander * Copyright (C) 2013-2014, MIPS Technologies, Inc., California * * Based on the x86 SIMD extension for IJG JPEG library, @@ -161,6 +161,12 @@ jsimd_can_ycc_rgb (void) return 0; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + return 0; +} + GLOBAL(int) jsimd_c_can_null_convert (void) { @@ -299,6 +305,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, num_rows); } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + GLOBAL(void) jsimd_c_null_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c index 87c9d56f..2c47a7f3 100644 --- a/simd/jsimd_x86_64.c +++ b/simd/jsimd_x86_64.c @@ -2,7 +2,7 @@ * jsimd_x86_64.c * * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright 2009-2011 D. R. Commander + * Copyright 2009-2011, 2014 D. R. Commander * * Based on the x86 SIMD extension for IJG JPEG library, * Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -80,6 +80,12 @@ jsimd_can_ycc_rgb (void) return 1; } +GLOBAL(int) +jsimd_can_ycc_rgb565 (void) +{ + return 0; +} + GLOBAL(void) jsimd_rgb_ycc_convert (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, @@ -194,6 +200,13 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows); } +GLOBAL(void) +jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ +} + GLOBAL(int) jsimd_can_h2v2_downsample (void) { From a92d31df00356b7756643f13c98ca81c1cd2fa7a Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 23 Aug 2014 15:57:38 +0000 Subject: [PATCH 980/985] ARM64 NEON SIMD support for YCC-to-RGB565 conversion git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1386 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jsimd_arm64.c | 16 ++++++++++- simd/jsimd_arm_neon_64.S | 57 ++++++++++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/simd/jsimd_arm64.c b/simd/jsimd_arm64.c index a346d165..65724cb9 100644 --- a/simd/jsimd_arm64.c +++ b/simd/jsimd_arm64.c @@ -98,6 +98,17 @@ jsimd_can_ycc_rgb (void) GLOBAL(int) jsimd_can_ycc_rgb565 (void) { + init_simd(); + + /* The code is optimised for these values only */ + if (BITS_IN_JSAMPLE != 8) + return 0; + if (sizeof(JDIMENSION) != 4) + return 0; + + if (simd_support & JSIMD_ARM_NEON) + return 1; + return 0; } @@ -145,7 +156,7 @@ jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, case JCS_EXT_ARGB: neonfct=jsimd_ycc_extxrgb_convert_neon; break; - default: + default: neonfct=jsimd_ycc_extrgb_convert_neon; break; } @@ -159,6 +170,9 @@ jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) { + if (simd_support & JSIMD_ARM_NEON) + jsimd_ycc_rgb565_convert_neon(cinfo->output_width, input_buf, input_row, + output_buf, num_rows); } GLOBAL(int) diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index b0ba4801..0ef770a7 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -4,7 +4,7 @@ * Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Author: Siarhei Siamashka - * Copyright (C) 2013, Linaro Limited + * Copyright (C) 2013-2014, Linaro Limited * Author: Ragesh Radhakrishnan * * This software is provided 'as-is', without any express or implied @@ -1576,7 +1576,20 @@ asm_function jsimd_idct_2x2_neon .else .error unsupported macroblock size .endif - .else + .elseif \bpp==16 + .if \size == 8 + st1 {v25.8h}, [RGB],16 + .elseif \size == 4 + st1 {v25.4h}, [RGB],8 + .elseif \size == 2 + st1 {v25.h}[4], [RGB],2 + st1 {v25.h}[5], [RGB],2 + .elseif \size == 1 + st1 {v25.h}[6], [RGB],2 + .else + .error unsupported macroblock size + .endif + .else .error unsupported bpp .endif .endm @@ -1610,24 +1623,33 @@ asm_function jsimd_idct_2x2_neon uaddw v20.8h, v20.8h, v0.8b uaddw v24.8h, v24.8h, v0.8b uaddw v28.8h, v28.8h, v0.8b +.if \bpp != 16 sqxtun v1\g_offs\defsize, v20.8h sqxtun v1\r_offs\defsize, v24.8h sqxtun v1\b_offs\defsize, v28.8h +.else + sqshlu v21.8h, v20.8h, #8 + sqshlu v25.8h, v24.8h, #8 + sqshlu v29.8h, v28.8h, #8 + sri v25.8h, v21.8h, #5 + sri v25.8h, v29.8h, #11 +.endif .endm .macro do_yuv_to_rgb_stage2_store_load_stage1 - ld1 {v4.8b}, [U], 8 rshrn v20.4h, v20.4s, #15 - rshrn2 v20.8h, v22.4s, #15 rshrn v24.4h, v24.4s, #14 - rshrn2 v24.8h, v26.4s, #14 rshrn v28.4h, v28.4s, #14 - ld1 {v5.8b}, [V], 8 + ld1 {v4.8b}, [U], 8 + rshrn2 v20.8h, v22.4s, #15 + rshrn2 v24.8h, v26.4s, #14 rshrn2 v28.8h, v30.4s, #14 + ld1 {v5.8b}, [V], 8 uaddw v20.8h, v20.8h, v0.8b uaddw v24.8h, v24.8h, v0.8b uaddw v28.8h, v28.8h, v0.8b +.if \bpp != 16 /**************** rgb24/rgb32 *********************************/ sqxtun v1\g_offs\defsize, v20.8h ld1 {v0.8b}, [Y], 8 sqxtun v1\r_offs\defsize, v24.8h @@ -1637,13 +1659,32 @@ asm_function jsimd_idct_2x2_neon sqxtun v1\b_offs\defsize, v28.8h uaddw v6.8h, v2.8h, v4.8b /* v6.16b = u - 128 */ uaddw v8.8h, v2.8h, v5.8b /* q2 = v - 128 */ - do_store \bpp, 8 smull v20.4s, v6.4h, v1.4h[1] /* multiply by -11277 */ smlal v20.4s, v8.4h, v1.4h[2] /* multiply by -23401 */ smull2 v22.4s, v6.8h, v1.4h[1] /* multiply by -11277 */ smlal2 v22.4s, v8.8h, v1.4h[2] /* multiply by -23401 */ smull v24.4s, v8.4h, v1.4h[0] /* multiply by 22971 */ smull2 v26.4s, v8.8h, v1.4h[0] /* multiply by 22971 */ +.else /**************************** rgb565 ***********************************/ + sqshlu v21.8h, v20.8h, #8 + sqshlu v25.8h, v24.8h, #8 + sqshlu v29.8h, v28.8h, #8 + uaddw v6.8h, v2.8h, v4.8b /* v6.16b = u - 128 */ + uaddw v8.8h, v2.8h, v5.8b /* q2 = v - 128 */ + ld1 {v0.8b}, [Y], 8 + smull v20.4s, v6.4h, v1.4h[1] /* multiply by -11277 */ + smlal v20.4s, v8.4h, v1.4h[2] /* multiply by -23401 */ + smull2 v22.4s, v6.8h, v1.4h[1] /* multiply by -11277 */ + smlal2 v22.4s, v8.8h, v1.4h[2] /* multiply by -23401 */ + sri v25.8h, v21.8h, #5 + smull v24.4s, v8.4h, v1.4h[0] /* multiply by 22971 */ + smull2 v26.4s, v8.8h, v1.4h[0] /* multiply by 22971 */ + prfm PLDL1KEEP, [U, #64] + prfm PLDL1KEEP, [V, #64] + prfm PLDL1KEEP, [Y, #64] + sri v25.8h, v29.8h, #11 +.endif + do_store \bpp, 8 smull v28.4s, v6.4h, v1.4h[3] /* multiply by 29033 */ smull2 v30.4s, v6.8h, v1.4h[3] /* multiply by 29033 */ .endm @@ -1812,6 +1853,6 @@ generate_jsimd_ycc_rgb_convert_neon extrgbx, 32, 0, .4h, 1, .4h, 2, .4h, . generate_jsimd_ycc_rgb_convert_neon extbgrx, 32, 2, .4h, 1, .4h, 0, .4h, .8b generate_jsimd_ycc_rgb_convert_neon extxbgr, 32, 3, .4h, 2, .4h, 1, .4h, .8b generate_jsimd_ycc_rgb_convert_neon extxrgb, 32, 1, .4h, 2, .4h, 3, .4h, .8b - +generate_jsimd_ycc_rgb_convert_neon rgb565, 16, 0, .4h, 0, .4h, 0, .4h, .8b .purgem do_load .purgem do_store From fe0750f0d2880f15151cd2f17892040bf0ac6638 Mon Sep 17 00:00:00 2001 From: DRC Date: Sat, 23 Aug 2014 17:48:17 +0000 Subject: [PATCH 981/985] Clarify forward compatibility of iOS/ARM builds git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1387 632fc199-4ca6-4c93-a231-07263d6284db --- BUILDING.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 13835a1f..5b5b7a49 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -349,17 +349,17 @@ Set the following shell variables for simplicity: Xcode 5.0.x and later: IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - ARM v6 only (up to and including iPhone 3G): + ARM v6 (code will run on all iOS devices, not SIMD-accelerated): [NOTE: Requires Xcode 4.4.x or earlier] IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp" - ARM v7 only (iPhone 3GS-4S, iPad 1st-3rd Generation): + ARM v7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer): Xcode 4.6.x and earlier: IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon" Xcode 5.0.x and later: IOS_CFLAGS="-arch armv7" - ARM v7s only (iPhone 5, iPad 4th Generation): + ARM v7s (code will run on iPhone 5/iPad 4th Generation and newer): [NOTE: Requires Xcode 4.5 or later] Xcode 4.6.x and earlier: IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon" From 33a4b3d40039b75a6b4338f8c186cfb34a8d9138 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 25 Aug 2014 15:26:09 +0000 Subject: [PATCH 982/985] Reformat code per Siarhei's original patch (to clearly indicate that the offset instructions are completely independent) and add Siarhei as an individual author (he no longer works for Nokia.) git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1388 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jsimd_arm_neon.S | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/simd/jsimd_arm_neon.S b/simd/jsimd_arm_neon.S index 7e8e134c..4d9685b0 100644 --- a/simd/jsimd_arm_neon.S +++ b/simd/jsimd_arm_neon.S @@ -4,6 +4,7 @@ * Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Author: Siarhei Siamashka + * Copyright (C) 2014 Siarhei Siamashka. All Rights Reserved. * Copyright (C) 2014 Linaro Limited. All Rights Reserved. * * This software is provided 'as-is', without any express or implied @@ -1408,52 +1409,52 @@ asm_function jsimd_idct_2x2_neon .endm .macro do_yuv_to_rgb_stage2_store_load_stage1 - /* "do_yuv_to_rgb_stage2" and "store" */ - vrshrn.s32 d20, q10, #15 + /* "do_yuv_to_rgb_stage2" and "store" */ + vrshrn.s32 d20, q10, #15 /* "load" and "do_yuv_to_rgb_stage1" */ pld [U, #64] - vrshrn.s32 d21, q11, #15 + vrshrn.s32 d21, q11, #15 pld [V, #64] - vrshrn.s32 d24, q12, #14 - vrshrn.s32 d25, q13, #14 + vrshrn.s32 d24, q12, #14 + vrshrn.s32 d25, q13, #14 vld1.8 {d4}, [U, :64]! - vrshrn.s32 d28, q14, #14 + vrshrn.s32 d28, q14, #14 vld1.8 {d5}, [V, :64]! - vrshrn.s32 d29, q15, #14 + vrshrn.s32 d29, q15, #14 vaddw.u8 q3, q1, d4 /* q3 = u - 128 */ vaddw.u8 q4, q1, d5 /* q2 = v - 128 */ - vaddw.u8 q11, q10, d0 + vaddw.u8 q11, q10, d0 vmull.s16 q10, d6, d1[1] /* multiply by -11277 */ vmlal.s16 q10, d8, d1[2] /* multiply by -23401 */ - vaddw.u8 q12, q12, d0 - vaddw.u8 q14, q14, d0 + vaddw.u8 q12, q12, d0 + vaddw.u8 q14, q14, d0 .if \bpp != 16 /**************** rgb24/rgb32 *********************************/ - vqmovun.s16 d1\g_offs, q11 + vqmovun.s16 d1\g_offs, q11 pld [Y, #64] - vqmovun.s16 d1\r_offs, q12 + vqmovun.s16 d1\r_offs, q12 vld1.8 {d0}, [Y, :64]! - vqmovun.s16 d1\b_offs, q14 + vqmovun.s16 d1\b_offs, q14 vmull.s16 q11, d7, d1[1] /* multiply by -11277 */ vmlal.s16 q11, d9, d1[2] /* multiply by -23401 */ - do_store \bpp, 8 + do_store \bpp, 8 vmull.s16 q12, d8, d1[0] /* multiply by 22971 */ vmull.s16 q13, d9, d1[0] /* multiply by 22971 */ vmull.s16 q14, d6, d1[3] /* multiply by 29033 */ vmull.s16 q15, d7, d1[3] /* multiply by 29033 */ .else /**************************** rgb565 ***********************************/ - vqshlu.s16 q13, q11, #8 + vqshlu.s16 q13, q11, #8 pld [Y, #64] - vqshlu.s16 q15, q12, #8 - vqshlu.s16 q14, q14, #8 + vqshlu.s16 q15, q12, #8 + vqshlu.s16 q14, q14, #8 vld1.8 {d0}, [Y, :64]! vmull.s16 q11, d7, d1[1] vmlal.s16 q11, d9, d1[2] - vsri.u16 q15, q13, #5 + vsri.u16 q15, q13, #5 vmull.s16 q12, d8, d1[0] - vsri.u16 q15, q14, #11 + vsri.u16 q15, q14, #11 vmull.s16 q13, d9, d1[0] vmull.s16 q14, d6, d1[3] - do_store \bpp, 8 + do_store \bpp, 8 vmull.s16 q15, d7, d1[3] .endif .endm From a1cea09935b632e07050e1c0e6176d282ad13fdc Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 29 Aug 2014 01:49:59 +0000 Subject: [PATCH 983/985] Fix several mathematical issues discovered in the ARM64 NEON code while running the extended regression tests introduced in r1267. Specific comments can be found in the original patches: https://sourceforge.net/p/libjpeg-turbo/patches/64/ git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1389 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jsimd_arm_neon_64.S | 61 +++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm_neon_64.S index 0ef770a7..f488b0f1 100644 --- a/simd/jsimd_arm_neon_64.S +++ b/simd/jsimd_arm_neon_64.S @@ -35,7 +35,6 @@ #define RESPECT_STRICT_ALIGNMENT 1 - /*****************************************************************************/ /* Supplementary macro for setting function attributes */ @@ -363,6 +362,7 @@ asm_function jsimd_idct_islow_neon orr x0, x0, x4 add v4.4s, v10.4s, v12.4s orr x0, x0, x5 + cmp x0, #0 /* orrs instruction removed */ sub v2.4s, v10.4s, v12.4s add v12.4s, v4.4s, v14.4s ldp w4, w5, [COEF_BLOCK, #(-96 + 2 * (4 + 0 * 8))] @@ -377,7 +377,6 @@ asm_function jsimd_idct_islow_neon rshrn ROW3L.4h, v10.4s, #11 rshrn ROW0L.4h, v12.4s, #11 rshrn ROW4L.4h, v6.4s, #11 - cmp x0, #0 /* orrs instruction removed */ beq 3f /* Go to do some special handling for the sparse right 4x8 half */ @@ -439,7 +438,7 @@ asm_function jsimd_idct_islow_neon add v12.4s, v4.4s, v14.4s sub v4.4s, v4.4s, v14.4s add v10.4s, v2.4s, v8.4s - sub v12.4s, v2.4s, v8.4s + sub v6.4s, v2.4s, v8.4s rshrn ROW7R.4h, v4.4s, #11 rshrn ROW3R.4h, v10.4s, #11 rshrn ROW0R.4h, v12.4s, #11 @@ -1220,7 +1219,7 @@ asm_function jsimd_idct_4x4_neon mul v12.4h, v12.4h, v26.4h mul v13.4h, v13.4h, v27.4h ins v12.2d[1], v13.2d[0] /* 128 bit q12 */ - ld1 {v30.8h}, [DCT_TABLE], 16 + ld1 {v30.4h, v31.4h}, [DCT_TABLE], 16 mul v14.4h, v14.4h, v28.4h mul v15.4h, v15.4h, v29.4h ins v14.2d[1], v15.2d[0] /* 128 bit q14 */ @@ -1327,17 +1326,17 @@ asm_function jsimd_idct_4x4_neon .balign 8 jsimd_idct_2x2_neon_consts: - .short -FIX_0_720959822 /* d0[0] */ - .short FIX_0_850430095 /* d0[1] */ - .short -FIX_1_272758580 /* d0[2] */ - .short FIX_3_624509785 /* d0[3] */ + .short -FIX_0_720959822 /* v14[0] */ + .short FIX_0_850430095 /* v14[1] */ + .short -FIX_1_272758580 /* v14[2] */ + .short FIX_3_624509785 /* v14[3] */ .macro idct_helper x4, x6, x10, x12, x16, shift, y26, y27 sshll v15.4s, \x4, #15 - smull v26.4s, \x6, v0.4h[3] - smlal v26.4s, \x10, v0.4h[2] - smlal v26.4s, \x12, v0.4h[1] - smlal v26.4s, \x16, v0.4h[0] + smull v26.4s, \x6, v14.4h[3] + smlal v26.4s, \x10, v14.4h[2] + smlal v26.4s, \x12, v14.4h[1] + smlal v26.4s, \x16, v14.4h[0] add v20.4s, v15.4s, v26.4s sub v15.4s, v15.4s, v26.4s @@ -1399,26 +1398,26 @@ asm_function jsimd_idct_2x2_neon ld1 {v16.4h, v17.4h}, [COEF_BLOCK], 16 /* Dequantize */ ld1 {v18.4h, v19.4h, v20.4h, v21.4h}, [DCT_TABLE], 32 - mul v4.8h, v4.8h, v18.8h - mul v5.8h, v5.8h, v18.8h + mul v4.4h, v4.4h, v18.4h + mul v5.4h, v5.4h, v19.4h ins v4.2d[1], v5.2d[0] - mul v6.8h, v6.8h, v20.8h - mul v7.8h, v7.8h, v21.8h + mul v6.4h, v6.4h, v20.4h + mul v7.4h, v7.4h, v21.4h ins v6.2d[1], v7.2d[0] add DCT_TABLE, DCT_TABLE, #16 ld1 {v24.4h, v25.4h}, [DCT_TABLE], 16 - mul v10.8h, v10.8h, v24.8h - mul v11.8h, v11.8h, v25.8h + mul v10.4h, v10.4h, v24.4h + mul v11.4h, v11.4h, v25.4h ins v10.2d[1], v11.2d[0] add DCT_TABLE, DCT_TABLE, #16 ld1 {v26.4h, v27.4h}, [DCT_TABLE], 16 - mul v12.8h, v12.8h, v26.8h - mul v13.8h, v13.8h, v27.8h + mul v12.4h, v12.4h, v26.4h + mul v13.4h, v13.4h, v27.4h ins v12.2d[1], v13.2d[0] add DCT_TABLE, DCT_TABLE, #16 ld1 {v30.4h, v31.4h}, [DCT_TABLE], 16 - mul v16.8h, v16.8h, v30.8h - mul v17.8h, v17.8h, v31.8h + mul v16.4h, v16.4h, v30.4h + mul v17.4h, v17.4h, v31.4h ins v16.2d[1], v17.2d[0] /* Pass 1 */ @@ -1446,8 +1445,12 @@ asm_function jsimd_idct_2x2_neon sub v15.4s, v30.4s, v24.4s rshrn v5.4h, v20.4s, #13 rshrn v7.4h, v15.4s, #13 + ins v4.2d[1], v5.2d[0] + ins v6.2d[1], v7.2d[0] transpose v4, v6, v3, .16b, .8h transpose v6, v10, v3, .16b, .4s + ins v11.2d[0], v10.2d[1] + ins v7.2d[0], v6.2d[1] #endif /* Pass 2 */ @@ -1515,11 +1518,11 @@ asm_function jsimd_idct_2x2_neon prfm PLDL1KEEP, [V, #64] prfm PLDL1KEEP, [Y, #64] .elseif \size == 4 - ld1 {v4.b}[0], [U] - ld1 {v4.b}[1], [U] - ld1 {v4.b}[2], [U] - ld1 {v4.b}[3], [U] - ld1 {v5.b}[0], [V] + ld1 {v4.b}[0], [U], 1 + ld1 {v4.b}[1], [U], 1 + ld1 {v4.b}[2], [U], 1 + ld1 {v4.b}[3], [U], 1 + ld1 {v5.b}[0], [V], 1 ld1 {v5.b}[1], [V], 1 ld1 {v5.b}[2], [V], 1 ld1 {v5.b}[3], [V], 1 @@ -1554,7 +1557,7 @@ asm_function jsimd_idct_2x2_neon st3 {v10.b, v11.b, v12.b}[3], [RGB], 3 .elseif \size == 2 st3 {v10.b, v11.b, v12.b}[4], [RGB], 3 - st3 {v10.b, v11.b, v12.b}[4], [RGB], 3 + st3 {v10.b, v11.b, v12.b}[5], [RGB], 3 .elseif \size == 1 st3 {v10.b, v11.b, v12.b}[6], [RGB], 3 .else @@ -1751,7 +1754,7 @@ asm_function jsimd_ycc_\colorid\()_convert_neon /* Initially set v10, v11.4h, v12.8b, d13 to 0xFF */ movi v10.16b, #255 - movi v12.16b, #255 + movi v13.16b, #255 /* Outer loop over scanlines */ cmp NUM_ROWS, #1 From 2ef1bec37fc35ffeaa833eabcd968bb7da2beb81 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 29 Aug 2014 01:53:17 +0000 Subject: [PATCH 984/985] Rename the ARM64 assembly file to match the C file git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1390 632fc199-4ca6-4c93-a231-07263d6284db --- simd/Makefile.am | 2 +- simd/{jsimd_arm_neon_64.S => jsimd_arm64_neon.S} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename simd/{jsimd_arm_neon_64.S => jsimd_arm64_neon.S} (100%) diff --git a/simd/Makefile.am b/simd/Makefile.am index 72d6366a..9605e68d 100644 --- a/simd/Makefile.am +++ b/simd/Makefile.am @@ -60,7 +60,7 @@ endif if SIMD_ARM_64 -libsimd_la_SOURCES = jsimd_arm64.c jsimd_arm_neon_64.S +libsimd_la_SOURCES = jsimd_arm64.c jsimd_arm64_neon.S endif diff --git a/simd/jsimd_arm_neon_64.S b/simd/jsimd_arm64_neon.S similarity index 100% rename from simd/jsimd_arm_neon_64.S rename to simd/jsimd_arm64_neon.S From 9f785697e4c575f0dc02596b4e82dbff6ec5a0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Sun, 7 Sep 2014 20:46:14 +0100 Subject: [PATCH 985/985] Script for git-svn reinitialization --- .gitauthors | 7 +++++++ git-init-svn.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .gitauthors create mode 100755 git-init-svn.sh diff --git a/.gitauthors b/.gitauthors new file mode 100644 index 00000000..7b724b5e --- /dev/null +++ b/.gitauthors @@ -0,0 +1,7 @@ + +dcommander = DRC +astrand = Peter Åstrand +ossman_ = Pierre Ossman +const_k = Constantin Kaplinsky +atkac = Adam Tkac + diff --git a/git-init-svn.sh b/git-init-svn.sh new file mode 100755 index 00000000..786d775e --- /dev/null +++ b/git-init-svn.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +# Make a local, clean libjpeg-turbo branch that tracks the remote libjpeg-turbo. +# This will allow pushing of imported libjpeg-turbo commits to the mozjpeg repository. +# The libjpeg-turbo branch must only contain imported SVN commits (with git-svn-id: in the message). +git branch -f -t libjpeg-turbo origin/libjpeg-turbo + +# Configure git-svn. "git svn fetch" will rebuild remaining git-svn metadata. +git config svn-remote.svn.url svn://svn.code.sf.net/p/libjpeg-turbo/code +git config svn-remote.svn.fetch trunk:refs/heads/libjpeg-turbo + +# Enable mapping of SVN usernames to git authors. +git config svn.authorsfile .gitauthors + +# Mark which libjpeg-turbo commit has been used to start mozjpeg. +# Required for accurate merging and blame. +echo > .git/info/grafts "72b66f9c77b3e4ae363b21e48145f635cec0b193 540789427ccae8e9e778151cbc16ab8ee88ac6a8" + +# To get changes from SVN: +# git svn fetch +# git push origin libjpeg-turbo +# +# To merge SVN changes with mozjpeg: +# git checkout master +# git merge libjpeg-turbo